Always show news feed icon, and show URI if no aggregator was specified

This commit is contained in:
Christian Dywan 2009-08-14 23:28:18 +02:00
parent c17e8a2a9a
commit 74457cfd75
2 changed files with 21 additions and 5 deletions

View file

@ -3227,8 +3227,22 @@ _action_location_secondary_icon_released (GtkAction* action,
const gchar* uri = midori_view_get_display_uri (MIDORI_VIEW (view));
if (gtk_window_get_focus (GTK_WINDOW (browser)) == widget)
_action_location_submit_uri (action, uri, FALSE, browser);
else if (g_object_get_data (G_OBJECT (view), "news-feeds"))
else if ((uri = g_object_get_data (G_OBJECT (view), "news-feeds")))
{
if (browser->news_aggregator && *browser->news_aggregator)
sokoke_spawn_program (browser->news_aggregator, uri, TRUE);
else
{
GtkWidget* dialog = gtk_message_dialog_new (
GTK_WINDOW (browser), 0, GTK_MESSAGE_INFO,
GTK_BUTTONS_OK, "%s", _("New feed"));
gtk_message_dialog_format_secondary_text (
GTK_MESSAGE_DIALOG (dialog), "%s", uri);
gtk_widget_show (dialog);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), dialog);
}
}
else
_action_location_submit_uri (action, uri, FALSE, browser);
}

View file

@ -847,7 +847,7 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
g_object_notify (G_OBJECT (view), "progress");
midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
if (view->news_aggregator && *view->news_aggregator)
if (1)
{
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
/* This snippet joins the available news feeds into a string like this:
@ -861,6 +861,7 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
"feeds (document.getElementsByTagName ('link'))", NULL);
gchar** items = g_strsplit (value, ",", 0);
guint i = 0;
gchar* default_uri = NULL;
katze_array_clear (view->news_feeds);
if (items != NULL)
@ -873,12 +874,13 @@ webkit_web_view_load_finished_cb (WebKitWebView* web_view,
NULL);
katze_array_add_item (view->news_feeds, item);
g_object_unref (item);
if (!default_uri)
default_uri = g_strdup (parts ? *parts : NULL);
g_strfreev (parts);
i++;
}
g_strfreev (items);
g_object_set_data (G_OBJECT (view), "news-feeds",
value && *value ? (void*)1 : (void*)0);
g_object_set_data_full (G_OBJECT (view), "news-feeds", default_uri, g_free);
g_free (value);
/* Ensure load-status is notified again, whether it changed or not */
g_object_notify (G_OBJECT (view), "load-status");