window: Use same title fallback mechanism as X backend

This looks at the application name or program name and uses that
as the title if gtk_window_set_title has not been called.
This commit is contained in:
Matthias Clasen 2013-03-17 12:08:17 -04:00
parent b141121ef6
commit d05d08a2f3

View File

@ -4839,13 +4839,28 @@ gtk_window_finalize (GObject *object)
G_OBJECT_CLASS (gtk_window_parent_class)->finalize (object);
}
/* copied from gdkwindow-x11.c */
static const gchar *
get_default_title (void)
{
const gchar *title;
title = g_get_application_name ();
if (!title)
title = g_get_prgname ();
if (!title)
title = "";
return title;
}
static void
create_decoration (GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = window->priv;
GtkStyleContext *context;
const char *title = "GtkWindow";
const gchar *title;
/* Clien decorations already created */
if (priv->client_decorated)
@ -4888,6 +4903,8 @@ create_decoration (GtkWidget *widget)
if (priv->title)
title = priv->title;
else
title = get_default_title ();
gtk_header_bar_set_title (GTK_HEADER_BAR (priv->title_box), title);
priv->title_min_button = gtk_button_new_with_label ("_");