mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
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.
This commit is contained in:
parent
22c1b541df
commit
f32239df1f
@ -119,6 +119,7 @@ enum {
|
|||||||
PROP_SEARCH_MODE_ENABLED,
|
PROP_SEARCH_MODE_ENABLED,
|
||||||
PROP_SHOW_CLOSE_BUTTON,
|
PROP_SHOW_CLOSE_BUTTON,
|
||||||
PROP_CHILD,
|
PROP_CHILD,
|
||||||
|
PROP_KEY_CAPTURE_WIDGET,
|
||||||
LAST_PROPERTY
|
LAST_PROPERTY
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,6 +207,9 @@ gtk_search_bar_set_property (GObject *object,
|
|||||||
case PROP_CHILD:
|
case PROP_CHILD:
|
||||||
gtk_search_bar_set_child (bar, g_value_get_object (value));
|
gtk_search_bar_set_child (bar, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_KEY_CAPTURE_WIDGET:
|
||||||
|
gtk_search_bar_set_key_capture_widget (bar, g_value_get_object (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -231,6 +235,9 @@ gtk_search_bar_get_property (GObject *object,
|
|||||||
case PROP_CHILD:
|
case PROP_CHILD:
|
||||||
g_value_set_object (value, gtk_search_bar_get_child (bar));
|
g_value_set_object (value, gtk_search_bar_get_child (bar));
|
||||||
break;
|
break;
|
||||||
|
case PROP_KEY_CAPTURE_WIDGET:
|
||||||
|
g_value_set_object (value, gtk_search_bar_get_key_capture_widget (bar));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -318,6 +325,13 @@ gtk_search_bar_class_init (GtkSearchBarClass *klass)
|
|||||||
GTK_TYPE_WIDGET,
|
GTK_TYPE_WIDGET,
|
||||||
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
|
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);
|
g_object_class_install_properties (object_class, LAST_PROPERTY, widget_props);
|
||||||
|
|
||||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
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);
|
G_CALLBACK (capture_widget_key_handled), bar);
|
||||||
gtk_widget_add_controller (widget, bar->capture_widget_controller);
|
gtk_widget_add_controller (widget, bar->capture_widget_controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (bar), widget_props[PROP_KEY_CAPTURE_WIDGET]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user