diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compose.c | 43 | ||||
-rw-r--r-- | src/mainwindow.c | 44 |
2 files changed, 50 insertions, 37 deletions
diff --git a/src/compose.c b/src/compose.c index 10563f1c..c3fecaaa 100644 --- a/src/compose.c +++ b/src/compose.c @@ -170,10 +170,14 @@ static Compose *compose_find_window_by_target (MsgInfo *msginfo); static gboolean compose_window_exist (gint x, gint y); static void compose_connect_changed_callbacks (Compose *compose); + static GtkWidget *compose_toolbar_create (Compose *compose); static GtkWidget *compose_toolbar_create_from_list (Compose *compose, GList *item_list); +static void compose_set_toolbar_button_visibility + (Compose *compose); + static GtkWidget *compose_account_option_menu_create (Compose *compose, GtkWidget *hbox); @@ -4588,21 +4592,6 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) gtk_widget_hide(misc_hbox); #endif - switch (prefs_common.toolbar_style) { - case TOOLBAR_NONE: - gtk_widget_hide(toolbar); - break; - case TOOLBAR_ICON: - gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); - break; - case TOOLBAR_TEXT: - gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_TEXT); - break; - case TOOLBAR_BOTH: - gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH); - break; - } - undostruct = undo_init(text); undo_set_change_state_func(undostruct, &compose_undo_state_changed, menubar); @@ -4713,6 +4702,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) compose->autosave_tag = 0; + compose_set_toolbar_button_visibility(compose); + compose_select_account(compose, account, TRUE); menu_set_active(ifactory, "/Edit/Auto wrapping", prefs_common.autowrap); @@ -4962,6 +4953,27 @@ static GtkWidget *compose_toolbar_create_from_list(Compose *compose, return toolbar; } +static void compose_set_toolbar_button_visibility(Compose *compose) +{ + GtkToolbarStyle style; + + if (prefs_common.toolbar_style == TOOLBAR_NONE) + style = -1; + else if (prefs_common.toolbar_style == TOOLBAR_ICON) + style = GTK_TOOLBAR_ICONS; + else if (prefs_common.toolbar_style == TOOLBAR_TEXT) + style = GTK_TOOLBAR_TEXT; + else if (prefs_common.toolbar_style == TOOLBAR_BOTH) + style = GTK_TOOLBAR_BOTH; + + if (style != -1) { + gtk_toolbar_set_style(GTK_TOOLBAR(compose->toolbar), style); + gtk_widget_show(compose->toolbar); + gtk_widget_queue_resize(compose->toolbar); + } else + gtk_widget_hide(compose->toolbar); +} + static GtkWidget *compose_account_option_menu_create(Compose *compose, GtkWidget *hbox) { @@ -5977,6 +5989,7 @@ static void toolbar_customize(GtkWidget *widget, gpointer data) FALSE, FALSE, 0); gtk_box_reorder_child(GTK_BOX(compose->vbox), toolbar, 1); compose->toolbar = toolbar; + compose_set_toolbar_button_visibility(compose); g_free(prefs_common.compose_toolbar_setting); prefs_common.compose_toolbar_setting = prefs_toolbar_get_name_list_from_item_list(item_list); diff --git a/src/mainwindow.c b/src/mainwindow.c index 286b27b6..eebfaaa8 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1093,6 +1093,7 @@ MainWindow *main_window_create(SeparateType type) case TOOLBAR_BOTH: menuitem = gtk_item_factory_get_item (ifactory, "/View/Show or hide/Toolbar/Icon and text"); + break; } gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); @@ -1116,6 +1117,7 @@ MainWindow *main_window_create(SeparateType type) mainwin->ac_menu = ac_menu; main_window_set_toolbar_sensitive(mainwin); + main_window_set_toolbar_button_visibility(mainwin); /* create actions menu */ #ifndef G_OS_WIN32 @@ -1901,6 +1903,24 @@ void main_window_set_toolbar_sensitive(MainWindow *mainwin) static void main_window_set_toolbar_button_visibility(MainWindow *mainwin) { + GtkToolbarStyle style; + + if (prefs_common.toolbar_style == TOOLBAR_NONE) + style = -1; + else if (prefs_common.toolbar_style == TOOLBAR_ICON) + style = GTK_TOOLBAR_ICONS; + else if (prefs_common.toolbar_style == TOOLBAR_TEXT) + style = GTK_TOOLBAR_TEXT; + else if (prefs_common.toolbar_style == TOOLBAR_BOTH) + style = GTK_TOOLBAR_BOTH; + + if (style != -1) { + gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar), style); + gtk_widget_show(mainwin->toolbar); + gtk_widget_queue_resize(mainwin->toolbar); + } else + gtk_widget_hide(mainwin->toolbar); + if (mainwin->junk_btn) { if (prefs_common.enable_junk) gtk_widget_show(mainwin->junk_btn); @@ -3020,30 +3040,10 @@ static void toggle_message_cb(MainWindow *mainwin, guint action, static void toggle_toolbar_cb(MainWindow *mainwin, guint action, GtkWidget *widget) { - switch ((ToolbarStyle)action) { - case TOOLBAR_NONE: - gtk_widget_hide(mainwin->toolbar); - case TOOLBAR_ICON: - gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar), - GTK_TOOLBAR_ICONS); - break; - case TOOLBAR_TEXT: - gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar), - GTK_TOOLBAR_TEXT); - break; - case TOOLBAR_BOTH: - gtk_toolbar_set_style(GTK_TOOLBAR(mainwin->toolbar), - GTK_TOOLBAR_BOTH); - break; - } - - if (action != TOOLBAR_NONE) { - gtk_widget_show(mainwin->toolbar); - gtk_widget_queue_resize(mainwin->toolbar); - } - mainwin->toolbar_style = (ToolbarStyle)action; prefs_common.toolbar_style = (ToolbarStyle)action; + + main_window_set_toolbar_button_visibility(mainwin); } static void toggle_searchbar_cb(MainWindow *mainwin, guint action, |