~ubuntu-branches/ubuntu/lucid/indicator-messages/lucid

« back to all changes in this revision

Viewing changes to src/indicator-messages.c

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2009-12-10 14:35:46 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20091210143546-n7coeuatbdodbaju
Tags: 0.2.6+r156-0ubuntu1
* New snapshot for libindicator 0.3.0
* debian/control
  - Build-Depends on libindicator >= 0.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include <string.h>
24
24
#include <glib.h>
 
25
#include <glib-object.h>
25
26
#include <gtk/gtk.h>
26
27
#include <libdbusmenu-gtk/menu.h>
27
28
#include <libdbusmenu-gtk/menuitem.h>
29
30
#include <dbus/dbus-glib-bindings.h>
30
31
 
31
32
#include <libindicator/indicator.h>
32
 
INDICATOR_SET_VERSION
33
 
INDICATOR_SET_NAME("messages")
 
33
#include <libindicator/indicator-object.h>
34
34
 
35
35
#include "dbus-data.h"
36
36
#include "messages-service-client.h"
37
37
 
 
38
#define INDICATOR_MESSAGES_TYPE            (indicator_messages_get_type ())
 
39
#define INDICATOR_MESSAGES(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_MESSAGES_TYPE, IndicatorMessages))
 
40
#define INDICATOR_MESSAGES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_MESSAGES_TYPE, IndicatorMessagesClass))
 
41
#define IS_INDICATOR_MESSAGES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_MESSAGES_TYPE))
 
42
#define IS_INDICATOR_MESSAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_MESSAGES_TYPE))
 
43
#define INDICATOR_MESSAGES_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_MESSAGES_TYPE, IndicatorMessagesClass))
 
44
 
 
45
typedef struct _IndicatorMessages      IndicatorMessages;
 
46
typedef struct _IndicatorMessagesClass IndicatorMessagesClass;
 
47
 
 
48
struct _IndicatorMessagesClass {
 
49
        IndicatorObjectClass parent_class;
 
50
};
 
51
 
 
52
struct _IndicatorMessages {
 
53
        IndicatorObject parent;
 
54
};
 
55
 
 
56
GType indicator_messages_get_type (void);
 
57
 
 
58
/* Indicator Module Config */
 
59
INDICATOR_SET_VERSION
 
60
INDICATOR_SET_TYPE(INDICATOR_MESSAGES_TYPE)
 
61
 
 
62
/* Globals */
38
63
static GtkWidget * main_image = NULL;
39
 
 
40
64
#define DESIGN_TEAM_SIZE  design_team_size
41
65
static GtkIconSize design_team_size;
42
 
 
43
66
static DBusGProxy * icon_proxy = NULL;
44
 
 
45
67
static GtkSizeGroup * indicator_right_group = NULL;
46
68
 
 
69
/* Prototypes */
 
70
static void indicator_messages_class_init (IndicatorMessagesClass *klass);
 
71
static void indicator_messages_init       (IndicatorMessages *self);
 
72
static void indicator_messages_dispose    (GObject *object);
 
73
static void indicator_messages_finalize   (GObject *object);
 
74
static GtkImage * get_icon                (IndicatorObject * io);
 
75
static GtkMenu * get_menu                 (IndicatorObject * io);
 
76
 
 
77
G_DEFINE_TYPE (IndicatorMessages, indicator_messages, INDICATOR_OBJECT_TYPE);
 
78
 
 
79
static void
 
80
indicator_messages_class_init (IndicatorMessagesClass *klass)
 
81
{
 
82
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
83
 
 
84
        object_class->dispose = indicator_messages_dispose;
 
85
        object_class->finalize = indicator_messages_finalize;
 
86
 
 
87
        IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass);
 
88
 
 
89
        io_class->get_image = get_icon;
 
90
        io_class->get_menu = get_menu;
 
91
 
 
92
        return;
 
93
}
 
94
 
 
95
static void
 
96
indicator_messages_init (IndicatorMessages *self)
 
97
{
 
98
}
 
99
 
 
100
static void
 
101
indicator_messages_dispose (GObject *object)
 
102
{
 
103
G_OBJECT_CLASS (indicator_messages_parent_class)->dispose (object);
 
104
}
 
105
 
 
106
static void
 
107
indicator_messages_finalize (GObject *object)
 
108
{
 
109
G_OBJECT_CLASS (indicator_messages_parent_class)->finalize (object);
 
110
}
 
111
 
 
112
 
 
113
 
 
114
/* Functions */
47
115
static void
48
116
attention_changed_cb (DBusGProxy * proxy, gboolean dot, gpointer userdata)
49
117
{
303
371
        return TRUE;
304
372
}
305
373
 
306
 
GtkLabel *
307
 
get_label (void)
308
 
{
309
 
        return NULL;
310
 
}
311
 
 
312
 
GtkImage *
313
 
get_icon (void)
 
374
static GtkImage *
 
375
get_icon (IndicatorObject * io)
314
376
{
315
377
        design_team_size = gtk_icon_size_register("design-team-size", 22, 22);
316
378
 
320
382
        return GTK_IMAGE(main_image);
321
383
}
322
384
 
323
 
GtkMenu *
324
 
get_menu (void)
 
385
static GtkMenu *
 
386
get_menu (IndicatorObject * io)
325
387
{
326
388
        guint returnval = 0;
327
389
        GError * error = NULL;