summaryrefslogtreecommitdiff
path: root/liblightdm-gobject
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2015-08-10 11:20:27 +1200
committerRobert Ancell <robert.ancell@canonical.com>2015-08-10 11:20:27 +1200
commite02cee89092b183898e7d8e539a16e663b3921e3 (patch)
treed57680961ba3f7570d3e07f48a3c84a507a337c2 /liblightdm-gobject
parentf4f681f7b4209a634b021ba731addec1e081e5c7 (diff)
parent621d3ec5f5a757419d6d3e2ee8c3020de274a4b4 (diff)
downloadlightdm-e02cee89092b183898e7d8e539a16e663b3921e3.tar.gz
Merge with trunk
Diffstat (limited to 'liblightdm-gobject')
-rw-r--r--liblightdm-gobject/LightDM-1-custom.vala6
-rw-r--r--liblightdm-gobject/LightDM-1.metadata12
-rw-r--r--liblightdm-gobject/Makefile.am26
-rw-r--r--liblightdm-gobject/greeter.c52
-rw-r--r--liblightdm-gobject/liblightdm-gobject-1.deps2
-rw-r--r--liblightdm-gobject/liblightdm-gobject-1.vapi115
-rw-r--r--liblightdm-gobject/lightdm/greeter.h4
-rw-r--r--liblightdm-gobject/user.c46
8 files changed, 123 insertions, 140 deletions
diff --git a/liblightdm-gobject/LightDM-1-custom.vala b/liblightdm-gobject/LightDM-1-custom.vala
new file mode 100644
index 00000000..85d30347
--- /dev/null
+++ b/liblightdm-gobject/LightDM-1-custom.vala
@@ -0,0 +1,6 @@
+namespace LightDM {
+ [CCode (type_id = "lightdm_user_list_get_type ()")]
+ public class UserList : GLib.Object {
+ public unowned GLib.List<LightDM.User> users { get; }
+ }
+}
diff --git a/liblightdm-gobject/LightDM-1.metadata b/liblightdm-gobject/LightDM-1.metadata
new file mode 100644
index 00000000..11ef55a6
--- /dev/null
+++ b/liblightdm-gobject/LightDM-1.metadata
@@ -0,0 +1,12 @@
+Greeter
+ .authenticate.username default=null
+ .connect_sync replacement="LightDM.Greeter.connect_to_daemon_sync"
+ .start_session.session default=null
+ .start_session.cancellable default=null
+ .start_session_sync.session default=null
+ .authentication_user nullable=true
+ .autologin_user_hint nullable=true
+ .select_user_hint nullable=true
+User
+ .get_uid type="Posix.uid_t"
+ .uid type="Posix.uid_t"
diff --git a/liblightdm-gobject/Makefile.am b/liblightdm-gobject/Makefile.am
index a247ad7c..91e041f9 100644
--- a/liblightdm-gobject/Makefile.am
+++ b/liblightdm-gobject/Makefile.am
@@ -45,7 +45,7 @@ INTROSPECTION_GIRS = LightDM-1.gir
LightDM-1.gir: liblightdm-gobject-1.la
LightDM_1_gir_INCLUDES = GObject-2.0 Gio-2.0
-LightDM_1_gir_SCANNERFLAGS = --symbol-prefix=lightdm
+LightDM_1_gir_SCANNERFLAGS = --symbol-prefix=lightdm --c-include "lightdm.h"
LightDM_1_gir_LIBS = liblightdm-gobject-1.la
LightDM_1_gir_FILES = $(liblightdm_gobject_1_la_SOURCES)
@@ -57,18 +57,38 @@ typelib_DATA = LightDM-1.typelib
endif
+if ENABLE_VAPIGEN
+
+include $(VAPIGEN_MAKEFILE)
+
+liblightdm-gobject-1.vapi: $(gir_DATA) LightDM-1.metadata LightDM-1-custom.vala
+
+VAPIGEN_VAPIS = liblightdm-gobject-1.vapi
+
+liblightdm_gobject_1_vapi_DEPS = gio-2.0 posix
+liblightdm_gobject_1_vapi_METADATADIRS = $(srcdir)
+liblightdm_gobject_1_vapi_FILES = $(gir_DATA) $(srcdir)/LightDM-1-custom.vala
+
vapidir = $(datadir)/vala/vapi
-dist_vapi_DATA = liblightdm-gobject-1.vapi
+vapi_DATA = $(VAPIGEN_VAPIS) $(srcdir)/liblightdm-gobject-1.deps
+
+endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = liblightdm-gobject-1.pc
CLEANFILES = \
$(gir_DATA) \
- $(typelib_DATA)
+ $(typelib_DATA) \
+ $(vapi_DATA)
DISTCLEANFILES = \
Makefile.in \
$(pkgconfig_DATA) \
$(gir_DATA) \
$(typelib_DATA)
+
+EXTRA_DIST = \
+ LightDM-1.metadata \
+ LightDM-1-custom.vala \
+ liblightdm-gobject-1.deps
diff --git a/liblightdm-gobject/greeter.c b/liblightdm-gobject/greeter.c
index 7b1c90c1..bcddf154 100644
--- a/liblightdm-gobject/greeter.c
+++ b/liblightdm-gobject/greeter.c
@@ -141,6 +141,41 @@ static void request_iface_init (GAsyncResultIface *iface);
#define REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), request_get_type (), Request))
G_DEFINE_TYPE_WITH_CODE (Request, request, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_RESULT, request_iface_init));
+GType
+lightdm_prompt_type_get_type (void)
+{
+ static GType enum_type = 0;
+
+ if (G_UNLIKELY(enum_type == 0)) {
+ static const GEnumValue values[] = {
+ { LIGHTDM_PROMPT_TYPE_QUESTION, "LIGHTDM_PROMPT_TYPE_QUESTION", "question" },
+ { LIGHTDM_PROMPT_TYPE_SECRET, "LIGHTDM_PROMPT_TYPE_SECRET", "secret" },
+ { 0, NULL, NULL }
+ };
+ enum_type = g_enum_register_static (g_intern_static_string ("LightDMPromptType"), values);
+ }
+
+ return enum_type;
+}
+
+GType
+lightdm_message_type_get_type (void)
+{
+ static GType enum_type = 0;
+
+ if (G_UNLIKELY(enum_type == 0)) {
+ static const GEnumValue values[] = {
+ { LIGHTDM_MESSAGE_TYPE_INFO, "LIGHTDM_MESSAGE_TYPE_INFO", "info" },
+ { LIGHTDM_MESSAGE_TYPE_ERROR, "LIGHTDM_MESSAGE_TYPE_ERROR", "error" },
+ { 0, NULL, NULL }
+ };
+ enum_type = g_enum_register_static (g_intern_static_string ("LightDMMessageType"), values);
+ }
+
+ return enum_type;
+}
+
+
/**
* lightdm_greeter_new:
*
@@ -845,7 +880,7 @@ lightdm_greeter_connect_sync (LightDMGreeter *greeter, GError **error)
*
* Get a hint.
*
- * Return value: The value for this hint or #NULL if not set.
+ * Return value: (nullable): The value for this hint or #NULL if not set.
**/
const gchar *
lightdm_greeter_get_hint (LightDMGreeter *greeter, const gchar *name)
@@ -980,7 +1015,7 @@ lightdm_greeter_get_has_guest_account_hint (LightDMGreeter *greeter)
*
* Get the user to select by default.
*
- * Return value: A username
+ * Return value: (nullable): A username or %NULL if no particular user should be selected.
*/
const gchar *
lightdm_greeter_get_select_user_hint (LightDMGreeter *greeter)
@@ -1012,9 +1047,9 @@ lightdm_greeter_get_select_guest_hint (LightDMGreeter *greeter)
* lightdm_greeter_get_autologin_user_hint:
* @greeter: A #LightDMGreeter
*
- * Get the user account to automatically logg into when the timer expires.
+ * Get the user account to automatically log into when the timer expires.
*
- * Return value: The user account to automatically log into.
+ * Return value: (nullable): The user account to automatically log into or %NULL if none configured.
*/
const gchar *
lightdm_greeter_get_autologin_user_hint (LightDMGreeter *greeter)
@@ -1319,7 +1354,7 @@ lightdm_greeter_get_is_authenticated (LightDMGreeter *greeter)
*
* Get the user that is being authenticated.
*
- * Return value: The username of the authentication user being authenticated or #NULL if no authentication in progress.
+ * Return value: (nullable): The username of the authentication user being authenticated or #NULL if no authentication in progress.
*/
const gchar *
lightdm_greeter_get_authentication_user (LightDMGreeter *greeter)
@@ -1484,6 +1519,7 @@ lightdm_greeter_ensure_shared_data_dir (LightDMGreeter *greeter, const gchar *us
* @result: A #GAsyncResult.
* @greeter: A #LightDMGreeter
*
+ * Function to call from lightdm_greeter_ensure_shared_data_dir callback.
*
* Return value: The path to the shared directory, free with g_free.
**/
@@ -1687,7 +1723,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass)
"default-session-hint",
"Default session hint",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_HIDE_USERS_HINT,
@@ -1811,7 +1847,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass)
G_STRUCT_OFFSET (LightDMGreeterClass, show_prompt),
NULL, NULL,
NULL,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT);
+ G_TYPE_NONE, 2, G_TYPE_STRING, lightdm_prompt_type_get_type ());
/**
* LightDMGreeter::show-message:
@@ -1829,7 +1865,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass)
G_STRUCT_OFFSET (LightDMGreeterClass, show_message),
NULL, NULL,
NULL,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT);
+ G_TYPE_NONE, 2, G_TYPE_STRING, lightdm_message_type_get_type ());
/**
* LightDMGreeter::authentication-complete:
diff --git a/liblightdm-gobject/liblightdm-gobject-1.deps b/liblightdm-gobject/liblightdm-gobject-1.deps
new file mode 100644
index 00000000..ddc9f420
--- /dev/null
+++ b/liblightdm-gobject/liblightdm-gobject-1.deps
@@ -0,0 +1,2 @@
+posix
+gio-2.0
diff --git a/liblightdm-gobject/liblightdm-gobject-1.vapi b/liblightdm-gobject/liblightdm-gobject-1.vapi
deleted file mode 100644
index e06f0b4e..00000000
--- a/liblightdm-gobject/liblightdm-gobject-1.vapi
+++ /dev/null
@@ -1,115 +0,0 @@
-[CCode (cprefix = "LightDM", lower_case_cprefix = "lightdm_", cheader_filename = "lightdm.h")]
-namespace LightDM {
- public static unowned string get_hostname ();
- public static unowned GLib.List<weak LightDM.Session> get_sessions ();
- public static unowned GLib.List<weak LightDM.Language> get_languages ();
- public static unowned GLib.List<weak LightDM.Layout> get_layouts ();
- public static unowned GLib.List<weak LightDM.Session> get_remote_sessions ();
- public static unowned Language get_language ();
- public static void set_layout (Layout layout);
- public static unowned Layout get_layout ();
- public static bool get_can_suspend ();
- public static bool suspend () throws GLib.Error;
- public static bool get_can_hibernate ();
- public static bool hibernate () throws GLib.Error;
- public static bool get_can_restart ();
- public static bool restart () throws GLib.Error;
- public static bool get_can_shutdown ();
- public static bool shutdown () throws GLib.Error;
-
- public class Greeter : GLib.Object {
- public Greeter ();
- public signal void show_message (string text, MessageType type);
- public signal void show_prompt (string text, PromptType type);
- public signal void authentication_complete ();
- public signal void autologin_timer_expired ();
-
- [Deprecated (replacement = "LightDM.Greeter.connect_to_daemon_sync")]
- public bool connect_sync () throws GLib.Error;
- public async bool connect_to_daemon () throws GLib.Error;
- public bool connect_to_daemon_sync () throws GLib.Error;
- public unowned string get_hint (string name);
- public unowned string default_session_hint { get; }
- public bool hide_users_hint { get; }
- public bool show_manual_login_hint { get; }
- public bool show_remote_login_hint { get; }
- public bool lock_hint { get; }
- public bool has_guest_account_hint { get; }
- public unowned string select_user_hint { get; }
- public bool select_guest_hint { get; }
- public unowned string autologin_user_hint { get; }
- public bool autologin_guest_hint { get; }
- public int autologin_timeout_hint { get; }
- public void cancel_autologin ();
- public void authenticate (string? username = null);
- public void authenticate_as_guest ();
- public void authenticate_autologin ();
- public void authenticate_remote (string session, string? username);
- public void respond (string response);
- public void cancel_authentication ();
- public bool in_authentication { get; }
- public bool is_authenticated { get; }
- public unowned string? authentication_user { get; }
- public async void start_session (string? session = null) throws GLib.Error;
- public bool start_session_sync (string? session = null) throws GLib.Error;
- public async string ensure_shared_data_dir (string username);
- public string ensure_shared_data_dir_sync (string username);
- }
- [CCode (has_type_id = false)]
- public enum MessageType {
- INFO,
- ERROR
- }
- [CCode (has_type_id = false)]
- public enum PromptType {
- QUESTION,
- SECRET
- }
- public class Language : GLib.Object {
- public unowned string code { get; }
- public unowned string name { get; }
- public unowned string territory { get; }
- public bool matches (string code);
- }
- public class Layout : GLib.Object {
- public unowned string description { get; }
- public unowned string name { get; }
- public unowned string short_description { get; }
- }
- public class Session : GLib.Object {
- public unowned string comment { get; }
- public unowned string key { get; }
- public unowned string name { get; }
- }
- public class UserList : GLib.Object {
- public static unowned UserList get_instance ();
-
- public signal void user_added (User user);
- public signal void user_changed (User user);
- public signal void user_removed (User user);
-
- public UserList ();
- public int num_users { get; }
- public unowned GLib.List<weak LightDM.User> users { get; }
- public unowned LightDM.User get_user_by_name (string username);
- }
- public class User : GLib.Object {
- public signal void changed ();
-
- [CCode (array_length = false, array_null_terminated = true)]
- public unowned string[] get_layouts ();
-
- public unowned string display_name { get; }
- public unowned string image { get; }
- public unowned string language { get; }
- public unowned string layout { get; }
- public bool logged_in { get; }
- public unowned string name { get; }
- public unowned string real_name { get; }
- public unowned Posix.uid_t uid { get; }
- public unowned string home_directory { get; }
- public unowned string session { get; }
- public unowned string background { get; }
- public bool has_messages { get; }
- }
-}
diff --git a/liblightdm-gobject/lightdm/greeter.h b/liblightdm-gobject/lightdm/greeter.h
index 0d046479..f0487472 100644
--- a/liblightdm-gobject/lightdm/greeter.h
+++ b/liblightdm-gobject/lightdm/greeter.h
@@ -41,6 +41,8 @@ typedef enum
LIGHTDM_PROMPT_TYPE_SECRET
} LightDMPromptType;
+GType lightdm_prompt_type_get_type (void);
+
/**
* LightDMMessageType:
* @LIGHTDM_MESSAGE_TYPE_INFO: Informational message.
@@ -52,6 +54,8 @@ typedef enum
LIGHTDM_MESSAGE_TYPE_ERROR
} LightDMMessageType;
+GType lightdm_message_type_get_type (void);
+
typedef struct
{
GObject parent_instance;
diff --git a/liblightdm-gobject/user.c b/liblightdm-gobject/user.c
index f8355df2..fdda7752 100644
--- a/liblightdm-gobject/user.c
+++ b/liblightdm-gobject/user.c
@@ -20,6 +20,7 @@ enum
{
LIST_PROP_0,
LIST_PROP_NUM_USERS,
+ LIST_PROP_LENGTH,
LIST_PROP_USERS,
};
@@ -261,6 +262,7 @@ lightdm_user_list_get_property (GObject *object,
switch (prop_id)
{
case LIST_PROP_NUM_USERS:
+ case LIST_PROP_LENGTH:
g_value_set_int (value, lightdm_user_list_get_length (self));
break;
default:
@@ -297,7 +299,23 @@ lightdm_user_list_class_init (LightDMUserListClass *klass)
"num-users",
"Number of login users",
0, G_MAXINT, 0,
+ G_PARAM_DEPRECATED | G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class,
+ LIST_PROP_LENGTH,
+ g_param_spec_int ("length",
+ "length",
+ "Number of login users",
+ 0, G_MAXINT, 0,
G_PARAM_READABLE));
+
+ /*g_object_class_install_property (object_class,
+ LIST_PROP_USERS,
+ g_param_spec_int ("users",
+ "users",
+ "Users to present to user",
+ 0, G_MAXINT, 0,
+ G_PARAM_READABLE));*/
/**
* LightDMUserList::user-added:
* @user_list: A #LightDMUserList
@@ -413,7 +431,7 @@ lightdm_user_get_home_directory (LightDMUser *user)
*
* Get the image URI for a user.
*
- * Return value: The image URI for the given user or #NULL if no URI
+ * Return value: (nullable): The image URI for the given user or #NULL if no URI
**/
const gchar *
lightdm_user_get_image (LightDMUser *user)
@@ -428,7 +446,7 @@ lightdm_user_get_image (LightDMUser *user)
*
* Get the background file path for a user.
*
- * Return value: The background file path for the given user or #NULL if no path
+ * Return value: (nullable): The background file path for the given user or #NULL if no path
**/
const gchar *
lightdm_user_get_background (LightDMUser *user)
@@ -443,7 +461,7 @@ lightdm_user_get_background (LightDMUser *user)
*
* Get the language for a user.
*
- * Return value: The language in the form of a local specification (e.g. "de_DE.UTF-8") for the given user or #NULL if using the system default locale.
+ * Return value: (nullable): The language in the form of a local specification (e.g. "de_DE.UTF-8") for the given user or #NULL if using the system default locale.
**/
const gchar *
lightdm_user_get_language (LightDMUser *user)
@@ -458,7 +476,7 @@ lightdm_user_get_language (LightDMUser *user)
*
* Get the keyboard layout for a user.
*
- * Return value: The keyboard layout for the given user or #NULL if using system defaults. Copy the value if you want to use it long term.
+ * Return value: (nullable): The keyboard layout for the given user or #NULL if using system defaults. Copy the value if you want to use it long term.
**/
const gchar *
lightdm_user_get_layout (LightDMUser *user)
@@ -488,7 +506,7 @@ lightdm_user_get_layouts (LightDMUser *user)
*
* Get the session for a user.
*
- * Return value: The session for the given user or #NULL if using system defaults.
+ * Return value: (nullable): The session for the given user or #NULL if using system defaults.
**/
const gchar *
lightdm_user_get_session (LightDMUser *user)
@@ -659,14 +677,14 @@ lightdm_user_class_init (LightDMUserClass *klass)
"name",
"Username",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_REAL_NAME,
g_param_spec_string ("real-name",
"real-name",
"Users real name",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_DISPLAY_NAME,
g_param_spec_string ("display-name",
@@ -680,21 +698,21 @@ lightdm_user_class_init (LightDMUserClass *klass)
"home-directory",
"Home directory",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_IMAGE,
g_param_spec_string ("image",
"image",
"Avatar image",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_BACKGROUND,
g_param_spec_string ("background",
"background",
"User background",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_LANGUAGE,
g_param_spec_string ("language",
@@ -729,20 +747,20 @@ lightdm_user_class_init (LightDMUserClass *klass)
"logged-in",
"TRUE if the user is currently in a session",
FALSE,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_LOGGED_IN,
g_param_spec_boolean ("has-messages",
"has-messages",
"TRUE if the user is has waiting messages",
FALSE,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
USER_PROP_UID,
- g_param_spec_string ("uid",
+ g_param_spec_uint64 ("uid",
"uid",
"User UID",
- NULL,
+ 0, G_MAXUINT64, 0,
G_PARAM_READABLE));
/**