static void
on_propdialog_response (GtkDialog *dialog, gint response_id, gpointer user_data)
{
	SearchFolderDialog	*sfd = SEARCH_FOLDER_DIALOG (user_data);
	
	if (response_id == GTK_RESPONSE_OK) {	
		/* save new search folder settings */
		node_set_title (sfd->priv->node, gtk_entry_get_text (GTK_ENTRY (sfd->priv->nameEntry)));
		rule_editor_save (sfd->priv->re, sfd->priv->vfolder->itemset);
		sfd->priv->vfolder->itemset->anyMatch = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (liferea_dialog_lookup (GTK_WIDGET (dialog), "anyRuleRadioBtn")));

		/* update search folder */
		itemview_clear ();
		vfolder_reset (sfd->priv->vfolder);
		itemlist_unload (FALSE);
		
		/* If we are finished editing a new search folder add it to the feed list */
		if (!sfd->priv->node->parent)
			feedlist_node_added (sfd->priv->node);
			
		ui_node_update (sfd->priv->node->id);
	}
	
	gtk_widget_destroy (GTK_WIDGET (dialog));
}
Exemple #2
0
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");
}
Exemple #3
0
void
vfolder_reset (vfolderPtr vfolder)
{
	itemlist_unload (FALSE);

	g_list_free (vfolder->itemset->ids);
	vfolder->itemset->ids = NULL;
	db_search_folder_reset (vfolder->node->id);
}
Exemple #4
0
static void
feedlist_unselect (void)
{
	SELECTED = NULL;

	itemview_set_displayed_node (NULL);
	itemview_update ();
		
	itemlist_unload (FALSE /* mark all read */);
	feed_list_view_select (NULL);
	liferea_shell_update_feed_menu (TRUE, FALSE, FALSE);
	liferea_shell_update_allitems_actions (FALSE, FALSE);
}
Exemple #5
0
static void
search_clean_results (vfolderPtr vfolder)
{
	if (!vfolder)
		return;

	/* Clean up old search result data and display... */
	if (vfolder->node == itemlist_get_displayed_node ())
		itemlist_unload (FALSE);
		
	/* FIXME: Don't simply free the result search folder
	   as the search query might still be active. Instead
	   g_object_unref() a search result object! For now
	   we leak the node to avoid crashes. */
	//node_free (vfolder->node);
}
Exemple #6
0
/** 
 * Loads a search result into the item list and renders
 * some info text into the HTML view pane.
 *
 * @param searchResult		valid search result node
 * @param searchString		search text (or NULL)
 */
static void
search_load_results (nodePtr searchResult, const gchar *searchString)
{
	GString	*buffer;
	itemSetPtr itemSet;
	nodeViewType viewMode;
	
	/* Clear feed and item display and load search results */
	feed_list_view_select (NULL);
	itemlist_unload (FALSE);
	
	/* Ensure that we are in a useful viewing mode (3 paned) */
	viewMode = itemlist_get_view_mode ();
	if ((NODE_VIEW_MODE_NORMAL != viewMode) &&
	    (NODE_VIEW_MODE_WIDE != viewMode))
		itemview_set_layout (NODE_VIEW_MODE_NORMAL);
		
	itemSet = node_get_itemset (searchResult);
	itemlist_load_search_result (itemSet);
	itemset_free (itemSet);

	buffer = g_string_new (NULL);
	htmlview_start_output (buffer, NULL, TRUE, FALSE);
	g_string_append_printf (buffer, "<div class='content'><h2>");
	
	if (searchString)
		g_string_append_printf (buffer, ngettext("%d Search Result for \"%s\"", 
	                                        	 "%d Search Results for \"%s\"",
	                                        	 searchResult->itemCount),
	                        	searchResult->itemCount, searchString);
	else 
		g_string_append_printf (buffer, ngettext("%d Search Result", 
	                                        	 "%d Search Results",
	                                        	 searchResult->itemCount),
	                        	searchResult->itemCount);
					
	g_string_append_printf (buffer, "</h2><p>");
	g_string_append_printf (buffer, _("The item list now contains all items matching the "
	                                "specified search pattern. If you want to save this search "
	                                "result permanently you can click the \"Search Folder\" button in "
	                                "the search dialog and Liferea will add a search folder to your "
	                                "feed list."));
	g_string_append_printf (buffer, "</p></div>");
	htmlview_finish_output (buffer);
	itemview_display_info (buffer->str);
	g_string_free (buffer, TRUE);
}
/**
 * The "Hide read items" button has been clicked. Here we change the
 * preference and, if the selected node is a folder, we reload the
 * itemlist. The item selection is lost by this.
 */
void
on_folderhidereadbtn_toggled (GtkToggleButton *togglebutton, gpointer user_data)
{
    nodePtr		displayedNode;
    gboolean	enabled;

    displayedNode = itemlist_get_displayed_node ();

    enabled = gtk_toggle_button_get_active (togglebutton);
    conf_set_bool_value (FOLDER_DISPLAY_HIDE_READ, enabled);

    if (displayedNode && IS_FOLDER (displayedNode)) {
        itemlist_unload (FALSE);
        itemlist_load (displayedNode);

        /* Note: For simplicity when toggling this preference we
           accept that the current item selection is lost. */
    }
}
Exemple #8
0
static void
on_simple_search_dialog_response (GtkDialog *dialog, gint responseId, gpointer user_data)
{
	SimpleSearchDialog	*ssd = (SimpleSearchDialog *)user_data;
	const gchar		*searchString;

	searchString = 	gtk_entry_get_text (GTK_ENTRY (ssd->priv->query));
	
	if (1 == responseId) {	/* Search */
		/* Clean up old search result data and display... */
		if (ssd->priv->searchResult) {
			if (ssd->priv->searchResult == itemlist_get_displayed_node ())
				itemlist_unload (FALSE);
			
			node_free (ssd->priv->searchResult);
		}
		
		/* Create new search... */
		ssd->priv->searchResult = node_new (vfolder_get_node_type ());
		ssd->priv->vfolder = vfolder_new (ssd->priv->searchResult);
	
		node_set_title (ssd->priv->searchResult, searchString);
		itemset_add_rule (ssd->priv->vfolder->itemset, "exact", searchString, TRUE);
		vfolder_reset (ssd->priv->vfolder);

		search_load_results (ssd->priv->searchResult, searchString);
	}
	
	if (2 == responseId)	/* Advanced... */			
		search_dialog_open (searchString);

	/* Do not close the dialog when "just" searching. The user
	   should click "Close" to close the dialog to be able to
	   do subsequent searches... */	
	if (1 != responseId)
		g_object_unref (ssd);
}