From 9a1d9169187380d74a2baa6ce76fa6efe4b8252d Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Sat, 7 Jan 2017 16:34:44 -0600 Subject: [PATCH] drop lightdm from config and desktop file names. --- ... com.antergos.webkit2-greeter.appdata.xml} | 0 ...p => com.antergos.webkit2-greeter.desktop} | 0 data/meson.build | 9 +++-- ...kit2-greeter.conf => webkit2-greeter.conf} | 0 meson.build | 10 ++++-- src/greeter.c | 33 +++++++++++-------- 6 files changed, 34 insertions(+), 18 deletions(-) rename data/{com.antergos.lightdm-webkit2-greeter.appdata.xml => com.antergos.webkit2-greeter.appdata.xml} (100%) rename data/{com.antergos.lightdm-webkit2-greeter.desktop => com.antergos.webkit2-greeter.desktop} (100%) rename data/{lightdm-webkit2-greeter.conf => webkit2-greeter.conf} (100%) diff --git a/data/com.antergos.lightdm-webkit2-greeter.appdata.xml b/data/com.antergos.webkit2-greeter.appdata.xml similarity index 100% rename from data/com.antergos.lightdm-webkit2-greeter.appdata.xml rename to data/com.antergos.webkit2-greeter.appdata.xml diff --git a/data/com.antergos.lightdm-webkit2-greeter.desktop b/data/com.antergos.webkit2-greeter.desktop similarity index 100% rename from data/com.antergos.lightdm-webkit2-greeter.desktop rename to data/com.antergos.webkit2-greeter.desktop diff --git a/data/meson.build b/data/meson.build index 326d6f3..124dc65 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,12 +1,15 @@ -appdata_file = 'com.antergos.lightdm-webkit2-greeter.appdata.xml' +id = 'com.antergos.webkit2-greeter' +appdata_file = '@0@.appdata.xml'.format(id) +desktop_file = '@0@.desktop'.format(id) + install_data( - 'com.antergos.lightdm-webkit2-greeter.desktop', + desktop_file, install_dir: get_option('with-desktop-dir') ) install_data( - 'lightdm-webkit2-greeter.conf', + 'webkit2-greeter.conf', install_dir: get_option('with-config-dir') ) diff --git a/data/lightdm-webkit2-greeter.conf b/data/webkit2-greeter.conf similarity index 100% rename from data/lightdm-webkit2-greeter.conf rename to data/webkit2-greeter.conf diff --git a/meson.build b/meson.build index 0615d57..c056dd0 100644 --- a/meson.build +++ b/meson.build @@ -36,7 +36,9 @@ has_gtk_3_22 = gtk3.version().version_compare('>=3.22') # ------->>> Configuration <<<------- # # =================================== # -conf = configuration_data() +conf = configuration_data() +config_file = 'webkit2-greeter.conf' +config_file_legacy = 'lightdm-webkit2-greeter.conf' conf.set('VERSION', as_version) conf.set('PACKAGE_VERSION', as_version) @@ -52,11 +54,15 @@ conf.set('THEME_DIR', '"@0@"'.format(get_option('with-theme-dir'))) conf.set('CONFIG_DIR', '"@0@"'.format(get_option('with-config-dir'))) +conf.set('CONFIG_FILE', '"@0@/@1@"'.format(get_option('with-config-dir'), config_file) + +conf.set('CONFIG_FILE_LEGACY', '"@0@/@1@"'.format(get_option('with-config-dir'), config_file_legacy) + conf.set('DESKTOP_DIR', '"@0@"'.format(get_option('with-desktop-dir'))) conf.set('WEBEXT_DIR', '"@0@"'.format(get_option('with-webext-dir'))) -conf.set('GRESOURCE_PATH', '"/com/antergos/lightdm-webkit2-greeter"') +conf.set('GRESOURCE_PATH', '"/com/antergos/webkit2-greeter"') if has_webkitgtk_2_14 conf.set('HAS_WEBKITGTK_2_14', has_webkitgtk_2_14) diff --git a/src/greeter.c b/src/greeter.c index 3a4a3ea..b0bd726 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -364,17 +364,24 @@ main(int argc, char **argv) { g_unix_signal_add(SIGINT, (GSourceFunc) quit_cb, NULL); g_unix_signal_add(SIGHUP, (GSourceFunc) quit_cb, NULL); - /* BEGIN Greeter Config File */ + /* BEGIN Load Greeter Config */ + /* TODO: Handle config values and fallbacks some other way, this is ugly! */ keyfile = g_key_file_new(); - g_key_file_load_from_file( - keyfile, - CONFIG_DIR "/lightdm-webkit2-greeter.conf", - G_KEY_FILE_NONE, - NULL - ); + g_key_file_load_from_file(keyfile, CONFIG_FILE, G_KEY_FILE_NONE, &err); + + if (NULL != err) { + g_clear_error(&err); + g_key_file_load_from_file(keyfile, CONFIG_FILE_LEGACY, G_KEY_FILE_NONE, &err); + + if (NULL != err) { + // Unable to load config file. Use defaults. + theme = "antergos"; + config_timeout = 300; + debug_mode = FALSE; + } + } - /* TODO: Handle config values and fallbacks some other way, this is garbage! */ theme = g_key_file_get_string(keyfile, "greeter", "webkit_theme", &err); if ( NULL != err) { @@ -395,15 +402,15 @@ main(int argc, char **argv) { config_timeout = g_key_file_get_integer(keyfile, "greeter", "screensaver-timeout", &err); if ( NULL != err) { - g_error_free(err); + g_clear_error(&err); config_timeout = 300; } } - debug_mode = g_key_file_get_boolean(keyfile, "greeter", "debug_mode", NULL); + debug_mode = g_key_file_get_boolean(keyfile, "greeter", "debug_mode", &err); - if ( NULL != err) { - g_clear_error(&err); + if (NULL != err) { + g_error_free(err); debug_mode = FALSE; } /* END Greeter Config File */ @@ -439,7 +446,7 @@ main(int argc, char **argv) { g_resources_register(greeter_resources); gtk_css_provider_load_from_resource( GTK_CSS_PROVIDER(css_provider), - "/com/antergos/lightdm-webkit2-greeter/css/style.css" + "/com/antergos/webkit2-greeter/css/style.css" ); gtk_style_context_add_provider_for_screen( screen,