position doesn't quite work yet, but we'll leave it in as a
reference.
+ * 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.
+
2009-01-13 Matthias Clasen <mclasen@redhat.com>
Bug 450716 – New API to change global IM
#include "gtkexpander.h"
#include "gtkfilechooserprivate.h"
#include "gtkfilechooserdefault.h"
+#include "gtkfilechooserdialog.h"
#include "gtkfilechooserembed.h"
#include "gtkfilechooserentry.h"
#include "gtkfilechoosersettings.h"
gtk_tree_view_column_set_visible (impl->list_size_column, show_size_column);
}
+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)
{
_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);
|| 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 &&