Display feed URLs and show an icon instead of error dialogues

This commit is contained in:
Dale Whittaker 2009-04-27 20:58:30 +02:00 committed by Christian Dywan
parent 6d2013f16f
commit 129f7d8f77
2 changed files with 56 additions and 59 deletions

View file

@ -89,9 +89,17 @@ feed_panel_treeview_render_icon_cb (GtkTreeViewColumn* column,
pitem = item;
uri = katze_item_get_uri (pitem);
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,24 +347,31 @@ 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))
{
gint64 date;
SoupDate* sdate;
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 (
"<html><head><title>feed</title></head>"
"<body><h3>%s</h3><p />Last updated %s.</body></html>",
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);
@ -374,7 +389,6 @@ feed_panel_cursor_or_row_changed_cb (GtkTreeView* treeview,
}
g_object_unref (item);
}
}
if (GTK_IS_WIDGET (panel->delete))
gtk_widget_set_sensitive (panel->delete, sensitive);
}

View file

@ -141,28 +141,12 @@ static void
feed_handle_net_error (FeedNetPrivate* netpriv,
const gchar* msg)
{
GtkWidget* dialog;
const gchar* uri;
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;
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,8 +190,7 @@ 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))
{
KatzeArray* parent;
@ -220,7 +203,6 @@ feed_transfer_cb (KatzeNetRequest* request,
else
feed_set_flags (netpriv->feed, 0);
}
}
netpriv->parsers = NULL;
netpriv->feed = 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");