en/disable Toolbar Action Buttons
authorOliver Haertel <o.h.a@gmx.net>
Wed, 14 Aug 2002 19:29:09 +0000 (19:29 +0000)
committerOliver Haertel <o.h.a@gmx.net>
Wed, 14 Aug 2002 19:29:09 +0000 (19:29 +0000)
ChangeLog.claws
configure.in
src/mainwindow.c
src/prefs_toolbar.c
src/toolbar.c
src/toolbar.h

index ea46da427da9ac6ed53de03ebc274b46ef65a2b8..fd78ad4f37c6017e0414c0785d7d62bb89050051 100644 (file)
@@ -1,3 +1,11 @@
+2002-08-14 [oliver]    0.8.1claws61
+       
+       * enable/disable Toolbar Action Buttons 
+       * code cleanups
+       * src/mainwindow.c
+       * src/toolbar.[ch]      
+       * src/prefs_toolbar.c   
+
 2002-08-14 [melvin]    0.8.1claws60
 
        * po/fr.po
index b6abb7e1aeda8dd0825b5e7647dcb35381b5b84b..31f6ad901941bf37ef75e02636f1fd23d6c30dfd 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws60
+EXTRA_VERSION=claws61
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 46e8ae3106d43752e09cb82b3167b80da3bfe428..d74632e4b5f5a1fdb1b6379ed6d91b5f77e0d38c 100644 (file)
@@ -771,8 +771,6 @@ MainWindow *main_window_create(SeparateType type)
 
        /* create the popup menus for the reply buttons specials */
        toolbar_popups_create(mainwin, window);
-                          
-       //main_window_toolbar_create(mainwin, handlebox);
        toolbar_create(mainwin, handlebox);
 
        /* vbox that contains body */
@@ -1044,11 +1042,7 @@ void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
 
                /* pixmap themes */
                if (pixmap_theme_changed) {
-                       gtk_container_remove(GTK_CONTAINER(mainwin->handlebox), 
-                                            GTK_WIDGET(mainwin->toolbar->toolbar));
-
-                       mainwin->toolbar->toolbar = NULL;
-                       toolbar_create(mainwin, mainwin->handlebox);
+                       toolbar_update();
                        set_toolbar_style(mainwin);
                        folderview_reflect_prefs_pixmap_theme(mainwin->folderview);
                        summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
index 638a8e4560223d2c132cc6de67ec1bf0ebbe84aa..0d0cbc39a32af2f8122bdc608edd32c83f14f843 100644 (file)
@@ -115,22 +115,22 @@ static gint prefs_toolbar_key_pressed            (GtkWidget *widget,
 void prefs_toolbar(void)
 {
        toolbar_read_config_file();
-       prefs_toolbar_open ();
+       prefs_toolbar_open();
 }
 
 static void prefs_toolbar_open(void)
 {
        if (!mtoolbar.window)
-               prefs_toolbar_create ();
+               prefs_toolbar_create();
 
-       manage_window_set_transient (GTK_WINDOW (mtoolbar.window));
-       prefs_toolbar_populate ();
+       manage_window_set_transient(GTK_WINDOW(mtoolbar.window));
+       prefs_toolbar_populate();
        gtk_widget_show(mtoolbar.window);
 }
 
 void prefs_toolbar_close(void)
 {
-       gtk_widget_hide (mtoolbar.window);
+       gtk_widget_hide(mtoolbar.window);
 }
 
 static void prefs_toolbar_populate(void)
@@ -147,84 +147,84 @@ static void prefs_toolbar_populate(void)
        gchar *activ[5] = {0};
        gchar *act;
        
-       gtk_clist_clear (clist_icons);
-       gtk_clist_clear (clist_set);
+       gtk_clist_clear(clist_icons);
+       gtk_clist_clear(clist_set);
 
-       gtk_clist_freeze (clist_icons);
-       gtk_clist_freeze (clist_set);
+       gtk_clist_freeze(clist_icons);
+       gtk_clist_freeze(clist_set);
 
        /* set available icons */
-       avail[0] = g_strdup (SEPARATOR_PIXMAP);
-       avail[1] = g_strdup (SEPARATOR);
-       gtk_clist_append (clist_icons, avail);
-       g_free (avail[0]);
-       g_free (avail[1]);
-
-       combo_action_items = toolbar_get_action_items ();
-       gtk_combo_set_popdown_strings (GTK_COMBO (mtoolbar.combo_action), combo_action_items);
-       gtk_combo_set_value_in_list (GTK_COMBO (mtoolbar.combo_action), 0, FALSE);
-       gtk_entry_set_text (GTK_ENTRY (mtoolbar.combo_entry), combo_action_items->data);
-       g_list_free (combo_action_items);
+       avail[0] = g_strdup(SEPARATOR_PIXMAP);
+       avail[1] = g_strdup(SEPARATOR);
+       gtk_clist_append(clist_icons, avail);
+       g_free(avail[0]);
+       g_free(avail[1]);
+
+       combo_action_items = toolbar_get_action_items();
+       gtk_combo_set_popdown_strings(GTK_COMBO(mtoolbar.combo_action), combo_action_items);
+       gtk_combo_set_value_in_list(GTK_COMBO(mtoolbar.combo_action), 0, FALSE);
+       gtk_entry_set_text(GTK_ENTRY(mtoolbar.combo_entry), combo_action_items->data);
+       g_list_free(combo_action_items);
 
        /* get currently defined sylpheed actions */
        if (prefs_common.actions_list != NULL) {
 
                for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) {
                        act = (gchar *)cur->data;
-                       syl_actions = g_list_append (syl_actions, act);
+                       syl_actions = g_list_append(syl_actions, act);
                } 
 
-               gtk_combo_set_popdown_strings (GTK_COMBO (mtoolbar.combo_syl_action), syl_actions);
-               gtk_combo_set_value_in_list (GTK_COMBO (mtoolbar.combo_syl_action), 0, FALSE);
-               gtk_entry_set_text (GTK_ENTRY (mtoolbar.combo_syl_entry), syl_actions->data);
+               gtk_combo_set_popdown_strings(GTK_COMBO(mtoolbar.combo_syl_action), syl_actions);
+               gtk_combo_set_value_in_list(GTK_COMBO(mtoolbar.combo_syl_action), 0, FALSE);
+               gtk_entry_set_text(GTK_ENTRY(mtoolbar.combo_syl_entry), syl_actions->data);
                prefs_toolbar_selection_changed(GTK_LIST(mtoolbar.combo_syl_list), NULL);
-               g_list_free (syl_actions);
+               g_list_free(syl_actions);
        }
 
        for (i = 0; i < N_STOCK_PIXMAPS; i++) {
-               avail[0] = g_strdup ("");
-               avail[1] = g_strdup (stock_pixmap_get_name ((StockPixmap)i));
+               avail[0] = g_strdup("");
+               avail[1] = g_strdup(stock_pixmap_get_name((StockPixmap)i));
 
-               stock_pixmap_gdk (mtoolbar.clist_icons, i,
+               stock_pixmap_gdk(mtoolbar.clist_icons, i,
                                  &xpm, &xpmmask);
-               gtk_clist_append (clist_icons, avail);
-               gtk_clist_set_pixmap (clist_icons, 
+               gtk_clist_append(clist_icons, avail);
+               gtk_clist_set_pixmap(clist_icons, 
                                       i + 1, 0, xpm, xpmmask);
                
-               g_free (avail[0]);
-               g_free (avail[1]);
+               g_free(avail[0]);
+               g_free(avail[1]);
        }
 
        /* set currently active toolbar entries */
        for (cur = toolbar_list; cur != NULL; cur = cur->next) {
                ToolbarItem *item = (ToolbarItem*) cur->data;
        
-               if (g_strcasecmp (item->file, SEPARATOR) != 0) {
+               if (g_strcasecmp(item->file, SEPARATOR) != 0) {
                        gint row_num;
-                       StockPixmap icon = stock_pixmap_get_icon (item->file);
+                       StockPixmap icon = stock_pixmap_get_icon(item->file);
                        
-                       stock_pixmap_gdk (mtoolbar.clist_set, icon,
+                       stock_pixmap_gdk(mtoolbar.clist_set, icon,
                                          &xpm, &xpmmask);
-                       activ[0] = g_strdup ("");
-                       activ[1] = g_strdup (item->file);
-                       activ[2] = g_strdup (item->text);
-                       activ[3] = g_strdup (toolbar_ret_descr_from_val (item->action));
-                       row_num  = gtk_clist_append (clist_set, activ);
-                       gtk_clist_set_pixmap (clist_set, 
+                       activ[0] = g_strdup("");
+                       activ[1] = g_strdup(item->file);
+                       activ[2] = g_strdup(item->text);
+                       activ[3] = g_strdup(toolbar_ret_descr_from_val(item->action));
+                       row_num  = gtk_clist_append(clist_set, activ);
+                       gtk_clist_set_pixmap(clist_set, 
                                              row_num, 0, xpm, xpmmask);
 
                } else {
-                       activ[0] = g_strdup (SEPARATOR_PIXMAP);
-                       activ[1] = g_strdup (item->file);
-                       activ[2] = g_strdup ("");
-                       activ[3] = g_strdup ("");
-                       gtk_clist_append (clist_set, activ);
+                       activ[0] = g_strdup(SEPARATOR_PIXMAP);
+                       activ[1] = g_strdup(item->file);
+                       activ[2] = g_strdup("");
+                       activ[3] = g_strdup("");
+                       gtk_clist_append(clist_set, activ);
                }
 
-               g_free (activ[0]);
-               g_free (activ[1]);
-               g_free (activ[2]);
-               g_free (activ[3]);
+               g_free(activ[0]);
+               g_free(activ[1]);
+               g_free(activ[2]);
+               g_free(activ[3]);
        }
 
        gtk_clist_thaw(clist_icons);
@@ -247,9 +247,9 @@ static gboolean is_duplicate(gchar *chosen_action)
        GtkCList *clist = GTK_CLIST(mtoolbar.clist_set);
        gchar *entry;
        gint row = 0;
-       gchar *syl_act = toolbar_ret_descr_from_val (A_SYL_ACTIONS);
+       gchar *syl_act = toolbar_ret_descr_from_val(A_SYL_ACTIONS);
 
-       g_return_val_if_fail (chosen_action != NULL, TRUE);
+       g_return_val_if_fail(chosen_action != NULL, TRUE);
        if (clist->rows == 0) 
                return FALSE;
        
@@ -258,8 +258,8 @@ static gboolean is_duplicate(gchar *chosen_action)
                return FALSE;
 
        do {
-               gtk_clist_get_text (clist, row, 3, &entry);
-               if ( g_strcasecmp (chosen_action, entry) == 0)
+               gtk_clist_get_text(clist, row, 3, &entry);
+               if ( g_strcasecmp(chosen_action, entry) == 0)
                        return TRUE;
                row++;
        } while ((gtk_clist_get_text(clist, row, 3, &entry)) && (row <= clist->rows));
@@ -280,29 +280,26 @@ static void prefs_toolbar_save(void)
        }
        else {
                do {
-                       ToolbarItem *toolbar_item = g_new0 (ToolbarItem, 1);
+                       ToolbarItem *toolbar_item = g_new0(ToolbarItem, 1);
                        
-                       gtk_clist_get_text (clist, row, 1, &entry);
-                       toolbar_item->file = g_strdup (entry);
+                       gtk_clist_get_text(clist, row, 1, &entry);
+                       toolbar_item->file = g_strdup(entry);
                        
-                       gtk_clist_get_text (clist, row, 2, &entry);
-                       toolbar_item->text = g_strdup (entry);
+                       gtk_clist_get_text(clist, row, 2, &entry);
+                       toolbar_item->text = g_strdup(entry);
                        
-                       gtk_clist_get_text (clist, row, 3, &entry);     
-                       toolbar_item->action = toolbar_ret_val_from_descr (entry);
+                       gtk_clist_get_text(clist, row, 3, &entry);      
+                       toolbar_item->action = toolbar_ret_val_from_descr(entry);
                        
                        /* TODO: save A_SYL_ACTIONS only if they are still active */
 
-                       toolbar_list = g_slist_append (toolbar_list, toolbar_item);
+                       toolbar_list = g_slist_append(toolbar_list, toolbar_item);
                        row++;
                        
-               } while (gtk_clist_get_text (clist, row, 3, &entry));
+               } while(gtk_clist_get_text(clist, row, 3, &entry));
        }
-       
-       toolbar_save_config_file ();
-       toolbar_clear_list ();
-       
-       main_window_reflect_prefs_all_real(TRUE);
+       toolbar_save_config_file();
+       toolbar_update();
 }
 
 static void prefs_toolbar_ok(void)
@@ -322,7 +319,7 @@ static void get_action_name(gchar *entry, gchar **menu)
 
        if (prefs_common.actions_list != NULL) {
                
-               act = g_strdup (entry);
+               act = g_strdup(entry);
                act_p = strstr(act, ": ");
                if (act_p != NULL)
                        act_p[0] = 0x00;
@@ -348,47 +345,47 @@ static gint prefs_toolbar_register(void)
                if (clist_icons->selection->data) 
                        row_icons = GPOINTER_TO_INT(clist_icons->selection->data);
        
-       gtk_clist_get_text (clist_icons, row_icons, 1, &item[1]);
-       item[3] = g_strdup (gtk_entry_get_text (GTK_ENTRY (mtoolbar.combo_entry)));
+       gtk_clist_get_text(clist_icons, row_icons, 1, &item[1]);
+       item[3] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_entry)));
        
        /* SEPARATOR or other ? */
-       if (g_strcasecmp (item[1], SEPARATOR) == 0) {
-               item[0] = g_strdup (SEPARATOR_PIXMAP);
-               item[2] = g_strdup ("");
-               item[3] = g_strdup ("");
+       if (g_strcasecmp(item[1], SEPARATOR) == 0) {
+               item[0] = g_strdup(SEPARATOR_PIXMAP);
+               item[2] = g_strdup("");
+               item[3] = g_strdup("");
                
-               row_set = gtk_clist_append (GTK_CLIST (mtoolbar.clist_set), item);
+               row_set = gtk_clist_append(GTK_CLIST(mtoolbar.clist_set), item);
 
-               g_free (item[0]);
+               g_free(item[0]);
        } else {
 
-               if (is_duplicate (item[3])) {
+               if (is_duplicate(item[3])) {
                        alertpanel_error(ERROR_MSG);
-                       g_free (item[3]);
+                       g_free(item[3]);
                        return -1;
                }
 
-               stock_pixmap_gdk (mtoolbar.clist_set, stock_pixmap_get_icon (item[1]),
+               stock_pixmap_gdk(mtoolbar.clist_set, stock_pixmap_get_icon(item[1]),
                                  &xpm, &xpmmask);
 
-               if (g_strcasecmp (item[3], syl_act) == 0) {
+               if (g_strcasecmp(item[3], syl_act) == 0) {
 
                        gchar *entry = gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_syl_entry));
                        get_action_name(entry, &item[2]);
                }
                else {
-                       item[2] = g_strdup (gtk_entry_get_text (GTK_ENTRY (mtoolbar.entry_icon_text)));
+                       item[2] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.entry_icon_text)));
                }
 
-               row_set = gtk_clist_append (GTK_CLIST (mtoolbar.clist_set), item);
-               gtk_clist_set_pixmap (clist_set, row_set, 0, xpm, xpmmask);
+               row_set = gtk_clist_append(GTK_CLIST(mtoolbar.clist_set), item);
+               gtk_clist_set_pixmap(clist_set, row_set, 0, xpm, xpmmask);
        }
 
        gtk_clist_moveto(clist_set, row_set, 0, row_set/clist_set->rows, 0);
-       gtk_clist_select_row (clist_set, row_set, 0);
+       gtk_clist_select_row(clist_set, row_set, 0);
 
-       g_free (item[2]);
-       g_free (item[3]);
+       g_free(item[2]);
+       g_free(item[3]);
 
        return 0;
 }
@@ -416,55 +413,55 @@ static gint prefs_toolbar_substitute(void)
                if (clist_set->selection->data) 
                        row_set = GPOINTER_TO_INT(clist_set->selection->data);
 
-       gtk_clist_get_text (clist_icons, row_icons, 1, &item[1]);
-       gtk_clist_get_text (clist_set, row_set, 3, &ac_set);
-       item[3] = g_strdup (gtk_entry_get_text (GTK_ENTRY (mtoolbar.combo_entry)));
+       gtk_clist_get_text(clist_icons, row_icons, 1, &item[1]);
+       gtk_clist_get_text(clist_set, row_set, 3, &ac_set);
+       item[3] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_entry)));
 
-       if (g_strcasecmp (item[1], SEPARATOR) == 0) {
-               item[0] = g_strdup (SEPARATOR_PIXMAP);
-               item[2] = g_strdup ("");
-               item[3] = g_strdup ("");
+       if (g_strcasecmp(item[1], SEPARATOR) == 0) {
+               item[0] = g_strdup(SEPARATOR_PIXMAP);
+               item[2] = g_strdup("");
+               item[3] = g_strdup("");
 
-               gtk_clist_remove (clist_set, row_set);
-               row_set = gtk_clist_insert (clist_set, row_set, item);
+               gtk_clist_remove(clist_set, row_set);
+               row_set = gtk_clist_insert(clist_set, row_set, item);
 
-               g_free (item[0]);
+               g_free(item[0]);
        } else {
 
                if ((is_duplicate(item[3])) && (g_strcasecmp(item[3], ac_set) != 0)){
                        alertpanel_error(ERROR_MSG);
-                       g_free (item[3]);
+                       g_free(item[3]);
                        return -1;
                }
 
-               stock_pixmap_gdk (mtoolbar.clist_set, stock_pixmap_get_icon (item[1]),
+               stock_pixmap_gdk(mtoolbar.clist_set, stock_pixmap_get_icon(item[1]),
                                  &xpm, &xpmmask);
 
-               if (g_strcasecmp (item[3], syl_act) == 0) {
+               if (g_strcasecmp(item[3], syl_act) == 0) {
 
                        gchar *entry = gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_syl_entry));
                        get_action_name(entry, &item[2]);
                } else {
-                       item[2] = g_strdup (gtk_entry_get_text (GTK_ENTRY (mtoolbar.entry_icon_text)));
+                       item[2] = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.entry_icon_text)));
                }
 
-               gtk_clist_remove (clist_set, row_set);
-               row_set = gtk_clist_insert (clist_set, row_set, item);
-               gtk_clist_set_pixmap (clist_set, row_set, 0, xpm, xpmmask);
+               gtk_clist_remove(clist_set, row_set);
+               row_set = gtk_clist_insert(clist_set, row_set, item);
+               gtk_clist_set_pixmap(clist_set, row_set, 0, xpm, xpmmask);
        }
        
        gtk_clist_moveto(clist_set, row_set, 0, row_set/clist_set->rows, 0);
-       gtk_clist_select_row (clist_set, row_set, 0);
+       gtk_clist_select_row(clist_set, row_set, 0);
 
-       g_free (item[2]);
-       g_free (item[3]);
+       g_free(item[2]);
+       g_free(item[3]);
        
        return 0;
 }
 
 static gint prefs_toolbar_delete(void)
 {
-       GtkCList *clist_set   = GTK_CLIST(mtoolbar.clist_set);
+       GtkCList *clist_set = GTK_CLIST(mtoolbar.clist_set);
        gint row_set = 0;
 
        if (clist_set->rows == 0) return -1; 
@@ -475,11 +472,11 @@ static gint prefs_toolbar_delete(void)
        if (clist_set->row_list != NULL) {
                        
                row_set = GPOINTER_TO_INT(clist_set->selection->data);
-               gtk_clist_remove (clist_set, row_set);
-               gtk_clist_columns_autosize (clist_set);
+               gtk_clist_remove(clist_set, row_set);
+               gtk_clist_columns_autosize(clist_set);
                
                if (clist_set->rows > 0)
-                       gtk_clist_select_row (clist_set, (row_set == 0) ? 0:row_set - 1, 0);
+                       gtk_clist_select_row(clist_set,(row_set == 0) ? 0:row_set - 1, 0);
        }
 
        return 0;
@@ -522,7 +519,7 @@ static void prefs_toolbar_down(void)
 static void prefs_toolbar_select_row_set(GtkCList *clist, gint row, gint column,
                                         GdkEvent *event, gpointer user_data)
 {
-       GtkCList *clist_ico = GTK_CLIST (mtoolbar.clist_icons);
+       GtkCList *clist_ico = GTK_CLIST(mtoolbar.clist_icons);
        gchar *syl_act = toolbar_ret_descr_from_val(A_SYL_ACTIONS);
        gint row_set = 0;
        gint row_ico = 0;
@@ -531,21 +528,21 @@ static void prefs_toolbar_select_row_set(GtkCList *clist, gint row, gint column,
        if (clist->selection->data) 
                row_set = GPOINTER_TO_INT(clist->selection->data);      
 
-       gtk_clist_get_text (clist, row_set, 1, &file);
-       gtk_clist_get_text (clist, row_set, 2, &icon_text);
-       gtk_clist_get_text (clist, row_set, 3, &descr);
+       gtk_clist_get_text(clist, row_set, 1, &file);
+       gtk_clist_get_text(clist, row_set, 2, &icon_text);
+       gtk_clist_get_text(clist, row_set, 3, &descr);
 
-       if (g_strcasecmp (descr, syl_act) != 0)
-               gtk_entry_set_text (GTK_ENTRY (mtoolbar.entry_icon_text), icon_text);
+       if (g_strcasecmp(descr, syl_act) != 0)
+               gtk_entry_set_text(GTK_ENTRY(mtoolbar.entry_icon_text), icon_text);
 
-       gtk_list_select_item (GTK_LIST (mtoolbar.combo_list), 
-                             toolbar_ret_val_from_descr (descr));
+       gtk_list_select_item(GTK_LIST(mtoolbar.combo_list), 
+                             toolbar_ret_val_from_descr(descr));
        do {
-               gtk_clist_get_text (clist_ico, row_ico, 1, &entry);
+               gtk_clist_get_text(clist_ico, row_ico, 1, &entry);
                row_ico++;
-       } while (g_strcasecmp (entry, file) != 0);
+       } while(g_strcasecmp(entry, file) != 0);
        
-       gtk_clist_select_row (clist_ico, row_ico - 1, 0);
+       gtk_clist_select_row(clist_ico, row_ico - 1, 0);
        gtk_clist_moveto(clist_ico, row_ico - 1, 0, row_ico/clist_ico->rows, 0);
 }
 
@@ -555,19 +552,19 @@ static void prefs_toolbar_select_row_icons(GtkCList *clist, gint row, gint colum
        GtkCList *clist_icons = GTK_CLIST(mtoolbar.clist_icons);
        gchar *text;
        
-       gtk_clist_get_text (clist_icons, row, 1, &text);
+       gtk_clist_get_text(clist_icons, row, 1, &text);
 
        if (!text) 
                return;
 
-       if (g_strcasecmp (SEPARATOR, text) == 0) {
-               gtk_widget_set_sensitive (mtoolbar.combo_action,     FALSE);
-               gtk_widget_set_sensitive (mtoolbar.entry_icon_text,  FALSE);
-               gtk_widget_set_sensitive (mtoolbar.combo_syl_action, FALSE);
+       if (g_strcasecmp(SEPARATOR, text) == 0) {
+               gtk_widget_set_sensitive(mtoolbar.combo_action,     FALSE);
+               gtk_widget_set_sensitive(mtoolbar.entry_icon_text,  FALSE);
+               gtk_widget_set_sensitive(mtoolbar.combo_syl_action, FALSE);
        } else {
-               gtk_widget_set_sensitive (mtoolbar.combo_action,     TRUE);
-               gtk_widget_set_sensitive (mtoolbar.entry_icon_text,  TRUE);
-               gtk_widget_set_sensitive (mtoolbar.combo_syl_action, TRUE);
+               gtk_widget_set_sensitive(mtoolbar.combo_action,     TRUE);
+               gtk_widget_set_sensitive(mtoolbar.entry_icon_text,  TRUE);
+               gtk_widget_set_sensitive(mtoolbar.combo_syl_action, TRUE);
        }
 }
 
@@ -575,24 +572,24 @@ static void prefs_toolbar_selection_changed(GtkList *list,
                                            gpointer user_data)
 {
 
-       gchar *cur_entry = g_strdup (gtk_entry_get_text (GTK_ENTRY (mtoolbar.combo_entry)));
-       gchar *actions_entry = toolbar_ret_descr_from_val (A_SYL_ACTIONS);
+       gchar *cur_entry = g_strdup(gtk_entry_get_text(GTK_ENTRY(mtoolbar.combo_entry)));
+       gchar *actions_entry = toolbar_ret_descr_from_val(A_SYL_ACTIONS);
 
-       gtk_widget_set_sensitive (mtoolbar.combo_syl_action, TRUE);
+       gtk_widget_set_sensitive(mtoolbar.combo_syl_action, TRUE);
 
-       if (g_strcasecmp (cur_entry, actions_entry) == 0) {
-               gtk_widget_hide (mtoolbar.entry_icon_text);
-               gtk_widget_show (mtoolbar.combo_syl_action);
-               gtk_label_set_text (GTK_LABEL(mtoolbar.label_icon_text), _("Sylpheed Action"));
+       if (g_strcasecmp(cur_entry, actions_entry) == 0) {
+               gtk_widget_hide(mtoolbar.entry_icon_text);
+               gtk_widget_show(mtoolbar.combo_syl_action);
+               gtk_label_set_text(GTK_LABEL(mtoolbar.label_icon_text), _("Sylpheed Action"));
 
                if (prefs_common.actions_list == NULL) {
-                   gtk_widget_set_sensitive (mtoolbar.combo_syl_action, FALSE);
+                   gtk_widget_set_sensitive(mtoolbar.combo_syl_action, FALSE);
                }
                    
        } else {
-               gtk_widget_hide (mtoolbar.combo_syl_action);
-               gtk_widget_show (mtoolbar.entry_icon_text);
-               gtk_label_set_text (GTK_LABEL(mtoolbar.label_icon_text), _("Toolbar text"));
+               gtk_widget_hide(mtoolbar.combo_syl_action);
+               gtk_widget_show(mtoolbar.entry_icon_text);
+               gtk_label_set_text(GTK_LABEL(mtoolbar.label_icon_text), _("Toolbar text"));
        }
 }
 
@@ -637,10 +634,6 @@ static void prefs_toolbar_create(void)
        GtkWidget *hbox_bottom;
        GtkWidget *scrolledwindow_clist_set;
        GtkWidget *clist_set;
-       GtkWidget *label_icon;
-       GtkWidget *label_file;
-       GtkWidget *label_text;
-       GtkWidget *label_action;
 
        GtkWidget *btn_vbox;
        GtkWidget *up_btn;
@@ -654,126 +647,126 @@ static void prefs_toolbar_create(void)
 
        debug_print("Creating custom toolbar window...\n");
 
-       window = gtk_window_new (GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize (window, 450, -1); 
-       gtk_container_set_border_width(GTK_CONTAINER (window), 8);
+       window = gtk_window_new(GTK_WINDOW_DIALOG);
+       gtk_widget_set_usize(window, 450, -1); 
+       gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       gtk_window_set_title (GTK_WINDOW (window), _("Customize toolbar"));
+       gtk_window_set_title(GTK_WINDOW(window), _("Customize toolbar"));
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
        gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
-       gtk_signal_connect(GTK_OBJECT (window), "delete_event",
-                          GTK_SIGNAL_FUNC (prefs_toolbar_cancel),
+       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
+                          GTK_SIGNAL_FUNC(prefs_toolbar_cancel),
                           NULL);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
                           GTK_SIGNAL_FUNC(prefs_toolbar_key_pressed),
                           NULL);
        MANAGE_WINDOW_SIGNALS_CONNECT(window);  
-       gtk_widget_realize (window); 
+       gtk_widget_realize(window); 
 
-       main_vbox = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (main_vbox);
-       gtk_container_add (GTK_CONTAINER (window), main_vbox);
+       main_vbox = gtk_vbox_new(FALSE, 0);
+       gtk_widget_show(main_vbox);
+       gtk_container_add(GTK_CONTAINER(window), main_vbox);
        
-       top_hbox = gtk_hbox_new (FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (main_vbox), top_hbox, TRUE, TRUE, 0);
+       top_hbox = gtk_hbox_new(FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(main_vbox), top_hbox, TRUE, TRUE, 0);
   
-       compose_frame = gtk_frame_new (_("Available toolbar items"));
-       gtk_box_pack_start (GTK_BOX (top_hbox), compose_frame, TRUE, TRUE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (compose_frame), 5);
+       compose_frame = gtk_frame_new(_("Available toolbar items"));
+       gtk_box_pack_start(GTK_BOX(top_hbox), compose_frame, TRUE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(compose_frame), 5);
 
-       vbox_frame = gtk_vbox_new (FALSE, 0);
-       gtk_container_add (GTK_CONTAINER (compose_frame), vbox_frame);
+       vbox_frame = gtk_vbox_new(FALSE, 0);
+       gtk_container_add(GTK_CONTAINER(compose_frame), vbox_frame);
        
        /* available icons */
-       scrolledwindow_clist_icon = gtk_scrolled_window_new (NULL, NULL);
-       gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow_clist_icon), 5);
-       gtk_container_add (GTK_CONTAINER (vbox_frame), scrolledwindow_clist_icon);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_clist_icon), 
+       scrolledwindow_clist_icon = gtk_scrolled_window_new(NULL, NULL);
+       gtk_container_set_border_width(GTK_CONTAINER(scrolledwindow_clist_icon), 5);
+       gtk_container_add(GTK_CONTAINER(vbox_frame), scrolledwindow_clist_icon);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow_clist_icon), 
                                        GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
        
-       clist_icons = gtk_clist_new (2);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow_clist_icon), clist_icons);
-       gtk_container_set_border_width (GTK_CONTAINER (clist_icons), 1);
-       gtk_clist_set_column_width (GTK_CLIST (clist_icons), 0, 35);
-       gtk_clist_set_column_width (GTK_CLIST (clist_icons), 1, 200);
-       gtk_clist_column_titles_hide (GTK_CLIST (clist_icons));
-       gtk_widget_set_usize (clist_icons, 225, 108); 
+       clist_icons = gtk_clist_new(2);
+       gtk_container_add(GTK_CONTAINER(scrolledwindow_clist_icon), clist_icons);
+       gtk_container_set_border_width(GTK_CONTAINER(clist_icons), 1);
+       gtk_clist_set_column_width(GTK_CLIST(clist_icons), 0, 35);
+       gtk_clist_set_column_width(GTK_CLIST(clist_icons), 1, 200);
+       gtk_clist_column_titles_hide(GTK_CLIST(clist_icons));
+       gtk_widget_set_usize(clist_icons, 225, 108); 
        
        /* icon description */
-       hbox_icon_text = gtk_hbox_new (FALSE, 5);
-       gtk_container_add (GTK_CONTAINER (vbox_frame), hbox_icon_text);
+       hbox_icon_text = gtk_hbox_new(FALSE, 5);
+       gtk_container_add(GTK_CONTAINER(vbox_frame), hbox_icon_text);
        
-       label_icon_text = gtk_label_new ("");
-       gtk_box_pack_start (GTK_BOX (hbox_icon_text), label_icon_text, FALSE, FALSE, 5);
+       label_icon_text = gtk_label_new("");
+       gtk_box_pack_start(GTK_BOX(hbox_icon_text), label_icon_text, FALSE, FALSE, 5);
        
-       entry_icon_text = gtk_entry_new ();
-       gtk_box_pack_start (GTK_BOX (hbox_icon_text), entry_icon_text, FALSE, FALSE, 0);
+       entry_icon_text = gtk_entry_new();
+       gtk_box_pack_start(GTK_BOX(hbox_icon_text), entry_icon_text, FALSE, FALSE, 0);
 
        /* Sylpheed Action Combo Box */ 
-       combo_syl_action = gtk_combo_new ();
-       gtk_box_pack_start (GTK_BOX (hbox_icon_text), combo_syl_action, FALSE, FALSE, 0);
+       combo_syl_action = gtk_combo_new();
+       gtk_box_pack_start(GTK_BOX(hbox_icon_text), combo_syl_action, FALSE, FALSE, 0);
 
-       combo_syl_list = GTK_COMBO (combo_syl_action)->list;
-       combo_syl_entry = GTK_COMBO (combo_syl_action)->entry;
-       gtk_entry_set_editable (GTK_ENTRY (combo_syl_entry), FALSE);
+       combo_syl_list = GTK_COMBO(combo_syl_action)->list;
+       combo_syl_entry = GTK_COMBO(combo_syl_action)->entry;
+       gtk_entry_set_editable(GTK_ENTRY(combo_syl_entry), FALSE);
 
        /* available actions */
-       hbox_action = gtk_hbox_new (FALSE, 5);
-       gtk_container_add (GTK_CONTAINER (vbox_frame), hbox_action);
-       gtk_container_set_border_width (GTK_CONTAINER (hbox_action), 5);
+       hbox_action = gtk_hbox_new(FALSE, 5);
+       gtk_container_add(GTK_CONTAINER(vbox_frame), hbox_action);
+       gtk_container_set_border_width(GTK_CONTAINER(hbox_action), 5);
        
-       label_action_sel = gtk_label_new (_("Event executed on click"));
-       gtk_box_pack_start (GTK_BOX (hbox_action), label_action_sel, FALSE, FALSE, 0);
+       label_action_sel = gtk_label_new(_("Event executed on click"));
+       gtk_box_pack_start(GTK_BOX(hbox_action), label_action_sel, FALSE, FALSE, 0);
        
-       combo_action = gtk_combo_new ();
-       gtk_box_pack_start (GTK_BOX (hbox_action), combo_action, FALSE, FALSE, 0);
+       combo_action = gtk_combo_new();
+       gtk_box_pack_start(GTK_BOX(hbox_action), combo_action, FALSE, FALSE, 0);
        
-       combo_list = GTK_COMBO (combo_action)->list;
-       combo_entry = GTK_COMBO (combo_action)->entry;
-       gtk_entry_set_editable (GTK_ENTRY (combo_entry), FALSE);
+       combo_list = GTK_COMBO(combo_action)->list;
+       combo_entry = GTK_COMBO(combo_action)->entry;
+       gtk_entry_set_editable(GTK_ENTRY(combo_entry), FALSE);
        
        /* register / substitute / delete */
-       reg_hbox = gtk_hbox_new (FALSE, 4);
-       gtk_box_pack_start (GTK_BOX (main_vbox), reg_hbox, FALSE, FALSE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (reg_hbox), 10);
+       reg_hbox = gtk_hbox_new(FALSE, 4);
+       gtk_box_pack_start(GTK_BOX(main_vbox), reg_hbox, FALSE, FALSE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(reg_hbox), 10);
 
-       arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
-       gtk_box_pack_start (GTK_BOX (reg_hbox), arrow, FALSE, FALSE, 0);
-       gtk_widget_set_usize (arrow, -1, 16);
+       arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
+       gtk_box_pack_start(GTK_BOX(reg_hbox), arrow, FALSE, FALSE, 0);
+       gtk_widget_set_usize(arrow, -1, 16);
 
-       btn_hbox = gtk_hbox_new (TRUE, 4);
-       gtk_box_pack_start (GTK_BOX (reg_hbox), btn_hbox, FALSE, FALSE, 0);
+       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_with_label (_("Register"));
-       gtk_box_pack_start (GTK_BOX (btn_hbox), reg_btn, FALSE, TRUE, 0);
-       gtk_signal_connect (GTK_OBJECT (reg_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_toolbar_register), 
+       reg_btn = gtk_button_new_with_label(_("Register"));
+       gtk_box_pack_start(GTK_BOX(btn_hbox), reg_btn, FALSE, TRUE, 0);
+       gtk_signal_connect(GTK_OBJECT(reg_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_toolbar_register), 
                            NULL);
 
-       subst_btn = gtk_button_new_with_label (_(" Substitute "));
-       gtk_box_pack_start (GTK_BOX (btn_hbox), subst_btn, FALSE, TRUE, 0);
-       gtk_signal_connect (GTK_OBJECT (subst_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_toolbar_substitute),
+       subst_btn = gtk_button_new_with_label(_(" Substitute "));
+       gtk_box_pack_start(GTK_BOX(btn_hbox), subst_btn, FALSE, TRUE, 0);
+       gtk_signal_connect(GTK_OBJECT(subst_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_toolbar_substitute),
                            NULL);
 
-       del_btn = gtk_button_new_with_label (_("Delete"));
-       gtk_box_pack_start (GTK_BOX (btn_hbox), del_btn, FALSE, TRUE, 0);
-       gtk_signal_connect (GTK_OBJECT (del_btn), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_toolbar_delete), 
+       del_btn = gtk_button_new_with_label(_("Delete"));
+       gtk_box_pack_start(GTK_BOX(btn_hbox), del_btn, FALSE, TRUE, 0);
+       gtk_signal_connect(GTK_OBJECT(del_btn), "clicked",
+                           GTK_SIGNAL_FUNC(prefs_toolbar_delete), 
                            NULL);
 
        /* currently active toolbar items */
-       frame_toolbar_items = gtk_frame_new (_("Displayed toolbar items"));
-       gtk_box_pack_start (GTK_BOX (main_vbox), frame_toolbar_items, TRUE, TRUE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (frame_toolbar_items), 5);
+       frame_toolbar_items = gtk_frame_new(_("Displayed toolbar items"));
+       gtk_box_pack_start(GTK_BOX(main_vbox), frame_toolbar_items, TRUE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(frame_toolbar_items), 5);
        
-       hbox_bottom = gtk_hbox_new (FALSE, 0);
-       gtk_container_add (GTK_CONTAINER (frame_toolbar_items), hbox_bottom);
+       hbox_bottom = gtk_hbox_new(FALSE, 0);
+       gtk_container_add(GTK_CONTAINER(frame_toolbar_items), hbox_bottom);
        
-       scrolledwindow_clist_set = gtk_scrolled_window_new (NULL, NULL);
-       gtk_box_pack_start (GTK_BOX (hbox_bottom), scrolledwindow_clist_set, TRUE, TRUE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow_clist_set), 1);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_clist_icon), 
+       scrolledwindow_clist_set = gtk_scrolled_window_new(NULL, NULL);
+       gtk_box_pack_start(GTK_BOX(hbox_bottom), scrolledwindow_clist_set, TRUE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(scrolledwindow_clist_set), 1);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow_clist_icon), 
                                        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
        titles[COL_ICON]     = _("Icon");
@@ -781,51 +774,51 @@ static void prefs_toolbar_create(void)
        titles[COL_TEXT]     = _("Icon text");
        titles[COL_EVENT]    = _("Mapped event");
        
-       clist_set = gtk_clist_new_with_titles (N_DISPLAYED_ITEMS_COLS, titles);
-       gtk_widget_show (clist_set);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow_clist_set), clist_set);
-       gtk_clist_set_column_width (GTK_CLIST(clist_set), COL_ICON    , 80);
-       gtk_clist_set_column_width (GTK_CLIST(clist_set), COL_FILENAME, 80);
-       gtk_clist_set_column_width (GTK_CLIST(clist_set), COL_TEXT    , 80);
-       gtk_clist_set_column_width (GTK_CLIST(clist_set), COL_EVENT   , 80);
-       gtk_clist_column_titles_show (GTK_CLIST (clist_set));
-       gtk_widget_set_usize (clist_set, 225, 120);
-
-       btn_vbox = gtk_vbox_new (FALSE, 8);
-       gtk_widget_show (btn_vbox);
-       gtk_box_pack_start (GTK_BOX (hbox_bottom), btn_vbox, FALSE, FALSE, 5);
-
-       up_btn = gtk_button_new_with_label (_("Up"));
-       gtk_widget_show (up_btn);
-       gtk_box_pack_start (GTK_BOX (btn_vbox), up_btn, FALSE, FALSE, 2);
-
-       down_btn = gtk_button_new_with_label (_("Down"));
-       gtk_widget_show (down_btn);
-       gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0);
+       clist_set = gtk_clist_new_with_titles(N_DISPLAYED_ITEMS_COLS, titles);
+       gtk_widget_show(clist_set);
+       gtk_container_add(GTK_CONTAINER(scrolledwindow_clist_set), clist_set);
+       gtk_clist_set_column_width(GTK_CLIST(clist_set), COL_ICON    , 80);
+       gtk_clist_set_column_width(GTK_CLIST(clist_set), COL_FILENAME, 80);
+       gtk_clist_set_column_width(GTK_CLIST(clist_set), COL_TEXT    , 80);
+       gtk_clist_set_column_width(GTK_CLIST(clist_set), COL_EVENT   , 80);
+       gtk_clist_column_titles_show(GTK_CLIST(clist_set));
+       gtk_widget_set_usize(clist_set, 225, 120);
+
+       btn_vbox = gtk_vbox_new(FALSE, 8);
+       gtk_widget_show(btn_vbox);
+       gtk_box_pack_start(GTK_BOX(hbox_bottom), btn_vbox, FALSE, FALSE, 5);
+
+       up_btn = gtk_button_new_with_label(_("Up"));
+       gtk_widget_show(up_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox), up_btn, FALSE, FALSE, 2);
+
+       down_btn = gtk_button_new_with_label(_("Down"));
+       gtk_widget_show(down_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox), down_btn, FALSE, FALSE, 0);
 
        gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
                                &cancel_btn, _("Cancel"), NULL, NULL);
-       gtk_box_pack_end (GTK_BOX(main_vbox), confirm_area, FALSE, FALSE, 0);
-       gtk_container_set_border_width (GTK_CONTAINER (confirm_area), 5);
-       gtk_widget_grab_default (ok_btn);
+       gtk_box_pack_end(GTK_BOX(main_vbox), confirm_area, FALSE, FALSE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(confirm_area), 5);
+       gtk_widget_grab_default(ok_btn);
 
        gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
                           GTK_SIGNAL_FUNC(prefs_toolbar_ok), NULL);
        gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
                           GTK_SIGNAL_FUNC(prefs_toolbar_cancel), NULL);
-       gtk_signal_connect(GTK_OBJECT (clist_set), "select_row",
-                          GTK_SIGNAL_FUNC (prefs_toolbar_select_row_set),
+       gtk_signal_connect(GTK_OBJECT(clist_set), "select_row",
+                          GTK_SIGNAL_FUNC(prefs_toolbar_select_row_set),
                           NULL);
-       gtk_signal_connect(GTK_OBJECT (clist_icons), "select_row",
-                          GTK_SIGNAL_FUNC (prefs_toolbar_select_row_icons),
+       gtk_signal_connect(GTK_OBJECT(clist_icons), "select_row",
+                          GTK_SIGNAL_FUNC(prefs_toolbar_select_row_icons),
                           NULL);
        gtk_signal_connect(GTK_OBJECT(combo_list), "selection-changed",
                           GTK_SIGNAL_FUNC(prefs_toolbar_selection_changed),
                           NULL);
-       gtk_signal_connect(GTK_OBJECT (up_btn), "clicked",
-                          GTK_SIGNAL_FUNC (prefs_toolbar_up), NULL);
-       gtk_signal_connect(GTK_OBJECT (down_btn), "clicked",
-                          GTK_SIGNAL_FUNC (prefs_toolbar_down), NULL);
+       gtk_signal_connect(GTK_OBJECT(up_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_toolbar_up), NULL);
+       gtk_signal_connect(GTK_OBJECT(down_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_toolbar_down), NULL);
        
        mtoolbar.window           = window;
        mtoolbar.clist_icons      = clist_icons;
@@ -840,5 +833,5 @@ static void prefs_toolbar_create(void)
 
        mtoolbar.label_icon_text  = label_icon_text;
 
-       gtk_widget_show_all (window);
+       gtk_widget_show_all(window);
 }
index 48fe91780fdf10c698137443c68009a01e3462d1..880f90d2bfbb378eb243dd13aac2dd674a5bbbfe 100644 (file)
@@ -180,7 +180,7 @@ static GtkItemFactoryEntry fwd_popup_entries[] =
 
 void toolbar_actions_cb(GtkWidget *widget, ToolbarItem *toolbar_item)
 {
-       if (toolbar_item->action < sizeof (t_action) / sizeof (t_action[0]))
+       if (toolbar_item->action < sizeof(t_action) / sizeof(t_action[0]))
                t_action[toolbar_item->action].func(widget, mwin);
 }
 
@@ -188,8 +188,8 @@ gint toolbar_ret_val_from_descr(gchar *descr)
 {
        gint i;
        
-       for (i = 0; i < sizeof (t_action) / sizeof (t_action[0]); i++) {
-               if (g_strcasecmp (t_action[i].descr, descr) == 0)
+       for (i = 0; i < sizeof(t_action) / sizeof(t_action[0]); i++) {
+               if (g_strcasecmp(t_action[i].descr, descr) == 0)
                                return i;
        }
        
@@ -198,7 +198,7 @@ gint toolbar_ret_val_from_descr(gchar *descr)
 
 gchar *toolbar_ret_descr_from_val(gint val)
 {
-       g_return_val_if_fail (val >=0 && val <= sizeof(t_action) / sizeof(t_action[0]), NULL);
+       g_return_val_if_fail(val >=0 && val <= sizeof(t_action) / sizeof(t_action[0]), NULL);
 
        return t_action[val].descr;
 
@@ -208,8 +208,8 @@ static gint toolbar_ret_val_from_text(gchar *text)
 {
        gint i;
        
-       for (i = 0; i < sizeof (t_action) / sizeof (t_action[0]); i++) {
-               if (g_strcasecmp (t_action[i].action_text, text) == 0)
+       for (i = 0; i < sizeof(t_action) / sizeof(t_action[0]); i++) {
+               if (g_strcasecmp(t_action[i].action_text, text) == 0)
                                return i;
        }
        
@@ -218,7 +218,7 @@ static gint toolbar_ret_val_from_text(gchar *text)
 
 gchar *toolbar_ret_text_from_val(gint val)
 {
-       g_return_val_if_fail (val >=0 && val <= sizeof(t_action) / sizeof(t_action[0]), NULL);
+       g_return_val_if_fail(val >=0 && val <= sizeof(t_action) / sizeof(t_action[0]), NULL);
 
        return t_action[val].action_text;
 }
@@ -245,7 +245,7 @@ GList *toolbar_get_action_items(void)
        gint i;
        
        for (i = 0; i < N_ACTION_VAL; i++) {
-               items = g_list_append (items, t_action[i].descr);
+               items = g_list_append(items, t_action[i].descr);
        }
 
        return items;
@@ -258,24 +258,24 @@ static void toolbar_parse_item(XMLFile *file)
        ToolbarItem *item = NULL;
 
        attr = xml_get_current_tag_attr(file);
-       item = g_new0 (ToolbarItem, 1);
+       item = g_new0(ToolbarItem, 1);
        while( attr ) {
                name = ((XMLAttr *)attr->data)->name;
                value = ((XMLAttr *)attr->data)->value;
                
-               if (strcmp (name, TOOLBAR_ICON_FILE) == 0) 
+               if (g_strcasecmp(name, TOOLBAR_ICON_FILE) == 0) 
                        item->file = g_strdup (value);
-               else if (strcmp (name, TOOLBAR_ICON_TEXT) == 0)
+               else if (g_strcasecmp(name, TOOLBAR_ICON_TEXT) == 0)
                        item->text = g_strdup (value);
-               else if (strcmp (name, TOOLBAR_ICON_ACTION) == 0)
+               else if (g_strcasecmp(name, TOOLBAR_ICON_ACTION) == 0)
                        item->action = toolbar_ret_val_from_text(value);
 
-               attr = g_list_next (attr);
+               attr = g_list_next(attr);
        }
        if (item->action != -1) {
                
                if ( !toolbar_is_duplicate(item->action)) 
-                       toolbar_list = g_slist_append (toolbar_list, item);
+                       toolbar_list = g_slist_append(toolbar_list, item);
        }
 }
 
@@ -304,32 +304,32 @@ void toolbar_set_default_toolbar(void)
                { A_GOTO_NEXT,     STOCK_PIXMAP_DOWN_ARROW,           _("Next")    },
        };
                
-       for (i = 0; i < sizeof (default_toolbar) / sizeof (default_toolbar[0]); i++) {
+       for (i = 0; i < sizeof(default_toolbar) / sizeof(default_toolbar[0]); i++) {
                
-               ToolbarItem *toolbar_item = g_new0 (ToolbarItem, 1);
+               ToolbarItem *toolbar_item = g_new0(ToolbarItem, 1);
                
                if (default_toolbar[i].action != A_SEPARATOR) {
                        
-                       gchar *file = stock_pixmap_get_name ((StockPixmap)default_toolbar[i].icon);
+                       gchar *file = stock_pixmap_get_name((StockPixmap)default_toolbar[i].icon);
                        
-                       toolbar_item->file   = g_strdup (file);
+                       toolbar_item->file   = g_strdup(file);
                        toolbar_item->action = default_toolbar[i].action;
-                       toolbar_item->text   = g_strdup (default_toolbar[i].text);
+                       toolbar_item->text   = g_strdup(default_toolbar[i].text);
                } else {
 
-                       toolbar_item->file   = g_strdup (SEPARATOR);
+                       toolbar_item->file   = g_strdup(SEPARATOR);
                        toolbar_item->action = A_SEPARATOR;
                }
                
                if (toolbar_item->action != -1) {
                        
                        if ( !toolbar_is_duplicate(toolbar_item->action)) 
-                               toolbar_list = g_slist_append (toolbar_list, toolbar_item);
+                               toolbar_list = g_slist_append(toolbar_list, toolbar_item);
                }       
        }
 }
 
-void toolbar_save_config_file ()
+void toolbar_save_config_file()
 {
        GSList *cur;
        FILE *fp;
@@ -338,36 +338,36 @@ void toolbar_save_config_file ()
 
        debug_print("save Toolbar Configuration\n");
 
-       fileSpec = g_strconcat (get_rc_dir(), G_DIR_SEPARATOR_S, TOOLBAR_FILE, NULL );
-       pfile = prefs_write_open (fileSpec);
+       fileSpec = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, TOOLBAR_FILE, NULL );
+       pfile = prefs_write_open(fileSpec);
        g_free( fileSpec );
        if( pfile ) {
                fp = pfile->fp;
-               fprintf (fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
-                               conv_get_current_charset_str());
+               fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
+                       conv_get_current_charset_str());
 
-               fprintf (fp, "<%s>\n", TOOLBAR_TAG_INDEX);
+               fprintf(fp, "<%s>\n", TOOLBAR_TAG_INDEX);
 
                for (cur = toolbar_list; cur != NULL; cur = cur->next) {
                        ToolbarItem *toolbar_item = (ToolbarItem*) cur->data;
                        
-                       if (g_strcasecmp (toolbar_item->file, SEPARATOR) != 0) 
-                               fprintf (fp, "\t<%s %s=\"%s\" %s=\"%s\" %s=\"%s\"/>\n",
-                                        TOOLBAR_TAG_ITEM, 
-                                        TOOLBAR_ICON_FILE, toolbar_item->file,
-                                        TOOLBAR_ICON_TEXT, toolbar_item->text,
-                                        TOOLBAR_ICON_ACTION, 
-                                        toolbar_ret_text_from_val (toolbar_item->action));
+                       if (g_strcasecmp(toolbar_item->file, SEPARATOR) != 0) 
+                               fprintf(fp, "\t<%s %s=\"%s\" %s=\"%s\" %s=\"%s\"/>\n",
+                                       TOOLBAR_TAG_ITEM, 
+                                       TOOLBAR_ICON_FILE, toolbar_item->file,
+                                       TOOLBAR_ICON_TEXT, toolbar_item->text,
+                                       TOOLBAR_ICON_ACTION, 
+                                       toolbar_ret_text_from_val(toolbar_item->action));
                        else 
-                               fprintf (fp, "\t<%s/>\n", TOOLBAR_TAG_SEPARATOR); 
+                               fprintf(fp, "\t<%s/>\n", TOOLBAR_TAG_SEPARATOR); 
                }
 
-               fprintf (fp, "</%s>\n", TOOLBAR_TAG_INDEX);     
+               fprintf(fp, "</%s>\n", TOOLBAR_TAG_INDEX);      
        
-               ifprefs_write_close (pfile) < 0 ) 
-                       g_warning(_("failed to write toolbar configuration to file\n"));
+               if (prefs_write_close (pfile) < 0 ) 
+                       g_warning("failed to write toolbar configuration to file\n");
        } else
-               g_warning(_("failed to open toolbar configuration file for writing\n"));
+               g_warning("failed to open toolbar configuration file for writing\n");
 }
 
 void toolbar_clear_list()
@@ -375,16 +375,16 @@ void toolbar_clear_list()
        while (toolbar_list != NULL) {
                ToolbarItem *item = (ToolbarItem*) toolbar_list->data;
                
-               toolbar_list = g_slist_remove (toolbar_list, item);
+               toolbar_list = g_slist_remove(toolbar_list, item);
                if (item->file)
-                       g_free (item->file);
+                       g_free(item->file);
                if (item->text)
-                       g_free (item->text);
+                       g_free(item->text);
        }
-       g_slist_free (toolbar_list);
+       g_slist_free(toolbar_list);
 }
 
-void toolbar_read_config_file ()
+void toolbar_read_config_file(void)
 {
        XMLFile *file   = NULL;
        gchar *fileSpec = NULL;
@@ -393,40 +393,40 @@ void toolbar_read_config_file ()
 
        debug_print("read Toolbar Configuration\n");
 
-       fileSpec = g_strconcat (get_rc_dir(), G_DIR_SEPARATOR_S, TOOLBAR_FILE, NULL );
-       file = xml_open_file (fileSpec);
-       g_free (fileSpec);
+       fileSpec = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, TOOLBAR_FILE, NULL );
+       file = xml_open_file(fileSpec);
+       g_free(fileSpec);
 
        toolbar_clear_list();
 
        if (file) {
-               if ((setjmp (jumper))
-               || (xml_get_dtd (file))
-               || (xml_parse_next_tag (file))
-               || (!xml_compare_tag (file, TOOLBAR_TAG_INDEX))) {
+               if ((setjmp(jumper))
+               || (xml_get_dtd(file))
+               || (xml_parse_next_tag(file))
+               || (!xml_compare_tag(file, TOOLBAR_TAG_INDEX))) {
                        xml_close_file(file);
                        return;
                }
 
-               attr = xml_get_current_tag_attr (file);
+               attr = xml_get_current_tag_attr(file);
                
                retVal = TRUE;
                for (;;) {
                        if (!file->level) 
                                break;
                        /* Get item tag */
-                       if (xml_parse_next_tag (file)) 
-                               longjmp (jumper, 1);
+                       if (xml_parse_next_tag(file)) 
+                               longjmp(jumper, 1);
 
                        /* Get next tag (icon, icon_text or icon_action) */
-                       if (xml_compare_tag (file, TOOLBAR_TAG_ITEM)) {
-                               toolbar_parse_item (file);
-                       } else if (xml_compare_tag (file, TOOLBAR_TAG_SEPARATOR)) {
-                               ToolbarItem *item = g_new0 (ToolbarItem, 1);
+                       if (xml_compare_tag(file, TOOLBAR_TAG_ITEM)) {
+                               toolbar_parse_item(file);
+                       } else if (xml_compare_tag(file, TOOLBAR_TAG_SEPARATOR)) {
+                               ToolbarItem *item = g_new0(ToolbarItem, 1);
                        
-                               item->file   = g_strdup (SEPARATOR);
+                               item->file   = g_strdup(SEPARATOR);
                                item->action = A_SEPARATOR;
-                               toolbar_list = g_slist_append (toolbar_list, item);
+                               toolbar_list = g_slist_append(toolbar_list, item);
                        }
 
                }
@@ -439,8 +439,8 @@ void toolbar_read_config_file ()
        }
 }
 
-static void toolbar_actions_execute_cb (GtkWidget      *widget,
-                                gpointer        data)
+static void toolbar_actions_execute_cb(GtkWidget *widget,
+                                      gpointer  data)
 {
        gint i = 0;
        GSList *cur, *lop;
@@ -460,11 +460,11 @@ static void toolbar_actions_execute_cb (GtkWidget *widget,
                                action_p[0] = 0x00;
                                if (g_strcasecmp(act->name, action) == 0) {
                                        found = TRUE;
-                                       g_free (action);
+                                       g_free(action);
                                        break;
                                } else 
                                        i++;
-                               g_free (action);
+                               g_free(action);
                        }
                        if (found) 
                                break;
@@ -474,11 +474,11 @@ static void toolbar_actions_execute_cb (GtkWidget *widget,
        if (found)
                actions_execute(mwin, i, widget);
        else
-               g_warning (_("Error: did not find Sylpheed Action to execute"));
+               g_warning ("Error: did not find Sylpheed Action to execute");
 }
 
 static void toolbar_inc_cb              (GtkWidget     *widget,
-                                gpointer        data)
+                                         gpointer       data)
 {
        MainWindow *mainwin = (MainWindow *)data;
 
@@ -659,7 +659,8 @@ static void toolbar_forward_popup_cb(GtkWidget *widget, GdkEventButton *event, g
        }
 }
 
-static void toolbar_forward_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
+static void toolbar_forward_popup_closed_cb (GtkMenuShell *menu_shell, 
+                                            gpointer     data)
 {
        MainWindow *mainwin = (MainWindow *)data;
 
@@ -667,9 +668,9 @@ static void toolbar_forward_popup_closed_cb(GtkMenuShell *menu_shell, gpointer d
        manage_window_focus_in(mainwin->window, NULL, NULL);
 }
 
-static void activate_compose_button (MainToolbar *toolbar,
-                               ToolbarStyle style,
-                               ComposeButtonType type)
+static void activate_compose_button (MainToolbar       *toolbar,
+                                    ToolbarStyle      style,
+                                    ComposeButtonType type)
 {
        if ((!toolbar->compose_mail_btn) || (!toolbar->compose_news_btn))
                return;
@@ -681,17 +682,8 @@ static void activate_compose_button (MainToolbar *toolbar,
        toolbar->compose_btn_type = type;       
 }
 
-void toolbar_reflect_prefs_pixmap_theme(MainWindow *mainwin)
-{
-       gtk_container_remove(GTK_CONTAINER(mainwin->handlebox), 
-                            GTK_WIDGET(mainwin->toolbar->toolbar));
-
-       mainwin->toolbar->toolbar = NULL;
-       toolbar_create(mainwin, mainwin->handlebox);
-
-}
-
-void toolbar_set_compose_button(MainToolbar *toolbar, ComposeButtonType compose_btn_type)
+void toolbar_set_compose_button (MainToolbar       *toolbar, 
+                                ComposeButtonType compose_btn_type)
 {
        if (toolbar->compose_btn_type != compose_btn_type)
                activate_compose_button(toolbar, 
@@ -703,7 +695,9 @@ void toolbar_set_sensitive(MainWindow *mainwin)
 {
        SensitiveCond state;
        gboolean sensitive;
+       guint no_items = g_slist_length(toolbar_list);
        MainToolbar *toolbar = mainwin->toolbar;
+       GSList *cur;
        gint i = 0;
        gint total = 0;
 
@@ -711,11 +705,11 @@ void toolbar_set_sensitive(MainWindow *mainwin)
                GtkWidget *widget;
                SensitiveCond cond;
                gboolean empty;
-       } entry[11];
+       } entry[no_items + 1];
 
 #define SET_WIDGET_COND(w, c)     \
 {                             \
-         entry[total].widget = w; \
+        entry[total].widget = w; \
        entry[total].cond   = c; \
        total++;                       \
 }
@@ -736,6 +730,12 @@ void toolbar_set_sensitive(MainWindow *mainwin)
                        M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED);
        SET_WIDGET_COND(toolbar->exec_btn, M_MSG_EXIST|M_EXEC|M_UNLOCKED);
 
+       for (cur = toolbar->syl_action; cur != NULL;  cur = cur->next) {
+               ToolbarSylpheedActions *act = (ToolbarSylpheedActions*)cur->data;
+               
+               SET_WIDGET_COND(act->widget, M_TARGET_EXIST|M_UNLOCKED);
+       }
+
 #undef SET_WIDGET_COND
 
        state = main_window_get_current_state(mainwin);
@@ -761,7 +761,7 @@ void toolbar_popups_create(MainWindow *mainwin, GtkWidget *window)
        GtkWidget *fwd_popup;
 
        if (mainwin->toolbar != NULL)
-               g_free (mainwin->toolbar);
+               g_free(mainwin->toolbar);
 
        mainwin->toolbar = g_new0(MainToolbar, 1); 
        
@@ -800,6 +800,31 @@ void toolbar_popups_create(MainWindow *mainwin, GtkWidget *window)
        mainwin->toolbar->fwd_popup         = fwd_popup;
 }
 
+void toolbar_update(void)
+{
+       gtk_container_remove(GTK_CONTAINER(mwin->handlebox), 
+                            GTK_WIDGET(mwin->toolbar->toolbar));
+       
+       mwin->toolbar->toolbar    = NULL;
+       mwin->toolbar->get_btn    = NULL;
+       mwin->toolbar->getall_btn = NULL;
+       mwin->toolbar->send_btn   = NULL;
+       mwin->toolbar->compose_mail_btn = NULL;
+       mwin->toolbar->compose_news_btn = NULL;
+       mwin->toolbar->reply_btn        = NULL; 
+       mwin->toolbar->replyall_btn     = NULL; 
+       mwin->toolbar->replysender_btn  = NULL; 
+       mwin->toolbar->fwd_btn    = NULL;       
+       mwin->toolbar->delete_btn = NULL;       
+       mwin->toolbar->next_btn   = NULL;       
+       mwin->toolbar->exec_btn   = NULL;
+
+       toolbar_destroy(mwin);
+       toolbar_create(mwin, mwin->handlebox);
+       toolbar_set_sensitive(mwin);
+
+}
+
 void toolbar_destroy(MainWindow *mainwin)
 {
        ToolbarSylpheedActions *syl_action;
@@ -810,11 +835,11 @@ void toolbar_destroy(MainWindow *mainwin)
                syl_action = (ToolbarSylpheedActions*)mainwin->toolbar->syl_action->data;
 
                if (syl_action->name)
-                       g_free (syl_action->name);
+                       g_free(syl_action->name);
                mainwin->toolbar->syl_action = g_slist_remove(mainwin->toolbar->syl_action, syl_action);
        }
 
-       g_slist_free (mainwin->toolbar->syl_action);
+       g_slist_free(mainwin->toolbar->syl_action);
 }
 
 void toolbar_create(MainWindow *mainwin,
@@ -847,15 +872,15 @@ void toolbar_create(MainWindow *mainwin,
                toolbar_item  = (ToolbarItem*) cur->data;
                
 
-               if (g_strcasecmp (toolbar_item->file, SEPARATOR) == 0) {
-                       gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+               if (g_strcasecmp(toolbar_item->file, SEPARATOR) == 0) {
+                       gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
                        continue;
                }
 
-               icon_wid = stock_pixmap_widget(container, stock_pixmap_get_icon (toolbar_item->file));
+               icon_wid = stock_pixmap_widget(container, stock_pixmap_get_icon(toolbar_item->file));
                item  = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
                                                toolbar_item->text,
-                                               toolbar_ret_descr_from_val (toolbar_item->action),
+                                               toolbar_ret_descr_from_val(toolbar_item->action),
                                                (""),
                                                icon_wid, toolbar_actions_cb, 
                                                toolbar_item);
@@ -874,7 +899,7 @@ void toolbar_create(MainWindow *mainwin,
                        icon_news = stock_pixmap_widget(container, STOCK_PIXMAP_NEWS_COMPOSE);
                        item_news = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
                                                            _("News"),
-                                                           toolbar_ret_descr_from_val (A_COMPOSE_NEWS),
+                                                           toolbar_ret_descr_from_val(A_COMPOSE_NEWS),
                                                            (""),
                                                            icon_news, toolbar_actions_cb, 
                                                            toolbar_item);
@@ -925,7 +950,7 @@ void toolbar_create(MainWindow *mainwin,
 
                        mainwin->toolbar->syl_action = g_slist_append(mainwin->toolbar->syl_action,
                                                                      syl_action);
-                       gtk_widget_show (item);
+                       gtk_widget_show(item);
                        break;
                default:
                        break;
@@ -936,18 +961,18 @@ void toolbar_create(MainWindow *mainwin,
        if (!mainwin->toolbar->exec_btn) {
                toolbar_item = g_new0(ToolbarItem, 1);
                toolbar_item->action = A_EXECUTE;
-               toolbar_item->file   = stock_pixmap_get_name (STOCK_PIXMAP_EXEC);
+               toolbar_item->file   = stock_pixmap_get_name(STOCK_PIXMAP_EXEC);
                toolbar_item->text   = toolbar_ret_text_from_val(A_EXECUTE);
 
                icon_wid = stock_pixmap_widget(container, STOCK_PIXMAP_EXEC);
                item = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
                                               _("Execute"),
-                                              toolbar_ret_descr_from_val (A_EXECUTE),
+                                              toolbar_ret_descr_from_val(A_EXECUTE),
                                               (""),
                                               icon_wid, toolbar_actions_cb,
                                               toolbar_item);
                mainwin->toolbar->exec_btn = item;
-               g_free (toolbar_item);
+               g_free(toolbar_item);
        }
        
        mainwin->toolbar->toolbar = toolbar;
index 9e2bf79e3f81e5033cd6e1359d50fcf539c07f73..980997477231b551874645a392a428e12d961ade 100644 (file)
@@ -127,6 +127,7 @@ void      toolbar_save_config_file         (void);
 void      toolbar_read_config_file         (void);
 void      toolbar_set_default_toolbar      (void);
 void      toolbar_clear_list               (void);
+void      toolbar_update                   (void);
 void      toolbar_destroy                  (MainWindow         *mainwin);
 
 gint      toolbar_ret_val_from_descr       (gchar              *descr);