diff options
author | Chris Coulson <chris.coulson@canonical.com> | 2013-05-28 15:46:09 +0100 |
---|---|---|
committer | Chris Coulson <chris.coulson@canonical.com> | 2013-05-28 15:46:09 +0100 |
commit | 09ce53603cda79824123867e8ea11af94be81eec (patch) | |
tree | 68def63e628a34f0b9a0539298948f93ae89f1b3 /libdbusmenu-glib | |
parent | ec9f767eac6b83d1dbf7200cddc1dbe81a9d11d7 (diff) | |
download | libdbusmenu-09ce53603cda79824123867e8ea11af94be81eec.tar.gz libdbusmenu-09ce53603cda79824123867e8ea11af94be81eec.tar.bz2 libdbusmenu-09ce53603cda79824123867e8ea11af94be81eec.zip |
Update for review comments
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 536fd6d..0b85193 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -391,8 +391,11 @@ set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) case PROP_ID: priv->id = g_value_get_int(value); if (priv->id > menuitem_next_id) { - menuitem_next_id = (priv->id + 1) % G_MAXINT; - if (menuitem_next_id == 0) menuitem_next_id++; + if (priv->id == G_MAXINT) { + menuitem_next_id = 1; + } else { + menuitem_next_id = priv->id + 1; + } } break; default: @@ -411,9 +414,12 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) switch (id) { case PROP_ID: if (priv->id == -1) { - priv->id = menuitem_next_id++; - menuitem_next_id &= G_MAXINT; - if (menuitem_next_id == 0) menuitem_next_id++; + priv->id = menuitem_next_id; + if (menuitem_next_id == G_MAXINT) { + menuitem_next_id = 1; + } else { + menuitem_next_id += 1; + } } if (dbusmenu_menuitem_get_root(DBUSMENU_MENUITEM(obj))) { g_value_set_int(value, 0); |