diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.in | 10 | ||||
-rw-r--r-- | src/datetime-service.c | 89 | ||||
-rw-r--r-- | src/indicator-datetime.c | 16 |
3 files changed, 68 insertions, 47 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 0b4b885..b8b7fb2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -39,10 +39,13 @@ libexec_PROGRAMS = indicator-datetime-service$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -110,7 +113,7 @@ indicator_datetime_service_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(indicator_datetime_service_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -202,7 +205,6 @@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBMAP_CFLAGS = @LIBMAP_CFLAGS@ -LIBMAP_LDFLAGS = @LIBMAP_LDFLAGS@ LIBMAP_LIBS = @LIBMAP_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ diff --git a/src/datetime-service.c b/src/datetime-service.c index 6c876aa..8d25b3c 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -60,6 +60,7 @@ static gboolean update_timezone_menu_items(gpointer user_data); static void setup_timer (void); static void geo_client_invalid (GeoclueMasterClient * client, gpointer user_data); static void geo_address_change (GeoclueMasterClient * client, gchar * a, gchar * b, gchar * c, gchar * d, gpointer user_data); +static gboolean get_greeter_mode (void); static IndicatorService * service = NULL; static GMainLoop * mainloop = NULL; @@ -534,6 +535,10 @@ static gboolean update_timezone_menu_items(gpointer user_data) { g_debug("Updating timezone menu items"); + if (locations_separator == NULL || current_location == NULL) { + return FALSE; + } + gchar ** locations = g_settings_get_strv(conf, SETTINGS_LOCATIONS_S); if (locations == NULL) { @@ -1077,45 +1082,47 @@ build_menus (DbusmenuMenuitem * root) g_idle_add(check_for_calendar, NULL); } + + if (!get_greeter_mode ()) { + locations_separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(locations_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + dbusmenu_menuitem_child_append(root, locations_separator); + + geo_location = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set (geo_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); + set_current_timezone_label (geo_location, ""); + dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + g_signal_connect(G_OBJECT(geo_location), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(quick_set_tz), NULL); + dbusmenu_menuitem_child_append(root, geo_location); + + current_location = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set (current_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); + set_current_timezone_label (current_location, ""); + dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + dbusmenu_menuitem_child_append(root, current_location); - locations_separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(locations_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - dbusmenu_menuitem_child_append(root, locations_separator); - - geo_location = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (geo_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); - set_current_timezone_label (geo_location, ""); - dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - g_signal_connect(G_OBJECT(geo_location), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(quick_set_tz), NULL); - dbusmenu_menuitem_child_append(root, geo_location); - - current_location = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (current_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); - set_current_timezone_label (current_location, ""); - dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - dbusmenu_menuitem_child_append(root, current_location); - - check_timezone_sync(); + check_timezone_sync(); - g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); - g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); - g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL); - g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL); - - DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_append(root, separator); - - settings = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings...")); - /* insensitive until we check for available apps */ - dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime"); - dbusmenu_menuitem_child_append(root, settings); - g_idle_add(check_for_timeadmin, NULL); + g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); + g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); + g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL); + g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL); + + DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + dbusmenu_menuitem_child_append(root, separator); + + settings = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings...")); + /* insensitive until we check for available apps */ + dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime"); + dbusmenu_menuitem_child_append(root, settings); + g_idle_add(check_for_timeadmin, NULL); + } return; } @@ -1396,6 +1403,14 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar * return; } +static gboolean +get_greeter_mode (void) +{ + const gchar *var; + var = g_getenv("INDICATOR_GREETER_MODE"); + return (g_strcmp0(var, "1") == 0); +} + /* Repsonds to the service object saying it's time to shutdown. It stops the mainloop. */ static void diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 072253b..163804b 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -829,11 +829,13 @@ update_label (IndicatorDatetime * io, GDateTime ** datetime) static void update_time (IndicatorDatetime * self) { - GDateTime * dt; + GDateTime * dt = NULL; update_label(self, &dt); timezone_update_all_labels(self); - setup_timer(self, dt); - g_date_time_unref(dt); + if (dt != NULL) { + setup_timer(self, dt); + g_date_time_unref(dt); + } return; } @@ -857,11 +859,13 @@ timer_func (gpointer user_data) { IndicatorDatetime * self = INDICATOR_DATETIME(user_data); self->priv->timer = 0; - GDateTime * dt; + GDateTime * dt = NULL; update_label(self, &dt); timezone_update_all_labels(self); - setup_timer(self, dt); - g_date_time_unref(dt); + if (dt != NULL) { + setup_timer(self, dt); + g_date_time_unref(dt); + } return FALSE; } |