deprecating signal “populate-popup” for “context-menu”

Signed-off-by: Christoph Lohmann <20h@r-36.net>
This commit is contained in:
Quentin Rameau 2014-02-07 02:17:43 +01:00 committed by Christoph Lohmann
parent 618c3dfd52
commit a8267f7b95
1 changed files with 14 additions and 11 deletions

23
surf.c
View File

@ -148,8 +148,9 @@ static void navigate(Client *c, const Arg *arg);
static Client *newclient(void); static Client *newclient(void);
static void newwindow(Client *c, const Arg *arg, gboolean noembed); static void newwindow(Client *c, const Arg *arg, gboolean noembed);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
static void populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c); static gboolean contextmenu(WebKitWebView *view, GtkWidget *menu,
static void popupactivate(GtkMenuItem *menu, Client *); WebKitHitTestResult *target, gboolean keyboard, Client *c);
static void menuactivate(GtkMenuItem *item, Client *c);
static void print(Client *c, const Arg *arg); static void print(Client *c, const Arg *arg);
static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event, static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event,
gpointer d); gpointer d);
@ -781,8 +782,8 @@ newclient(void) {
"button-release-event", "button-release-event",
G_CALLBACK(buttonrelease), c); G_CALLBACK(buttonrelease), c);
g_signal_connect(G_OBJECT(c->view), g_signal_connect(G_OBJECT(c->view),
"populate-popup", "context-menu",
G_CALLBACK(populatepopup), c); G_CALLBACK(contextmenu), c);
g_signal_connect(G_OBJECT(c->view), g_signal_connect(G_OBJECT(c->view),
"resource-request-starting", "resource-request-starting",
G_CALLBACK(beforerequest), c); G_CALLBACK(beforerequest), c);
@ -945,19 +946,21 @@ newwindow(Client *c, const Arg *arg, gboolean noembed) {
spawn(NULL, &a); spawn(NULL, &a);
} }
static void static gboolean
populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c) { contextmenu(WebKitWebView *view, GtkWidget *menu, WebKitHitTestResult *target,
GList *items = gtk_container_get_children(GTK_CONTAINER(menu)); gboolean keyboard, Client *c) {
GList *items = gtk_container_get_children(GTK_CONTAINER(GTK_MENU(menu)));
for(GList *l = items; l; l = l->next) { for(GList *l = items; l; l = l->next) {
g_signal_connect(l->data, "activate", G_CALLBACK(popupactivate), c); g_signal_connect(l->data, "activate", G_CALLBACK(menuactivate), c);
} }
g_list_free(items); g_list_free(items);
return FALSE;
} }
static void static void
popupactivate(GtkMenuItem *menu, Client *c) { menuactivate(GtkMenuItem *item, Client *c) {
/* /*
* context-menu-action-2000 open link * context-menu-action-2000 open link
* context-menu-action-1 open link in window * context-menu-action-1 open link in window
@ -973,7 +976,7 @@ popupactivate(GtkMenuItem *menu, Client *c) {
const char *name; const char *name;
GtkClipboard *prisel; GtkClipboard *prisel;
a = gtk_activatable_get_related_action(GTK_ACTIVATABLE(menu)); a = gtk_activatable_get_related_action(GTK_ACTIVATABLE(item));
if(a == NULL) if(a == NULL)
return; return;