gtk+ r22119 - in trunk: . gtk
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22119 - in trunk: . gtk
- Date: Wed, 14 Jan 2009 20:19:11 +0000 (UTC)
Author: federico
Date: Wed Jan 14 20:19:10 2009
New Revision: 22119
URL: http://svn.gnome.org/viewvc/gtk+?rev=22119&view=rev
Log:
Load/save the file chooser's size
* gtk/gtkfilechooserdefault.c (save_dialog_geometry): New function.
(settings_save): Save the dialog's geometry.
(gtk_file_chooser_default_get_default_size): Load the geometry
from the settings. If it was already saved, return that instead
of computing an ad-hoc size.
Signed-off-by: Federico Mena Quintero <federico novell com>
Modified:
trunk/ChangeLog
trunk/gtk/gtkfilechooserdefault.c
Modified: trunk/gtk/gtkfilechooserdefault.c
==============================================================================
--- trunk/gtk/gtkfilechooserdefault.c (original)
+++ trunk/gtk/gtkfilechooserdefault.c Wed Jan 14 20:19:10 2009
@@ -34,6 +34,7 @@
#include "gtkexpander.h"
#include "gtkfilechooserprivate.h"
#include "gtkfilechooserdefault.h"
+#include "gtkfilechooserdialog.h"
#include "gtkfilechooserembed.h"
#include "gtkfilechooserentry.h"
#include "gtkfilechoosersettings.h"
@@ -6025,6 +6026,31 @@
}
static void
+save_dialog_geometry (GtkFileChooserDefault *impl, GtkFileChooserSettings *settings)
+{
+ GtkWindow *toplevel;
+ int x, y, width, height;
+
+ /* We don't save the geometry in non-expanded "save" mode, so that the "little
+ * dialog" won't make future Open dialogs too small.
+ */
+ if (!(impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+ || impl->expand_folders))
+ return;
+
+ toplevel = get_toplevel (GTK_WIDGET (impl));
+
+ if (!(toplevel && GTK_IS_FILE_CHOOSER_DIALOG (toplevel)))
+ return;
+
+ gtk_window_get_position (toplevel, &x, &y);
+ gtk_window_get_size (toplevel, &width, &height);
+
+ _gtk_file_chooser_settings_set_geometry (settings, x, y, width, height);
+}
+
+static void
settings_save (GtkFileChooserDefault *impl)
{
GtkFileChooserSettings *settings;
@@ -6036,6 +6062,8 @@
_gtk_file_chooser_settings_set_expand_folders (settings, impl->expand_folders);
_gtk_file_chooser_settings_set_show_size_column (settings, impl->show_size_column);
+ save_dialog_geometry (impl, settings);
+
/* NULL GError */
_gtk_file_chooser_settings_save (settings, NULL);
@@ -7938,6 +7966,20 @@
|| impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
|| impl->expand_folders)
{
+ GtkFileChooserSettings *settings;
+ int x, y, width, height;
+
+ settings = _gtk_file_chooser_settings_new ();
+ _gtk_file_chooser_settings_get_geometry (settings, &x, &y, &width, &height);
+ g_object_unref (settings);
+
+ if (x >= 0 && y >= 0 && width > 0 && height > 0)
+ {
+ *default_width = width;
+ *default_height = height;
+ return;
+ }
+
find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height);
if (impl->preview_widget_active &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]