diff options
author | Ted Gould <ted@gould.cx> | 2011-03-10 11:05:16 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-10 11:05:16 -0600 |
commit | 9aa5445985ebf244681ccfb3bb6f264eb4282bca (patch) | |
tree | b8a4f31686c6339498e34785252ff57016a5f518 /libdbusmenu-glib/client.c | |
parent | 05d9b0b58fa3c9247860f911bb3477cd52665671 (diff) | |
parent | cec350b1d24eeeb308fd02846bf637d4ec92fbb5 (diff) | |
download | libdbusmenu-9aa5445985ebf244681ccfb3bb6f264eb4282bca.tar.gz libdbusmenu-9aa5445985ebf244681ccfb3bb6f264eb4282bca.tar.bz2 libdbusmenu-9aa5445985ebf244681ccfb3bb6f264eb4282bca.zip |
New upstream release.
∘ Add helper to get cached menuitem from widget
∘ Have the GTK Dbusmenu Client handle theme directories (LP: #727325)
∘ Fix a bunch of memory leaks (LP: #722972)
∘ Handle _ in menuitems more correctly when parsing (LP: #621301)
∘ Protect from NULL layout_props (LP: #729722)
∘ Remove the property from the hashtable before signaling that
it's been changed (LP: #725603)
∘ Wrap emitted properties in a variant
∘ Fix enum templates so they can be included by other programs
without error
∘ Setting the cached menu item (LP: #723463) (LP: #729128) (LP: #729194)
Diffstat (limited to 'libdbusmenu-glib/client.c')
-rw-r--r-- | libdbusmenu-glib/client.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c95b161..16e832d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1056,10 +1056,39 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) } priv->text_direction = dbusmenu_text_direction_get_value_from_nick(g_variant_get_string(str, NULL)); + g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_TEXT_DIRECTION); g_variant_unref(textdir); } + /* Check the status if available */ + GVariant * status = g_dbus_proxy_get_cached_property(priv->menuproxy, "Status"); + if (textdir != NULL) { + GVariant * str = status; + if (g_variant_is_of_type(str, G_VARIANT_TYPE_VARIANT)) { + str = g_variant_get_variant(str); + } + + priv->status = dbusmenu_status_get_value_from_nick(g_variant_get_string(str, NULL)); + g_object_notify(G_OBJECT(user_data), DBUSMENU_CLIENT_PROP_STATUS); + + g_variant_unref(status); + } + + /* Get the icon theme directories if available */ + GVariant * icon_dirs = g_dbus_proxy_get_cached_property(priv->menuproxy, "IconThemePath"); + if (icon_dirs != NULL) { + if (priv->icon_dirs != NULL) { + g_strfreev(priv->icon_dirs); + priv->icon_dirs = NULL; + } + + priv->icon_dirs = g_variant_dup_strv(icon_dirs, NULL); + g_signal_emit(G_OBJECT(client), signals[ICON_THEME_DIRS], 0, priv->icon_dirs, TRUE); + + g_variant_unref(icon_dirs); + } + /* If we get here, we don't need the DBus proxy */ if (priv->dbusproxy != 0) { g_bus_unwatch_name(priv->dbusproxy); @@ -1213,7 +1242,9 @@ menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVarian while (g_variant_iter_next(&properties, "s", &property)) { /* g_debug("Removing property '%s' on %d", property, id); */ dbusmenu_menuitem_property_remove(menuitem, property); + g_free(property); } + g_variant_unref(ritem); } GVariantIter items; @@ -1304,12 +1335,11 @@ menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpoin have_error = TRUE; } - GList * current_props = NULL; + GList * current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); + GList * tmp = NULL; - for (current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); - current_props != NULL && have_error == FALSE; - current_props = g_list_next(current_props)) { - dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data); + for (tmp = current_props; tmp != NULL && have_error == FALSE; tmp = g_list_next(tmp)) { + dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)tmp->data); } g_list_free(current_props); @@ -1823,6 +1853,7 @@ static void update_layout (DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + g_return_if_fail(priv->layout_props != NULL); if (priv->menuproxy == NULL) { return; |