2005-08-27 [colin] 1.9.13cvs61
authorColin Leroy <colin@colino.net>
Sat, 27 Aug 2005 12:12:03 +0000 (12:12 +0000)
committerColin Leroy <colin@colino.net>
Sat, 27 Aug 2005 12:12:03 +0000 (12:12 +0000)
* src/toolbar.c
* src/toolbar.h
Remove A_DELETE, replace it with
A_TRASH and A_DELETE_REAL. Automatically
rewrite config files to replace A_DELETE
with A_TRASH (no functionality change).
Fixes half of #794

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/toolbar.c
src/toolbar.h

index cae1fd91b4f62c438b37bd5135f4cd38f43aa6b2..d44ce846e86959736fb275a36c318cc1eb8286af 100644 (file)
@@ -1,3 +1,13 @@
+2005-08-27 [colin]     1.9.13cvs61
+
+       * src/toolbar.c
+       * src/toolbar.h
+               Remove A_DELETE, replace it with 
+               A_TRASH and A_DELETE_REAL. Automatically
+               rewrite config files to replace A_DELETE
+               with A_TRASH (no functionality change).
+               Fixes half of #794
+
 2005-08-26 [colin]     1.9.13cvs60
 
        * src/procmime.c
index 26ec3f375b3b45a874e81920f8b949b584668296..ffb8d40f21627a8e6524247366b464658c55225c 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.155 -r 1.382.2.156 src/compose.c;  ) > 1.9.13cvs58.patchset
 ( cvs diff -u -r 1.49.2.55 -r 1.49.2.56 src/procmime.c;  cvs diff -u -r 1.150.2.40 -r 1.150.2.41 src/procmsg.c;  cvs diff -u -r 1.382.2.156 -r 1.382.2.157 src/compose.c;  ) > 1.9.13cvs59.patchset
 ( cvs diff -u -r 1.49.2.56 -r 1.49.2.57 src/procmime.c;  ) > 1.9.13cvs60.patchset
+( cvs diff -u -r 1.43.2.21 -r 1.43.2.22 src/toolbar.c;  cvs diff -u -r 1.19.2.4 -r 1.19.2.5 src/toolbar.h;  ) > 1.9.13cvs61.patchset
index 550c35dead0eed26725136d87d4ddebe537815ea..b95d1a3cd8090928162a1de84d1ebd6daa03fdd0 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=60
+EXTRA_VERSION=61
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0c2112114a6241b0b8e2afab0daf180e6c528b0c..8eb645e4ce59ac27057412ee924693d8df3d215f 100644 (file)
@@ -91,6 +91,8 @@ static void toolbar_reply                     (gpointer        data,
                                                 guint           action);
 static void toolbar_delete_cb                  (GtkWidget      *widget,
                                                 gpointer        data);
+static void toolbar_trash_cb                   (GtkWidget      *widget,
+                                                gpointer        data);
 
 static void toolbar_compose_cb                 (GtkWidget      *widget,
                                                 gpointer        data);
@@ -164,7 +166,8 @@ struct {
        { "A_REPLY_ALL",        N_("Reply to All")                         },
        { "A_REPLY_ML",         N_("Reply to Mailing-list")                },
        { "A_FORWARD",          N_("Forward Message")                      }, 
-       { "A_DELETE",           N_("Delete Message")                       },
+       { "A_TRASH",            N_("Trash Message")                        },
+       { "A_DELETE_REAL",      N_("Delete Message")                       },
        { "A_EXECUTE",          N_("Execute")                              },
        { "A_GOTO_PREV",        N_("Go to Previous Unread Message")        },
        { "A_GOTO_NEXT",        N_("Go to Next Unread Message")            },
@@ -257,7 +260,7 @@ static gint toolbar_ret_val_from_text(const gchar *text)
                if (g_utf8_collate(toolbar_text[i].index_str, text) == 0)
                                return i;
        }
-       
+
        return -1;
 }
 
@@ -297,7 +300,7 @@ GList *toolbar_get_action_items(ToolbarType source)
                gint main_items[]   = { A_RECEIVE_ALL,   A_RECEIVE_CUR,   A_SEND_QUEUED,
                                        A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER, 
                                        A_REPLY_ALL,     A_REPLY_ML,      A_FORWARD, 
-                                       A_DELETE,        A_EXECUTE,       A_GOTO_PREV, 
+                                       A_TRASH , A_DELETE_REAL,       A_EXECUTE,       A_GOTO_PREV, 
                                        A_GOTO_NEXT,    A_IGNORE_THREAD,  A_PRINT,
                                        A_ADDRBOOK,      A_SYL_ACTIONS };
 
@@ -326,7 +329,7 @@ GList *toolbar_get_action_items(ToolbarType source)
        else if (source == TOOLBAR_MSGVIEW) {
                gint msgv_items[] =   { A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
                                        A_REPLY_ALL,     A_REPLY_ML,      A_FORWARD,
-                                       A_DELETE,        A_GOTO_PREV,     A_GOTO_NEXT,
+                                       A_TRASH, A_DELETE_REAL,       A_GOTO_PREV,        A_GOTO_NEXT,
                                        A_ADDRBOOK,      A_SYL_ACTIONS };       
 
                for (i = 0; i < sizeof msgv_items / sizeof msgv_items[0]; i++) 
@@ -341,6 +344,7 @@ static void toolbar_parse_item(XMLFile *file, ToolbarType source)
        GList *attr;
        gchar *name, *value;
        ToolbarItem *item = NULL;
+       gboolean rewrite = FALSE;
 
        attr = xml_get_current_tag_attr(file);
        item = g_new0(ToolbarItem, 1);
@@ -354,7 +358,15 @@ static void toolbar_parse_item(XMLFile *file, ToolbarType source)
                        item->text = g_strdup (value);
                else if (g_utf8_collate(name, TOOLBAR_ICON_ACTION) == 0)
                        item->index = toolbar_ret_val_from_text(value);
-
+               if (item->index == -1 && !strcmp(value, "A_DELETE")) {
+                       /* switch button */
+                       item->index = A_TRASH;
+                       g_free(item->file);
+                       item->file = g_strdup("trash_open");
+                       g_free(item->text);
+                       item->text = g_strdup(_("Trash"));
+                       rewrite = TRUE;
+               }
                attr = g_list_next(attr);
        }
        if (item->index != -1) {
@@ -363,6 +375,9 @@ static void toolbar_parse_item(XMLFile *file, ToolbarType source)
                        toolbar_config[source].item_list = g_slist_append(toolbar_config[source].item_list,
                                                                         item);
        }
+       if (rewrite) {
+               toolbar_save_config_file(source);
+       }
 }
 
 static void toolbar_set_default_main(void) 
@@ -383,7 +398,7 @@ static void toolbar_set_default_main(void)
                { A_REPLY_SENDER,  STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR, _("Sender")  },
                { A_FORWARD,       STOCK_PIXMAP_MAIL_FORWARD,         _("Forward") },
                { A_SEPARATOR,     0,                                 ("")         },
-               { A_DELETE,        STOCK_PIXMAP_CLOSE,                _("Delete")  },
+               { A_TRASH,         STOCK_PIXMAP_TRASH_OPEN,           _("Trash")   },
                { A_EXECUTE,       STOCK_PIXMAP_EXEC,                 _("Execute") },
                { A_GOTO_PREV,     STOCK_PIXMAP_UP_ARROW,             _("Previous")},
                { A_GOTO_NEXT,     STOCK_PIXMAP_DOWN_ARROW,           _("Next")    }
@@ -477,7 +492,7 @@ static void toolbar_set_default_msgview(void)
                { A_REPLY_SENDER,  STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR, _("Sender")  },
                { A_FORWARD,       STOCK_PIXMAP_MAIL_FORWARD,         _("Forward") },
                { A_SEPARATOR,     0,                                 ("")         },
-               { A_DELETE,        STOCK_PIXMAP_CLOSE,                _("Delete")  },
+               { A_TRASH,         STOCK_PIXMAP_TRASH_OPEN,           _("Trash")   },
                { A_GOTO_NEXT,     STOCK_PIXMAP_DOWN_ARROW,           _("Next")    }
        };
        
@@ -888,7 +903,7 @@ static void toolbar_exec_cb(GtkWidget       *widget,
 /*
  * Delete current/selected(s) message(s)
  */
-static void toolbar_delete_cb(GtkWidget *widget, gpointer data)
+static void toolbar_trash_cb(GtkWidget *widget, gpointer data)
 {
        ToolbarItem *toolbar_item = (ToolbarItem*)data;
        MainWindow *mainwin;
@@ -910,6 +925,31 @@ static void toolbar_delete_cb(GtkWidget *widget, gpointer data)
        }
 }
 
+/*
+ * Delete current/selected(s) message(s)
+ */
+static void toolbar_delete_cb(GtkWidget *widget, gpointer data)
+{
+       ToolbarItem *toolbar_item = (ToolbarItem*)data;
+       MainWindow *mainwin;
+
+       g_return_if_fail(toolbar_item != NULL);
+       g_return_if_fail(toolbar_item->parent);
+       
+       switch (toolbar_item->type) {
+       case TOOLBAR_MSGVIEW:
+               messageview_delete((MessageView *)toolbar_item->parent);
+               break;
+        case TOOLBAR_MAIN:
+               mainwin = (MainWindow *)toolbar_item->parent;
+               summary_delete(mainwin->summaryview);
+               break;
+        default: 
+               debug_print("toolbar event not supported\n");
+               break;
+       }
+}
+
 
 /*
  * Compose new message
@@ -1265,7 +1305,8 @@ static void toolbar_buttons_cb(GtkWidget   *widget,
                { A_REPLY_ALL,          toolbar_reply_to_all_cb         },
                { A_REPLY_ML,           toolbar_reply_to_list_cb        },
                { A_FORWARD,            toolbar_forward_cb              },
-               { A_DELETE,             toolbar_delete_cb               },
+               { A_TRASH,              toolbar_trash_cb                },
+               { A_DELETE_REAL,        toolbar_delete_cb               },
                { A_EXECUTE,            toolbar_exec_cb                 },
                { A_GOTO_PREV,          toolbar_prev_unread_cb          },
                { A_GOTO_NEXT,          toolbar_next_unread_cb          },
@@ -1491,7 +1532,13 @@ Toolbar *toolbar_create(ToolbarType       type,
                                                  _("Forward Message"), "Fwd");
                        toolbar_data->fwd_combo = fwd_combo;
                        break;
-               case A_DELETE:
+               case A_TRASH:
+                       toolbar_data->trash_btn = item;
+                       gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), 
+                                            toolbar_data->trash_btn,
+                                            _("Trash Message"), NULL);
+                       break;
+               case A_DELETE_REAL:
                        toolbar_data->delete_btn = item;
                        gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), 
                                             toolbar_data->delete_btn,
@@ -1744,6 +1791,8 @@ void toolbar_main_set_sensitive(gpointer data)
                SET_WIDGET_COND(toolbar->next_btn, 0);
        }
 
+       SET_WIDGET_COND(toolbar->trash_btn,
+                       M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED);
        SET_WIDGET_COND(toolbar->delete_btn,
                        M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED);
        SET_WIDGET_COND(toolbar->exec_btn, M_DELAY_EXEC);
@@ -1833,6 +1882,7 @@ void toolbar_init(Toolbar * toolbar) {
        toolbar->replyall_btn           = NULL;
        toolbar->replylist_btn          = NULL;
        toolbar->fwd_btn                = NULL;
+       toolbar->trash_btn              = NULL;
        toolbar->delete_btn             = NULL;
        toolbar->prev_btn               = NULL;
        toolbar->next_btn               = NULL;
index 57d58d8f8545639030afb6fd2535bbe9871dc126..0b6d067b0413c8608317b482983bb162641b5434 100644 (file)
@@ -62,6 +62,7 @@ struct _Toolbar {
        GtkWidget *fwd_btn;
        ComboButton *fwd_combo;
        
+       GtkWidget *trash_btn;
        GtkWidget *delete_btn;
        GtkWidget *prev_btn;
        GtkWidget *next_btn;
@@ -146,7 +147,8 @@ enum {
        A_REPLY_ALL,
        A_REPLY_ML,
        A_FORWARD,
-       A_DELETE,
+       A_TRASH,
+       A_DELETE_REAL,
        A_EXECUTE,
        A_GOTO_PREV,
        A_GOTO_NEXT,