aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbusmenu-glib/Makefile.am15
-rw-r--r--libdbusmenu-glib/defaults.c2
-rw-r--r--libdbusmenu-glib/menuitem.c42
-rw-r--r--libdbusmenu-glib/server.c8
-rw-r--r--libdbusmenu-gtk/parser.c35
5 files changed, 63 insertions, 39 deletions
diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am
index 8b523aa..5b04415 100644
--- a/libdbusmenu-glib/Makefile.am
+++ b/libdbusmenu-glib/Makefile.am
@@ -17,12 +17,17 @@ lib_LTLIBRARIES = \
libdbusmenu_glibincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-glib/
-libdbusmenu_glibinclude_HEADERS = \
- dbusmenu-glib.h \
+
+EXPORTED_OBJECTS = \
+ enum-types.h \
menuitem.h \
menuitem-proxy.h \
server.h \
- client.h \
+ client.h
+
+libdbusmenu_glibinclude_HEADERS = \
+ $(EXPORTED_OBJECTS) \
+ dbusmenu-glib.h \
types.h
libdbusmenu_glib_la_SOURCES = \
@@ -153,7 +158,9 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir)
if HAVE_INTROSPECTION
-introspection_sources = $(libdbusmenu_glibinclude_HEADERS) $(libdbusmenu_glib_la_SOURCES)
+introspection_sources = \
+ $(libdbusmenu_glibinclude_HEADERS) \
+ $(EXPORTED_OBJECTS:.h=.c)
Dbusmenu-0.4.gir: libdbusmenu-glib.la
Dbusmenu_0_4_gir_INCLUDES = \
diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c
index c05ef38..9eaf9e5 100644
--- a/libdbusmenu-glib/defaults.c
+++ b/libdbusmenu-glib/defaults.c
@@ -30,7 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "config.h"
#endif
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include "defaults.h"
#include "menuitem.h"
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 34147a3..855f4ee 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1150,9 +1150,9 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi);
GVariant * default_value = NULL;
- if (value != NULL) {
- const gchar * type = menuitem_get_type(mi);
+ const gchar * type = menuitem_get_type(mi);
+ if (value != NULL) {
/* Check the expected type to see if we want to have a warning */
GVariantType * default_type = dbusmenu_defaults_default_get_type(priv->defaults, type, property);
if (default_type != NULL) {
@@ -1163,22 +1163,23 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro
g_warning("Setting menuitem property '%s' with value of type '%s' when expecting '%s'", property, g_variant_get_type_string(value), g_variant_type_peek_string(default_type));
}
}
+ }
- /* Check the defaults database to see if we have a default
- for this property. */
- default_value = dbusmenu_defaults_default_get(priv->defaults, type, property);
- if (default_value != NULL) {
- /* Now see if we're setting this to the same value as the
- default. If we are then we just want to swallow this variant
- and make the function behave like we're clearing it. */
- if (g_variant_equal(default_value, value)) {
- g_variant_ref_sink(value);
- g_variant_unref(value);
- value = NULL;
- }
+ /* Check the defaults database to see if we have a default
+ for this property. */
+ default_value = dbusmenu_defaults_default_get(priv->defaults, type, property);
+ if (default_value != NULL && value != NULL) {
+ /* Now see if we're setting this to the same value as the
+ default. If we are then we just want to swallow this variant
+ and make the function behave like we're clearing it. */
+ if (g_variant_equal(default_value, value)) {
+ g_variant_ref_sink(value);
+ g_variant_unref(value);
+ value = NULL;
}
}
+
gboolean replaced = FALSE;
gpointer currentval = g_hash_table_lookup(priv->properties, property);
@@ -1371,9 +1372,7 @@ dbusmenu_menuitem_property_remove (DbusmenuMenuitem * mi, const gchar * property
g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
g_return_if_fail(property != NULL);
- DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi);
-
- g_hash_table_remove(priv->properties, property);
+ dbusmenu_menuitem_property_set_variant(mi, property, NULL);
return;
}
@@ -1753,13 +1752,8 @@ dbusmenu_menuitem_property_is_default (DbusmenuMenuitem * mi, const gchar * prop
return FALSE;
}
- currentval = dbusmenu_defaults_default_get(priv->defaults, menuitem_get_type(mi), property);
- if (currentval != NULL) {
- return TRUE;
- }
-
- g_warn_if_reached();
- return FALSE;
+ /* If we haven't stored it locally, then it's the default */
+ return TRUE;
}
/* Check to see if this menu item has been sent into the bus yet or
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index 056d6cb..7c943b2 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -30,7 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "config.h"
#endif
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include "menuitem-private.h"
@@ -1180,7 +1180,11 @@ bus_get_layout (DbusmenuServer * server, GVariant * params, GDBusMethodInvocatio
GVariant * items = NULL;
if (priv->root != NULL) {
- items = dbusmenu_menuitem_build_variant(priv->root, props, recurse);
+ DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, parent);
+
+ if (mi != NULL) {
+ items = dbusmenu_menuitem_build_variant(mi, props, recurse);
+ }
}
/* What happens if we don't have anything? */
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 97f7979..cf2003f 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -129,6 +129,12 @@ parse_data_free (gpointer data)
if (pdata != NULL && pdata->widget != NULL) {
g_signal_handlers_disconnect_matched(pdata->widget, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
0, 0, NULL, G_CALLBACK(widget_notify_cb), NULL);
+ g_signal_handlers_disconnect_matched(pdata->widget, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, G_CALLBACK(accel_changed), NULL);
+ g_signal_handlers_disconnect_matched(pdata->widget, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, G_CALLBACK(checkbox_toggled), NULL);
+ g_signal_handlers_disconnect_matched(pdata->widget, (GSignalMatchType)G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, G_CALLBACK(menuitem_notify_cb), NULL);
g_object_remove_weak_pointer(G_OBJECT(pdata->widget), (gpointer*)&pdata->widget);
}
@@ -149,6 +155,14 @@ parse_data_free (gpointer data)
return;
}
+static void
+widget_freed (gpointer data, GObject * obj)
+{
+ g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), obj);
+
+ return;
+}
+
/* Called when the dbusmenu item that we're keeping around
is finalized */
static void
@@ -157,18 +171,12 @@ dbusmenu_item_freed (gpointer data, GObject * obj)
ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA);
if (pdata != NULL && pdata->widget != NULL) {
+ g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), pdata->widget);
g_object_steal_data(G_OBJECT(pdata->widget), CACHED_MENUITEM);
+ g_object_weak_unref(G_OBJECT(pdata->widget), widget_freed, NULL);
}
}
-static void
-widget_freed (gpointer data, GObject * obj)
-{
- g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), obj);
-
- return;
-}
-
/* Gets the positon of the child with its' parent if it has one.
Returns -1 if the position is unable to be calculated. */
static gint
@@ -450,6 +458,17 @@ construct_dbusmenu_for_widget (GtkWidget * widget)
}
}
+ GtkWidget *submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
+ if (submenu)
+ {
+ pdata->shell = submenu;
+ g_signal_connect (G_OBJECT (submenu),
+ "child-added",
+ G_CALLBACK (child_added_cb),
+ mi);
+ g_object_add_weak_pointer(G_OBJECT(submenu), (gpointer*)&pdata->shell);
+ }
+
if (!g_object_get_data (G_OBJECT (widget), "gtk-empty-menu-item") && !GTK_IS_TEAROFF_MENU_ITEM (widget))
{
visible = gtk_widget_get_visible (widget);