diff options
author | Federico Mena Quintero <federico@ximian.com> | 2004-02-29 06:35:15 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2004-02-29 06:35:15 +0000 |
commit | 17e840f79ccc50f6479d6f1f2275cc600a070ffb (patch) | |
tree | f635d34f28bbb364a1acb1b58424c5ab8e65ec17 /gtk/gtkfilechooser.c | |
parent | 393d0f92384003d2a477cceffbcf5d80c050f127 (diff) | |
download | gdk-pixbuf-17e840f79ccc50f6479d6f1f2275cc600a070ffb.tar.gz |
Handle GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
2004-02-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_set_property): Handle
GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
(gtk_file_chooser_default_get_property): Likewise.
(struct _GtkFileChooserDefault): Added fields for preview_label,
use_preview_label, preview_display_name, preview_box. Removed
preview_frame.
(set_preview_widget): Reorder the widget in relation to the label.
(update_preview_widget_visibility): Create or destroy the preview
label.
(check_preview_change): Update impl->preview_display_name and the
label.
(find_good_size_from_style): Use the preview_box.
(gtk_file_chooser_default_finalize): Free
impl->preview_display_name.
(gtk_file_chooser_default_init): Initialize
impl->use_preview_label.
* gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Add a
"use-preview-label" property.
(gtk_file_chooser_set_use_preview_label): New function. This sets
whether one wants the file chooser to display a stock label with
the previewed filename. Apps that do really fancy previews can
turn this off and draw the name themselves.
(gtk_file_chooser_get_use_preview_label): New function.
(gtk_file_chooser_get_preview_widget_active): Documentation fix.
* gtk/gtkfilechooserutils.h (GtkFileChooserProp): Add a
GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL value.
* gtk/gtkfilechooserutils.c
(_gtk_file_chooser_install_properties): Override the
"use-preview-label" property.
Diffstat (limited to 'gtk/gtkfilechooser.c')
-rw-r--r-- | gtk/gtkfilechooser.c | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index 88b670951..f1bc3a999 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -125,6 +125,12 @@ gtk_file_chooser_class_init (gpointer g_iface) TRUE, G_PARAM_READWRITE)); g_object_interface_install_property (g_iface, + g_param_spec_boolean ("use-preview-label", + P_("Use Preview Label"), + P_("Whether to display a stock label with the name of the previewed file."), + TRUE, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, g_param_spec_object ("extra-widget", P_("Extra widget"), P_("Application supplied widget for extra options."), @@ -1047,12 +1053,11 @@ gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser, * gtk_file_chooser_get_preview_widget_active: * @chooser: a #GtkFileChooser * - * Gets whether the preview widget set by - * gtk_file_chooser_set_preview_widget_active() should be shown for the - * current filename. See gtk_file_chooser_set_preview_widget_active(). + * Gets whether the preview widget set by gtk_file_chooser_set_preview_widget() + * should be shown for the current filename. See + * gtk_file_chooser_set_preview_widget_active(). * - * Return value: %TRUE if the preview widget is active for the - * current filename. + * Return value: %TRUE if the preview widget is active for the current filename. * * Since: 2.4 **/ @@ -1069,6 +1074,51 @@ gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser) } /** + * gtk_file_chooser_set_use_preview_label: + * @chooser: a #GtkFileChooser + * @use_label: whether to display a stock label with the name of the previewed file + * + * Sets whether the file chooser should display a stock label with the name of + * the file that is being previewed; the default is %TRUE. Applications that + * want to draw the whole preview area themselves should set this to %FALSE and + * display the name themselves in their preview widget. + * + * See also: gtk_file_chooser_set_preview_widget() + * + * Since: 2.4 + **/ +void +gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser, + gboolean use_label) +{ + g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser)); + + g_object_set (chooser, "use-preview-label", use_label, NULL); +} + +/** + * gtk_file_chooser_get_use_preview_label: + * @chooser: a #GtkFileChooser + * + * Gets whether a stock label should be drawn with the name of the previewed + * file. See gtk_file_chooser_set_use_preview_label(). + * + * Return value: %TRUE if the file chooser is set to display a label with the + * name of the previewed file, %FALSE otherwise. + **/ +gboolean +gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser) +{ + gboolean use_label; + + g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE); + + g_object_get (chooser, "use-preview-label", &use_label, NULL); + + return use_label; +} + +/** * gtk_file_chooser_get_preview_filename: * @chooser: a #GtkFileChooser * |