[gtk/matthiasc/for-master: 4/6] searchbar: Add a key-capture-widget property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 4/6] searchbar: Add a key-capture-widget property
- Date: Sun, 12 Jul 2020 20:49:26 +0000 (UTC)
commit f32239df1f44ff73cfb81cec4bf631520677a65b
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jul 12 16:25:24 2020 -0400
searchbar: Add a key-capture-widget property
This is handy to set up this relationship in ui files,
and also makes it accessible in the inspector.
gtk/gtksearchbar.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/gtk/gtksearchbar.c b/gtk/gtksearchbar.c
index 5609f24088..c0624268c5 100644
--- a/gtk/gtksearchbar.c
+++ b/gtk/gtksearchbar.c
@@ -119,6 +119,7 @@ enum {
PROP_SEARCH_MODE_ENABLED,
PROP_SHOW_CLOSE_BUTTON,
PROP_CHILD,
+ PROP_KEY_CAPTURE_WIDGET,
LAST_PROPERTY
};
@@ -206,6 +207,9 @@ gtk_search_bar_set_property (GObject *object,
case PROP_CHILD:
gtk_search_bar_set_child (bar, g_value_get_object (value));
break;
+ case PROP_KEY_CAPTURE_WIDGET:
+ gtk_search_bar_set_key_capture_widget (bar, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -231,6 +235,9 @@ gtk_search_bar_get_property (GObject *object,
case PROP_CHILD:
g_value_set_object (value, gtk_search_bar_get_child (bar));
break;
+ case PROP_KEY_CAPTURE_WIDGET:
+ g_value_set_object (value, gtk_search_bar_get_key_capture_widget (bar));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -318,6 +325,13 @@ gtk_search_bar_class_init (GtkSearchBarClass *klass)
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
+ widget_props[PROP_KEY_CAPTURE_WIDGET]
+ = g_param_spec_object ("key-capture-widget",
+ P_("Key Capture Widget"),
+ P_("Key Capture Widget"),
+ GTK_TYPE_WIDGET,
+ GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
+
g_object_class_install_properties (object_class, LAST_PROPERTY, widget_props);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
@@ -610,6 +624,8 @@ gtk_search_bar_set_key_capture_widget (GtkSearchBar *bar,
G_CALLBACK (capture_widget_key_handled), bar);
gtk_widget_add_controller (widget, bar->capture_widget_controller);
}
+
+ g_object_notify_by_pspec (G_OBJECT (bar), widget_props[PROP_KEY_CAPTURE_WIDGET]);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]