Browse Source

code formatting. updated submodule ref. tweaked the simple theme, now has a better HTML structure.

sisyphus
Dustin Falgout 9 years ago
parent
commit
72a57d4e9e
  1. 29
      src/lightdm-webkit2-greeter-ext.c
  2. 320
      themes/simple/index.html

29
src/lightdm-webkit2-greeter-ext.c

@ -89,11 +89,6 @@ string_or_null(JSContextRef context, const gchar *str) {
}
/*
* Makes an Exception.
*
* Convert a const string to an exception which can be passed back to webkit.
*/
static void
_mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) {
JSValueRef result;
@ -108,6 +103,11 @@ _mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) {
}
/*
* Makes an Exception.
*
* Convert a const string to an exception which can be passed back to webkit.
*/
static JSValueRef
mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) {
_mkexception(context, exception, str);
@ -899,8 +899,8 @@ start_session_sync_cb(JSContextRef context,
/* FIXME: old API required lightdm.login(username, session), but the username
* is never actually used. At some point, deprecate the old usage. For now,
* simply work around it. */
* simply work around it.
*/
if (argumentCount == 1) {
session = arg_to_string(context, arguments[0], exception);
} else if (argumentCount == 2) {
@ -1020,7 +1020,7 @@ ngettext_cb(JSContextRef context,
/*
* Gets a key's value from config file.
*
* Returns config key's value as string.
* Returns value as a string.
*/
static JSValueRef
get_conf_str_cb(JSContextRef context,
@ -1067,7 +1067,7 @@ get_conf_str_cb(JSContextRef context,
/*
* Gets a key's value from config file.
*
* Returns config key's value as number.
* Returns value as a number.
*/
static JSValueRef
get_conf_num_cb(JSContextRef context,
@ -1110,7 +1110,7 @@ get_conf_num_cb(JSContextRef context,
/*
* Gets a key's value from config file.
*
* Returns config key's value as bool.
* Returns value as a bool.
*/
static JSValueRef
get_conf_bool_cb(JSContextRef context,
@ -1302,15 +1302,6 @@ static const JSClassDefinition config_file_definition = {
config_file_functions, /* Static functions */
};
/*static void
web_page_created_callback(WebKitWebExtension *extension, WebKitWebPage *web_page, gpointer user_data) {
#define G_GUINT64_FORMAT "lu"
g_print("Page %" G_GUINT64_FORMAT "created for %s\n",
webkit_web_page_get_id(web_page),
webkit_web_page_get_uri(web_page)
);
}*/
static void
window_object_cleared_callback(WebKitScriptWorld *world,

320
themes/simple/index.html

@ -1,165 +1,161 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style type="text/css">
td
{
font-size: 24px;
vertical-align: middle;
}
input
{
font-size: 24px;
}
html
{
height: 100%;
}
body
{
background: linear-gradient(white, SlateGray);
}
.topBox
{
height: 490px;
}
.inputBox
{
width: 100%;
}
.messageBox
{
font-size: 24px;
width: 60%;
margin-left: auto;
margin-right: auto;
display: block;
text-align: center;
visibility: hidden;
}
</style>
<script type="text/javascript">
/*********************************************************************/
/* Callbacks for lightdm-webkit-greeter */
/*********************************************************************/
/*
* show_prompt callback.
*/
function show_prompt(text, type)
{
// type is either "text" or "password"
prompt = document.getElementById("prompt");
prompt.innerHTML = text;
entry = document.getElementById("entry");
entry.value = ""; // clear entry
entry.type = type;
entry.focus();
}
/*
* show_message callback.
*/
function show_message(text, type)
{
if (text.length == 0)
return;
messages = document.getElementById("messages");
messages.style.visibility = "visible";
// type is either "info" or "error"
if (type == "error") {
text = "<font color=\"red\">" + text + "</font>";
}
text = text + "<br>";
messages.innerHTML = messages.innerHTML + text;
}
/*
* authentication_complete callback.
*/
function authentication_complete()
{
if (lightdm.is_authenticated) {
lightdm.start_session_sync (); // Start default session
} else {
show_message ("Authentication Failed", "error");
setTimeout (start_authentication, 3000);
}
}
/*
* autologin_timer_expired callback.
*/
function autologin_timer_expired(username)
{
/* Stub. Does nothing. */
}
/*********************************************************************/
/* Functions local to this greeter */
/*********************************************************************/
/*
* clear_messages
*/
function clear_messages()
{
messages = document.getElementById("messages");
messages.innerHTML = "";
messages.style.visibility = "hidden";
}
/*
* Kickoff the authentication process
*/
function start_authentication()
{
clear_messages();
lightdm.authenticate(); // start with null userid, have pam prompt for userid.
}
/*
* handle the input from the entry field.
*/
function handle_input()
{
entry = document.getElementById("entry");
lightdm.respond(entry.value);
}
</script>
</head>
<body>
<img style="float: right;" onclick="javascript:lightdm.shutdown();" src="power_button.png" />
<div class="topBox"></div>
<div class="inputBox">
<table id="input_table" width="100%">
<tr>
<td id="prompt" width="45%" align="right"></td>
<td width="55%"><form action="javascript: handle_input()"><input id="entry"></form></td>
</tr>
</table>
</div>
<div class="messageBox" id="messages"></div>
<script type="text/javascript">
start_authentication();
</script>
</body>
<head>
<style>
html, body {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
}
body {
background: linear-gradient(white, SlateGray);
font-size: 24px;
}
.container {
width: 100%;
height: 100%;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
}
.topBox, .inputBox, .messageBox {
width: 100%;
height: 33.33%;
text-align: center;
}
.inputBox {
position: relative;
}
.wrapper {
height: 85px;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
.topBox {
text-align: right;
padding: 15px;
box-sizing: border-box;
}
.messageBox {
text-align: center;
visibility: hidden;
}
</style>
</head>
<body>
<div class="container">
<div class="topBox">
<img onclick="javascript:lightdm.shutdown();" src="power_button.png"/>
</div>
<div class="inputBox">
<div class="wrapper">
<div id="prompt"></div>
<form action="javascript: handle_input()">
<input id="entry" />
</form>
</div>
</div>
<div class="messageBox" id="messages"></div>
</div>
<script>
/*********************************************************************/
/* Callbacks for lightdm-webkit-greeter */
/*********************************************************************/
/**
* show_prompt callback.
*/
function show_prompt(text, type) {
// type is either "text" or "password"
prompt = document.getElementById("prompt");
prompt.innerHTML = text;
entry = document.getElementById("entry");
entry.value = ""; // clear entry
entry.type = type;
entry.focus();
}
/**
* show_message callback.
*/
function show_message(text, type) {
if (text.length == 0)
return;
messages = document.getElementById("messages");
messages.style.visibility = "visible";
// type is either "info" or "error"
if (type == "error") {
text = "<font color=\"red\">" + text + "</font>";
}
text = text + "<br>";
messages.innerHTML = messages.innerHTML + text;
}
/**
* authentication_complete callback.
*/
function authentication_complete() {
if (lightdm.is_authenticated) {
lightdm.start_session_sync(); // Start default session
} else {
show_message("Authentication Failed", "error");
setTimeout(start_authentication, 3000);
}
}
/**
* autologin_timer_expired callback.
*/
function autologin_timer_expired(username) {
/* Stub. Does nothing. */
}
/*********************************************************************/
/* Functions local to this greeter */
/*********************************************************************/
/**
* clear_messages
*/
function clear_messages() {
messages = document.getElementById("messages");
messages.innerHTML = "";
messages.style.visibility = "hidden";
}
/**
* Kickoff the authentication process
*/
function start_authentication() {
clear_messages();
lightdm.start_authentication(); // start with null userid, have pam prompt for userid.
}
/**
* handle the input from the entry field.
*/
function handle_input() {
entry = document.getElementById("entry");
lightdm.respond(entry.value);
}
</script>
<script src="../antergos/js/mock.js"></script>
<script>
start_authentication();
</script>
</body>
</html>

Loading…
Cancel
Save