[Xfce4-commits] [apps/xfce4-panel-profiles] 26/162: Replace os.system by Terminate method from org.xfce.Panel interface (LP: #1489551) - Patch provided by Olivier Duchateau (duchateau-olivier) https://bugs.launchpad.net/xfpanel-switch/+bug/1489551/comments/1

noreply at xfce.org noreply at xfce.org
Fri Jul 13 13:08:45 CEST 2018


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

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-panel-profiles.

commit 55da9786421d89fe2e7a7bc39a66fb86406f8f3a
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Tue Sep 8 21:30:10 2015 -0400

    Replace os.system by Terminate method from org.xfce.Panel interface (LP: #1489551)
    - Patch provided by Olivier Duchateau (duchateau-olivier)
      https://bugs.launchpad.net/xfpanel-switch/+bug/1489551/comments/1
---
 xfpanel-switch/panelconfig.py | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/xfpanel-switch/panelconfig.py b/xfpanel-switch/panelconfig.py
index 0989e54..c2b0907 100644
--- a/xfpanel-switch/panelconfig.py
+++ b/xfpanel-switch/panelconfig.py
@@ -122,21 +122,29 @@ class PanelConfig(object):
         t.close()
 
     def to_xfconf(self, xfconf):
-        os.system('killall xfce4-panel')
+        session_bus = Gio.BusType.SESSION
+        conn = Gio.bus_get_sync(session_bus, None)
 
-        for (pp, pv) in sorted(self.properties.items()):
-            result = xfconf.call_sync('SetProperty', GLib.Variant(
-                '(ssv)', ('xfce4-panel', pp, pv)), 0, -1, None)
+        destination = 'org.xfce.Panel'
+        path = '/org/xfce/Panel'
+        interface = destination
 
-        panel_path = expanduser("~") + '/.config/xfce4/panel/'
-        for d in self.desktops:
-            bytes = self.get_desktop_source_file(d).read()
-            mkdir_p(panel_path + os.path.dirname(d))
-            f = open(panel_path + d, 'wb')
-            f.write(bytes)
-            f.close()
+        dbus_proxy = Gio.DBusProxy.new_sync(conn, 0, None, destination, path, interface, None)
+
+        if dbus_proxy is not None:
+            for (pp, pv) in sorted(self.properties.items()):
+                result = xfconf.call_sync('SetProperty', GLib.Variant(
+                    '(ssv)', ('xfce4-panel', pp, pv)), 0, -1, None)
+
+            panel_path = expanduser("~") + '/.config/xfce4/panel/'
+            for d in self.desktops:
+                bytes = self.get_desktop_source_file(d).read()
+                mkdir_p(panel_path + os.path.dirname(d))
+                f = open(panel_path + d, 'wb')
+                f.write(bytes)
+                f.close()
 
-        os.system('cd ~ && xfce4-panel &')
+            dbus_proxy.call_sync('Terminate', GLib.Variant('(b)', ('xfce4-panel',)), 0, -1, None)
 
 
 if __name__ == '__main__':

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


More information about the Xfce4-commits mailing list