GtkHeaderBar: don't show dangling separators
If we don't have a window icon, we hide the titlebar_icon, we still add it, so we can't simply go by the number of children when deciding whether to show the separator or now. Instead, update the separator visibility as we create the various buttons.
This commit is contained in:
parent
dc073b8020
commit
a33e5748db
@ -346,7 +346,6 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
t = g_strsplit (tokens[i], ",", -1);
|
t = g_strsplit (tokens[i], ",", -1);
|
||||||
|
|
||||||
separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||||
gtk_widget_show (separator);
|
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, priv->spacing);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, priv->spacing);
|
||||||
|
|
||||||
@ -365,6 +364,8 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
priv->titlebar_icon = button;
|
priv->titlebar_icon = button;
|
||||||
if (!_gtk_header_bar_update_window_icon (bar, window))
|
if (!_gtk_header_bar_update_window_icon (bar, window))
|
||||||
gtk_widget_hide (button);
|
gtk_widget_hide (button);
|
||||||
|
else
|
||||||
|
gtk_widget_show (separator);
|
||||||
}
|
}
|
||||||
else if (strcmp (t[j], "menu") == 0 && menu != NULL)
|
else if (strcmp (t[j], "menu") == 0 && menu != NULL)
|
||||||
{
|
{
|
||||||
@ -383,6 +384,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
|
|
||||||
if (!_gtk_header_bar_update_window_icon (bar, window))
|
if (!_gtk_header_bar_update_window_icon (bar, window))
|
||||||
gtk_image_set_from_icon_name (GTK_IMAGE (priv->titlebar_icon), "process-stop-symbolic", GTK_ICON_SIZE_MENU);
|
gtk_image_set_from_icon_name (GTK_IMAGE (priv->titlebar_icon), "process-stop-symbolic", GTK_ICON_SIZE_MENU);
|
||||||
|
gtk_widget_show (separator);
|
||||||
}
|
}
|
||||||
else if (strcmp (t[j], "minimize") == 0 &&
|
else if (strcmp (t[j], "minimize") == 0 &&
|
||||||
gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
|
gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
|
||||||
@ -400,6 +402,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
if (GTK_IS_ACCESSIBLE (accessible))
|
if (GTK_IS_ACCESSIBLE (accessible))
|
||||||
atk_object_set_name (accessible, _("Minimize"));
|
atk_object_set_name (accessible, _("Minimize"));
|
||||||
priv->titlebar_min_button = button;
|
priv->titlebar_min_button = button;
|
||||||
|
gtk_widget_show (separator);
|
||||||
}
|
}
|
||||||
else if (strcmp (t[j], "maximize") == 0 &&
|
else if (strcmp (t[j], "maximize") == 0 &&
|
||||||
gtk_window_get_resizable (window) &&
|
gtk_window_get_resizable (window) &&
|
||||||
@ -422,6 +425,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
if (GTK_IS_ACCESSIBLE (accessible))
|
if (GTK_IS_ACCESSIBLE (accessible))
|
||||||
atk_object_set_name (accessible, maximized ? _("Restore") : _("Maximize"));
|
atk_object_set_name (accessible, maximized ? _("Restore") : _("Maximize"));
|
||||||
priv->titlebar_max_button = button;
|
priv->titlebar_max_button = button;
|
||||||
|
gtk_widget_show (separator);
|
||||||
}
|
}
|
||||||
else if (strcmp (t[j], "close") == 0 &&
|
else if (strcmp (t[j], "close") == 0 &&
|
||||||
gtk_window_get_deletable (window) &&
|
gtk_window_get_deletable (window) &&
|
||||||
@ -440,6 +444,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
|||||||
if (GTK_IS_ACCESSIBLE (accessible))
|
if (GTK_IS_ACCESSIBLE (accessible))
|
||||||
atk_object_set_name (accessible, _("Close"));
|
atk_object_set_name (accessible, _("Close"));
|
||||||
priv->titlebar_close_button = button;
|
priv->titlebar_close_button = button;
|
||||||
|
gtk_widget_show (separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button)
|
if (button)
|
||||||
|
Loading…
Reference in New Issue
Block a user