Browse Source

update api usage for lightdm 1.19.2+

sisyphus
Dustin Falgout 8 years ago
parent
commit
0a32a1312d
  1. 9
      meson.build
  2. 60
      src/webkit2-extension.c

9
meson.build

@ -1,4 +1,4 @@
project('lightdm-webkit2-greeter', 'c', version: '2.1.5', license: 'GPL-3')
project('lightdm-webkit2-greeter', 'c', version: '2.1.6', license: 'GPL-3')
# ================================== #
@ -28,7 +28,8 @@ webkit2_webext = dependency('webkit2gtk-web-extension-4.0', version: '>=2.10.7'
greeter_deps = [dbus_glib, gtk3, webkit2, x11]
webext_deps = [webkit2_webext, lightdm_gobject]
has_webkitgtk_214 = webkit2.version().version_compare('>=2.14.0')
has_webkitgtk_2_14 = webkit2.version().version_compare('>=2.14.0')
has_lightdm_1_19_2 = lightdm_gobject.version().version_compare('>=1.19.2')
# =================================== #
@ -55,7 +56,9 @@ conf.set('DESKTOP_DIR', '"@0@"'.format(get_option('with-desktop-dir')))
conf.set('WEBEXT_DIR', '"@0@"'.format(get_option('with-webext-dir')))
conf.set('HAS_WEBKITGTK_2_14', has_webkitgtk_214)
conf.set('HAS_WEBKITGTK_2_14', has_webkitgtk_2_14)
conf.set('HAS_LIGHTDM_1_19_2', has_lightdm_1_19_2)
# ===================================== #

60
src/webkit2-extension.c

@ -38,6 +38,7 @@
#define _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@ -52,7 +53,7 @@
/* CLion bugs */
#ifndef guint64
#define guint64 typedef unsigned long guint64;
typedef unsigned long guint64;
#endif
@ -672,7 +673,19 @@ authenticate_cb(JSContextRef context,
name = arg_to_string(context, arguments[0], exception);
}
#ifdef HAS_LIGHTDM_1_19_2
GError *err = NULL;
lightdm_greeter_authenticate(GREETER, name, &err);
if (NULL != err) {
_mkexception(context, exception, err->message);
g_error_free(err);
}
#else
lightdm_greeter_authenticate(GREETER, name);
#endif
g_free(name);
return JSValueMakeNull(context);
@ -687,7 +700,18 @@ authenticate_as_guest_cb(JSContextRef context,
const JSValueRef arguments[],
JSValueRef *exception) {
#ifdef HAS_LIGHTDM_1_19_2
GError *err = NULL;
lightdm_greeter_authenticate_as_guest(GREETER, &err);
if (NULL != err) {
_mkexception(context, exception, err->message);
g_error_free(err);
}
#else
lightdm_greeter_authenticate_as_guest(GREETER);
#endif
return JSValueMakeNull(context);
}
@ -741,7 +765,19 @@ respond_cb(JSContextRef context,
return JSValueMakeNull(context);
}
#ifdef HAS_LIGHTDM_1_19_2
GError *err = NULL;
lightdm_greeter_respond(GREETER, response, &err);
if (NULL != err) {
_mkexception(context, exception, err->message);
g_error_free(err);
}
#else
lightdm_greeter_respond(GREETER, response);
#endif
g_free(response);
return JSValueMakeNull(context);
@ -756,7 +792,18 @@ cancel_authentication_cb(JSContextRef context,
const JSValueRef arguments[],
JSValueRef *exception) {
#ifdef HAS_LIGHTDM_1_19_2
GError *err = NULL;
lightdm_greeter_cancel_authentication(GREETER, &err);
if (NULL != err) {
_mkexception(context, exception, err->message);
g_error_free(err);
}
#else
lightdm_greeter_cancel_authentication(GREETER);
#endif
return JSValueMakeNull(context);
}
@ -1014,7 +1061,18 @@ set_language_cb(JSContextRef context,
return JSValueMakeNull(context);
}
#ifdef HAS_LIGHTDM_1_19_2
GError *err = NULL;
lightdm_greeter_set_language(GREETER, language, &err);
if (NULL != err) {
_mkexception(context, exception, err->message);
g_error_free(err);
}
#else
lightdm_greeter_set_language(GREETER, language);
#endif
g_free(language);

Loading…
Cancel
Save