[Xfce4-commits] [xfce/xfce4-session] 21/30: settings: Port to GDBus

noreply at xfce.org noreply at xfce.org
Sun May 15 18:03:40 CEST 2016


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-session.

commit 38a8819834264020c5de6c628c8d402dc11e58dd
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Mon Apr 25 10:32:56 2016 +0300

    settings: Port to GDBus
---
 configure.ac.in           |   1 +
 settings/Makefile.am      |  30 +++--
 settings/session-editor.c | 271 +++++++++++++++++++++++++++-------------------
 3 files changed, 180 insertions(+), 122 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 5e56170..c1dc763 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -103,6 +103,7 @@ dnl Check for required packages
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.12.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0])
 XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.10.0])
+XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.42.0])
 XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.24.0])
 XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-3.0], [3.10])
 XDT_CHECK_PACKAGE([DBUS], [dbus-1], [1.1.0])
diff --git a/settings/Makefile.am b/settings/Makefile.am
index 4ca79ad..2afc69e 100644
--- a/settings/Makefile.am
+++ b/settings/Makefile.am
@@ -17,7 +17,9 @@ xfce4_session_settings_SOURCES = \
 	xfce4-session-settings-common.h \
 	xfce4-session-settings_ui.h \
 	xfsm-client-dbus-client.h \
-	xfsm-manager-dbus-client.h
+	xfsm-client-dbus-client.c \
+	xfsm-manager-dbus-client.h \
+	xfsm-manager-dbus-client.c
 
 xfce4_session_settings_CFLAGS = \
 	-DLOCALEDIR=\"$(localedir)\" \
@@ -27,7 +29,7 @@ xfce4_session_settings_CFLAGS = \
 	$(LIBXFCE4UTIL_CFLAGS) \
 	$(LIBXFCE4UI_CFLAGS) \
 	$(XFCONF_CFLAGS) \
-	$(DBUS_GLIB_CFLAGS) \
+	$(GIO_CFLAGS) \
 	$(GMODULE_CFLAGS)
 
 xfce4_session_settings_LDADD = \
@@ -35,7 +37,7 @@ xfce4_session_settings_LDADD = \
 	$(LIBXFCE4UTIL_CFLAGS) \
 	$(LIBXFCE4UI_LIBS) \
 	$(XFCONF_LIBS) \
-	$(DBUS_GLIB_LIBS) \
+	$(GIO_LIBS) \
 	$(GMODULE_LIBS)
 
 xfce4_session_settings_DEPENDENCIES = \
@@ -58,7 +60,9 @@ BUILT_SOURCES = \
 	xfce4-session-marshal.h \
 	xfce4-session-settings_ui.h \
 	xfsm-client-dbus-client.h \
-	xfsm-manager-dbus-client.h
+	xfsm-client-dbus-client.c \
+	xfsm-manager-dbus-client.h \
+	xfsm-manager-dbus-client.c
 
 xfce4-session-marshal.h: stamp-xfce4-session-marshal.h
 	@true
@@ -72,11 +76,19 @@ xfce4-session-marshal.c: xfce4-session-marshal.list Makefile
 xfce4-session-settings_ui.h: xfce4-session-settings.ui
 	$(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=xfce4_session_settings_ui $< >$@
 
-xfsm-client-dbus-client.h: $(top_srcdir)/xfce4-session/xfsm-client-dbus.xml Makefile
-	$(AM_V_GEN) dbus-binding-tool --mode=glib-client $(top_srcdir)/xfce4-session/xfsm-client-dbus.xml > $@
-
-xfsm-manager-dbus-client.h: $(top_srcdir)/xfce4-session/xfsm-manager-dbus.xml Makefile
-	$(AM_V_GEN) dbus-binding-tool --mode=glib-client $(top_srcdir)/xfce4-session/xfsm-manager-dbus.xml > $@
+xfsm-client-dbus-client.c xfsm-client-dbus-client.h : $(top_srcdir)/xfce4-session/xfsm-client-dbus.xml Makefile.am
+	gdbus-codegen \
+		--c-namespace=Xfsm \
+		--interface-prefix=org.xfce.Session. \
+		--generate-c-code=xfsm-client-dbus-client \
+		$(top_srcdir)/xfce4-session/xfsm-client-dbus.xml
+
+xfsm-manager-dbus-client.c xfsm-manager-dbus-client.h : $(top_srcdir)/xfce4-session/xfsm-manager-dbus.xml Makefile.am
+	gdbus-codegen \
+		--c-namespace=Xfsm \
+		--interface-prefix=org.xfce.Session. \
+		--generate-c-code=xfsm-manager-dbus-client \
+		$(top_srcdir)/xfce4-session/xfsm-manager-dbus.xml
 
 endif
 
diff --git a/settings/session-editor.c b/settings/session-editor.c
index 32bc019..afc2239 100644
--- a/settings/session-editor.c
+++ b/settings/session-editor.c
@@ -28,7 +28,7 @@
 #include <gtk/gtk.h>
 #include <glib/gstdio.h>
 
-#include <dbus/dbus-glib.h>
+#include <gio/gio.h>
 
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
@@ -65,40 +65,37 @@ static const gchar *restart_styles[] = {
     NULL,
 };
 
-static DBusGConnection *dbus_conn = NULL;
-static DBusGProxy *manager_dbus_proxy = NULL;
+static XfsmManager *manager_dbus_proxy = NULL;
 
 
 static gboolean
 session_editor_ensure_dbus(void)
 {
-    if(G_UNLIKELY(!dbus_conn)) {
-        GError *error = NULL;
+    GError *error = NULL;
 
-        dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
-        if(!dbus_conn) {
-            g_critical("Unable to connect to D-Bus session bus: %s",
-                       error ? error->message : "Unknown error");
-            if(error)
-                g_error_free(error);
-        }
+    TRACE("entering");
 
-        manager_dbus_proxy = dbus_g_proxy_new_for_name(dbus_conn,
-                                                       "org.xfce.SessionManager",
-                                                       "/org/xfce/SessionManager",
-                                                       "org.xfce.Session.Manager");
+    if (manager_dbus_proxy)
+        return TRUE;
 
-        dbus_g_proxy_add_signal(manager_dbus_proxy, "ClientRegistered",
-                                G_TYPE_STRING, G_TYPE_INVALID);
-        dbus_g_proxy_add_signal(manager_dbus_proxy, "StateChanged",
-                                G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
+    manager_dbus_proxy = xfsm_manager_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
+                                                             G_DBUS_PROXY_FLAGS_NONE,
+                                                             "org.xfce.SessionManager",
+                                                             "/org/xfce/SessionManager",
+                                                             NULL,
+                                                             &error);
+
+    if (manager_dbus_proxy == NULL) {
+        g_error ("error connecting to org.xfce.SessionManager, reason was: %s", error->message);
+        g_clear_error(&error);
+        return FALSE;
     }
 
-    return !!dbus_conn;
+    return TRUE;
 }
 
 static void
-manager_state_changed_saving(DBusGProxy *proxy,
+manager_state_changed_saving(XfsmManager *proxy,
                              guint old_state,
                              guint new_state,
                              gpointer user_data)
@@ -120,11 +117,14 @@ session_editor_save_session(GtkWidget *btn,
 {
     GtkWidget *pbar = g_object_get_data(G_OBJECT(dialog), "pbar");
     guint pulse_id;
+    guint sig_id;
     GError *error = NULL;
 
+    TRACE("entering");
+
     gtk_widget_set_sensitive(btn, FALSE);
 
-    if(!xfsm_manager_dbus_client_checkpoint(manager_dbus_proxy, "", &error)) {
+    if(!xfsm_manager_call_checkpoint_sync(manager_dbus_proxy, "", NULL, &error)) {
         xfce_message_dialog(GTK_WINDOW(gtk_widget_get_toplevel(btn)),
                             _("Session Save Error"), "dialog-error",
                             _("Unable to save the session"),
@@ -136,17 +136,15 @@ session_editor_save_session(GtkWidget *btn,
         return;
     }
 
-    dbus_g_proxy_connect_signal(manager_dbus_proxy, "StateChanged",
-                                G_CALLBACK(manager_state_changed_saving),
-                                dialog, NULL);
+    sig_id = g_signal_connect(manager_dbus_proxy, "state_changed",
+                              G_CALLBACK(manager_state_changed_saving),
+                              dialog);
     pulse_id = g_timeout_add(250, pulse_session_save_dialog, pbar);
 
     gtk_dialog_run(GTK_DIALOG(dialog));
 
     g_source_remove(pulse_id);
-    dbus_g_proxy_disconnect_signal(manager_dbus_proxy, "StateChanged",
-                                   G_CALLBACK(manager_state_changed_saving),
-                                   dialog);
+    g_signal_handler_disconnect(manager_dbus_proxy, sig_id);
     gtk_widget_hide(dialog);
     gtk_widget_set_sensitive(btn, TRUE);
 }
@@ -164,6 +162,8 @@ static void
 session_editor_clear_sessions(GtkWidget *btn,
                               GtkWidget *treeview)
 {
+    TRACE("entering");
+
     gtk_widget_set_sensitive(btn, FALSE);
 
     if(xfce_message_dialog(GTK_WINDOW(gtk_widget_get_toplevel(treeview)),
@@ -231,11 +231,13 @@ session_editor_quit_client(GtkWidget *btn,
     GtkTreeSelection *sel;
     GtkTreeModel *model = NULL;
     GtkTreeIter iter;
-    DBusGProxy *proxy = NULL;
+    XfsmClient *proxy = NULL;
     gchar *name = NULL;
     guchar hint = SmRestartIfRunning;
     gchar *primary;
 
+    TRACE("entering");
+
     sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
     if(!gtk_tree_selection_get_selected(sel, &model, &iter))
         return;
@@ -261,21 +263,25 @@ session_editor_quit_client(GtkWidget *btn,
         if(hint != SmRestartIfRunning) {
             GHashTable *properties = g_hash_table_new(g_str_hash, g_str_equal);
             GValue val = { 0, };
+            GVariant *variant;
 
             g_value_init(&val, G_TYPE_UCHAR);
             g_value_set_uchar(&val, SmRestartIfRunning);
             g_hash_table_insert(properties, SmRestartStyleHint, &val);
 
-            if(!xfsm_client_dbus_client_set_sm_properties(proxy, properties, &error)) {
+            variant = g_variant_new ("a{sv}", properties);
+
+            if(!xfsm_client_call_set_sm_properties_sync(proxy, variant, NULL, &error)) {
                 /* FIXME: show error */
                 g_error_free(error);
             }
 
             g_value_unset(&val);
             g_hash_table_destroy(properties);
+            g_variant_unref(variant);
         }
 
-        if(!xfsm_client_dbus_client_terminate(proxy, &error)) {
+        if(!xfsm_client_call_terminate_sync(proxy, NULL, &error)) {
             xfce_message_dialog(GTK_WINDOW(gtk_widget_get_toplevel(treeview)),
                                 _("Terminate Program"), "dialog-error",
                                 _("Unable to terminate program."),
@@ -299,6 +305,8 @@ session_editor_set_from_desktop_file(GtkTreeModel *model,
     XfceRc *rcfile;
     const gchar *name, *icon;
 
+    TRACE("entering");
+
     rcfile = xfce_rc_simple_open(desktop_file, TRUE);
     if(!rcfile)
         return;
@@ -329,7 +337,7 @@ session_editor_set_from_desktop_file(GtkTreeModel *model,
 }
 
 static void
-client_sm_property_changed(DBusGProxy *proxy,
+client_sm_property_changed(XfsmClient *proxy,
                            const gchar *name,
                            const GValue *value,
                            gpointer user_data)
@@ -342,6 +350,8 @@ client_sm_property_changed(DBusGProxy *proxy,
     GtkTreeIter iter;
     gboolean has_desktop_file = FALSE;
 
+    TRACE("entering");
+
     if(!gtk_tree_model_get_iter(model, &iter, path)) {
         gtk_tree_path_free(path);
         return;
@@ -383,13 +393,15 @@ client_sm_property_changed(DBusGProxy *proxy,
 }
 
 static void
-client_state_changed(DBusGProxy *proxy,
+client_state_changed(XfsmClient *proxy,
                      guint old_state,
                      guint new_state,
                      gpointer user_data)
 {
     GtkTreeView *treeview = user_data;
 
+    TRACE("entering");
+
     if(new_state == 7) {  /* disconnected.  FIXME: enum this */
         GtkTreeModel *model = gtk_tree_view_get_model(treeview);
         GtkTreeRowReference *rref = g_object_get_data(G_OBJECT(proxy),
@@ -407,7 +419,7 @@ client_state_changed(DBusGProxy *proxy,
 }
 
 static void
-manager_client_registered(DBusGProxy *proxy,
+manager_client_registered(XfsmManager *proxy,
                           const gchar *object_path,
                           gpointer user_data)
 {
@@ -415,26 +427,39 @@ manager_client_registered(DBusGProxy *proxy,
     GtkTreeModel *model = gtk_tree_view_get_model(treeview);
     GtkTreePath *path;
     GtkTreeIter iter;
-    DBusGProxy *client_proxy;
-    GHashTable *properties = NULL;
+    XfsmClient *client_proxy;
     const gchar *propnames[] = {
         SmProgram, SmRestartStyleHint,SmProcessID, GsmPriority,
         GsmDesktopFile, NULL
     };
-    GValue *val;
-    const gchar *name = NULL, *pid = NULL;
+    const gchar *name = NULL, *pid = NULL, *desktop_file = NULL;
     guchar hint = SmRestartIfRunning, priority = 50;
+    GVariant *variant, *variant_value;
+    GVariantIter *variant_iter;
+    gchar *property;
     GError *error = NULL;
 
+    TRACE("entering");
+
     DBG("new client at %s", object_path);
 
-    client_proxy = dbus_g_proxy_new_for_name(dbus_conn,
-                                             "org.xfce.SessionManager",
-                                             object_path,
-                                             "org.xfce.Session.Client");
+    client_proxy = xfsm_client_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
+                                                      G_DBUS_PROXY_FLAGS_NONE,
+                                                      "org.xfce.SessionManager",
+                                                      object_path,
+                                                      NULL,
+                                                      &error);
 
-    if(!xfsm_client_dbus_client_get_sm_properties(client_proxy, propnames,
-                                                  &properties, &error))
+    if(error != NULL)
+    {
+        g_warning("Unable to connect to org.xfce.SessionManager, reason: %s",
+                  error->message);
+        g_clear_error(&error);
+        return;
+    }
+
+    if(!xfsm_client_call_get_sm_properties_sync(client_proxy, propnames,
+                                                &variant, NULL, &error))
     {
         g_warning("Unable to get properties for client at %s: %s",
                   object_path, error->message);
@@ -443,17 +468,42 @@ manager_client_registered(DBusGProxy *proxy,
         return;
     }
 
-    if((val = g_hash_table_lookup(properties, SmProgram)))
-        name = g_value_get_string(val);
-    if((val = g_hash_table_lookup(properties, SmRestartStyleHint))) {
-        hint = g_value_get_uchar(val);
-        if(hint > SmRestartNever)
-            hint = SmRestartIfRunning;
+    g_variant_get((GVariant *)variant, "a{sv}", &variant_iter);
+    while(g_variant_iter_next(variant_iter, "{sv}", &property, &variant_value))
+    {
+            if(g_strcmp0(property, SmProgram) == 0)
+            {
+                name = g_variant_get_string(variant_value, 0);
+                DBG("name %s", name);
+            }
+            else if(g_strcmp0(property, SmRestartStyleHint) == 0)
+            {
+                hint = g_variant_get_byte(variant_value);
+                if(hint > SmRestartNever)
+                {
+                    hint = SmRestartIfRunning;
+                }
+                DBG("hint %d", hint);
+            }
+            else if(g_strcmp0(property, GsmPriority) == 0)
+            {
+                priority = g_variant_get_byte(variant_value);
+                DBG("priority %d", priority);
+            }
+            else if(g_strcmp0(property, SmProgram) == 0)
+            {
+                pid = g_variant_get_string(variant_value, 0);
+                DBG("pid %s", pid);
+            }
+            else if(g_strcmp0(property, GsmDesktopFile) == 0)
+            {
+                desktop_file = g_variant_get_string(variant_value, 0);
+                DBG("desktop_file %s", desktop_file);
+            }
+
+            g_free (property);
+            g_variant_unref (variant_value);
     }
-    if((val = g_hash_table_lookup(properties, GsmPriority)))
-        priority = g_value_get_uchar(val);
-    if((val = g_hash_table_lookup(properties, SmProcessID)))
-        pid = g_value_get_string(val);
 
     if(!name || !*name)
         name = _("(Unknown program)");
@@ -470,11 +520,9 @@ manager_client_registered(DBusGProxy *proxy,
                        COL_PID, pid,
                        -1);
 
-    if((val = g_hash_table_lookup(properties, GsmDesktopFile))
-       && G_VALUE_HOLDS_STRING(val))
+    if(desktop_file != NULL)
     {
-        session_editor_set_from_desktop_file(model, &iter,
-                                             g_value_get_string(val));
+        session_editor_set_from_desktop_file(model, &iter, desktop_file);
     }
 
     path = gtk_tree_model_get_path(model, &iter);
@@ -483,21 +531,15 @@ manager_client_registered(DBusGProxy *proxy,
                            (GDestroyNotify)gtk_tree_row_reference_free);
     gtk_tree_path_free(path);
 
-    dbus_g_proxy_add_signal(client_proxy, "SmPropertyChanged",
-                            G_TYPE_STRING, G_TYPE_VALUE,
-                            G_TYPE_INVALID);
-    dbus_g_proxy_connect_signal(client_proxy, "SmPropertyChanged",
-                                G_CALLBACK(client_sm_property_changed),
-                                treeview, NULL);
+    g_signal_connect(client_proxy, "sm_property_changed",
+                     G_CALLBACK(client_sm_property_changed),
+                     treeview);
 
     /* proxy will live as long as the client does */
-    dbus_g_proxy_add_signal(client_proxy, "StateChanged",
-                            G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
-    dbus_g_proxy_connect_signal(client_proxy, "StateChanged",
-                                G_CALLBACK(client_state_changed), treeview,
-                                NULL);
+    g_signal_connect(client_proxy, "state_changed",
+                     G_CALLBACK(client_state_changed), treeview);
 
-    g_hash_table_destroy(properties);
+    g_variant_unref(variant);
 }
 
 static GtkTreeModel *
@@ -507,6 +549,8 @@ session_editor_create_restart_style_combo_model(void)
     GtkTreeIter iter;
     gint i;
 
+    TRACE("entering");
+
     for(i = 0; restart_styles[i]; ++i) {
         gtk_list_store_append(ls, &iter);
         gtk_list_store_set(ls, &iter, 0, _(restart_styles[i]), -1);
@@ -526,8 +570,10 @@ priority_changed(GtkCellRenderer *render,
     GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
     GtkTreeIter iter;
 
+    TRACE("entering");
+
     if(gtk_tree_model_get_iter(model, &iter, path)) {
-        DBusGProxy *proxy = NULL;
+        XfsmClient *proxy = NULL;
         gint new_prio_i = atoi(new_text);
         guchar old_prio, new_prio;
 
@@ -543,22 +589,25 @@ priority_changed(GtkCellRenderer *render,
                            COL_DBUS_PROXY, &proxy,
                            COL_PRIORITY, &old_prio,
                            -1);
+
+        DBG("old_prio %d, new_prio %d", old_prio, new_prio);
+
         if(old_prio != new_prio) {
-            GHashTable *properties = g_hash_table_new(g_str_hash, g_str_equal);
-            GValue val = { 0, };
+            GVariantBuilder properties;
+            GVariant *variant;
             GError *error = NULL;
 
-            g_value_init(&val, G_TYPE_UCHAR);
-            g_value_set_uchar(&val, new_prio);
-            g_hash_table_insert(properties, GsmPriority, &val);
+            g_variant_builder_init (&properties, G_VARIANT_TYPE ("a{sv}"));
+            variant = g_variant_new_byte(new_prio);
+            g_variant_builder_add (&properties, "{sv}", GsmPriority, variant);
 
-            if(!xfsm_client_dbus_client_set_sm_properties(proxy, properties, &error)) {
-                /* FIXME: show error */
+            if(!xfsm_client_call_set_sm_properties_sync(proxy, g_variant_builder_end (&properties), NULL, &error)) {
+                g_error("error setting 'GsmPriority', error: %s", error->message);
                 g_error_free(error);
             }
 
-            g_value_unset(&val);
-            g_hash_table_destroy(properties);
+            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                COL_PRIORITY, new_prio, -1);
         }
 
         g_object_unref(proxy);
@@ -578,10 +627,12 @@ restart_style_hint_changed(GtkCellRenderer *render,
     GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
     GtkTreeIter iter;
 
+    TRACE("entering");
+
     if(gtk_tree_model_get_iter(model, &iter, path)) {
         gint i;
         guchar old_hint = SmRestartIfRunning, hint;
-        DBusGProxy *proxy = NULL;
+        XfsmClient *proxy = NULL;
 
         gtk_tree_model_get(GTK_TREE_MODEL(model), &iter,
                            COL_DBUS_PROXY, &proxy,
@@ -595,23 +646,22 @@ restart_style_hint_changed(GtkCellRenderer *render,
             }
         }
 
+        DBG("old_hint %d, hint %d", old_hint, hint);
+
         if(old_hint != hint) {
-            GHashTable *properties = g_hash_table_new(g_str_hash, g_str_equal);
-            GValue val = { 0, };
+            GVariantBuilder properties;
+            GVariant *variant;
             GError *error = NULL;
 
-            g_value_init(&val, G_TYPE_UCHAR);
-            g_value_set_uchar(&val, hint);
-            g_hash_table_insert(properties, SmRestartStyleHint, &val);
+            g_variant_builder_init (&properties, G_VARIANT_TYPE ("a{sv}"));
+            variant = g_variant_new_byte(hint);
+            g_variant_builder_add (&properties, "{sv}", SmRestartStyleHint, variant);
 
-            if(!xfsm_client_dbus_client_set_sm_properties(proxy, properties, &error)) {
-                /* FIXME: show error */
-                g_error_free(error);
+            if(!xfsm_client_call_set_sm_properties_sync(proxy, g_variant_builder_end (&properties), NULL, &error)) {
+                g_error("error setting 'SmRestartStyleHint', error: %s", error->message);
+                g_clear_error(&error);
             }
 
-            g_value_unset(&val);
-            g_hash_table_destroy(properties);
-
             gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                                 COL_RESTART_STYLE_STR, new_text, -1);
         }
@@ -630,6 +680,8 @@ session_tree_compare_iter(GtkTreeModel *model,
 {
     guchar aprio = 0, bprio = 0;
 
+    TRACE("entering");
+
     gtk_tree_model_get(model, a, COL_PRIORITY, &aprio, -1);
     gtk_tree_model_get(model, b, COL_PRIORITY, &bprio, -1);
 
@@ -666,11 +718,13 @@ session_editor_populate_treeview(GtkTreeView *treeview)
     GtkCellRenderer *render;
     GtkTreeViewColumn *col;
     GtkTreeModel *combo_model;
-    GPtrArray *clients = NULL;
+    gchar **clients = NULL;
     GtkListStore *ls;
     guint i;
     GError *error = NULL;
 
+    TRACE("entering");
+
     render = gtk_cell_renderer_text_new();
     g_object_set(render,
                  "editable", TRUE,
@@ -729,7 +783,7 @@ session_editor_populate_treeview(GtkTreeView *treeview)
     ls = gtk_list_store_new(N_COLS, G_TYPE_STRING, G_TYPE_STRING,
                             G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UCHAR,
                             G_TYPE_STRING, G_TYPE_UCHAR, G_TYPE_STRING,
-                            DBUS_TYPE_G_PROXY, G_TYPE_BOOLEAN);
+                            G_TYPE_OBJECT, G_TYPE_BOOLEAN);
     gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(ls));
     gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(ls),
                                             session_tree_compare_iter,
@@ -739,12 +793,12 @@ session_editor_populate_treeview(GtkTreeView *treeview)
                                          GTK_SORT_ASCENDING);
     g_object_unref(ls);
 
-    dbus_g_proxy_connect_signal(manager_dbus_proxy, "ClientRegistered",
-                                G_CALLBACK(manager_client_registered),
-                                treeview, NULL);
+    g_signal_connect(manager_dbus_proxy, "client_registered",
+                     G_CALLBACK(manager_client_registered),
+                     treeview);
 
-    if(!xfsm_manager_dbus_client_list_clients(manager_dbus_proxy,
-                                              &clients, &error))
+    if(!xfsm_manager_call_list_clients_sync(manager_dbus_proxy,
+                                            &clients, NULL, &error))
     {
         g_critical("Unable to query session manager for client list: %s",
                    error->message);
@@ -752,13 +806,12 @@ session_editor_populate_treeview(GtkTreeView *treeview)
         return;
     }
 
-    for(i = 0; i < clients->len; ++i) {
-        gchar *client_op = g_ptr_array_index(clients, i);
+    for(i = 0; clients[i] != NULL; ++i) {
+        gchar *client_op = clients[i];
         manager_client_registered(manager_dbus_proxy, client_op, treeview);
-        g_free(client_op);
     }
 
-    g_ptr_array_free(clients, TRUE);
+    g_strfreev(clients);
 }
 
 void
@@ -768,15 +821,7 @@ session_editor_init(GtkBuilder *builder)
     GtkTreeView *treeview;
     GtkTreeSelection *sel;
 
-    dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__STRING,
-                                      G_TYPE_NONE, G_TYPE_STRING,
-                                      G_TYPE_INVALID);
-    dbus_g_object_register_marshaller(xfce4_session_marshal_VOID__STRING_BOXED,
-                                      G_TYPE_NONE, G_TYPE_STRING,
-                                      G_TYPE_VALUE, G_TYPE_INVALID);
-    dbus_g_object_register_marshaller(xfce4_session_marshal_VOID__UINT_UINT,
-                                      G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT,
-                                      G_TYPE_INVALID);
+    TRACE("entering");
 
     treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview_clients"));
     sel = gtk_tree_view_get_selection(treeview);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list