@@ -11,6 +11,7 @@ static gchar *summary = NULL;
1111static gchar * body = NULL ;
1212static NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL ;
1313static gchar * urgency_str = NULL ;
14+ static gchar * category = NULL ;
1415static gchar * * hint_strs = NULL ;
1516static gchar * * action_strs = NULL ;
1617static gint timeout = NOTIFY_EXPIRES_DEFAULT ;
@@ -32,7 +33,8 @@ static GOptionEntry entries[] =
3233 { "timeout" , 't' , 0 , G_OPTION_ARG_INT , & timeout , "The time in milliseconds until the notification expires" , "TIMEOUT" },
3334 { "icon" , 'i' , 0 , G_OPTION_ARG_STRING , & icon , "An icon that should be displayed with the notification" , "ICON" },
3435 { "raw_icon" , 'I' , 0 , G_OPTION_ARG_STRING , & raw_icon_path , "Path to the icon to be sent as raw image data" , "RAW_ICON" },
35- { "capabilities" , 'c' , 0 , G_OPTION_ARG_NONE , & capabilities , "Print the server capabilities and exit" , NULL },
36+ { "category" , 'c' , 0 , G_OPTION_ARG_STRING , & category , "The category of this notification" , "TYPE" },
37+ { "capabilities" , 0 , 0 , G_OPTION_ARG_NONE , & capabilities , "Print the server capabilities and exit" , NULL },
3638 { "serverinfo" , 's' , 0 , G_OPTION_ARG_NONE , & serverinfo , "Print server information and exit" , NULL },
3739 { "printid" , 'p' , 0 , G_OPTION_ARG_NONE , & printid , "Print id, which can be used to update/replace this notification" , NULL },
3840 { "replace" , 'r' , 0 , G_OPTION_ARG_INT , & replace_id , "Set id of this notification." , "ID" },
@@ -171,53 +173,20 @@ void parse_commandline(int argc, char *argv[])
171173 }
172174}
173175
174- typedef struct _NotifyNotificationPrivate
175- {
176- guint32 id ;
177- char * app_name ;
178- char * summary ;
179- char * body ;
180-
181- /* NULL to use icon data. Anything else to have server lookup icon */
182- char * icon_name ;
183-
184- /*
185- * -1 = use server default
186- * 0 = never timeout
187- * > 0 = Number of milliseconds before we timeout
188- */
189- gint timeout ;
190-
191- GSList * actions ;
192- GHashTable * action_map ;
193- GHashTable * hints ;
194-
195- gboolean has_nondefault_actions ;
196- gboolean updates_pending ;
197-
198- gulong proxy_signal_handler ;
199-
200- gint closed_reason ;
201- } knickers ;
202-
203176int get_id (NotifyNotification * n )
204177{
205- knickers * kn = n -> priv ;
206-
207- /* I'm sorry for taking a peek */
208- 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 ) ;
209182}
210183
211184void put_id (NotifyNotification * n , guint32 id )
212185{
213- knickers * kn = n -> priv ;
214-
215- /* And know I'm putting stuff into
216- * your knickers. I'm sorry.
217- * I'm so sorry.
218- * */
219-
220- 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 );
221190}
222191
223192void actioned (NotifyNotification * n , char * a , gpointer foo )
@@ -302,6 +271,9 @@ int main(int argc, char *argv[])
302271 notify_notification_set_timeout (n , timeout );
303272 notify_notification_set_urgency (n , urgency );
304273
274+ if (category != NULL )
275+ notify_notification_set_category (n , category );
276+
305277 GError * err = NULL ;
306278
307279 if (raw_icon_path ) {
0 commit comments