Advertisement
Guest User

Untitled

a guest
May 26th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.17 KB | None | 0 0
  1. /* gcc -Wall $(pkg-config --cflags --libs hildon-notify glib-2.0) notify.c -o notify */
  2.  
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <libintl.h>
  6. #include <locale.h>
  7. #include <hildon/hildon-notification.h>
  8. #include <glib.h>
  9.  
  10. int main (int argc, char *argv[])
  11. {
  12.  
  13.     if ( argc != 5 ) /* argc should be 5 for correct execution */
  14.     {
  15.     printf("Usage: %s <title> <subtitle> <icon> <timeout (ms)> <category (optional)> \n", argv[0]);
  16.     return 1;
  17.     } else {
  18.     const gchar *title = argv[1];
  19.     const gchar *subTitle = argv[2];
  20.     const gchar *icon = argv[3];
  21. /* ===================== FIX THIS OR HARDCODE LIMIT ============================= */
  22.     const gint timeout = argv[4];
  23. /* ============================================================================== */
  24.     const gchar *category = argv[5];
  25.     if (category == NULL)
  26.         category = "misc";
  27.  
  28.     HildonNotification *notification;
  29.  
  30.     g_type_init ();
  31.     notify_init ("notification");
  32.  
  33.     notification = hildon_notification_new(title, subTitle, icon, category);
  34.     notify_notification_set_timeout (NOTIFY_NOTIFICATION(notification), timeout);
  35.     notify_notification_show(NOTIFY_NOTIFICATION(notification), NULL);
  36.  
  37.     return 0;
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement