2005-10-17 [wwp] 1.9.15cvs67
authorTristan Chabredier <wwp@claws-mail.org>
Mon, 17 Oct 2005 15:00:48 +0000 (15:00 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Mon, 17 Oct 2005 15:00:48 +0000 (15:00 +0000)
* src/account.c
* src/prefs_account.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_folder_item.c
* src/prefs_gtk.c
* src/gtk/logwindow.c
* src/gtk/pluginwindow.c
* src/gtk/prefswindow.c
* src/gtk/prefswindow.h
Remember yet more window sizes (log, prefs, folder prefs, accounts)

13 files changed:
ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/account.c
src/gtk/logwindow.c
src/gtk/pluginwindow.c
src/gtk/prefswindow.c
src/gtk/prefswindow.h
src/prefs_account.c
src/prefs_common.c
src/prefs_common.h
src/prefs_folder_item.c
src/prefs_gtk.c

index 4b725b7ae1413e58c34a5bca752e41c04a16b24d..1f2a95894e9fe21e63709412eb8fce55e86ad7b1 100644 (file)
@@ -1,3 +1,17 @@
+2005-10-17 [wwp]       1.9.15cvs67
+
+       * src/account.c
+       * src/prefs_account.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/prefs_folder_item.c
+       * src/prefs_gtk.c
+       * src/gtk/logwindow.c
+       * src/gtk/pluginwindow.c
+       * src/gtk/prefswindow.c
+       * src/gtk/prefswindow.h
+               Remember yet more window sizes (log, prefs, folder prefs, accounts)
+
 2005-10-17 [paul]      1.9.15cvs66
 
        * configure.ac
index 7166a80591e648cac0e361c3bb07f5e3245deeda..246872f7914105c3fde7f0fe370631977d08d227 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.26 -r 1.1.2.27 commitHelper;  cvs diff -u -r 1.60.2.16 -r 1.60.2.17 po/es.po;  ) > 1.9.15cvs64.patchset
 ( cvs diff -u -r 1.395.2.139 -r 1.395.2.140 src/summaryview.c;  ) > 1.9.15cvs65.patchset
 ( cvs diff -u -r 1.654.2.945 -r 1.654.2.946 configure.ac;  cvs diff -u -r 1.12.2.5 -r 1.12.2.6 po/en_GB.po;  cvs diff -u -r 1.23.2.14 -r 1.23.2.15 src/crash.c;  cvs diff -u -r 1.11.2.1 -r 1.11.2.2 src/manual.c;  cvs diff -u -r 1.3.2.30 -r 1.3.2.31 src/prefs_themes.c;  cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/wizard.c;  cvs diff -u -r 1.9.2.17 -r 1.9.2.18 src/common/defs.h;  cvs diff -u -r 1.5.2.17 -r 1.5.2.18 src/gtk/menu.c;  ) > 1.9.15cvs66.patchset
+( cvs diff -u -r 1.61.2.38 -r 1.61.2.39 src/account.c;  cvs diff -u -r 1.105.2.39 -r 1.105.2.40 src/prefs_account.c;  cvs diff -u -r 1.204.2.65 -r 1.204.2.66 src/prefs_common.c;  cvs diff -u -r 1.103.2.33 -r 1.103.2.34 src/prefs_common.h;  cvs diff -u -r 1.52.2.14 -r 1.52.2.15 src/prefs_folder_item.c;  cvs diff -u -r 1.10.2.14 -r 1.10.2.15 src/prefs_gtk.c;  cvs diff -u -r 1.1.4.12 -r 1.1.4.13 src/gtk/logwindow.c;  cvs diff -u -r 1.5.2.19 -r 1.5.2.20 src/gtk/pluginwindow.c;  cvs diff -u -r 1.12.2.22 -r 1.12.2.23 src/gtk/prefswindow.c;  cvs diff -u -r 1.7.2.4 -r 1.7.2.5 src/gtk/prefswindow.h;  ) > 1.9.15cvs67.patchset
index 6eced9901feca84b6476a785e98fa30faf72ea24..fdbba6aec84391da7217c9ac9ad97458f2848a8a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=15
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=66
+EXTRA_VERSION=67
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 9dcc370acc345a61930c86f83917ea08668ee81f..68336d454bfe5eb44b550e5c961a671879db340f 100644 (file)
@@ -102,6 +102,8 @@ static void account_edit_close              (GtkWidget *widget, gpointer data);
 static gint account_delete_event       (GtkWidget      *widget,
                                         GdkEventAny    *event,
                                         gpointer        data);
+static void account_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation);
 static gboolean account_key_pressed    (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
@@ -598,6 +600,17 @@ void account_destroy(PrefsAccount *ac_prefs)
        }
 }
 
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void account_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.accountswin_width = allocation->width;
+       prefs_common.accountswin_height = allocation->height;
+}
 
 static void account_edit_create(void)
 {
@@ -621,10 +634,11 @@ static void account_edit_create(void)
        GtkWidget *hbbox;
        GtkWidget *close_btn;
 
+       static GdkGeometry geometry;
+
        debug_print("Creating account edit window...\n");
 
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-       gtk_widget_set_size_request (window, 500, 350);
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
        gtk_window_set_title (GTK_WINDOW (window), _("Edit accounts"));
        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
@@ -742,6 +756,19 @@ static void account_edit_create(void)
 
        account_create_list_view_images(list_view);
 
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(account_size_allocate_cb), NULL);
+
+       if (!geometry.min_height) {
+               geometry.min_width = 500;
+               geometry.min_height = 350;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, prefs_common.accountswin_width,
+                                   prefs_common.accountswin_height);
+
        edit_account.window    = window;
        edit_account.list_view = list_view;
        edit_account.close_btn = close_btn;
index 51d98d3be8892ac45eaf3531586672275ba56f90..dae335141b218ef91de9f789283aebd615bce7d7 100644 (file)
 #include "gtkutils.h"
 #include "log.h"
 #include "hooks.h"
+#include "prefs_common.h"
 
 static void hide_cb                            (GtkWidget      *widget,
                                                 LogWindow      *logwin);
 static gboolean key_pressed                    (GtkWidget      *widget,
                                                 GdkEventKey    *event,
                                                 LogWindow      *logwin);
+static void size_allocate_cb   (GtkWidget *widget,
+                                        GtkAllocation *allocation);
 static gboolean log_window_append              (gpointer        source,
                                                 gpointer        data);
 static void log_window_clip                    (GtkWidget      *text,
@@ -54,6 +57,18 @@ static void log_window_popup_menu_extend     (GtkTextView    *textview,
                                                 GtkMenu        *menu,
                                                 LogWindow      *logwin);
                                         
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.logwin_width = allocation->width;
+       prefs_common.logwin_height = allocation->height;
+}
+
 LogWindow *log_window_create(void)
 {
        LogWindow *logwin;
@@ -62,14 +77,15 @@ LogWindow *log_window_create(void)
        GtkWidget *text;
        GtkTextBuffer *buffer;
        GtkTextIter iter;
+       static GdkGeometry geometry;
 
        debug_print("Creating log window...\n");
+
        logwin = g_new0(LogWindow, 1);
 
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(window), _("Protocol log"));
        gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
-       gtk_widget_set_size_request(window, 520, 400);
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(gtk_widget_hide_on_delete), NULL);
        g_signal_connect(G_OBJECT(window), "key_press_event",
@@ -97,6 +113,19 @@ LogWindow *log_window_create(void)
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
        gtk_widget_show(text);
 
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(size_allocate_cb), NULL);
+
+       if (!geometry.min_height) {
+               geometry.min_width = 520;
+               geometry.min_height = 400;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, prefs_common.logwin_width,
+                                   prefs_common.logwin_height);
+
        logwin->window = window;
        logwin->scrolledwin = scrolledwin;
        logwin->text = text;
index 411526d9fb1d014cf6723ebf24674bb41ab4a577..f72b7b27da4e290c1cd682b5c1e06c43bb2032cf 100644 (file)
@@ -198,6 +198,19 @@ static gboolean pluginwindow_key_pressed(GtkWidget *widget, GdkEventKey *event,
        return FALSE;
 }
 
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void pluginwindow_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.pluginswin_width = allocation->width;
+       prefs_common.pluginswin_height = allocation->height;
+}
+
+
 void pluginwindow_create()
 {
        PluginWindow *pluginwindow;
@@ -216,12 +229,14 @@ void pluginwindow_create()
        GtkWidget *load_btn;
        GtkWidget *unload_btn;
        GtkWidget *close_btn;
+       static GdkGeometry geometry;
        
+       debug_print("Creating plugins window...\n");
+
        pluginwindow = g_new0(PluginWindow, 1);
 
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
-       gtk_window_set_default_size(GTK_WINDOW(window), 480, 300);
        gtk_window_set_title(GTK_WINDOW(window), _("Plugins"));
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
 
@@ -303,6 +318,8 @@ void pluginwindow_create()
                         G_CALLBACK(unload_cb), pluginwindow);
        g_signal_connect(G_OBJECT(close_btn), "released",
                         G_CALLBACK(close_cb), pluginwindow);
+       g_signal_connect(G_OBJECT(window), "size_allocate",
+                        G_CALLBACK(pluginwindow_size_allocate_cb), NULL);
        g_signal_connect(G_OBJECT(window), "key_press_event",
                           G_CALLBACK(pluginwindow_key_pressed), pluginwindow);
 
@@ -315,6 +332,17 @@ void pluginwindow_create()
        set_plugin_list(pluginwindow);
 
        inc_lock();
+
+       if (!geometry.min_height) {
+               geometry.min_width = 480;
+               geometry.min_height = 300;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, prefs_common.pluginswin_width,
+                                   prefs_common.pluginswin_height);
+
        gtk_widget_show(window);
 }
 
index dc9a5521c1b0f21371eaf4944dd41a07913571ae..2c827c8e984c77e0ba3ce607b08527156d11940b 100644 (file)
@@ -61,6 +61,8 @@ struct _PrefsWindow
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
        GtkWidget *apply_btn;
+       gint *save_width;
+       gint *save_height;
 
        GtkWidget *empty_page;
 
@@ -75,6 +77,8 @@ struct _PrefsTreeNode
        gfloat     treeweight; /* GTK2: not used */
 };
 
+static void prefs_size_allocate_cb(GtkWidget *widget,
+                                                        GtkAllocation *allocation, gpointer *user_data);
 static GtkTreeStore *prefswindow_create_data_store     (void);
 static GtkWidget *prefswindow_tree_view_create         (PrefsWindow* prefswindow);
 static void prefs_filtering_create_tree_view_columns   (GtkWidget *tree_view);
@@ -332,26 +336,25 @@ static void prefswindow_build_tree(GtkWidget *tree_view, GSList *prefs_pages)
                gtk_tree_selection_select_iter(selection, &iter);
 }
 
-void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer data, GtkDestroyNotify func)
+void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer data, GtkDestroyNotify func,
+                                                        gint *save_width, gint *save_height)
 {
        PrefsWindow *prefswindow;
        gint x = gdk_screen_width();
        gint y = gdk_screen_height();
+       static GdkGeometry geometry;
 
        prefswindow = g_new0(PrefsWindow, 1);
 
        prefswindow->data = data;
        prefswindow->func = func;
        prefswindow->prefs_pages = g_slist_copy(prefs_pages);
+       prefswindow->save_width = save_width;
+       prefswindow->save_height = save_height;
 
        prefswindow->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(prefswindow->window), title);
 
-       if (x < 800 && y < 600)
-               gtk_window_set_default_size(GTK_WINDOW(prefswindow->window), 600, 440);
-       else
-               gtk_window_set_default_size(GTK_WINDOW(prefswindow->window), 700, 550);
-
        gtk_window_set_position (GTK_WINDOW(prefswindow->window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal (GTK_WINDOW (prefswindow->window), TRUE);
        gtk_window_set_resizable (GTK_WINDOW(prefswindow->window), TRUE);
@@ -431,13 +434,54 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer dat
                         G_CALLBACK(window_closed), prefswindow);
        g_signal_connect(G_OBJECT(prefswindow->window), "key_press_event",
                           G_CALLBACK(prefswindow_key_pressed), &(prefswindow->window));
+       /* connect to callback only if we hhave non-NULL pointers to store size to */
+       if (prefswindow->save_width && prefswindow->save_height) {
+               g_signal_connect(G_OBJECT(prefswindow->window), "size_allocate",
+                                G_CALLBACK(prefs_size_allocate_cb), prefswindow);
+       }
+
+       if (!geometry.min_height) {
+               
+               if (x < 800 && y < 600) {
+                       geometry.min_width = 600;
+                       geometry.min_height = 440;
+               } else {
+                       geometry.min_width = 700;
+                       geometry.min_height = 550;
+               }
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(prefswindow->window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       if (prefswindow->save_width && prefswindow->save_height) {
+               gtk_widget_set_size_request(prefswindow->window, *(prefswindow->save_width),
+                                           *(prefswindow->save_height));
+       }
 
        gtk_widget_show(prefswindow->window);
 }
 
-void prefswindow_open(const gchar *title, GSList *prefs_pages, gpointer data)
+void prefswindow_open(const gchar *title, GSList *prefs_pages, gpointer data,
+                                        gint *save_width, gint *save_height)
 {
-       prefswindow_open_full(title, prefs_pages, data, NULL);
+       prefswindow_open_full(title, prefs_pages, data, NULL, save_width, save_height);
+}
+
+/*!
+ *\brief       Save Gtk object size to prefs dataset
+ */
+static void prefs_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation, gpointer *user_data)
+{
+       PrefsWindow *prefswindow = (PrefsWindow *) user_data;
+
+       g_return_if_fail(allocation != NULL);
+
+       /* don't try to save size to NULL pointers */
+       if (prefswindow && prefswindow->save_width && prefswindow->save_height) {
+               *(prefswindow->save_width) = allocation->width;
+               *(prefswindow->save_height) = allocation->height;
+       }
 }
 
 static GtkTreeStore *prefswindow_create_data_store(void)
index a85a91c762e7bfca2fdcfab831df645489cd142b..5dafb2d536e45b060d2dc0437ef74151d26af8c7 100644 (file)
@@ -47,10 +47,12 @@ struct _PrefsPage
 void prefswindow_open_full             (const gchar *title, 
                                         GSList *prefs_pages,
                                         gpointer data,
-                                        GtkDestroyNotify func);
+                                        GtkDestroyNotify func,
+                                        gint *save_width, gint *save_height);
 
 void prefswindow_open                  (const gchar *title, 
                                         GSList *prefs_pages,
-                                        gpointer data);
+                                        gpointer data,
+                                        gint *save_width, gint *save_height);
 
 #endif
index 105a8ac0ab860848aeb88a51df1f6a14775f41cf..5a4ac6f5596776d8679f490ee2944cc3f220c207 100644 (file)
@@ -38,6 +38,7 @@
 #include "main.h"
 #include "prefs_gtk.h"
 #include "prefs_account.h"
+#include "prefs_common.h"
 #include "prefs_customheader.h"
 #include "account.h"
 #include "mainwindow.h"
@@ -963,7 +964,8 @@ PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs)
                title = g_strdup_printf (_("%s - Account preferences"),
                                ac_prefs->account_name);
 
-       prefswindow_open_full(title, prefs_pages, ac_prefs, destroy_dialog);
+       prefswindow_open_full(title, prefs_pages, ac_prefs, destroy_dialog,
+                       &prefs_common.editaccountwin_width, &prefs_common.editaccountwin_height);
        g_free(title);
        gtk_main();
 
index f268959ef29ba49597dbe9d4a7d81498fe40767b..9625d26b77258563e5c0be41eea4766d7ce023c9 100644 (file)
@@ -579,6 +579,36 @@ static PrefParam param[] = {
        {"addressbookeditpersonwin_height", "-1", &prefs_common.addressbookeditpersonwin_height, P_INT,
         NULL, NULL, NULL},
 
+       {"pluginswin_width", "480", &prefs_common.pluginswin_width, P_INT,
+        NULL, NULL, NULL},
+       {"pluginswin_height", "-1", &prefs_common.pluginswin_height, P_INT,
+        NULL, NULL, NULL},
+
+       {"prefswin_width", "600", &prefs_common.prefswin_width, P_INT,
+        NULL, NULL, NULL},
+       {"prefswin_height", "-1", &prefs_common.prefswin_height, P_INT,
+        NULL, NULL, NULL},
+
+       {"folderitemwin_width", "500", &prefs_common.folderitemwin_width, P_INT,
+        NULL, NULL, NULL},
+       {"folderitemwin_height", "-1", &prefs_common.folderitemwin_height, P_INT,
+        NULL, NULL, NULL},
+
+       {"editaccountwin_width", "500", &prefs_common.editaccountwin_width, P_INT,
+        NULL, NULL, NULL},
+       {"editaccountwin_height", "-1", &prefs_common.editaccountwin_height, P_INT,
+        NULL, NULL, NULL},
+
+       {"accountswin_width", "500", &prefs_common.accountswin_width, P_INT,
+        NULL, NULL, NULL},
+       {"accountswin_height", "-1", &prefs_common.accountswin_height, P_INT,
+        NULL, NULL, NULL},
+
+       {"logwin_width", "520", &prefs_common.logwin_width, P_INT,
+        NULL, NULL, NULL},
+       {"logwin_height", "-1", &prefs_common.logwin_height, P_INT,
+        NULL, NULL, NULL},
+
        /* Hidden */
        {"warn_dnd", "1", &prefs_common.warn_dnd, P_INT,
         NULL, NULL, NULL},
index 4d03f502e29eea5b829735487ece90d1637dde06..17505adee32a087a0405a1cfb7a1c3260383ea9b 100644 (file)
@@ -321,7 +321,7 @@ struct _PrefsCommon
        gulong color_new;
        
        GList *summary_quicksearch_history;
-       
+
        gint filteringwin_width;
        gint filteringwin_height;
        gint filteringactionwin_width;
@@ -336,6 +336,19 @@ struct _PrefsCommon
        gint addressbookwin_height;
        gint addressbookeditpersonwin_width;
        gint addressbookeditpersonwin_height;
+       gint pluginswin_width;
+       gint pluginswin_height;
+       gint prefswin_width;
+       gint prefswin_height;
+       gint folderitemwin_width;
+       gint folderitemwin_height;
+       gint editaccountwin_width;
+       gint editaccountwin_height;
+       gint accountswin_width;
+       gint accountswin_height;
+       gint logwin_width;
+       gint logwin_height;
+
        gint warn_dnd;
        gint broken_are_utf8;
 };
index 56e8950c8ffcf322a5c22c915a109de1ab3a65ba..1e298b4f85bc1f1424dbe7e232420cb79d2d0c12 100644 (file)
@@ -845,7 +845,8 @@ void prefs_folder_item_open(FolderItem *item)
        id = folder_item_get_identifier (item);
        title = g_strdup_printf (_("Properties for folder %s"), id);
        g_free (id);
-       prefswindow_open(title, prefs_pages, item);
+       prefswindow_open(title, prefs_pages, item,
+                       &prefs_common.folderitemwin_width, &prefs_common.folderitemwin_height);
        g_free (title);
 }
 
index f2b443a1d592c1aefc61ce9abfbc0ba09ee7bdeb..b89540dcae57876ce3037bf33f26e6033152f0f0 100644 (file)
@@ -33,6 +33,7 @@
 #include "main.h"
 #include "prefs.h"
 #include "prefs_gtk.h"
+#include "prefs_common.h"
 #include "utils.h"
 #include "gtkutils.h"
 #include "passcrypt.h"
@@ -845,7 +846,8 @@ static GSList *prefs_pages = NULL;
 
 void prefs_gtk_open(void)
 {
-       prefswindow_open(_("Preferences"), prefs_pages, NULL);
+       prefswindow_open(_("Preferences"), prefs_pages, NULL,
+                       &prefs_common.prefswin_width, &prefs_common.prefswin_height);
 }
 
 void prefs_gtk_register_page(PrefsPage *page)