[gtk/wip/matthiasc/popup5: 138/186] popover: Rename modal to autohide
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup5: 138/186] popover: Rename modal to autohide
- Date: Tue, 28 May 2019 20:20:32 +0000 (UTC)
commit 084539ced1957720f35934c37d07eea0b36dd1f3
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 19 19:46:56 2019 -0400
popover: Rename modal to autohide
This is the term we use for the surface,
and it matches the behavior a bit better
than modal.
Update all callers.
demos/gtk-demo/popover.c | 2 +-
demos/gtk-demo/sliding_puzzle.c | 1 -
demos/widget-factory/widget-factory.ui | 6 ++--
docs/reference/gtk/gtk4-sections.txt | 4 +--
gtk/a11y/gtkpopoveraccessible.c | 4 +--
gtk/gtkpopover.c | 65 ++++++++++++++++++----------------
gtk/gtkpopover.h | 6 ++--
gtk/gtktext.c | 4 +--
gtk/gtktextview.c | 4 +--
gtk/ui/gtkemojicompletion.ui | 2 +-
10 files changed, 50 insertions(+), 48 deletions(-)
---
diff --git a/demos/gtk-demo/popover.c b/demos/gtk-demo/popover.c
index 3aa201c2d3..f3d8bcf5fe 100644
--- a/demos/gtk-demo/popover.c
+++ b/demos/gtk-demo/popover.c
@@ -143,7 +143,7 @@ do_popover (GtkWidget *do_widget)
popover = create_popover (widget,
gtk_label_new ("This popover does not grab input"),
GTK_POS_TOP);
- gtk_popover_set_modal (GTK_POPOVER (popover), FALSE);
+ gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
g_signal_connect (widget, "toggled",
G_CALLBACK (toggle_changed_cb), popover);
gtk_container_add (GTK_CONTAINER (box), widget);
diff --git a/demos/gtk-demo/sliding_puzzle.c b/demos/gtk-demo/sliding_puzzle.c
index 3cfb182d88..3bb8ffbebe 100644
--- a/demos/gtk-demo/sliding_puzzle.c
+++ b/demos/gtk-demo/sliding_puzzle.c
@@ -445,7 +445,6 @@ do_sliding_puzzle (GtkWidget *do_widget)
g_signal_connect (apply, "clicked", G_CALLBACK (reconfigure), NULL);
popover = gtk_popover_new (NULL);
- gtk_popover_set_modal (GTK_POPOVER (popover), TRUE);
gtk_container_add (GTK_CONTAINER (popover), tweaks);
tweak = gtk_menu_button_new ();
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 0a2d4e25cf..3dc1b280b1 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -3463,7 +3463,7 @@ bad things might happen.</property>
</widgets>
</object>
<object class="GtkPopover" id="notebook_info_popover">
- <property name="modal">0</property>
+ <property name="autohide">0</property>
<child>
<object class="GtkLabel">
<property name="label">No updates at this time</property>
@@ -3474,7 +3474,7 @@ bad things might happen.</property>
</child>
</object>
<object class="GtkPopover" id="notebook_info_popover3">
- <property name="modal">0</property>
+ <property name="autohide">0</property>
<child>
<object class="GtkLabel">
<property name="label">You're in too deep!</property>
@@ -3485,7 +3485,7 @@ bad things might happen.</property>
</child>
</object>
<object class="GtkPopover" id="notebook_info_popover2">
- <property name="modal">0</property>
+ <property name="autohide">0</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 79e0fc9cef..7c0f38a198 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -6457,8 +6457,8 @@ gtk_popover_get_position
GtkPopoverConstraint
gtk_popover_set_constrain_to
gtk_popover_get_constrain_to
-gtk_popover_set_modal
-gtk_popover_get_modal
+gtk_popover_set_autohide
+gtk_popover_get_autohide
gtk_popover_set_default_widget
gtk_popover_get_default_widget
<SUBSECTION Standard>
diff --git a/gtk/a11y/gtkpopoveraccessible.c b/gtk/a11y/gtkpopoveraccessible.c
index 63bceab014..4b51139c05 100644
--- a/gtk/a11y/gtkpopoveraccessible.c
+++ b/gtk/a11y/gtkpopoveraccessible.c
@@ -82,7 +82,7 @@ popover_update_modality (AtkObject *object,
GtkPopover *popover)
{
atk_object_notify_state_change (object, ATK_STATE_MODAL,
- gtk_popover_get_modal (popover));
+ gtk_popover_get_autohide (popover));
}
static void
@@ -125,7 +125,7 @@ gtk_popover_accessible_ref_state_set (AtkObject *obj)
state_set = ATK_OBJECT_CLASS (gtk_popover_accessible_parent_class)->ref_state_set (obj);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
- if (gtk_popover_get_modal (GTK_POPOVER (widget)))
+ if (gtk_popover_get_autohide (GTK_POPOVER (widget)))
atk_state_set_add_state (state_set, ATK_STATE_MODAL);
return state_set;
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 9b8b219620..00f6046cf7 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -37,8 +37,8 @@
* input events get redirected to it while it is shown, and also so
* the popover is dismissed in the expected situations (clicks outside
* the popover, or the Esc key being pressed). If no such modal behavior
- * is desired on a popover, gtk_popover_set_modal() may be called on it
- * to tweak its behavior.
+ * is desired on a popover, gtk_popover_set_autohide() may be called
+ * on it to tweak its behavior.
*
* ## GtkPopover as menu replacement
*
@@ -153,7 +153,7 @@ typedef struct {
gboolean has_pointing_to;
guint surface_transform_changed_cb;
GtkPositionType position;
- gboolean modal;
+ gboolean autohide;
GtkWidget *contents_widget;
GtkCssNode *arrow_node;
@@ -173,7 +173,7 @@ enum {
PROP_RELATIVE_TO = 1,
PROP_POINTING_TO,
PROP_POSITION,
- PROP_MODAL,
+ PROP_AUTOHIDE,
PROP_DEFAULT_WIDGET,
NUM_PROPERTIES
};
@@ -526,7 +526,7 @@ gtk_popover_init (GtkPopover *popover)
priv->position = GTK_POS_TOP;
priv->final_position = GTK_POS_TOP;
- priv->modal = TRUE;
+ priv->autohide = TRUE;
controller = gtk_event_controller_key_new ();
g_signal_connect_swapped (controller, "focus-in", G_CALLBACK (gtk_popover_focus_in), popover);
@@ -568,7 +568,7 @@ gtk_popover_realize (GtkWidget *widget)
display = gtk_widget_get_display (priv->relative_to);
- priv->surface = gdk_surface_new_popup (display, gtk_widget_get_surface (priv->relative_to), priv->modal);
+ priv->surface = gdk_surface_new_popup (display, gtk_widget_get_surface (priv->relative_to),
priv->autohide);
gdk_surface_set_widget (priv->surface, widget);
@@ -626,7 +626,7 @@ gtk_popover_show (GtkWidget *widget)
gtk_popover_native_check_resize (GTK_NATIVE (widget));
gtk_widget_map (widget);
- if (priv->modal)
+ if (priv->autohide)
{
if (!gtk_widget_get_focus_child (widget))
gtk_widget_child_focus (widget, GTK_DIR_TAB_FORWARD);
@@ -1185,8 +1185,8 @@ gtk_popover_set_property (GObject *object,
gtk_popover_set_position (popover, g_value_get_enum (value));
break;
- case PROP_MODAL:
- gtk_popover_set_modal (popover, g_value_get_boolean (value));
+ case PROP_AUTOHIDE:
+ gtk_popover_set_autohide (popover, g_value_get_boolean (value));
break;
case PROP_DEFAULT_WIDGET:
@@ -1222,8 +1222,8 @@ gtk_popover_get_property (GObject *object,
g_value_set_enum (value, priv->position);
break;
- case PROP_MODAL:
- g_value_set_boolean (value, priv->modal);
+ case PROP_AUTOHIDE:
+ g_value_set_boolean (value, priv->autohide);
break;
case PROP_DEFAULT_WIDGET:
@@ -1308,10 +1308,10 @@ gtk_popover_class_init (GtkPopoverClass *klass)
GTK_TYPE_POSITION_TYPE, GTK_POS_TOP,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
- properties[PROP_MODAL] =
- g_param_spec_boolean ("modal",
- P_("Modal"),
- P_("Whether the popover is modal"),
+ properties[PROP_AUTOHIDE] =
+ g_param_spec_boolean ("autohide",
+ P_("Autohide"),
+ P_("Whether to dismiss the popver on outside clicks"),
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@@ -1583,50 +1583,53 @@ gtk_popover_get_position (GtkPopover *popover)
}
/**
- * gtk_popover_set_modal:
+ * gtk_popover_set_autohide:
* @popover: a #GtkPopover
- * @modal: #TRUE to make popover claim all input within the toplevel
+ * @autohide: #TRUE to dismiss the popover on outside clicks
*
- * Sets whether @popover is modal, a modal popover will grab all input
- * within the toplevel and grab the keyboard focus on it when being
+ * Sets whether @popover is modal.
+ *
+ * A modal popover will grab the keyboard focus on it when being
* displayed. Clicking outside the popover area or pressing Esc will
- * dismiss the popover and ungrab input.
+ * dismiss the popover.
**/
void
-gtk_popover_set_modal (GtkPopover *popover,
- gboolean modal)
+gtk_popover_set_autohide (GtkPopover *popover,
+ gboolean autohide)
{
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_if_fail (GTK_IS_POPOVER (popover));
- modal = modal != FALSE;
+ autohide = autohide != FALSE;
- if (priv->modal == modal)
+ if (priv->autohide == autohide)
return;
- priv->modal = modal;
+ priv->autohide = autohide;
- g_object_notify_by_pspec (G_OBJECT (popover), properties[PROP_MODAL]);
+ g_object_notify_by_pspec (G_OBJECT (popover), properties[PROP_AUTOHIDE]);
}
/**
- * gtk_popover_get_modal:
+ * gtk_popover_get_autohide:
* @popover: a #GtkPopover
*
- * Returns whether the popover is modal, see gtk_popover_set_modal to
- * see the implications of this.
+ * Returns whether the popover is modal.
+ *
+ * See gtk_popover_set_autohide() for the
+ * implications of this.
*
* Returns: #TRUE if @popover is modal
**/
gboolean
-gtk_popover_get_modal (GtkPopover *popover)
+gtk_popover_get_autohide (GtkPopover *popover)
{
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
g_return_val_if_fail (GTK_IS_POPOVER (popover), FALSE);
- return priv->modal;
+ return priv->autohide;
}
/**
diff --git a/gtk/gtkpopover.h b/gtk/gtkpopover.h
index c4905f3b5d..7815677df6 100644
--- a/gtk/gtkpopover.h
+++ b/gtk/gtkpopover.h
@@ -89,10 +89,10 @@ GDK_AVAILABLE_IN_ALL
GtkPositionType gtk_popover_get_position (GtkPopover *popover);
GDK_AVAILABLE_IN_ALL
-void gtk_popover_set_modal (GtkPopover *popover,
- gboolean modal);
+void gtk_popover_set_autohide (GtkPopover *popover,
+ gboolean autohide);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_popover_get_modal (GtkPopover *popover);
+gboolean gtk_popover_get_autohide (GtkPopover *popover);
GDK_AVAILABLE_IN_ALL
void gtk_popover_popup (GtkPopover *popover);
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index f177a8fd50..6c2519c8ee 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1838,7 +1838,7 @@ gtk_text_ensure_magnifier (GtkText *self)
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (self));
gtk_style_context_add_class (gtk_widget_get_style_context (priv->magnifier_popover),
"magnifier");
- gtk_popover_set_modal (GTK_POPOVER (priv->magnifier_popover), FALSE);
+ gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
priv->magnifier);
gtk_widget_show (priv->magnifier);
@@ -5840,7 +5840,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
GTK_STYLE_CLASS_TOUCH_SELECTION);
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
- gtk_popover_set_modal (GTK_POPOVER (priv->selection_bubble), FALSE);
+ gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
g_signal_connect (priv->selection_bubble, "notify::visible",
G_CALLBACK (show_or_hide_handles), self);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 4a7cb14b7d..6a4db5f041 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -1757,7 +1757,7 @@ _gtk_text_view_ensure_magnifier (GtkTextView *text_view)
priv->magnifier_popover = gtk_popover_new (GTK_WIDGET (text_view));
gtk_style_context_add_class (gtk_widget_get_style_context (priv->magnifier_popover),
"magnifier");
- gtk_popover_set_modal (GTK_POPOVER (priv->magnifier_popover), FALSE);
+ gtk_popover_set_autohide (GTK_POPOVER (priv->magnifier_popover), FALSE);
gtk_container_add (GTK_CONTAINER (priv->magnifier_popover),
priv->magnifier);
gtk_widget_show (priv->magnifier);
@@ -8791,7 +8791,7 @@ gtk_text_view_selection_bubble_popup_show (gpointer user_data)
gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
GTK_STYLE_CLASS_TOUCH_SELECTION);
gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM);
- gtk_popover_set_modal (GTK_POPOVER (priv->selection_bubble), FALSE);
+ gtk_popover_set_autohide (GTK_POPOVER (priv->selection_bubble), FALSE);
g_signal_connect (priv->selection_bubble, "notify::visible",
G_CALLBACK (show_or_hide_handles), text_view);
diff --git a/gtk/ui/gtkemojicompletion.ui b/gtk/ui/gtkemojicompletion.ui
index 0abdb7742a..e4873d930a 100644
--- a/gtk/ui/gtkemojicompletion.ui
+++ b/gtk/ui/gtkemojicompletion.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<template class="GtkEmojiCompletion" parent="GtkPopover">
- <property name="modal">0</property>
+ <property name="autohide">0</property>
<style>
<class name="emoji-completion"/>
</style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]