2008-11-30 [paul] 3.6.1cvs55
[claws.git] / src / prefs_toolbar.c
index e203f05ca4b58eca5375ca94edd0de787e3a83f4..06fc7509c4a3bf4c4affb79a6adf3bfcf5a41ceb 100644 (file)
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <gtk/gtkoptionmenu.h>
 #include <gdk/gdkkeysyms.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "stock_pixmap.h"
 #include "manage_window.h"
+#include "combobox.h"
 #include "gtkutils.h"
 #include "mainwindow.h"
 #include "alertpanel.h"
@@ -96,6 +96,7 @@ static const gint ToolbarIcons[] =
        STOCK_PIXMAP_MAIL_REPLY,
        STOCK_PIXMAP_MAIL_REPLY_TO_ALL,
        STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR,
+       STOCK_PIXMAP_MAIL_REPLY_TO_LIST,
        STOCK_PIXMAP_MAIL_SEND,
        STOCK_PIXMAP_MAIL_SEND_QUEUE,
        STOCK_PIXMAP_MAIL_SIGN,
@@ -113,6 +114,7 @@ static const gint ToolbarIcons[] =
        STOCK_PIXMAP_GO_FOLDERS,
        STOCK_PIXMAP_MIME_TEXT_PLAIN,
        STOCK_PIXMAP_MIME_TEXT_HTML,
+       STOCK_PIXMAP_MIME_TEXT_PATCH,
        STOCK_PIXMAP_MIME_APPLICATION,
        STOCK_PIXMAP_MIME_IMAGE,
        STOCK_PIXMAP_MIME_AUDIO,
@@ -136,6 +138,9 @@ static const gint ToolbarIcons[] =
        STOCK_PIXMAP_MIME_MESSAGE,
        STOCK_PIXMAP_SPAM_BTN,
        STOCK_PIXMAP_HAM_BTN,
+       STOCK_PIXMAP_TRASH,
+       STOCK_PIXMAP_DELETE,
+       STOCK_PIXMAP_CANCEL,
        STOCK_PIXMAP_EMPTY,              /* last entry */
 };
 
@@ -255,7 +260,7 @@ static void prefs_toolbar_save(PrefsPage *_page)
                        item->index = toolbar_ret_val_from_descr(event);
                        g_free(event);
 
-                       /* TODO: save A_SYL_ACTIONS only if they are still active */
+                       /* TODO: save A_CLAWS_ACTIONS only if they are still active */
                        toolbar_set_list_item(item, prefs_toolbar->source);
 
                        g_free(item->file);
@@ -334,28 +339,17 @@ static void prefs_toolbar_set_displayed(ToolbarPage *prefs_toolbar)
 
 static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
 {
-       GList *cur;
-       GSList *cur2;
+       GSList *cur;
        gchar *act, *act_name;
 
-       gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_type_combo),
-                                 _("Internal Function"));      
-       gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_type_combo),
-                                 _("User Action"));
-       gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_type_combo),
-                                 _("Separator"));
-       
        prefs_toolbar->combo_action_list = toolbar_get_action_items(prefs_toolbar->source);
-       for(cur = prefs_toolbar->combo_action_list; cur != NULL; cur = cur->next) {
-               act = (gchar *)cur->data;
-               gtk_combo_box_append_text(GTK_COMBO_BOX(prefs_toolbar->item_func_combo),
-                                         act);
-       }
-
+       combobox_set_popdown_strings(GTK_COMBO_BOX(prefs_toolbar->item_func_combo),
+                                    prefs_toolbar->combo_action_list);
+       
        /* get currently defined sylpheed actions */
        if (prefs_common.actions_list != NULL) {
-               for (cur2 = prefs_common.actions_list; cur2 != NULL; cur2 = cur2->next) {
-                       act = (gchar *)cur2->data;
+               for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) {
+                       act = (gchar *)cur->data;
                        get_action_name(act, &act_name);
                        
                        gtk_combo_box_append_text(
@@ -367,7 +361,6 @@ static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
 
        }
        
-       gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_toolbar->item_type_combo), 0);
        gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_toolbar->item_func_combo), 0);
        gtk_combo_box_set_active(GTK_COMBO_BOX(prefs_toolbar->item_action_combo), 0);
        
@@ -479,7 +472,7 @@ static void prefs_toolbar_register(GtkButton *button, ToolbarPage *prefs_toolbar
                                return;
                        }
                } else
-                       event = toolbar_ret_descr_from_val(A_SYL_ACTIONS);
+                       event = toolbar_ret_descr_from_val(A_CLAWS_ACTIONS);
                
                text = gtk_editable_get_chars(
                        GTK_EDITABLE(prefs_toolbar->item_text_entry), 0 , -1);
@@ -565,7 +558,7 @@ static void prefs_toolbar_substitute(GtkButton *button, ToolbarPage *prefs_toolb
                                return;
                        }
                } else
-                       icon_event = toolbar_ret_descr_from_val(A_SYL_ACTIONS);
+                       icon_event = toolbar_ret_descr_from_val(A_CLAWS_ACTIONS);
                
                text = gtk_editable_get_chars(
                        GTK_EDITABLE(prefs_toolbar->item_text_entry), 0 , -1);
@@ -779,7 +772,7 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
        GtkWidget *reg_hbox;
        GtkWidget *arrow;
        GtkWidget *btn_hbox;
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
        GtkWidget *hbox;
 #endif
        GtkWidget *reg_btn;
@@ -828,7 +821,8 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0); 
        
-       item_type_combo = gtk_combo_box_new_text();
+       item_type_combo = combobox_text_new(FALSE, _("Internal Function"),
+                               _("User Action"), _("Separator"), NULL);
        gtk_widget_set_size_request(item_type_combo, 200, -1);
        gtk_table_attach(GTK_TABLE(table), item_type_combo, 1, 3, 0, 1,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
@@ -925,7 +919,7 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
                          prefs_toolbar);
 
        default_btn = gtk_button_new_with_label(_(" Use default "));
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
        gtk_box_pack_end(GTK_BOX(reg_hbox), default_btn, FALSE, TRUE, 0);
 #else
        hbox = gtk_hbox_new(FALSE, 0);
@@ -1001,7 +995,7 @@ void prefs_toolbar_init(void)
        ToolbarPage *page;
        static gchar *mainpath[3], *messagepath[3], *composepath[3];
 
-       mainpath[0] = _("Customize Toolbars");
+       mainpath[0] = _("Toolbars");
        mainpath[1] = _("Main Window");
        mainpath[2] = NULL;
 
@@ -1015,7 +1009,7 @@ void prefs_toolbar_init(void)
        prefs_gtk_register_page((PrefsPage *) page);
        prefs_toolbar_mainwindow = page;
 
-       messagepath[0] = _("Customize Toolbars");
+       messagepath[0] = _("Toolbars");
        messagepath[1] = _("Message Window");
        messagepath[2] = NULL;
 
@@ -1029,7 +1023,7 @@ void prefs_toolbar_init(void)
        prefs_gtk_register_page((PrefsPage *) page);
        prefs_toolbar_messageview = page;
 
-       composepath[0] = _("Customize Toolbars");
+       composepath[0] = _("Toolbars");
        composepath[1] = _("Compose Window");
        composepath[2] = NULL;
 
@@ -1106,7 +1100,7 @@ static GtkWidget *create_set_list_view(ToolbarPage *prefs_toolbar)
        gtk_tree_view_column_set_title(column, _("Icon"));
        renderer = gtk_cell_renderer_pixbuf_new();
        gtk_tree_view_column_pack_start(column, renderer, FALSE);
-       
+       gtk_tree_view_set_reorderable(list_view, TRUE);
        /* tell pixbuf renderer it is only visible if 
         * the icon is not represented by text */
        gtk_tree_view_column_set_cell_data_func(column, renderer,
@@ -1202,7 +1196,7 @@ static gboolean set_list_selected(GtkTreeSelection *selector,
        gtk_entry_set_text(GTK_ENTRY(prefs_toolbar->item_text_entry), 
                           icon_text);
 
-       if (g_utf8_collate(toolbar_ret_descr_from_val(A_SYL_ACTIONS), descr) == 0) {
+       if (g_utf8_collate(toolbar_ret_descr_from_val(A_CLAWS_ACTIONS), descr) == 0) {
                gtk_combo_box_set_active(GTK_COMBO_BOX(
                        prefs_toolbar->item_type_combo), ITEM_USER_ACTION);
 
@@ -1224,6 +1218,9 @@ static gboolean set_list_selected(GtkTreeSelection *selector,
                        }
                }
                
+               gtk_widget_show(prefs_toolbar->item_action_combo);
+               gtk_widget_hide(prefs_toolbar->item_func_combo);
+               
                g_free(icon_text);
                g_free(descr);
 
@@ -1247,6 +1244,8 @@ static gboolean set_list_selected(GtkTreeSelection *selector,
 
        gtk_combo_box_set_active(GTK_COMBO_BOX(
                        prefs_toolbar->item_type_combo),ITEM_FUNCTION);
+       gtk_widget_hide(prefs_toolbar->item_action_combo);
+       gtk_widget_show(prefs_toolbar->item_func_combo);
 
        g_free(icon_text);
        g_free(descr);