diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-02-01 07:31:37 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-02-01 07:31:37 +0000 |
commit | 1f5dda88cb08345da903d560d8fb3e6431b5e8ab (patch) | |
tree | 75c239e6b759c02f7d354b8f316a44b267edda8c /src | |
parent | cbf7cb3b735e09d6ce449cf7a4c80ea4a6e9e616 (diff) |
refactored the toolbar structure.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1520 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/compose.c | 68 | ||||
-rw-r--r-- | src/compose.h | 4 | ||||
-rw-r--r-- | src/mainwindow.c | 97 | ||||
-rw-r--r-- | src/prefs_display_items.h | 5 | ||||
-rw-r--r-- | src/prefs_toolbar.c | 116 | ||||
-rw-r--r-- | src/prefs_toolbar.h | 4 |
6 files changed, 181 insertions, 113 deletions
diff --git a/src/compose.c b/src/compose.c index 9fb15715..ff48c1c3 100644 --- a/src/compose.c +++ b/src/compose.c @@ -101,10 +101,12 @@ #include "news.h" #include "customheader.h" #include "prefs_common.h" +#include "prefs_common_dialog.h" #include "prefs_account.h" #include "prefs_toolbar.h" #include "action.h" #include "account.h" +#include "account_dialog.h" #include "filesel.h" #include "procheader.h" #include "procmime.h" @@ -345,6 +347,10 @@ static void toolbar_linewrap_cb (GtkWidget *widget, gpointer data); static void toolbar_address_cb (GtkWidget *widget, gpointer data); +static void toolbar_prefs_common_cb (GtkWidget *widget, + gpointer data); +static void toolbar_prefs_account_cb (GtkWidget *widget, + gpointer data); static gboolean toolbar_button_pressed (GtkWidget *widget, GdkEventButton *event, @@ -4854,26 +4860,19 @@ static void compose_connect_changed_callbacks(Compose *compose) static PrefsToolbarItem items[] = { - {T_SEND, N_("Send message"), - STOCK_PIXMAP_MAIL_SEND, NULL, TRUE, toolbar_send_cb}, - {T_SEND_LATER, N_("Put into queue folder and send later"), - STOCK_PIXMAP_MAIL_SEND_QUEUE, NULL, TRUE, toolbar_send_later_cb}, - {T_DRAFT, N_("Save to draft folder"), - STOCK_PIXMAP_MAIL, NULL, TRUE, toolbar_draft_cb}, - {T_INSERT_FILE, N_("Insert file"), - STOCK_PIXMAP_INSERT_FILE, NULL, FALSE, toolbar_insert_cb}, - {T_ATTACH_FILE, N_("Attach file"), - STOCK_PIXMAP_MAIL_ATTACH, NULL, FALSE, toolbar_attach_cb}, - {T_SIGNATURE, N_("Append signature"), - STOCK_PIXMAP_SIGN, NULL, FALSE, toolbar_sig_cb}, - {T_EDITOR, N_("Edit with external editor"), - STOCK_PIXMAP_MAIL_COMPOSE, NULL, FALSE, toolbar_ext_editor_cb}, - {T_LINEWRAP, N_("Wrap all long lines"), - STOCK_PIXMAP_LINEWRAP, NULL, FALSE, toolbar_linewrap_cb}, - {T_ADDRESS_BOOK, N_("Address book"), - STOCK_PIXMAP_ADDRESS_BOOK, NULL, FALSE, toolbar_address_cb}, - - {-1, NULL, -1, NULL, NULL} + {T_SEND, TRUE, toolbar_send_cb}, + {T_SEND_LATER, TRUE, toolbar_send_later_cb}, + {T_DRAFT, TRUE, toolbar_draft_cb}, + {T_INSERT_FILE, FALSE, toolbar_insert_cb}, + {T_ATTACH_FILE, FALSE, toolbar_attach_cb}, + {T_SIGNATURE, FALSE, toolbar_sig_cb}, + {T_EDITOR, FALSE, toolbar_ext_editor_cb}, + {T_LINEWRAP, FALSE, toolbar_linewrap_cb}, + {T_ADDRESS_BOOK, FALSE, toolbar_address_cb}, + {T_COMMON_PREFS, FALSE, toolbar_prefs_common_cb}, + {T_ACCOUNT_PREFS, FALSE, toolbar_prefs_account_cb}, + + {-1, FALSE, NULL} }; static GtkWidget *compose_toolbar_create(Compose *compose) @@ -4920,7 +4919,9 @@ static GtkWidget *compose_toolbar_create_from_list(Compose *compose, items[6].data = &compose->exteditor_btn; items[7].data = &compose->linewrap_btn; items[8].data = &compose->addrbook_btn; - for (i = 0; i <= 8; i++) + items[9].data = &compose->prefs_common_btn; + items[10].data = &compose->prefs_account_btn; + for (i = 0; i <= 10; i++) *(GtkWidget **)items[i].data = NULL; for (cur = item_list; cur != NULL; cur = cur->next) { @@ -4942,16 +4943,19 @@ static GtkWidget *compose_toolbar_create_from_list(Compose *compose, if (item->id == -1) continue; - if (item->stock_id) { + if (ditem->stock_id) { icon_wid = gtk_image_new_from_stock - (item->stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR); + (ditem->stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR); } else - icon_wid = stock_pixbuf_widget(NULL, item->icon); + icon_wid = stock_pixbuf_widget(NULL, ditem->icon); toolitem = gtk_tool_button_new(icon_wid, gettext(ditem->label)); - tips = gtk_tooltips_new(); - gtk_tool_item_set_tooltip(toolitem, tips, - gettext(item->tooltip), ditem->name); + if (ditem->description) { + tips = gtk_tooltips_new(); + gtk_tool_item_set_tooltip(toolitem, tips, + gettext(ditem->description), + ditem->name); + } gtkut_get_str_size(GTK_WIDGET(toolitem), gettext(ditem->label), &width, NULL); @@ -5993,6 +5997,16 @@ static void toolbar_address_cb(GtkWidget *widget, gpointer data) compose_address_cb(data, 0, NULL); } +static void toolbar_prefs_common_cb(GtkWidget *widget, gpointer data) +{ + prefs_common_open(); +} + +static void toolbar_prefs_account_cb(GtkWidget *widget, gpointer data) +{ + account_open(cur_account); +} + static void toolbar_customize(GtkWidget *widget, gpointer data) { Compose *compose = (Compose *)data; diff --git a/src/compose.h b/src/compose.h index d1eba0a9..2a0136e5 100644 --- a/src/compose.h +++ b/src/compose.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2006 Hiroyuki Yamamoto + * Copyright (C) 1999-2007 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,6 +86,8 @@ struct _Compose GtkWidget *exteditor_btn; GtkWidget *linewrap_btn; GtkWidget *addrbook_btn; + GtkWidget *prefs_common_btn; + GtkWidget *prefs_account_btn; GtkWidget *vbox2; diff --git a/src/mainwindow.c b/src/mainwindow.c index f9fff54d..a4591a12 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -2394,40 +2394,24 @@ static GtkItemFactoryEntry forward_entries[] = static PrefsToolbarItem items[] = { - {T_GET, N_("Incorporate new mail"), - STOCK_PIXMAP_MAIL_RECEIVE, NULL, TRUE, toolbar_inc_cb}, - {T_GET_ALL, N_("Incorporate new mail of all accounts"), - STOCK_PIXMAP_MAIL_RECEIVE_ALL, NULL, TRUE, toolbar_inc_all_cb}, - {T_SEND_QUEUE, N_("Send queued message(s)"), - STOCK_PIXMAP_MAIL_SEND, NULL, TRUE, toolbar_send_cb}, - {T_COMPOSE, N_("Compose new message"), - STOCK_PIXMAP_MAIL_COMPOSE, NULL, TRUE, toolbar_compose_cb}, - {T_REPLY, N_("Reply to the message"), - STOCK_PIXMAP_MAIL_REPLY, NULL, TRUE, toolbar_reply_cb}, - {T_REPLY_ALL, N_("Reply to all"), - STOCK_PIXMAP_MAIL_REPLY_TO_ALL, NULL, TRUE, toolbar_reply_to_all_cb}, - {T_FORWARD, N_("Forward the message"), - STOCK_PIXMAP_MAIL_FORWARD, NULL, TRUE, toolbar_forward_cb}, - {T_DELETE, N_("Delete the message"), - STOCK_PIXMAP_DELETE, NULL, FALSE, toolbar_delete_cb}, - {T_JUNK, N_("Set as junk mail"), - STOCK_PIXMAP_SPAM, NULL, TRUE, toolbar_junk_cb}, - {T_EXECUTE, N_("Execute marked process"), - -1, GTK_STOCK_EXECUTE, FALSE, toolbar_exec_cb}, - {T_NEXT, N_("Next unread message"), - -1, GTK_STOCK_GO_DOWN, FALSE, toolbar_next_unread_cb}, - {T_PREV, N_("Previous unread message"), - -1, GTK_STOCK_GO_UP, FALSE, toolbar_prev_unread_cb}, - {T_ADDRESS_BOOK, N_("Address book"), - STOCK_PIXMAP_ADDRESS_BOOK, NULL, FALSE, toolbar_address_cb}, - {T_PRINT, N_("Print message"), - -1, GTK_STOCK_PRINT, FALSE, toolbar_print_cb}, - {T_COMMON_PREFS, N_("Common preferences"), - -1, GTK_STOCK_PREFERENCES, FALSE, toolbar_prefs_common_cb}, - {T_ACCOUNT_PREFS, N_("Account preferences"), - -1, GTK_STOCK_PREFERENCES, FALSE, toolbar_prefs_account_cb}, - - {-1, NULL, -1, NULL, FALSE, NULL} + {T_GET, TRUE, toolbar_inc_cb}, + {T_GET_ALL, TRUE, toolbar_inc_all_cb}, + {T_SEND_QUEUE, TRUE, toolbar_send_cb}, + {T_COMPOSE, TRUE, toolbar_compose_cb}, + {T_REPLY, TRUE, toolbar_reply_cb}, + {T_REPLY_ALL, TRUE, toolbar_reply_to_all_cb}, + {T_FORWARD, TRUE, toolbar_forward_cb}, + {T_DELETE, FALSE, toolbar_delete_cb}, + {T_JUNK, TRUE, toolbar_junk_cb}, + {T_NEXT, FALSE, toolbar_next_unread_cb}, + {T_PREV, FALSE, toolbar_prev_unread_cb}, + {T_PRINT, FALSE, toolbar_print_cb}, + {T_ADDRESS_BOOK, FALSE, toolbar_address_cb}, + {T_EXECUTE, FALSE, toolbar_exec_cb}, + {T_COMMON_PREFS, FALSE, toolbar_prefs_common_cb}, + {T_ACCOUNT_PREFS, FALSE, toolbar_prefs_account_cb}, + + {-1, FALSE, NULL} }; static GtkWidget *main_window_toolbar_create(MainWindow *mainwin) @@ -2477,11 +2461,11 @@ static GtkWidget *main_window_toolbar_create_from_list(MainWindow *mainwin, items[6].data = &mainwin->fwd_btn; items[7].data = &mainwin->delete_btn; items[8].data = &mainwin->junk_btn; - items[9].data = &mainwin->exec_btn; - items[10].data = &mainwin->next_btn; - items[11].data = &mainwin->prev_btn; + items[9].data = &mainwin->next_btn; + items[10].data = &mainwin->prev_btn; + items[11].data = &mainwin->print_btn; items[12].data = &mainwin->address_btn; - items[13].data = &mainwin->print_btn; + items[13].data = &mainwin->exec_btn; items[14].data = &mainwin->prefs_common_btn; items[15].data = &mainwin->prefs_account_btn; for (i = 0; i <= 15; i++) @@ -2508,16 +2492,19 @@ static GtkWidget *main_window_toolbar_create_from_list(MainWindow *mainwin, if (item->id == -1) continue; - if (item->stock_id) { + if (ditem->stock_id) { icon_wid = gtk_image_new_from_stock - (item->stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR); + (ditem->stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR); } else - icon_wid = stock_pixbuf_widget(NULL, item->icon); + icon_wid = stock_pixbuf_widget(NULL, ditem->icon); toolitem = gtk_tool_button_new(icon_wid, gettext(ditem->label)); - tips = gtk_tooltips_new(); - gtk_tool_item_set_tooltip(toolitem, tips, - gettext(item->tooltip), ditem->name); + if (ditem->description) { + tips = gtk_tooltips_new(); + gtk_tool_item_set_tooltip(toolitem, tips, + gettext(ditem->description), + ditem->name); + } gtkut_get_str_size(GTK_WIDGET(toolitem), gettext(ditem->label), &width, NULL); @@ -2546,10 +2533,13 @@ static GtkWidget *main_window_toolbar_create_from_list(MainWindow *mainwin, gtk_tool_item_set_homogeneous(comboitem, FALSE); gtk_container_add(GTK_CONTAINER(comboitem), GTK_WIDGET_PTR(combo)); - tips = gtk_tooltips_new(); - gtk_tool_item_set_tooltip(comboitem, tips, - gettext(item->tooltip), - ditem->name); + if (ditem->description) { + tips = gtk_tooltips_new(); + gtk_tool_item_set_tooltip + (comboitem, tips, + gettext(ditem->description), + ditem->name); + } gtk_toolbar_insert(GTK_TOOLBAR(toolbar), comboitem, -1); @@ -2568,10 +2558,13 @@ static GtkWidget *main_window_toolbar_create_from_list(MainWindow *mainwin, gtk_tool_item_set_homogeneous(comboitem, FALSE); gtk_container_add(GTK_CONTAINER(comboitem), GTK_WIDGET_PTR(combo)); - tips = gtk_tooltips_new(); - gtk_tool_item_set_tooltip(comboitem, tips, - gettext(item->tooltip), - ditem->name); + if (ditem->description) { + tips = gtk_tooltips_new(); + gtk_tool_item_set_tooltip + (comboitem, tips, + gettext(ditem->description), + ditem->name); + } gtk_toolbar_insert(GTK_TOOLBAR(toolbar), comboitem, -1); diff --git a/src/prefs_display_items.h b/src/prefs_display_items.h index c02ccf41..00c01806 100644 --- a/src/prefs_display_items.h +++ b/src/prefs_display_items.h @@ -26,11 +26,16 @@ typedef struct _PrefsDisplayItem PrefsDisplayItem; typedef struct _PrefsDisplayItemsDialog PrefsDisplayItemsDialog; +#include "stock_pixmap.h" + struct _PrefsDisplayItem { gint id; gchar *name; gchar *label; + gchar *description; + StockPixmap icon; + const gchar *stock_id; gboolean allow_multiple; gboolean in_use; }; diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c index 91d9ca93..2a8d0f0e 100644 --- a/src/prefs_toolbar.c +++ b/src/prefs_toolbar.c @@ -27,39 +27,92 @@ #include <glib/gi18n.h> #include <gtk/gtkwindow.h> #include <gtk/gtklabel.h> +#include <gtk/gtkstock.h> #include "prefs_toolbar.h" #include "prefs_display_items.h" static PrefsDisplayItem all_items[] = { - {T_SEPARATOR, "separator", N_("Separator"), TRUE, FALSE}, - {T_GET, "get", N_("Get"), FALSE, FALSE}, - {T_GET_ALL, "get-all", N_("Get all"), FALSE, FALSE}, - {T_SEND_QUEUE, "send-queue", N_("Send"), FALSE, FALSE}, - {T_COMPOSE, "compose", N_("Compose"), FALSE, FALSE}, - {T_REPLY, "reply", N_("Reply"), FALSE, FALSE}, - {T_REPLY_ALL, "reply-all", N_("Reply all"), FALSE, FALSE}, - {T_FORWARD, "forward", N_("Forward"), FALSE, FALSE}, - {T_DELETE, "delete", N_("Delete"), FALSE, FALSE}, - {T_JUNK, "junk", N_("Junk"), FALSE, FALSE}, - {T_EXECUTE, "execute", N_("Execute"), FALSE, FALSE}, - {T_NEXT, "next", N_("Next"), FALSE, FALSE}, - {T_PREV, "prev", N_("Prev"), FALSE, FALSE}, - {T_ADDRESS_BOOK,"address-book", N_("Address"), FALSE, FALSE}, - {T_PRINT, "print", N_("Print"), FALSE, FALSE}, - {T_COMMON_PREFS,"common-prefs", N_("Prefs"), FALSE, FALSE}, - {T_ACCOUNT_PREFS, - "account-prefs",N_("Account"), FALSE, FALSE}, - - {T_SEND, "send", N_("Send"), FALSE, FALSE}, - {T_SEND_LATER, "send-later", N_("Send later"), FALSE, FALSE}, - {T_DRAFT, "draft", N_("Draft"), FALSE, FALSE}, - {T_INSERT_FILE, "insert-file", N_("Insert"), FALSE, FALSE}, - {T_ATTACH_FILE, "attach-file", N_("Attach"), FALSE, FALSE}, - {T_SIGNATURE, "signature", N_("Signature"), FALSE, FALSE}, - {T_EDITOR, "editor", N_("Editor"), FALSE, FALSE}, - {T_LINEWRAP, "linewrap", N_("Linewrap"), FALSE, FALSE}, + {T_SEPARATOR, "separator", N_("Separator"), + NULL, 0, NULL, TRUE, FALSE}, + {T_GET, "get", N_("Get"), + N_("Incorporate new mail"), + STOCK_PIXMAP_MAIL_SEND, NULL, FALSE, FALSE}, + {T_GET_ALL, "get-all", N_("Get all"), + N_("Incorporate new mail of all accounts"), + STOCK_PIXMAP_MAIL_RECEIVE_ALL, NULL, FALSE, FALSE}, + {T_SEND_QUEUE, "send-queue", N_("Send"), + N_("Send queued message(s)"), + STOCK_PIXMAP_MAIL_SEND, NULL, FALSE, FALSE}, + {T_COMPOSE, "compose", N_("Compose"), + N_("Compose new message"), + STOCK_PIXMAP_MAIL_COMPOSE, NULL, FALSE, FALSE}, + {T_REPLY, "reply", N_("Reply"), + N_("Reply to the message"), + STOCK_PIXMAP_MAIL_REPLY, NULL, FALSE, FALSE}, + {T_REPLY_ALL, "reply-all", N_("Reply all"), + N_("Reply to all"), + STOCK_PIXMAP_MAIL_REPLY_TO_ALL, NULL, FALSE, FALSE}, + {T_FORWARD, "forward", N_("Forward"), + N_("Forward the message"), + STOCK_PIXMAP_MAIL_FORWARD, NULL, FALSE, FALSE}, + {T_DELETE, "delete", N_("Delete"), + N_("Delete the message"), + STOCK_PIXMAP_DELETE, NULL, FALSE, FALSE}, + {T_JUNK, "junk", N_("Junk"), + N_("Set as junk mail"), + STOCK_PIXMAP_SPAM, NULL, FALSE, FALSE}, + {T_NEXT, "next", N_("Next"), + N_("Next unread message"), + -1, GTK_STOCK_GO_DOWN, FALSE, FALSE}, + {T_PREV, "prev", N_("Prev"), + N_("Previous unread message"), + -1, GTK_STOCK_GO_UP, FALSE, FALSE}, + {T_PRINT, "print", N_("Print"), + N_("Print message"), + -1, GTK_STOCK_PRINT, FALSE, FALSE}, + {T_ADDRESS_BOOK, "address-book", N_("Address"), + N_("Address book"), + STOCK_PIXMAP_ADDRESS_BOOK, NULL, FALSE, FALSE}, + {T_EXECUTE, "execute", N_("Execute"), + N_("Execute marked process"), + -1, GTK_STOCK_EXECUTE, FALSE, FALSE}, + {T_COMMON_PREFS, "common-prefs", N_("Prefs"), + N_("Common preferences"), + -1, GTK_STOCK_PREFERENCES, FALSE, FALSE}, + {T_ACCOUNT_PREFS, "account-prefs", N_("Account"), + N_("Account preferences"), + -1, GTK_STOCK_PREFERENCES, FALSE, FALSE}, + + {T_SEND, "send", N_("Send"), + N_("Send message"), + STOCK_PIXMAP_MAIL_SEND, NULL, FALSE, FALSE}, + {T_SEND_LATER, "send-later", N_("Send later"), + N_("Put into queue folder and send later"), + STOCK_PIXMAP_MAIL_SEND_QUEUE, NULL, FALSE, FALSE}, + {T_DRAFT, "draft", N_("Draft"), + N_("Save to draft folder"), + -1, GTK_STOCK_SAVE, FALSE, FALSE}, + {T_INSERT_FILE, "insert-file", N_("Insert"), + N_("Insert file"), + STOCK_PIXMAP_INSERT_FILE, NULL, FALSE, FALSE}, + {T_ATTACH_FILE, "attach-file", N_("Attach"), + N_("Attach file"), + STOCK_PIXMAP_MAIL_ATTACH, NULL, FALSE, FALSE}, + {T_SIGNATURE, "signature", N_("Signature"), + N_("Append signature"), + STOCK_PIXMAP_SIGN, NULL, FALSE, FALSE}, + {T_EDITOR, "editor", N_("Editor"), + N_("Edit with external editor"), +#ifdef GTK_STOCK_EDIT + -1, GTK_STOCK_EDIT, FALSE, FALSE}, +#else + STOCK_PIXMAP_MAIL_COMPOSE, NULL, FALSE, FALSE}, +#endif + {T_LINEWRAP, "linewrap", N_("Linewrap"), + N_("Wrap all long lines"), + STOCK_PIXMAP_LINEWRAP, NULL, FALSE, FALSE}, {-1, NULL, NULL, FALSE, FALSE} }; @@ -76,11 +129,11 @@ static gint main_available_items[] = T_FORWARD, T_DELETE, T_JUNK, - T_EXECUTE, T_NEXT, T_PREV, - T_ADDRESS_BOOK, T_PRINT, + T_ADDRESS_BOOK, + T_EXECUTE, T_COMMON_PREFS, T_ACCOUNT_PREFS, -1 @@ -98,6 +151,8 @@ static gint compose_available_items[] = T_EDITOR, T_LINEWRAP, T_ADDRESS_BOOK, + T_COMMON_PREFS, + T_ACCOUNT_PREFS, -1 }; @@ -117,6 +172,9 @@ static gint default_main_items[] = T_JUNK, T_SEPARATOR, T_NEXT, + T_SEPARATOR, + T_PRINT, + T_ADDRESS_BOOK, -1 }; diff --git a/src/prefs_toolbar.h b/src/prefs_toolbar.h index 50697276..a63f218e 100644 --- a/src/prefs_toolbar.h +++ b/src/prefs_toolbar.h @@ -26,7 +26,6 @@ typedef struct _PrefsToolbarItem PrefsToolbarItem; #include "prefs_display_items.h" -#include "stock_pixmap.h" typedef enum { @@ -70,9 +69,6 @@ typedef enum struct _PrefsToolbarItem { gint id; - gchar *tooltip; - StockPixmap icon; - const gchar *stock_id; gboolean is_important; void (*callback) (GtkWidget *widget, gpointer data); gpointer data; |