gtk2/gtk/gtkfilechooserembed.h
Carlos Garnacho 7bb7cfb293 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
2007-05-18 10:38:42 +00:00

74 lines
2.9 KiB
C

/* GTK - The GIMP Toolkit
* gtkfilechooserembed.h: Abstract sizing interface for file selector implementations
* Copyright (C) 2004, Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_FILE_CHOOSER_EMBED_H__
#define __GTK_FILE_CHOOSER_EMBED_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_FILE_CHOOSER_EMBED (_gtk_file_chooser_embed_get_type ())
#define GTK_FILE_CHOOSER_EMBED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER_EMBED, GtkFileChooserEmbed))
#define GTK_IS_FILE_CHOOSER_EMBED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_CHOOSER_EMBED))
#define GTK_FILE_CHOOSER_EMBED_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_FILE_CHOOSER_EMBED, GtkFileChooserEmbedIface))
typedef struct _GtkFileChooserEmbed GtkFileChooserEmbed;
typedef struct _GtkFileChooserEmbedIface GtkFileChooserEmbedIface;
struct _GtkFileChooserEmbedIface
{
GTypeInterface base_iface;
/* Methods
*/
void (*get_default_size) (GtkFileChooserEmbed *chooser_embed,
gint *default_width,
gint *default_height);
gboolean (*get_resizable) (GtkFileChooserEmbed *chooser_embed);
gboolean (*should_respond) (GtkFileChooserEmbed *chooser_embed);
void (*initial_focus) (GtkFileChooserEmbed *chooser_embed);
/* Signals
*/
void (*default_size_changed) (GtkFileChooserEmbed *chooser_embed);
void (*response_requested) (GtkFileChooserEmbed *chooser_embed);
};
GType _gtk_file_chooser_embed_get_type (void) G_GNUC_CONST;
void _gtk_file_chooser_embed_get_default_size (GtkFileChooserEmbed *chooser_embed,
gint *default_width,
gint *default_height);
gboolean _gtk_file_chooser_embed_get_resizable (GtkFileChooserEmbed *chooser_embed);
gboolean _gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed);
void _gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed);
void _gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface);
void _gtk_file_chooser_embed_set_delegate (GtkFileChooserEmbed *receiver,
GtkFileChooserEmbed *delegate);
G_END_DECLS
#endif /* __GTK_FILE_CHOOSER_EMBED_H__ */