void feedlist_selection_changed (nodePtr node) { debug_enter ("feedlist_selection_changed"); debug1 (DEBUG_GUI, "new selected node: %s", node?node_get_title (node):"none"); if (node != SELECTED) { /* When the user selects a feed in the feed list we assume that he got notified of the new items or isn't interested in the event anymore... */ if (0 != feedlist->priv->newCount) feedlist_reset_new_item_count (); /* Unload visible items. */ itemlist_unload (TRUE); /* Load items of new selected node. */ SELECTED = node; if (SELECTED) { itemlist_set_view_mode (node_get_view_mode (SELECTED)); itemlist_load (SELECTED); } else { itemview_clear (); } } debug_exit ("feedlist_selection_changed"); }
void item_read_state_changed (itemPtr item, gboolean newState) { nodePtr node; debug_start_measurement (DEBUG_GUI); /* 1. set values in memory */ item->readStatus = newState; item->updateStatus = FALSE; /* 2. propagate to vfolders */ vfolder_foreach_data (vfolder_merge_item, item); vfolder_foreach (node_update_counters); /* 3. apply to DB */ db_item_state_update (item); /* 4. update item list GUI state */ itemlist_update_item (item); /* 5. updated feed list unread counters */ node = node_from_id (item->nodeId); node_update_counters (node); /* 6. update notification statistics */ feedlist_reset_new_item_count (); /* 7. duplicate state propagation */ if (item->validGuid) { GSList *duplicates, *iter; duplicates = iter = db_item_get_duplicates (item->sourceId); while (iter) { itemPtr duplicate = item_load (GPOINTER_TO_UINT (iter->data)); /* The check on node_from_id() is an evil workaround to handle "lost" items in the DB that have no associated node in the feed list. This should be fixed by having the feed list in the DB too, so we can clean up correctly after crashes. */ if (duplicate && duplicate->id != item->id && node_from_id (duplicate->nodeId)) { item_set_read_state (duplicate, newState); } if (duplicate) item_unload (duplicate); iter = g_slist_next (iter); } g_slist_free (duplicates); } debug_end_measurement (DEBUG_GUI, "set read status"); }
void feedlist_mark_all_read (nodePtr node) { if (!node) return; feedlist_reset_new_item_count (); if (node != ROOTNODE) node_mark_all_read (node); else node_foreach_child (ROOTNODE, node_mark_all_read); feedlist_foreach (feedlist_update_node_counters); itemview_update_all_items (); itemview_update (); }
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 item_flag_state_changed (itemPtr item, gboolean newState) { /* 1. set value in memory */ item->flagStatus = newState; /* 2. propagate to vfolders */ vfolder_foreach_data (vfolder_merge_item, item); vfolder_foreach (node_update_counters); /* 3. save state to DB */ db_item_state_update (item); /* 4. update item list GUI state */ itemlist_update_item (item); /* 5. update notification statistics */ feedlist_reset_new_item_count (); /* no duplicate state propagation to avoid copies in the "Important" search folder */ }