]> spindle.queued.net Git - midori/commitdiff
Don't bother to counter browser and also unref the array
authorChristian Dywan <christian@twotoasts.de>
Sat, 6 Jun 2009 23:31:49 +0000 (01:31 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sat, 6 Jun 2009 23:31:49 +0000 (01:31 +0200)
extensions/mouse-gestures/main.c

index 2d9bd02e27ec624d037ccc3ff546402a921e0bc6..1e8707b7eb916e80d88c645a0c680d506877be82 100644 (file)
@@ -177,32 +177,25 @@ static void mouse_gestures_browser_cb (MidoriApp *app, MidoriBrowser *browser)
 static void mouse_gestures_deactivate (MidoriExtension *extension, MidoriApp *app)
 {
     gulong signal_id;
-    KatzeArray *browsers;
+    KatzeArray* browsers;
+    MidoriBrowser* browser;
     guint i;
-    gint j;
-    GtkWidget *notebook;
 
-    signal_id =
-        g_signal_handler_find (app, G_SIGNAL_MATCH_FUNC,
-                               0, 0, NULL,
-                               mouse_gestures_browser_cb, NULL);
+    signal_id = g_signal_handler_find (app, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
+                                       mouse_gestures_browser_cb, NULL);
 
-    if(signal_id != 0)
+    if (signal_id != 0)
         g_signal_handler_disconnect (app, signal_id);
 
     browsers = katze_object_get_object (app, "browsers");
-
-    for (i = 0; i < katze_array_get_length (browsers); i++)
+    i = 0;
+    while ((browser = katze_array_get_nth_item (browsers, i++)))
     {
-        MidoriBrowser *browser;
-
-        browser = katze_array_get_nth_item (browsers, i);
-
-        signal_id =
-            g_signal_handler_find (browser, G_SIGNAL_MATCH_FUNC,
-                                   0, 0, NULL,
-                                   mouse_gestures_tab_cb, NULL);
+        gint j;
+        GtkWidget* notebook;
 
+        signal_id = g_signal_handler_find (browser, G_SIGNAL_MATCH_FUNC,
+            0, 0, NULL, mouse_gestures_tab_cb, NULL);
         if (signal_id != 0)
             g_signal_handler_disconnect (browser, signal_id);
 
@@ -212,15 +205,14 @@ static void mouse_gestures_deactivate (MidoriExtension *extension, MidoriApp *ap
         {
             GtkWidget *page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), j);
 
-            signal_id =
-                g_signal_handler_find (page, G_SIGNAL_MATCH_FUNC,
-                                       0, 0, NULL,
-                                       mouse_gestures_handle_events, NULL);
+            signal_id = g_signal_handler_find (page, G_SIGNAL_MATCH_FUNC,
+                0, 0, NULL, mouse_gestures_handle_events, NULL);
 
             if (signal_id != 0)
                 g_signal_handler_disconnect (page, signal_id);
         }
     }
+    g_object_unref (browsers);
 
     g_signal_handlers_disconnect_by_func (extension, mouse_gestures_deactivate, app);
     g_free (gesture);