MidoriBrowser* browser,
MidoriExtension* extension);
+static gboolean
+secondary_icon_released_cb (GtkAction* action,
+ GtkWidget* widget,
+ FeedPrivate* priv);
+
static void
feed_deactivate_cb (MidoriExtension* extension,
FeedPrivate* priv)
if (priv)
{
MidoriApp* app = midori_extension_get_app (extension);
+ GtkActionGroup* action_group;
+ GtkAction* action;
+
+ action_group = midori_browser_get_action_group (priv->browser);
+ action = gtk_action_group_get_action (action_group, "Location");
+ g_signal_handlers_disconnect_by_func (action,
+ secondary_icon_released_cb, priv);
g_signal_handlers_disconnect_by_func (app,
feed_app_add_browser_cb, extension);
return TRUE;
}
-static void
+static gboolean
secondary_icon_released_cb (GtkAction* action,
GtkWidget* widget,
FeedPrivate* priv)
{
- const gchar* uri;
+ GtkWidget* view;
g_assert (KATZE_IS_ARRAY (priv->feeds));
- uri = midori_location_action_get_uri (MIDORI_LOCATION_ACTION (action));
+ if (gtk_window_get_focus (GTK_WINDOW (priv->browser)) == widget)
+ return FALSE;
- if (uri && *uri)
+ if ((view = midori_browser_get_current_tab (priv->browser)))
{
- KatzeArray* feed;
+ const gchar* uri;
- feed = feed_add_item (priv->feeds, uri);
- if (feed)
+ uri = g_object_get_data (G_OBJECT (view), "news-feeds");
+ if (uri && *uri)
{
- feed_save_items (priv->extension, priv->feeds);
- update_feed (priv, KATZE_ITEM (feed));
+ KatzeArray* feed;
+
+ if ((feed = feed_add_item (priv->feeds, uri)))
+ {
+ /* FIXME: Let the user know that a feed was added */
+ feed_save_items (priv->extension, priv->feeds);
+ update_feed (priv, KATZE_ITEM (feed));
+ return TRUE;
+ }
}
}
+
+ return FALSE;
}
static void
gtk_widget_grab_focus (midori_browser_get_current_tab (browser));
}
-static void
+static gboolean
_action_location_secondary_icon_released (GtkAction* action,
GtkWidget* widget,
MidoriBrowser* browser)
}
else
_action_location_submit_uri (action, uri, FALSE, browser);
+ return TRUE;
}
+
+ return FALSE;
}
static void
_action_location_reset_uri, browser,
"signal::submit-uri",
_action_location_submit_uri, browser,
- "signal::secondary-icon-released",
+ "signal-after::secondary-icon-released",
_action_location_secondary_icon_released, browser,
NULL);
gtk_action_group_add_action_with_accel (browser->action_group,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ /**
+ * MidoriLocationAction:secondary-icon-released:
+ *
+ * The secondary-icon-released signal is emitted when the mouse button
+ * is released above the secondary icon.
+ *
+ * Since 0.1.10 a signal handler can return %TRUE to stop signal
+ * emission, for instance to suppress default behavior.
+ */
signals[SECONDARY_ICON_RELEASED] = g_signal_new ("secondary-icon-released",
G_TYPE_FROM_CLASS (class),
(GSignalFlags) (G_SIGNAL_RUN_LAST),
0,
- 0,
+ g_signal_accumulator_true_handled,
NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
+ midori_cclosure_marshal_BOOLEAN__OBJECT,
+ G_TYPE_BOOLEAN, 1,
GTK_TYPE_WIDGET);
signals[RESET_URI] = g_signal_new ("reset-uri",