diff options
-rw-r--r-- | docs/reference/gtk/gtk4-sections.txt | 1 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 57 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 2 |
3 files changed, 14 insertions, 46 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 19e5e49841..231242108e 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4433,7 +4433,6 @@ gtk_widget_event gtk_widget_activate gtk_widget_is_focus gtk_widget_grab_focus -gtk_widget_grab_default gtk_widget_set_name gtk_widget_get_name gtk_widget_set_sensitive diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index bbacdfdd34..3195d78b5b 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -1045,7 +1045,7 @@ gtk_widget_class_init (GtkWidgetClass *klass) P_("Has default"), P_("Whether the widget is the default widget"), FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY); widget_props[PROP_RECEIVES_DEFAULT] = g_param_spec_boolean ("receives-default", @@ -2193,10 +2193,6 @@ gtk_widget_set_property (GObject *object, case PROP_CAN_DEFAULT: gtk_widget_set_can_default (widget, g_value_get_boolean (value)); break; - case PROP_HAS_DEFAULT: - if (g_value_get_boolean (value)) - gtk_widget_grab_default (widget); - break; case PROP_RECEIVES_DEFAULT: gtk_widget_set_receives_default (widget, g_value_get_boolean (value)); break; @@ -5821,9 +5817,14 @@ gtk_widget_get_focus_on_click (GtkWidget *widget) * @widget: a #GtkWidget * @can_default: whether or not @widget can be a default widget. * - * Specifies whether @widget can be a default widget. See - * gtk_widget_grab_default() for details about the meaning of - * “default”. + * Specifies whether @widget can be a default widget. + * + * The default widget is activated when the user presses + * Enter in a window. Default widgets must be activatable, + * that is, gtk_widget_activate() should affect them. Note + * that #GtkEntry widgets require the “activates-default” + * property set to %TRUE before they activate the default + * widget when Enter is pressed and the #GtkEntry is focused. **/ void gtk_widget_set_can_default (GtkWidget *widget, @@ -5899,46 +5900,16 @@ _gtk_widget_set_has_default (GtkWidget *widget, } /** - * gtk_widget_grab_default: - * @widget: a #GtkWidget - * - * Causes @widget to become the default widget. @widget must be able to be - * a default widget; typically you would ensure this yourself - * by calling gtk_widget_set_can_default() with a %TRUE value. - * The default widget is activated when - * the user presses Enter in a window. Default widgets must be - * activatable, that is, gtk_widget_activate() should affect them. Note - * that #GtkEntry widgets require the “activates-default” property - * set to %TRUE before they activate the default widget when Enter - * is pressed and the #GtkEntry is focused. - **/ -void -gtk_widget_grab_default (GtkWidget *widget) -{ - GtkWidget *window; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (gtk_widget_get_can_default (widget)); - - window = _gtk_widget_get_toplevel (widget); - - if (window && _gtk_widget_is_toplevel (window)) - gtk_window_set_default_widget (GTK_WINDOW (window), widget); - else - g_warning (G_STRLOC ": widget not within a GtkWindow"); -} - -/** * gtk_widget_set_receives_default: * @widget: a #GtkWidget * @receives_default: whether or not @widget can be a default widget. * - * Specifies whether @widget will be treated as the default widget - * within its toplevel when it has the focus, even if another widget - * is the default. + * Specifies whether @widget will be treated as the default + * widget within its toplevel when it has the focus, even if + * another widget is the default. * - * See gtk_widget_grab_default() for details about the meaning of - * “default”. + * See gtk_widget_set_can_default() for details about the + * meaning of “default”. **/ void gtk_widget_set_receives_default (GtkWidget *widget, diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 2734c4fd37..1c14b63de4 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -482,8 +482,6 @@ GDK_AVAILABLE_IN_ALL gboolean gtk_widget_get_can_default (GtkWidget *widget); GDK_AVAILABLE_IN_ALL gboolean gtk_widget_has_default (GtkWidget *widget); -GDK_AVAILABLE_IN_ALL -void gtk_widget_grab_default (GtkWidget *widget); GDK_AVAILABLE_IN_ALL void gtk_widget_set_receives_default (GtkWidget *widget, |