summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Davis <smd.seandavis@gmail.com>2020-06-22 18:38:57 -0400
committerSean Davis <smd.seandavis@gmail.com>2020-06-22 18:38:57 -0400
commit5c4ff6ef2e21ce97391401df4e52ec4d9a47ba54 (patch)
tree06a30df8a6f833e73a2f1f737b3c7c6207b8406e /src
parentd797072d729dce47d7cff155ca8c15756db6f6f8 (diff)
downloadlightdm-gtk-greeter-git-5c4ff6ef2e21ce97391401df4e52ec4d9a47ba54.tar.gz
Improve builds and error handling
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/lightdm-gtk-greeter.c27
2 files changed, 20 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fb717f9..5325a36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,6 +41,7 @@ AM_CPPFLAGS = \
-DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
-DUNITY_INDICATOR_DIR=\""$(UNITY_INDICATORDIR)"\" \
-DAYATANA_INDICATOR_DIR=\""$(AYATANA_INDICATORDIR)"\" \
+ -DSYSTEMD_SERVICE_DIR=\""$(SYSTEMD_SERVICE_DIR)"\" \
$(WARN_CFLAGS)
lightdm_gtk_greeter_CFLAGS = \
diff --git a/src/lightdm-gtk-greeter.c b/src/lightdm-gtk-greeter.c
index 73b7120..cefa348 100644
--- a/src/lightdm-gtk-greeter.c
+++ b/src/lightdm-gtk-greeter.c
@@ -1569,7 +1569,7 @@ find_indicator_exec (const gchar *name)
} else {
g_free (desktop);
- desktop = g_strdup_printf ("/usr/lib/systemd/user/%s.service", indicator);
+ desktop = g_strdup_printf ("%s/%s.service", SYSTEMD_SERVICE_DIR, indicator);
if (g_key_file_load_from_file (keyfile, desktop, G_KEY_FILE_NONE, NULL)) {
exec = g_key_file_get_string (keyfile, "Service", "ExecStart", NULL);
@@ -1590,6 +1590,7 @@ init_indicators (void)
gpointer iter_value;
gsize length = 0;
guint i;
+ GError *error = NULL;
#ifdef HAVE_LIBINDICATOR
IndicatorObject *io = NULL;
@@ -1676,11 +1677,6 @@ init_indicators (void)
#ifdef HAVE_LIBINDICATOR_NG
else
{ /* service file */
- gchar *exec = find_indicator_exec (names[i]);
- if (exec) {
- spawn_line_pid (exec, G_SPAWN_SEARCH_PATH, NULL);
- g_free (exec);
- }
#ifdef HAVE_UNITY_LIBINDICATOR_NG
if (strchr (names[i], '.'))
path = g_strdup_printf ("%s/%s", UNITY_INDICATOR_DIR, names[i]);
@@ -1692,7 +1688,14 @@ init_indicators (void)
else
path = g_strdup_printf ("%s/org.ayatana.indicator.%s", AYATANA_INDICATOR_DIR, names[i]);
#endif
- io = INDICATOR_OBJECT (indicator_ng_new_for_profile (path, "desktop_greeter", NULL));
+ io = INDICATOR_OBJECT (indicator_ng_new_for_profile (path, "desktop_greeter", &error));
+ if (io) {
+ gchar *exec = find_indicator_exec (names[i]);
+ if (exec) {
+ spawn_line_pid (exec, G_SPAWN_SEARCH_PATH, NULL);
+ g_free (exec);
+ }
+ }
}
#endif
@@ -1720,9 +1723,17 @@ init_indicators (void)
}
else
{
- g_warning ("Indicator \"%s\": failed to load", names[i]);
+ if (error != NULL) {
+ g_warning ("Indicator \"%s\": Failed to load from %s: %s", names[i], path, error->message);
+ g_clear_error (&error);
+ } else {
+ g_warning ("Indicator \"%s\": failed to load", names[i]);
+ }
}
+ if (error != NULL)
+ g_clear_error (&error);
+
g_free (path);
#endif
}