aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-01-26 09:46:14 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-01-26 09:46:14 +0000
commitd896027c305c2f16dd226ed707f38daafa6a235f (patch)
tree243bdc23b9490211d4ab3996f83316ac866f2e0d
parent01ee9f70b0f84ad6b10a7c2c6eb6f6ee481d7a21 (diff)
fixed a bug that the toolbar state was reset to GTK_TOOLBAR_BOTH after the customization of toolbar.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1507 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--src/compose.c43
-rw-r--r--src/mainwindow.c44
4 files changed, 62 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index d18ae21e..94f4e849 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2007-01-26
+ * src/mainwindow.c
+ src/compose.c: fixed a bug that the toolbar state was reset to
+ GTK_TOOLBAR_BOTH after the customization of toolbar.
+
+2007-01-26
+
* src/prefs_toolbar.c
src/mainwindow.c
src/prefs_display_items.[ch]: set dialog title and label.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 4ede221d..5a9b13c3 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,11 @@
2007-01-26
+ * src/mainwindow.c
+ src/compose.c: ツールバーのカスタマイズの後ツールバーの状態が
+ GTK_TOOLBAR_BOTH にリセットされるバグを修正。
+
+2007-01-26
+
* src/prefs_toolbar.c
src/mainwindow.c
src/prefs_display_items.[ch]: ダイアログのタイトルとラベルをセット。
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,