]> spindle.queued.net Git - midori/commitdiff
Always show news feed icon, and show URI if no aggregator was specified
authorChristian Dywan <christian@twotoasts.de>
Fri, 14 Aug 2009 21:28:18 +0000 (23:28 +0200)
committerChristian Dywan <christian@twotoasts.de>
Fri, 14 Aug 2009 21:28:18 +0000 (23:28 +0200)
midori/midori-browser.c
midori/midori-view.c

index fd2dbca265863a25c0b38119624fa26b9767f1ec..56736771fdb083ab27ce7ec7f91839fb948e003b 100644 (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"))
-            sokoke_spawn_program (browser->news_aggregator, uri, TRUE);
+        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);
     }
index 812a6cd1a511fb4e7d46e25dbf9ba7e346ccf0e5..f7b2248e62a6c2788e152f4f5ddfc92b1445a757 100644 (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");