aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am83
-rw-r--r--src/utils.c51
2 files changed, 83 insertions, 51 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f247c1..093a258 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,44 +1,67 @@
-if BUILD_CCPANEL
-ccpaneldir = $(libdir)/control-center-1/panels/
-ccpanel_LTLIBRARIES = libindicator-datetime.la
-endif
+SHARED_CFLAGS = \
+ -Wall \
+ -Wextra -Wno-missing-field-initializers \
+ -Werror \
+ $(SERVICE_CFLAGS) \
+ $(COVERAGE_CFLAGS) \
+ -DTIMEZONE_FILE="\"/etc/timezone\"" \
+ -DG_LOG_DOMAIN=\"Indicator-Datetime\"
+
+###
+###
+###
+
+noinst_LIBRARIES = libindicator-datetime-service.a
+
+libindicator_datetime_service_a_CFLAGS = \
+ $(SHARED_CFLAGS)
+
+libindicator_datetime_service_a_SOURCES = \
+ planner.c \
+ planner.h \
+ planner-eds.c \
+ planner-eds.h \
+ service.c \
+ service.h \
+ timezone.c \
+ timezone.h \
+ timezone-file.c \
+ timezone-file.h \
+ timezone-geoclue.c \
+ timezone-geoclue.h \
+ utils.c \
+ utils.h \
+ dbus-shared.h \
+ settings-shared.h
+
+###
+###
+###
libexec_PROGRAMS = indicator-datetime-service
indicator_datetime_service_SOURCES = \
- planner.c \
- planner.h \
- planner-eds.c \
- planner-eds.h \
- service.c \
- service.h \
- main.c \
- timezone.c \
- timezone.h \
- timezone-file.c \
- timezone-file.h \
- timezone-geoclue.c \
- timezone-geoclue.h \
- utils.c \
- utils.h \
- dbus-shared.h \
- settings-shared.h
+ main.c
indicator_datetime_service_CFLAGS = \
- -Wall \
- -Wextra -Wno-missing-field-initializers \
- -Werror \
- $(SERVICE_CFLAGS) \
- $(COVERAGE_CFLAGS) \
- -DTIMEZONE_FILE="\"/etc/timezone\"" \
- -DG_LOG_DOMAIN=\"Indicator-Datetime\"
+ $(SHARED_CFLAGS)
+
indicator_datetime_service_LDADD = \
- $(SERVICE_LIBS)
+ libindicator-datetime-service.a \
+ $(SERVICE_LIBS)
+
indicator_datetime_service_LDFLAGS = \
- $(COVERAGE_LDFLAGS)
+ $(COVERAGE_LDFLAGS)
+
+###
+###
+###
if BUILD_CCPANEL
+ccpaneldir = $(libdir)/control-center-1/panels/
+ccpanel_LTLIBRARIES = libindicator-datetime.la
+
libindicator_datetime_la_SOURCES =\
datetime-prefs.c \
datetime-prefs-locations.c \
diff --git a/src/utils.c b/src/utils.c
index 1c3626d..9b0f24f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -53,32 +53,41 @@ is_locale_12h (void)
void
split_settings_location (const gchar * location, gchar ** zone, gchar ** name)
{
- gchar * location_dup = g_strdup (location);
- gchar * first = strchr (location_dup, ' ');
+ gchar * location_dup;
+ gchar * first;
- if (first) {
- first[0] = 0;
- }
+ location_dup = g_strdup (location);
+ g_strstrip (location_dup);
- if (zone) {
- *zone = location_dup;
- }
+ if ((first = strchr (location_dup, ' ')))
+ *first = '\0';
- if (name) {
- gchar * after = first ? g_strstrip (first + 1) : NULL;
- if (after == NULL || after[0] == 0) {
- /* Make up name from zone */
- gchar * chr = strrchr (location_dup, '/');
- after = g_strdup (chr ? chr + 1 : location_dup);
- while ((chr = strchr (after, '_')) != NULL) { /* and turn underscores to spaces */
- *chr = ' ';
- }
- *name = after;
+ if (zone != NULL)
+ {
+ *zone = location_dup;
}
- else {
- *name = g_strdup (after);
+
+ if (name != NULL)
+ {
+ gchar * after = first ? g_strstrip (first + 1) : NULL;
+
+ if (after && *after)
+ {
+ *name = g_strdup (after);
+ }
+ else /* make the name from zone */
+ {
+ gchar * chr = strrchr (location_dup, '/');
+ after = g_strdup (chr ? chr + 1 : location_dup);
+
+ /* replace underscores with spaces */
+ for (chr=after; chr && *chr; chr++)
+ if (*chr == '_')
+ *chr = ' ';
+
+ *name = after;
+ }
}
- }
}
gchar *