[Xfce4-commits] <xfce4-session:dbus-add-client> WIP

Brian J. Tarricone noreply at xfce.org
Fri Jan 29 07:08:05 CET 2010


Updating branch refs/heads/dbus-add-client
         to aaa53bbbc0ddf236a1977b1fbd4bdb5270275a4b (commit)
       from cfaeaeeb62f354e0060c1c036d8a04b41f4349bb (commit)

commit aaa53bbbc0ddf236a1977b1fbd4bdb5270275a4b
Author: Brian J. Tarricone <bjt23 at cornell.edu>
Date:   Thu Apr 2 01:43:19 2009 -0700

    WIP

 xfce4-session/xfsm-client-dbus.xml |   22 ++++++++++++++++++++++
 xfce4-session/xfsm-client.c        |   19 +++++++++++++++++++
 xfce4-session/xfsm-manager.h       |   10 ++++++++++
 3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/xfce4-session/xfsm-client-dbus.xml b/xfce4-session/xfsm-client-dbus.xml
index 6d1ead4..5c021ef 100644
--- a/xfce4-session/xfsm-client-dbus.xml
+++ b/xfce4-session/xfsm-client-dbus.xml
@@ -115,6 +115,28 @@
         <method name="Terminate"/>
 
         <!--
+             (Bool, UInt) org.xfce.Session.Client.AddToSavedSession()
+
+             Forces the session manager to reopen the currently-active
+             session file, add this client to it, and then save it back
+             to disk.  This allows "important" clients to get themselves
+             added to the session without dirty hacks.
+
+             Note: the user may be prompted to confirm.
+
+             Returns: %TRUE if the client was added successfully, %FALSE
+                      otherwise.  If %FALSE, the second return arg will
+                      be an integer describing the reason for failure:
+                        0: Success/Unknown
+                        1: Write error
+                        2: User canceled
+        -->
+        <method name="AddToSavedSession">
+            <arg direction="out" name="success" type="b"/>
+            <arg direction="out" name="reason" type="u"/>
+        </method>
+
+        <!--
              void org.xfce.Session.Client.StateChanged(Unsigned Int old_state,
                                                        Unsigned Int new_state)
 
diff --git a/xfce4-session/xfsm-client.c b/xfce4-session/xfsm-client.c
index ca400d5..24af2f0 100644
--- a/xfce4-session/xfsm-client.c
+++ b/xfce4-session/xfsm-client.c
@@ -714,6 +714,10 @@ static gboolean xfsm_client_dbus_delete_sm_properties (XfsmClient *client,
                                                        GError    **error);
 static gboolean xfsm_client_dbus_terminate (XfsmClient *client,
                                             GError    **error);
+static gboolean xfsm_client_dbus_add_to_saved_session (XfsmClient *client,
+                                                       gboolean *OUT_success,
+                                                       guint *OUT_reason,
+                                                       GError **error);
 
 
 /* header needs the above fwd decls */
@@ -1001,3 +1005,18 @@ xfsm_client_dbus_terminate (XfsmClient *client,
 {
   return xfsm_manager_terminate_client (client->manager, client, error);
 }
+
+static gboolean
+xfsm_client_dbus_add_to_saved_session (XfsmClient *client,
+                                       gboolean   *OUT_success,
+                                       guint      *OUT_reason,
+                                       GError    **error)
+{
+  XfsmManagerFailureReason ret;
+
+  ret = xfsm_manager_add_client_to_saved_session (client->manager, client);
+  *OUT_success = (ret == XFSM_MANAGER_REASON_SUCCESS);
+  *OUT_reason = ret;
+
+  return TRUE;
+}
diff --git a/xfce4-session/xfsm-manager.h b/xfce4-session/xfsm-manager.h
index 1a4ffcc..1ee52b2 100644
--- a/xfce4-session/xfsm-manager.h
+++ b/xfce4-session/xfsm-manager.h
@@ -66,6 +66,13 @@ typedef enum
     XFSM_MANAGER_COMPAT_KDE,
 } XfsmManagerCompatType;
 
+typedef enum
+{
+  XFSM_MANAGER_REASON_SUCCESS = 0,
+  XFSM_MANAGER_REASON_WRITE_ERROR,
+  XFSM_MANAGER_REASON_USER_CANCELED,
+} XfsmManagerReason;
+
 typedef struct _XfsmManager  XfsmManager;
 
 GType xfsm_manager_get_type (void) G_GNUC_CONST;
@@ -155,4 +162,7 @@ gboolean xfsm_manager_get_use_failsafe_mode (XfsmManager *manager);
 gboolean xfsm_manager_get_compat_startup (XfsmManager          *manager,
                                           XfsmManagerCompatType type);
 
+XfsmManagerReason xfsm_manager_add_client_to_saved_session (XfsmManager *manager,
+                                                            XfsmClient  *client);
+
 #endif /* !__XFSM_MANAGER_H__ */



More information about the Xfce4-commits mailing list