static void on_simple_search_dialog_response (GtkDialog *dialog, gint responseId, gpointer user_data) { SimpleSearchDialog *ssd = (SimpleSearchDialog *)user_data; const gchar *searchString; vfolderPtr vfolder = ssd->priv->vfolder; searchString = gtk_entry_get_text (GTK_ENTRY (ssd->priv->query)); if (1 == responseId) { /* Search */ search_clean_results (vfolder); /* Create new search... */ ssd->priv->vfolder = vfolder = vfolder_new (node_new (vfolder_get_node_type ())); node_set_title (vfolder->node, searchString); itemset_add_rule (vfolder->itemset, "exact", searchString, TRUE); search_load_results (vfolder); } 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); }
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); }