aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--libsylph/prefs_common.c2
-rw-r--r--libsylph/prefs_common.h1
-rw-r--r--src/messageview.c35
-rw-r--r--src/prefs_common_dialog.c96
5 files changed, 123 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index e01ad34e..9902647b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-08-15
+
+ * libsylph/prefs_common.[ch]
+ src/messageview.c
+ src/prefs_common_dialog.c: added an option to specify the position
+ of attach tool button.
+
2012-08-08
* src/main.c: enabled viewing of external rfc822 message files.
diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c
index b3d5dc48..8652d9c9 100644
--- a/libsylph/prefs_common.c
+++ b/libsylph/prefs_common.c
@@ -331,6 +331,8 @@ static PrefParam param[] = {
{"show_attach_tab", "FALSE", &prefs_common.show_attach_tab, P_BOOL},
{"show_attached_files_first", "TRUE",
&prefs_common.show_attached_files_first, P_BOOL},
+ {"attach_toolbutton_pos", "0", &prefs_common.attach_toolbutton_pos,
+ P_INT},
{"display_header", "TRUE", &prefs_common.display_header, P_BOOL},
{"render_html", "TRUE", &prefs_common.render_html, P_BOOL},
{"html_only_as_attach", "FALSE", &prefs_common.html_only_as_attach,
diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h
index e8c7f07b..ea31f6fd 100644
--- a/libsylph/prefs_common.h
+++ b/libsylph/prefs_common.h
@@ -340,6 +340,7 @@ struct _PrefsCommon
gboolean show_attach_tab; /* Message - Attachment */
gboolean show_attached_files_first; /* Message - Attachment */
+ gint attach_toolbutton_pos; /* Message - Attachment */
};
extern PrefsCommon prefs_common;
diff --git a/src/messageview.c b/src/messageview.c
index e59046e2..07496b6c 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -69,6 +69,8 @@
static GList *messageview_list = NULL;
+static void messageview_set_mime_view_layout
+ (MessageView *messageview);
static void messageview_change_view_type(MessageView *messageview,
MessageType type);
static void messageview_set_tool_menu (MessageView *messageview,
@@ -556,14 +558,8 @@ void messageview_init(MessageView *messageview)
void messageview_reflect_prefs(MessageView *messageview)
{
- if (messageview->type == MVIEW_MIME) {
- if (prefs_common.show_attach_tab)
- gtk_widget_hide(messageview->toolbar_vbox);
- else
- gtk_widget_show(messageview->toolbar_vbox);
- gtk_notebook_set_show_tabs(GTK_NOTEBOOK(messageview->notebook),
- prefs_common.show_attach_tab);
- }
+ if (messageview->type == MVIEW_MIME)
+ messageview_set_mime_view_layout(messageview);
}
GList *messageview_get_window_list(void)
@@ -637,6 +633,22 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
return 0;
}
+static void messageview_set_mime_view_layout(MessageView *messageview)
+{
+ if (prefs_common.attach_toolbutton_pos == 0)
+ gtk_box_set_child_packing(GTK_BOX(messageview->hbox), messageview->toolbar_vbox, FALSE, FALSE, 0, GTK_PACK_START);
+ else
+ gtk_box_set_child_packing(GTK_BOX(messageview->hbox), messageview->toolbar_vbox, FALSE, FALSE, 0, GTK_PACK_END);
+
+ if (prefs_common.show_attach_tab)
+ gtk_widget_hide(messageview->toolbar_vbox);
+ else
+ gtk_widget_show(messageview->toolbar_vbox);
+
+ gtk_notebook_set_show_tabs(GTK_NOTEBOOK(messageview->notebook),
+ prefs_common.show_attach_tab);
+}
+
static void messageview_change_view_type(MessageView *messageview,
MessageType type)
{
@@ -645,12 +657,7 @@ static void messageview_change_view_type(MessageView *messageview,
if (messageview->type == type) return;
if (type == MVIEW_MIME) {
- if (prefs_common.show_attach_tab)
- gtk_widget_hide(messageview->toolbar_vbox);
- else
- gtk_widget_show(messageview->toolbar_vbox);
- gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook),
- prefs_common.show_attach_tab);
+ messageview_set_mime_view_layout(messageview);
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook),
messageview->current_page);
if (messageview->current_page == 0)
diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c
index 1a3a1cba..847a4fe6 100644
--- a/src/prefs_common_dialog.c
+++ b/src/prefs_common_dialog.c
@@ -171,6 +171,7 @@ static struct Message {
} message;
static struct Attach {
+ GtkWidget *radiobtn_attach_toolbtn_pos;
GtkWidget *chkbtn_show_attach_tab;
GtkWidget *chkbtn_show_files_first;
@@ -299,6 +300,9 @@ static void prefs_common_uri_set_entry (PrefParam *pparam);
static void prefs_common_addr_compl_set_data_from_radiobtn (PrefParam *pparam);
static void prefs_common_addr_compl_set_radiobtn (PrefParam *pparam);
+static void prefs_common_attach_toolbtn_pos_set_data_from_radiobtn (PrefParam *pparam);
+static void prefs_common_attach_toolbtn_pos_set_radiobtn (PrefParam *pparam);
+
static PrefsUIData ui_data[] = {
/* Receive */
{"autochk_newmail", &receive.checkbtn_autochk,
@@ -469,6 +473,9 @@ static PrefsUIData ui_data[] = {
prefs_set_data_from_toggle, prefs_set_toggle},
/* Attachment */
+ {"attach_toolbutton_pos", &attach.radiobtn_attach_toolbtn_pos,
+ prefs_common_attach_toolbtn_pos_set_data_from_radiobtn,
+ prefs_common_attach_toolbtn_pos_set_radiobtn},
{"show_attach_tab", &attach.chkbtn_show_attach_tab,
prefs_set_data_from_toggle, prefs_set_toggle},
{"show_attached_files_first", &attach.chkbtn_show_files_first,
@@ -2009,6 +2016,10 @@ static GtkWidget *prefs_attach_create(void)
{
GtkWidget *vbox1;
GtkWidget *vbox2;
+ GtkWidget *hbox1;
+ GtkWidget *label;
+ GtkWidget *radiobtn_attach_toolbtn_pos;
+ GtkWidget *radiobtn_attach_toolbtn_pos2;
GtkWidget *chkbtn_show_attach_tab;
GtkWidget *chkbtn_show_files_first;
GtkWidget *frame_image;
@@ -2023,10 +2034,36 @@ static GtkWidget *prefs_attach_create(void)
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
- PACK_CHECK_BUTTON(vbox2, chkbtn_show_attach_tab,
- _("Toggle attachment list view with tab"));
- PACK_CHECK_BUTTON(vbox2, chkbtn_show_files_first,
- _("Show attached files first on message view"));
+ hbox1 = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox1);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Position of attachment tool button:"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
+
+ radiobtn_attach_toolbtn_pos = gtk_radio_button_new_with_label
+ (NULL, _("Left"));
+ gtk_widget_show (radiobtn_attach_toolbtn_pos);
+ gtk_box_pack_start (GTK_BOX(hbox1), radiobtn_attach_toolbtn_pos,
+ FALSE, FALSE, 0);
+ g_object_set_data (G_OBJECT (radiobtn_attach_toolbtn_pos), MENU_VAL_ID,
+ GINT_TO_POINTER (0));
+
+ radiobtn_attach_toolbtn_pos2 = gtk_radio_button_new_with_label_from_widget
+ (GTK_RADIO_BUTTON (radiobtn_attach_toolbtn_pos), _("Right"));
+ gtk_widget_show (radiobtn_attach_toolbtn_pos2);
+ gtk_box_pack_start (GTK_BOX (hbox1), radiobtn_attach_toolbtn_pos2,
+ FALSE, FALSE, 0);
+ g_object_set_data (G_OBJECT (radiobtn_attach_toolbtn_pos2), MENU_VAL_ID,
+ GINT_TO_POINTER (1));
+
+ PACK_CHECK_BUTTON (vbox2, chkbtn_show_attach_tab,
+ _("Toggle attachment list view with tab"));
+ SET_TOGGLE_SENSITIVITY_REV (chkbtn_show_attach_tab, hbox1);
+
+ PACK_CHECK_BUTTON (vbox2, chkbtn_show_files_first,
+ _("Show attached files first on message view"));
PACK_FRAME(vbox1, frame_image, _("Images"));
@@ -2041,6 +2078,7 @@ static GtkWidget *prefs_attach_create(void)
_("Display images as inline"));
attach.chkbtn_show_attach_tab = chkbtn_show_attach_tab;
+ attach.radiobtn_attach_toolbtn_pos = radiobtn_attach_toolbtn_pos;
attach.chkbtn_show_files_first = chkbtn_show_files_first;
attach.chkbtn_resize_image = chkbtn_resize_image;
@@ -4441,6 +4479,56 @@ static void prefs_common_addr_compl_set_radiobtn(PrefParam *pparam)
}
}
+static void prefs_common_attach_toolbtn_pos_set_data_from_radiobtn(PrefParam *pparam)
+{
+ PrefsUIData *ui_data;
+ GtkRadioButton *radiobtn;
+ GSList *group;
+
+ ui_data = (PrefsUIData *)pparam->ui_data;
+ g_return_if_fail(ui_data != NULL);
+ g_return_if_fail(*ui_data->widget != NULL);
+
+ radiobtn = GTK_RADIO_BUTTON(*ui_data->widget);
+ group = gtk_radio_button_get_group(radiobtn);
+ while (group != NULL) {
+ GtkToggleButton *btn = GTK_TOGGLE_BUTTON(group->data);
+
+ if (gtk_toggle_button_get_active(btn)) {
+ prefs_common.attach_toolbutton_pos =
+ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(btn), MENU_VAL_ID));
+ break;
+ }
+ group = group->next;
+ }
+}
+
+static void prefs_common_attach_toolbtn_pos_set_radiobtn(PrefParam *pparam)
+{
+ PrefsUIData *ui_data;
+ GtkRadioButton *radiobtn;
+ GSList *group;
+
+ ui_data = (PrefsUIData *)pparam->ui_data;
+ g_return_if_fail(ui_data != NULL);
+ g_return_if_fail(*ui_data->widget != NULL);
+
+ radiobtn = GTK_RADIO_BUTTON(*ui_data->widget);
+ group = gtk_radio_button_get_group(radiobtn);
+ while (group != NULL) {
+ GtkToggleButton *btn = GTK_TOGGLE_BUTTON(group->data);
+ gint data;
+
+ data = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(btn),
+ MENU_VAL_ID));
+ if (data == prefs_common.attach_toolbutton_pos) {
+ gtk_toggle_button_set_active(btn, TRUE);
+ break;
+ }
+ group = group->next;
+ }
+}
+
static void prefs_common_dispitem_clicked(void)
{
prefs_summary_column_open(FOLDER_ITEM_IS_SENT_FOLDER