[gdm] launch-environment: implement hostname-selected signal



commit 4bf8912516661f7f03c0906ff484c95df240e911
Author: Ray Strode <rstrode redhat com>
Date:   Fri Mar 31 15:01:06 2017 -0400

    launch-environment: implement hostname-selected signal
    
    We're connecting to a signal that isn't implemented.  This
    commit adds the implementation.
    
    A slightly better fix might be to cut out some of the layers,
    of middle men passing around hostname-selected, but for now this
    is fine.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780787

 daemon/gdm-launch-environment.c |   27 +++++++++++++++++++++++++++
 daemon/gdm-launch-environment.h |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c
index 4372ac2..a7ae672 100644
--- a/daemon/gdm-launch-environment.c
+++ b/daemon/gdm-launch-environment.c
@@ -103,6 +103,7 @@ enum {
         STOPPED,
         EXITED,
         DIED,
+        HOSTNAME_SELECTED,
         LAST_SIGNAL
 };
 
@@ -264,6 +265,15 @@ on_session_died (GdmSession           *session,
 }
 
 static void
+on_hostname_selected (GdmSession               *session,
+                      const char               *hostname,
+                     GdmLaunchEnvironment     *launch_environment)
+{
+        g_debug ("GdmSession: hostname selected: %s", hostname);
+        g_signal_emit (launch_environment, signals [HOSTNAME_SELECTED], 0, hostname);
+}
+
+static void
 on_conversation_started (GdmSession           *session,
                          const char           *service_name,
                          GdmLaunchEnvironment *launch_environment)
@@ -409,6 +419,11 @@ gdm_launch_environment_start (GdmLaunchEnvironment *launch_environment)
                                  G_CALLBACK (on_session_died),
                                  launch_environment,
                                  0);
+        g_signal_connect_object (launch_environment->priv->session,
+                                 "hostname-selected",
+                                 G_CALLBACK (on_hostname_selected),
+                                 launch_environment,
+                                 0);
 
         gdm_session_start_conversation (launch_environment->priv->session, "gdm-launch-environment");
         gdm_session_select_program (launch_environment->priv->session, launch_environment->priv->command);
@@ -807,6 +822,18 @@ gdm_launch_environment_class_init (GdmLaunchEnvironmentClass *klass)
                               G_TYPE_NONE,
                               1,
                               G_TYPE_INT);
+
+        signals [HOSTNAME_SELECTED] =
+                g_signal_new ("hostname-selected",
+                              G_OBJECT_CLASS_TYPE (object_class),
+                              G_SIGNAL_RUN_FIRST,
+                              G_STRUCT_OFFSET (GdmLaunchEnvironmentClass, hostname_selected),
+                              NULL,
+                              NULL,
+                              g_cclosure_marshal_VOID__STRING,
+                              G_TYPE_NONE,
+                              1,
+                              G_TYPE_STRING);
 }
 
 static void
diff --git a/daemon/gdm-launch-environment.h b/daemon/gdm-launch-environment.h
index 3fd875c..c2a09d1 100644
--- a/daemon/gdm-launch-environment.h
+++ b/daemon/gdm-launch-environment.h
@@ -59,6 +59,8 @@ typedef struct
                                     int                    exit_code);
         void (* died)              (GdmLaunchEnvironment  *launch_environment,
                                     int                    signal_number);
+        void (* hostname_selected) (GdmLaunchEnvironment  *launch_environment,
+                                    const char            *hostname);
 } GdmLaunchEnvironmentClass;
 
 GType                 gdm_launch_environment_get_type           (void);


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