[gtk+] Rename GtkHeaderBar::show-close-button
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Rename GtkHeaderBar::show-close-button
- Date: Fri, 8 Dec 2017 03:37:26 +0000 (UTC)
commit fec0dc2b13c4a992d6b2ec6f0b3184a8557f339b
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 7 22:36:29 2017 -0500
Rename GtkHeaderBar::show-close-button
It is about all window buttons, so rename it to ::show-title-buttons.
https://bugzilla.gnome.org/show_bug.cgi?id=779862
demos/gtk-demo/headerbar.c | 2 +-
demos/gtk-demo/markup.c | 2 +-
demos/gtk-demo/sidebar.c | 2 +-
demos/gtk-demo/widgetbowl.c | 2 +-
docs/reference/gtk/gtk4-sections.txt | 4 +-
docs/reference/gtk/migrating-3to4.xml | 8 ++++
examples/sunny.c | 2 +-
gtk/gtkdialog.c | 2 +-
gtk/gtkheaderbar.c | 61 ++++++++++++++++-----------------
gtk/gtkheaderbar.h | 10 +++---
tests/testpopover.c | 2 +-
tests/testrevealer2.c | 2 +-
tests/testselectionmode.c | 4 +-
13 files changed, 55 insertions(+), 48 deletions(-)
---
diff --git a/demos/gtk-demo/headerbar.c b/demos/gtk-demo/headerbar.c
index 5e6e64c..6784ea3 100644
--- a/demos/gtk-demo/headerbar.c
+++ b/demos/gtk-demo/headerbar.c
@@ -30,7 +30,7 @@ do_headerbar (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
header = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Welcome to Facebook - Log in, sign up or learn
more");
gtk_header_bar_set_has_subtitle (GTK_HEADER_BAR (header), FALSE);
diff --git a/demos/gtk-demo/markup.c b/demos/gtk-demo/markup.c
index d24ee51..974775e 100644
--- a/demos/gtk-demo/markup.c
+++ b/demos/gtk-demo/markup.c
@@ -68,7 +68,7 @@ do_markup (GtkWidget *do_widget)
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
header = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
diff --git a/demos/gtk-demo/sidebar.c b/demos/gtk-demo/sidebar.c
index f044602..422e98e 100644
--- a/demos/gtk-demo/sidebar.c
+++ b/demos/gtk-demo/sidebar.c
@@ -40,7 +40,7 @@ do_sidebar (GtkWidget *do_widget)
gtk_widget_set_size_request (window, 500, 350);
header = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR(header), TRUE);
gtk_window_set_titlebar (GTK_WINDOW(window), header);
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
diff --git a/demos/gtk-demo/widgetbowl.c b/demos/gtk-demo/widgetbowl.c
index 33a929f..60cf47a 100644
--- a/demos/gtk-demo/widgetbowl.c
+++ b/demos/gtk-demo/widgetbowl.c
@@ -308,7 +308,7 @@ do_widgetbowl (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
titlebar = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (titlebar), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (titlebar), TRUE);
info_label = gtk_label_new ("widget - 00.0 fps");
count_label = gtk_label_new ("0");
fishbowl = gtk_fishbowl_new ();
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index dd0a1ad..7cf3269 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1926,8 +1926,8 @@ gtk_info_bar_set_message_type
gtk_info_bar_get_message_type
gtk_info_bar_get_action_area
gtk_info_bar_get_content_area
-gtk_info_bar_get_show_close_button
-gtk_info_bar_set_show_close_button
+gtk_info_bar_get_show_title_buttons
+gtk_info_bar_set_show_title_buttons
gtk_info_bar_get_revealed
gtk_info_bar_set_revealed
diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml
index 8031ea6..a5b8210 100644
--- a/docs/reference/gtk/migrating-3to4.xml
+++ b/docs/reference/gtk/migrating-3to4.xml
@@ -209,6 +209,14 @@
</section>
<section>
+ <title>Adapt to GtkHeaderBar API changes</title>
+ <para>
+ The gtk_header_bar_set_show_close_button() function has been renamed to
+ the more accurate name gtk_header_bar_set_show_title_buttons().
+ </para>
+ </section>
+
+ <section>
<title>Adapt to GtkStyleContext API changes</title>
<para>
The getters in the GtkStyleContext API, such as
diff --git a/examples/sunny.c b/examples/sunny.c
index 4b64c01..e57e9ed 100644
--- a/examples/sunny.c
+++ b/examples/sunny.c
@@ -17,7 +17,7 @@ new_window (GApplication *app,
header = gtk_header_bar_new ();
gtk_widget_show (header);
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Sunny");
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
overlay = gtk_overlay_new ();
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index babc37c..67c3c40 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -366,7 +366,7 @@ apply_response_for_header_bar (GtkDialog *dialog,
NULL);
if (response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_CLOSE)
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (priv->headerbar), FALSE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (priv->headerbar), FALSE);
}
static void
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 88bc513..8c784ba 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -70,7 +70,7 @@ struct _GtkHeaderBarPrivate
GList *children;
- gboolean shows_wm_decorations;
+ gboolean show_title_buttons;
gchar *decoration_layout;
gboolean decoration_layout_set;
@@ -99,7 +99,7 @@ enum {
PROP_HAS_SUBTITLE,
PROP_CUSTOM_TITLE,
PROP_SPACING,
- PROP_SHOW_CLOSE_BUTTON,
+ PROP_SHOW_TITLE_BUTTONS,
PROP_DECORATION_LAYOUT,
PROP_DECORATION_LAYOUT_SET,
LAST_PROP
@@ -286,7 +286,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
priv->titlebar_icon = NULL;
priv->shows_app_menu = FALSE;
- if (!priv->shows_wm_decorations)
+ if (!priv->show_title_buttons)
return;
direction = gtk_widget_get_direction (widget);
@@ -501,8 +501,7 @@ _gtk_header_bar_shows_app_menu (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
- return priv->shows_wm_decorations &&
- priv->shows_app_menu;
+ return priv->show_title_buttons && priv->shows_app_menu;
}
/* As an intended side effect, this function allows @child
@@ -1456,8 +1455,8 @@ gtk_header_bar_get_property (GObject *object,
g_value_set_int (value, priv->spacing);
break;
- case PROP_SHOW_CLOSE_BUTTON:
- g_value_set_boolean (value, gtk_header_bar_get_show_close_button (bar));
+ case PROP_SHOW_TITLE_BUTTONS:
+ g_value_set_boolean (value, gtk_header_bar_get_show_title_buttons (bar));
break;
case PROP_HAS_SUBTITLE:
@@ -1510,8 +1509,8 @@ gtk_header_bar_set_property (GObject *object,
}
break;
- case PROP_SHOW_CLOSE_BUTTON:
- gtk_header_bar_set_show_close_button (bar, g_value_get_boolean (value));
+ case PROP_SHOW_TITLE_BUTTONS:
+ gtk_header_bar_set_show_title_buttons (bar, g_value_get_boolean (value));
break;
case PROP_HAS_SUBTITLE:
@@ -1910,19 +1909,19 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
- * GtkHeaderBar:show-close-button:
+ * GtkHeaderBar:show-title-buttons:
*
- * Whether to show window decorations.
+ * Whether to show title buttons like close, minimize, maximize.
*
* Which buttons are actually shown and where is determined
* by the #GtkHeaderBar:decoration-layout property, and by
* the state of the window (e.g. a close button will not be
* shown if the window can't be closed).
*/
- header_bar_props[PROP_SHOW_CLOSE_BUTTON] =
- g_param_spec_boolean ("show-close-button",
- P_("Show decorations"),
- P_("Whether to show window decorations"),
+ header_bar_props[PROP_SHOW_TITLE_BUTTONS] =
+ g_param_spec_boolean ("show-title-buttons",
+ P_("Show title buttons"),
+ P_("Whether to show title buttons"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@@ -2073,18 +2072,18 @@ gtk_header_bar_new (void)
}
/**
- * gtk_header_bar_get_show_close_button:
+ * gtk_header_bar_get_show_title_buttons:
* @bar: a #GtkHeaderBar
*
* Returns whether this header bar shows the standard window
- * decorations.
+ * title buttons.
*
- * Returns: %TRUE if the decorations are shown
+ * Returns: %TRUE if title buttons are shown
*
- * Since: 3.10
+ * Since: 3.94
*/
gboolean
-gtk_header_bar_get_show_close_button (GtkHeaderBar *bar)
+gtk_header_bar_get_show_title_buttons (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv;
@@ -2092,22 +2091,22 @@ gtk_header_bar_get_show_close_button (GtkHeaderBar *bar)
priv = gtk_header_bar_get_instance_private (bar);
- return priv->shows_wm_decorations;
+ return priv->show_title_buttons;
}
/**
- * gtk_header_bar_set_show_close_button:
+ * gtk_header_bar_set_show_title_buttons:
* @bar: a #GtkHeaderBar
- * @setting: %TRUE to show standard window decorations
+ * @setting: %TRUE to show standard title buttons
*
- * Sets whether this header bar shows the standard window decorations,
- * including close, maximize, and minimize.
+ * Sets whether this header bar shows the standard window
+ * title buttons including close, maximize, and minimize.
*
- * Since: 3.10
+ * Since: 3.94
*/
void
-gtk_header_bar_set_show_close_button (GtkHeaderBar *bar,
- gboolean setting)
+gtk_header_bar_set_show_title_buttons (GtkHeaderBar *bar,
+ gboolean setting)
{
GtkHeaderBarPrivate *priv;
@@ -2117,12 +2116,12 @@ gtk_header_bar_set_show_close_button (GtkHeaderBar *bar,
setting = setting != FALSE;
- if (priv->shows_wm_decorations == setting)
+ if (priv->show_title_buttons == setting)
return;
- priv->shows_wm_decorations = setting;
+ priv->show_title_buttons = setting;
_gtk_header_bar_update_window_buttons (bar);
- g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_SHOW_CLOSE_BUTTON]);
+ g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_SHOW_TITLE_BUTTONS]);
}
/**
diff --git a/gtk/gtkheaderbar.h b/gtk/gtkheaderbar.h
index 73346e4..d0430e6 100644
--- a/gtk/gtkheaderbar.h
+++ b/gtk/gtkheaderbar.h
@@ -83,12 +83,12 @@ GDK_AVAILABLE_IN_3_10
void gtk_header_bar_pack_end (GtkHeaderBar *bar,
GtkWidget *child);
-GDK_AVAILABLE_IN_3_10
-gboolean gtk_header_bar_get_show_close_button (GtkHeaderBar *bar);
+GDK_AVAILABLE_IN_3_94
+gboolean gtk_header_bar_get_show_title_buttons (GtkHeaderBar *bar);
-GDK_AVAILABLE_IN_3_10
-void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar,
- gboolean setting);
+GDK_AVAILABLE_IN_3_94
+void gtk_header_bar_set_show_title_buttons (GtkHeaderBar *bar,
+ gboolean setting);
GDK_AVAILABLE_IN_3_12
void gtk_header_bar_set_has_subtitle (GtkHeaderBar *bar,
diff --git a/tests/testpopover.c b/tests/testpopover.c
index 19eff54..f77c703 100644
--- a/tests/testpopover.c
+++ b/tests/testpopover.c
@@ -59,7 +59,7 @@ main (int argc, char *argv[])
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (win), 400, 600);
header_bar = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header_bar), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header_bar), TRUE);
gtk_window_set_titlebar (GTK_WINDOW (win), header_bar);
gtk_window_set_title (GTK_WINDOW (win), "Test GtkPopover");
actions = g_simple_action_group_new ();
diff --git a/tests/testrevealer2.c b/tests/testrevealer2.c
index fc978d2..7bb08ad 100644
--- a/tests/testrevealer2.c
+++ b/tests/testrevealer2.c
@@ -20,7 +20,7 @@ on_activate (GApplication *app,
/* titlebar */
header = gtk_header_bar_new ();
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
sidebar_toggle = gtk_toggle_button_new_with_label ("Show Sidebar");
diff --git a/tests/testselectionmode.c b/tests/testselectionmode.c
index f3b983f..2174d19 100644
--- a/tests/testselectionmode.c
+++ b/tests/testselectionmode.c
@@ -111,7 +111,7 @@ selection_mode_enter (GtkButton *button, GtkBuilder *builder)
titlestack = GTK_WIDGET (gtk_builder_get_object (builder, "titlestack"));
gtk_style_context_add_class (gtk_widget_get_style_context (header), "selection-mode");
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), FALSE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_widget_hide (headerbutton);
gtk_widget_hide (selectbutton);
gtk_widget_show (cancelbutton);
@@ -140,7 +140,7 @@ selection_mode_leave (GtkButton *button, GtkBuilder *builder)
titlestack = GTK_WIDGET (gtk_builder_get_object (builder, "titlestack"));
gtk_style_context_remove_class (gtk_widget_get_style_context (header), "selection-mode");
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_widget_show (headerbutton);
gtk_widget_show (selectbutton);
gtk_widget_hide (cancelbutton);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]