diff options
author | Pascal Terjan <pterjan@mandriva.com> | 2009-07-28 14:15:59 +0200 |
---|---|---|
committer | Pascal Terjan <pterjan@mandriva.com> | 2009-07-30 16:58:42 +0200 |
commit | a4514f993e3d9176fdd8ee62b0654cbefb463e6f (patch) | |
tree | f9e7f4c9c011bedfbc571955dec6559c520336dd /gtk/gtkfilechooser.c | |
parent | d75ccb5c0d4876c3c021668fdad02e68d0501f4d (diff) | |
download | gtk+-a4514f993e3d9176fdd8ee62b0654cbefb463e6f.tar.gz |
Allow disabling New Folder button in File Choser
Bug #570516. Add a new property "create-folders" meaning that the
"New Folder" button should be displayed in the modes where it used
to be.
Diffstat (limited to 'gtk/gtkfilechooser.c')
-rw-r--r-- | gtk/gtkfilechooser.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index f113bea1f0..c8078b12a5 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -269,6 +269,22 @@ gtk_file_chooser_class_init (gpointer g_iface) "if necessary."), FALSE, GTK_PARAM_READWRITE)); + + /** + * GtkFileChooser:create-folders: + * + * Whether a file chooser not in %GTK_FILE_CHOOSER_ACTION_OPEN mode + * will offer the user to create new folders. + * + * Since: 2.18 + */ + g_object_interface_install_property (g_iface, + g_param_spec_boolean ("create-folders", + P_("Allow folders creation"), + P_("Whether a file chooser not in open mode " + "will offer the user to create new folders."), + TRUE, + GTK_PARAM_READWRITE)); } /** @@ -424,6 +440,49 @@ gtk_file_chooser_get_select_multiple (GtkFileChooser *chooser) } /** + * gtk_file_chooser_set_create_folders: + * @chooser: a #GtkFileChooser + * @create_folders: %TRUE if the New Folder button should be displayed + * + * Sets whether file choser will offer to create new folders. + * This is only relevant if the action is not set to be + * GTK_FILE_CHOOSER_ACTION_OPEN. + * + * Since: 2.18 + **/ +void +gtk_file_chooser_set_create_folders (GtkFileChooser *chooser, + gboolean create_folders) +{ + g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser)); + + g_object_set (chooser, "create-folders", create_folders, NULL); +} + +/** + * gtk_file_chooser_get_create_folders: + * @chooser: a #GtkFileChooser + * + * Gets whether file choser will offer to create new folders. + * See gtk_file_chooser_set_create_folders(). + * + * Return value: %TRUE if the New Folder button should be displayed. + * + * Since: 2.18 + **/ +gboolean +gtk_file_chooser_get_create_folders (GtkFileChooser *chooser) +{ + gboolean create_folders; + + g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE); + + g_object_get (chooser, "create-folders", &create_folders, NULL); + + return create_folders; +} + +/** * gtk_file_chooser_get_filename: * @chooser: a #GtkFileChooser * |