void on_remove_items_activate (GtkMenuItem *menuitem, gpointer user_data) { nodePtr node; node = feedlist_get_selected (); // FIXME: use node type capability check if (node && (IS_FEED (node) || IS_NEWSBIN (node))) itemlist_remove_all_items (node); else ui_show_error_box (_("You must select a feed to delete its items!")); }
static void notif_libnotify_callback_open (NotifyNotification *n, gchar *action, gpointer user_data) { nodePtr node_p; g_assert(action != NULL); g_assert(strcmp(action, "open") == 0); node_p = node_from_id (user_data); if (node_p) feed_list_view_select (node_p); else ui_show_error_box (_("This feed does not exist anymore!")); notify_notification_close (n, NULL); liferea_shell_present (); }
void on_popup_launchitem_in_tab_selected (void) { itemPtr item; gchar *link; item = itemlist_get_selected (); if (item) { link = item_make_link (item); if (link) { browser_tabs_add_new (link, link, FALSE); g_free (link); } else ui_show_error_box (_("This item has no link specified!")); item_unload (item); } else { liferea_shell_set_important_status_bar (_("No item has been selected")); } }
static void notif_libnotify_callback_mark_read (NotifyNotification *n, gchar *action, gpointer user_data) { nodePtr node; g_assert (action != NULL); g_assert (strcmp (action, "mark_read") == 0); node = node_from_id (user_data); if (node) { feedlist_mark_all_read (node); feedlist_reset_new_item_count (); item_state_set_all_popup (node->id); } else { ui_show_error_box (_("This feed does not exist anymore!")); } notify_notification_close (n, NULL); }
static void notif_libnotify_callback_show_details (NotifyNotification *n, gchar *action, gpointer user_data) { nodePtr node_p; GList *list_p; itemPtr item_p; gchar *labelText_p; gchar *labelText_now_p = NULL; gchar *labelText_prev_p; gchar *labelHeadline_p; const gchar *labelURL_p; gint item_count = 0; g_assert (action != NULL); g_assert (strcmp(action, "show_details") == 0); node_p = node_from_id (user_data); if (node_p) { itemSetPtr itemSet = node_get_itemset (node_p); labelText_now_p = g_strdup (""); /* Gather the feed's headlines */ list_p = itemSet->ids; while (list_p) { item_p = item_load (GPOINTER_TO_UINT (list_p->data)); if (item_p->popupStatus && !item_p->readStatus) { item_p->popupStatus = FALSE; item_count += 1; labelHeadline_p = g_strdup (item_get_title (item_p)); if (labelHeadline_p == NULL ) { labelHeadline_p = g_strdup_printf (_("This news entry has no headline")); } labelURL_p = item_get_base_url (item_p); if (labelURL_p) { labelText_p = g_strdup_printf ("%s <a href='%s'>%s</a>\n", labelHeadline_p, labelURL_p, _("Visit")); } else { labelText_p = g_strdup_printf ("%s\n", labelHeadline_p); } labelText_prev_p = labelText_now_p; labelText_now_p = g_strconcat(labelText_now_p, labelText_p, NULL); g_free(labelHeadline_p); g_free(labelText_p); g_free(labelText_prev_p); } item_unload (item_p); list_p = g_list_next (list_p); } itemset_free (itemSet); if (item_count == 0) { g_free (labelText_now_p); return; } } else { ui_show_error_box(_("This feed does not exist anymore!")); } notify_notification_close (n, NULL); if (node_p) { // notify_notification_update ( n, node_get_title(node_p), labelText_now_p, NULL); // notify_notification_clear_actions(n); n = notify_notification_new (node_get_title (node_p), labelText_now_p, NULL, NULL); notify_notification_set_icon_from_pixbuf (n, node_get_icon (node_p)); notify_notification_set_category (n, "feed"); notify_notification_set_timeout (n, NOTIFY_EXPIRES_NEVER); if (supports_actions) { notify_notification_add_action (n, "open", _("Open feed"), (NotifyActionCallback)notif_libnotify_callback_open, node_p->id, NULL); notify_notification_add_action (n, "mark_read", _("Mark all as read"), (NotifyActionCallback)notif_libnotify_callback_mark_read, node_p->id, NULL); } notify_notification_attach_to_status_icon (n, ui_tray_get_status_icon ()); if (!notify_notification_show (n, NULL)) { g_warning ("libnotify.c - failed to update notification via libnotify\n"); } g_free (labelText_now_p); } }