2007-05-10 [wwp] 2.9.2cvs5
authorTristan Chabredier <wwp@claws-mail.org>
Thu, 10 May 2007 16:39:25 +0000 (16:39 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Thu, 10 May 2007 16:39:25 +0000 (16:39 +0000)
* src/prefs_common.c
* src/prefs_common.h
* src/gtk/quicksearch.c
Add a quicksearch option to automatically run
a search selected from the history (this option
is exclusive towards type-ahead).

ChangeLog
PATCHSETS
configure.ac
src/gtk/quicksearch.c
src/prefs_common.c
src/prefs_common.h

index 5d900fa..db4fcd9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-05-10 [wwp]       2.9.2cvs5
+
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/gtk/quicksearch.c
+               Add a quicksearch option to automatically run
+               a search selected from the history (this option
+               is exclusive towards type-ahead).
+
 2007-05-10 [colin]     2.9.2cvs4
 
        * src/imap.c
index e2f66e4..a72db10 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.171 -r 1.179.2.172 src/imap.c;  ) > 2.9.2cvs2.patchset
 ( cvs diff -u -r 1.23.2.22 -r 1.23.2.23 src/crash.c;  cvs diff -u -r 1.5.2.18 -r 1.5.2.19 src/exporthtml.c;  cvs diff -u -r 1.28.2.34 -r 1.28.2.35 src/mbox.c;  cvs diff -u -r 1.1.2.39 -r 1.1.2.40 src/prefs_summaries.c;  cvs diff -u -r 1.47.2.39 -r 1.47.2.40 src/procheader.c;  cvs diff -u -r 1.6.2.10 -r 1.6.2.11 src/common/log.c;  cvs diff -u -r 1.36.2.101 -r 1.36.2.102 src/common/utils.c;  cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/gtk/gtksourceprintjob.c;  cvs diff -u -r 1.9.2.16 -r 1.9.2.17 src/gtk/sslcertwindow.c;  ) > 2.9.2cvs3.patchset
 ( cvs diff -u -r 1.179.2.172 -r 1.179.2.173 src/imap.c;  ) > 2.9.2cvs4.patchset
+( cvs diff -u -r 1.204.2.133 -r 1.204.2.134 src/prefs_common.c;  cvs diff -u -r 1.103.2.81 -r 1.103.2.82 src/prefs_common.h;  cvs diff -u -r 1.1.2.70 -r 1.1.2.71 src/gtk/quicksearch.c;  ) > 2.9.2cvs5.patchset
index db209ea..df9eb36 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=4
+EXTRA_VERSION=5
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 48e121c..833499e 100644 (file)
@@ -66,6 +66,10 @@ struct _QuickSearch
        gboolean                         is_fast;
        gboolean                         in_typing;
        guint                            press_timeout_id;
+
+       /* dynamic and autorun qs settings are exclusive*/
+       GtkWidget                        *dynamic_menuitem;
+       GtkWidget                        *autorun_menuitem;
 };
 
 static void quicksearch_set_running(QuickSearch *quicksearch, gboolean run);
@@ -206,6 +210,12 @@ static int searchbar_changed_timeout(void *data)
 
 static gboolean searchbar_changed_cb(GtkWidget *widget, QuickSearch *qs)
 {
+       if (!qs->has_focus && prefs_common.summary_quicksearch_autorun) {
+               gtk_widget_grab_focus(qs->search_string_entry);
+               searchbar_run(qs, TRUE);
+               return FALSE;
+       }
+
        if (prefs_common.summary_quicksearch_dynamic) {
                if (qs->press_timeout_id != -1) {
                        g_source_remove(qs->press_timeout_id);
@@ -327,6 +337,27 @@ static gboolean searchtype_dynamic_changed(GtkMenuItem *widget, gpointer data)
        gboolean checked = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
 
        prefs_common.summary_quicksearch_dynamic = checked;
+       if (checked)
+               gtk_check_menu_item_set_active(
+                               GTK_CHECK_MENU_ITEM(quicksearch->autorun_menuitem),
+                               FALSE);
+
+       /* reselect the search type */
+       quicksearch_set_type(quicksearch, prefs_common.summary_quicksearch_type);
+
+       return TRUE;
+}
+
+static gboolean searchtype_autorun_changed(GtkMenuItem *widget, gpointer data)
+{
+       QuickSearch *quicksearch = (QuickSearch *)data;
+       gboolean checked = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+
+       prefs_common.summary_quicksearch_autorun = checked;
+       if (checked)
+               gtk_check_menu_item_set_active(
+                               GTK_CHECK_MENU_ITEM(quicksearch->dynamic_menuitem),
+                               FALSE);
 
        /* reselect the search type */
        quicksearch_set_type(quicksearch, prefs_common.summary_quicksearch_type);
@@ -544,6 +575,18 @@ QuickSearch *quicksearch_new()
                         G_CALLBACK(searchtype_dynamic_changed),
                         quicksearch);
 
+       menuitem = gtk_check_menu_item_new_with_label(_("Run on select"));
+       gtk_menu_shell_append(GTK_MENU_SHELL(search_type), menuitem);
+
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
+                                       prefs_common.summary_quicksearch_autorun);
+
+       quicksearch->autorun_menuitem = menuitem;
+
+       g_signal_connect(G_OBJECT(menuitem), "activate",
+                        G_CALLBACK(searchtype_autorun_changed),
+                        quicksearch);
+
        gtk_option_menu_set_menu(GTK_OPTION_MENU(search_type_opt), search_type);
 
        quicksearch->search_type_opt = search_type_opt;
index 3b86b94..4c0faa3 100644 (file)
@@ -967,6 +967,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"summary_quicksearch_dynamic", "0", &prefs_common.summary_quicksearch_dynamic, P_INT,
         NULL, NULL, NULL},
+       {"summary_quicksearch_autorun", "0", &prefs_common.summary_quicksearch_autorun, P_INT,
+        NULL, NULL, NULL},
        {"statusbar_update_step", "10", &prefs_common.statusbar_update_step, P_INT,
         NULL, NULL, NULL},
        {"compose_no_markup", "FALSE", &prefs_common.compose_no_markup, P_BOOL,
index 8fb6086..3823270 100644 (file)
@@ -379,6 +379,7 @@ struct _PrefsCommon
        gint summary_quicksearch_sticky;
        gint summary_quicksearch_recurse;
        gint summary_quicksearch_dynamic;
+       gint summary_quicksearch_autorun;
        gulong color_new;
        
        GList *summary_quicksearch_history;