~ubuntu-branches/ubuntu/precise/gnome-bluetooth/precise-updates

« back to all changes in this revision

Viewing changes to applet/notify.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2009-08-05 13:34:38 UTC
  • mto: (2.2.1 experimental) (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090805133438-791u4ywsppj71d9y
Tags: upstream-2.27.8
ImportĀ upstreamĀ versionĀ 2.27.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
static GtkStatusIcon *statusicon = NULL;
35
35
static char *icon_name = NULL;
 
36
static char *tooltip = NULL;
36
37
static NotifyNotification *notify = NULL;
37
38
 
38
39
static void notify_action(NotifyNotification *notify,
40
41
{
41
42
}
42
43
 
 
44
gboolean notification_supports_actions (void)
 
45
{
 
46
        gboolean supports_actions = FALSE;
 
47
        GList *caps = NULL;
 
48
 
 
49
        caps = notify_get_server_caps ();
 
50
        if (g_list_find_custom(caps, "actions", (GCompareFunc)g_strcmp0) != NULL)
 
51
                supports_actions = TRUE;
 
52
 
 
53
        g_list_foreach(caps, (GFunc)g_free, NULL);
 
54
        g_list_free (caps);
 
55
 
 
56
        return supports_actions;
 
57
}
 
58
 
43
59
void show_notification(const gchar *summary, const gchar *message,
44
60
                        const gchar *action, gint timeout, GCallback handler)
45
61
{
95
111
        notify_init("bluetooth-manager");
96
112
 
97
113
        statusicon = gtk_status_icon_new_from_icon_name(icon_name);
98
 
 
99
 
        gtk_status_icon_set_tooltip_markup(statusicon, _("Bluetooth Manager"));
 
114
        gtk_status_icon_set_tooltip_markup(statusicon, tooltip);
100
115
 
101
116
        return statusicon;
102
117
}
109
124
 
110
125
        g_free (icon_name);
111
126
        icon_name = NULL;
 
127
        g_free (tooltip);
 
128
        tooltip = NULL;
112
129
 
113
130
        notify_uninit();
114
131
}
128
145
void set_icon(gboolean enabled)
129
146
{
130
147
        const char *name = (enabled ? "bluetooth" : "bluetooth-disabled");
 
148
        const char *_tooltip = enabled ? _("Bluetooth: Enabled") : _("Bluetooth: Disabled");
131
149
 
132
150
        if (statusicon == NULL) {
133
151
                g_free (icon_name);
134
152
                icon_name = g_strdup (name);
 
153
                tooltip = g_strdup (_tooltip);
135
154
        } else {
136
155
                gtk_status_icon_set_from_icon_name (statusicon, name);
 
156
                gtk_status_icon_set_tooltip_markup(statusicon, _tooltip);
137
157
        }
138
158
}
139
159