gnome-client patch



Hi,

OK to commit?

Rationale is in
http://moniker.gnome.org/archives/gnomecc-list/2001-October/msg00028.html

Also a small fix to get_config_prefix().

Havoc

Index: libgnomeui/ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/ChangeLog,v
retrieving revision 1.1711
diff -u -p -u -r1.1711 ChangeLog
--- libgnomeui/ChangeLog	2001/10/30 17:28:44	1.1711
+++ libgnomeui/ChangeLog	2001/10/31 17:25:43
@@ -1,3 +1,10 @@
+2001-10-31  Havoc Pennington  <hp redhat com>
+
+	* gnome-client.c (gnome_client_get_config_prefix): fix some utter
+	braindamage (if you passed in the wrong type, it silently returned
+	the master client)
+	(gnome_client_get_desktop_id): new function
+
 2001-10-30  jacob berkman  <jacob ximian com>
 
 	* libgnomeui-2.0.pc.in (Cflags): use the correct includedir
Index: libgnomeui/gnome-client.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-client.c,v
retrieving revision 1.113
diff -u -p -u -r1.113 gnome-client.c
--- libgnomeui/gnome-client.c	2001/10/29 17:17:41	1.113
+++ libgnomeui/gnome-client.c	2001/10/31 17:25:43
@@ -2144,6 +2144,26 @@ gnome_client_get_previous_id (GnomeClien
 }
 
 /**
+ * gnome_client_get_desktop_id:
+ * @client: a #GnomeClient
+ * 
+ * Get the client ID of the desktop's current instance, i.e.  if
+ * you consider the desktop as a whole as a session managed app, this
+ * returns its session ID using a GNOME extension to session
+ * management. May return %NULL for apps not running under a recent
+ * version of gnome-session, apps should handle that case.
+ * 
+ * Return value: session ID of GNOME desktop instance, or %NULL if none
+ **/
+const gchar*
+gnome_client_get_desktop_id (GnomeClient *client)
+{
+  g_return_val_if_fail (GNOME_IS_CLIENT (client), NULL);
+
+  return g_getenv ("GNOME_DESKTOP_SESSION_ID");
+}
+
+/**
  * gnome_client_get_config_prefix
  * @client: Pointer to GNOME session client object.
  *
@@ -2160,10 +2180,12 @@ gnome_client_get_previous_id (GnomeClien
 const gchar *
 gnome_client_get_config_prefix (GnomeClient *client)
 {
-  if (!client || !GNOME_IS_CLIENT (client))
+  g_return_val_if_fail (client == NULL || GNOME_IS_CLIENT (client), NULL);
+  
+  if (!client)
       client = master_client;
 
-  if (!client || !GNOME_IS_CLIENT (client))
+  if (!client)
       return gnome_client_get_global_config_prefix (client);
 
   if (!client->config_prefix)
Index: libgnomeui/gnome-client.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-client.h,v
retrieving revision 1.52
diff -u -p -u -r1.52 gnome-client.h
--- libgnomeui/gnome-client.h	2001/10/23 21:56:54	1.52
+++ libgnomeui/gnome-client.h	2001/10/31 17:25:43
@@ -434,6 +434,12 @@ const gchar*       gnome_client_get_id  
    manager tries to maintain the same id from one session to another. */
 const gchar*       gnome_client_get_previous_id        (GnomeClient *client);
 
+/* Get the client ID of the desktop's current instance, i.e.  if you
+ * consider the desktop as a whole as a session managed app, this
+ * returns its session ID (GNOME extension to SM)
+ */
+const gchar*       gnome_client_get_desktop_id   (GnomeClient *client);
+
 /* Use the following functions, if you want to interact with the user
    during a "save_yourself" handler without being restricted to using 
    the dialog based commands gnome_client_save_[any/error]_dialog.  



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