/* called when unselecting the item or unloading the item list */ static void itemlist_check_for_deferred_action (void) { gulong id = itemlist->priv->selectedId; itemPtr item; if (id) { itemlist_set_selected (NULL); /* check for removals caused by itemlist filter rule */ if (itemlist->priv->deferredFilter) { itemlist->priv->deferredFilter = FALSE; item = item_load (id); itemview_remove_item (item); feed_list_node_update (item->nodeId); } /* check for removals caused by vfolder rules */ if (itemlist->priv->deferredRemove) { itemlist->priv->deferredRemove = FALSE; item = item_load (id); itemlist_remove_item (item); } } }
static void subscription_favicon_downloaded (gpointer user_data) { nodePtr node = (nodePtr)user_data; node_set_icon (node, favicon_load_from_cache (node->id)); feed_list_node_update (node->id); }
static void on_nodenamedialog_response (GtkDialog *dialog, gint response_id, gpointer user_data) { nodePtr node = (nodePtr)user_data; if (response_id == GTK_RESPONSE_OK) { node_set_title (node, (gchar *) gtk_entry_get_text (GTK_ENTRY (liferea_dialog_lookup (GTK_WIDGET (dialog), "nameentry")))); feed_list_node_update (node->id); feedlist_schedule_save (); } gtk_widget_destroy (GTK_WIDGET (dialog)); nodenamedialog = NULL; }
void node_update_counters (nodePtr node) { guint oldUnreadCount = node->unreadCount; guint oldItemCount = node->itemCount; /* Update the node itself and its children */ node_calc_counters (node); if ((oldUnreadCount != node->unreadCount) || (oldItemCount != node->itemCount)) feed_list_node_update (node->id); /* Update the unread count of the parent nodes, usually they just add all child unread counters */ if (!IS_VFOLDER (node)) node_update_parent_counters (node->parent); }
static void node_update_parent_counters (nodePtr node) { guint old; if (!node) return; old = node->unreadCount; NODE_TYPE (node)->update_counters (node); if (old != node->unreadCount) { feed_list_node_update (node->id); feedlist_new_items (0); /* add 0 new items, as 'new-items' signal updates unread items also */ } if (node->parent) node_update_parent_counters (node->parent); }
void feed_list_node_add (nodePtr node) { gint position; GtkTreeIter *iter, *parentIter = NULL; debug2 (DEBUG_GUI, "adding node \"%s\" as child of parent=\"%s\"", node_get_title(node), (NULL != node->parent)?node_get_title(node->parent):"feed list root"); g_assert (NULL != node->parent); g_assert (NULL == feed_list_node_to_iter (node->id)); /* if parent is NULL we have the root folder and don't create a new row! */ iter = (GtkTreeIter *)g_new0 (GtkTreeIter, 1); /* if reduced feedlist, show flat treeview */ if (feedlist_reduced_unread) parentIter = NULL; else if (node->parent != feedlist_get_root ()) parentIter = feed_list_node_to_iter (node->parent->id); position = g_slist_index (node->parent->children, node); if (feedlist_reduced_unread || position < 0) gtk_tree_store_append (feedstore, iter, parentIter); else gtk_tree_store_insert (feedstore, iter, parentIter, position); gtk_tree_store_set (feedstore, iter, FS_PTR, node, -1); feed_list_node_add_iter (node->id, iter); feed_list_node_update (node->id); if (node->parent != feedlist_get_root ()) feed_list_node_check_if_folder_is_empty (node->parent->id); if (IS_FOLDER (node)) feed_list_node_check_if_folder_is_empty (node->id); }
void feed_list_node_remove_node (nodePtr node) { GtkTreeIter *iter; gboolean parentExpanded = FALSE; iter = feed_list_node_to_iter (node->id); if (!iter) return; /* must be tolerant because of DnD handling */ if (node->parent) parentExpanded = feed_list_node_is_expanded (node->parent->id); /* If the folder becomes empty, the folder would collapse */ gtk_tree_store_remove (feedstore, iter); g_hash_table_remove (flIterHash, node->id); if (node->parent) { feed_list_node_check_if_folder_is_empty (node->parent->id); if (parentExpanded) feed_list_node_set_expansion (node->parent, TRUE); feed_list_node_update (node->parent->id); } }
void feed_list_node_update (const gchar *nodeId) { GtkTreeIter *iter; gchar *label, *count = NULL; guint labeltype; nodePtr node; static gchar *countColor = NULL; node = node_from_id (nodeId); iter = feed_list_node_to_iter (nodeId); if (!iter) return; /* Initialize unread item color Pango CSS */ if (!countColor) { const gchar *bg = NULL, *fg = NULL; bg = render_get_theme_color ("FEEDLIST_UNREAD_BG"); fg = render_get_theme_color ("FEEDLIST_UNREAD_FG"); if (fg && bg) { countColor = g_strdup_printf ("foreground='#%s' background='#%s'", fg, bg); debug1 (DEBUG_HTML, "Feed list unread CSS: %s\n", countColor); } } labeltype = NODE_TYPE (node)->capabilities; labeltype &= (NODE_CAPABILITY_SHOW_UNREAD_COUNT | NODE_CAPABILITY_SHOW_ITEM_COUNT); if (node->unreadCount == 0 && (labeltype & NODE_CAPABILITY_SHOW_UNREAD_COUNT)) labeltype -= NODE_CAPABILITY_SHOW_UNREAD_COUNT; label = g_markup_escape_text (node_get_title (node), -1); switch (labeltype) { case NODE_CAPABILITY_SHOW_UNREAD_COUNT | NODE_CAPABILITY_SHOW_ITEM_COUNT: /* treat like show unread count */ case NODE_CAPABILITY_SHOW_UNREAD_COUNT: count = g_strdup_printf ("<span weight='bold' %s> %u </span>", countColor?countColor:"", node->unreadCount); break; case NODE_CAPABILITY_SHOW_ITEM_COUNT: count = g_strdup_printf ("<span weight='bold' %s> %u </span>", countColor?countColor:"", node->itemCount); break; default: break; } /* Extra message for search folder rebuilds */ if (IS_VFOLDER (node) && node->data) { if (((vfolderPtr)node->data)->reloading) { gchar *tmp = label; label = g_strdup_printf (_("%s\n<i>Rebuilding</i>"), label); g_free (tmp); } } gtk_tree_store_set (feedstore, iter, FS_LABEL, label, FS_UNREAD, node->unreadCount, FS_ICON, node->available?node_get_icon (node):icon_get (ICON_UNAVAILABLE), FS_COUNT, count, -1); g_free (label); if (node->parent) feed_list_node_update (node->parent->id); }
static void on_propdialog_response (GtkDialog *dialog, gint response_id, gpointer user_data) { SubscriptionPropDialog *spd = (SubscriptionPropDialog *)user_data; if(response_id == GTK_RESPONSE_OK) { gchar *newSource; const gchar *newFilter; gboolean needsUpdate = FALSE; subscriptionPtr subscription = spd->priv->subscription; nodePtr node = spd->priv->subscription->node; feedPtr feed = (feedPtr)node->data; if (SUBSCRIPTION_TYPE(subscription) == feed_get_subscription_type ()) { /* "General" */ node_set_title(node, gtk_entry_get_text(GTK_ENTRY(spd->priv->feedNameEntry))); /* Source */ newSource = ui_subscription_dialog_decode_source(spd->priv); /* Filter handling */ newFilter = gtk_entry_get_text(GTK_ENTRY(liferea_dialog_lookup(spd->priv->dialog, "filterEntry"))); if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(liferea_dialog_lookup(spd->priv->dialog, "filterCheckbox"))) && strcmp(newFilter,"")) { /* Maybe this should be a test to see if the file exists? */ if(subscription_get_filter(subscription) == NULL || strcmp(newFilter, subscription_get_filter(subscription))) { subscription_set_filter(subscription, newFilter); needsUpdate = TRUE; } } else { if(subscription_get_filter(subscription)) { subscription_set_filter(subscription, NULL); needsUpdate = TRUE; } } /* if URL has changed... */ if(strcmp(newSource, subscription_get_source(subscription))) { subscription_set_source(subscription, newSource); needsUpdate = TRUE; } g_free(newSource); /* Update interval handling */ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "updateIntervalNever")))) subscription_set_update_interval (subscription, -2); else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "updateIntervalDefault")))) subscription_set_update_interval (subscription, -1); else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "updateIntervalSpecific")))) { gint intervalUnit = gtk_combo_box_get_active (GTK_COMBO_BOX (spd->priv->refreshIntervalUnit)); gint updateInterval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spd->priv->refreshInterval)); if (intervalUnit == 1) updateInterval *= 60; /* hours */ if (intervalUnit == 2) updateInterval *= 1440; /* days */ subscription_set_update_interval (subscription, updateInterval); db_subscription_update (subscription); } } /* "Archive" handling */ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(liferea_dialog_lookup(GTK_WIDGET(dialog), "feedCacheDefault")))) feed->cacheLimit = CACHE_DEFAULT; else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(liferea_dialog_lookup(GTK_WIDGET(dialog), "feedCacheDisable")))) feed->cacheLimit = CACHE_DISABLE; else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(liferea_dialog_lookup(GTK_WIDGET(dialog), "feedCacheUnlimited")))) feed->cacheLimit = CACHE_UNLIMITED; else if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(liferea_dialog_lookup(GTK_WIDGET(dialog), "feedCacheLimited")))) feed->cacheLimit = gtk_spin_button_get_value(GTK_SPIN_BUTTON(liferea_dialog_lookup(GTK_WIDGET(dialog), "cacheItemLimit"))); if (SUBSCRIPTION_TYPE(subscription) == feed_get_subscription_type ()) { /* "Download" Options */ subscription->updateOptions->dontUseProxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(liferea_dialog_lookup(GTK_WIDGET(dialog), "dontUseProxyCheck"))); } /* "Advanced" options */ feed->encAutoDownload = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "enclosureDownloadCheck"))); node->loadItemLink = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "loadItemLinkCheck"))); feed->ignoreComments = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "ignoreCommentFeeds"))); feed->markAsRead = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "markAsReadCheck"))); feed_list_node_update (node->id); feedlist_schedule_save (); db_subscription_update (subscription); if (needsUpdate) subscription_update (subscription, FEED_REQ_PRIORITY_HIGH); } g_object_unref(spd); }