2012-09-16 [mones] 3.8.1cvs60
[claws.git] / src / prefs_toolbar.c
index 90e6dea5d9f5732d5a30d67f9d9de452e07d437c..a437dcc5d9ef0837bec13e273042a8d4ad19fe7d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2009 Hiroyuki Yamamoto & the Claws Mail team
+ * Copyright (C) 2002-2012 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
@@ -23,6 +23,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
@@ -41,6 +42,7 @@
 #include "mainwindow.h"
 #include "alertpanel.h"
 #include "prefs_common.h"
+#include "prefs_actions.h"
 
 #include "utils.h"
 
@@ -49,6 +51,7 @@
 #include "prefswindow.h"
 #include "prefs_gtk.h"
 #include "plugin.h"
+#include "messageview.h"
 
 enum
 {
@@ -246,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);
 
@@ -291,7 +290,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);
@@ -1266,6 +1264,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,
@@ -1536,7 +1552,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;
        }
@@ -1548,9 +1564,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;
                }
@@ -1582,11 +1598,9 @@ static gboolean icon_window_button_press(GtkWidget *widget,
                                               GdkEventButton *event,
                                               ToolbarPage *prefs_toolbar )
 {
-       GtkWidget *event_widget, *button;
+       GtkWidget *event_widget;
        gboolean restore = TRUE;
 
-       button = prefs_toolbar->icon_button;
-
        /* Test where mouse was clicked */
        event_widget = gtk_get_event_widget((GdkEvent *)event);
        if (event_widget != widget) {
@@ -1597,7 +1611,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);
                }
        }
 
@@ -1616,6 +1630,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;
@@ -1646,10 +1661,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);