From: Dale Whittaker Date: Mon, 27 Apr 2009 18:58:30 +0000 (+0200) Subject: Display feed URLs and show an icon instead of error dialogues X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=129f7d8f77431f2f8fb4ffea22e3d10c97c3fead;p=midori Display feed URLs and show an icon instead of error dialogues --- diff --git a/extensions/feed-panel/feed-panel.c b/extensions/feed-panel/feed-panel.c index 0abf8be6..1389e969 100644 --- a/extensions/feed-panel/feed-panel.c +++ b/extensions/feed-panel/feed-panel.c @@ -89,9 +89,17 @@ feed_panel_treeview_render_icon_cb (GtkTreeViewColumn* column, pitem = item; uri = katze_item_get_uri (pitem); - pixbuf = katze_net_load_icon (panel->net, uri, NULL, NULL, NULL); - if (!pixbuf) - pixbuf = panel->pixbuf; + if (uri) + { + pixbuf = katze_net_load_icon (panel->net, uri, NULL, NULL, NULL); + if (!pixbuf) + pixbuf = panel->pixbuf; + } + else + { + pixbuf = gtk_widget_render_icon (panel->treeview, + GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_MENU, NULL); + } g_object_set (renderer, "pixbuf", pixbuf, NULL); @@ -339,41 +347,47 @@ feed_panel_cursor_or_row_changed_cb (GtkTreeView* treeview, const gchar* text; gtk_tree_model_get (model, &iter, 0, &item, -1); - uri = katze_item_get_uri (item); - if (uri) + if (KATZE_IS_ARRAY (item)) { - if (KATZE_IS_ARRAY (item)) - { - gint64 date; - SoupDate* sdate; + gint64 date; - text = NULL; + text = NULL; + if (!uri) + text = g_strdup (katze_item_get_text (KATZE_ITEM (item))); + else + { date = katze_item_get_added (item); if (date) { + SoupDate* sdate; + const gchar* suri; sdate = soup_date_new_from_time_t ((time_t) date); - text = g_strdup_printf ("Last updated %s.", soup_date_to_string (sdate, SOUP_DATE_HTTP)); + suri = (const gchar*)g_object_get_data (G_OBJECT (item), "feeduri"); + text = g_strdup_printf ( + "feed" + "

%s

Last updated %s.", + suri, soup_date_to_string (sdate, SOUP_DATE_HTTP)); soup_date_free (sdate); } - webkit_web_view_load_html_string ( - WEBKIT_WEB_VIEW (panel->webview), text ? text : "", uri); - g_free ((gchar*) text); - - sensitive = TRUE; } - else + webkit_web_view_load_html_string ( + WEBKIT_WEB_VIEW (panel->webview), text ? text : "", uri); + g_free ((gchar*) text); + + sensitive = TRUE; + } + else + { + text = katze_item_get_text (item); + if (text) { - text = katze_item_get_text (item); - if (text) - { - webkit_web_view_load_html_string ( - WEBKIT_WEB_VIEW (panel->webview), text, uri); - } + webkit_web_view_load_html_string ( + WEBKIT_WEB_VIEW (panel->webview), text, uri); } - g_object_unref (item); } + g_object_unref (item); } if (GTK_IS_WIDGET (panel->delete)) gtk_widget_set_sensitive (panel->delete, sensitive); diff --git a/extensions/feed-panel/main.c b/extensions/feed-panel/main.c index e1c4d723..9f72973c 100644 --- a/extensions/feed-panel/main.c +++ b/extensions/feed-panel/main.c @@ -141,28 +141,12 @@ static void feed_handle_net_error (FeedNetPrivate* netpriv, const gchar* msg) { - GtkWidget* dialog; - - dialog = gtk_message_dialog_new ( - NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - _("Error")); - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - "%s", msg); - gtk_window_set_title (GTK_WINDOW (dialog), EXTENSION_NAME); - gtk_widget_show (dialog); - g_signal_connect_swapped (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); - - if (feed_has_flags (netpriv->feed, FEED_NEW)) - { - KatzeArray* parent; - KatzeItem* child; + const gchar* uri; - child = KATZE_ITEM (netpriv->feed); - parent = katze_item_get_parent (child); - katze_array_remove_item (parent, child); - feed_save_items (netpriv->extension, parent); - } + uri = (gchar*) g_object_get_data (G_OBJECT (netpriv->feed), "feeduri"); + katze_item_set_name (KATZE_ITEM (netpriv->feed), uri); + katze_item_set_text (KATZE_ITEM (netpriv->feed), msg); + katze_item_set_uri (KATZE_ITEM (netpriv->feed), NULL); feed_remove_flags (netpriv->feed, FEED_READ); } @@ -206,20 +190,18 @@ feed_transfer_cb (KatzeNetRequest* request, feed_handle_net_error (netpriv, error->message); g_error_free (error); } - else + + if (feed_has_flags (netpriv->feed, FEED_REMOVE)) { - if (feed_has_flags (netpriv->feed, FEED_REMOVE)) - { - KatzeArray* parent; - - /* deferred remove */ - parent = katze_item_get_parent (KATZE_ITEM (netpriv->feed)); - katze_array_remove_item (parent, netpriv->feed); - feed_save_items (netpriv->extension, parent); - } - else - feed_set_flags (netpriv->feed, 0); + KatzeArray* parent; + + /* deferred remove */ + parent = katze_item_get_parent (KATZE_ITEM (netpriv->feed)); + katze_array_remove_item (parent, netpriv->feed); + feed_save_items (netpriv->extension, parent); } + else + feed_set_flags (netpriv->feed, 0); } netpriv->parsers = NULL; @@ -415,6 +397,7 @@ feed_app_add_browser_cb (MidoriApp* app, update_feed (priv, KATZE_ITEM (feed)); } } + g_strdupv (sfeeds); action_group = midori_browser_get_action_group (browser); action = gtk_action_group_get_action (action_group, "Location");