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);
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 (
+ "<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);
-
- 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);
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);
}
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;
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");