mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
filechooser: Add a readonly :filters property
This makes the filters list accessible in the the inspector.
This commit is contained in:
parent
76290e8ddb
commit
ea07a92366
@ -168,6 +168,22 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkFileChooser:filters:
|
||||
*
|
||||
* A #GListModel containing the filters that have been
|
||||
* added with gtk_file_chooser_add_filter().
|
||||
*
|
||||
* The returned object should not be modified. It may
|
||||
* or may not be updated for later changes.
|
||||
*/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_object ("filters",
|
||||
P_("Filters"),
|
||||
P_("List model of filters"),
|
||||
G_TYPE_LIST_MODEL,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkFileChooser:create-folders:
|
||||
*
|
||||
|
@ -1035,6 +1035,7 @@ gtk_file_chooser_button_get_property (GObject *object,
|
||||
case GTK_FILE_CHOOSER_PROP_FILTER:
|
||||
case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
|
||||
case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
|
||||
case GTK_FILE_CHOOSER_PROP_FILTERS:
|
||||
g_object_get_property (G_OBJECT (button->chooser), pspec->name, value);
|
||||
break;
|
||||
|
||||
|
@ -92,17 +92,20 @@ void
|
||||
_gtk_file_chooser_install_properties (GObjectClass *klass)
|
||||
{
|
||||
g_object_class_override_property (klass,
|
||||
GTK_FILE_CHOOSER_PROP_ACTION,
|
||||
"action");
|
||||
GTK_FILE_CHOOSER_PROP_ACTION,
|
||||
"action");
|
||||
g_object_class_override_property (klass,
|
||||
GTK_FILE_CHOOSER_PROP_FILTER,
|
||||
"filter");
|
||||
GTK_FILE_CHOOSER_PROP_FILTER,
|
||||
"filter");
|
||||
g_object_class_override_property (klass,
|
||||
GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
|
||||
"select-multiple");
|
||||
GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
|
||||
"select-multiple");
|
||||
g_object_class_override_property (klass,
|
||||
GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS,
|
||||
"create-folders");
|
||||
GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS,
|
||||
"create-folders");
|
||||
g_object_class_override_property (klass,
|
||||
GTK_FILE_CHOOSER_PROP_FILTERS,
|
||||
"filters");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,8 @@ typedef enum {
|
||||
GTK_FILE_CHOOSER_PROP_FILTER,
|
||||
GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
|
||||
GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS,
|
||||
GTK_FILE_CHOOSER_PROP_LAST = GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS
|
||||
GTK_FILE_CHOOSER_PROP_FILTERS,
|
||||
GTK_FILE_CHOOSER_PROP_LAST = GTK_FILE_CHOOSER_PROP_FILTERS
|
||||
} GtkFileChooserProp;
|
||||
|
||||
void _gtk_file_chooser_install_properties (GObjectClass *klass);
|
||||
|
@ -3072,6 +3072,10 @@ gtk_file_chooser_widget_get_property (GObject *object,
|
||||
g_value_set_boolean (value, impl->create_folders);
|
||||
break;
|
||||
|
||||
case GTK_FILE_CHOOSER_PROP_FILTERS:
|
||||
g_value_set_object (value, impl->filters);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -5564,6 +5568,8 @@ gtk_file_chooser_widget_add_filter (GtkFileChooser *chooser,
|
||||
set_current_filter (impl, filter);
|
||||
|
||||
show_filters (impl, TRUE);
|
||||
|
||||
g_object_notify (G_OBJECT (chooser), "filters");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5597,6 +5603,8 @@ gtk_file_chooser_widget_remove_filter (GtkFileChooser *chooser,
|
||||
|
||||
if (!impl->filters)
|
||||
show_filters (impl, FALSE);
|
||||
|
||||
g_object_notify (G_OBJECT (chooser), "filters");
|
||||
}
|
||||
|
||||
static GListModel *
|
||||
|
Loading…
Reference in New Issue
Block a user