[gnome-terminal] window: Use the UUID in the window role



commit 90550d1b4eab130f5cfd6e62a14359ca0eb6a190
Author: Christian Persch <chpe gnome org>
Date:   Fri Jun 21 15:17:29 2013 +0200

    window: Use the UUID in the window role

 src/terminal-util.c   |   10 ----------
 src/terminal-util.h   |    2 --
 src/terminal-window.c |    5 +++--
 3 files changed, 3 insertions(+), 14 deletions(-)
---
diff --git a/src/terminal-util.c b/src/terminal-util.c
index 4026bd4..305c3b0 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -43,16 +43,6 @@
 #include "terminal-util.h"
 #include "terminal-window.h"
 
-void
-terminal_util_set_unique_role (GtkWindow *window, const char *prefix)
-{
-  char *role;
-
-  role = g_strdup_printf ("%s-%d-%u-%d", prefix, getpid (), (guint) g_random_int (), (int) time (NULL));
-  gtk_window_set_role (window, role);
-  g_free (role);
-}
-
 /**
  * terminal_util_show_error_dialog:
  * @transient_parent: parent of the future dialog window;
diff --git a/src/terminal-util.h b/src/terminal-util.h
index 71ab903..95a3029 100644
--- a/src/terminal-util.h
+++ b/src/terminal-util.h
@@ -26,8 +26,6 @@
 
 G_BEGIN_DECLS
 
-void terminal_util_set_unique_role (GtkWindow *window, const char *prefix);
-
 void terminal_util_show_error_dialog (GtkWindow *transient_parent, 
                                       GtkWidget **weap_ptr, 
                                       GError *error,
diff --git a/src/terminal-window.c b/src/terminal-window.c
index f28af03..a9501b4 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1759,7 +1759,7 @@ terminal_window_init (TerminalWindow *window)
   GtkAccelGroup *accel_group;
   GtkClipboard *clipboard;
   uuid_t u;
-  char uuidstr[37];
+  char uuidstr[37], role[64];
 
   priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate);
 
@@ -1896,7 +1896,8 @@ terminal_window_init (TerminalWindow *window)
   gtk_window_group_add_window (window_group, GTK_WINDOW (window));
   g_object_unref (window_group);
 
-  terminal_util_set_unique_role (GTK_WINDOW (window), "gnome-terminal-window");
+  g_snprintf (role, sizeof (role), "gnome-terminal-window-%s", uuidstr);
+  gtk_window_set_role (GTK_WINDOW (window), role);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]