Merge lp:~themuso/indicator-datetime/accessible-desc into lp:indicator-datetime/0.3

Proposed by Luke Yelavich
Status: Merged
Merged at revision: 43
Proposed branch: lp:~themuso/indicator-datetime/accessible-desc
Merge into: lp:indicator-datetime/0.3
Diff against target: 72 lines (+30/-0)
1 file modified
src/indicator-datetime.c (+30/-0)
To merge this branch: bzr merge lp:~themuso/indicator-datetime/accessible-desc
Reviewer Review Type Date Requested Status
Luke Yelavich (community) Needs Resubmitting
Ted Gould (community) Needs Fixing
Review via email: mp+49747@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2011-02-15 at 01:04 +0000, Luke Yelavich wrote:
> @@ -621,6 +623,11 @@
> if (ltime == NULL) {
> g_debug("Error getting local time");
> gtk_label_set_label(self->priv->label, _("Error getting time"));
> + g_signal_emit(G_OBJECT(self),
> + INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
> + 0,
> + (IndicatorObjectEntry *)indicator_object_get_entries(INDICATOR_OBJECT(self))->data,
> + TRUE);
> return NULL;
> }
>
> @@ -642,6 +649,12 @@
> self->priv->idle_measure = g_idle_add(idle_measure, io);
> }
>
> + g_signal_emit(G_OBJECT(self),
> + INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
> + 0,
> + (IndicatorObjectEntry *)indicator_object_get_entries(INDICATOR_OBJECT(self))->data,
> + TRUE);
> +
> return ltime;
> }

indicator_object_get_entires() returns a new GList of the entires
(though for this one it is only one). So the list needs to be free'd or
there will be a memory leak.

  review needsfixing

review: Needs Fixing
Revision history for this message
Luke Yelavich (themuso) wrote :

On Thu, Feb 17, 2011 at 09:22:52AM EST, Ted Gould wrote:
> indicator_object_get_entires() returns a new GList of the entires
> (though for this one it is only one). So the list needs to be free'd or
> there will be a memory leak.

Fixed in revision 43.

 review resubmit

review: Needs Resubmitting
43. By Luke Yelavich

Get the indicator entry data into a separate variable, adn and free it after
we signal a change in the accessible description, to avoid a memory leak.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator-datetime.c'
2--- src/indicator-datetime.c 2011-02-09 03:37:50 +0000
3+++ src/indicator-datetime.c 2011-02-17 00:08:13 +0000
4@@ -166,6 +166,7 @@
5 static void indicator_datetime_finalize (GObject *object);
6 static GtkLabel * get_label (IndicatorObject * io);
7 static GtkMenu * get_menu (IndicatorObject * io);
8+static const gchar * get_accessible_desc (IndicatorObject * io);
9 static GVariant * bind_enum_set (const GValue * value, const GVariantType * type, gpointer user_data);
10 static gboolean bind_enum_get (GValue * value, GVariant * variant, gpointer user_data);
11 static gchar * generate_format_string (IndicatorDatetime * self);
12@@ -203,6 +204,7 @@
13
14 io_class->get_label = get_label;
15 io_class->get_menu = get_menu;
16+ io_class->get_accessible_desc = get_accessible_desc;
17
18 g_object_class_install_property (object_class,
19 PROP_TIME_FORMAT,
20@@ -608,6 +610,7 @@
21 update_label (IndicatorDatetime * io)
22 {
23 IndicatorDatetime * self = INDICATOR_DATETIME(io);
24+ GList * entry = indicator_object_get_entries(INDICATOR_OBJECT(io));
25
26 if (self->priv->label == NULL) return NULL;
27
28@@ -621,6 +624,13 @@
29 if (ltime == NULL) {
30 g_debug("Error getting local time");
31 gtk_label_set_label(self->priv->label, _("Error getting time"));
32+
33+ g_signal_emit(G_OBJECT(self),
34+ INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
35+ 0,
36+ entry->data,
37+ TRUE);
38+ g_list_free(entry);
39 return NULL;
40 }
41
42@@ -642,6 +652,13 @@
43 self->priv->idle_measure = g_idle_add(idle_measure, io);
44 }
45
46+ g_signal_emit(G_OBJECT(self),
47+ INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
48+ 0,
49+ entry->data,
50+ TRUE);
51+ g_list_free(entry);
52+
53 return ltime;
54 }
55
56@@ -1313,3 +1330,16 @@
57
58 return GTK_MENU(self->priv->menu);
59 }
60+
61+static const gchar *
62+get_accessible_desc (IndicatorObject * io)
63+{
64+ IndicatorDatetime * self = INDICATOR_DATETIME(io);
65+ const gchar * name;
66+
67+ if (self->priv->label != NULL) {
68+ name = gtk_label_get_text(self->priv->label);
69+ return name;
70+ }
71+ return NULL;
72+}

Subscribers

People subscribed via source and target branches