Add G_OPTION_FLAG_REVERSE, to reverse the sense of a G_OPTION_ARG_NONE
authorTor Lillqvist <tml@iki.fi>
Thu, 4 Nov 2004 00:40:06 +0000 (00:40 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 4 Nov 2004 00:40:06 +0000 (00:40 +0000)
2004-11-04  Tor Lillqvist  <tml@iki.fi>

* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.

* glib/goption.c (parse_arg): Obey the above flag.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/goption.c
glib/goption.h

index ef5c40e2dbcf85857bece3d9dbb971ec5f1198cf..e000728e7364d1ce822d52d0a2d5e04f841f3017 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-11-04  Tor Lillqvist  <tml@iki.fi>
 
+       * glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
+       to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
+
+       * glib/goption.c (parse_arg): Obey the above flag.
+
        * glib/gconvert.c (g_filename_display_name): Document that the
        result is guaranteed to be non-NULL.
 
index ef5c40e2dbcf85857bece3d9dbb971ec5f1198cf..e000728e7364d1ce822d52d0a2d5e04f841f3017 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-04  Tor Lillqvist  <tml@iki.fi>
 
+       * glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
+       to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
+
+       * glib/goption.c (parse_arg): Obey the above flag.
+
        * glib/gconvert.c (g_filename_display_name): Document that the
        result is guaranteed to be non-NULL.
 
index ef5c40e2dbcf85857bece3d9dbb971ec5f1198cf..e000728e7364d1ce822d52d0a2d5e04f841f3017 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-04  Tor Lillqvist  <tml@iki.fi>
 
+       * glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
+       to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
+
+       * glib/goption.c (parse_arg): Obey the above flag.
+
        * glib/gconvert.c (g_filename_display_name): Document that the
        result is guaranteed to be non-NULL.
 
index ef5c40e2dbcf85857bece3d9dbb971ec5f1198cf..e000728e7364d1ce822d52d0a2d5e04f841f3017 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-04  Tor Lillqvist  <tml@iki.fi>
 
+       * glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
+       to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
+
+       * glib/goption.c (parse_arg): Obey the above flag.
+
        * glib/gconvert.c (g_filename_display_name): Document that the
        result is guaranteed to be non-NULL.
 
index ef5c40e2dbcf85857bece3d9dbb971ec5f1198cf..e000728e7364d1ce822d52d0a2d5e04f841f3017 100644 (file)
@@ -1,5 +1,10 @@
 2004-11-04  Tor Lillqvist  <tml@iki.fi>
 
+       * glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
+       to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
+
+       * glib/goption.c (parse_arg): Obey the above flag.
+
        * glib/gconvert.c (g_filename_display_name): Document that the
        result is guaranteed to be non-NULL.
 
index 35a4e3d07a9d2c9aa1b941e360d010fa83ee358b..afafa9bcba62d2dbf641db892b4c29042bc12bbe 100644 (file)
@@ -654,7 +654,7 @@ parse_arg (GOptionContext *context,
        change = get_change (context, G_OPTION_ARG_NONE,
                             entry->arg_data);
 
-       *(gboolean *)entry->arg_data = TRUE;
+       *(gboolean *)entry->arg_data = !(entry->flags & G_OPTION_FLAG_REVERSE);
        break;
       }             
     case G_OPTION_ARG_STRING:
index 1b62d7c2d49e7a25c6a34ea8d09c5e0c5ee17893..fca5802d57e4abc382200d27ea219a40701e5d7a 100644 (file)
@@ -33,7 +33,8 @@ typedef struct _GOptionEntry   GOptionEntry;
 typedef enum
 {
   G_OPTION_FLAG_HIDDEN       = 1 << 0,
-  G_OPTION_FLAG_IN_MAIN      = 1 << 1
+  G_OPTION_FLAG_IN_MAIN      = 1 << 1,
+  G_OPTION_FLAG_REVERSE             = 1 << 2
 } GOptionFlags;
 
 typedef enum