Update to lightdm 0.3.5 API
authorRobert Ancell <robert.ancell@canonical.com>
Wed, 25 May 2011 23:49:33 +0000 (09:49 +1000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Wed, 3 Aug 2011 05:22:17 +0000 (13:22 +0800)
configure.ac
data/Makefile.am
src/Makefile.am
src/ldm-gtk-builder-greeter.c

index a2106f7..aa70e15 100644 (file)
@@ -38,12 +38,14 @@ AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
 # Check for LightDM Greeter library
-ldm_modules="libldmgreeter-0"
-PKG_CHECK_MODULES(LDM, [$ldm_modules])
-AC_SUBST(LDM_CFLAGS)
-AC_SUBST(LDM_LIBS)
-LDM_THEMEDIR=`pkg-config --variable=themedir $ldm_modules`
-AC_SUBST(LDM_THEMEDIR)
+ldm_modules="liblightdm-gobject-0"
+PKG_CHECK_MODULES(LIGHTDM_GOBJECT, [$ldm_modules])
+AC_SUBST(LIGHTDM_GOBJECT_CFLAGS)
+AC_SUBST(LIGHTDM_GOBJECT_LIBS)
+LIGHTDM_THEMEDIR=`pkg-config --define-variable=prefix=$prefix --variable=themedir $ldm_modules`
+AC_SUBST(LIGHTDM_THEMEDIR)
+LIGHTDM_GREETERDIR=`pkg-config --define-variable=prefix=$prefix --variable=greeterdir $ldm_modules`
+AC_SUBST(LIGHTDM_GREETERDIR)
 
 # Let's make a Glade plugin for it.
 AC_ARG_WITH([glade],
index f333659..6d474ec 100644 (file)
@@ -3,7 +3,7 @@ NULL=
 SUBDIRS= \
        $(NULL)
 
-themedir=$(LDM_THEMEDIR)/Industrial
+themedir=$(LIGHTDM_THEMEDIR)/Industrial
 theme_DATA= \
        themes/Industrial/greeter.ui \
        themes/Industrial/login.png \
index 951893b..8bf84fa 100644 (file)
@@ -17,14 +17,14 @@ ldm_gtk_builder_greeter_SOURCES = \
 
 ldm_gtk_builder_greeter_CFLAGS = \
        $(GTK_CFLAGS) \
-       $(LDM_CFLAGS) \
+       $(LIGHTDM_GOBJECT_CFLAGS) \
        -Wl,--export-dynamic \
        -Werror-implicit-function-declaration \
        $(NULL)
 
 ldm_gtk_builder_greeter_LDADD = \
        $(GTK_LIBS) \
-       $(LDM_LIBS) \
+       $(LIGHTDM_GOBJECT_LIBS) \
        $(INTLLIBS) \
        $(NULL)
 
index abbac89..e50ee6e 100644 (file)
@@ -419,6 +419,38 @@ static void sigterm_cb (int signum)
     exit(0);
 }
 
+static void
+on_connected(LdmGreeter *greeter)
+{
+    if(test_dir)
+    {
+        g_free(theme_dir);
+        theme_dir = test_dir;
+    }
+    else
+    {
+        theme_dir = g_path_get_dirname(ldm_greeter_get_theme(greeter));
+        g_debug("theme_dir = %s", theme_dir);
+    }
+
+    if(theme_dir)
+    {
+        char* gtkrc = g_build_filename(theme_dir, "gtkrc", NULL);
+        gtk_rc_parse(gtkrc);
+        g_debug("gtkrc: %s", gtkrc);
+        g_free(gtkrc);
+    }
+
+    char* gtk_theme = ldm_greeter_get_string_property(greeter, "gtk_theme");
+    if(gtk_theme)
+        g_object_set(gtk_settings_get_default(), "gtk-theme-name", gtk_theme, NULL);
+
+    /* create GUI */
+    if(!show_ui())
+        return 1;
+}
+
+
 int main(int argc, char** argv)
 {
     GError* err = NULL;
@@ -442,44 +474,18 @@ int main(int argc, char** argv)
     g_type_init();
     greeter = ldm_greeter_new();
 
-    if(!ldm_greeter_connect(greeter))
+    if(!ldm_greeter_connect_to_server(greeter))
     {
         g_print("Error: unable to connect to lightdm deamon.\n");
         return 1;
     }
 
+    g_signal_connect(greeter, "connected", G_CALLBACK(on_connected), NULL);  
     g_signal_connect(greeter, "show-prompt", G_CALLBACK(on_show_prompt), NULL);
     g_signal_connect(greeter, "authentication-complete", G_CALLBACK(on_authentication_complete), NULL);
     g_signal_connect(greeter, "timed-login", G_CALLBACK(on_timed_login), NULL);
     g_signal_connect(greeter, "quit", G_CALLBACK(on_quit), NULL);
 
-    if(test_dir)
-    {
-        g_free(theme_dir);
-        theme_dir = test_dir;
-    }
-    else
-    {
-        theme_dir = g_path_get_dirname(ldm_greeter_get_theme(greeter));
-        g_debug("theme_dir = %s", theme_dir);
-    }
-
-    if(theme_dir)
-    {
-        char* gtkrc = g_build_filename(theme_dir, "gtkrc", NULL);
-        gtk_rc_parse(gtkrc);
-        g_debug("gtkrc: %s", gtkrc);
-        g_free(gtkrc);
-    }
-
-    char* gtk_theme = ldm_greeter_get_string_property(greeter, "gtk_theme");
-    if(gtk_theme)
-        g_object_set(gtk_settings_get_default(), "gtk-theme-name", gtk_theme, NULL);
-
-    /* create GUI */
-    if(!show_ui())
-        return 1;
-
     gtk_main();
 
     return 0;