diff options
author | Carlos Garnacho <carlos@imendio.com> | 2007-05-18 10:38:42 +0000 |
---|---|---|
committer | Carlos Garnacho <carlosg@src.gnome.org> | 2007-05-18 10:38:42 +0000 |
commit | 7bb7cfb29328264a5cb876aa5bdcc404946d6014 (patch) | |
tree | b5b3245c4c8a5b2493408070421bdf174735f174 /gtk/gtkfilechooserembed.c | |
parent | a1498f769747e0fad97803dfdb7329ae76697c49 (diff) | |
download | gtk+-7bb7cfb29328264a5cb876aa5bdcc404946d6014.tar.gz |
Refactor GtkFileChooserDialog sizing.
2007-05-18 Carlos Garnacho <carlos@imendio.com>
Refactor GtkFileChooserDialog sizing.
* gtkfilechooserembed.[ch] (delegate_get_resizable_hints)
(_gtk_file_chooser_embed_get_resizable_hints):
s/resizable_hints/resizable/, return just one boolean value to
determine whether the filechooser should be resizable or not.
* gtkfilechooserprivate.h (struct GtkFileChooserDialogPrivate): remove
variables related to the GtkFileChooserEmbed get_default_size() and
get_resizable() implementations.
(struct GtkFileChooserDefault): Move default size management here.
* gtkfilechooserdefault.c (gtk_file_chooser_default_size_allocate):
Added, store currently allocated size to calculate default size later.
(gtk_file_chooser_default_get_resizable_hints):
s/resizable_hints/resizable/.
(gtk_file_chooser_default_set_property): Reload settings if the file
chooser action changes, this way the save expander state will be known
before mapping the window, avoiding wrong window positioning and
flickering. (#424299, #424309)
(find_good_size_from_style): Only get size from style if it wasn't set
previously.
(gtk_file_chooser_default_get_default_size): return default size based
on stored default size and preview/extra widget sizes.
* gtkfilechooserdialog.c (file_chooser_widget_update_hints)
(file_chooser_widget_realized_size_changed)
(file_chooser_widget_unrealized_size_changed): simplified to
(file_chooser_widget_size_changed): set window size and resizability
based on the GtkFileChooserEmbed interface implementation. (Bug
#420285, Tomeu Vizoso)
(gtk_file_chooser_dialog_map): force a dialog size change, so it's
clamped for sure to the 75% of the screen size.
svn path=/trunk/; revision=17859
Diffstat (limited to 'gtk/gtkfilechooserembed.c')
-rw-r--r-- | gtk/gtkfilechooserembed.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/gtk/gtkfilechooserembed.c b/gtk/gtkfilechooserembed.c index a2eced08d5..5816dcaf36 100644 --- a/gtk/gtkfilechooserembed.c +++ b/gtk/gtkfilechooserembed.c @@ -28,9 +28,7 @@ static void gtk_file_chooser_embed_class_init (gpointer g_iface); static void delegate_get_default_size (GtkFileChooserEmbed *chooser_embed, gint *default_width, gint *default_height); -static void delegate_get_resizable_hints (GtkFileChooserEmbed *chooser_embed, - gboolean *resize_horizontally, - gboolean *resize_vertically); +static gboolean delegate_get_resizable (GtkFileChooserEmbed *chooser_embed); static gboolean delegate_should_respond (GtkFileChooserEmbed *chooser_embed); static void delegate_initial_focus (GtkFileChooserEmbed *chooser_embed); static void delegate_default_size_changed (GtkFileChooserEmbed *chooser_embed, @@ -57,7 +55,7 @@ void _gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface) { iface->get_default_size = delegate_get_default_size; - iface->get_resizable_hints = delegate_get_resizable_hints; + iface->get_resizable = delegate_get_resizable; iface->should_respond = delegate_should_respond; iface->initial_focus = delegate_initial_focus; } @@ -96,13 +94,11 @@ delegate_get_default_size (GtkFileChooserEmbed *chooser_embed, { _gtk_file_chooser_embed_get_default_size (get_delegate (chooser_embed), default_width, default_height); } - -static void -delegate_get_resizable_hints (GtkFileChooserEmbed *chooser_embed, - gboolean *resize_horizontally, - gboolean *resize_vertically) + +static gboolean +delegate_get_resizable (GtkFileChooserEmbed *chooser_embed) { - _gtk_file_chooser_embed_get_resizable_hints (get_delegate (chooser_embed), resize_horizontally, resize_vertically); + return _gtk_file_chooser_embed_get_resizable (get_delegate (chooser_embed)); } static gboolean @@ -208,14 +204,10 @@ _gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed) GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->initial_focus (chooser_embed); } -void -_gtk_file_chooser_embed_get_resizable_hints (GtkFileChooserEmbed *chooser_embed, - gboolean *resize_horizontally, - gboolean *resize_vertically) +gboolean +_gtk_file_chooser_embed_get_resizable (GtkFileChooserEmbed *chooser_embed) { - g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed)); - g_return_if_fail (resize_horizontally != NULL); - g_return_if_fail (resize_vertically != NULL); + g_return_val_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed), FALSE); - GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->get_resizable_hints (chooser_embed, resize_horizontally, resize_vertically); + return GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->get_resizable (chooser_embed); } |