Skip to content

Commit 73c7f92

Browse files
authored
Merge pull request #1444 from bynect/fix-libnotify
Use properties instead of private fields in dunstify
2 parents fe7f928 + 2099296 commit 73c7f92

File tree

1 file changed

+8
-41
lines changed

1 file changed

+8
-41
lines changed

dunstify.c

+8-41
Original file line numberDiff line numberDiff line change
@@ -173,53 +173,20 @@ void parse_commandline(int argc, char *argv[])
173173
}
174174
}
175175

176-
typedef struct _NotifyNotificationPrivate
177-
{
178-
guint32 id;
179-
char *app_name;
180-
char *summary;
181-
char *body;
182-
183-
/* NULL to use icon data. Anything else to have server lookup icon */
184-
char *icon_name;
185-
186-
/*
187-
* -1 = use server default
188-
* 0 = never timeout
189-
* > 0 = Number of milliseconds before we timeout
190-
*/
191-
gint timeout;
192-
193-
GSList *actions;
194-
GHashTable *action_map;
195-
GHashTable *hints;
196-
197-
gboolean has_nondefault_actions;
198-
gboolean updates_pending;
199-
200-
gulong proxy_signal_handler;
201-
202-
gint closed_reason;
203-
} knickers;
204-
205176
int get_id(NotifyNotification *n)
206177
{
207-
knickers *kn = n->priv;
208-
209-
/* I'm sorry for taking a peek */
210-
return kn->id;
178+
GValue value = G_VALUE_INIT;
179+
g_value_init(&value, G_TYPE_UINT);
180+
g_object_get_property(G_OBJECT(n), "id", &value);
181+
return g_value_get_int(&value);
211182
}
212183

213184
void put_id(NotifyNotification *n, guint32 id)
214185
{
215-
knickers *kn = n->priv;
216-
217-
/* And now I'm putting stuff into
218-
* your knickers. I'm sorry.
219-
* I'm so sorry.
220-
* */
221-
222-
kn->id = id;
186+
GValue value = G_VALUE_INIT;
187+
g_value_init(&value, G_TYPE_UINT);
188+
g_value_set_uint(&value, id);
189+
g_object_set_property(G_OBJECT(n), "id", &value);
223190
}
224191

225192
void actioned(NotifyNotification *n, char *a, gpointer foo)

0 commit comments

Comments
 (0)