fix bug 2986, 'Down and Delete buttons have same hotkey in filtering config' and...
[claws.git] / src / prefs_toolbar.c
index bc55950aee1c2cdc9427559937316737e46e7fd8..9969063c0de2a067132c7929901619c7327b6a5c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 Hiroyuki Yamamoto & the Claws Mail team
+ * Copyright (C) 2002-2013 Hiroyuki Yamamoto & the Claws Mail team
  *
  * 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
@@ -249,10 +249,6 @@ static GHashTable** get_plugin_hash_from_toolbar_type(ToolbarType toolbar_type)
 static void prefs_toolbar_create_widget(PrefsPage *_page, GtkWindow *window, gpointer data)
 {
        ToolbarPage *prefs_toolbar = (ToolbarPage *) _page;
-       gchar *win_titles[3];
-       win_titles[TOOLBAR_MAIN]    = _("Main toolbar configuration");
-       win_titles[TOOLBAR_COMPOSE] = _("Compose toolbar configuration");  
-       win_titles[TOOLBAR_MSGVIEW] = _("Message view toolbar configuration");  
 
        prefs_toolbar->window = GTK_WIDGET(window);
 
@@ -372,7 +368,11 @@ static void prefs_toolbar_set_displayed(ToolbarPage *prefs_toolbar)
 
 static void add_item_to_plugin_combo(gpointer key, gpointer data, gpointer combo_box)
 {
+#if !GTK_CHECK_VERSION(2, 24, 0)
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), (const gchar*)key);
+#else
+       gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), (const gchar*)key);
+#endif
 }
 
 static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
@@ -382,8 +382,13 @@ static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
        GHashTable **hash;
 
        prefs_toolbar->combo_action_list = toolbar_get_action_items(prefs_toolbar->source);
+#if !GTK_CHECK_VERSION(2, 24, 0)
        combobox_set_popdown_strings(GTK_COMBO_BOX(prefs_toolbar->item_func_combo),
                                     prefs_toolbar->combo_action_list);
+#else
+       combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(prefs_toolbar->item_func_combo),
+                                    prefs_toolbar->combo_action_list);
+#endif
        
        /* get currently defined sylpheed actions */
        if (prefs_common.actions_list != NULL) {
@@ -391,8 +396,13 @@ static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
                        act = (gchar *)cur->data;
                        get_action_name(act, &act_name);
                        
+#if !GTK_CHECK_VERSION(2, 24, 0)
                        gtk_combo_box_append_text(
                                GTK_COMBO_BOX(prefs_toolbar->item_action_combo),
+#else
+                       gtk_combo_box_text_append_text(
+                               GTK_COMBO_BOX_TEXT(prefs_toolbar->item_action_combo),
+#endif
                                act_name);
 
                        g_free(act_name);
@@ -514,7 +524,11 @@ static void prefs_toolbar_register(GtkButton *button, ToolbarPage *prefs_toolbar
                }
                                
                if (item_type == ITEM_FUNCTION) {
+#if !GTK_CHECK_VERSION(2, 24, 0)
                        event = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
+#else
+                       event = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
+#endif
                                                prefs_toolbar->item_func_combo));
                                                
                        if (is_duplicate(prefs_toolbar, event)) {
@@ -600,7 +614,11 @@ static void prefs_toolbar_substitute(GtkButton *button, ToolbarPage *prefs_toolb
                                                  -1);
                
                if (item_type == ITEM_FUNCTION) {
+#if !GTK_CHECK_VERSION(2, 24, 0)
                        icon_event = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
+#else
+                       icon_event = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
+#endif
                                                prefs_toolbar->item_func_combo));
                                                
                        if (is_duplicate(prefs_toolbar, icon_event)
@@ -794,7 +812,11 @@ static void item_type_changed(GtkComboBox *item_type_combo,
 static void action_selection_changed(GtkComboBox *action_combo,
                                ToolbarPage *prefs_toolbar)
 {
+#if !GTK_CHECK_VERSION(2, 24, 0)
        gchar *text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
+#else
+       gchar *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
+#endif
                           prefs_toolbar->item_action_combo));
 
        if(text != NULL) { /* action */
@@ -806,7 +828,11 @@ static void action_selection_changed(GtkComboBox *action_combo,
 static void plugin_selection_changed(GtkComboBox *action_combo,
                 ToolbarPage *prefs_toolbar)
 {
+#if !GTK_CHECK_VERSION(2, 24, 0)
        gchar *text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(prefs_toolbar->item_plugin_combo));
+#else
+       gchar *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(prefs_toolbar->item_plugin_combo));
+#endif
 
        if (text != NULL) { /* action */
                gtk_entry_set_text(GTK_ENTRY(prefs_toolbar->item_text_entry), text);
@@ -817,7 +843,11 @@ static void plugin_selection_changed(GtkComboBox *action_combo,
 static void func_selection_changed(GtkComboBox *action_combo,
                                ToolbarPage *prefs_toolbar)
 {
+#if !GTK_CHECK_VERSION(2, 24, 0)
        gchar *text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
+#else
+       gchar *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
+#endif
                           prefs_toolbar->item_func_combo));
 
        if(text != NULL) { /* action */
@@ -925,21 +955,33 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
                          (GtkAttachOptions) (GTK_FILL),
                          (GtkAttachOptions) (0), 0, 0);
 
+#if !GTK_CHECK_VERSION(2, 24, 0)
        item_action_combo = gtk_combo_box_new_text();
+#else
+       item_action_combo = gtk_combo_box_text_new();
+#endif
        gtk_widget_set_size_request(item_action_combo, 200, -1);
        gtk_table_attach (GTK_TABLE (table), item_action_combo, 1, 3, 1, 2,
                          (GtkAttachOptions) (GTK_FILL),
                          (GtkAttachOptions) (0), 0, 0);
                          
        /* available internal functions */
+#if !GTK_CHECK_VERSION(2, 24, 0)
        item_func_combo = gtk_combo_box_new_text();
+#else
+       item_func_combo = gtk_combo_box_text_new();
+#endif
        gtk_widget_set_size_request(item_func_combo, 200, -1);
        gtk_table_attach (GTK_TABLE (table), item_func_combo, 1, 3, 1, 2,
                          (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                          (GtkAttachOptions) (0), 0, 0);
        
        /* plugin-registered items */
+#if !GTK_CHECK_VERSION(2, 24, 0)
        item_plugin_combo = gtk_combo_box_new_text();
+#else
+       item_plugin_combo = gtk_combo_box_text_new();
+#endif
        gtk_widget_set_size_request(item_plugin_combo, 200, -1);
        gtk_table_attach(GTK_TABLE(table), item_plugin_combo, 1, 3, 1, 2,
                         (GtkAttachOptions) (GTK_FILL),
@@ -997,19 +1039,23 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
        btn_hbox = gtk_hbox_new(TRUE, 4);
        gtk_box_pack_start(GTK_BOX(reg_hbox), btn_hbox, FALSE, FALSE, 0);
 
-       reg_btn = gtk_button_new_from_stock(GTK_STOCK_ADD);
+       reg_btn = gtk_button_new_with_mnemonic (_("A_dd"));
+       gtk_button_set_image(GTK_BUTTON(reg_btn),
+                       gtk_image_new_from_stock(GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start(GTK_BOX(btn_hbox), reg_btn, FALSE, TRUE, 0);
        g_signal_connect(G_OBJECT(reg_btn), "clicked",
                         G_CALLBACK(prefs_toolbar_register), 
                         prefs_toolbar);
 
-       subst_btn = gtkut_get_replace_btn(_("Replace"));
+       subst_btn = gtkut_get_replace_btn(_("_Replace"));
        gtk_box_pack_start(GTK_BOX(btn_hbox), subst_btn, FALSE, TRUE, 0);
        g_signal_connect(G_OBJECT(subst_btn), "clicked",
                         G_CALLBACK(prefs_toolbar_substitute),
                         prefs_toolbar);
 
-       del_btn = gtk_button_new_from_stock(GTK_STOCK_DELETE);
+       del_btn = gtk_button_new_with_mnemonic (_("Re_move"));
+       gtk_button_set_image(GTK_BUTTON(del_btn),
+                       gtk_image_new_from_stock(GTK_STOCK_REMOVE,GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start(GTK_BOX(btn_hbox), del_btn, FALSE, TRUE, 0);
        g_signal_connect(G_OBJECT(del_btn), "clicked",
                         G_CALLBACK(prefs_toolbar_delete), 
@@ -1662,9 +1708,7 @@ static void icon_chooser_create(GtkButton *button, ToolbarPage *prefs_toolbar)
        
        icon_chooser_win = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_toolbar");
        gtk_window_set_title(GTK_WINDOW(icon_chooser_win), _("Toolbar item icon"));
-#ifndef MAEMO
        gtk_window_set_decorated(GTK_WINDOW(icon_chooser_win), FALSE);
-#endif
        gdk_window_get_origin(gtk_widget_get_window(
                        GTK_WIDGET(prefs_toolbar->icon_button)), 
                        &x, &y);