[gnome-flashback] shell: move D-Bus interface files to libdbus



commit 30b4fddd4d61e6c14cfabc3214a1c01f4abb0c53
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Dec 17 13:59:03 2019 +0200

    shell: move D-Bus interface files to libdbus

 dbus/Makefile.am                                   |   9 ++
 .../libshell => dbus}/org.gnome.Shell.xml          |  19 +++-
 gnome-flashback/libshell/Makefile.am               |  27 +----
 gnome-flashback/libshell/flashback-shell.c         | 115 +++++++++------------
 4 files changed, 78 insertions(+), 92 deletions(-)
---
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index 4b59bac..aa66b6c 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -81,6 +81,12 @@ gf-screensaver-gen.c: org.gnome.ScreenSaver.xml
                --generate-c-code gf-screensaver-gen \
                $(srcdir)/org.gnome.ScreenSaver.xml
 
+gf-shell-gen.h:
+gf-shell-gen.c: org.gnome.Shell.xml
+       $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
+               --generate-c-code gf-shell-gen \
+               $(srcdir)/org.gnome.Shell.xml
+
 gf-sm-presence-gen.h:
 gf-sm-presence-gen.c: org.gnome.SessionManager.Presence.xml
        $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
@@ -112,6 +118,8 @@ BUILT_SOURCES = \
        gf-nautilus-gen.h \
        gf-screensaver-gen.c \
        gf-screensaver-gen.h \
+       gf-shell-gen.c \
+       gf-shell-gen.h \
        gf-sm-presence-gen.c \
        gf-sm-presence-gen.h \
        gf-sn-watcher-v0-gen.c \
@@ -129,6 +137,7 @@ EXTRA_DIST = \
        org.gnome.Nautilus.FileOperations.xml \
        org.gnome.ScreenSaver.xml \
        org.gnome.SessionManager.Presence.xml \
+       org.gnome.Shell.xml \
        org.kde.StatusNotifierWatcher.xml \
        $(NULL)
 
diff --git a/gnome-flashback/libshell/org.gnome.Shell.xml b/dbus/org.gnome.Shell.xml
similarity index 87%
rename from gnome-flashback/libshell/org.gnome.Shell.xml
rename to dbus/org.gnome.Shell.xml
index bc3b37b..c3294ff 100644
--- a/gnome-flashback/libshell/org.gnome.Shell.xml
+++ b/dbus/org.gnome.Shell.xml
@@ -1,47 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
 <node>
   <interface name="org.gnome.Shell">
-    <annotation name="org.gtk.GDBus.C.Name" value="DBusShell" />
+    <annotation name="org.gtk.GDBus.C.Name" value="ShellGen" />
+
     <method name="Eval">
       <arg type="s" direction="in" name="script" />
       <arg type="b" direction="out" name="success" />
       <arg type="s" direction="out" name="result" />
     </method>
+
     <method name="FocusSearch"/>
+
     <method name="ShowOSD">
       <arg type="a{sv}" direction="in" name="params" />
     </method>
+
     <method name="ShowMonitorLabels">
       <arg type="a{sv}" direction="in" name="params" />
     </method>
+
     <method name="HideMonitorLabels" />
+
     <method name="FocusApp">
       <arg type="s" direction="in" name="id" />
     </method>
+
     <method name="ShowApplications" />
+
     <method name="GrabAccelerator">
       <arg type="s" direction="in" name="accelerator" />
       <arg type="u" direction="in" name="modeFlags" />
       <arg type="u" direction="in" name="grabFlags" />
       <arg type="u" direction="out" name="action" />
     </method>
+
     <method name="GrabAccelerators">
       <arg type="a(suu)" direction="in" name="accelerators" />
       <arg type="au" direction="out" name="actions" />
     </method>
+
     <method name="UngrabAccelerator">
       <arg type="u" direction="in" name="action" />
       <arg type="b" direction="out" name="success" />
     </method>
+
     <method name="UngrabAccelerators">
       <arg type="au" direction="in" name="actions" />
       <arg type="b" direction="out" name="success" />
     </method>
+
     <signal name="AcceleratorActivated">
       <arg name="action" type="u" />
       <arg name="parameters" type="a{sv}" />
     </signal>
+
     <property name="Mode" type="s" access="read" />
     <property name="OverviewActive" type="b" access="readwrite" />
     <property name="ShellVersion" type="s" access="read" />
+
   </interface>
 </node>
diff --git a/gnome-flashback/libshell/Makefile.am b/gnome-flashback/libshell/Makefile.am
index 688c4bc..e0dec19 100644
--- a/gnome-flashback/libshell/Makefile.am
+++ b/gnome-flashback/libshell/Makefile.am
@@ -11,6 +11,7 @@ libshell_la_CPPFLAGS = \
        -I$(top_builddir)/gnome-flashback/libshell \
        -I$(top_srcdir)/gnome-flashback \
        -I$(top_srcdir) \
+       $(AM_CPPFLAGS) \
        $(NULL)
 
 libshell_la_CFLAGS = \
@@ -20,8 +21,6 @@ libshell_la_CFLAGS = \
        $(NULL)
 
 libshell_la_SOURCES = \
-       flashback-dbus-shell.c \
-       flashback-dbus-shell.h \
        flashback-monitor-labeler.c \
        flashback-monitor-labeler.h \
        flashback-osd.c \
@@ -40,29 +39,9 @@ libshell_la_LDFLAGS = \
        $(NULL)
 
 libshell_la_LIBADD = \
-       $(SHELL_LIBS) \
+       $(top_builddir)/dbus/libdbus.la \
        $(top_builddir)/gnome-flashback/libcommon/libcommon.la \
-       $(NULL)
-
-flashback-dbus-shell.h:
-flashback-dbus-shell.c: org.gnome.Shell.xml
-       $(AM_V_GEN) gdbus-codegen \
-               --interface-prefix org.gnome.Shell. \
-               --c-namespace Flashback \
-               --generate-c-code flashback-dbus-shell \
-               $(srcdir)/org.gnome.Shell.xml
-
-BUILT_SOURCES = \
-       flashback-dbus-shell.c \
-       flashback-dbus-shell.h \
-       $(NULL)
-
-EXTRA_DIST = \
-       org.gnome.Shell.xml \
-       $(NULL)
-
-CLEANFILES = \
-       $(BUILT_SOURCES) \
+       $(SHELL_LIBS) \
        $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/gnome-flashback/libshell/flashback-shell.c b/gnome-flashback/libshell/flashback-shell.c
index f50e6b1..ea867ce 100644
--- a/gnome-flashback/libshell/flashback-shell.c
+++ b/gnome-flashback/libshell/flashback-shell.c
@@ -15,13 +15,15 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <config.h>
+#include "config.h"
+#include "flashback-shell.h"
+
 #include <gtk/gtk.h>
 #include <libcommon/gf-keybindings.h>
-#include "flashback-dbus-shell.h"
+
+#include "dbus/gf-shell-gen.h"
 #include "flashback-monitor-labeler.h"
 #include "flashback-osd.h"
-#include "flashback-shell.h"
 
 #define SHELL_DBUS_NAME "org.gnome.Shell"
 #define SHELL_DBUS_PATH "/org/gnome/Shell"
@@ -91,14 +93,14 @@ accelerator_activated (GfKeybindings *keybindings,
                        gpointer       user_data)
 {
        FlashbackShell *shell;
-       FlashbackDBusShell *dbus_shell;
+       GfShellGen *shell_gen;
        GVariant *parameters;
 
        shell = FLASHBACK_SHELL (user_data);
-       dbus_shell = FLASHBACK_DBUS_SHELL (shell->iface);
+       shell_gen = GF_SHELL_GEN (shell->iface);
        parameters = build_parameters (device_node, device_id, timestamp, 0);
 
-       flashback_dbus_shell_emit_accelerator_activated (dbus_shell, action, parameters);
+       gf_shell_gen_emit_accelerator_activated (shell_gen, action, parameters);
 }
 
 static gint
@@ -214,54 +216,47 @@ ungrab_accelerator (FlashbackShell *shell,
 }
 
 static gboolean
-handle_eval (FlashbackDBusShell    *dbus_shell,
+handle_eval (GfShellGen            *shell_gen,
              GDBusMethodInvocation *invocation,
              const gchar            action,
-             gpointer               user_data)
+             FlashbackShell        *shell)
 {
-  flashback_dbus_shell_complete_eval (dbus_shell, invocation,
-                                      FALSE, "");
+  gf_shell_gen_complete_eval (shell_gen, invocation, FALSE, "");
 
   return TRUE;
 }
 
 static gboolean
-handle_focus_search (FlashbackDBusShell    *dbus_shell,
+handle_focus_search (GfShellGen            *shell_gen,
                      GDBusMethodInvocation *invocation,
-                     gpointer               user_data)
+                     FlashbackShell        *shell)
 {
-  flashback_dbus_shell_complete_focus_search (dbus_shell, invocation);
+  gf_shell_gen_complete_focus_search (shell_gen, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_show_osd (FlashbackDBusShell    *dbus_shell,
+handle_show_osd (GfShellGen            *shell_gen,
                  GDBusMethodInvocation *invocation,
                  GVariant              *params,
-                 gpointer               user_data)
+                 FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
-
-  shell = FLASHBACK_SHELL (user_data);
-
   flashback_osd_show (shell->osd, shell->monitor_manager, params);
 
-  flashback_dbus_shell_complete_show_osd (dbus_shell, invocation);
+  gf_shell_gen_complete_show_osd (shell_gen, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_show_monitor_labels (FlashbackDBusShell    *dbus_shell,
+handle_show_monitor_labels (GfShellGen            *shell_gen,
                             GDBusMethodInvocation *invocation,
                             GVariant              *params,
-                            gpointer               user_data)
+                            FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
   const gchar *sender;
 
-  shell = FLASHBACK_SHELL (user_data);
   sender = g_dbus_method_invocation_get_sender (invocation);
 
   g_assert (shell->monitor_manager != NULL);
@@ -269,85 +264,78 @@ handle_show_monitor_labels (FlashbackDBusShell    *dbus_shell,
   flashback_monitor_labeler_show (shell->labeler, shell->monitor_manager,
                                   sender, params);
 
-  flashback_dbus_shell_complete_show_monitor_labels (dbus_shell, invocation);
+  gf_shell_gen_complete_show_monitor_labels (shell_gen, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_hide_monitor_labels (FlashbackDBusShell    *dbus_shell,
+handle_hide_monitor_labels (GfShellGen            *shell_gen,
                             GDBusMethodInvocation *invocation,
-                            gpointer               user_data)
+                            FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
   const gchar *sender;
 
-  shell = FLASHBACK_SHELL (user_data);
   sender = g_dbus_method_invocation_get_sender (invocation);
 
   flashback_monitor_labeler_hide (shell->labeler, sender);
 
-  flashback_dbus_shell_complete_hide_monitor_labels (dbus_shell, invocation);
+  gf_shell_gen_complete_hide_monitor_labels (shell_gen, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_focus_app (FlashbackDBusShell    *dbus_shell,
+handle_focus_app (GfShellGen            *shell_gen,
                   GDBusMethodInvocation *invocation,
                   const gchar            id,
-                  gpointer               user_data)
+                  FlashbackShell        *shell)
 {
-  flashback_dbus_shell_complete_focus_app (dbus_shell, invocation);
+  gf_shell_gen_complete_focus_app (shell_gen, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_show_applications (FlashbackDBusShell    *dbus_shell,
+handle_show_applications (GfShellGen            *shell_gen,
                           GDBusMethodInvocation *invocation,
-                          gpointer               user_data)
+                          FlashbackShell        *shell)
 {
-  flashback_dbus_shell_complete_show_applications (dbus_shell, invocation);
+  gf_shell_gen_complete_show_applications (shell_gen, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_grab_accelerator (FlashbackDBusShell    *dbus_shell,
+handle_grab_accelerator (GfShellGen            *shell_gen,
                          GDBusMethodInvocation *invocation,
                          const gchar           *accelerator,
                          guint                  mode_flags,
                          guint                  grab_flags,
-                         gpointer               user_data)
+                         FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
   const gchar *sender;
   guint action;
 
-  shell = FLASHBACK_SHELL (user_data);
   sender = g_dbus_method_invocation_get_sender (invocation);
   action = grab_accelerator (shell, accelerator, mode_flags, grab_flags, sender);
 
-  flashback_dbus_shell_complete_grab_accelerator (dbus_shell, invocation, action);
+  gf_shell_gen_complete_grab_accelerator (shell_gen, invocation, action);
 
   return TRUE;
 }
 
 static gboolean
-handle_grab_accelerators (FlashbackDBusShell    *dbus_shell,
+handle_grab_accelerators (GfShellGen            *shell_gen,
                           GDBusMethodInvocation *invocation,
                           GVariant              *accelerators,
-                          gpointer               user_data)
+                          FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
   GVariantBuilder builder;
   GVariantIter iter;
   GVariant *child;
   const gchar *sender;
 
-  shell = FLASHBACK_SHELL (user_data);
-
   g_variant_builder_init (&builder, G_VARIANT_TYPE("au"));
   g_variant_iter_init (&iter, accelerators);
 
@@ -369,46 +357,41 @@ handle_grab_accelerators (FlashbackDBusShell    *dbus_shell,
       g_variant_unref (child);
     }
 
-  flashback_dbus_shell_complete_grab_accelerators (dbus_shell, invocation,
-                                                   g_variant_builder_end (&builder));
+  gf_shell_gen_complete_grab_accelerators (shell_gen,
+                                           invocation,
+                                           g_variant_builder_end (&builder));
 
   return TRUE;
 }
 
 static gboolean
-handle_ungrab_accelerator (FlashbackDBusShell    *dbus_shell,
+handle_ungrab_accelerator (GfShellGen            *shell_gen,
                            GDBusMethodInvocation *invocation,
                            guint                  action,
-                           gpointer               user_data)
+                           FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
   const gchar *sender;
   gboolean success;
 
-  shell = FLASHBACK_SHELL (user_data);
-
   sender = g_dbus_method_invocation_get_sender (invocation);
   success = ungrab_accelerator (shell, action, sender);
 
-  flashback_dbus_shell_complete_ungrab_accelerator (dbus_shell, invocation, success);
+  gf_shell_gen_complete_ungrab_accelerator (shell_gen, invocation, success);
 
   return TRUE;
 }
 
 static gboolean
-handle_ungrab_accelerators (FlashbackDBusShell    *dbus_shell,
+handle_ungrab_accelerators (GfShellGen            *shell_gen,
                             GDBusMethodInvocation *invocation,
                             GVariant              *actions,
-                            gpointer               user_data)
+                            FlashbackShell        *shell)
 {
-  FlashbackShell *shell;
   const char *sender;
   gboolean success;
   GVariantIter iter;
   GVariant *child;
 
-  shell = FLASHBACK_SHELL (user_data);
-
   sender = g_dbus_method_invocation_get_sender (invocation);
   success = TRUE;
 
@@ -423,9 +406,7 @@ handle_ungrab_accelerators (FlashbackDBusShell    *dbus_shell,
       success &= ungrab_accelerator (shell, action, sender);
     }
 
-  flashback_dbus_shell_complete_ungrab_accelerators (dbus_shell,
-                                                     invocation,
-                                                     success);
+  gf_shell_gen_complete_ungrab_accelerators (shell_gen, invocation, success);
 
   return TRUE;
 }
@@ -437,11 +418,11 @@ name_appeared_handler (GDBusConnection *connection,
                        gpointer         user_data)
 {
   FlashbackShell *shell;
-  FlashbackDBusShell *skeleton;
+  GfShellGen *skeleton;
   GError *error;
 
   shell = FLASHBACK_SHELL (user_data);
-  skeleton = flashback_dbus_shell_skeleton_new ();
+  skeleton = gf_shell_gen_skeleton_new ();
 
   g_signal_connect (skeleton, "handle-eval",
                     G_CALLBACK (handle_eval), shell);
@@ -466,9 +447,9 @@ name_appeared_handler (GDBusConnection *connection,
   g_signal_connect (skeleton, "handle-ungrab-accelerators",
                     G_CALLBACK (handle_ungrab_accelerators), shell);
 
-  flashback_dbus_shell_set_mode (skeleton, "");
-  flashback_dbus_shell_set_overview_active (skeleton, FALSE);
-  flashback_dbus_shell_set_shell_version (skeleton, "");
+  gf_shell_gen_set_mode (skeleton, "");
+  gf_shell_gen_set_overview_active (skeleton, FALSE);
+  gf_shell_gen_set_shell_version (skeleton, "");
 
   error = NULL;
   shell->iface = G_DBUS_INTERFACE_SKELETON (skeleton);


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