Minor GUI fixes: adding horizontal scrollbars to Hoa's matcher dialogs, and fixing...
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 26 May 2001 19:04:41 +0000 (19:04 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 26 May 2001 19:04:41 +0000 (19:04 +0000)
ChangeLog.claws
src/mainwindow.c
src/prefs_filtering.c
src/prefs_matcher.c

index dcf586c..d57905f 100644 (file)
@@ -1,3 +1,28 @@
+2001-05-26 [alfons]
+
+       Minor GUI fixes adding horizontal scrollbars to Hoa's matcher dialogs,
+       and fixing the persistence troubles when using separate windows.
+
+       * src/mainwindow.c:
+       
+           Added #define SEPARATE_ACTION used in the gtk item factory for 
+           the SEPARATE_FOLDER and SEPARATE_MESSAGE items, so we can
+               use gtk_item_factory_get_widget_by_action() to get the items.
+               
+           Removed separate_widget_cb from the gtk item factory data   
+         
+           (mainwindow_create): connect separate_widget_cb() to check
+           menu item "toggled" signal. also passing a MainWindow pointer
+               as object data for both check menu items.
+               
+           (separate_widget_cb): definition of separate_widget_cb() to match
+           GtkCheckMenuItem's "toggled" signal. Now get the pointer to the main 
+               window using gtk_object_get_data(). The type of window separation 
+               (SEPARATE_MESSAGE or SEPARATE_FOLDER) is passed as the signal's data
+       
+       * src/prefs_filtering.c,
+         src/prefs_matcher.c: added horizontal scrollbars
+
 2001-05-25 [darko]
 
        * src/headerview.c
index 27b03ba..c727506 100644 (file)
@@ -191,9 +191,8 @@ static void toggle_toolbar_cb        (MainWindow    *mainwin,
 static void toggle_statusbar_cb         (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
-static void separate_widget_cb  (MainWindow    *mainwin,
-                                 guint          action,
-                                 GtkWidget     *widget);
+                                 
+static void separate_widget_cb(GtkCheckMenuItem *checkitem, guint action);                                
 
 static void addressbook_open_cb        (MainWindow     *mainwin,
                                 guint           action,
@@ -346,6 +345,8 @@ static void scan_tree_func   (Folder        *folder,
                                  FolderItem    *item,
                                  gpointer       data);
 
+#define  SEPARATE_ACTION  667
+
 static GtkItemFactoryEntry mainwin_entries[] =
 {
        {N_("/_File"),                          NULL, NULL, 0, "<Branch>"},
@@ -382,8 +383,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/_Toolbar/_Non-display"),    NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Toolbar/Icon and text"},
        {N_("/_View/_Status bar"),              NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/Separate f_older tree"),    NULL, separate_widget_cb, SEPARATE_FOLDER, "<ToggleItem>"},
-       {N_("/_View/Separate m_essage view"),   NULL, separate_widget_cb, SEPARATE_MESSAGE, "<ToggleItem>"},
+       {N_("/_View/Separate f_older tree"),    NULL, NULL, SEPARATE_ACTION + SEPARATE_FOLDER, "<ToggleItem>"},
+       {N_("/_View/Separate m_essage view"),   NULL, NULL, SEPARATE_ACTION + SEPARATE_MESSAGE, "<ToggleItem>"},
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Code set"),                NULL, NULL, 0, "<Branch>"},
        {N_("/_View/_Code set/_Auto detect"),
@@ -599,6 +600,7 @@ MainWindow *main_window_create(SeparateType type)
        n_menu_entries = sizeof(mainwin_entries) / sizeof(mainwin_entries[0]);
        menubar = menubar_create(window, mainwin_entries, 
                                 n_menu_entries, "<Main>", mainwin);
+
        gtk_widget_show(menubar);
        gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
 
@@ -732,6 +734,22 @@ MainWindow *main_window_create(SeparateType type)
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
                                       prefs_common.show_statusbar);
 
+       /* set the check of the SEPARATE_xxx menu items. we also need the main window
+        * as a property and pass the action type to the callback */
+       menuitem = gtk_item_factory_get_widget_by_action(ifactory, SEPARATE_ACTION + SEPARATE_FOLDER);
+       g_assert(menuitem);
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), type & SEPARATE_FOLDER);
+       gtk_object_set_data(GTK_OBJECT(menuitem), "mainwindow", mainwin);
+       gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(separate_widget_cb), 
+                                          GUINT_TO_POINTER(SEPARATE_FOLDER));
+
+       menuitem = gtk_item_factory_get_widget_by_action(ifactory, SEPARATE_ACTION + SEPARATE_MESSAGE);
+       g_assert(menuitem);
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), type & SEPARATE_MESSAGE);
+       gtk_object_set_data(GTK_OBJECT(menuitem), "mainwindow", mainwin);
+       gtk_signal_connect(GTK_OBJECT(menuitem), "toggled", GTK_SIGNAL_FUNC(separate_widget_cb), 
+                                          GUINT_TO_POINTER(SEPARATE_MESSAGE));
+
        menu_set_sensitive(ifactory, "/Summary/Thread view",
                           prefs_common.enable_thread ? FALSE : TRUE);
        menu_set_sensitive(ifactory, "/Summary/Unthread view",
@@ -1802,11 +1820,14 @@ static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
        }
 }
 
-static void separate_widget_cb(MainWindow *mainwin, guint action,
-                              GtkWidget *widget)
+static void separate_widget_cb(GtkCheckMenuItem *checkitem, guint action)                                 
 {
+       MainWindow *mainwin;
        SeparateType type;
 
+       mainwin = (MainWindow *) gtk_object_get_data(GTK_OBJECT(checkitem), "mainwindow");
+       g_return_if_fail(mainwin != NULL);
+
        type = mainwin->type ^ action;
        main_window_separation_change(mainwin, type);
 
index 5a12297..fa2921c 100644 (file)
@@ -506,11 +506,17 @@ static void prefs_filtering_create(void)
        filtering.cond_clist   = cond_clist;
 }
 
+static void prefs_filtering_update_hscrollbar(void)
+{
+       gint optwidth = gtk_clist_optimal_column_width(GTK_CLIST(filtering.cond_clist), 0);
+       gtk_clist_set_column_width(GTK_CLIST(filtering.cond_clist), 0, optwidth);
+}
+
 static void prefs_filtering_set_dialog(void)
 {
        GtkCList *clist = GTK_CLIST(filtering.cond_clist);
        GSList *cur;
-
+       
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
 
@@ -521,6 +527,7 @@ static void prefs_filtering_set_dialog(void)
                prefs_filtering_clist_set_row(-1, prop);
        }
 
+       prefs_filtering_update_hscrollbar();
        gtk_clist_thaw(clist);
 
        prefs_filtering_reset_dialog();
@@ -693,6 +700,8 @@ static void prefs_filtering_register_cb(void)
        prefs_filtering_clist_set_row(-1, prop);
 
        filteringprop_free(prop);
+       
+       prefs_filtering_update_hscrollbar();
 }
 
 static void prefs_filtering_substitute_cb(void)
@@ -712,6 +721,8 @@ static void prefs_filtering_substitute_cb(void)
        prefs_filtering_clist_set_row(row, prop);
 
        filteringprop_free(prop);
+       
+       prefs_filtering_update_hscrollbar();
 }
 
 static void prefs_filtering_delete_cb(void)
@@ -729,6 +740,8 @@ static void prefs_filtering_delete_cb(void)
                return;
 
        gtk_clist_remove(clist, row);
+
+       prefs_filtering_update_hscrollbar();
 }
 
 static void prefs_filtering_up(void)
index 1f35d0f..b0efe4f 100644 (file)
@@ -614,6 +614,12 @@ static void prefs_matcher_reset_condition(void)
        gtk_entry_set_text(GTK_ENTRY(matcher.value_entry), "");
 }
 
+static void prefs_matcher_update_hscrollbar(void)
+{
+       gint optwidth = gtk_clist_optimal_column_width(GTK_CLIST(matcher.cond_clist), 0);
+       gtk_clist_set_column_width(GTK_CLIST(matcher.cond_clist), 0, optwidth);
+}
+
 static void prefs_matcher_set_dialog(MatcherList * matchers)
 {
        GtkCList *clist = GTK_CLIST(matcher.cond_clist);
@@ -634,6 +640,8 @@ static void prefs_matcher_set_dialog(MatcherList * matchers)
 
                bool_op = matchers->bool_and;
        }
+       
+       prefs_matcher_update_hscrollbar();
 
        gtk_clist_thaw(clist);
 
@@ -1002,6 +1010,7 @@ static void prefs_matcher_register_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_substitute_cb(void)
@@ -1023,6 +1032,8 @@ static void prefs_matcher_substitute_cb(void)
        matcherprop_free(matcherprop);
 
        prefs_matcher_reset_condition();
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_delete_cb(void)
@@ -1036,6 +1047,8 @@ static void prefs_matcher_delete_cb(void)
                return;
 
        gtk_clist_remove(clist, row);
+       
+       prefs_matcher_update_hscrollbar();
 }
 
 static void prefs_matcher_up(void)