Example #1
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);
}
Example #2
0
/**
 * 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. */
    }
}
Example #3
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);
}