auto-chango compose toolbar button depending on folder selection
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Fri, 5 Oct 2001 19:10:51 +0000 (19:10 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Fri, 5 Oct 2001 19:10:51 +0000 (19:10 +0000)
ChangeLog.claws
configure.in
src/folderview.c
src/mainwindow.c
src/mainwindow.h

index 34d68cf899e6402ac7dcd6bde4f796babf777a24..3034af3b478e75466a33a73bb0d969eb991f4655 100644 (file)
@@ -1,3 +1,10 @@
+2001-10-05 [alfons]    0.6.2claws20
+
+       * src/mainwindow.[ch], src/folderview.c
+               make composite tool button switch between "Compose News"
+               and "Compose Mail" depending on selected folder
+               (nifty idea by Kim Schulz <kim@schulz.dk>)
+
 2001-10-05 [paul]      0.6.2claws19
 
        * src/mainwindow.c, src/summaryview.c
index 71e1e682e251bc019806844981dd9e73dfd2aca6..9c7120119caab5f770dcdddbb74e6ad2c507a0ff 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws19
+EXTRA_VERSION=claws20
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index b9eefd32e7d9c2df93c0c542626372c110a64ab2..a54ef4de51e58125945c343f5d17de17fe0c1fb7 100644 (file)
@@ -493,7 +493,7 @@ void folderview_select(FolderView *folderview, FolderItem *item)
        GtkCTreeNode *old_selected = folderview->selected;
 
        if (!item) return;
-
+       
        node = gtk_ctree_find_by_row_data(ctree, NULL, item);
        if (node) folderview_select_node(folderview, node);
 
@@ -1388,6 +1388,14 @@ static void folderview_selected(GtkCTree *ctree, GtkCTreeNode *row,
 
        can_select = FALSE;
 
+       /* CLAWS: set compose button type: news folder items 
+        * always have a news folder as parent */
+       if (item->folder) 
+               main_window_toolbar_set_compose_button
+                       (folderview->mainwin,
+                        item->folder->type == F_NEWS ? 
+                        COMPOSEBUTTON_NEWS : COMPOSEBUTTON_MAIL);
+        
        if (item->path)
                debug_print(_("Folder %s is selected\n"), item->path);
 
index 9b1576ef47811e7d97536854756badcb0d612e94..efe554b2043578e570f59ad32e37b15287355496 100644 (file)
@@ -2777,7 +2777,9 @@ static void activate_compose_button (MainWindow *mainwin,
        if (style == TOOLBAR_NONE) 
                return;
 
-       if (style == TOOLBAR_BOTH) {    
+       if (style == TOOLBAR_BOTH) {
+               debug_print("preferring %s\n",
+                           type == COMPOSEBUTTON_NEWS ? "news" : "mail");
                gtk_widget_hide(mainwin->compose_mail_btn_plain);
                gtk_widget_hide(mainwin->compose_news_btn_plain);
                gtk_widget_hide(type == COMPOSEBUTTON_NEWS ? mainwin->compose_mail_btn 
@@ -2797,6 +2799,14 @@ static void activate_compose_button (MainWindow *mainwin,
        }
 }
 
+void main_window_toolbar_set_compose_button(MainWindow *mainwin, ComposeButtonType compose_btn_type)
+{
+       if (mainwin->compose_btn_type != compose_btn_type)
+               activate_compose_button(mainwin, 
+                                       prefs_common.toolbar_style,
+                                       compose_btn_type);
+}
+
 static void prefs_templates_open_cb(MainWindow *mainwin, guint action,
                                    GtkWidget *widget)
 {
index 8182b05c5e297e2ffd118a9b3fc91932e374e19f..addd4f05518d2e6b19f28011e491e7d7e9cf8142 100644 (file)
@@ -159,4 +159,8 @@ void main_window_set_menu_sensitive (MainWindow     *mainwin);
 
 void main_window_popup                 (MainWindow     *mainwin);
 
+void main_window_toolbar_set_compose_button    
+                                       (MainWindow *mainwin, 
+                                        ComposeButtonType compose_btn_type);
+
 #endif /* __MAINWINDOW_H__ */