Fixed bug where actions menus were not updated in separate message views and compose...
authorMelvin Hadasht <melvin.hadasht@free.fr>
Sun, 21 Dec 2003 00:37:48 +0000 (00:37 +0000)
committerMelvin Hadasht <melvin.hadasht@free.fr>
Sun, 21 Dec 2003 00:37:48 +0000 (00:37 +0000)
ChangeLog.claws
configure.ac
src/action.c
src/action.h
src/compose.c
src/compose.h
src/mainwindow.c
src/mainwindow.h
src/messageview.c
src/messageview.h
src/prefs_actions.c

index b4f481cd25be51fb097877b45c974a361dbe8b20..054c6931d3a2169cf5ba7b87c11358fcd94cf77c 100644 (file)
@@ -1,3 +1,33 @@
+2003-12-20 [melvin]    0.9.8claws6
+
+       * src/action.[ch]
+               Changed the interface for action_update_*_menu() so
+               action.c does not need to know the paths of the different
+               actions menu (mainwindow, message view and compose window). 
+
+       * src/compose.c
+               Tiny code cleanup to merge spell checker related code
+               compose_update_actions_menu(): new function to update
+               the actions menu. Use it in compose_create()
+
+       * src/compose.h
+               compose_update_actions_menu(): new function to update
+               the actions menu. Used also in prefs_actions.c.
+
+       * src/mainwindow.[ch]
+               main_window_update_actions_menu(): new function to update
+               the actions menu. Used in main_window_create() and in
+               prefs_actions.c
+
+       * src/messageview.[ch]
+               messageview_update_actions_menu(): new function to update
+               the actions menu. Used in messageview_add_toolbar() and in
+               prefs_actions.c
+               
+       * src/prefs_actions.c   
+               prefs_actions_ok(): fixed to update the actions menu of
+               the separate message view and the compose windows.
+
 2003-12-20 [luke]      0.9.8claws5
        * src/procheader.c
                fix unfolding/newline stripping for multiline fields
index 06f8d878fa2b16e31f579850d7f5c94f3517058b..e18fffee82cea90c2be7e207baea7b1ac32010a8 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=5
+EXTRA_VERSION=6
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 1d43968d99bbf87e49c66f8385c289ec02755eb2..cd136a30de6d5f4bd8bb42ddb7ee434820f975d9 100644 (file)
@@ -98,7 +98,7 @@ struct _ChildInfo
 };
 
 static void action_update_menu         (GtkItemFactory *ifactory,
-                                        gchar          *branch_path,
+                                        const gchar    *branch_path,
                                         gpointer        callback,
                                         gpointer        data);
 static void compose_actions_execute_cb (Compose        *compose,
@@ -404,25 +404,32 @@ void actions_execute(gpointer data,
                msgview_actions_execute_cb((MessageView*)data, action_nb, widget);      
 }
 
-void action_update_mainwin_menu(GtkItemFactory *ifactory, MainWindow *mainwin)
+void action_update_mainwin_menu(GtkItemFactory *ifactory,
+                               const gchar *branch_path,
+                               MainWindow *mainwin)
 {
-       action_update_menu(ifactory, "/Tools/Actions",
+       action_update_menu(ifactory, branch_path,
                           mainwin_actions_execute_cb, mainwin);
 }
 
-void action_update_msgview_menu(GtkItemFactory *ifactory, MessageView *msgview)
+void action_update_msgview_menu(GtkItemFactory *ifactory,
+                               const gchar *branch_path,
+                               MessageView *msgview)
 {
-       action_update_menu(ifactory, "/Tools/Actions",
+       action_update_menu(ifactory, branch_path,
                           msgview_actions_execute_cb, msgview);
 }
 
-void action_update_compose_menu(GtkItemFactory *ifactory, Compose *compose)
+void action_update_compose_menu(GtkItemFactory *ifactory, 
+                               const gchar *branch_path,
+                               Compose *compose)
 {
-       action_update_menu(ifactory, "/Tools/Actions",
+       action_update_menu(ifactory, branch_path,
                           compose_actions_execute_cb, compose);
 }
 
-static void action_update_menu(GtkItemFactory *ifactory, gchar *branch_path,
+static void action_update_menu(GtkItemFactory *ifactory, 
+                              const gchar *branch_path,
                               gpointer callback, gpointer data)
 {
        GtkWidget *menuitem;
index 9f4179f3d717964a478a491f5767da606bfd9ea5..d3d7a028c8e7c59df9fe1029f30e4b90d5032bd1 100644 (file)
@@ -47,16 +47,19 @@ typedef enum
 
 ActionType action_get_type     (const gchar    *action_str);
 
-void actions_execute                    (gpointer       data, 
-                                        guint          action_nb,
-                                        GtkWidget      *widget,
-                                        gint           source);
+void actions_execute           (gpointer       data, 
+                                guint          action_nb,
+                                GtkWidget      *widget,
+                                gint           source);
 
-void action_update_mainwin_menu        (GtkItemFactory *ifactory, 
+void action_update_mainwin_menu        (GtkItemFactory *ifactory,
+                                const gchar    *branch_path,
                                 MainWindow     *mainwin);
 void action_update_msgview_menu        (GtkItemFactory *ifactory,
+                                const gchar    *branch_path,
                                 MessageView    *msgview);
-void action_update_compose_menu        (GtkItemFactory *ifactory, 
+void action_update_compose_menu        (GtkItemFactory *ifactory,
+                                const gchar    *branch_path,
                                 Compose        *compose);
 
 #endif /* __ACTION_H__ */
index 6fb8ce2daa929c555e675d7fa6a4afa04136177f..365903969b66d6b4df171fa528843b70f3de5816 100644 (file)
@@ -5161,9 +5161,6 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        }
 #endif
 
-       action_update_compose_menu(ifactory, compose);
-
-
        undostruct = undo_init(text);
        undo_set_change_state_func(undostruct, &compose_undo_state_changed,
                                   menubar);
@@ -5267,14 +5264,11 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
                        }
                }
        }
+        compose->gtkaspell = gtkaspell;
 #endif
 
        compose_select_account(compose, account, TRUE);
 
-#if USE_ASPELL
-        compose->gtkaspell      = gtkaspell;
-#endif
-
        if (account->set_autocc && account->auto_cc && mode != COMPOSE_REEDIT)
                compose_entry_append(compose, account->auto_cc, COMPOSE_CC);
 
@@ -5291,7 +5285,6 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
                gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), prefs_common.trans_hdr ? _("Newsgroups:") : "Newsgroups:");
 
        addressbook_set_target_compose(compose);
-       action_update_compose_menu(ifactory, compose);
        
        if (mode != COMPOSE_REDIRECT)
                compose_set_template_menu(compose);
@@ -5309,7 +5302,10 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        /* Priority */
        compose->priority = PRIORITY_NORMAL;
        compose_update_priority_menu_item(compose);
-       
+
+       /* Actions menu */
+       compose_update_actions_menu(compose);
+
 #if USE_GPGME
        activate_gnupg_mode(compose, account);
 #endif 
@@ -5463,6 +5459,14 @@ static void compose_set_template_menu(Compose *compose)
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(compose->tmpl_menu), menu);
 }
 
+void compose_update_actions_menu(Compose *compose)
+{
+       GtkItemFactory *ifactory;
+
+       ifactory = gtk_item_factory_from_widget(compose->menubar);
+       action_update_compose_menu(ifactory, "/Tools/Actions", compose);
+}
+
 void compose_reflect_prefs_all(void)
 {
        GList *cur;
index c27bc8a3b7cdd7b55ae83e9ec9b07d3b39ddc26a..94618e953fb35f69e364bc3a7ba5cd8cd06cfb1c 100644 (file)
@@ -264,6 +264,8 @@ void compose_entry_select           (Compose          *compose,
 
 gint compose_send                      (Compose          *compose);
 
+void compose_update_actions_menu       (Compose        *compose);
+
 void compose_reflect_prefs_all                 (void);
 void compose_reflect_prefs_pixmap_theme        (void);
 
index b09216404bfcc9ab3878e5147b254950dec1f9f4..8a61066dfbfba47f5febe361946e267cf4cabe08 100644 (file)
@@ -1009,7 +1009,7 @@ MainWindow *main_window_create(SeparateType type)
        toolbar_main_set_sensitive(mainwin);
 
        /* create actions menu */
-       action_update_mainwin_menu(ifactory, mainwin);
+       main_window_update_actions_menu(mainwin);
 
        /* attach accel groups to main window */
 #define        ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win)        \
@@ -1063,6 +1063,14 @@ void main_window_destroy(MainWindow *mainwin)
        messageview_destroy(mainwin->messageview);
 }
 
+void main_window_update_actions_menu(MainWindow *mainwin)
+{
+       GtkItemFactory *ifactory;
+
+       ifactory = gtk_item_factory_from_widget(mainwin->menubar);
+       action_update_mainwin_menu(ifactory, "/Tools/Actions", mainwin);
+}
+
 void main_window_cursor_wait(MainWindow *mainwin)
 {
 
index be1555ea37e84b1a5f8b4d473967afeb1c97a4d3..596576dc1fe72ddadc220d0450967ab0ded47fbc 100644 (file)
@@ -138,6 +138,8 @@ MainWindow *main_window_create              (SeparateType    type);
 
 void main_window_destroy                (MainWindow *mainwin);
 
+void main_window_update_actions_menu   (MainWindow     *mainwin);
+
 void main_window_cursor_wait           (MainWindow     *mainwin);
 void main_window_cursor_normal         (MainWindow     *mainwin);
 
index 3fad6c200d2e27512d1fc6f9c06ae9c0294ed8ce..c8ff1fb4228ff1ec76b82086e0d9e44db403acc2 100644 (file)
@@ -338,6 +338,17 @@ GList *messageview_get_msgview_list(void)
        return msgview_list;
 }
 
+void messageview_update_actions_menu(MessageView *msgview)
+{
+       GtkItemFactory *ifactory;
+
+       /* Messages opened in a new window do not have a menu bar */
+       if (msgview->menubar == NULL)
+               return;
+       ifactory = gtk_item_factory_from_widget(msgview->menubar);
+       action_update_msgview_menu(ifactory, "/Tools/Actions", msgview);
+}
+
 void messageview_add_toolbar(MessageView *msgview, GtkWidget *window) 
 {
        GtkWidget *handlebox;
@@ -365,8 +376,7 @@ void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        gtk_container_add(GTK_CONTAINER(vbox),
                          GTK_WIDGET_PTR(msgview));
 
-       ifactory = gtk_item_factory_from_widget(menubar);
-       action_update_msgview_menu(ifactory, msgview);
+       messageview_update_actions_menu(msgview);
 
        msgview_list = g_list_append(msgview_list, msgview);
 }
index d4ba73ab5781317ec99984c6cb458b60ced70c38..4d0533ccded953ac7944d5fe5bbf9f583d394f77 100644 (file)
@@ -99,6 +99,7 @@ gboolean messageview_search_string_backward   (MessageView    *messageview,
 
 gboolean messageview_is_visible                        (MessageView    *messageview);
 
+void messageview_update_actions_menu           (MessageView    *msgview);
 void messageview_add_toolbar                   (MessageView    *msgview,
                                                 GtkWidget      *vbox);
 void messageview_reflect_prefs_pixmap_theme    (void);
index 8fc33110e079be90bb230098605ff02dcef9dd0d..e856e04d8c823e075205e96daedf17360df4db7e 100644 (file)
@@ -619,13 +619,31 @@ static void prefs_actions_cancel(GtkWidget *w, gpointer data)
 
 static void prefs_actions_ok(GtkWidget *widget, gpointer data)
 {
-       GtkItemFactory *ifactory;
-       MainWindow *mainwin = (MainWindow *)data;
-       GtkItemFactoryEntry ifentry = {NULL, NULL, NULL, 0, "<Branch>"};
+       MainWindow *mainwin = (MainWindow *) data;
+       GList *list;
+       GList *iter;
+       MessageView *msgview;
+       Compose *compose;
 
        prefs_actions_write_config();
-       ifactory = gtk_item_factory_from_widget(mainwin->menubar);
-       action_update_mainwin_menu(ifactory, mainwin);
+
+       /* Update mainwindow actions menu */
+       main_window_update_actions_menu(mainwin);
+
+       /* Update separated message view actions menu */
+       list = messageview_get_msgview_list();
+       for (iter = list; iter; iter = iter->next) {
+               msgview = (MessageView *) iter->data;
+               messageview_update_actions_menu(msgview);
+       }
+
+       /* Update compose windows actions menu */
+       list = compose_get_compose_list();
+       for (iter = list; iter; iter = iter->next) {
+               compose = (Compose *) iter->data;
+               compose_update_actions_menu(compose);
+       }
+
        gtk_widget_hide(actions.window);
        inc_unlock();
 }