[gnome-flashback/wip/muktupavels/test: 13/15] end-session-dialog: move D-Bus interface files to libdbus



commit 9420a10d15738601a1aa8833059e8db585af8ba8
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Dec 17 16:04:12 2019 +0200

    end-session-dialog: move D-Bus interface files to libdbus

 dbus/Makefile.am                                   |  9 ++++
 .../org.gnome.SessionManager.EndSessionDialog.xml  |  9 +++-
 gnome-flashback/libend-session-dialog/Makefile.am  | 27 +---------
 .../libend-session-dialog/gf-end-session-dialog.c  | 59 +++++++++-------------
 4 files changed, 41 insertions(+), 63 deletions(-)
---
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index f9bf35b..f6ac106 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -51,6 +51,12 @@ gf-dm-seat-gen.c: org.freedesktop.DisplayManager.Seat.xml
                --generate-c-code gf-dm-seat-gen \
                $(srcdir)/org.freedesktop.DisplayManager.Seat.xml
 
+gf-end-session-dialog-gen.h:
+gf-end-session-dialog-gen.c: org.gnome.SessionManager.EndSessionDialog.xml
+       $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
+               --generate-c-code gf-end-session-dialog-gen \
+               $(srcdir)/org.gnome.SessionManager.EndSessionDialog.xml
+
 gf-fd-application-gen.h:
 gf-fd-application-gen.c: org.freedesktop.Application.xml
        $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
@@ -162,6 +168,8 @@ BUILT_SOURCES = \
        gf-audio-device-selection-gen.h \
        gf-dm-seat-gen.c \
        gf-dm-seat-gen.h \
+       gf-end-session-dialog-gen.c \
+       gf-end-session-dialog-gen.h \
        gf-fd-application-gen.c \
        gf-fd-application-gen.h \
        gf-fd-dbus-gen.c \
@@ -212,6 +220,7 @@ EXTRA_DIST = \
        org.freedesktop.UPower.Device.xml \
        org.gnome.Nautilus.FileOperations.xml \
        org.gnome.ScreenSaver.xml \
+       org.gnome.SessionManager.EndSessionDialog.xml \
        org.gnome.SessionManager.Presence.xml \
        org.gnome.SettingsDaemon.Rfkill.xml \
        org.gnome.Shell.AudioDeviceSelection.xml \
diff --git a/gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml 
b/dbus/org.gnome.SessionManager.EndSessionDialog.xml
similarity index 92%
rename from gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml
rename to dbus/org.gnome.SessionManager.EndSessionDialog.xml
index 38f2757..3353740 100644
--- a/gnome-flashback/libend-session-dialog/org.gnome.SessionManager.EndSessionDialog.xml
+++ b/dbus/org.gnome.SessionManager.EndSessionDialog.xml
@@ -1,7 +1,10 @@
 <?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 xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+<!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.SessionManager.EndSessionDialog">
+    <annotation name="org.gtk.GDBus.C.Name" value="EndSessionDialogGen" />
+
     <method name="Open">
       <arg type="u" name="type" direction="in">
         <doc:doc>
@@ -45,6 +48,7 @@
         </doc:summary>
       </doc:doc>
     </method>
+
     <signal name="ConfirmedLogout" />
     <signal name="ConfirmedReboot" />
     <signal name="ConfirmedShutdown" />
@@ -53,5 +57,6 @@
     <signal name="ConfirmedHybridSleep" />
     <signal name="Canceled" />
     <signal name="Closed" />
+
   </interface>
 </node>
diff --git a/gnome-flashback/libend-session-dialog/Makefile.am 
b/gnome-flashback/libend-session-dialog/Makefile.am
index 2fc01d8..491007c 100644
--- a/gnome-flashback/libend-session-dialog/Makefile.am
+++ b/gnome-flashback/libend-session-dialog/Makefile.am
@@ -7,18 +7,16 @@ noinst_LTLIBRARIES = \
 libend_session_dialog_la_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"end-session-dialog\" \
        -DG_LOG_USE_STRUCTURED=1 \
+       $(AM_CPPFLAGS) \
        $(NULL)
 
 libend_session_dialog_la_CFLAGS = \
        $(END_SESSION_DIALOG_CFLAGS) \
        $(WARN_CFLAGS) \
        $(AM_CFLAGS) \
-       -I$(top_builddir)/gnome-flashback/libend-session-dialog \
        $(NULL)
 
 libend_session_dialog_la_SOURCES = \
-       dbus-end-session-dialog.c \
-       dbus-end-session-dialog.h \
        gf-end-session-dialog.c \
        gf-end-session-dialog.h \
        gf-inhibit-dialog.c \
@@ -31,29 +29,8 @@ libend_session_dialog_la_LDFLAGS = \
        $(NULL)
 
 libend_session_dialog_la_LIBADD = \
+       $(top_builddir)/dbus/libdbus.la \
        $(END_SESSION_DIALOG_LIBS) \
        $(NULL)
 
-dbus-end-session-dialog.h:
-dbus-end-session-dialog.c: org.gnome.SessionManager.EndSessionDialog.xml Makefile.am
-       $(AM_V_GEN) gdbus-codegen \
-               --interface-prefix=org.gnome.SessionManager \
-               --generate-c-code dbus-end-session-dialog \
-               --c-namespace DBus \
-               $(srcdir)/org.gnome.SessionManager.EndSessionDialog.xml
-
-BUILT_SOURCES = \
-       dbus-end-session-dialog.h \
-       dbus-end-session-dialog.c \
-       $(NULL)
-
-EXTRA_DIST = \
-       org.gnome.SessionManager.EndSessionDialog.xml \
-       gf-inhibit-dialog.ui \
-       $(NULL)
-
-CLEANFILES = \
-       $(BUILT_SOURCES) \
-       $(NULL)
-
 -include $(top_srcdir)/git.mk
diff --git a/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c 
b/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
index 1fa5fe5..54388c0 100644
--- a/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
+++ b/gnome-flashback/libend-session-dialog/gf-end-session-dialog.c
@@ -16,11 +16,11 @@
  */
 
 #include "config.h"
+#include "gf-end-session-dialog.h"
 
 #include <gtk/gtk.h>
 
-#include "dbus-end-session-dialog.h"
-#include "gf-end-session-dialog.h"
+#include "dbus/gf-end-session-dialog-gen.h"
 #include "gf-inhibit-dialog.h"
 
 struct _GfEndSessionDialog
@@ -36,14 +36,12 @@ struct _GfEndSessionDialog
 G_DEFINE_TYPE (GfEndSessionDialog, gf_end_session_dialog, G_TYPE_OBJECT)
 
 static void
-inhibit_dialog_response (GfInhibitDialog *dialog,
-                         guint            response_id,
-                         gpointer         user_data)
+inhibit_dialog_response (GfInhibitDialog       *dialog,
+                         guint                  response_id,
+                         GfEndSessionDialogGen *object)
 {
-  DBusEndSessionDialog *object;
   gint action;
 
-  object = DBUS_END_SESSION_DIALOG (user_data);
   g_object_get (dialog, "action", &action, NULL);
 
   switch (response_id)
@@ -53,17 +51,17 @@ inhibit_dialog_response (GfInhibitDialog *dialog,
 
       case GF_RESPONSE_ACCEPT:
         if (action == GF_LOGOUT_ACTION_LOGOUT)
-          dbus_end_session_dialog_emit_confirmed_logout (object);
+          gf_end_session_dialog_gen_emit_confirmed_logout (object);
         else if (action == GF_LOGOUT_ACTION_SHUTDOWN)
-          dbus_end_session_dialog_emit_confirmed_shutdown (object);
+          gf_end_session_dialog_gen_emit_confirmed_shutdown (object);
         else if (action == GF_LOGOUT_ACTION_REBOOT)
-          dbus_end_session_dialog_emit_confirmed_reboot (object);
+          gf_end_session_dialog_gen_emit_confirmed_reboot (object);
         else if (action == GF_LOGOUT_ACTION_HIBERNATE)
-          dbus_end_session_dialog_emit_confirmed_hibernate (object);
+          gf_end_session_dialog_gen_emit_confirmed_hibernate (object);
         else if (action == GF_LOGOUT_ACTION_SUSPEND)
-          dbus_end_session_dialog_emit_confirmed_suspend (object);
+          gf_end_session_dialog_gen_emit_confirmed_suspend (object);
         else if (action == GF_LOGOUT_ACTION_HYBRID_SLEEP)
-          dbus_end_session_dialog_emit_confirmed_hybrid_sleep (object);
+          gf_end_session_dialog_gen_emit_confirmed_hybrid_sleep (object);
         else
           g_assert_not_reached ();
         break;
@@ -77,42 +75,31 @@ inhibit_dialog_response (GfInhibitDialog *dialog,
 }
 
 static void
-inhibit_dialog_close (GfInhibitDialog *dialog,
-                      gpointer         user_data)
+inhibit_dialog_close (GfInhibitDialog       *dialog,
+                      GfEndSessionDialogGen *object)
 {
-  DBusEndSessionDialog *object;
-
-  object = DBUS_END_SESSION_DIALOG (user_data);
-
-  dbus_end_session_dialog_emit_canceled (object);
-  dbus_end_session_dialog_emit_closed (object);
+  gf_end_session_dialog_gen_emit_canceled (object);
+  gf_end_session_dialog_gen_emit_closed (object);
 }
 
 static void
-closed (DBusEndSessionDialog *object,
-        gpointer              user_data)
+closed (GfEndSessionDialogGen *object,
+        GfEndSessionDialog    *dialog)
 {
-  GfEndSessionDialog *dialog;
-
-  dialog = GF_END_SESSION_DIALOG (user_data);
-
   dialog->dialog = NULL;
 }
 
 static gboolean
-handle_open (DBusEndSessionDialog  *object,
+handle_open (GfEndSessionDialogGen *object,
              GDBusMethodInvocation *invocation,
              guint                  type,
              guint                  timestamp,
              guint                  seconds_to_stay_open,
              const gchar *const    *inhibitor_object_paths,
-             gpointer               user_data)
+             GfEndSessionDialog    *dialog)
 {
-  GfEndSessionDialog *dialog;
   GfInhibitDialog *inhibit_dialog;
 
-  dialog = GF_END_SESSION_DIALOG (user_data);
-
   if (dialog->dialog != NULL)
     {
       inhibit_dialog = GF_INHIBIT_DIALOG (dialog->dialog);
@@ -122,7 +109,7 @@ handle_open (DBusEndSessionDialog  *object,
                     NULL);
 
       gf_inhibit_dialog_present (inhibit_dialog, timestamp);
-      dbus_end_session_dialog_complete_open (object, invocation);
+      gf_end_session_dialog_gen_complete_open (object, invocation);
 
       return TRUE;
     }
@@ -143,7 +130,7 @@ handle_open (DBusEndSessionDialog  *object,
                     G_CALLBACK (closed), dialog);
 
   gf_inhibit_dialog_present (inhibit_dialog, timestamp);
-  dbus_end_session_dialog_complete_open (object, invocation);
+  gf_end_session_dialog_gen_complete_open (object, invocation);
 
   return TRUE;
 }
@@ -155,11 +142,11 @@ name_appeared_handler (GDBusConnection *connection,
                        gpointer         user_data)
 {
   GfEndSessionDialog *dialog;
-  DBusEndSessionDialog *skeleton;
+  GfEndSessionDialogGen *skeleton;
   GError *error;
 
   dialog = GF_END_SESSION_DIALOG (user_data);
-  skeleton = dbus_end_session_dialog_skeleton_new ();
+  skeleton = gf_end_session_dialog_gen_skeleton_new ();
 
   dialog->iface = G_DBUS_INTERFACE_SKELETON (skeleton);
 


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