#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:
*
write_int (buffer, buffer_length, length, offset);
if (*offset + length >= buffer_length)
return;
- memcpy (buffer + *offset, value, length);
+ if (value)
+ memcpy (buffer + *offset, value, length);
*offset += length;
}
/**
* lightdm_greeter_connect_to_daemon_finish:
+ * @greeter: The greeter the the request was done with
* @result: A #GAsyncResult.
* @error: return location for a #GError, or %NULL
*
{
LightDMGreeterPrivate *priv;
Request *request;
+ gboolean result;
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
g_free (message);
} while (!request->complete);
+ result = request->complete;
g_object_unref (request);
- return request->complete;
+ return result;
}
/**
*
* 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)
*
* 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)
* 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)
*
* 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)
* @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.
**/
"default-session-hint",
"Default session hint",
NULL,
- G_PARAM_READWRITE));
+ G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_HIDE_USERS_HINT,
* lightdm_greeter_cancel_authentication() to abort the authentication.
**/
signals[SHOW_PROMPT] =
- g_signal_new ("show-prompt",
+ g_signal_new (LIGHTDM_GREETER_SIGNAL_SHOW_PROMPT,
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
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:
* should show a message to the user.
**/
signals[SHOW_MESSAGE] =
- g_signal_new ("show-message",
+ g_signal_new (LIGHTDM_GREETER_SIGNAL_SHOW_MESSAGE,
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
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:
* was successful.
**/
signals[AUTHENTICATION_COMPLETE] =
- g_signal_new ("authentication-complete",
+ g_signal_new (LIGHTDM_GREETER_SIGNAL_AUTHENTICATION_COMPLETE,
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (LightDMGreeterClass, authentication_complete),
* The application should then call lightdm_greeter_login().
**/
signals[AUTOLOGIN_TIMER_EXPIRED] =
- g_signal_new ("autologin-timer-expired",
+ g_signal_new (LIGHTDM_GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED,
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (LightDMGreeterClass, autologin_timer_expired),
* resettable using lightdm_greeter_set_resettable().
**/
signals[IDLE] =
- g_signal_new ("idle",
+ g_signal_new (LIGHTDM_GREETER_SIGNAL_IDLE,
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (LightDMGreeterClass, idle),
* resettable using lightdm_greeter_set_resettable().
**/
signals[RESET] =
- g_signal_new ("reset",
+ g_signal_new (LIGHTDM_GREETER_SIGNAL_RESET,
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (LightDMGreeterClass, reset),
Request *request = REQUEST (object);
g_free (request->dir);
- if (request->cancellable)
- g_object_unref (request->cancellable);
+ g_clear_object (&request->cancellable);
G_OBJECT_CLASS (request_parent_class)->finalize (object);
}