]> spindle.queued.net Git - midori/commitdiff
Integrate Adblock preferences with extension list
authorAlexander Butenko <a.butenka@gmail.com>
Fri, 24 Jun 2011 21:55:08 +0000 (23:55 +0200)
committerChristian Dywan <christian@twotoasts.de>
Fri, 24 Jun 2011 21:55:08 +0000 (23:55 +0200)
extensions/adblock.c

index 8ec30fc3196d60ae412f523c3fe8b09411c7a6a4..395b8e9964d8e2405ae66063a301e86944ee500c 100644 (file)
@@ -199,10 +199,6 @@ adblock_reload_rules (MidoriExtension* extension,
     katze_assign (blockscript, adblock_build_js (blockcss->str, blockcssprivate->str));
 }
 
-static void
-adblock_browser_populate_tool_menu_cb (MidoriBrowser*   browser,
-                                       GtkWidget*       menu,
-                                       MidoriExtension* extension);
 static void
 adblock_preferences_render_tick_cb (GtkTreeViewColumn* column,
                                     GtkCellRenderer*   renderer,
@@ -568,8 +564,7 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
 }
 
 static void
-adblock_menu_configure_filters_activate_cb (GtkWidget*       menuitem,
-                                            MidoriExtension* extension)
+adblock_open_preferences_cb (MidoriExtension* extension)
 {
     static GtkWidget* dialog = NULL;
 
@@ -584,20 +579,6 @@ adblock_menu_configure_filters_activate_cb (GtkWidget*       menuitem,
         gtk_window_present (GTK_WINDOW (dialog));
 }
 
-static void
-adblock_browser_populate_tool_menu_cb (MidoriBrowser*   browser,
-                                       GtkWidget*       menu,
-                                       MidoriExtension* extension)
-{
-    GtkWidget* menuitem;
-
-    menuitem = gtk_menu_item_new_with_mnemonic (_("Configure _Advertisement filters..."));
-    g_signal_connect (menuitem, "activate",
-        G_CALLBACK (adblock_menu_configure_filters_activate_cb), extension);
-    gtk_widget_show (menuitem);
-    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-}
-
 static inline gboolean
 adblock_check_filter_options (GRegex*       regex,
                               const gchar*  opts,
@@ -989,8 +970,8 @@ adblock_app_add_browser_cb (MidoriApp*       app,
           (GtkCallback)adblock_add_tab_foreach_cb, extension);
     g_signal_connect (browser, "add-tab",
         G_CALLBACK (adblock_add_tab_cb), extension);
-    g_signal_connect (browser, "populate-tool-menu",
-        G_CALLBACK (adblock_browser_populate_tool_menu_cb), extension);
+    g_signal_connect (extension, "open-preferences",
+        G_CALLBACK (adblock_open_preferences_cb), extension);
     g_signal_connect (extension, "deactivate",
         G_CALLBACK (adblock_deactivate_cb), browser);
     g_object_unref (statusbar);
@@ -1318,7 +1299,7 @@ adblock_deactivate_cb (MidoriExtension* extension,
     MidoriApp* app = midori_extension_get_app (extension);
 
     g_signal_handlers_disconnect_by_func (
-        browser, adblock_browser_populate_tool_menu_cb, extension);
+        browser, adblock_open_preferences_cb, extension);
     g_signal_handlers_disconnect_by_func (
         extension, adblock_deactivate_cb, browser);
     g_signal_handlers_disconnect_by_func (