[Xfce4-commits] <libxfce4ui:new-sm-client> remove ability to set SmProgram

Brian J. Tarricone noreply at xfce.org
Sat Sep 19 11:38:01 CEST 2009


Updating branch refs/heads/kelnos/new-sm-client
         to ee7cd1f527861e9caf3cf1b4d4860607030c0376 (commit)
       from 901fb8de6fc98b2c6c9794e9b73e26a6e41259a5 (commit)

commit ee7cd1f527861e9caf3cf1b4d4860607030c0376
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Sat Sep 19 02:10:38 2009 -0700

    remove ability to set SmProgram

 docs/libxfce4ui-sections.txt  |    2 -
 docs/tmpl/xfce-sm-client.sgml |   24 ----------
 libxfce4ui/libxfce4ui.symbols |    2 -
 libxfce4ui/xfce-sm-client.c   |   97 +++++------------------------------------
 libxfce4ui/xfce-sm-client.h   |    5 --
 5 files changed, 11 insertions(+), 119 deletions(-)

diff --git a/docs/libxfce4ui-sections.txt b/docs/libxfce4ui-sections.txt
index d3a9b10..d8b2c26 100644
--- a/docs/libxfce4ui-sections.txt
+++ b/docs/libxfce4ui-sections.txt
@@ -96,8 +96,6 @@ xfce_sm_client_get_discard_command
 xfce_sm_client_set_discard_command
 xfce_sm_client_get_priority
 xfce_sm_client_set_priority
-xfce_sm_client_get_program
-xfce_sm_client_set_program
 xfce_sm_client_get_restart_command
 xfce_sm_client_set_restart_command
 xfce_sm_client_get_restart_style
diff --git a/docs/tmpl/xfce-sm-client.sgml b/docs/tmpl/xfce-sm-client.sgml
index b9547b6..cdadf74 100644
--- a/docs/tmpl/xfce-sm-client.sgml
+++ b/docs/tmpl/xfce-sm-client.sgml
@@ -100,11 +100,6 @@
 
 </para>
 
-<!-- ##### ARG XfceSMClient:program ##### -->
-<para>
-
-</para>
-
 <!-- ##### ARG XfceSMClient:restart-command ##### -->
 <para>
 
@@ -187,7 +182,6 @@
 @restart_style: 
 @priority: 
 @resumed_client_id: 
- at program: 
 @current_directory: 
 @restart_command: 
 @clone_command: 
@@ -330,24 +324,6 @@
 @priority: 
 
 
-<!-- ##### FUNCTION xfce_sm_client_get_program ##### -->
-<para>
-
-</para>
-
- at sm_client: 
- at Returns: 
-
-
-<!-- ##### FUNCTION xfce_sm_client_set_program ##### -->
-<para>
-
-</para>
-
- at sm_client: 
- at program: 
-
-
 <!-- ##### FUNCTION xfce_sm_client_get_restart_command ##### -->
 <para>
 
diff --git a/libxfce4ui/libxfce4ui.symbols b/libxfce4ui/libxfce4ui.symbols
index d75091d..3517027 100644
--- a/libxfce4ui/libxfce4ui.symbols
+++ b/libxfce4ui/libxfce4ui.symbols
@@ -111,8 +111,6 @@ xfce_sm_client_set_restart_style
 xfce_sm_client_get_restart_style
 xfce_sm_client_set_priority
 xfce_sm_client_get_priority
-xfce_sm_client_set_program
-xfce_sm_client_get_program
 xfce_sm_client_set_clone_command
 xfce_sm_client_get_clone_command
 xfce_sm_client_set_restart_command
diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index 4500253..4acec2b 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -208,7 +208,6 @@ enum
     PROP_PRIORITY,
     PROP_CLIENT_ID,
     PROP_CURRENT_DIRECTORY,
-    PROP_PROGRAM,
     PROP_CLONE_COMMAND,
     PROP_RESTART_COMMAND,
     PROP_DISCARD_COMMAND,
@@ -393,12 +392,6 @@ xfce_sm_client_class_init(XfceSMClientClass *klass)
                                                         "The directory that should be used as the working directory the next time this client is restarted",
                                                         NULL,
                                                         G_PARAM_READWRITE));
-    g_object_class_install_property(gobject_class, PROP_PROGRAM,
-                                    g_param_spec_string("program",
-                                                        "Program name",
-                                                        "An string used to identify the application",
-                                                        NULL,
-                                                        G_PARAM_READWRITE));
     g_object_class_install_property(gobject_class, PROP_CLONE_COMMAND,
                                     g_param_spec_boxed("clone-command",
                                                        "Clone command",
@@ -442,7 +435,6 @@ xfce_sm_client_class_init(XfceSMClientClass *klass)
 static void
 xfce_sm_client_init(XfceSMClient *sm_client)
 {
-    sm_client->program = g_get_prgname() ? g_strdup(g_get_prgname()) : g_strdup("<unknown program>");
     sm_client->current_directory = g_strdup(xfce_get_homedir());
 }
 
@@ -475,10 +467,6 @@ xfce_sm_client_get_property(GObject *obj,
             g_value_set_string(value, sm_client->current_directory);
             break;
 
-        case PROP_PROGRAM:
-            g_value_set_string(value, sm_client->program);
-            break;
-
         case PROP_CLONE_COMMAND:
             g_value_set_boxed(value, sm_client->clone_command);
             break;
@@ -529,10 +517,6 @@ xfce_sm_client_set_property(GObject *obj,
                                                  g_value_get_string(value));
             break;
 
-        case PROP_PROGRAM:
-            xfce_sm_client_set_program(sm_client, g_value_get_string(value));
-            break;
-
         case PROP_CLONE_COMMAND:
             xfce_sm_client_set_clone_command(sm_client,
                                              g_value_get_boxed(value));
@@ -614,7 +598,6 @@ xfce_sm_client_finalize(GObject *obj)
 
     g_free(sm_client->client_id);
     g_free(sm_client->current_directory);
-    g_free(sm_client->program);
     g_strfreev(sm_client->clone_command);
     g_strfreev(sm_client->restart_command);
     g_strfreev(sm_client->discard_command);
@@ -1471,7 +1454,6 @@ xfce_sm_client_get_with_argv(guint argc,
  * @restart_style: An XfceSMClientRestartStyle
  * @priority: A restart priority
  * @resumed_client_id: The client id used in the previous session
- * @program: A program identifier string
  * @current_directory: The application's working directory
  * @restart_command: A command that can resume the application's
  *                   saved state
@@ -1494,10 +1476,9 @@ xfce_sm_client_get_with_argv(guint argc,
  * Returns: A new #XfceSMClient instance
  **/
 XfceSMClient *
-xfce_sm_client_new_full(XfceSMClientRestartStyle restart_style,
+xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
                         gchar priority,
                         const gchar *resumed_client_id,
-                        const gchar *program,
                         const gchar *current_directory,
                         const gchar **restart_command,
                         const gchar **clone_command,
@@ -1507,7 +1488,6 @@ xfce_sm_client_new_full(XfceSMClientRestartStyle restart_style,
                         "restart-style", restart_style,
                         "priority", priority,
                         "client-id", resumed_client_id,
-                        "program", program,
                         "current-directory", current_directory,
                         "restart-command", restart_command,
                         "clone-command", clone_command,
@@ -1613,8 +1593,10 @@ xfce_sm_client_connect(XfceSMClient *sm_client,
     prop1.type = SmARRAY8;
     prop1.num_vals = 1;
     prop1.vals = &prop1val;
-    prop1val.value = sm_client->program;
-    prop1val.length = strlen(sm_client->program);
+    prop1val.value = (char *)g_get_prgname();
+    if(G_UNLIKELY(!prop1val.value))
+        prop1val.value = "<unknown program>";
+    prop1val.length = strlen(prop1val.value);
     n_props++;
 
     prop2.name = SmUserID;
@@ -2002,50 +1984,6 @@ xfce_sm_client_set_current_directory(XfceSMClient *sm_client,
     g_object_notify(G_OBJECT(sm_client), "current-directory");
 }
 
-/**
- * xfce_sm_client_set_program:
- * @sm_client: An XfceSMClient
- * @program: A program identifier string
- *
- * Sets an identifier string for your application.  This string is not
- * intended to be user-visible, but in some cases may be, so it may be
- * useful to use something that isn't totally incomprehensible.  If
- * unset, it will default to the value returned by g_get_prgname().
- **/
-void
-xfce_sm_client_set_program(XfceSMClient *sm_client,
-                           const gchar *program)
-{
-    g_return_if_fail(XFCE_IS_SM_CLIENT(sm_client));
-
-    if(!xfce_safe_strcmp(sm_client->program, program))
-        return;
-
-    if(!program)
-        program = g_get_prgname() ? g_get_prgname() : "<unknown program>";
-
-    g_free(sm_client->program);
-    sm_client->program = g_strdup(program);
-    
-#ifdef HAVE_LIBSM
-    if(sm_client->session_connection) {
-        SmProp prop, *props[1];
-        SmPropValue propval;
-
-        prop.name = SmProgram;
-        prop.type = SmARRAY8;
-        prop.num_vals = 1;
-        prop.vals = &propval;
-        propval.value = sm_client->program;
-        propval.length = strlen(sm_client->program);
-
-        SmcSetProperties(sm_client->session_connection, 1, props);
-    }
-#endif /* HAVE_LIBSM */
-
-    g_object_notify(G_OBJECT(sm_client), "program");
-}
-
 static gchar **
 copy_command(gchar **command,
              gchar **value)
@@ -2230,18 +2168,21 @@ G_CONST_RETURN gchar *
 xfce_sm_client_get_state_file(XfceSMClient *sm_client)
 {
     gchar *resource, *p;
+    const gchar *prgname;
 
     g_return_val_if_fail(XFCE_IS_SM_CLIENT(sm_client), NULL);
 
     if(sm_client->state_file)
         return sm_client->state_file;
 
-    g_return_val_if_fail(sm_client->program, NULL);
     g_return_val_if_fail(sm_client->client_id, NULL);
 
+    prgname = g_get_prgname();
+    if(G_UNLIKELY(!prgname))
+        prgname = "unknown";
+
     resource = g_strdup_printf("sessions/%s-%s.state",
-                               sm_client->program,
-                               sm_client->client_id);
+                               prgname, sm_client->client_id);
     for(p = resource+9; *p; p++) {
         if(*p == '/')
             *p = '_';
@@ -2292,22 +2233,6 @@ xfce_sm_client_get_current_directory(XfceSMClient *sm_client)
 }
 
 /**
- * xfce_sm_client_get_program:
- * @sm_client: An #XfceSMClient
- *
- * Retrieves the session client's program identifier.  See
- * xfce_sm_client_set_program() for more information.
- *
- * Returns: an object-owned string
- **/
-G_CONST_RETURN gchar *
-xfce_sm_client_get_program(XfceSMClient *sm_client)
-{
-    g_return_val_if_fail(XFCE_IS_SM_CLIENT(sm_client), NULL);
-    return sm_client->program;
-}
-
-/**
  * xfce_sm_client_get_clone_command:
  * @sm_client: An #XfceSMClient
  *
diff --git a/libxfce4ui/xfce-sm-client.h b/libxfce4ui/xfce-sm-client.h
index 70175e4..830fd06 100644
--- a/libxfce4ui/xfce-sm-client.h
+++ b/libxfce4ui/xfce-sm-client.h
@@ -75,7 +75,6 @@ XfceSMClient *xfce_sm_client_get_with_argv(guint argc,
 XfceSMClient *xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
                                       gchar priority,
                                       const gchar *resumed_client_id,
-                                      const gchar *program,
                                       const gchar *current_directory,
                                       const gchar **restart_command,
                                       const gchar **clone_command,
@@ -109,10 +108,6 @@ void xfce_sm_client_set_current_directory(XfceSMClient *sm_client,
                                           const gchar *current_directory);
 G_CONST_RETURN gchar *xfce_sm_client_get_current_directory(XfceSMClient *sm_client);
 
-void xfce_sm_client_set_program(XfceSMClient *sm_client,
-                                const gchar *program);
-G_CONST_RETURN gchar *xfce_sm_client_get_program(XfceSMClient *sm_client);
-
 void xfce_sm_client_set_clone_command(XfceSMClient *sm_client,
                                       gchar **clone_command);
 gchar **xfce_sm_client_get_clone_command(XfceSMClient *sm_client);



More information about the Xfce4-commits mailing list