diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-12 16:25:24 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-12 16:25:48 -0400 |
commit | f32239df1f44ff73cfb81cec4bf631520677a65b (patch) | |
tree | c633af25b2e43056964ccde0c16bb4ca726156a7 /gtk/gtksearchbar.c | |
parent | 22c1b541dfdee23d39c862dbccbe619f68d7516b (diff) | |
download | gtk+-f32239df1f44ff73cfb81cec4bf631520677a65b.tar.gz |
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.
Diffstat (limited to 'gtk/gtksearchbar.c')
-rw-r--r-- | gtk/gtksearchbar.c | 16 |
1 files changed, 16 insertions, 0 deletions
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]); } /** |