~jjardon/indicator-me/fix-autotools

« back to all changes in this revision

Viewing changes to src/indicator-me.c

  • Committer: Ken VanDine
  • Date: 2011-03-02 19:06:50 UTC
  • mfrom: (129.1.2 indicator-me)
  • Revision ID: ken.vandine@canonical.com-20110302190650-ztfjuy6s91po5q0n
Add accessible description support

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include <glib.h>
26
26
#include <glib-object.h>
 
27
#include <glib/gi18n.h>
27
28
#include <gtk/gtk.h>
28
29
#include <gio/gio.h>
29
30
#include <libdbusmenu-glib/menuitem.h>
76
77
 
77
78
static IdoEntryMenuItem *ido_entry = NULL;
78
79
 
 
80
static const gchar *status_desc = NULL;
 
81
 
79
82
/* Prototypes */
80
83
static GtkLabel * get_label (IndicatorObject * io);
81
84
static GtkImage * get_icon (IndicatorObject * io);
82
85
static GtkMenu * get_menu (IndicatorObject * io);
 
86
static const gchar * get_accessible_desc (IndicatorObject * io);
83
87
 
84
88
static void indicator_me_class_init (IndicatorMeClass *klass);
85
89
static void indicator_me_init       (IndicatorMe *self);
119
123
        io_class->get_label = get_label;
120
124
        io_class->get_image = get_icon;
121
125
        io_class->get_menu = get_menu;
 
126
        io_class->get_accessible_desc = get_accessible_desc;
122
127
 
123
128
        return;
124
129
}
235
240
        return status_image;
236
241
}
237
242
 
 
243
static const gchar *
 
244
get_accessible_desc (IndicatorObject * io)
 
245
{
 
246
        if (label == NULL) {
 
247
                /* Create the label if it doesn't exist already */
 
248
                username_changed (NULL, NULL);
 
249
        }
 
250
        return g_strdup_printf("%s (%s)", gtk_label_get_text(label), status_desc);
 
251
}
 
252
 
238
253
static void
239
254
status_icon_cb (GObject * object, GAsyncResult * res, gpointer user_data)
240
255
{
273
288
                gtk_widget_show(GTK_WIDGET(status_image));
274
289
        }
275
290
 
 
291
        if (g_strcmp0(icon, "user-away") == 0) {
 
292
                status_desc = _("Away"));
 
293
        } else if (g_strcmp0(icon, "user-invisible") == 0) {
 
294
                status_desc = _("Invisible"));
 
295
        } else if (g_strcmp0(icon, "user-busy") == 0) {
 
296
                status_desc = _("Busy"));
 
297
        } else if (g_strcmp0(icon, "user-available") == 0) {
 
298
                status_desc = _("Available"));
 
299
        } else if (g_strcmp0(icon, "user-indeterminate") == 0) {
 
300
                status_desc = _("Unknown"));
 
301
        } else if (g_strcmp0(icon, "user-offline") == 0) {
 
302
                status_desc = _("Offline"));
 
303
        }
 
304
 
276
305
        gchar *panel_icon = g_strconcat (icon, "-panel", NULL);
277
306
        indicator_image_helper_update (status_image, panel_icon);
278
307
        g_free (panel_icon);