Sun, 13 Jul 2025 00:01:48 -0500
Fix some Since tags
These either have an unnecessary micro version, or are missing altogether.
Testing Done:
Ran `girlint.xsl` on the `Purple-3.0.gir` and `Pidgin-3.0.gir`.
Reviewed at https://reviews.imfreedom.org/r/4059/
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <purple.h> |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include "pidgin/pidginnotification.h" |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | typedef struct { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | PurpleNotification *notification; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | GtkWidget *details; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | GtkWidget *child; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | } PidginNotificationPrivate; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | enum { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | PROP_0, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | PROP_NOTIFICATION, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | PROP_CHILD, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | N_PROPERTIES, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | }; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | G_DEFINE_TYPE_WITH_PRIVATE(PidginNotification, pidgin_notification, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | GTK_TYPE_BOX) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | /****************************************************************************** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | * Helpers |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | *****************************************************************************/ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | pidgin_notification_set_notification(PidginNotification *pidgin_notification, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | PurpleNotification *purple_notification) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | PidginNotificationPrivate *priv = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | priv = pidgin_notification_get_instance_private(pidgin_notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | if(g_set_object(&priv->notification, purple_notification)) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | g_object_notify_by_pspec(G_OBJECT(pidgin_notification), |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | properties[PROP_NOTIFICATION]); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | /****************************************************************************** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | * Callbacks |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | *****************************************************************************/ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | static gboolean |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | pidgin_notification_show_subtitle(G_GNUC_UNUSED PidginNotification *notification, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | const char *subtitle) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | return !purple_strempty(subtitle); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
43182
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
74 | static char * |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
75 | pidgin_notification_get_timestamp_string(G_GNUC_UNUSED PidginNotification *notification, |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
76 | GDateTime *timestamp) |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
77 | { |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
78 | char *ret = NULL; |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
79 | |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
80 | if(timestamp != NULL) { |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
81 | GDateTime *local = NULL; |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
82 | |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
83 | local = g_date_time_to_local(timestamp); |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
84 | ret = g_date_time_format(local, "%I:%M %p"); |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
85 | g_date_time_unref(local); |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
86 | } |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
87 | |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
88 | return ret; |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
89 | } |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
90 | |
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | /****************************************************************************** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | * Widget Actions |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | *****************************************************************************/ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | pidgin_notification_close(GtkWidget *self, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | G_GNUC_UNUSED const char *action_name, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | G_GNUC_UNUSED GVariant *parameter) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | PidginNotification *notification = PIDGIN_NOTIFICATION(self); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | PidginNotificationPrivate *priv = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | PurpleNotificationManager *manager = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | priv = pidgin_notification_get_instance_private(notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | purple_notification_delete(priv->notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | manager = purple_notification_manager_get_default(); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | purple_notification_manager_remove(manager, priv->notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | /****************************************************************************** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | * GObject Implementation |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | *****************************************************************************/ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | pidgin_notification_get_property(GObject *obj, guint param_id, GValue *value, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | GParamSpec *pspec) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | PidginNotification *notification = PIDGIN_NOTIFICATION(obj); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | switch(param_id) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | case PROP_NOTIFICATION: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | g_value_set_object(value, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | pidgin_notification_get_notification(notification)); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | break; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | case PROP_CHILD: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | g_value_set_object(value, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | pidgin_notification_get_child(notification)); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | break; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | default: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | break; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | pidgin_notification_set_property(GObject *obj, guint param_id, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | const GValue *value, GParamSpec *pspec) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | PidginNotification *notification = PIDGIN_NOTIFICATION(obj); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | switch(param_id) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | case PROP_NOTIFICATION: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | pidgin_notification_set_notification(notification, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | g_value_get_object(value)); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | break; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | case PROP_CHILD: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | pidgin_notification_set_child(notification, g_value_get_object(value)); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | break; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | default: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | break; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | pidgin_notification_dispose(GObject *obj) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | PidginNotification *notification = PIDGIN_NOTIFICATION(obj); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | PidginNotificationPrivate *priv = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | priv = pidgin_notification_get_instance_private(notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | g_clear_object(&priv->notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | g_clear_pointer(&priv->child, gtk_widget_unparent); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | G_OBJECT_CLASS(pidgin_notification_parent_class)->dispose(obj); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | pidgin_notification_init(PidginNotification *notification) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | gtk_widget_init_template(GTK_WIDGET(notification)); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | static void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | pidgin_notification_class_init(PidginNotificationClass *klass) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | obj_class->get_property = pidgin_notification_get_property; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | obj_class->set_property = pidgin_notification_set_property; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
179 | obj_class->dispose = pidgin_notification_dispose; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | /** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | * PidginNotification:notification: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | * The [type@Purple.Notification] that is being displayed. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | * Since: 3.0 |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | */ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | properties[PROP_NOTIFICATION] = g_param_spec_object( |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | "notification", NULL, NULL, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | PURPLE_TYPE_NOTIFICATION, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | /** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | * PidginNotification:child: |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | * Child widgets to show between the details and the close button. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | * This is typically actions like message, add contact, etc. |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | * Since: 3.0 |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | */ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | properties[PROP_CHILD] = g_param_spec_object( |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | "child", NULL, NULL, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | GTK_TYPE_WIDGET, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | /* Actions */ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | gtk_widget_class_install_action(widget_class, "notification.close", |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | NULL, pidgin_notification_close); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | /* Bindings */ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | gtk_widget_class_set_template_from_resource(widget_class, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | "/im/pidgin/Pidgin3/notification.ui"); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | gtk_widget_class_bind_template_child_private(widget_class, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | PidginNotification, details); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | gtk_widget_class_bind_template_callback(widget_class, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | pidgin_notification_show_subtitle); |
|
43182
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
221 | gtk_widget_class_bind_template_callback(widget_class, |
|
9e12c632516e
Display the timestamp of notifications
Gary Kramlich <grim@reaperworld.com>
parents:
42940
diff
changeset
|
222 | pidgin_notification_get_timestamp_string); |
|
42940
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | /****************************************************************************** |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | * API |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | *****************************************************************************/ |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | GtkWidget * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | pidgin_notification_new(PurpleNotification *notification) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | return g_object_new( |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | PIDGIN_TYPE_NOTIFICATION, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | "notification", notification, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 | NULL); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | PurpleNotification * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | pidgin_notification_get_notification(PidginNotification *notification) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | PidginNotificationPrivate *priv = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | g_return_val_if_fail(PIDGIN_IS_NOTIFICATION(notification), NULL); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | priv = pidgin_notification_get_instance_private(notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | return priv->notification; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | GtkWidget * |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | pidgin_notification_get_child(PidginNotification *notification) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | PidginNotificationPrivate *priv = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | g_return_val_if_fail(PIDGIN_IS_NOTIFICATION(notification), NULL); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | priv = pidgin_notification_get_instance_private(notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | return priv->child; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | void |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | pidgin_notification_set_child(PidginNotification *notification, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | GtkWidget *child) |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 | PidginNotificationPrivate *priv = NULL; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | g_return_if_fail(PIDGIN_IS_NOTIFICATION(notification)); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | priv = pidgin_notification_get_instance_private(notification); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | if(child == priv->child) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | return; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | g_clear_pointer(&priv->child, gtk_widget_unparent); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | if(GTK_IS_WIDGET(child)) { |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | priv->child = child; |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | gtk_box_insert_child_after(GTK_BOX(notification), child, |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | priv->details); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | } |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | g_object_notify_by_pspec(G_OBJECT(notification), properties[PROP_CHILD]); |
|
240eb66a3795
Create Pidgin.Notification to simplify the custom widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | } |