[gnome-settings-daemon/wip/muktupavels/flashback: 1/7] gnome-settings-daemon: split out OSD from org.gnome.Shell



commit 94378243fd7974eac2d25e9b0648b687e9a3e94a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Dec 13 23:59:08 2014 +0200

    gnome-settings-daemon: split out OSD from org.gnome.Shell
    
    OSD can be reused in other desktop environments that are using
    GNOME components.

 .gitignore                                    |    2 +
 gnome-settings-daemon/Makefile.am             |   15 +++++++++++
 gnome-settings-daemon/gnome-settings-bus.c    |   30 ++++++++++++++++++++++
 gnome-settings-daemon/gnome-settings-bus.h    |    2 +
 gnome-settings-daemon/org.gnome.Shell.OSD.xml |   33 +++++++++++++++++++++++++
 gnome-settings-daemon/org.gnome.Shell.xml     |    3 --
 6 files changed, 82 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e4e5725..c16bfdf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,8 @@ gnome-settings-daemon/gsd-session-manager-glue.c
 gnome-settings-daemon/gsd-session-manager-glue.h
 gnome-settings-daemon/gsd-shell-glue.c
 gnome-settings-daemon/gsd-shell-glue.h
+gnome-settings-daemon/gsd-shell-osd-glue.c
+gnome-settings-daemon/gsd-shell-osd-glue.h
 data/*.pc
 data/*.xml
 data/*.xml.in
diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am
index dd901c7..0972c83 100644
--- a/gnome-settings-daemon/Makefile.am
+++ b/gnome-settings-daemon/Makefile.am
@@ -58,10 +58,24 @@ $(shell_dbus_built_sources) : Makefile.am org.gnome.Shell.xml
                           "org.gtk.GDBus.C.Name" Shell         \
                $(srcdir)/org.gnome.Shell.xml
 
+shell_osd_dbus_built_sources = gsd-shell-osd-glue.c gsd-shell-osd-glue.h
+
+BUILT_SOURCES += $(shell_osd_dbus_built_sources)
+
+$(shell_osd_dbus_built_sources) : Makefile.am org.gnome.Shell.OSD.xml
+       gdbus-codegen                                           \
+               --interface-prefix org.gnome.Shell.OSD          \
+               --generate-c-code gsd-shell-osd-glue            \
+               --c-namespace Gsd                               \
+               --annotate "org.gnome.Shell.OSD"                \
+                          "org.gtk.GDBus.C.Name" ShellOSD      \
+               $(srcdir)/org.gnome.Shell.OSD.xml
+
 libgsd_la_SOURCES =            \
        $(session_manager_dbus_built_sources) \
        $(screen_saver_dbus_built_sources) \
        $(shell_dbus_built_sources)     \
+       $(shell_osd_dbus_built_sources) \
        gnome-settings-profile.c        \
        gnome-settings-profile.h        \
        gnome-settings-bus.c    \
@@ -101,6 +115,7 @@ EXTRA_DIST = \
        org.gnome.SessionManager.xml        \
        org.gnome.ScreenSaver.xml           \
        org.gnome.Shell.xml                 \
+       org.gnome.Shell.OSD.xml             \
        $(NULL)
 
 gnome-settings-daemon-localeexec: gnome-settings-daemon-localeexec.in
diff --git a/gnome-settings-daemon/gnome-settings-bus.c b/gnome-settings-daemon/gnome-settings-bus.c
index cd1a686..baf0cf4 100644
--- a/gnome-settings-daemon/gnome-settings-bus.c
+++ b/gnome-settings-daemon/gnome-settings-bus.c
@@ -42,6 +42,9 @@
 #define GNOME_SHELL_DBUS_NAME      "org.gnome.Shell"
 #define GNOME_SHELL_DBUS_OBJECT    "/org/gnome/Shell"
 
+#define GNOME_SHELL_OSD_DBUS_NAME   "org.gnome.Shell.OSD"
+#define GNOME_SHELL_OSD_DBUS_OBJECT "/org/gnome/Shell/OSD"
+
 GsdSessionManager *
 gnome_settings_bus_get_session_proxy (void)
 {
@@ -122,6 +125,33 @@ gnome_settings_bus_get_shell_proxy (void)
         return shell_proxy;
 }
 
+GsdShellOSD *
+gnome_settings_bus_get_shell_osd_proxy (void)
+{
+        static GsdShellOSD *proxy = NULL;
+        GError *error =  NULL;
+
+        if (proxy != NULL) {
+                g_object_ref (proxy);
+        } else {
+                proxy = gsd_shell_osd_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+                                                              G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+                                                              G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+                                                              GNOME_SHELL_OSD_DBUS_NAME,
+                                                              GNOME_SHELL_OSD_DBUS_OBJECT,
+                                                              NULL,
+                                                              &error);
+                if (error) {
+                        g_warning ("Failed to connect to the shell osd: %s", error->message);
+                        g_error_free (error);
+                } else {
+                        g_object_add_weak_pointer (G_OBJECT (proxy), (gpointer*)&proxy);
+                }
+        }
+
+        return proxy;
+}
+
 char *
 gnome_settings_get_chassis_type (void)
 {
diff --git a/gnome-settings-daemon/gnome-settings-bus.h b/gnome-settings-daemon/gnome-settings-bus.h
index 1d14980..8ebb9b8 100644
--- a/gnome-settings-daemon/gnome-settings-bus.h
+++ b/gnome-settings-daemon/gnome-settings-bus.h
@@ -26,12 +26,14 @@
 #include "gsd-session-manager-glue.h"
 #include "gsd-screen-saver-glue.h"
 #include "gsd-shell-glue.h"
+#include "gsd-shell-osd-glue.h"
 
 G_BEGIN_DECLS
 
 GsdSessionManager        *gnome_settings_bus_get_session_proxy       (void);
 GsdScreenSaver           *gnome_settings_bus_get_screen_saver_proxy  (void);
 GsdShell                 *gnome_settings_bus_get_shell_proxy         (void);
+GsdShellOSD              *gnome_settings_bus_get_shell_osd_proxy     (void);
 gboolean                  gnome_settings_is_wayland                  (void);
 char *                    gnome_settings_get_chassis_type            (void);
 
diff --git a/gnome-settings-daemon/org.gnome.Shell.OSD.xml b/gnome-settings-daemon/org.gnome.Shell.OSD.xml
new file mode 100644
index 0000000..6ae88d6
--- /dev/null
+++ b/gnome-settings-daemon/org.gnome.Shell.OSD.xml
@@ -0,0 +1,33 @@
+<!DOCTYPE node PUBLIC
+        "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+        "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
+
+<!--
+        Copyright (C) 2013 Red Hat, Inc.
+
+        This library is free software; you can redistribute it and/or
+        modify it under the terms of the GNU Lesser General Public
+        License as published by the Free Software Foundation; either
+        version 2 of the License, or (at your option) any later version.
+
+        This library is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+        Lesser General Public License for more details.
+
+        You should have received a copy of the GNU Lesser General
+        Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
+-->
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+  <!--
+      org.gnome.Shell:
+
+      An interface used to request shell features.
+  -->
+  <interface name="org.gnome.Shell.OSD">
+    <method name="ShowOSD">
+      <arg type="a{sv}" direction="in" name="params"/>
+    </method>
+  </interface>
+</node>
diff --git a/gnome-settings-daemon/org.gnome.Shell.xml b/gnome-settings-daemon/org.gnome.Shell.xml
index 1845dde..d9e5bf9 100644
--- a/gnome-settings-daemon/org.gnome.Shell.xml
+++ b/gnome-settings-daemon/org.gnome.Shell.xml
@@ -27,8 +27,5 @@
   -->
   <interface name="org.gnome.Shell">
     <method name="FocusSearch"/>
-    <method name="ShowOSD">
-      <arg type="a{sv}" direction="in" name="params"/>
-    </method>
   </interface>
 </node>


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