~nathandyer/birdie/manual-import

« back to all changes in this revision

Viewing changes to build/src/Utils/Notifications.c

  • Committer: Nathan Dyer
  • Date: 2016-02-06 20:22:09 UTC
  • Revision ID: mail@nathandyer.me-20160206202209-qwhtqwi1j8feglds
Updated to git master

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Notifications.c generated by valac 0.30.0, the Vala compiler
2
 
 * generated from Notifications.vala, do not modify */
3
 
 
4
 
/* -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-*/
5
 
/*-
6
 
 * Copyright (c) 2013-2016 Birdie Developers (http://birdieapp.github.io)
7
 
 *
8
 
 * This software is licensed under the GNU General Public License
9
 
 * (version 3 or later). See the COPYING file in this distribution.
10
 
 *
11
 
 * You should have received a copy of the GNU Library General Public
12
 
 * License along with this software; if not, write to the
13
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14
 
 * Boston, MA 02111-1307, USA.
15
 
 *
16
 
 * Authored by: Ivo Nunes <ivoavnunes@gmail.com>
17
 
 *              Vasco Nunes <vascomfnunes@gmail.com>
18
 
 *              Nathan Dyer <mail@nathandyer.me>
19
 
 */
20
 
 
21
 
#include <glib.h>
22
 
#include <glib-object.h>
23
 
#include <libnotify/notify.h>
24
 
#include <granite.h>
25
 
#include <stdlib.h>
26
 
#include <string.h>
27
 
#include <canberra.h>
28
 
#include <gio/gio.h>
29
 
#include <glib/gi18n-lib.h>
30
 
#include <gobject/gvaluecollector.h>
31
 
 
32
 
 
33
 
#define BIRDIE_UTILS_TYPE_NOTIFICATION (birdie_utils_notification_get_type ())
34
 
#define BIRDIE_UTILS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BIRDIE_UTILS_TYPE_NOTIFICATION, BirdieUtilsNotification))
35
 
#define BIRDIE_UTILS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BIRDIE_UTILS_TYPE_NOTIFICATION, BirdieUtilsNotificationClass))
36
 
#define BIRDIE_UTILS_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BIRDIE_UTILS_TYPE_NOTIFICATION))
37
 
#define BIRDIE_UTILS_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BIRDIE_UTILS_TYPE_NOTIFICATION))
38
 
#define BIRDIE_UTILS_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BIRDIE_UTILS_TYPE_NOTIFICATION, BirdieUtilsNotificationClass))
39
 
 
40
 
typedef struct _BirdieUtilsNotification BirdieUtilsNotification;
41
 
typedef struct _BirdieUtilsNotificationClass BirdieUtilsNotificationClass;
42
 
typedef struct _BirdieUtilsNotificationPrivate BirdieUtilsNotificationPrivate;
43
 
 
44
 
#define BIRDIE_TYPE_BIRDIE (birdie_birdie_get_type ())
45
 
#define BIRDIE_BIRDIE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BIRDIE_TYPE_BIRDIE, BirdieBirdie))
46
 
#define BIRDIE_BIRDIE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BIRDIE_TYPE_BIRDIE, BirdieBirdieClass))
47
 
#define BIRDIE_IS_BIRDIE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BIRDIE_TYPE_BIRDIE))
48
 
#define BIRDIE_IS_BIRDIE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BIRDIE_TYPE_BIRDIE))
49
 
#define BIRDIE_BIRDIE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BIRDIE_TYPE_BIRDIE, BirdieBirdieClass))
50
 
 
51
 
typedef struct _BirdieBirdie BirdieBirdie;
52
 
typedef struct _BirdieBirdieClass BirdieBirdieClass;
53
 
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
54
 
#define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))
55
 
#define _g_free0(var) (var = (g_free (var), NULL))
56
 
typedef struct _Block49Data Block49Data;
57
 
#define _birdie_utils_notification_unref0(var) ((var == NULL) ? NULL : (var = (birdie_utils_notification_unref (var), NULL)))
58
 
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
59
 
#define _ca_context_destroy0(var) ((var == NULL) ? NULL : (var = (ca_context_destroy (var), NULL)))
60
 
typedef struct _BirdieUtilsParamSpecNotification BirdieUtilsParamSpecNotification;
61
 
 
62
 
struct _BirdieUtilsNotification {
63
 
        GTypeInstance parent_instance;
64
 
        volatile int ref_count;
65
 
        BirdieUtilsNotificationPrivate * priv;
66
 
};
67
 
 
68
 
struct _BirdieUtilsNotificationClass {
69
 
        GTypeClass parent_class;
70
 
        void (*finalize) (BirdieUtilsNotification *self);
71
 
};
72
 
 
73
 
struct _BirdieUtilsNotificationPrivate {
74
 
        NotifyNotification* notification;
75
 
        BirdieBirdie* birdie_app;
76
 
        GList* caps;
77
 
};
78
 
 
79
 
struct _Block49Data {
80
 
        int _ref_count_;
81
 
        BirdieUtilsNotification* self;
82
 
        gchar* timeline;
83
 
};
84
 
 
85
 
struct _BirdieUtilsParamSpecNotification {
86
 
        GParamSpec parent_instance;
87
 
};
88
 
 
89
 
 
90
 
static gpointer birdie_utils_notification_parent_class = NULL;
91
 
static ca_context* birdie_utils_notification_sound_context;
92
 
static ca_context* birdie_utils_notification_sound_context = NULL;
93
 
 
94
 
gpointer birdie_utils_notification_ref (gpointer instance);
95
 
void birdie_utils_notification_unref (gpointer instance);
96
 
GParamSpec* birdie_utils_param_spec_notification (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
97
 
void birdie_utils_value_set_notification (GValue* value, gpointer v_object);
98
 
void birdie_utils_value_take_notification (GValue* value, gpointer v_object);
99
 
gpointer birdie_utils_value_get_notification (const GValue* value);
100
 
GType birdie_utils_notification_get_type (void) G_GNUC_CONST;
101
 
GType birdie_birdie_get_type (void) G_GNUC_CONST;
102
 
#define BIRDIE_UTILS_NOTIFICATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BIRDIE_UTILS_TYPE_NOTIFICATION, BirdieUtilsNotificationPrivate))
103
 
enum  {
104
 
        BIRDIE_UTILS_NOTIFICATION_DUMMY_PROPERTY
105
 
};
106
 
static void _g_free0_ (gpointer var);
107
 
static void _g_list_free__g_free0_ (GList* self);
108
 
void birdie_utils_notification_init (BirdieUtilsNotification* self);
109
 
static void birdie_utils_notification_init_sound (void);
110
 
void birdie_utils_notification_notify (BirdieUtilsNotification* self, BirdieBirdie* birdie, const gchar* header, const gchar* message, const gchar* timeline, gboolean* dm, const gchar* avatar);
111
 
static Block49Data* block49_data_ref (Block49Data* _data49_);
112
 
static void block49_data_unref (void * _userdata_);
113
 
gchar* birdie_utils_remove_html_tags (const gchar* input);
114
 
gchar* birdie_utils_escape_markup (gchar* text);
115
 
static void __lambda51_ (Block49Data* _data49_, NotifyNotification* notification, const gchar* action);
116
 
void birdie_birdie_switch_timeline (BirdieBirdie* self, const gchar* new_timeline);
117
 
static void ___lambda51__notify_action_callback (NotifyNotification* notification, const gchar* action, gpointer self);
118
 
void birdie_utils_notification_play_sound (const gchar* sound);
119
 
void birdie_utils_notification_uninit (BirdieUtilsNotification* self);
120
 
BirdieUtilsNotification* birdie_utils_notification_new (void);
121
 
BirdieUtilsNotification* birdie_utils_notification_construct (GType object_type);
122
 
static void birdie_utils_notification_finalize (BirdieUtilsNotification* obj);
123
 
 
124
 
 
125
 
static void _g_free0_ (gpointer var) {
126
 
        var = (g_free (var), NULL);
127
 
}
128
 
 
129
 
 
130
 
static void _g_list_free__g_free0_ (GList* self) {
131
 
        g_list_foreach (self, (GFunc) _g_free0_, NULL);
132
 
        g_list_free (self);
133
 
}
134
 
 
135
 
 
136
 
void birdie_utils_notification_init (BirdieUtilsNotification* self) {
137
 
        GList* _tmp0_ = NULL;
138
 
        g_return_if_fail (self != NULL);
139
 
        notify_init ("Birdie");
140
 
        birdie_utils_notification_init_sound ();
141
 
        _tmp0_ = notify_get_server_caps ();
142
 
        __g_list_free__g_free0_0 (self->priv->caps);
143
 
        self->priv->caps = _tmp0_;
144
 
}
145
 
 
146
 
 
147
 
static Block49Data* block49_data_ref (Block49Data* _data49_) {
148
 
        g_atomic_int_inc (&_data49_->_ref_count_);
149
 
        return _data49_;
150
 
}
151
 
 
152
 
 
153
 
static void block49_data_unref (void * _userdata_) {
154
 
        Block49Data* _data49_;
155
 
        _data49_ = (Block49Data*) _userdata_;
156
 
        if (g_atomic_int_dec_and_test (&_data49_->_ref_count_)) {
157
 
                BirdieUtilsNotification* self;
158
 
                self = _data49_->self;
159
 
                _g_free0 (_data49_->timeline);
160
 
                _birdie_utils_notification_unref0 (self);
161
 
                g_slice_free (Block49Data, _data49_);
162
 
        }
163
 
}
164
 
 
165
 
 
166
 
static gpointer _g_object_ref0 (gpointer self) {
167
 
        return self ? g_object_ref (self) : NULL;
168
 
}
169
 
 
170
 
 
171
 
static void __lambda51_ (Block49Data* _data49_, NotifyNotification* notification, const gchar* action) {
172
 
        BirdieUtilsNotification* self;
173
 
        BirdieBirdie* _tmp0_ = NULL;
174
 
        const gchar* _tmp1_ = NULL;
175
 
        BirdieBirdie* _tmp2_ = NULL;
176
 
        self = _data49_->self;
177
 
        g_return_if_fail (notification != NULL);
178
 
        g_return_if_fail (action != NULL);
179
 
        _tmp0_ = self->priv->birdie_app;
180
 
        _tmp1_ = _data49_->timeline;
181
 
        birdie_birdie_switch_timeline (_tmp0_, _tmp1_);
182
 
        _tmp2_ = self->priv->birdie_app;
183
 
        g_application_activate ((GApplication*) _tmp2_);
184
 
}
185
 
 
186
 
 
187
 
static void ___lambda51__notify_action_callback (NotifyNotification* notification, const gchar* action, gpointer self) {
188
 
        __lambda51_ (self, notification, action);
189
 
}
190
 
 
191
 
 
192
 
void birdie_utils_notification_notify (BirdieUtilsNotification* self, BirdieBirdie* birdie, const gchar* header, const gchar* message, const gchar* timeline, gboolean* dm, const gchar* avatar) {
193
 
        Block49Data* _data49_;
194
 
        const gchar* _tmp0_ = NULL;
195
 
        gchar* _tmp1_ = NULL;
196
 
        BirdieBirdie* _tmp2_ = NULL;
197
 
        BirdieBirdie* _tmp3_ = NULL;
198
 
        gchar* notification_txt = NULL;
199
 
        gchar* avatar_path = NULL;
200
 
        const gchar* _tmp4_ = NULL;
201
 
        gchar* _tmp5_ = NULL;
202
 
        const gchar* _tmp6_ = NULL;
203
 
        gchar* _tmp7_ = NULL;
204
 
        gchar* _tmp8_ = NULL;
205
 
        gboolean _tmp9_ = FALSE;
206
 
        const gchar* _tmp10_ = NULL;
207
 
        const gchar* _tmp20_ = NULL;
208
 
        const gchar* _tmp21_ = NULL;
209
 
        const gchar* _tmp22_ = NULL;
210
 
        NotifyNotification* _tmp23_ = NULL;
211
 
        NotifyNotification* _tmp24_ = NULL;
212
 
        NotifyNotification* _tmp25_ = NULL;
213
 
        gboolean* _tmp26_ = NULL;
214
 
        NotifyNotification* _tmp29_ = NULL;
215
 
        const gchar* _tmp30_ = NULL;
216
 
        GList* _tmp34_ = NULL;
217
 
        GList* _tmp35_ = NULL;
218
 
        GError * _inner_error_ = NULL;
219
 
        g_return_if_fail (self != NULL);
220
 
        g_return_if_fail (birdie != NULL);
221
 
        g_return_if_fail (header != NULL);
222
 
        _data49_ = g_slice_new0 (Block49Data);
223
 
        _data49_->_ref_count_ = 1;
224
 
        _data49_->self = birdie_utils_notification_ref (self);
225
 
        _tmp0_ = timeline;
226
 
        _tmp1_ = g_strdup (_tmp0_);
227
 
        _g_free0 (_data49_->timeline);
228
 
        _data49_->timeline = _tmp1_;
229
 
        _tmp2_ = birdie;
230
 
        _tmp3_ = _g_object_ref0 (_tmp2_);
231
 
        _g_object_unref0 (self->priv->birdie_app);
232
 
        self->priv->birdie_app = _tmp3_;
233
 
        _tmp4_ = message;
234
 
        _tmp5_ = birdie_utils_remove_html_tags (_tmp4_);
235
 
        _g_free0 (notification_txt);
236
 
        notification_txt = _tmp5_;
237
 
        _tmp6_ = notification_txt;
238
 
        _tmp7_ = g_strdup (_tmp6_);
239
 
        _tmp8_ = birdie_utils_escape_markup (_tmp7_);
240
 
        _g_free0 (notification_txt);
241
 
        notification_txt = _tmp8_;
242
 
        _tmp10_ = avatar;
243
 
        if (g_strcmp0 (_tmp10_, "") != 0) {
244
 
                const gchar* _tmp11_ = NULL;
245
 
                _tmp11_ = avatar;
246
 
                _tmp9_ = _tmp11_ != NULL;
247
 
        } else {
248
 
                _tmp9_ = FALSE;
249
 
        }
250
 
        if (_tmp9_) {
251
 
                GFile* file = NULL;
252
 
                const gchar* _tmp12_ = NULL;
253
 
                GFile* _tmp13_ = NULL;
254
 
                GFile* _tmp14_ = NULL;
255
 
                gboolean _tmp15_ = FALSE;
256
 
                _tmp12_ = avatar;
257
 
                _tmp13_ = g_file_new_for_path (_tmp12_);
258
 
                file = _tmp13_;
259
 
                _tmp14_ = file;
260
 
                _tmp15_ = g_file_query_exists (_tmp14_, NULL);
261
 
                if (_tmp15_) {
262
 
                        const gchar* _tmp16_ = NULL;
263
 
                        gchar* _tmp17_ = NULL;
264
 
                        _tmp16_ = avatar;
265
 
                        _tmp17_ = g_strdup (_tmp16_);
266
 
                        _g_free0 (avatar_path);
267
 
                        avatar_path = _tmp17_;
268
 
                } else {
269
 
                        gchar* _tmp18_ = NULL;
270
 
                        _tmp18_ = g_strdup ("birdie");
271
 
                        _g_free0 (avatar_path);
272
 
                        avatar_path = _tmp18_;
273
 
                }
274
 
                _g_object_unref0 (file);
275
 
        } else {
276
 
                gchar* _tmp19_ = NULL;
277
 
                _tmp19_ = g_strdup ("birdie");
278
 
                _g_free0 (avatar_path);
279
 
                avatar_path = _tmp19_;
280
 
        }
281
 
        _tmp20_ = header;
282
 
        _tmp21_ = notification_txt;
283
 
        _tmp22_ = avatar_path;
284
 
        _tmp23_ = notify_notification_new (_tmp20_, _tmp21_, _tmp22_);
285
 
        _g_object_unref0 (self->priv->notification);
286
 
        self->priv->notification = _tmp23_;
287
 
        _tmp24_ = self->priv->notification;
288
 
        notify_notification_set_hint_string (_tmp24_, "desktop-entry", "birdie");
289
 
        _tmp25_ = self->priv->notification;
290
 
        notify_notification_set_urgency (_tmp25_, NOTIFY_URGENCY_NORMAL);
291
 
        _tmp26_ = dm;
292
 
        if (*_tmp26_) {
293
 
                NotifyNotification* _tmp27_ = NULL;
294
 
                NotifyNotification* _tmp28_ = NULL;
295
 
                _tmp27_ = self->priv->notification;
296
 
                notify_notification_set_timeout (_tmp27_, 0);
297
 
                _tmp28_ = self->priv->notification;
298
 
                notify_notification_set_urgency (_tmp28_, NOTIFY_URGENCY_CRITICAL);
299
 
        }
300
 
        _tmp29_ = self->priv->notification;
301
 
        _tmp30_ = _ ("View");
302
 
        notify_notification_add_action (_tmp29_, "view", _tmp30_, ___lambda51__notify_action_callback, block49_data_ref (_data49_), block49_data_unref);
303
 
        {
304
 
                NotifyNotification* _tmp31_ = NULL;
305
 
                _tmp31_ = self->priv->notification;
306
 
                notify_notification_show (_tmp31_, &_inner_error_);
307
 
                if (G_UNLIKELY (_inner_error_ != NULL)) {
308
 
                        goto __catch96_g_error;
309
 
                }
310
 
        }
311
 
        goto __finally96;
312
 
        __catch96_g_error:
313
 
        {
314
 
                GError* e = NULL;
315
 
                GError* _tmp32_ = NULL;
316
 
                const gchar* _tmp33_ = NULL;
317
 
                e = _inner_error_;
318
 
                _inner_error_ = NULL;
319
 
                _tmp32_ = e;
320
 
                _tmp33_ = _tmp32_->message;
321
 
                g_warning ("Notifications.vala:76: Failed to show notification: %s", _tmp33_);
322
 
                _g_error_free0 (e);
323
 
        }
324
 
        __finally96:
325
 
        if (G_UNLIKELY (_inner_error_ != NULL)) {
326
 
                _g_free0 (avatar_path);
327
 
                _g_free0 (notification_txt);
328
 
                block49_data_unref (_data49_);
329
 
                _data49_ = NULL;
330
 
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
331
 
                g_clear_error (&_inner_error_);
332
 
                return;
333
 
        }
334
 
        _tmp34_ = self->priv->caps;
335
 
        _tmp35_ = g_list_find (_tmp34_, "message");
336
 
        if (_tmp35_ != NULL) {
337
 
                NotifyNotification* _tmp36_ = NULL;
338
 
                _tmp36_ = self->priv->notification;
339
 
                notify_notification_set_hint_string (_tmp36_, "sound-name", "message");
340
 
        } else {
341
 
                birdie_utils_notification_play_sound ("message");
342
 
        }
343
 
        _g_free0 (avatar_path);
344
 
        _g_free0 (notification_txt);
345
 
        block49_data_unref (_data49_);
346
 
        _data49_ = NULL;
347
 
}
348
 
 
349
 
 
350
 
static void birdie_utils_notification_init_sound (void) {
351
 
        ca_context* _tmp0_ = NULL;
352
 
        _tmp0_ = birdie_utils_notification_sound_context;
353
 
        if (_tmp0_ == NULL) {
354
 
                ca_context* _tmp1_ = NULL;
355
 
                ca_context_create (&_tmp1_);
356
 
                _ca_context_destroy0 (birdie_utils_notification_sound_context);
357
 
                birdie_utils_notification_sound_context = _tmp1_;
358
 
        }
359
 
}
360
 
 
361
 
 
362
 
void birdie_utils_notification_play_sound (const gchar* sound) {
363
 
        ca_context* _tmp0_ = NULL;
364
 
        const gchar* _tmp1_ = NULL;
365
 
        g_return_if_fail (sound != NULL);
366
 
        birdie_utils_notification_init_sound ();
367
 
        _tmp0_ = birdie_utils_notification_sound_context;
368
 
        _tmp1_ = sound;
369
 
        ca_context_play (_tmp0_, (guint32) 0, CA_PROP_EVENT_ID, _tmp1_, NULL);
370
 
}
371
 
 
372
 
 
373
 
void birdie_utils_notification_uninit (BirdieUtilsNotification* self) {
374
 
        g_return_if_fail (self != NULL);
375
 
        notify_uninit ();
376
 
}
377
 
 
378
 
 
379
 
BirdieUtilsNotification* birdie_utils_notification_construct (GType object_type) {
380
 
        BirdieUtilsNotification* self = NULL;
381
 
        self = (BirdieUtilsNotification*) g_type_create_instance (object_type);
382
 
        return self;
383
 
}
384
 
 
385
 
 
386
 
BirdieUtilsNotification* birdie_utils_notification_new (void) {
387
 
        return birdie_utils_notification_construct (BIRDIE_UTILS_TYPE_NOTIFICATION);
388
 
}
389
 
 
390
 
 
391
 
static void birdie_utils_value_notification_init (GValue* value) {
392
 
        value->data[0].v_pointer = NULL;
393
 
}
394
 
 
395
 
 
396
 
static void birdie_utils_value_notification_free_value (GValue* value) {
397
 
        if (value->data[0].v_pointer) {
398
 
                birdie_utils_notification_unref (value->data[0].v_pointer);
399
 
        }
400
 
}
401
 
 
402
 
 
403
 
static void birdie_utils_value_notification_copy_value (const GValue* src_value, GValue* dest_value) {
404
 
        if (src_value->data[0].v_pointer) {
405
 
                dest_value->data[0].v_pointer = birdie_utils_notification_ref (src_value->data[0].v_pointer);
406
 
        } else {
407
 
                dest_value->data[0].v_pointer = NULL;
408
 
        }
409
 
}
410
 
 
411
 
 
412
 
static gpointer birdie_utils_value_notification_peek_pointer (const GValue* value) {
413
 
        return value->data[0].v_pointer;
414
 
}
415
 
 
416
 
 
417
 
static gchar* birdie_utils_value_notification_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
418
 
        if (collect_values[0].v_pointer) {
419
 
                BirdieUtilsNotification* object;
420
 
                object = collect_values[0].v_pointer;
421
 
                if (object->parent_instance.g_class == NULL) {
422
 
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
423
 
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
424
 
                        return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
425
 
                }
426
 
                value->data[0].v_pointer = birdie_utils_notification_ref (object);
427
 
        } else {
428
 
                value->data[0].v_pointer = NULL;
429
 
        }
430
 
        return NULL;
431
 
}
432
 
 
433
 
 
434
 
static gchar* birdie_utils_value_notification_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
435
 
        BirdieUtilsNotification** object_p;
436
 
        object_p = collect_values[0].v_pointer;
437
 
        if (!object_p) {
438
 
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
439
 
        }
440
 
        if (!value->data[0].v_pointer) {
441
 
                *object_p = NULL;
442
 
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
443
 
                *object_p = value->data[0].v_pointer;
444
 
        } else {
445
 
                *object_p = birdie_utils_notification_ref (value->data[0].v_pointer);
446
 
        }
447
 
        return NULL;
448
 
}
449
 
 
450
 
 
451
 
GParamSpec* birdie_utils_param_spec_notification (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
452
 
        BirdieUtilsParamSpecNotification* spec;
453
 
        g_return_val_if_fail (g_type_is_a (object_type, BIRDIE_UTILS_TYPE_NOTIFICATION), NULL);
454
 
        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
455
 
        G_PARAM_SPEC (spec)->value_type = object_type;
456
 
        return G_PARAM_SPEC (spec);
457
 
}
458
 
 
459
 
 
460
 
gpointer birdie_utils_value_get_notification (const GValue* value) {
461
 
        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BIRDIE_UTILS_TYPE_NOTIFICATION), NULL);
462
 
        return value->data[0].v_pointer;
463
 
}
464
 
 
465
 
 
466
 
void birdie_utils_value_set_notification (GValue* value, gpointer v_object) {
467
 
        BirdieUtilsNotification* old;
468
 
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BIRDIE_UTILS_TYPE_NOTIFICATION));
469
 
        old = value->data[0].v_pointer;
470
 
        if (v_object) {
471
 
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BIRDIE_UTILS_TYPE_NOTIFICATION));
472
 
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
473
 
                value->data[0].v_pointer = v_object;
474
 
                birdie_utils_notification_ref (value->data[0].v_pointer);
475
 
        } else {
476
 
                value->data[0].v_pointer = NULL;
477
 
        }
478
 
        if (old) {
479
 
                birdie_utils_notification_unref (old);
480
 
        }
481
 
}
482
 
 
483
 
 
484
 
void birdie_utils_value_take_notification (GValue* value, gpointer v_object) {
485
 
        BirdieUtilsNotification* old;
486
 
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BIRDIE_UTILS_TYPE_NOTIFICATION));
487
 
        old = value->data[0].v_pointer;
488
 
        if (v_object) {
489
 
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BIRDIE_UTILS_TYPE_NOTIFICATION));
490
 
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
491
 
                value->data[0].v_pointer = v_object;
492
 
        } else {
493
 
                value->data[0].v_pointer = NULL;
494
 
        }
495
 
        if (old) {
496
 
                birdie_utils_notification_unref (old);
497
 
        }
498
 
}
499
 
 
500
 
 
501
 
static void birdie_utils_notification_class_init (BirdieUtilsNotificationClass * klass) {
502
 
        birdie_utils_notification_parent_class = g_type_class_peek_parent (klass);
503
 
        ((BirdieUtilsNotificationClass *) klass)->finalize = birdie_utils_notification_finalize;
504
 
        g_type_class_add_private (klass, sizeof (BirdieUtilsNotificationPrivate));
505
 
}
506
 
 
507
 
 
508
 
static void birdie_utils_notification_instance_init (BirdieUtilsNotification * self) {
509
 
        self->priv = BIRDIE_UTILS_NOTIFICATION_GET_PRIVATE (self);
510
 
        self->ref_count = 1;
511
 
}
512
 
 
513
 
 
514
 
static void birdie_utils_notification_finalize (BirdieUtilsNotification* obj) {
515
 
        BirdieUtilsNotification * self;
516
 
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRDIE_UTILS_TYPE_NOTIFICATION, BirdieUtilsNotification);
517
 
        g_signal_handlers_destroy (self);
518
 
        _g_object_unref0 (self->priv->notification);
519
 
        _g_object_unref0 (self->priv->birdie_app);
520
 
        __g_list_free__g_free0_0 (self->priv->caps);
521
 
}
522
 
 
523
 
 
524
 
GType birdie_utils_notification_get_type (void) {
525
 
        static volatile gsize birdie_utils_notification_type_id__volatile = 0;
526
 
        if (g_once_init_enter (&birdie_utils_notification_type_id__volatile)) {
527
 
                static const GTypeValueTable g_define_type_value_table = { birdie_utils_value_notification_init, birdie_utils_value_notification_free_value, birdie_utils_value_notification_copy_value, birdie_utils_value_notification_peek_pointer, "p", birdie_utils_value_notification_collect_value, "p", birdie_utils_value_notification_lcopy_value };
528
 
                static const GTypeInfo g_define_type_info = { sizeof (BirdieUtilsNotificationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) birdie_utils_notification_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdieUtilsNotification), 0, (GInstanceInitFunc) birdie_utils_notification_instance_init, &g_define_type_value_table };
529
 
                static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
530
 
                GType birdie_utils_notification_type_id;
531
 
                birdie_utils_notification_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BirdieUtilsNotification", &g_define_type_info, &g_define_type_fundamental_info, 0);
532
 
                g_once_init_leave (&birdie_utils_notification_type_id__volatile, birdie_utils_notification_type_id);
533
 
        }
534
 
        return birdie_utils_notification_type_id__volatile;
535
 
}
536
 
 
537
 
 
538
 
gpointer birdie_utils_notification_ref (gpointer instance) {
539
 
        BirdieUtilsNotification* self;
540
 
        self = instance;
541
 
        g_atomic_int_inc (&self->ref_count);
542
 
        return instance;
543
 
}
544
 
 
545
 
 
546
 
void birdie_utils_notification_unref (gpointer instance) {
547
 
        BirdieUtilsNotification* self;
548
 
        self = instance;
549
 
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
550
 
                BIRDIE_UTILS_NOTIFICATION_GET_CLASS (self)->finalize (self);
551
 
                g_type_free_instance ((GTypeInstance *) self);
552
 
        }
553
 
}
554
 
 
555
 
 
556