send-notification: do not send a notification when using "--help"
authorManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Sat, 31 May 2014 17:54:01 +0000 (19:54 +0200)
committerManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Sat, 31 May 2014 17:54:01 +0000 (19:54 +0200)
The "--help" option should make the program display the help text
and return directly, not sending a blank notification.

send_notification.c

index 0a15d86..a42b9dd 100644 (file)
@@ -75,6 +75,7 @@ main(int argc, char **argv)
     char *icon = NULL;
     char *image = NULL;
     int imageType = 0;
+    Eina_Bool quit = EINA_FALSE;
     Eina_Bool remove = EINA_FALSE;
     notification_h noti = NULL;
     notification_error_e err = NOTIFICATION_ERROR_NONE;
@@ -85,7 +86,8 @@ main(int argc, char **argv)
         ECORE_GETOPT_VALUE_STR(icon),
         ECORE_GETOPT_VALUE_STR(image),
         ECORE_GETOPT_VALUE_INT(imageType),
-        ECORE_GETOPT_VALUE_NONE
+        ECORE_GETOPT_VALUE_NONE,
+        ECORE_GETOPT_VALUE_BOOL(quit)
     };
 
     if (!ecore_init()) {
@@ -98,6 +100,9 @@ main(int argc, char **argv)
         return -1;
     }
 
+    if (quit)
+       return 0;
+
     noti = notification_new(NOTIFICATION_TYPE_NOTI,
                             NOTIFICATION_GROUP_ID_NONE,
                             NOTIFICATION_PRIV_ID_NONE);