diff options
-rw-r--r-- | src/datetime-service.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index c59c05b..44fffdc 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -84,7 +84,7 @@ static DbusmenuMenuitem * events_separator = NULL; static DbusmenuMenuitem * locations_separator = NULL; static DbusmenuMenuitem * add_appointment = NULL; static GList * appointments = NULL; -static GList * location_menu_items = NULL; +static GSList * location_menu_items = NULL; static GList * comp_instances = NULL; static gboolean updating_appointments = FALSE; static time_t start_time_appointments = (time_t) 0; @@ -138,10 +138,10 @@ static int time_location_compare (const struct TimeLocation * a, const struct TimeLocation * b) { int ret; - if (a->offset != b->offset) + if (a->offset != b->offset) /* primary key s.t. we can sort by timezone order */ ret = a->offset - b->offset; else - ret = g_strcmp0 (a->name, b->name); + ret = g_strcmp0 (a->name, b->name); /* secondary key */ g_debug ("%s comparing '%s' (%d) to '%s' (%d), returning %d", G_STRLOC, a->name, (int)a->offset, b->name, (int)b->offset, ret); return ret; } @@ -164,15 +164,14 @@ locations_add (GSList * locations, const char * zone, const char * name) static void update_location_menu_items (void) { + /* if we're in greeter mode, don't bother */ if (locations_separator == NULL) return; - GSList * locations = NULL; - /* remove the previous locations */ while (location_menu_items != NULL) { DbusmenuMenuitem * item = DBUSMENU_MENUITEM(location_menu_items->data); - location_menu_items = g_list_remove(location_menu_items, item); + location_menu_items = g_slist_remove(location_menu_items, item); dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(item)); g_object_unref(G_OBJECT(item)); } @@ -182,6 +181,8 @@ update_location_menu_items (void) **** current_timezone, and SETTINGS_LOCATIONS_S, but omit duplicates. ***/ + GSList * locations = NULL; + /* maybe add geo_timezone */ if (geo_timezone != NULL) { gchar * name = get_current_zone_name (geo_timezone); @@ -197,10 +198,10 @@ update_location_menu_items (void) } /* maybe add the user-specified custom locations */ - gchar ** user_locations = g_settings_get_strv(conf, SETTINGS_LOCATIONS_S); + gchar ** user_locations = g_settings_get_strv (conf, SETTINGS_LOCATIONS_S); if (user_locations != NULL) { gint i; - const guint location_count = g_strv_length(user_locations); + const guint location_count = g_strv_length (user_locations); g_debug ("%s Found %u user-specified locations", G_STRLOC, location_count); for (i=0; i<location_count; i++) { gchar * zone; @@ -233,7 +234,7 @@ update_location_menu_items (void) dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_VISIBLE, show_locations); dbusmenu_menuitem_child_add_position (root, item, offset++); g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(quick_set_tz), NULL); - location_menu_items = g_list_append (location_menu_items, item); + location_menu_items = g_slist_append (location_menu_items, item); time_location_free (loc); } g_slist_free (locations); @@ -368,7 +369,7 @@ execute_command (const gchar * command) /* Run a particular program based on an activation */ static void -activate_cb (DbusmenuMenuitem * menuitem G_GNUC_UNUSED, +activate_cb (DbusmenuMenuitem * menuitem G_GNUC_UNUSED, guint timestamp G_GNUC_UNUSED, const gchar * command) { |