2006-04-19 [colin] 2.1.1cvs15
authorColin Leroy <colin@colino.net>
Wed, 19 Apr 2006 17:28:39 +0000 (17:28 +0000)
committerColin Leroy <colin@colino.net>
Wed, 19 Apr 2006 17:28:39 +0000 (17:28 +0000)
* src/compose.c
* src/compose.h
* src/gtk/gtkaspell.c
* src/gtk/gtkaspell.h
Put back Options menu in Spelling/
* src/gtk/quicksearch.c
Don't search, and show error, if the
advanced search has a syntax error

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/compose.h
src/gtk/gtkaspell.c
src/gtk/gtkaspell.h
src/gtk/quicksearch.c

index e623e2ac7f53889febd705f3aaff769083613a57..4629bf575d575c796e9cb1dd4afa2ad3ad4c5887 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-04-19 [colin]     2.1.1cvs15
+
+       * src/compose.c
+       * src/compose.h
+       * src/gtk/gtkaspell.c
+       * src/gtk/gtkaspell.h
+               Put back Options menu in Spelling/
+       * src/gtk/quicksearch.c
+               Don't search, and show error, if the
+               advanced search has a syntax error
+
 2006-04-18 [colin]     2.1.1cvs14
 
        * src/textview.c
index bffdd01c8872193a9232088c61ff97ddb5548367..ab6dafa684ca5a7f28a32e0b295fc0c72fb9d692 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.264 -r 1.382.2.265 src/compose.c;  cvs diff -u -r 1.179.2.105 -r 1.179.2.106 src/imap.c;  cvs diff -u -r 1.105.2.52 -r 1.105.2.53 src/prefs_account.c;  cvs diff -u -r 1.49.2.18 -r 1.49.2.19 src/prefs_account.h;  cvs diff -u -r 1.150.2.60 -r 1.150.2.61 src/procmsg.c;  ) > 2.1.1cvs12.patchset
 ( cvs diff -u -r 1.1.4.15 -r 1.1.4.16 src/gtk/gtksctree.c;  ) > 2.1.1cvs13.patchset
 ( cvs diff -u -r 1.96.2.111 -r 1.96.2.112 src/textview.c;  ) > 2.1.1cvs14.patchset
+( cvs diff -u -r 1.382.2.265 -r 1.382.2.266 src/compose.c;  cvs diff -u -r 1.50.2.23 -r 1.50.2.24 src/compose.h;  cvs diff -u -r 1.9.2.38 -r 1.9.2.39 src/gtk/gtkaspell.c;  cvs diff -u -r 1.5.2.5 -r 1.5.2.6 src/gtk/gtkaspell.h;  cvs diff -u -r 1.1.2.39 -r 1.1.2.40 src/gtk/quicksearch.c;  ) > 2.1.1cvs15.patchset
index 83e79327ac3bc81fa274cdc3a19b2e0a09d06f9a..dc42e1af60117f3c49be048b9368ad16cf84d367 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=1
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=14
+EXTRA_VERSION=15
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 7e7569990952faed51227fb6f2d57729b9befc02..1a4fc5a8f3930be1959835953912160761c37add 100644 (file)
@@ -646,6 +646,9 @@ static GtkItemFactoryEntry compose_entries[] =
                                        NULL, compose_check_backwards , 0, NULL},
        {N_("/_Spelling/_Forward to next misspelled word"),
                                        NULL, compose_check_forwards_go, 0, NULL},
+       {N_("/_Spelling/---"),          NULL, NULL, 0, "<Separator>"},
+       {N_("/_Spelling/Options"),
+                                       NULL, NULL, 0, "<Branch>"},
 #endif
        {N_("/_Options"),               NULL, NULL, 0, "<Branch>"},
        {N_("/_Options/Privacy System"),                NULL, NULL,   0, "<Branch>"},
@@ -5561,6 +5564,45 @@ static gboolean text_clicked(GtkWidget *text, GdkEventButton *event,
        return FALSE;
 }
 
+#if USE_ASPELL
+static void compose_spell_menu_changed(void *data)
+{
+       Compose *compose = (Compose *)data;
+       GSList *items;
+       GtkWidget *menuitem;
+       GtkWidget *parent_item;
+       GtkMenu *menu = gtk_menu_new();
+       GtkItemFactory *ifactory = gtk_item_factory_from_widget(compose->menubar);
+       GSList *spell_menu;
+
+       parent_item = gtk_item_factory_get_item(ifactory, 
+                       "/Spelling/Options");
+
+       /* setting the submenu removes /Spelling/Options from the factory 
+        * so we need to save it */
+
+       if (parent_item == NULL) {
+               parent_item = compose->aspell_options_menu;
+               gtk_menu_item_remove_submenu(GTK_MENU_ITEM(parent_item));
+       } else
+               compose->aspell_options_menu = parent_item;
+
+       spell_menu = gtkaspell_make_config_menu(compose->gtkaspell);
+
+       spell_menu = g_slist_reverse(spell_menu);
+       for (items = spell_menu;
+            items; items = items->next) {
+               menuitem = GTK_MENU_ITEM(items->data);
+               gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), GTK_WIDGET(menuitem));
+               gtk_widget_show(GTK_WIDGET(menuitem));
+       }
+       g_slist_free(spell_menu);
+
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(parent_item), GTK_WIDGET(menu));
+       
+}
+#endif
+
 static Compose *compose_create(PrefsAccount *account, ComposeMode mode,
                                                 gboolean batch)
 {
@@ -5886,7 +5928,9 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode,
                                                  prefs_common.recheck_when_changing_dict,
                                                  prefs_common.use_alternate,
                                                  GTK_TEXT_VIEW(text),
-                                                 GTK_WINDOW(compose->window));
+                                                 GTK_WINDOW(compose->window),
+                                                 compose_spell_menu_changed,
+                                                 compose);
                        if (!gtkaspell) {
                                alertpanel_error(_("Spell checker could not "
                                                "be started.\n%s"),
@@ -5906,6 +5950,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode,
                }
        }
         compose->gtkaspell = gtkaspell;
+       compose_spell_menu_changed(compose);
 #endif
 
        compose_select_account(compose, account, TRUE);
index 29cce3410f55ec139f9a701fe9696e74cf8f7548..2f5e46e9d275fd1aaace3069a4c53d8c0a8f866c 100644 (file)
@@ -208,6 +208,7 @@ struct _Compose
 #if USE_ASPELL
         /* GNU/aspell spell checker */
         GtkAspell *gtkaspell;
+       GtkWidget *aspell_options_menu;
 #endif
 
        /* Priority */
index 354d0d785e59627eb42150a7910788a66f6c991a..f22f8a0e8ae391b0e6001b54069b4028cef04440 100644 (file)
@@ -136,6 +136,8 @@ struct _GtkAspell
        GtkTextView     *gtktext;
        GdkColor         highlight;
        GtkAccelGroup   *accel_group;
+       void            (*menu_changed_cb)(void *data);
+       void            *menu_changed_data;
 };
 
 typedef AspellConfig GtkAspellConfig;
@@ -206,7 +208,7 @@ static void toggle_check_while_typing_cb    (GtkWidget      *w,
 /* Menu creation */
 static GSList* make_sug_menu                   (GtkAspell      *gtkaspell);
 static GSList * populate_submenu               (GtkAspell      *gtkaspell);
-static GSList* make_config_menu                (GtkAspell      *gtkaspell);
+GSList*        gtkaspell_make_config_menu              (GtkAspell      *gtkaspell);
 static void set_menu_pos                       (GtkMenu        *menu, 
                                                 gint           *x, 
                                                 gint           *y, 
@@ -377,7 +379,9 @@ GtkAspell *gtkaspell_new(const gchar *dictionary_path,
                         gboolean recheck_when_changing_dict,
                         gboolean use_alternate,
                         GtkTextView *gtktext,
-                        GtkWindow *parent_win)
+                        GtkWindow *parent_win,
+                        void (*spell_menu_cb)(void *data),
+                        void *data)
 {
        Dictionary      *dict;
        GtkAspell       *gtkaspell;
@@ -424,7 +428,9 @@ GtkAspell *gtkaspell_new(const gchar *dictionary_path,
        gtkaspell->suggestions_list   = NULL;
        gtkaspell->use_alternate      = use_alternate;
        gtkaspell->parent_window      = GTK_WIDGET(parent_win);
-       
+       gtkaspell->menu_changed_cb = spell_menu_cb;
+       gtkaspell->menu_changed_data = data;
+
        allocate_color(gtkaspell, misspelled_color);
 
        g_signal_connect_after(G_OBJECT(buffer), "insert-text",
@@ -562,7 +568,7 @@ static void button_press_intercept_cb(GtkTextView *gtktext,
                }
        } 
        if (!spell_menu) 
-               spell_menu = make_config_menu(gtkaspell);
+               spell_menu = gtkaspell_make_config_menu(gtkaspell);
        
        spell_menu = g_slist_reverse(spell_menu);
        for (items = spell_menu;
@@ -808,6 +814,8 @@ static void set_sug_mode_cb(GtkMenuItem *w, GtkAspell *gtkaspell)
        
        set_real_sug_mode(gtkaspell, themode);
        g_free(themode);
+       if (gtkaspell->menu_changed_cb)
+               gtkaspell->menu_changed_cb(gtkaspell->menu_changed_data);
 }
 
 static void set_real_sug_mode(GtkAspell *gtkaspell, const char *themode)
@@ -1610,6 +1618,8 @@ static void toggle_check_while_typing_cb(GtkWidget *w, gpointer data)
 
        if (!gtkaspell->check_while_typing)
                gtkaspell_uncheck_all(gtkaspell);
+       if (gtkaspell->menu_changed_cb)
+               gtkaspell->menu_changed_cb(gtkaspell->menu_changed_data);
 }
 
 static GSList *create_empty_dictionary_list(void)
@@ -2173,7 +2183,7 @@ static GSList *populate_submenu(GtkAspell *gtkaspell)
        return list;
 }
 
-static GSList *make_config_menu(GtkAspell *gtkaspell)
+GSList *gtkaspell_make_config_menu(GtkAspell *gtkaspell)
 {
        return populate_submenu(gtkaspell);
 }
@@ -2288,6 +2298,8 @@ static void change_dict_cb(GtkWidget *w, GtkAspell *gtkaspell)
        if (gtkaspell->recheck_when_changing_dict) {
                gtkaspell_highlight_all(gtkaspell);
        }
+       if (gtkaspell->menu_changed_cb)
+               gtkaspell->menu_changed_cb(gtkaspell->menu_changed_data);
 }
 
 static void switch_to_alternate_cb(GtkWidget *w,
@@ -2295,6 +2307,8 @@ static void switch_to_alternate_cb(GtkWidget *w,
 {
        GtkAspell *gtkaspell = (GtkAspell *) data;
        use_alternate_dict(gtkaspell);
+       if (gtkaspell->menu_changed_cb)
+               gtkaspell->menu_changed_cb(gtkaspell->menu_changed_data);
 }
 
 /* Misc. helper functions */
index 59add9bbc4ff228762ff16d1face1a01946666a5..e92e9a457bf8a5fe56303acde5c3e2cc7dc400fa 100644 (file)
@@ -58,7 +58,9 @@ GtkAspell*    gtkaspell_new                   (const gchar *dictionary_path,
                                                 gboolean recheck_when_changing_dict,
                                                 gboolean use_alternate,  
                                                 GtkTextView *gtktext,
-                                                GtkWindow *parent_win);
+                                                GtkWindow *parent_win,
+                                                void (*spell_menu_cb)(void *data),
+                                                void *data);
 
 void           gtkaspell_delete                (GtkAspell *gtkaspell); 
 
@@ -98,6 +100,7 @@ void                 gtkaspell_sugmode_option_menu_set       (GtkOptionMenu *optmenu,
                                                         gint sugmode);
 
 gint           gtkaspell_get_sugmode_from_option_menu  (GtkOptionMenu *optmenu);
+GSList*                gtkaspell_make_config_menu              (GtkAspell      *gtkaspell);
 
 #endif /* USE_ASPELL */
 #endif /* __GTKASPELL_H__ */
index dde8b5c0ab244033971912d89e7aa737e4a67a66..6837e3182e90cfa690efb624d50cd62b448ada57 100644 (file)
@@ -282,7 +282,7 @@ static gchar *search_descr_strings[] = {
        "T",     N_("marked messages"),
        "U",     N_("unread messages"),
        "x S",   N_("messages which contain S in References header"),
-       "X cmd", N_("messages returning 0 when passed to command"),
+       "X \"cmd args\"", N_("messages returning 0 when passed to command - %F is message file"),
        "y S",   N_("messages which contain S in X-Label header"),
        "",      "" ,
        "&amp;",         N_("logical AND operator"),
@@ -550,44 +550,54 @@ void quicksearch_set(QuickSearch *quicksearch, QuickSearchType type,
 
 gboolean quicksearch_is_active(QuickSearch *quicksearch)
 {
-       return quicksearch->active;
+       return quicksearch->active && (quicksearch->matcher_list != NULL);
 }
 
 static void quicksearch_set_active(QuickSearch *quicksearch, gboolean active)
 {
        static GdkColor yellow;
+       static GdkColor red;
        static GdkColor black;
-       static gboolean yellow_initialised = FALSE;
+       static gboolean colors_initialised = FALSE;
+       gboolean error = FALSE;
 
-       if (!yellow_initialised) {
+       if (!colors_initialised) {
                gdk_color_parse("#f5f6be", &yellow);
                gdk_color_parse("#000000", &black);
-               yellow_initialised = gdk_colormap_alloc_color(
+               gdk_color_parse("#ff7070", &red);
+               colors_initialised = gdk_colormap_alloc_color(
                        gdk_colormap_get_system(), &yellow, FALSE, TRUE);
-               yellow_initialised &= gdk_colormap_alloc_color(
+               colors_initialised &= gdk_colormap_alloc_color(
                        gdk_colormap_get_system(), &black, FALSE, TRUE);
-
+               colors_initialised &= gdk_colormap_alloc_color(
+                       gdk_colormap_get_system(), &red, FALSE, TRUE);
        }
+
        quicksearch->active = active;
 
+       if (active && quicksearch->matcher_list == NULL)
+               error = TRUE;
+
        if (active) {
                gtk_widget_set_sensitive(quicksearch->clear_search, TRUE);
-               if (yellow_initialised)
+               if (colors_initialised) {
                        gtk_widget_modify_base(
                                GTK_COMBO(quicksearch->search_string_entry)->entry,
-                               GTK_STATE_NORMAL, &yellow);
+                               GTK_STATE_NORMAL, error ? &red : &yellow);
                        gtk_widget_modify_text(
                                GTK_COMBO(quicksearch->search_string_entry)->entry,
                                GTK_STATE_NORMAL, &black);
+               }
        } else {
                gtk_widget_set_sensitive(quicksearch->clear_search, FALSE);
-               if (yellow_initialised)
+               if (colors_initialised) {
                        gtk_widget_modify_base(
                                GTK_COMBO(quicksearch->search_string_entry)->entry,
                                GTK_STATE_NORMAL, NULL);
                        gtk_widget_modify_text(
                                GTK_COMBO(quicksearch->search_string_entry)->entry,
                                GTK_STATE_NORMAL, NULL);
+               }
        }
 
        if (!active) {