re-work UI
authorPaul Mangan <paul@claws-mail.org>
Sat, 10 Aug 2002 18:54:27 +0000 (18:54 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sat, 10 Aug 2002 18:54:27 +0000 (18:54 +0000)
src/prefs_toolbar.c

index 557c605..aa47852 100644 (file)
 #include "toolbar.h"
 #include "prefs_toolbar.h"
 
+typedef enum
+{
+       COL_PIXMAP      = 0,
+       COL_FILENAME    = 1,
+       COL_TEXT        = 2,
+       COL_EVENT       = 3
+} DisplayedItemsColumnPos;
+
+# define N_DISPLAYED_ITEMS_COLS        4
+
 static struct _Toolbar {
        GtkWidget *window;
 
@@ -63,7 +73,7 @@ static struct _Toolbar {
 
 }mtoolbar;
 
-#define CELL_SPACING 30
+#define CELL_SPACING 24
 #define ERROR_MSG _("Selected Action already set.\nPlease choose another Action from List")
 
 static void prefs_toolbar_open                   (void);
@@ -635,33 +645,34 @@ static void prefs_toolbar_create(void)
        GtkWidget *up_btn;
        GtkWidget *down_btn;
        GtkWidget *icon_wid;
+       gchar *titles[N_DISPLAYED_ITEMS_COLS];
 
        GtkWidget *confirm_area;
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
 
-       window = gtk_window_new (GTK_WINDOW_DIALOG);
+       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);
        gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       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_window_set_title (GTK_WINDOW (window), _("Customize toolbar"));
-       gtk_widget_set_usize (window, 450, -1); 
+       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); 
 
        main_vbox = gtk_vbox_new (FALSE, 0);
-
+       gtk_widget_show (main_vbox);
        gtk_container_add (GTK_CONTAINER (window), main_vbox);
        
-       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);
-
        top_hbox = gtk_hbox_new (FALSE, 0);
        gtk_box_pack_start (GTK_BOX (main_vbox), top_hbox, TRUE, TRUE, 0);
   
@@ -685,12 +696,11 @@ static void prefs_toolbar_create(void)
        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, 100); 
+       gtk_widget_set_usize (clist_icons, 225, 108); 
        
        /* icon description */
-       hbox_icon_text = gtk_hbox_new (TRUE, 5);
+       hbox_icon_text = gtk_hbox_new (FALSE, 5);
        gtk_container_add (GTK_CONTAINER (vbox_frame), hbox_icon_text);
-       gtk_container_set_border_width (GTK_CONTAINER (hbox_icon_text), 5);
        
        label_icon_text = gtk_label_new ("");
        gtk_box_pack_start (GTK_BOX (hbox_icon_text), label_icon_text, FALSE, FALSE, 5);
@@ -700,23 +710,22 @@ static void prefs_toolbar_create(void)
 
        /* Sylpheed Action Combo Box */ 
        combo_syl_action = gtk_combo_new ();
-       gtk_box_pack_start (GTK_BOX (hbox_icon_text), combo_syl_action, TRUE, TRUE, 0);
+       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);
 
        /* available actions */
-       hbox_action = gtk_hbox_new (TRUE, 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);
-       gtk_label_set_justify (GTK_LABEL (label_action_sel), GTK_JUSTIFY_RIGHT);
        
        combo_action = gtk_combo_new ();
-       gtk_box_pack_start (GTK_BOX (hbox_action), combo_action, TRUE, TRUE, 0);
+       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;
@@ -765,28 +774,22 @@ static void prefs_toolbar_create(void)
        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_PIXMAP]   = _("Pixmap");
+       titles[COL_FILENAME] = _("File name");
+       titles[COL_TEXT]     = _("Pixmap text");
+       titles[COL_EVENT]    = _("Mapped event");
        
-       clist_set = gtk_clist_new (4);
+       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), 0, 80);
-       gtk_clist_set_column_width (GTK_CLIST (clist_set), 1, 80);
-       gtk_clist_set_column_width (GTK_CLIST (clist_set), 2, 80);
-       gtk_clist_set_column_width (GTK_CLIST (clist_set), 3, 80);
+       gtk_clist_set_column_width (GTK_CLIST(clist_set), COL_PIXMAP  , 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);
 
-       label_icon = gtk_label_new (_("Pixmap"));
-       gtk_clist_set_column_widget (GTK_CLIST (clist_set), 0, label_icon);
-       
-       label_file = gtk_label_new (_("File name"));
-       gtk_clist_set_column_widget (GTK_CLIST (clist_set), 1, label_file);
-
-       label_text = gtk_label_new (_("Pixmap text"));
-       gtk_clist_set_column_widget (GTK_CLIST (clist_set), 2, label_text);
-
-       label_action = gtk_label_new (_("Mapped event"));
-       gtk_clist_set_column_widget (GTK_CLIST (clist_set), 3, label_action);
-       
        toolbar = gtk_toolbar_new (GTK_ORIENTATION_VERTICAL, GTK_TOOLBAR_BOTH);
        gtk_box_pack_start (GTK_BOX (hbox_bottom), toolbar, FALSE, FALSE, 0);
        gtk_container_set_border_width (GTK_CONTAINER (toolbar), 5);
@@ -807,13 +810,11 @@ static void prefs_toolbar_create(void)
                                               _("Down"), NULL,
                                               icon_wid, NULL, NULL);
 
-       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);  
+       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_signal_connect(GTK_OBJECT(ok_btn), "clicked",
                           GTK_SIGNAL_FUNC(prefs_toolbar_ok),