Exemplo n.º 1
0
static void
ui_update_find_requests (nodePtr node) {

	if (node->children)
		node_foreach_child (node, ui_update_find_requests);

	if (!node->subscription)
		return;
		
	if (node->subscription->updateJob) {
		if (REQUEST_STATE_PROCESSING == update_job_get_state (node->subscription->updateJob)) {
			ui_update_merge_request (node, um1store, um1hash);
			ui_update_remove_request (node, um2store, um2hash);
			return;
		}

		if (REQUEST_STATE_PENDING == update_job_get_state (node->subscription->updateJob)) {
			ui_update_merge_request (node, um2store, um2hash);
			return;
		}
	}
			
	ui_update_remove_request (node, um1store, um1hash);
	ui_update_remove_request (node, um2store, um2hash);
}
Exemplo n.º 2
0
static void
feed_list_view_restore_folder_expansion (nodePtr node)
{
	if (node->expanded)
		feed_list_view_expand (node);

	node_foreach_child (node, feed_list_view_restore_folder_expansion);
}
Exemplo n.º 3
0
static void
feedlist_free_node (nodePtr node)
{
	if (node->children)
		node_foreach_child (node, feedlist_free_node);
	
	node->parent->children = g_slist_remove (node->parent->children, node);
	node_free (node); 
}
Exemplo n.º 4
0
static void
feedlist_update_node_counters (nodePtr node)
{
	node_update_counters (node);	/* update with parent propagation */

	if (node->needsUpdate)
		ui_node_update (node->id);
	if (node->children)
		node_foreach_child (node, feedlist_update_node_counters);
}
Exemplo n.º 5
0
static void
ui_update_cancel (nodePtr node)
{
	if (node->children)
		node_foreach_child (node, ui_update_cancel);

	if (!node->subscription)
		return;
		
	subscription_cancel_update (node->subscription);
}
Exemplo n.º 6
0
static void
node_calc_counters (nodePtr node)
{
	/* Order is important! First update all children
	   so that hierarchical nodes (folders and feed
	   list sources) can determine their own unread
	   count as the sum of all childs afterwards */
	node_foreach_child (node, node_calc_counters);

	NODE_TYPE (node)->update_counters (node);
}
Exemplo n.º 7
0
void
node_update_favicon (nodePtr node)
{
	if (NODE_TYPE (node)->capabilities & NODE_CAPABILITY_UPDATE_FAVICON) {
		debug1 (DEBUG_UPDATE, "favicon of node %s needs to be updated...", node->title);
		subscription_update_favicon (node->subscription);
	}

	/* Recursion */
	if (node->children)
		node_foreach_child (node, node_update_favicon);
}
Exemplo n.º 8
0
void
node_auto_update_subscription (nodePtr node)
{
	if (node->source->root == node) {
		node_source_auto_update (node);
		return;
	}

	if (node->subscription)
		subscription_auto_update (node->subscription);

	node_foreach_child (node, node_auto_update_subscription);
}
Exemplo n.º 9
0
/* This method is used to initialize the node states in the feed list */
static void
feedlist_init_node (nodePtr node) 
{
	if (node->expanded)
		ui_node_set_expansion (node, TRUE);
	
	if (node->subscription)
		db_subscription_load (node->subscription);
		
	node_update_counters (node);
	ui_node_update (node->id);	/* Necessary to initially set folder unread counters */
	
	node_foreach_child (node, feedlist_init_node);
}
Exemplo n.º 10
0
void
node_mark_all_read (nodePtr node)
{
	if (!node)
		return;

	if ((node->unreadCount > 0) || (IS_VFOLDER (node))) {
		itemset_mark_read (node);
		node->unreadCount = 0;
		node->needsUpdate = TRUE;
	}

	if (node->children)
		node_foreach_child (node, node_mark_all_read);
}
Exemplo n.º 11
0
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 ();
}
Exemplo n.º 12
0
void
feedlist_node_removed (nodePtr node)
{
	if (node == SELECTED)
		feedlist_unselect ();
		
	/* First remove all children */
	node_foreach_child (node, feedlist_node_removed);

	node_remove (node);

	ui_node_remove_node (node);

	node->parent->children = g_slist_remove (node->parent->children, node);

	node_free (node);
	
	feedlist_schedule_save ();
}
Exemplo n.º 13
0
static void
google_subscription_opml_cb (subscriptionPtr subscription, const struct updateResult * const result, updateFlags flags)
{
	AolSourcePtr	gsource = (AolSourcePtr) subscription->node->data;

	subscription->updateJob = NULL;
	
	if (result->data) {
		xmlDocPtr doc = xml_parse (result->data, result->size, NULL);
		if(doc) {		
			xmlNodePtr root = xmlDocGetRootElement (doc);
			
			/* Go through all existing nodes and remove those whose
			   URLs are not in new feed list. Also removes those URLs
			   from the list that have corresponding existing nodes. */
			node_foreach_child_data (subscription->node, aol_source_check_for_removal, (gpointer)root);
			node_foreach_child (subscription->node, aol_source_migrate_node);
						
			opml_source_export (subscription->node);	/* save new feed list tree to disk 
									   to ensure correct document in 
									   next step */

			xpath_foreach_match (root, "/object/list[@name='subscriptions']/object",
			                     aol_source_merge_feed,
			                     (gpointer)gsource);

			opml_source_export (subscription->node);	/* save new feeds to feed list */
						   
			subscription->node->available = TRUE;
			xmlFreeDoc (doc);
		} else { 
			/** @todo The session seems to have expired */
			g_warning ("Unable to parse OPML list from google, the session might have expired.\n");
		}
	} else {
		subscription->node->available = FALSE;
		debug0 (DEBUG_UPDATE, "google_subscription_opml_cb(): ERROR: failed to get subscription list!\n");
	}

	if (!(flags & NODE_SOURCE_UPDATE_ONLY_LIST))
		node_foreach_child_data (subscription->node, node_update_subscription, GUINT_TO_POINTER (0));

}
Exemplo n.º 14
0
static void
add_node_indicator (nodePtr node)
{
	IndicateIndicator *indicator;
	GdkPixbuf *pixbuf;
	gchar count[10];
	
	if (indicator_priv->indicators->len >= MAX_INDICATORS)
		return;

	if (IS_VFOLDER(node) || g_slist_length (node->children) > 0) {
		/* Not a feed - walk children and do nothing more */
		node_foreach_child (node, add_node_indicator);
		return;
	}
	
	/* Skip feeds with no unread items */
	if (node->unreadCount == 0)
		return;
	
	indicator = indicate_indicator_new_with_server (indicator_priv->server);
	g_signal_connect (indicator, "user-display", G_CALLBACK (on_indicator_clicked), node);

	/* load favicon */
	pixbuf = gdk_pixbuf_new_from_file (node->iconFile, NULL);

	/* display favicon */
	indicate_gtk_indicator_set_property_icon (indicator, "icon", pixbuf);
	g_object_unref (pixbuf);

	sprintf (count, "%u", node->unreadCount);
	indicate_indicator_set_property (indicator, "name", node->title);
	indicate_indicator_set_property (indicator, "count", count);
#if SET_DRAW_ATTENTION
	indicate_indicator_set_property_bool (indicator, "draw-attention", TRUE);
#endif
	g_ptr_array_add (indicator_priv->indicators, indicator);
}
Exemplo n.º 15
0
static void
default_source_auto_update (nodePtr node)
{	
	node_foreach_child (node, node_auto_update_subscription);
}