fixing double calling functions from contextmenu.
authorEnno Boland (tox) <tox@s01.de>
Sat, 17 Oct 2009 06:57:23 +0000 (08:57 +0200)
committerEnno Boland (tox) <tox@s01.de>
Sat, 17 Oct 2009 06:57:23 +0000 (08:57 +0200)
surf.c

diff --git a/surf.c b/surf.c
index 016610b..37d457e 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -187,8 +187,6 @@ context(WebKitWebView *v, GtkMenu *m, Client *c) {
                if(parent)
                        gtk_container_remove(parent, c->items[i]);
                gtk_menu_shell_append(GTK_MENU_SHELL(m), c->items[i]);
-               g_signal_connect(G_OBJECT(c->items[i]), "activate",
-                               G_CALLBACK(itemclick), c);
                gtk_widget_show(c->items[i]);
        }
 }
@@ -459,8 +457,11 @@ newclient(void) {
                die("Cannot malloc!\n");
 
        /* contextmenu */
-       for(i = 0; i < LENGTH(items); i++)
+       for(i = 0; i < LENGTH(items); i++) {
                c->items[i] = gtk_menu_item_new_with_label(items[i].label);
+               g_signal_connect(G_OBJECT(c->items[i]), "activate",
+                               G_CALLBACK(itemclick), c);
+       }
 
 
        /* VBox */