[Xfce4-commits] <midori:master> Implement middle click on the bookmark button in the bookmarkbar

Christian Dywan noreply at xfce.org
Mon Dec 7 21:18:01 CET 2009


Updating branch refs/heads/master
         to 88b720295f218487bd2ff855a3ad01d20b3899b9 (commit)
       from 47514c180ee2f1450417508aae25551db87c3ca0 (commit)

commit 88b720295f218487bd2ff855a3ad01d20b3899b9
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Dec 7 21:14:10 2009 +0100

    Implement middle click on the bookmark button in the bookmarkbar

 midori/midori-browser.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 88d204a..92769fd 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -3565,6 +3565,26 @@ midori_browser_bookmark_homepage_clicked_cb (GtkToolItem*   button,
     gtk_widget_grab_focus (midori_browser_get_current_tab (browser));
 }
 
+static gboolean
+midori_browser_bookmark_homepage_button_press_cb (GtkToolItem*    button,
+                                                  GdkEventButton* event,
+                                                  MidoriBrowser*  browser)
+{
+    if (event->button == 2)
+    {
+        gchar* homepage;
+        guint n;
+
+        g_object_get (browser->settings, "homepage", &homepage, NULL);
+        n = midori_browser_add_uri (browser, homepage);
+        g_free (homepage);
+        _midori_browser_set_current_page_smartly (browser, n);
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
 static void
 browser_bookmarks_add_item_cb (KatzeArray* array,
                                KatzeItem*  item,
@@ -5908,6 +5928,8 @@ midori_browser_init (MidoriBrowser* browser)
     gtk_widget_show (GTK_WIDGET (browser->homepage));
     g_signal_connect (browser->homepage, "clicked",
         G_CALLBACK (midori_browser_bookmark_homepage_clicked_cb), browser);
+    g_signal_connect (gtk_bin_get_child (GTK_BIN (browser->homepage)), "button-press-event",
+        G_CALLBACK (midori_browser_bookmark_homepage_button_press_cb), browser);
     gtk_toolbar_insert (GTK_TOOLBAR (browser->bookmarkbar), browser->homepage, -1);
     #if HAVE_HILDON
     hildon_window_add_toolbar (HILDON_WINDOW (browser),



More information about the Xfce4-commits mailing list