Merge lp:~ted/indicator-messages/bool-handling into lp:indicator-messages/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/indicator-messages/bool-handling
Merge into: lp:indicator-messages/0.5
Diff against target: 53 lines (+15/-6)
1 file modified
src/im-menu-item.c (+15/-6)
To merge this branch: bzr merge lp:~ted/indicator-messages/bool-handling
Reviewer Review Type Date Requested Status
Aurélien Gâteau (community) Approve
Review via email: mp+21254@code.launchpad.net

Description of the change

Making the attention property handler take booleans as well -- which
everyone should be moving to.

To post a comment you must log in.
Revision history for this message
Aurélien Gâteau (agateau) wrote :

It works!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/im-menu-item.c'
2--- src/im-menu-item.c 2010-02-05 02:12:10 +0000
3+++ src/im-menu-item.c 2010-03-12 16:20:33 +0000
4@@ -358,7 +358,7 @@
5 this indicator should be calling for attention or not. If we are,
6 we need to signal that. */
7 static void
8-attention_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data)
9+attention_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const GValue * propertydata, gpointer data)
10 {
11 g_debug("Got Attention Information");
12 ImMenuItem * self = IM_MENU_ITEM(data);
13@@ -373,10 +373,19 @@
14 ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self);
15
16 gboolean wantit;
17- if (propertydata == NULL || propertydata[0] == '\0' || !g_strcmp0(propertydata, "false")) {
18- wantit = FALSE;
19+ if (G_VALUE_HOLDS_BOOLEAN(propertydata)) {
20+ wantit = g_value_get_boolean(propertydata);
21+ } else if (G_VALUE_HOLDS_STRING(propertydata)) {
22+ const gchar * propstring = g_value_get_string(propertydata);
23+
24+ if (propstring == NULL || propstring[0] == '\0' || !g_strcmp0(propstring, "false")) {
25+ wantit = FALSE;
26+ } else {
27+ wantit = TRUE;
28+ }
29 } else {
30- wantit = TRUE;
31+ g_warning("Got property '%s' of an unknown type.", property);
32+ return;
33 }
34
35 if (priv->attention != wantit) {
36@@ -418,7 +427,7 @@
37 } else if (!g_strcmp0(property, INDICATE_INDICATOR_MESSAGES_PROP_COUNT)) {
38 indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT, count_cb, self);
39 } else if (!g_strcmp0(property, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION)) {
40- indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self);
41+ indicate_listener_get_property_value(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self);
42 } else if (!g_strcmp0(property, "sender")) {
43 /* This is a compatibility string with v1 and should be removed */
44 g_debug("Indicator is using 'sender' property which is a v1 string.");
45@@ -451,7 +460,7 @@
46 indicate_listener_get_property_time(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_TIME, time_cb, self);
47 indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ICON, icon_cb, self);
48 indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT, count_cb, self);
49- indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self);
50+ indicate_listener_get_property_value(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self);
51 indicate_listener_get_property(listener, server, indicator, "sender", sender_cb, self);
52
53 g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL);

Subscribers

People subscribed via source and target branches

to all changes: