2007-10-07 [colin] 3.0.2cvs24
authorColin Leroy <colin@colino.net>
Sun, 7 Oct 2007 08:58:46 +0000 (08:58 +0000)
committerColin Leroy <colin@colino.net>
Sun, 7 Oct 2007 08:58:46 +0000 (08:58 +0000)
* src/prefs_toolbar.c
* src/toolbar.c
* src/toolbar.h
Update icon to default one when changing event
Make the icon chooser nicer (handle Esc, Enter,
double-click)

ChangeLog
PATCHSETS
configure.ac
src/prefs_toolbar.c
src/toolbar.c
src/toolbar.h

index e42a1ef..54f3711 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-10-07 [colin]     3.0.2cvs24
+
+       * src/prefs_toolbar.c
+       * src/toolbar.c
+       * src/toolbar.h
+               Update icon to default one when changing event
+               Make the icon chooser nicer (handle Esc, Enter,
+               double-click)
+
 2007-10-06 [colin]     3.0.2cvs23
 
        * src/prefs_toolbar.c
index 4a383b6..cf2ff53 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.30.2.37 -r 1.30.2.38 src/prefs_toolbar.c;  cvs diff -u -r 1.43.2.85 -r 1.43.2.86 src/toolbar.c;  ) > 3.0.2cvs21.patchset
 ( cvs diff -u -r 1.19.2.22 -r 1.19.2.23 src/toolbar.h;  ) > 3.0.2cvs22.patchset
 ( cvs diff -u -r 1.30.2.38 -r 1.30.2.39 src/prefs_toolbar.c;  ) > 3.0.2cvs23.patchset
+( cvs diff -u -r 1.30.2.39 -r 1.30.2.40 src/prefs_toolbar.c;  cvs diff -u -r 1.43.2.86 -r 1.43.2.87 src/toolbar.c;  cvs diff -u -r 1.19.2.23 -r 1.19.2.24 src/toolbar.h;  ) > 3.0.2cvs24.patchset
index 361bf45..6f02e9b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=23
+EXTRA_VERSION=24
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6fb6012..212158d 100644 (file)
@@ -670,6 +670,16 @@ static void func_selection_changed(GtkComboBox *action_combo,
                        gtk_entry_set_text(GTK_ENTRY(prefs_toolbar->item_text_entry), 
                                        toolbar_get_short_text(action));
                g_free(text);
+               if (action >= 0) {
+                       StockPixmap stockp = toolbar_get_icon(action);
+                       if (stockp >= 0)  {
+                               g_free(prefs_toolbar->item_icon_file);
+                               prefs_toolbar->item_icon_file = g_strdup(stock_pixmap_get_name(stockp));
+
+                               gtk_button_set_image(GTK_BUTTON(prefs_toolbar->icon_button),
+                                    stock_pixmap_widget(prefs_toolbar->window, stockp));
+                       }
+               }
        } 
 }
 
@@ -1201,6 +1211,23 @@ static void icon_chooser_cancel_clicked(GtkButton *button,
        prefs_toolbar->icon_chooser_list = NULL;
 }
 
+static gboolean icon_chooser_key_pressed(GtkWidget *widget, GdkEventKey *event,
+                       ToolbarPage *prefs_toolbar)
+{
+       if (event && event->keyval == GDK_Escape) {
+               icon_chooser_cancel_clicked(NULL, prefs_toolbar);
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static void icon_chooser_tree_activated(GtkTreeView *treeview, GtkTreePath *path,
+                                    GtkTreeViewColumn *column, ToolbarPage *prefs_toolbar)
+{
+       icon_chooser_ok_clicked(NULL, prefs_toolbar);
+}
+
 static void icon_chooser_create(GtkButton *button, ToolbarPage *prefs_toolbar)
 {
        static GtkWidget *icon_chooser_win;
@@ -1305,7 +1332,11 @@ static void icon_chooser_create(GtkButton *button, ToolbarPage *prefs_toolbar)
                         G_CALLBACK(icon_chooser_ok_clicked), prefs_toolbar);
        g_signal_connect(G_OBJECT(cancel_btn), "clicked",
                         G_CALLBACK(icon_chooser_cancel_clicked), prefs_toolbar);
-       
+       g_signal_connect(G_OBJECT(icon_chooser_win), "key_press_event",
+                        G_CALLBACK(icon_chooser_key_pressed), prefs_toolbar);
+       g_signal_connect(G_OBJECT(list_view), "row-activated",
+                        G_CALLBACK(icon_chooser_tree_activated), prefs_toolbar);
+
        gtk_widget_show_all(icon_chooser_win);
        gtk_window_set_modal(GTK_WINDOW(icon_chooser_win), TRUE);
        
index 6d71a8d..7694b50 100644 (file)
@@ -437,6 +437,7 @@ const gchar *toolbar_get_short_text(int action) {
        case A_LINEWRAP_ALL:    return _("Wrap all");
        case A_ADDRBOOK:        return _("Address");
        case A_CANCEL_INC:      return _("Stop");
+       case A_EXECUTE:         return _("Execute");
        #ifdef USE_ASPELL
        case A_CHECK_SPELLING:  return _("Check spelling");
        #endif
@@ -444,37 +445,78 @@ const gchar *toolbar_get_short_text(int action) {
        }
 }
 
+gint toolbar_get_icon(int action) {
+       switch(action) {
+       case A_GO_FOLDERS:      return STOCK_PIXMAP_GO_FOLDERS;
+       case A_OPEN_MAIL:       return STOCK_PIXMAP_OPEN_MAIL;
+       case A_RECEIVE_ALL:     return STOCK_PIXMAP_MAIL_RECEIVE_ALL;
+       case A_RECEIVE_CUR:     return STOCK_PIXMAP_MAIL_RECEIVE;
+       case A_SEND_QUEUED:     return STOCK_PIXMAP_MAIL_SEND_QUEUE;
+       case A_COMPOSE_EMAIL:   return STOCK_PIXMAP_MAIL_COMPOSE;
+       case A_COMPOSE_NEWS:    return STOCK_PIXMAP_NEWS_COMPOSE;
+       case A_REPLY_MESSAGE:   return STOCK_PIXMAP_MAIL_REPLY;
+       case A_REPLY_ALL:       return STOCK_PIXMAP_MAIL_REPLY_TO_ALL;
+       case A_REPLY_SENDER:    return STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR;
+       case A_REPLY_ML:        return STOCK_PIXMAP_MAIL_REPLY;
+       case A_FORWARD:         return STOCK_PIXMAP_MAIL_FORWARD;
+       case A_TRASH:           return STOCK_PIXMAP_TRASH;
+       case A_DELETE_REAL:     return STOCK_PIXMAP_DELETED;
+       case A_LEARN_SPAM:      return STOCK_PIXMAP_SPAM_BTN;
+       case A_GOTO_PREV:       return STOCK_PIXMAP_UP_ARROW;
+       case A_GOTO_NEXT:       return STOCK_PIXMAP_DOWN_ARROW;
+       case A_IGNORE_THREAD:   return STOCK_PIXMAP_IGNORETHREAD;
+       case A_WATCH_THREAD:    return STOCK_PIXMAP_WATCHTHREAD;
+       case A_PRINT:           return STOCK_PIXMAP_PRINTER;
+       case A_CLOSE:           return STOCK_PIXMAP_CLOSE;
+       case A_SEND:            return STOCK_PIXMAP_MAIL_SEND;
+       case A_SENDL:           return STOCK_PIXMAP_MAIL_SEND_QUEUE;
+       case A_DRAFT:           return STOCK_PIXMAP_MAIL;
+       case A_INSERT:          return STOCK_PIXMAP_INSERT_FILE;
+       case A_ATTACH:          return STOCK_PIXMAP_MAIL_ATTACH;
+       case A_SIG:             return STOCK_PIXMAP_MAIL_SIGN;
+       case A_EXTEDITOR:       return STOCK_PIXMAP_EDIT_EXTERN;
+       case A_LINEWRAP_CURRENT:return STOCK_PIXMAP_LINEWRAP_CURRENT;
+       case A_LINEWRAP_ALL:    return STOCK_PIXMAP_LINEWRAP_ALL;
+       case A_ADDRBOOK:        return STOCK_PIXMAP_ADDRESS_BOOK;
+       case A_CANCEL_INC:      return STOCK_PIXMAP_NOTICE_ERROR;
+       case A_EXECUTE:         return STOCK_PIXMAP_EXEC;
+       #ifdef USE_ASPELL
+       case A_CHECK_SPELLING:  return STOCK_PIXMAP_CHECK_SPELLING;
+       #endif
+       default:                return -1;
+       }
+}
+
 static void toolbar_set_default_main(void) 
 {
        struct {
                gint action;
-               gint icon;
        } default_toolbar[] = {
 #ifdef MAEMO
-               { A_GO_FOLDERS,    STOCK_PIXMAP_GO_FOLDERS },
-               { A_OPEN_MAIL,     STOCK_PIXMAP_OPEN_MAIL  },           
-               { A_SEPARATOR,     0                       }, 
+               { A_GO_FOLDERS},
+               { A_OPEN_MAIL},         
+               { A_SEPARATOR}, 
 #endif
-               { A_RECEIVE_ALL,   STOCK_PIXMAP_MAIL_RECEIVE_ALL },
-               { A_SEPARATOR,     0}, 
-               { A_SEND_QUEUED,   STOCK_PIXMAP_MAIL_SEND_QUEUE},
-               { A_COMPOSE_EMAIL, STOCK_PIXMAP_MAIL_COMPOSE },
-               { A_SEPARATOR,     0},
-               { A_REPLY_MESSAGE, STOCK_PIXMAP_MAIL_REPLY}, 
+               { A_RECEIVE_ALL},
+               { A_SEPARATOR}, 
+               { A_SEND_QUEUED},
+               { A_COMPOSE_EMAIL},
+               { A_SEPARATOR},
+               { A_REPLY_MESSAGE}, 
 #ifndef MAEMO
-               { A_REPLY_ALL,     STOCK_PIXMAP_MAIL_REPLY_TO_ALL},
-               { A_REPLY_SENDER,  STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR},
+               { A_REPLY_ALL},
+               { A_REPLY_SENDER},
 #endif
-               { A_FORWARD,       STOCK_PIXMAP_MAIL_FORWARD},
-               { A_SEPARATOR,     0},
-               { A_TRASH,         STOCK_PIXMAP_TRASH},
+               { A_FORWARD},
+               { A_SEPARATOR},
+               { A_TRASH},
 #ifndef MAEMO
 #if (defined(USE_SPAMASSASSIN_PLUGIN) || defined(USE_BOGOFILTER_PLUGIN))
-               { A_LEARN_SPAM,    STOCK_PIXMAP_SPAM_BTN},
+               { A_LEARN_SPAM},
 #endif
 #endif
-               { A_SEPARATOR,     0},
-               { A_GOTO_NEXT,     STOCK_PIXMAP_DOWN_ARROW }
+               { A_SEPARATOR},
+               { A_GOTO_NEXT}
        };
        
        gint i;
@@ -485,7 +527,7 @@ static void toolbar_set_default_main(void)
                
                if (default_toolbar[i].action != A_SEPARATOR) {
                        
-                       gchar *file = stock_pixmap_get_name((StockPixmap)default_toolbar[i].icon);
+                       gchar *file = stock_pixmap_get_name((StockPixmap)toolbar_get_short_text(default_toolbar[i].action));
                        
                        toolbar_item->file  = g_strdup(file);
                        toolbar_item->index = default_toolbar[i].action;
@@ -508,22 +550,21 @@ static void toolbar_set_default_compose(void)
 {
        struct {
                gint action;
-               gint icon;
        } default_toolbar[] = {
 #ifdef MAEMO
-               { A_CLOSE,              STOCK_PIXMAP_CLOSE},
-               { A_SEPARATOR,          0}, 
+               { A_CLOSE},
+               { A_SEPARATOR}, 
 #endif
-               { A_SEND,               STOCK_PIXMAP_MAIL_SEND},
-               { A_SENDL,              STOCK_PIXMAP_MAIL_SEND_QUEUE},
-               { A_DRAFT,              STOCK_PIXMAP_MAIL},
-               { A_SEPARATOR,          0}, 
+               { A_SEND},
+               { A_SENDL},
+               { A_DRAFT},
+               { A_SEPARATOR}, 
 #ifndef MAEMO
-               { A_INSERT,             STOCK_PIXMAP_INSERT_FILE},
+               { A_INSERT},
 #endif
-               { A_ATTACH,             STOCK_PIXMAP_MAIL_ATTACH},
-               { A_SEPARATOR,          0},
-               { A_ADDRBOOK,           STOCK_PIXMAP_ADDRESS_BOOK       }
+               { A_ATTACH},
+               { A_SEPARATOR},
+               { A_ADDRBOOK}
        };
        
        gint i;
@@ -534,7 +575,7 @@ static void toolbar_set_default_compose(void)
                
                if (default_toolbar[i].action != A_SEPARATOR) {
                        
-                       gchar *file = stock_pixmap_get_name((StockPixmap)default_toolbar[i].icon);
+                       gchar *file = stock_pixmap_get_name((StockPixmap)toolbar_get_short_text(default_toolbar[i].action));
                        
                        toolbar_item->file  = g_strdup(file);
                        toolbar_item->index = default_toolbar[i].action;
@@ -557,24 +598,23 @@ static void toolbar_set_default_msgview(void)
 {
        struct {
                gint action;
-               gint icon;
        } default_toolbar[] = {
 #ifdef MAEMO
-               { A_CLOSE,              STOCK_PIXMAP_CLOSE},
-               { A_SEPARATOR,          0}, 
+               { A_CLOSE},
+               { A_SEPARATOR}, 
 #endif
-               { A_REPLY_MESSAGE, STOCK_PIXMAP_MAIL_REPLY}, 
-               { A_REPLY_ALL,     STOCK_PIXMAP_MAIL_REPLY_TO_ALL},
-               { A_REPLY_SENDER,  STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR},
-               { A_FORWARD,       STOCK_PIXMAP_MAIL_FORWARD},
-               { A_SEPARATOR,     0},
-               { A_TRASH,         STOCK_PIXMAP_TRASH},
+               { A_REPLY_MESSAGE}, 
+               { A_REPLY_ALL},
+               { A_REPLY_SENDER},
+               { A_FORWARD},
+               { A_SEPARATOR},
+               { A_TRASH},
 #ifndef MAEMO
 #if (defined(USE_SPAMASSASSIN_PLUGIN) || defined(USE_BOGOFILTER_PLUGIN))
-               { A_LEARN_SPAM,    STOCK_PIXMAP_SPAM_BTN},
+               { A_LEARN_SPAM},
 #endif
 #endif
-               { A_GOTO_NEXT,     STOCK_PIXMAP_DOWN_ARROW }
+               { A_GOTO_NEXT}
        };
        
        gint i;
@@ -585,7 +625,7 @@ static void toolbar_set_default_msgview(void)
                
                if (default_toolbar[i].action != A_SEPARATOR) {
                        
-                       gchar *file = stock_pixmap_get_name((StockPixmap)default_toolbar[i].icon);
+                       gchar *file = stock_pixmap_get_name((StockPixmap)toolbar_get_short_text(default_toolbar[i].action));
                        
                        toolbar_item->file  = g_strdup(file);
                        toolbar_item->index = default_toolbar[i].action;
index e15b60a..f05c134 100644 (file)
@@ -262,4 +262,5 @@ void        toolbar_init                    (Toolbar        *toolbar);
 void toolbar_set_learn_button          (Toolbar        *toolbar, 
                                         LearnButtonType  learn_btn_type);
 const gchar *toolbar_get_short_text    (int action);
+int         toolbar_get_icon           (int action);
 #endif /* __CUSTOM_TOOLBAR_H__ */