[seahorse] Clean up version constants



commit d8ff80a2b43baec7daa136e07583fe179fec1d75
Author: nobled <nobled dreamwidth org>
Date:   Sun Feb 7 22:16:51 2010 +0000

    Clean up version constants
    
    Add an inline macro to make the declarations readable

 libseahorse/seahorse-util.h |    3 +++
 pgp/seahorse-gpgme.c        |   15 ++++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/libseahorse/seahorse-util.h b/libseahorse/seahorse-util.h
index e863852..888d485 100644
--- a/libseahorse/seahorse-util.h
+++ b/libseahorse/seahorse-util.h
@@ -180,6 +180,9 @@ void        seahorse_util_determine_popup_menu_position  (GtkMenu *menu,
 
 SeahorseVersion seahorse_util_parse_version   (const char *version);
 
+#define seahorse_util_version(a,b,c,d) ((SeahorseVersion)a << 48) + ((SeahorseVersion)b << 32) \
+                                     + ((SeahorseVersion)c << 16) +  (SeahorseVersion)d
+
 #define     seahorse_util_wait_until(expr)                \
     while (!(expr)) {                                     \
         while (g_main_context_pending(NULL) && !(expr))   \
diff --git a/pgp/seahorse-gpgme.c b/pgp/seahorse-gpgme.c
index 46a0d46..c6af2ea 100644
--- a/pgp/seahorse-gpgme.c
+++ b/pgp/seahorse-gpgme.c
@@ -188,15 +188,12 @@ const struct _SeahorseKeyTypeTable KEYTYPES_124 =
 const struct _SeahorseKeyTypeTable KEYTYPES_120 =
 	{ .rsa_sign=5, .rsa_enc=6, .dsa_sign=2, .elgamal_enc=3 };
 
-const SeahorseVersion VER_2012 = ((SeahorseVersion)2 << 48)
-                               + ((SeahorseVersion)12 << 16);
-const SeahorseVersion VER_190  = ((SeahorseVersion)1 << 48) + ((SeahorseVersion)9 << 32);
-const SeahorseVersion VER_1410 = ((SeahorseVersion)1 << 48) + ((SeahorseVersion)4 << 32)
-                               + ((SeahorseVersion)10 << 16);
-const SeahorseVersion VER_140  = ((SeahorseVersion)1 << 48) + ((SeahorseVersion)4 << 32);
-const SeahorseVersion VER_124  = ((SeahorseVersion)1 << 48) + ((SeahorseVersion)2 << 32)
-                               + ((SeahorseVersion)4 << 16);
-const SeahorseVersion VER_120  = ((SeahorseVersion)1 << 48) + ((SeahorseVersion)2 << 32);
+const SeahorseVersion VER_2012 = seahorse_util_version(2,0,12,0);
+const SeahorseVersion VER_190  = seahorse_util_version(1,9,0,0);
+const SeahorseVersion VER_1410 = seahorse_util_version(1,4,10,0);
+const SeahorseVersion VER_140  = seahorse_util_version(1,4,0,0);
+const SeahorseVersion VER_124  = seahorse_util_version(1,2,4,0);
+const SeahorseVersion VER_120  = seahorse_util_version(1,2,0,0);
 
 /**
  * seahorse_gpgme_get_keytype_table:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]