_action_back_activate (GtkAction* action,
MidoriBrowser* browser)
{
+ if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
+ {
+ g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
+ return;
+ }
+
GtkWidget* view = midori_browser_get_current_tab (browser);
if (view)
midori_view_go_back (MIDORI_VIEW (view));
_action_forward_activate (GtkAction* action,
MidoriBrowser* browser)
{
+ if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
+ {
+ g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
+ return;
+ }
+
GtkWidget* view = midori_browser_get_current_tab (browser);
if (view)
midori_view_go_forward (MIDORI_VIEW (view));
_action_homepage_activate (GtkAction* action,
MidoriBrowser* browser)
{
+ if (g_object_get_data (G_OBJECT (action), "midori-middle-click"))
+ {
+ g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)0);
+ return;
+ }
+
gchar* homepage;
if (!browser->settings)
name = gtk_action_get_name (action);
+ /* We use a trick here to implement middle click and prevent the default
+ "activate" callback from being invoked. We set "midori-middle-click"
+ as GObject data and check the value in the "activate" callback. */
+
if (g_str_equal (name, "Homepage"))
{
gint n;
n = midori_browser_add_uri (browser, homepage);
_midori_browser_set_current_page_smartly (browser, n);
+ g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)1);
+
return TRUE;
}
else if (g_str_equal (name, "Back"))
n = midori_browser_add_uri (browser, back_uri);
_midori_browser_set_current_page_smartly (browser, n);
+ g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)1);
+
return TRUE;
}
else if (g_str_equal (name, "Forward"))
n = midori_browser_add_uri (browser, forward_uri);
_midori_browser_set_current_page_smartly (browser, n);
+ g_object_set_data (G_OBJECT (action), "midori-middle-click", (void*)1);
+
return TRUE;
}