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
This commit is contained in:
Matthias Clasen 2017-12-07 22:36:29 -05:00
parent 6412d25602
commit fec0dc2b13
13 changed files with 55 additions and 48 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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 ();

View File

@ -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

View File

@ -208,6 +208,14 @@
</para>
</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>

View File

@ -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 ();

View File

@ -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

View File

@ -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]);
}
/**

View File

@ -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,

View File

@ -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 ();

View File

@ -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");

View File

@ -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);