[gtk+/wip/csd] window: Use same title fallback mechanism as X backend
- From: Rob Bradford <rbradford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/csd] window: Use same title fallback mechanism as X backend
- Date: Wed, 30 Jan 2013 18:47:16 +0000 (UTC)
commit 1134ba14a81b0dea3ea1a3080a6fa50ed6813306
Author: Rob Bradford <rob linux intel com>
Date: Wed Jan 30 18:45:59 2013 +0000
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.
gtk/gtkwindow.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2ca851c..2db029e 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4861,13 +4861,29 @@ 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 char *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;
/* Client decorations already created */
if (priv->client_decorated)
@@ -4910,6 +4926,8 @@ create_decoration (GtkWidget *widget)
priv->title_label = gtk_label_new (NULL);
if (priv->title)
title = priv->title;
+ else
+ title = get_default_title (); /* copied from X backend */
gtk_label_set_markup (GTK_LABEL (priv->title_label), title);
gtk_box_pack_start (GTK_BOX (priv->title_box),
priv->title_label, TRUE, TRUE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]