aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/planner.c2
-rw-r--r--src/service.c26
-rw-r--r--src/utils.c5
3 files changed, 12 insertions, 21 deletions
diff --git a/src/planner.c b/src/planner.c
index 124aeae..e826c2c 100644
--- a/src/planner.c
+++ b/src/planner.c
@@ -188,6 +188,8 @@ indicator_datetime_planner_get_appointments (IndicatorDatetimePlanner * self,
IndicatorDatetimePlannerClass * klass;
g_return_if_fail (INDICATOR_IS_DATETIME_PLANNER (self));
+ g_return_val_if_fail (begin != NULL, NULL);
+ g_return_val_if_fail (end != NULL, NULL);
klass = INDICATOR_DATETIME_PLANNER_GET_CLASS (self);
g_return_if_fail (klass->get_appointments != NULL);
diff --git a/src/service.c b/src/service.c
index 3340337..0928205 100644
--- a/src/service.c
+++ b/src/service.c
@@ -227,7 +227,7 @@ calculate_seconds_until_next_fifteen_minutes (GDateTime * now)
g_date_time_get_day_of_month (next),
g_date_time_get_hour (next),
g_date_time_get_minute (next),
- 1);
+ 0.1);
str = g_date_time_format (start_of_next, "%F %T");
g_debug ("%s %s the next timestamp rebuild will be at %s", G_STRLOC, G_STRFUNC, str);
@@ -299,7 +299,7 @@ calculate_milliseconds_until_next_minute (GDateTime * now)
g_date_time_get_day_of_month (next),
g_date_time_get_hour (next),
g_date_time_get_minute (next),
- 0);
+ 0.1);
interval_usec = g_date_time_difference (start_of_next, now);
interval_msec = (interval_usec + 999) / 1000;
@@ -468,12 +468,11 @@ create_desktop_header_state (IndicatorDatetimeService * self)
g_variant_builder_init (&b, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&b, "{sv}", "accessible-desc", g_variant_new_string (str));
- g_variant_builder_add (&b, "{sv}", "label", g_variant_new_string (str));
+ g_variant_builder_add (&b, "{sv}", "label", g_variant_new_take_string (str));
g_variant_builder_add (&b, "{sv}", "visible", g_variant_new_boolean (visible));
/* cleanup */
g_date_time_unref (now);
- g_free (str);
g_free (fmt);
return g_variant_builder_end (&b);
}
@@ -497,7 +496,6 @@ create_phone_header_state (IndicatorDatetimeService * self)
now = indicator_datetime_service_get_localtime (self);
fmt = get_terse_time_format_string (now);
label = g_date_time_format (now, fmt);
- g_variant_builder_add (&b, "{sv}", "label", g_variant_new_string (label));
/* icon */
if ((has_alarms = service_has_alarms (self)))
@@ -514,14 +512,12 @@ create_phone_header_state (IndicatorDatetimeService * self)
else
a11y = g_strdup (label);
g_variant_builder_add (&b, "{sv}", "accessible-desc",
- g_variant_new_string (a11y));
+ g_variant_new_take_string (a11y));
- /* visible */
g_variant_builder_add (&b, "{sv}", "visible", g_variant_new_boolean (TRUE));
+ g_variant_builder_add (&b, "{sv}", "label", g_variant_new_take_string (label));
/* cleanup */
- g_free (a11y);
- g_free (label);
g_date_time_unref (now);
return g_variant_builder_end (&b);
}
@@ -621,10 +617,8 @@ add_localtime_menuitem (GMenu * menu,
static void
add_calendar_menuitem (GMenu * menu)
{
- char * label;
GMenuItem * menu_item;
- label = g_strdup ("[calendar]");
menu_item = g_menu_item_new ("[calendar]", NULL);
g_menu_item_set_action_and_target_value (menu_item, "indicator.calendar", g_variant_new_int64(0));
g_menu_item_set_attribute (menu_item, "x-canonical-type", "s", "com.canonical.indicator.calendar");
@@ -632,7 +626,6 @@ add_calendar_menuitem (GMenu * menu)
g_menu_append_item (menu, menu_item);
g_object_unref (menu_item);
- g_free (label);
}
static GMenuModel *
@@ -1004,18 +997,16 @@ create_locations_section (IndicatorDatetimeService * self)
struct TimeLocation * loc = l->data;
if (loc->visible)
{
- char * label;
char * detailed_action;
char * fmt;
GMenuItem * menu_item;
- label = g_strdup (loc->name);
detailed_action = g_strdup_printf ("indicator.set-location::%s %s",
loc->zone,
loc->name);
fmt = generate_full_format_string_at_time (now, loc->local_time, p->settings);
- menu_item = g_menu_item_new (label, detailed_action);
+ menu_item = g_menu_item_new (loc->name, detailed_action);
g_menu_item_set_attribute (menu_item, "x-canonical-type",
"s", "com.canonical.indicator.location");
g_menu_item_set_attribute (menu_item, "x-canonical-timezone",
@@ -1027,7 +1018,6 @@ create_locations_section (IndicatorDatetimeService * self)
g_object_unref (menu_item);
g_free (fmt);
g_free (detailed_action);
- g_free (label);
}
}
@@ -1620,8 +1610,8 @@ update_appointment_lists (IndicatorDatetimeService * self)
/* get all the appointments in the calendar month */
g_date_time_get_ymd (calendar_date, &y, &m, &d);
- begin = g_date_time_new_local (y, m, 1, 0, 0, 0);
- end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 0);
+ begin = g_date_time_new_local (y, m, 1, 0, 0, 0.1);
+ end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 59.9);
if (begin && end)
indicator_datetime_planner_get_appointments (planner, begin, end,
on_calendar_appointments_ready,
diff --git a/src/utils.c b/src/utils.c
index f8aa1f8..1c3626d 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -133,9 +133,9 @@ T_(const char *msg)
LC_MESSAGES directory, so we won't find any translation there.
*/
char *message_locale = g_strdup(setlocale(LC_MESSAGES, NULL));
- char *time_locale = g_strdup(setlocale(LC_TIME, NULL));
+ const char *time_locale = setlocale (LC_TIME, NULL);
char *language = g_strdup(g_getenv("LANGUAGE"));
- char *rv;
+ const char *rv;
if (language)
g_unsetenv("LANGUAGE");
setlocale(LC_MESSAGES, time_locale);
@@ -148,7 +148,6 @@ T_(const char *msg)
if (language)
g_setenv("LANGUAGE", language, TRUE);
g_free(message_locale);
- g_free(time_locale);
g_free(language);
return rv;
}