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 static void
_mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) { _mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) {
JSValueRef result; 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 static JSValueRef
mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) { mkexception(JSContextRef context, JSValueRef *exception, const gchar *str) {
_mkexception(context, exception, 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 /* FIXME: old API required lightdm.login(username, session), but the username
* is never actually used. At some point, deprecate the old usage. For now, * is never actually used. At some point, deprecate the old usage. For now,
* simply work around it. */ * simply work around it.
*/
if (argumentCount == 1) { if (argumentCount == 1) {
session = arg_to_string(context, arguments[0], exception); session = arg_to_string(context, arguments[0], exception);
} else if (argumentCount == 2) { } else if (argumentCount == 2) {
@ -1020,7 +1020,7 @@ ngettext_cb(JSContextRef context,
/* /*
* Gets a key's value from config file. * Gets a key's value from config file.
* *
* Returns config key's value as string. * Returns value as a string.
*/ */
static JSValueRef static JSValueRef
get_conf_str_cb(JSContextRef context, get_conf_str_cb(JSContextRef context,
@ -1067,7 +1067,7 @@ get_conf_str_cb(JSContextRef context,
/* /*
* Gets a key's value from config file. * Gets a key's value from config file.
* *
* Returns config key's value as number. * Returns value as a number.
*/ */
static JSValueRef static JSValueRef
get_conf_num_cb(JSContextRef context, get_conf_num_cb(JSContextRef context,
@ -1110,7 +1110,7 @@ get_conf_num_cb(JSContextRef context,
/* /*
* Gets a key's value from config file. * Gets a key's value from config file.
* *
* Returns config key's value as bool. * Returns value as a bool.
*/ */
static JSValueRef static JSValueRef
get_conf_bool_cb(JSContextRef context, get_conf_bool_cb(JSContextRef context,
@ -1302,15 +1302,6 @@ static const JSClassDefinition config_file_definition = {
config_file_functions, /* Static functions */ 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 static void
window_object_cleared_callback(WebKitScriptWorld *world, window_object_cleared_callback(WebKitScriptWorld *world,

320
themes/simple/index.html

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

Loading…
Cancel
Save