2012-02-08 [pawel] 3.8.0cvs27
[claws.git] / src / prefs_toolbar.c
index b83be45586601f4df66c6b5ba3e035d7b5422596..38cc74fb261af26da261fd47e2efb5c822391bbc 100644 (file)
@@ -41,6 +41,7 @@
 #include "mainwindow.h"
 #include "alertpanel.h"
 #include "prefs_common.h"
+#include "prefs_actions.h"
 
 #include "utils.h"
 
@@ -291,7 +292,6 @@ static void prefs_toolbar_save(PrefsPage *_page)
                        item->index = toolbar_ret_val_from_descr(event);
                        g_free(event);
 
-                       /* TODO: save A_CLAWS_ACTIONS only if they are still active */
                        toolbar_set_list_item(item, prefs_toolbar->source);
 
                        g_free(item->file);
@@ -370,9 +370,7 @@ static void prefs_toolbar_set_displayed(ToolbarPage *prefs_toolbar)
 
 static void add_item_to_plugin_combo(gpointer key, gpointer data, gpointer combo_box)
 {
-       gtk_combo_box_text_append_text(
-               GTK_COMBO_BOX_TEXT(combo_box),
-               (const gchar*)key);
+       gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), (const gchar*)key);
 }
 
 static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
@@ -391,8 +389,8 @@ static void prefs_toolbar_populate(ToolbarPage *prefs_toolbar)
                        act = (gchar *)cur->data;
                        get_action_name(act, &act_name);
                        
-                       gtk_combo_box_text_append_text(
-                               GTK_COMBO_BOX_TEXT(prefs_toolbar->item_action_combo),
+                       gtk_combo_box_append_text(
+                               GTK_COMBO_BOX(prefs_toolbar->item_action_combo),
                                act_name);
 
                        g_free(act_name);
@@ -514,8 +512,8 @@ static void prefs_toolbar_register(GtkButton *button, ToolbarPage *prefs_toolbar
                }
                                
                if (item_type == ITEM_FUNCTION) {
-                       event = gtk_combo_box_text_get_active_text(
-                               GTK_COMBO_BOX_TEXT(prefs_toolbar->item_func_combo));
+                       event = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
+                                               prefs_toolbar->item_func_combo));
                                                
                        if (is_duplicate(prefs_toolbar, event)) {
                                alertpanel_error(ERROR_MSG);
@@ -600,8 +598,8 @@ static void prefs_toolbar_substitute(GtkButton *button, ToolbarPage *prefs_toolb
                                                  -1);
                
                if (item_type == ITEM_FUNCTION) {
-                       icon_event = gtk_combo_box_text_get_active_text(
-                               GTK_COMBO_BOX_TEXT(prefs_toolbar->item_func_combo));
+                       icon_event = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
+                                               prefs_toolbar->item_func_combo));
                                                
                        if (is_duplicate(prefs_toolbar, icon_event)
                        && g_utf8_collate(icon_event, set_event) != 0){
@@ -794,7 +792,7 @@ static void item_type_changed(GtkComboBox *item_type_combo,
 static void action_selection_changed(GtkComboBox *action_combo,
                                ToolbarPage *prefs_toolbar)
 {
-       gchar *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
+       gchar *text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
                           prefs_toolbar->item_action_combo));
 
        if(text != NULL) { /* action */
@@ -806,7 +804,7 @@ static void action_selection_changed(GtkComboBox *action_combo,
 static void plugin_selection_changed(GtkComboBox *action_combo,
                 ToolbarPage *prefs_toolbar)
 {
-       gchar *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(prefs_toolbar->item_plugin_combo));
+       gchar *text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(prefs_toolbar->item_plugin_combo));
 
        if (text != NULL) { /* action */
                gtk_entry_set_text(GTK_ENTRY(prefs_toolbar->item_text_entry), text);
@@ -817,7 +815,7 @@ static void plugin_selection_changed(GtkComboBox *action_combo,
 static void func_selection_changed(GtkComboBox *action_combo,
                                ToolbarPage *prefs_toolbar)
 {
-       gchar *text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(
+       gchar *text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(
                           prefs_toolbar->item_func_combo));
 
        if(text != NULL) { /* action */
@@ -925,21 +923,21 @@ static void prefs_toolbar_create(ToolbarPage *prefs_toolbar)
                          (GtkAttachOptions) (GTK_FILL),
                          (GtkAttachOptions) (0), 0, 0);
 
-       item_action_combo = gtk_combo_box_text_new();
+       item_action_combo = gtk_combo_box_new_text();
        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 */
-       item_func_combo = gtk_combo_box_text_new();
+       item_func_combo = gtk_combo_box_new_text();
        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 */
-       item_plugin_combo = gtk_combo_box_text_new();
+       item_plugin_combo = gtk_combo_box_new_text();
        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),
@@ -1268,6 +1266,24 @@ void prefs_toolbar_done(void)
        g_free(prefs_toolbar_messageview);
 }
 
+void prefs_toolbar_update_action_btns(void) 
+{
+       if (toolbar_check_action_btns(TOOLBAR_MAIN)) {
+               toolbar_save_config_file(TOOLBAR_MAIN);
+               toolbar_update(TOOLBAR_MAIN, mainwindow_get_mainwindow());
+       }
+
+       if (toolbar_check_action_btns(TOOLBAR_COMPOSE)) {
+               toolbar_save_config_file(TOOLBAR_COMPOSE);
+               compose_reflect_prefs_pixmap_theme();
+       }
+
+       if (toolbar_check_action_btns(TOOLBAR_MSGVIEW)) {
+               toolbar_save_config_file(TOOLBAR_MSGVIEW);
+               messageview_reflect_prefs_pixmap_theme();
+       }
+}
+
 static void set_visible_if_not_text(GtkTreeViewColumn *col,
                                    GtkCellRenderer   *renderer,
                                    GtkTreeModel      *model,
@@ -1538,7 +1554,7 @@ static void icon_chooser_cancel_clicked(GtkButton *button,
 static gboolean icon_chooser_key_pressed(GtkWidget *widget, GdkEventKey *event,
                        ToolbarPage *prefs_toolbar)
 {
-       if (event && event->keyval == GDK_Escape) {
+       if (event && event->keyval == GDK_KEY_Escape) {
                icon_chooser_cancel_clicked(NULL, prefs_toolbar);
                return TRUE;
        }
@@ -1550,9 +1566,9 @@ static gboolean icon_list_key_pressed(GtkWidget *widget, GdkEventKey *event,
                        ToolbarPage *prefs_toolbar)
 {
        if (event) {
-               if (event->keyval == GDK_KP_Enter ||
-                   event->keyval == GDK_Return ||
-                   event->keyval == GDK_space) {
+               if (event->keyval == GDK_KEY_KP_Enter ||
+                   event->keyval == GDK_KEY_Return ||
+                   event->keyval == GDK_KEY_space) {
                        icon_chooser_ok_clicked(NULL, prefs_toolbar);
                        return TRUE;
                }
@@ -1599,7 +1615,7 @@ static gboolean icon_window_button_press(GtkWidget *widget,
                                restore = FALSE;
                                break;
                        }
-                       event_widget = event_widget->parent;
+                       event_widget = gtk_widget_get_parent(event_widget);
                }
        }
 
@@ -1618,6 +1634,7 @@ static void icon_chooser_activated(GtkTreeView *treeview, GtkTreePath *path,
 
 static void icon_chooser_create(GtkButton *button, ToolbarPage *prefs_toolbar)
 {
+       GtkAllocation allocation;
        GtkWidget *icon_chooser_win;
        GtkWidget *scrollwin;
        GtkWidget *icon_view;
@@ -1648,10 +1665,12 @@ static void icon_chooser_create(GtkButton *button, ToolbarPage *prefs_toolbar)
 #ifndef MAEMO
        gtk_window_set_decorated(GTK_WINDOW(icon_chooser_win), FALSE);
 #endif
-       gdk_window_get_origin(GTK_WIDGET(prefs_toolbar->icon_button)->window, 
+       gdk_window_get_origin(gtk_widget_get_window(
+                       GTK_WIDGET(prefs_toolbar->icon_button)), 
                        &x, &y);
-       x += GTK_WIDGET(prefs_toolbar->icon_button)->allocation.x;
-       y += GTK_WIDGET(prefs_toolbar->icon_button)->allocation.y;
+       gtk_widget_get_allocation(GTK_WIDGET(prefs_toolbar->icon_button), &allocation);
+       x += allocation.x;
+       y += allocation.y;
        y += 50;
        x -= 300-50;
        gtk_window_move(GTK_WINDOW(icon_chooser_win), x, y);