[gtk+] file chooser: Add a search-mode property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] file chooser: Add a search-mode property
- Date: Wed, 28 Jan 2015 21:32:20 +0000 (UTC)
commit de4427304c680c4d111ba92477a30f70befa2d06
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 28 15:00:08 2015 -0500
file chooser: Add a search-mode property
This will be used to control search from the dialog.
gtk/gtkfilechooserwidget.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index e6d6475..799492c 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -163,6 +163,9 @@ _gtk_file_chooser_profile_log (const char *func, int indent, const char *msg1, c
#define profile_msg(x, y)
#endif
+enum {
+ PROP_SEARCH_MODE = 1
+};
typedef enum {
LOAD_EMPTY, /* There is no model */
@@ -2523,9 +2526,11 @@ static void
operation_mode_set (GtkFileChooserWidget *impl, OperationMode mode)
{
GtkFileChooserWidgetPrivate *priv = impl->priv;
+ OperationMode old_mode;
operation_mode_stop (impl, priv->operation_mode);
+ old_mode = priv->operation_mode;
priv->operation_mode = mode;
switch (priv->operation_mode)
@@ -2550,6 +2555,9 @@ operation_mode_set (GtkFileChooserWidget *impl, OperationMode mode)
g_assert_not_reached ();
return;
}
+
+ if ((old_mode == OPERATION_MODE_SEARCH) != (mode == OPERATION_MODE_SEARCH))
+ g_object_notify (G_OBJECT (impl), "search-mode");
}
/* This function is basically a do_all function.
@@ -2608,6 +2616,13 @@ gtk_file_chooser_widget_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_SEARCH_MODE:
+ if (g_value_get_boolean (value))
+ operation_mode_set (impl, OPERATION_MODE_SEARCH);
+ else
+ operation_mode_set (impl, OPERATION_MODE_BROWSE);
+ break;
+
case GTK_FILE_CHOOSER_PROP_ACTION:
{
GtkFileChooserAction action = g_value_get_enum (value);
@@ -2721,6 +2736,10 @@ gtk_file_chooser_widget_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_SEARCH_MODE:
+ g_value_set_boolean (value, priv->operation_mode == OPERATION_MODE_SEARCH);
+ break;
+
case GTK_FILE_CHOOSER_PROP_ACTION:
g_value_set_enum (value, priv->action);
break;
@@ -7362,6 +7381,13 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
"quick-bookmark",
1, G_TYPE_INT, i);
+ g_object_class_install_property (gobject_class, PROP_SEARCH_MODE,
+ g_param_spec_boolean ("search-mode",
+ P_("Search mode"),
+ P_("Search mode"),
+ FALSE,
+ G_PARAM_READWRITE));
+
_gtk_file_chooser_install_properties (gobject_class);
/* Bind class to template */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]