G_TYPE_BOOLEAN, 2,
GTK_TYPE_MENU_SHELL, KATZE_TYPE_ITEM);
+ /**
+ * KatzeArrayAction::activate-item:
+ * @array: the object on which the signal is emitted
+ * @item: the item being activated
+ *
+ * An item was clicked with the first button.
+ *
+ * Deprecated: 0.2.8: Use "activate-item-alt" instead.
+ **/
signals[ACTIVATE_ITEM] = g_signal_new ("activate-item",
G_TYPE_FROM_CLASS (class),
(GSignalFlags) (G_SIGNAL_RUN_LAST),
* @item: the item being activated
* @button: the mouse button pressed
*
- * An item was clicked with a particular button. Use this if you need
- * to handle middle or right clicks specially.
+ * An item was clicked, with the specified @button.
*
* Return value: %TRUE if the event was handled. If %FALSE is returned,
* the default "activate-item" signal is emitted.
GTK_ACTION_CLASS (katze_array_action_parent_class)->activate (action);
}
+static void
+katze_array_action_activate_item (KatzeArrayAction* action,
+ KatzeItem* item,
+ gint button)
+{
+ gboolean handled = FALSE;
+ g_signal_emit (action, signals[ACTIVATE_ITEM_ALT], 0, item,
+ button, &handled);
+ if (!handled)
+ g_signal_emit (action, signals[ACTIVATE_ITEM], 0, item);
+}
+
static void
katze_array_action_menu_activate_cb (GtkWidget* proxy,
KatzeArrayAction* array_action)
{
KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
- g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
+ katze_array_action_activate_item (array_action, item, 1);
}
static gboolean
KatzeArrayAction* array_action)
{
KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
- gboolean handled;
-
- g_signal_emit (array_action, signals[ACTIVATE_ITEM_ALT], 0, item,
- event->button, &handled);
- if (!handled)
- g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
+ katze_array_action_activate_item (array_action, item, event->button);
/* we need to block the 'activate' handler which would be called
* otherwise as well */
array = (KatzeArray*)g_object_get_data (G_OBJECT (proxy), "KatzeArray");
if (KATZE_IS_ITEM (array) && katze_item_get_uri ((KatzeItem*)array))
{
- g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, array);
+ katze_array_action_activate_item (array_action, KATZE_ITEM (array), 1);
return;
}
_midori_browser_set_statusbar_text (browser, NULL);
}
-static void
-midori_bookmarkbar_activate_item (GtkAction* action,
- KatzeItem* item,
- MidoriBrowser* browser)
-{
- midori_browser_open_bookmark (browser, item);
-}
-
static gboolean
midori_bookmarkbar_activate_item_alt (GtkAction* action,
KatzeItem* item,
guint button,
MidoriBrowser* browser)
{
- if (button == 2)
+ if (button == 1)
+ {
+ midori_browser_open_bookmark (browser, item);
+ }
+ else 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;
+ return TRUE;
}
static void
gtk_widget_show (menuitem);
}
-static void
-_action_trash_activate_item (GtkAction* action,
- KatzeItem* item,
- MidoriBrowser* browser)
-{
- guint n = midori_browser_add_item (browser, item);
- midori_browser_set_current_page (browser, n);
- katze_array_remove_item (browser->trash, item);
- _midori_browser_update_actions (browser);
-}
-
static gboolean
_action_trash_activate_item_alt (GtkAction* action,
KatzeItem* item,
guint button,
MidoriBrowser* browser)
{
- if (button == 2)
+ if (button == 1)
{
- gint n = midori_browser_add_uri (browser, katze_item_get_uri (item));
+ guint n = midori_browser_add_item (browser, item);
+ midori_browser_set_current_page (browser, n);
+ katze_array_remove_item (browser->trash, item);
+ _midori_browser_update_actions (browser);
+ }
+ else if (button == 2)
+ {
+ gint n = midori_browser_add_item (browser, item);
midori_browser_set_current_page_smartly (browser, n);
katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser);
- return TRUE;
}
- return FALSE;
+ return TRUE;
}
/* static */ void
}
static void
-_action_window_activate_item (GtkAction* action,
- KatzeItem* item,
- MidoriBrowser* browser)
+_action_window_activate_item_alt (GtkAction* action,
+ KatzeItem* item,
+ gint button,
+ MidoriBrowser* browser)
{
- guint i, n;
- GtkWidget* view;
+ guint i;
+ guint n = katze_array_get_length (browser->proxy_array);
- n = katze_array_get_length (browser->proxy_array);
for (i = 0; i < n; i++)
{
+ GtkWidget* view;
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), i);
if (midori_view_get_proxy_item (MIDORI_VIEW (view)) == item)
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), i);
g_object_connect (action,
"signal::populate-popup",
_action_trash_populate_popup, browser,
- "signal::activate-item",
- _action_trash_activate_item, browser,
"signal::activate-item-alt",
_action_trash_activate_item_alt, browser,
NULL);
g_object_connect (action,
"signal::populate-folder",
_action_bookmarks_populate_folder, browser,
- "signal::activate-item",
- midori_bookmarkbar_activate_item, browser,
"signal::activate-item-alt",
midori_bookmarkbar_activate_item_alt, browser,
NULL);
g_object_connect (action,
"signal::populate-popup",
_action_tools_populate_popup, browser,
- "signal::activate-item",
- midori_bookmarkbar_activate_item, browser,
"signal::activate-item-alt",
midori_bookmarkbar_activate_item_alt, browser,
NULL);
g_object_connect (action,
"signal::populate-popup",
_action_window_populate_popup, browser,
- "signal::activate-item",
- _action_window_activate_item, browser,
+ "signal::activate-item-alt",
+ _action_window_activate_item_alt, browser,
NULL);
gtk_action_group_add_action_with_accel (browser->action_group, action, "");
g_object_unref (action);