[gdm/wip/slave-connection: 24/24] chooser: port to libgdm
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/slave-connection: 24/24] chooser: port to libgdm
- Date: Tue, 17 Jul 2012 07:39:07 +0000 (UTC)
commit 7322279de23123b4fe35c872aa72c8a5e01cb640
Author: Ray Strode <rstrode redhat com>
Date: Thu Jul 12 22:41:15 2012 -0400
chooser: port to libgdm
The chooser is the UI showns to XDMCP clients connecting
via indirect queries. It shows a list of login screens
on the network and lets the user pick that login screen
to jump to.
Right now it uses its own hardcoded D-Bus calls
to interact with the GDM daemon.
The D-Bus APIs have changed, though, and so now it
no longer works.
This commit changes simple-chooser to use libgdm
instead.
configure.ac | 1 -
gui/simple-chooser/Makefile.am | 4 +-
gui/simple-chooser/gdm-chooser-client.c | 403 ------------------------------
gui/simple-chooser/gdm-chooser-client.h | 69 -----
gui/simple-chooser/gdm-chooser-session.c | 68 ++++--
5 files changed, 50 insertions(+), 495 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index af2e295..a6360fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,6 @@ AC_SUBST(LIBXKLAVIER_CFLAGS)
AC_SUBST(LIBXKLAVIER_LIBS)
PKG_CHECK_MODULES(SIMPLE_CHOOSER,
- dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
gtk+-3.0 >= $GTK_REQUIRED_VERSION
)
AC_SUBST(SIMPLE_CHOOSER_CFLAGS)
diff --git a/gui/simple-chooser/Makefile.am b/gui/simple-chooser/Makefile.am
index eacf0c9..8b9c003 100644
--- a/gui/simple-chooser/Makefile.am
+++ b/gui/simple-chooser/Makefile.am
@@ -2,6 +2,7 @@ NULL =
AM_CPPFLAGS = \
-I$(top_srcdir)/common \
+ -I$(top_srcdir)/gui/libgdm \
-DAUTHDIR=\""$(authdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DGDMCONFDIR=\"$(gdmconfdir)\" \
@@ -32,14 +33,13 @@ gdm_simple_chooser_SOURCES = \
gdm-host-chooser-widget.h \
gdm-host-chooser-dialog.c \
gdm-host-chooser-dialog.h \
- gdm-chooser-client.c \
- gdm-chooser-client.h \
gdm-chooser-session.c \
gdm-chooser-session.h \
$(NULL)
gdm_simple_chooser_LDADD = \
$(top_builddir)/common/libgdmcommon.la \
+ $(top_builddir)/gui/libgdm/libgdm.la \
$(GTK_LIBS) \
$(EXTRA_CHOOSER_LIBS) \
$(SIMPLE_CHOOSER_LIBS) \
diff --git a/gui/simple-chooser/gdm-chooser-session.c b/gui/simple-chooser/gdm-chooser-session.c
index da1e896..3a69aa7 100644
--- a/gui/simple-chooser/gdm-chooser-session.c
+++ b/gui/simple-chooser/gdm-chooser-session.c
@@ -30,7 +30,7 @@
#include <glib-object.h>
#include "gdm-chooser-session.h"
-#include "gdm-chooser-client.h"
+#include "gdm-client.h"
#include "gdm-host-chooser-dialog.h"
@@ -38,7 +38,9 @@
struct GdmChooserSessionPrivate
{
- GdmChooserClient *client;
+ GdmClient *client;
+ GdmRemoteGreeter *remote_greeter;
+ GdmChooser *chooser;
GtkWidget *chooser_dialog;
};
@@ -150,6 +152,7 @@ on_dialog_response (GtkDialog *dialog,
GdmChooserSession *session)
{
GdmChooserHost *host;
+ GError *error = NULL;
host = NULL;
switch (response_id) {
@@ -172,38 +175,59 @@ on_dialog_response (GtkDialog *dialog,
/* FIXME: fall back to numerical address? */
if (hostname != NULL) {
g_debug ("GdmChooserSession: Selected hostname '%s'", hostname);
- gdm_chooser_client_call_select_hostname (session->priv->client, hostname);
+ gdm_chooser_call_select_hostname_sync (session->priv->chooser,
+ hostname,
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_debug ("GdmChooserSession: %s", error->message);
+ g_clear_error (&error);
+ }
g_free (hostname);
}
}
- gdm_chooser_client_call_disconnect (session->priv->client);
+ gdm_remote_greeter_call_disconnect_sync (session->priv->remote_greeter,
+ NULL,
+ &error);
+ if (error != NULL) {
+ g_debug ("GdmChooserSession: disconnect failed: %s", error->message);
+ }
}
gboolean
gdm_chooser_session_start (GdmChooserSession *session,
GError **error)
{
- gboolean res;
-
g_return_val_if_fail (GDM_IS_CHOOSER_SESSION (session), FALSE);
- res = gdm_chooser_client_start (session->priv->client, error);
-
- if (res) {
- start_settings_daemon (session);
- start_window_manager (session);
+ session->priv->remote_greeter = gdm_client_get_remote_greeter_sync (session->priv->client,
+ NULL,
+ error);
+ if (session->priv->remote_greeter == NULL) {
+ return FALSE;
+ }
- /* Only support XDMCP on remote choosers */
- session->priv->chooser_dialog = gdm_host_chooser_dialog_new (GDM_CHOOSER_HOST_KIND_XDMCP);
- g_signal_connect (session->priv->chooser_dialog,
- "response",
- G_CALLBACK (on_dialog_response),
- session);
- gtk_widget_show (session->priv->chooser_dialog);
+ session->priv->chooser = gdm_client_get_chooser_sync (session->priv->client,
+ NULL,
+ error);
+ if (session->priv->chooser == NULL) {
+ return FALSE;
}
- return res;
+ start_settings_daemon (session);
+ start_window_manager (session);
+
+ /* Only support XDMCP on remote choosers */
+ session->priv->chooser_dialog = gdm_host_chooser_dialog_new (GDM_CHOOSER_HOST_KIND_XDMCP);
+ g_signal_connect (session->priv->chooser_dialog,
+ "response",
+ G_CALLBACK (on_dialog_response),
+ session);
+ gtk_widget_show (session->priv->chooser_dialog);
+
+ return TRUE;
}
void
@@ -281,7 +305,7 @@ gdm_chooser_session_init (GdmChooserSession *session)
session->priv = GDM_CHOOSER_SESSION_GET_PRIVATE (session);
- session->priv->client = gdm_chooser_client_new ();
+ session->priv->client = gdm_client_new ();
}
static void
@@ -296,6 +320,10 @@ gdm_chooser_session_finalize (GObject *object)
g_return_if_fail (chooser_session->priv != NULL);
+ g_clear_object (&chooser_session->priv->chooser);
+ g_clear_object (&chooser_session->priv->remote_greeter);
+ g_clear_object (&chooser_session->priv->client);
+
G_OBJECT_CLASS (gdm_chooser_session_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]