diff options
author | Owen Taylor <otaylor@src.gnome.org> | 2003-03-26 17:09:26 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-03-26 17:09:26 +0000 |
commit | 79491c1d25c1a417d2588319e706ebf35a8d1779 (patch) | |
tree | 7dfec9d1741d6afc465777c0b75427cc031c92fb /gtk/gtkfilechooserdialog.c | |
parent | 5ef90224aaa8a2054247e8031fcd93c52014f438 (diff) | |
download | gdk-pixbuf-79491c1d25c1a417d2588319e706ebf35a8d1779.tar.gz |
Add a construct-only 'file_system' property, split test case into testfilechooser, testfilechooser-vfs
Diffstat (limited to 'gtk/gtkfilechooserdialog.c')
-rw-r--r-- | gtk/gtkfilechooserdialog.c | 77 |
1 files changed, 64 insertions, 13 deletions
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index c540bb6d0..b6ab558f2 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -22,12 +22,15 @@ #include "gtkfilechooserwidget.h" #include "gtkfilechooserenums.h" #include "gtkfilechooserutils.h" +#include "gtkfilesystem.h" #include <stdarg.h> struct _GtkFileChooserDialogPrivate { GtkWidget *widget; + + GtkFileSystem *file_system; }; #define GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE(o) (GTK_FILE_CHOOSER_DIALOG (o)->priv) @@ -35,14 +38,19 @@ struct _GtkFileChooserDialogPrivate static void gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class); static void gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog); -static void gtk_file_chooser_dialog_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gtk_file_chooser_dialog_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); +static GObject* gtk_file_chooser_dialog_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params); +static void gtk_file_chooser_dialog_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_file_chooser_dialog_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +GObjectClass *parent_class; GType gtk_file_chooser_dialog_get_type (void) @@ -86,6 +94,9 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); + parent_class = g_type_class_peek_parent (class); + + gobject_class->constructor = gtk_file_chooser_dialog_constructor; gobject_class->set_property = gtk_file_chooser_dialog_set_property; gobject_class->get_property = gtk_file_chooser_dialog_get_property; @@ -101,17 +112,39 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog) GTK_TYPE_FILE_CHOOSER_DIALOG, GtkFileChooserDialogPrivate); dialog->priv = priv; +} + +static GObject* +gtk_file_chooser_dialog_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_params) +{ + GtkFileChooserDialogPrivate *priv; + GObject *object; + object = parent_class->constructor (type, + n_construct_properties, + construct_params); + priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (object); + gtk_widget_push_composite_child (); - priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), priv->widget, TRUE, TRUE, 0); + if (priv->file_system) + priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, + "file_system", priv->file_system, + NULL); + else + priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL); + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0); gtk_widget_show (priv->widget); - _gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (dialog), + _gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object), GTK_FILE_CHOOSER (priv->widget)); gtk_widget_pop_composite_child (); + + return object; } static void @@ -122,8 +155,26 @@ gtk_file_chooser_dialog_set_property (GObject *object, { GtkFileChooserDialogPrivate *priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (object); - - g_object_set_property (G_OBJECT (priv->widget), pspec->name, value); + + switch (prop_id) + { + case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM: + { + GtkFileSystem *file_system = g_value_get_object (value); + if (priv->file_system != file_system) + { + if (priv->file_system) + g_object_unref (priv->file_system); + priv->file_system = file_system; + if (priv->file_system) + g_object_ref (priv->file_system); + } + } + break; + default: + g_object_set_property (G_OBJECT (priv->widget), pspec->name, value); + break; + } } static void |