~ted/libindicator/lp942042

« back to all changes in this revision

Viewing changes to tests/dummy-indicator-signaler.c

  • Committer: Ted Gould
  • Date: 2012-02-03 15:48:05 UTC
  • mfrom: (444.1.7 libindicator)
  • Revision ID: ted@gould.cx-20120203154805-v1vbwrkm3w0om6s0
Be more agressive in ensureing the parent_object value is available everywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
struct _DummyIndicatorSignaler {
44
44
        IndicatorObject parent;
 
45
        IndicatorObjectEntry *entries;
45
46
};
46
47
 
47
48
GType dummy_indicator_signaler_get_type (void);
110
111
{
111
112
        DummyIndicatorSignaler * self = DUMMY_INDICATOR_SIGNALER(data);
112
113
 
113
 
        g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0,   GUINT_TO_POINTER(5), TRUE);
114
 
        g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, GUINT_TO_POINTER(5), TRUE);
115
 
        g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID, 0, GUINT_TO_POINTER(5), 0, 1, TRUE);
 
114
        IndicatorObjectEntry *added_entry, *removed_entry, *moved_entry;
 
115
 
 
116
        added_entry = &self->entries[0];
 
117
        moved_entry = &self->entries[1];
 
118
        removed_entry = &self->entries[2];
 
119
 
 
120
        added_entry->name_hint = "added";
 
121
        moved_entry->name_hint = "moved";
 
122
        removed_entry->name_hint = "removed";
 
123
 
 
124
        g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, added_entry);
 
125
        g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID, 0, moved_entry, 0, 1);
 
126
        g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, removed_entry);
116
127
 
117
128
        return FALSE; /* Don't queue again */
118
129
}
120
131
static void
121
132
dummy_indicator_signaler_init (DummyIndicatorSignaler *self)
122
133
{
 
134
        self->entries = g_new0(IndicatorObjectEntry, 3);
123
135
        g_idle_add(idle_signal, self);
124
136
        return;
125
137
}
135
147
static void
136
148
dummy_indicator_signaler_finalize (GObject *object)
137
149
{
138
 
 
 
150
        DummyIndicatorSignaler * self = DUMMY_INDICATOR_SIGNALER(object);
 
151
        g_free (self->entries);
139
152
        G_OBJECT_CLASS (dummy_indicator_signaler_parent_class)->finalize (object);
140
153
        return;
141
154
}