diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-09-03 20:42:44 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-09-03 20:42:44 +0000 |
commit | 00893711236fa5b36453bc2f0e47406fcc2a73c7 (patch) | |
tree | 379c3122d590790a00633486b11e1ba6e30a44e6 /gtk/gtkfilechooser.c | |
parent | 1c9d02b48deeeab5f195748ed88f684244b02147 (diff) | |
download | gtk+-00893711236fa5b36453bc2f0e47406fcc2a73c7.tar.gz |
Remove excess check that was breaking with current GObject.
Wed Sep 3 16:38:59 2003 Owen Taylor <otaylor@redhat.com>
* glib-interface-propreties-0.5.patch: Remove excess
check that was breaking with current GObject.
* gtkfilechooser.c (gtk_file_chooser_class_init):
use the new ability to have a class_init function for
interfaces to avoid the ugly static gboolean initialized
hack.
Diffstat (limited to 'gtk/gtkfilechooser.c')
-rw-r--r-- | gtk/gtkfilechooser.c | 183 |
1 files changed, 89 insertions, 94 deletions
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index eb2338caca..f27fccfd30 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -25,7 +25,7 @@ #define _(str) (str) -static void gtk_file_chooser_base_init (gpointer g_iface); +static void gtk_file_chooser_class_init (gpointer g_iface); static GtkFilePath *gtk_file_chooser_get_path (GtkFileChooser *chooser); @@ -39,8 +39,9 @@ gtk_file_chooser_get_type (void) static const GTypeInfo file_chooser_info = { sizeof (GtkFileChooserIface), /* class_size */ - gtk_file_chooser_base_init, /* base_init */ + NULL, /* base_init */ NULL, /* base_finalize */ + (GClassInitFunc)gtk_file_chooser_class_init, /* class_init */ }; file_chooser_type = g_type_register_static (G_TYPE_INTERFACE, @@ -54,100 +55,94 @@ gtk_file_chooser_get_type (void) } static void -gtk_file_chooser_base_init (gpointer g_iface) +gtk_file_chooser_class_init (gpointer g_iface) { - static gboolean initialized = FALSE; + GType iface_type = G_TYPE_FROM_INTERFACE (g_iface); + + g_signal_new ("current-folder-changed", + iface_type, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkFileChooserIface, current_folder_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + g_signal_new ("selection-changed", + iface_type, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkFileChooserIface, selection_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + g_signal_new ("update-preview", + iface_type, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkFileChooserIface, update_preview), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); - if (!initialized) - { - GType iface_type = G_TYPE_FROM_INTERFACE (g_iface); - - g_signal_new ("current-folder-changed", - iface_type, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GtkFileChooserIface, current_folder_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - g_signal_new ("selection-changed", - iface_type, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GtkFileChooserIface, selection_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - g_signal_new ("update-preview", - iface_type, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GtkFileChooserIface, update_preview), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - g_object_interface_install_property (g_iface, - g_param_spec_enum ("action", - _("Action"), - _("The type of operation that the file selector is performing"), - GTK_TYPE_FILE_CHOOSER_ACTION, - GTK_FILE_CHOOSER_ACTION_OPEN, - G_PARAM_READWRITE)); - g_object_interface_install_property (g_iface, - g_param_spec_object ("file-system", - _("File System"), - _("File system object to use"), - GTK_TYPE_FILE_SYSTEM, - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - g_object_interface_install_property (g_iface, - g_param_spec_object ("filter", - _("Filter"), - _("The current filter for selecting which files are displayed"), - GTK_TYPE_FILE_FILTER, - G_PARAM_READWRITE)); - g_object_interface_install_property (g_iface, - g_param_spec_boolean ("folder-mode", - _("Folder Mode"), - _("Whether to select folders rather than files"), - FALSE, - G_PARAM_READWRITE)); - g_object_interface_install_property (g_iface, - g_param_spec_boolean ("local-only", - _("Local Only"), - _("Whether the selected file(s) should be limited to local file: URLs"), - TRUE, - G_PARAM_READWRITE)); - g_object_interface_install_property (g_iface, - g_param_spec_object ("preview-widget", - _("Preview widget"), - _("Application supplied widget for custom previews."), - GTK_TYPE_WIDGET, - G_PARAM_READWRITE)); - g_object_interface_install_property (g_iface, - g_param_spec_boolean ("preview-widget-active", - _("Preview Widget Active"), - _("Whether the application supplied widget for custom previews should be shown."), - 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"), - FALSE, - G_PARAM_READWRITE)); - - g_object_interface_install_property (g_iface, - g_param_spec_boolean ("show-hidden", - _("Show Hidden"), - _("Whether the hidden files and folders should be displayed"), - FALSE, - G_PARAM_READWRITE)); - initialized = TRUE; - } + g_object_interface_install_property (g_iface, + g_param_spec_enum ("action", + _("Action"), + _("The type of operation that the file selector is performing"), + GTK_TYPE_FILE_CHOOSER_ACTION, + GTK_FILE_CHOOSER_ACTION_OPEN, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, + g_param_spec_object ("file-system", + _("File System"), + _("File system object to use"), + GTK_TYPE_FILE_SYSTEM, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_interface_install_property (g_iface, + g_param_spec_object ("filter", + _("Filter"), + _("The current filter for selecting which files are displayed"), + GTK_TYPE_FILE_FILTER, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, + g_param_spec_boolean ("folder-mode", + _("Folder Mode"), + _("Whether to select folders rather than files"), + FALSE, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, + g_param_spec_boolean ("local-only", + _("Local Only"), + _("Whether the selected file(s) should be limited to local file: URLs"), + TRUE, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, + g_param_spec_object ("preview-widget", + _("Preview widget"), + _("Application supplied widget for custom previews."), + GTK_TYPE_WIDGET, + G_PARAM_READWRITE)); + g_object_interface_install_property (g_iface, + g_param_spec_boolean ("preview-widget-active", + _("Preview Widget Active"), + _("Whether the application supplied widget for custom previews should be shown."), + 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"), + FALSE, + G_PARAM_READWRITE)); + + g_object_interface_install_property (g_iface, + g_param_spec_boolean ("show-hidden", + _("Show Hidden"), + _("Whether the hidden files and folders should be displayed"), + FALSE, + G_PARAM_READWRITE)); } /** |