diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2010-02-25 22:19:50 +0100 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2010-02-25 22:19:50 +0100 |
commit | 08b711551f30656386c6eadb7b82e6885ba55c63 (patch) | |
tree | 8d611fbff08d2de1d24103ed08933af134f262dc | |
parent | 0af5090188b1002d4cbca3e8a60b701153a8b391 (diff) | |
parent | 688b1c13a36bf5c0dcc885000b7cec42e043bf24 (diff) | |
download | libdbusmenu-08b711551f30656386c6eadb7b82e6885ba55c63.tar.gz libdbusmenu-08b711551f30656386c6eadb7b82e6885ba55c63.tar.bz2 libdbusmenu-08b711551f30656386c6eadb7b82e6885ba55c63.zip |
releasing version 0.2.6-0ubuntu1
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | libdbusmenu-glib/client.c | 128 | ||||
-rw-r--r-- | tests/test-glib-proxy-client.c | 24 | ||||
-rw-r--r-- | tests/test-glib-proxy-server.c | 25 | ||||
-rw-r--r-- | tests/test-glib-proxy.h | 4 |
6 files changed, 54 insertions, 142 deletions
diff --git a/configure.ac b/configure.ac index 798ba0a..2d08437 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(libdbusmenu, 0.2.5, ted@canonical.com) +AC_INIT(libdbusmenu, 0.2.6, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libdbusmenu, 0.2.5) +AM_INIT_AUTOMAKE(libdbusmenu, 0.2.6) AM_MAINTAINER_MODE @@ -66,7 +66,7 @@ AC_SUBST(DBUSMENUTESTS_LIBS) ########################### LIBDBUSMENU_CURRENT=1 -LIBDBUSMENU_REVISION=3 +LIBDBUSMENU_REVISION=4 LIBDBUSMENU_AGE=0 AC_SUBST(LIBDBUSMENU_CURRENT) diff --git a/debian/changelog b/debian/changelog index c33bfa8..2f5d0c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +libdbusmenu (0.2.6-0ubuntu1) lucid; urgency=low + + * Upstream release 0.2.6 + * Fix testing to make it more reliable + * Remove delayed property queueing as it was causing properties to not + get updated. (lp: #524308) + + -- Ted Gould <ted@ubuntu.com> Thu, 25 Feb 2010 10:23:49 -0600 + libdbusmenu (0.2.5-0ubuntu1) lucid; urgency=low * Upstream release 0.2.5 diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 4735794..309a11c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -75,8 +75,6 @@ struct _DbusmenuClientPrivate DBusGProxy * dbusproxy; GHashTable * type_handlers; - - GArray * delayed_properties; }; typedef struct _newItemPropData newItemPropData; @@ -87,21 +85,6 @@ struct _newItemPropData DbusmenuMenuitem * parent; }; -typedef struct _propertyDelay propertyDelay; -struct _propertyDelay -{ - guint revision; - GArray * entries; -}; - -typedef struct _propertyDelayValue propertyDelayValue; -struct _propertyDelayValue -{ - gint id; - gchar * name; - GValue value; -}; - #define DBUSMENU_CLIENT_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_CLIENT, DbusmenuClientPrivate)) @@ -225,8 +208,6 @@ dbusmenu_client_init (DbusmenuClient *self) priv->type_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - priv->delayed_properties = g_array_new(FALSE, TRUE, sizeof(propertyDelay)); - return; } @@ -274,23 +255,6 @@ dbusmenu_client_finalize (GObject *object) g_hash_table_destroy(priv->type_handlers); } - if (priv->delayed_properties) { - gint i; - for (i = 0; i < priv->delayed_properties->len; i++) { - propertyDelay * delay = &g_array_index(priv->delayed_properties, propertyDelay, i); - gint j; - for (j = 0; j < delay->entries->len; j++) { - propertyDelayValue * value = &g_array_index(delay->entries, propertyDelayValue, j); - g_free(value->name); - g_value_unset(&value->value); - } - g_array_free(delay->entries, TRUE); - delay->entries = NULL; - } - g_array_free(priv->delayed_properties, TRUE); - priv->delayed_properties = NULL; - } - G_OBJECT_CLASS (dbusmenu_client_parent_class)->finalize (object); return; } @@ -355,49 +319,6 @@ layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * return; } -/* Add an entry to the set of entries that are delayed until the - layout has been updated to this revision */ -static void -delay_prop_update (guint revision, GArray * delayarray, gint id, gchar * prop, GValue * value) -{ - propertyDelay * delay = NULL; - gint i; - - /* First look for something with this revision number. This - array should be really short, probably not more than an entry or - two so there is no reason to optimize this. */ - for (i = 0; i < delayarray->len; i++) { - propertyDelay * localdelay = &g_array_index(delayarray, propertyDelay, i); - if (localdelay->revision == revision) { - delay = localdelay; - break; - } - } - - /* If we don't have any entires for this revision number then we - need to create a new one with it's own array of entires. */ - if (delay == NULL) { - propertyDelay localdelay = {0}; - localdelay.revision = revision; - localdelay.entries = g_array_new(FALSE, TRUE, sizeof(propertyDelayValue)); - - g_array_append_val(delayarray, localdelay); - delay = &g_array_index(delayarray, propertyDelay, delayarray->len - 1); - } - - /* Build the actual entry and tack it on the end of the array - of entries */ - propertyDelayValue delayvalue = {0}; - delayvalue.id = id; - delayvalue.name = g_strdup(prop); - - g_value_init(&delayvalue.value, G_VALUE_TYPE(value)); - g_value_copy(value, &delayvalue.value); - - g_array_append_val(delay->entries, delayvalue); - return; -} - /* Signal from the server that a property has changed on one of our menuitems */ static void @@ -413,15 +334,7 @@ id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, D DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - /* If we're not on the right revision, we need to cache the property - changes as it could be that the menuitems don't exist yet. */ - if (priv->root == NULL || priv->my_revision != priv->current_revision) { - #ifdef MASSIVEDEBUGGING - g_debug("Delaying prop update until rev %d for id %d property %s", priv->current_revision, id, property); - #endif - delay_prop_update(priv->current_revision, priv->delayed_properties, id, property, value); - return; - } + g_return_if_fail(priv->root != NULL); DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id); g_return_if_fail(menuitem != NULL); @@ -898,19 +811,16 @@ update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * error, vo DbusmenuClient * client = DBUSMENU_CLIENT(data); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - /* Check to make sure this isn't an issue */ if (error != NULL) { g_warning("Getting layout failed on client %s object %s: %s", priv->dbus_name, priv->dbus_object, error->message); return; } - /* Try to take in the layout that we got */ if (!parse_layout(client, xml)) { g_warning("Unable to parse layout!"); return; } - /* Success, so we need to update our local variables */ priv->my_revision = rev; /* g_debug("Root is now: 0x%X", (unsigned int)priv->root); */ priv->layoutcall = NULL; @@ -919,42 +829,6 @@ update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * error, vo #endif g_signal_emit(G_OBJECT(client), signals[LAYOUT_UPDATED], 0, TRUE); - /* Apply the delayed properties that were queued up while - we were waiting on this layout update. */ - if (G_LIKELY(priv->delayed_properties != NULL)) { - gint i; - for (i = 0; i < priv->delayed_properties->len; i++) { - propertyDelay * delay = &g_array_index(priv->delayed_properties, propertyDelay, i); - if (delay->revision > priv->my_revision) { - /* Check to see if this is for future revisions, which - is possible if there is a ton of updates. */ - break; - } - - gint j; - for (j = 0; j < delay->entries->len; j++) { - propertyDelayValue * value = &g_array_index(delay->entries, propertyDelayValue, j); - DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, value->id); - if (mi != NULL) { - #ifdef MASSIVEDEBUGGING - g_debug("Applying delayed property id %d property %s", value->id, value->name); - #endif - dbusmenu_menuitem_property_set_value(mi, value->name, &value->value); - } - g_free(value->name); - g_value_unset(&value->value); - } - g_array_free(delay->entries, TRUE); - - /* We're removing the entry and moving the index down one - to ensure that we adjust for the shift in the array. The - reality is that i is always 0. You understood this loop - until you got here, didn't you :) */ - g_array_remove_index(priv->delayed_properties, i); - i--; - } - } - /* Check to see if we got another update in the time this one was issued. */ if (priv->my_revision < priv->current_revision) { diff --git a/tests/test-glib-proxy-client.c b/tests/test-glib-proxy-client.c index 50ad5d3..0ae2e20 100644 --- a/tests/test-glib-proxy-client.c +++ b/tests/test-glib-proxy-client.c @@ -26,10 +26,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "test-glib-proxy.h" -static guint layouton = -1; +static guint layouton = -2; static GMainLoop * mainloop = NULL; static gboolean passed = TRUE; static guint death_timer = 0; +static guint verify_timer = 0; static gboolean verify_props (DbusmenuMenuitem * mi, gchar ** properties) @@ -118,16 +119,22 @@ layout_updated (DbusmenuClient * client, gpointer data) g_debug("\tIgnored, no root"); return; } - layouton++; - g_timeout_add (1500, layout_verify_timer, client); + if (verify_timer != 0) { + g_source_remove(verify_timer); + } + + verify_timer = g_timeout_add (3000, layout_verify_timer, client); return; } static gboolean layout_verify_timer (gpointer data) { - g_debug("Verifing Layout: %d", layouton); DbusmenuMenuitem * menuroot = dbusmenu_client_get_root(DBUSMENU_CLIENT(data)); + layouton = dbusmenu_menuitem_property_get_int(menuroot, LAYOUT_ON); + + g_debug("Verifing Layout: %d", layouton); + verify_timer = 0; proplayout_t * layout = &layouts[layouton]; if (!verify_root_to_layout(menuroot, layout)) { @@ -136,13 +143,18 @@ layout_verify_timer (gpointer data) } else { /* Extend our death */ g_source_remove(death_timer); - death_timer = g_timeout_add_seconds(10, timer_func, data); + death_timer = g_timeout_add_seconds(4, timer_func, data); } if (layouts[layouton+1].id == -1) { g_main_loop_quit(mainloop); } + GValue value = {0}; + g_value_init(&value, G_TYPE_INT); + g_value_set_int(&value, 0); + dbusmenu_menuitem_handle_event(menuroot, "clicked", &value, layouton); + return FALSE; } @@ -154,7 +166,7 @@ main (int argc, char ** argv) DbusmenuClient * client = dbusmenu_client_new("test.proxy.first_proxy", "/org/test"); g_signal_connect(G_OBJECT(client), DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, G_CALLBACK(layout_updated), NULL); - death_timer = g_timeout_add_seconds(10, timer_func, client); + death_timer = g_timeout_add_seconds(4, timer_func, client); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-glib-proxy-server.c b/tests/test-glib-proxy-server.c index cba8ec7..f32b426 100644 --- a/tests/test-glib-proxy-server.c +++ b/tests/test-glib-proxy-server.c @@ -69,22 +69,39 @@ layout2menuitem (proplayout_t * layout) static guint layouton = 0; static DbusmenuServer * server = NULL; static GMainLoop * mainloop = NULL; +static guint death_timer = 0; static gboolean timer_func (gpointer data) { + g_debug("Death timer. Oops. Got to: %d", layouton); + g_main_loop_quit(mainloop); + return FALSE; +} + +static void +layout_change (DbusmenuMenuitem * oldroot, guint timestamp, gpointer data) +{ if (layouts[layouton].id == -1) { g_main_loop_quit(mainloop); - return FALSE; + return; } g_debug("Updating to Layout %d", layouton); DbusmenuMenuitem * mi = layout2menuitem(&layouts[layouton]); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(layout_change), NULL); + dbusmenu_menuitem_property_set_int(mi, LAYOUT_ON, layouton); dbusmenu_server_set_root(server, mi); g_object_unref(G_OBJECT(mi)); layouton++; - return TRUE; + /* Extend our death */ + if (death_timer != 0) { + g_source_remove(death_timer); + } + death_timer = g_timeout_add_seconds(4, timer_func, data); + + return; } int @@ -111,9 +128,7 @@ main (int argc, char ** argv) } server = dbusmenu_server_new("/org/test"); - - timer_func(NULL); - g_timeout_add(2500, timer_func, NULL); + layout_change(NULL, 0, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-glib-proxy.h b/tests/test-glib-proxy.h index bc12df6..7bb58b6 100644 --- a/tests/test-glib-proxy.h +++ b/tests/test-glib-proxy.h @@ -22,6 +22,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib.h> +#define LAYOUT_ON "proxy-layout-on" + typedef struct _proplayout_t proplayout_t; struct _proplayout_t { gint id; @@ -132,7 +134,7 @@ proplayout_t submenu_5_1[] = { }; proplayout_t layouts[] = { - {id: 1, properties: props1, submenu: NULL}, + {id: 1, properties: props1, submenu: submenu_5_5}, {id: 10, properties: props2, submenu: submenu_4_1}, {id: 20, properties: props3, submenu: submenu_4_2}, {id: 100, properties: props2, submenu: submenu_4_0}, |