Implement activate-item(-alt) for bookmarkbar mouse buttons
This commit is contained in:
parent
9a098e2656
commit
f764f25747
1 changed files with 33 additions and 17 deletions
|
@ -2651,6 +2651,30 @@ midori_browser_menu_item_deselect_cb (GtkWidget* menuitem,
|
||||||
_midori_browser_set_statusbar_text (browser, NULL);
|
_midori_browser_set_statusbar_text (browser, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_bookmarkbar_activate_item (GtkAction* action,
|
||||||
|
KatzeItem* item,
|
||||||
|
MidoriBrowser* browser)
|
||||||
|
{
|
||||||
|
midori_browser_set_current_uri (browser, katze_item_get_uri (item));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
midori_bookmarkbar_activate_item_alt (GtkAction* action,
|
||||||
|
KatzeItem* item,
|
||||||
|
guint button,
|
||||||
|
MidoriBrowser* browser)
|
||||||
|
{
|
||||||
|
if (button == 2)
|
||||||
|
{
|
||||||
|
gint n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
||||||
|
midori_browser_set_current_page_smartly (browser, n);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_action_trash_populate_popup (GtkAction* action,
|
_action_trash_populate_popup (GtkAction* action,
|
||||||
GtkMenu* menu,
|
GtkMenu* menu,
|
||||||
|
@ -2697,15 +2721,10 @@ _action_trash_activate_item_alt (GtkAction* action,
|
||||||
{
|
{
|
||||||
if (button == 2)
|
if (button == 2)
|
||||||
{
|
{
|
||||||
gint n;
|
gint n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
||||||
|
|
||||||
n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
|
||||||
|
|
||||||
midori_browser_set_current_page_smartly (browser, n);
|
midori_browser_set_current_page_smartly (browser, n);
|
||||||
|
|
||||||
katze_array_remove_item (browser->trash, item);
|
katze_array_remove_item (browser->trash, item);
|
||||||
_midori_browser_update_actions (browser);
|
_midori_browser_update_actions (browser);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5668,6 +5687,10 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
g_object_connect (action,
|
g_object_connect (action,
|
||||||
"signal::populate-popup",
|
"signal::populate-popup",
|
||||||
_action_tools_populate_popup, browser,
|
_action_tools_populate_popup, browser,
|
||||||
|
"signal::activate-item",
|
||||||
|
midori_bookmarkbar_activate_item, browser,
|
||||||
|
"signal::activate-item-alt",
|
||||||
|
midori_bookmarkbar_activate_item_alt, browser,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_action_group_add_action (browser->action_group, action);
|
gtk_action_group_add_action (browser->action_group, action);
|
||||||
g_object_unref (action);
|
g_object_unref (action);
|
||||||
|
@ -6284,17 +6307,12 @@ midori_bookmarkbar_item_button_press_event_cb (GtkWidget* toolitem,
|
||||||
item = (KatzeItem*)g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
|
item = (KatzeItem*)g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
|
||||||
if (event->button == 2)
|
if (event->button == 2)
|
||||||
{
|
{
|
||||||
if (katze_item_get_uri (item))
|
if (KATZE_ITEM_IS_BOOKMARK (item))
|
||||||
{
|
{
|
||||||
n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
||||||
midori_browser_set_current_page_smartly (browser, n);
|
midori_browser_set_current_page_smartly (browser, n);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* FIXME: This is a folder and we need to popup a menu */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (event->button == 3)
|
else if (event->button == 3)
|
||||||
{
|
{
|
||||||
|
@ -6308,12 +6326,10 @@ static void
|
||||||
midori_bookmarkbar_insert_item (GtkWidget* toolbar,
|
midori_bookmarkbar_insert_item (GtkWidget* toolbar,
|
||||||
KatzeItem* item)
|
KatzeItem* item)
|
||||||
{
|
{
|
||||||
GtkToolItem* toolitem;
|
|
||||||
|
|
||||||
MidoriBrowser* browser = midori_browser_get_for_widget (toolbar);
|
MidoriBrowser* browser = midori_browser_get_for_widget (toolbar);
|
||||||
|
GtkAction* action = _action_by_name (browser, "Tools");
|
||||||
toolitem = katze_array_action_create_tool_item_for (
|
GtkToolItem* toolitem = katze_array_action_create_tool_item_for (
|
||||||
KATZE_ARRAY_ACTION (_action_by_name (browser, "Tools")), item);
|
KATZE_ARRAY_ACTION (action), item);
|
||||||
g_object_set_data (G_OBJECT (toolitem), "KatzeItem", item);
|
g_object_set_data (G_OBJECT (toolitem), "KatzeItem", item);
|
||||||
|
|
||||||
if (KATZE_IS_ITEM (item))
|
if (KATZE_IS_ITEM (item))
|
||||||
|
|
Loading…
Reference in a new issue