sync with 0.9.4cvs7
authorPaul Mangan <paul@claws-mail.org>
Thu, 21 Aug 2003 08:45:43 +0000 (08:45 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 21 Aug 2003 08:45:43 +0000 (08:45 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/folderview.c
src/mainwindow.c
src/prefs_common.c
src/prefs_common.h
src/summaryview.c

index e288a91..0183455 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-08-20
+
+       * src/mainwindow.c: always reflect window size changes.
+       * src/folderview.c: folderview_init()
+         src/summaryview.c: summary_init(): realize the widget before
+         creating pixmaps.
+       * src/prefs_common.[ch]: remember the folder and mesage view's
+         visibility.
+
 2003-08-07
 
        * src/mainwindow.c
index ceb0560..12a76db 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-21 [paul]      0.9.4claws32
+
+       * sync with 0.9.4cvs7
+               see ChangeLog 2003-08-20
+
 2003-08-19 [paul]      0.9.4claws31
 
        * src/common/defs.h
index 8afedfb..7e0a3eb 100644 (file)
@@ -1,3 +1,12 @@
+2003-08-20
+
+       * src/mainwindow.c: ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ÎÊѹ¹¤ò¾ï¤ËÈ¿±Ç¡£
+       * src/folderview.c: folderview_init()
+         src/summaryview.c: summary_init(): pixmap ¤òºîÀ®¤¹¤ëÁ°¤Ë¥¦¥£¥¸¥§¥Ã¥È
+         ¤ò realize ¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/prefs_common.[ch]: ¥Õ¥©¥ë¥À¤È¥á¥Ã¥»¡¼¥¸¥Ó¥å¡¼¤Î²Ä»ë¾õÂÖ¤ò
+         µ­²±¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
 2003-08-07
 
        * src/mainwindow.c
index a09f944..675c946 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=31
+EXTRA_VERSION=32
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 9626d85..2bb1c38 100644 (file)
@@ -540,7 +540,8 @@ void folderview_init(FolderView *folderview)
        GtkWidget *label_unread;
        GtkWidget *hbox_new;
        GtkWidget *hbox_unread;
-
+       
+       gtk_widget_realize(ctree);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE, &inboxxpm, &inboxxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_CLOSE_HRM, &inboxhrmxpm, &inboxhrmxpmmask);
        stock_pixmap_gdk(ctree, STOCK_PIXMAP_INBOX_OPEN, &inboxopenxpm, &inboxopenxpmmask);
index c94161a..5c55a3e 100644 (file)
@@ -113,19 +113,25 @@ static void ac_label_button_pressed               (GtkWidget      *widget,
 static void ac_menu_popup_closed               (GtkMenuShell   *menu_shell,
                                                 gpointer        data);
 
-static gint main_window_close_cb       (GtkWidget      *widget,
-                                        GdkEventAny    *event,
-                                        gpointer        data);
-static gint folder_window_close_cb     (GtkWidget      *widget,
-                                        GdkEventAny    *event,
-                                        gpointer        data);
-static gint message_window_close_cb    (GtkWidget      *widget,
-                                        GdkEventAny    *event,
-                                        gpointer        data);
-
-static void main_window_size_allocate_cb(GtkWidget     *widget,
-                                        GtkAllocation  *allocation,
-                                        gpointer        data);
+static gint main_window_close_cb               (GtkWidget      *widget,
+                                                GdkEventAny    *event,
+                                                gpointer        data);
+static gint folder_window_close_cb             (GtkWidget      *widget,
+                                                GdkEventAny    *event,
+                                                gpointer        data);
+static gint message_window_close_cb            (GtkWidget      *widget,
+                                                GdkEventAny    *event,
+                                                gpointer        data);
+
+static void main_window_size_allocate_cb       (GtkWidget      *widget,
+                                                GtkAllocation  *allocation,
+                                                gpointer        data);
+static void folder_window_size_allocate_cb     (GtkWidget      *widget,
+                                                GtkAllocation  *allocation,
+                                                gpointer        data);
+static void message_window_size_allocate_cb    (GtkWidget      *widget,
+                                                GtkAllocation  *allocation,
+                                                gpointer        data);
 
 static void new_folder_cb       (MainWindow    *mainwin,
                                  guint          action,
@@ -927,7 +933,7 @@ MainWindow *main_window_create(SeparateType type)
 
        debug_print("done.\n");
 
-       messageview->visible = TRUE;
+       messageview->visible = prefs_common.msgview_visible;
 
        main_window_set_widgets(mainwin, type);
 
@@ -1328,6 +1334,8 @@ void main_window_toggle_message_view(MainWindow *mainwin)
 
        main_window_set_menu_sensitive(mainwin);
 
+       prefs_common.msgview_visible = mainwin->messageview->visible;
+
        gtk_widget_grab_focus(summaryview->ctree);
 }
 
@@ -1337,27 +1345,45 @@ void main_window_get_size(MainWindow *mainwin)
 
        allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
 
-       prefs_common.summaryview_width = allocation->width;
+       if (allocation->width > 1 && allocation->height > 1) {
+               prefs_common.summaryview_width = allocation->width;
 
-       if ((mainwin->type == SEPARATE_NONE ||
-            mainwin->type == SEPARATE_FOLDER) &&
-           messageview_is_visible(mainwin->messageview))
-               prefs_common.summaryview_height = allocation->height;
+               if ((mainwin->type == SEPARATE_NONE ||
+                    mainwin->type == SEPARATE_FOLDER) &&
+                   messageview_is_visible(mainwin->messageview))
+                       prefs_common.summaryview_height = allocation->height;
 
-       prefs_common.mainview_width = allocation->width;
+               prefs_common.mainview_width = allocation->width;
+       }
 
        allocation = &mainwin->window->allocation;
-       prefs_common.mainview_height = allocation->height;
-       prefs_common.mainwin_width   = allocation->width;
-       prefs_common.mainwin_height  = allocation->height;
+       if (allocation->width > 1 && allocation->height > 1) {
+               prefs_common.mainview_height = allocation->height;
+               prefs_common.mainwin_width   = allocation->width;
+               prefs_common.mainwin_height  = allocation->height;
+       }
 
        allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
-       prefs_common.folderview_width  = allocation->width;
-       prefs_common.folderview_height = allocation->height;
+       if (allocation->width > 1 && allocation->height > 1) {
+               prefs_common.folderview_width  = allocation->width;
+               prefs_common.folderview_height = allocation->height;
+       }
 
        allocation = &(GTK_WIDGET_PTR(mainwin->messageview)->allocation);
-       prefs_common.msgview_width = allocation->width;
-       prefs_common.msgview_height = allocation->height;
+       if (allocation->width > 1 && allocation->height > 1) {
+               prefs_common.msgview_width = allocation->width;
+               prefs_common.msgview_height = allocation->height;
+       }
+
+       debug_print("summaryview size: %d x %d\n",
+                   prefs_common.summaryview_width,
+                   prefs_common.summaryview_height);
+       debug_print("folderview size: %d x %d\n",
+                   prefs_common.folderview_width,
+                   prefs_common.folderview_height);
+       debug_print("messageview size: %d x %d\n",
+                   prefs_common.msgview_width,
+                   prefs_common.msgview_height);
 }
 
 void main_window_get_position(MainWindow *mainwin)
@@ -1372,19 +1398,21 @@ void main_window_get_position(MainWindow *mainwin)
        prefs_common.mainwin_x = x;
        prefs_common.mainwin_y = y;
 
-       debug_print("window position: x = %d, y = %d\n", x, y);
+       debug_print("main window position: %d, %d\n", x, y);
 
        window = main_window_get_folder_window(mainwin);
        if (window) {
                gtkut_widget_get_uposition(window, &x, &y);
                prefs_common.folderwin_x = x;
                prefs_common.folderwin_y = y;
+               debug_print("folder window position: %d, %d\n", x, y);
        }
        window = main_window_get_message_window(mainwin);
        if (window) {
                gtkut_widget_get_uposition(window, &x, &y);
                prefs_common.main_msgwin_x = x;
                prefs_common.main_msgwin_y = y;
+               debug_print("message window position: %d, %d\n", x, y);
        }
 }
 
@@ -1796,7 +1824,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
        GtkWidget *menuitem;
        GtkItemFactory *msgview_ifactory;
 
-       debug_print("Setting widgets...");
+       debug_print("Setting widgets... ");
 
        /* create separated window(s) if needed */
        if (type & SEPARATE_FOLDER) {
@@ -1814,6 +1842,11 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                gtk_signal_connect(GTK_OBJECT(folderwin), "delete_event",
                                   GTK_SIGNAL_FUNC(folder_window_close_cb),
                                   mainwin);
+               gtk_container_add(GTK_CONTAINER(folderwin),
+                                 GTK_WIDGET_PTR(mainwin->folderview));
+               gtk_widget_realize(folderwin);
+               if (prefs_common.folderview_visible)
+                       gtk_widget_show(folderwin);
        }
        if (type & SEPARATE_MESSAGE) {
                messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -1830,6 +1863,11 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
                                   GTK_SIGNAL_FUNC(message_window_close_cb),
                                   mainwin);
+               gtk_container_add(GTK_CONTAINER(messagewin),
+                                 GTK_WIDGET_PTR(mainwin->messageview));
+               gtk_widget_realize(messagewin);
+               if (messageview_is_visible(mainwin->messageview))
+                       gtk_widget_show(messagewin);
        }
 
        gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->folderview),
@@ -1845,10 +1883,11 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
        switch (type) {
        case SEPARATE_NONE:
                hpaned = gtk_hpaned_new();
-               gtk_widget_show(hpaned);
                gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
                gtk_paned_add1(GTK_PANED(hpaned),
                               GTK_WIDGET_PTR(mainwin->folderview));
+               gtk_widget_show(hpaned);
+               gtk_widget_queue_resize(hpaned);
 
                vpaned = gtk_vpaned_new();
                if (messageview_is_visible(mainwin->messageview)) {
@@ -1863,6 +1902,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                gtk_paned_add2(GTK_PANED(vpaned),
                               GTK_WIDGET_PTR(mainwin->messageview));
                gtk_widget_show(vpaned);
+               gtk_widget_queue_resize(vpaned);
 
                mainwin->win.sep_none.hpaned = hpaned;
                mainwin->win.sep_none.vpaned = vpaned;
@@ -1887,15 +1927,11 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                gtk_paned_add2(GTK_PANED(vpaned),
                               GTK_WIDGET_PTR(mainwin->messageview));
                gtk_widget_show(vpaned);
-
-               gtk_container_add(GTK_CONTAINER(folderwin),
-                                 GTK_WIDGET_PTR(mainwin->folderview));
+               gtk_widget_queue_resize(vpaned);
 
                mainwin->win.sep_folder.folderwin = folderwin;
                mainwin->win.sep_folder.vpaned    = vpaned;
 
-               gtk_widget_show_all(folderwin);
-               
                /* remove headerview if not in prefs */
                headerview_set_visibility(mainwin->messageview->headerview,
                                          prefs_common.display_header_pane);
@@ -1904,13 +1940,12 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
        case SEPARATE_MESSAGE:
                hpaned = gtk_hpaned_new();
                gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
-
                gtk_paned_add1(GTK_PANED(hpaned),
                               GTK_WIDGET_PTR(mainwin->folderview));
                gtk_paned_add2(GTK_PANED(hpaned),
                               GTK_WIDGET_PTR(mainwin->summaryview));
                gtk_widget_show(hpaned);
-
+               gtk_widget_queue_resize(hpaned);
                messageview_add_toolbar(mainwin->messageview, messagewin);
                msgview_ifactory = gtk_item_factory_from_widget(mainwin->messageview->menubar);
                menu_set_sensitive(msgview_ifactory, "/File/Close", FALSE);
@@ -1918,22 +1953,15 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                mainwin->win.sep_message.messagewin = messagewin;
                mainwin->win.sep_message.hpaned     = hpaned;
 
-               gtk_widget_show(messagewin);
                break;
        case SEPARATE_BOTH:
                gtk_box_pack_start(GTK_BOX(vbox_body),
                                   GTK_WIDGET_PTR(mainwin->summaryview),
                                   TRUE, TRUE, 0);
-               gtk_container_add(GTK_CONTAINER(folderwin),
-                                 GTK_WIDGET_PTR(mainwin->folderview));
-               gtk_container_add(GTK_CONTAINER(messagewin),
-                                 GTK_WIDGET_PTR(mainwin->messageview));
 
                mainwin->win.sep_both.folderwin = folderwin;
                mainwin->win.sep_both.messagewin = messagewin;
 
-               gtk_widget_show(folderwin);
-               gtk_widget_show(messagewin);
                break;
        }
 
@@ -1942,6 +1970,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                                 prefs_common.mainwin_y);
 
        gtk_widget_queue_resize(vbox_body);
+       gtk_widget_queue_resize(mainwin->vbox);
        gtk_widget_queue_resize(mainwin->window);
        /* CLAWS: previous "gtk_widget_show_all" makes noticeview
         * and mimeview icon list/ctree lose track of their visibility states */
@@ -1958,15 +1987,19 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
        
        mainwin->type = type;
 
-       mainwin->messageview->visible = TRUE;
 
        /* toggle menu state */
        menuitem = gtk_item_factory_get_item
                (ifactory, "/View/Show or hide/Folder tree");
-       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
+                                      (type & SEPARATE_FOLDER) == 0 ? TRUE :
+                                      prefs_common.folderview_visible);
+       gtk_widget_set_sensitive(menuitem, ((type & SEPARATE_FOLDER) != 0));
        menuitem = gtk_item_factory_get_item
                (ifactory, "/View/Show or hide/Message view");
-       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
+                                      (type & SEPARATE_MESSAGE) == 0 ? TRUE :
+                                      prefs_common.msgview_visible);
 
        menuitem = gtk_item_factory_get_item
                (ifactory, "/View/Separate folder tree");
@@ -1977,6 +2010,19 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
                                       ((type & SEPARATE_MESSAGE) != 0));
 
+       if (folderwin) {
+               gtk_signal_connect
+                       (GTK_OBJECT(folderwin), "size_allocate",
+                        GTK_SIGNAL_FUNC(folder_window_size_allocate_cb),
+                        mainwin);
+       }
+       if (messagewin) {
+               gtk_signal_connect
+                       (GTK_OBJECT(messagewin), "size_allocate",
+                        GTK_SIGNAL_FUNC(message_window_size_allocate_cb),
+                        mainwin);
+       }
+
        debug_print("done.\n");
 }
 
@@ -2092,6 +2138,24 @@ static void main_window_size_allocate_cb(GtkWidget *widget,
        main_window_get_size(mainwin);
 }
 
+static void folder_window_size_allocate_cb(GtkWidget *widget,
+                                          GtkAllocation *allocation,
+                                          gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       main_window_get_size(mainwin);
+}
+
+static void message_window_size_allocate_cb(GtkWidget *widget,
+                                           GtkAllocation *allocation,
+                                           gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)data;
+
+       main_window_get_size(mainwin);
+}
+
 static void add_mailbox_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
@@ -2208,6 +2272,8 @@ static void toggle_folder_cb(MainWindow *mainwin, guint action,
                        gtk_widget_hide(mainwin->win.sep_both.folderwin);
                break;
        }
+
+       prefs_common.folderview_visible = active;
 }
 
 static void toggle_message_cb(MainWindow *mainwin, guint action,
index 94ab0e6..610af63 100644 (file)
@@ -583,6 +583,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"folderview_height", "600", &prefs_common.folderview_height, P_INT,
         NULL, NULL, NULL},
+       {"folderview_visible", "TRUE", &prefs_common.folderview_visible, P_BOOL,
+        NULL, NULL, NULL},
 
        {"folder_col_folder", "150", &prefs_common.folder_col_folder, P_INT,
         NULL, NULL, NULL},
@@ -606,6 +608,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"messageview_height", "540", &prefs_common.msgview_height, P_INT,
         NULL, NULL, NULL},
+       {"messageview_visible", "TRUE", &prefs_common.msgview_visible, P_BOOL,
+        NULL, NULL, NULL},
 
        {"mainview_x", "64", &prefs_common.mainview_x, P_INT,
         NULL, NULL, NULL},
index 24756c1..df54f7c 100644 (file)
@@ -167,11 +167,12 @@ struct _PrefsCommon
        gint summary_col_pos[N_SUMMARY_COLS];
        gint summary_col_size[N_SUMMARY_COLS];
 
-       /* Widget size */
+       /* Widget visibility, position and size */
        gint folderwin_x;
        gint folderwin_y;
        gint folderview_width;
        gint folderview_height;
+       gboolean folderview_visible;
 
        gint folder_col_folder;
        gint folder_col_new;
@@ -185,6 +186,7 @@ struct _PrefsCommon
        gint main_msgwin_y;
        gint msgview_width;
        gint msgview_height;
+       gboolean msgview_visible;
 
        gint mainview_x;
        gint mainview_y;
index 0d4633d..e2df546 100644 (file)
@@ -725,6 +725,7 @@ void summary_init(SummaryView *summaryview)
        GtkStyle *style;
        GtkWidget *pixmap;
 
+       gtk_widget_realize(summaryview->ctree);
        stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_MARK,
                         &markxpm, &markxpmmask);
        stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_DELETED,