diff options
author | Federico Mena Quintero <federico@ximian.com> | 2003-09-03 05:52:35 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2003-09-03 05:52:35 +0000 |
commit | 36dfea8ece7cae37ff6b7a17e3370fed2e92c834 (patch) | |
tree | 72ff8526d4216558d6d6ed096332ed55f410a15a /gtk/gtkfilechooser.c | |
parent | fafe735f130700fbb0184d5a9523a51160b2c94d (diff) | |
download | gdk-pixbuf-36dfea8ece7cae37ff6b7a17e3370fed2e92c834.tar.gz |
Removed the "extra widget" bit, implemented with the following:
2003-09-03 Federico Mena Quintero <federico@ximian.com>
* TODO: Removed the "extra widget" bit, implemented with the
following:
* gtkfilechooser.h: Added gtk_file_chooser_{set,get}_extra_widget().
* gtkfilechooser.c (gtk_file_chooser_base_init): Install an
"extra-widget" interface property.
(gtk_file_chooser_set_extra_widget): Implemented.
(gtk_file_chooser_get_extra_widget): Implemented.
* gtkfilechooserutils.h (GtkFileChooserProp): Added
GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET.
* gtkfilechooserutils.c (_gtk_file_chooser_install_properties):
Added the "extra-widget" property.
* gtkfilechooserimpldefault.c (struct _GtkFileChooserImplDefault):
Added an extra_widget field.
(gtk_file_chooser_impl_default_set_property): Handle the
"extra-widget" property.
(gtk_file_chooser_impl_default_get_property): Likewise.
(set_preview_widget): Fix the call gtk_container_remove(). Also,
we don't need to ref/sink/unref the preview widget, as that gets
already done by container_add/remove.
(set_extra_widget): New utility function.
* testfilechooser.c (main): Add an extra widget.
Diffstat (limited to 'gtk/gtkfilechooser.c')
-rw-r--r-- | gtk/gtkfilechooser.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index c04ea5aef..eb2338cac 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -128,6 +128,12 @@ gtk_file_chooser_base_init (gpointer g_iface) TRUE, G_PARAM_READWRITE)); g_object_interface_install_property (g_iface, + g_param_spec_object ("extra-widget", + _("Extra widget"), + _("Application supplied widget for extra options."), + GTK_TYPE_WIDGET, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, g_param_spec_boolean ("select-multiple", _("Select Multiple"), _("Whether to allow multiple files to be selected"), @@ -1079,6 +1085,50 @@ gtk_file_chooser_get_preview_uri (GtkFileChooser *chooser) } /** + * gtk_file_chooser_set_extra_widget: + * @chooser: a #GtkFileChooser + * @extra_widget: widget for extra options + * + * Sets an application-supplied widget to provide extra options to the user. + **/ +void +gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser, + GtkWidget *extra_widget) +{ + g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser)); + + g_object_set (chooser, "extra-widget", extra_widget, NULL); +} + +/** + * gtk_file_chooser_get_extra_widget: + * @chooser: a #GtkFileChooser + * + * Gets the current preview widget; see + * gtk_file_chooser_set_extra_widget(). + * + * Return value: the current extra widget, or %NULL + **/ +GtkWidget * +gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser) +{ + GtkWidget *extra_widget; + + g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL); + + g_object_get (chooser, "extra-widget", &extra_widget, NULL); + + /* Horrid hack; g_object_get() refs returned objects but + * that contradicts the memory management conventions + * for accessors. + */ + if (extra_widget) + g_object_unref (extra_widget); + + return extra_widget; +} + +/** * gtk_file_chooser_add_filter: * @chooser: a #GtkFileChooser * @filter: a #GtkFileFilter |