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); }
void on_action_mark_all_read (GSimpleAction *action, GVariant *parameter, gpointer user_data) { nodePtr feedlist; gboolean confirm_mark_read; gboolean do_mark_read = TRUE; if (!g_strcmp0 (g_action_get_name (G_ACTION (action)), "mark-all-feeds-read")) feedlist = feedlist_get_root (); else if (user_data) feedlist = (nodePtr) user_data; else feedlist = feedlist_get_selected (); conf_get_bool_value (CONFIRM_MARK_ALL_READ, &confirm_mark_read); if (confirm_mark_read) { gint result; GtkMessageDialog *confirm_dialog = GTK_MESSAGE_DIALOG (liferea_dialog_new ("mark_read_dialog")); GtkWidget *dont_ask_toggle = liferea_dialog_lookup (GTK_WIDGET (confirm_dialog), "dontAskAgainToggle"); const gchar *feed_title = (feedlist_get_root () == feedlist) ? _("all feeds"):node_get_title (feedlist); gchar *primary_message = g_strdup_printf (_("Mark %s as read ?"), feed_title); g_object_set (confirm_dialog, "text", primary_message, NULL); g_free (primary_message); gtk_message_dialog_format_secondary_text (confirm_dialog, _("Are you sure you want to mark all items in %s as read ?"), feed_title); conf_bind (CONFIRM_MARK_ALL_READ, dont_ask_toggle, "active", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN); result = gtk_dialog_run (GTK_DIALOG (confirm_dialog)); if (result != GTK_RESPONSE_OK) do_mark_read = FALSE; gtk_widget_destroy (GTK_WIDGET (confirm_dialog)); } if (do_mark_read) feedlist_mark_all_read (feedlist); }