From ad4bfb14e3449857f52f50bca76ce52ee72be5f5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 21:58:26 -0600 Subject: Changing the prototype on the signal so that it isn't a string, but a value. --- libdbusmenu-glib/menuitem-marshal.list | 2 +- libdbusmenu-glib/menuitem.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list index a32e7e3..dc4ba53 100644 --- a/libdbusmenu-glib/menuitem-marshal.list +++ b/libdbusmenu-glib/menuitem-marshal.list @@ -1,4 +1,4 @@ -VOID: STRING, STRING +VOID: STRING, POINTER VOID: OBJECT, UINT, UINT VOID: OBJECT, UINT VOID: OBJECT diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index dc01157..5d45e98 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -122,8 +122,8 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DbusmenuMenuitemClass, property_changed), NULL, NULL, - _dbusmenu_menuitem_marshal_VOID__STRING_STRING, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + _dbusmenu_menuitem_marshal_VOID__STRING_POINTER, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VALUE); /** DbusmenuMenuitem::item-activated: @arg0: The #DbusmenuMenuitem object. -- cgit v1.2.3 From 1088cbfdb3cfd67ee3dfe048c7b0879d6f83a8d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:04:00 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 08f8b96..83f9a25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix1) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix1) karmic; urgency=low * Upstream * Fixing the signal prototypes. - -- Ted Gould Fri, 18 Dec 2009 21:59:03 -0600 + -- Ted Gould Fri, 18 Dec 2009 22:03:56 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa5) karmic; urgency=low -- cgit v1.2.3 From 8f3554c1f22f58ab8e601a4efc5eabfbf04c2349 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:09:02 -0600 Subject: Switching to just being a string and a pointer. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 5d45e98..ec37da5 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -123,7 +123,7 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_STRUCT_OFFSET(DbusmenuMenuitemClass, property_changed), NULL, NULL, _dbusmenu_menuitem_marshal_VOID__STRING_POINTER, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VALUE); + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER); /** DbusmenuMenuitem::item-activated: @arg0: The #DbusmenuMenuitem object. -- cgit v1.2.3 From 13a19ef39002664d91cabfea8bfe0cb3ad01d61e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:10:47 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 93e5787..09f5c79 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix1) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix1) karmic; urgency=low * Trying again - -- Ted Gould Fri, 18 Dec 2009 22:09:20 -0600 + -- Ted Gould Fri, 18 Dec 2009 22:10:45 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix1) karmic; urgency=low -- cgit v1.2.3 From 5217f7324cedb09aba9fab35c348c3191279a90e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:11:07 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix2 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 09f5c79..b1308ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix1) karmic; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix2) karmic; urgency=low * Trying again -- cgit v1.2.3 From 9676ac55e84b21bf1318925bceb3b3135e07403c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:20:10 -0600 Subject: debian/rules: Massive debugging --- debian/changelog | 6 ++++++ debian/rules | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index b1308ae..41dc81e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix3) UNRELEASED; urgency=low + + * debian/rules: Massive debugging + + -- Ted Gould Fri, 18 Dec 2009 22:19:52 -0600 + libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix2) karmic; urgency=low * Trying again diff --git a/debian/rules b/debian/rules index 7f7f405..ebcbf31 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,7 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/gnome.mk -DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper +DEB_CONFIGURE_EXTRA_FLAGS += --disable-scrollkeeper --enable-massivedebugging LDFLAGS += -Wl,-z,defs -Wl,--as-needed DEB_DH_MAKESHLIBS_ARGS_libdbusmenu-gtk0 += -V 'libdbusmenu-gtk0 (>= 0.1.2)' -- cgit v1.2.3 From ac0fbaf02100ff196bef3d97db162a4f01d58d58 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:21:46 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 41dc81e..4621c6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix3) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix3) karmic; urgency=low * debian/rules: Massive debugging - -- Ted Gould Fri, 18 Dec 2009 22:19:52 -0600 + -- Ted Gould Fri, 18 Dec 2009 22:21:44 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix2) karmic; urgency=low -- cgit v1.2.3 From 9276f061d4565b57a160ece79ec547550195188b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Dec 2009 22:24:25 -0600 Subject: Making sure we get our function. --- libdbusmenu-glib/menuitem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ec37da5..2cefce4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -250,7 +250,7 @@ static guint menuitem_next_id = 1; /* A small little function to both clear the insides of a value as well as the memory it itself uses. */ static void -g_value_free (gpointer data) +_g_value_free (gpointer data) { if (data == NULL) return; GValue * value = (GValue*)data; @@ -269,7 +269,7 @@ dbusmenu_menuitem_init (DbusmenuMenuitem *self) priv->id = 0; priv->children = NULL; - priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_value_free); + priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_value_free); priv->root = FALSE; -- cgit v1.2.3 From d7f273f9fced68bea1d711503b9a0fd2defa72c6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 14:29:56 -0600 Subject: Starting a framework for object testing. --- tests/test-glib-objects.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/test-glib-objects.c diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c new file mode 100644 index 0000000..cc95b81 --- /dev/null +++ b/tests/test-glib-objects.c @@ -0,0 +1,60 @@ +/* +Testing for the various objects just by themselves. + +Copyright 2009 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#include +#include + +#include + +void +test_object_menuitem (void) +{ + + +} + +void +test_object_menuitem_props (void) +{ + + +} + +void +test_glib_objects_suite (void) +{ + g_test_add_func ("/dbusmenu/glib/objects/menuitem", test_object_menuitem); + g_test_add_func ("/dbusmenu/glib/objects/menuitem-props", test_object_menuitem_props); + return; +} + +gint +main (gint argc, gchar * argv[]) +{ + g_type_init(); + g_test_init(&argc, &argv, NULL); + + /* Test suites */ + test_glib_objects_suite(); + + + return g_test_run (); +} -- cgit v1.2.3 From 7f05a7e84a3bf4bf936bc9e81465e7feac1f7487 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 14:41:50 -0600 Subject: Adding the object tests into the build. --- .bzrignore | 2 ++ tests/Makefile.am | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/.bzrignore b/.bzrignore index d7b28a6..66f815e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -54,3 +54,5 @@ libdbusmenu-[0-9].[0-9].[0-9].tar.gz.asc tests/test-mago tests/*.bustle libdbusmenu-gtk/libdbusmenu_gtk_la-genericmenuitem.lo +tests/test-glib-objects +tests/test-glib-objects-test diff --git a/tests/Makefile.am b/tests/Makefile.am index 1d58700..0c2ab57 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,6 +2,7 @@ DBUS_RUNNER=dbus-test-runner TESTS = \ + test-glib-objects-test \ test-glib-layout \ test-glib-properties \ test-glib-simple-items \ @@ -10,6 +11,7 @@ TESTS = \ check_PROGRAMS = \ glib-server-nomenu \ + test-glib-objects \ test-glib-layout-client \ test-glib-layout-server \ test-glib-properties-client \ @@ -70,6 +72,26 @@ test_glib_layout_client_LDADD = \ $(DBUSMENUGLIB_LIBS) +###################### +# Test Glib Object +###################### + +test-glib-objects-test: test-glib-objects Makefile.am + @echo "#!/bin/bash" > $@ + @echo $(DBUS_RUNNER) -b $@.bustle --task gtester --parameter ./test-glib-objects >> $@ + @chmod +x $@ + +test_glib_objects_SOURCES = \ + test-glib-objects.c + +test_glib_objects_CFLAGS = \ + -I $(srcdir)/.. \ + $(DBUSMENUGLIB_CFLAGS) -Wall -Werror + +test_glib_objects_LDADD = \ + ../libdbusmenu-glib/libdbusmenu-glib.la \ + $(DBUSMENUGLIB_LIBS) + ###################### # Test Glib Properties ###################### @@ -239,6 +261,7 @@ distclean-local: DISTCLEANFILES = \ $(TESTS) \ + test-glib-objects-test.bustle \ test-glib-layout.bustle \ test-glib-properties.bustle \ test-glib-simple-items.bustle \ -- cgit v1.2.3 From b03128c902c0b9906a34e3cc9f4fc5985d7a06d3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 14:52:44 -0600 Subject: Adding a menuitem allocation test. --- tests/test-glib-objects.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index cc95b81..cc59751 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -27,8 +27,22 @@ with this program. If not, see . void test_object_menuitem (void) { + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + g_assert(G_IS_OBJECT(item)); + g_assert(DBUSMENU_IS_MENUITEM(item)); + /* Set up a check to make sure it gets destroyed on unref */ + g_object_add_weak_pointer(G_OBJECT(item), (gpointer *)&item); + g_object_unref(item); + + /* Did it go away? */ + g_assert(item == NULL); + + return; } void -- cgit v1.2.3 From 46532dd8beb62a6aa4a639ee646eb0bf1682b75c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 14:56:49 -0600 Subject: Adding in an XML report file. --- tests/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 0c2ab57..fa18b9d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -76,9 +76,11 @@ test_glib_layout_client_LDADD = \ # Test Glib Object ###################### +OBJECT_XML_REPORT = test-glib-objects.xml + test-glib-objects-test: test-glib-objects Makefile.am @echo "#!/bin/bash" > $@ - @echo $(DBUS_RUNNER) -b $@.bustle --task gtester --parameter ./test-glib-objects >> $@ + @echo $(DBUS_RUNNER) -b $@.bustle --task gtester --parameter -k --parameter -o --parameter $(OBJECT_XML_REPORT) --parameter ./test-glib-objects >> $@ @chmod +x $@ test_glib_objects_SOURCES = \ @@ -261,6 +263,7 @@ distclean-local: DISTCLEANFILES = \ $(TESTS) \ + $(OBJECT_XML_FILE) \ test-glib-objects-test.bustle \ test-glib-layout.bustle \ test-glib-properties.bustle \ -- cgit v1.2.3 From 0d32243f7b12d6d1bc94658a61c4f06c4643051b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 15:07:39 -0600 Subject: Setting all the different properties. --- tests/test-glib-objects.c | 70 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index cc59751..d45baa0 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -46,17 +46,81 @@ test_object_menuitem (void) } void -test_object_menuitem_props (void) +test_object_menuitem_props_string (void) { + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + const GValue * out = NULL; + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + + /* Setting a string */ + dbusmenu_menuitem_property_set(item, "string", "value"); + out = dbusmenu_menuitem_property_get_value(item, "string"); + g_assert(out != NULL); + g_assert(G_VALUE_TYPE(out) == G_TYPE_STRING); + g_assert(!g_strcmp0(g_value_get_string(out), "value")); + g_assert(!g_strcmp0(dbusmenu_menuitem_property_get(item, "string"), "value")); + + g_object_unref(item); + + return; +} + +void +test_object_menuitem_props_int (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + const GValue * out = NULL; + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + + /* Setting a string */ + dbusmenu_menuitem_property_set_int(item, "int", 12345); + out = dbusmenu_menuitem_property_get_value(item, "int"); + g_assert(out != NULL); + g_assert(G_VALUE_TYPE(out) == G_TYPE_INT); + g_assert(g_value_get_int(out) == 12345); + g_assert(dbusmenu_menuitem_property_get_int(item, "int") == 12345); + + g_object_unref(item); + + return; +} + +void +test_object_menuitem_props_bool (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + const GValue * out = NULL; + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + /* Setting a string */ + dbusmenu_menuitem_property_set_bool(item, "boolean", TRUE); + out = dbusmenu_menuitem_property_get_value(item, "boolean"); + g_assert(out != NULL); + g_assert(G_VALUE_TYPE(out) == G_TYPE_BOOLEAN); + g_assert(g_value_get_boolean(out)); + g_assert(dbusmenu_menuitem_property_get_int(item, "boolean")); + + g_object_unref(item); + + return; } void test_glib_objects_suite (void) { - g_test_add_func ("/dbusmenu/glib/objects/menuitem", test_object_menuitem); - g_test_add_func ("/dbusmenu/glib/objects/menuitem-props", test_object_menuitem_props); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/base", test_object_menuitem); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_string", test_object_menuitem_props_string); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_int", test_object_menuitem_props_int); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool); return; } -- cgit v1.2.3 From d7480ea88bc34ac80c468e28ce8b6a0704cb3c8c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 15:08:03 -0600 Subject: Ignoring the generated test description. --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 66f815e..06863df 100644 --- a/.bzrignore +++ b/.bzrignore @@ -56,3 +56,4 @@ tests/*.bustle libdbusmenu-gtk/libdbusmenu_gtk_la-genericmenuitem.lo tests/test-glib-objects tests/test-glib-objects-test +tests/test-glib-objects.xml -- cgit v1.2.3 From c96e551eccc631c726e0987ebe8ed859c2305e42 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 15:26:19 -0600 Subject: Testing setting the same prop multiple times of different types. --- tests/test-glib-objects.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index d45baa0..7f79746 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -114,6 +114,36 @@ test_object_menuitem_props_bool (void) return; } +void +test_object_menuitem_props_swap (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + + /* Setting a boolean */ + dbusmenu_menuitem_property_set_bool(item, "swapper", TRUE); + g_assert(dbusmenu_menuitem_property_get_bool(item, "swapper")); + + /* Setting a int */ + dbusmenu_menuitem_property_set_int(item, "swapper", 5432); + g_assert(dbusmenu_menuitem_property_get_int(item, "swapper") == 5432); + + /* Setting a string */ + dbusmenu_menuitem_property_set(item, "swapper", "mystring"); + g_assert(!g_strcmp0(dbusmenu_menuitem_property_get(item, "swapper"), "mystring")); + + /* Setting a boolean */ + dbusmenu_menuitem_property_set_bool(item, "swapper", FALSE); + g_assert(!dbusmenu_menuitem_property_get_bool(item, "swapper")); + + g_object_unref(item); + + return; +} + void test_glib_objects_suite (void) { @@ -121,6 +151,7 @@ test_glib_objects_suite (void) g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_string", test_object_menuitem_props_string); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_int", test_object_menuitem_props_int); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_swap", test_object_menuitem_props_swap); return; } -- cgit v1.2.3 From d33832e3fd108c002216551123d419ec494bd668 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 15:28:08 -0600 Subject: Comments are good for the soul. --- tests/test-glib-objects.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 7f79746..d63c26d 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -24,6 +24,8 @@ with this program. If not, see . #include +/* Building the basic menu item, make sure we didn't break + any core GObject stuff */ void test_object_menuitem (void) { @@ -45,6 +47,7 @@ test_object_menuitem (void) return; } +/* Set a string prop, make sure it's stored as one */ void test_object_menuitem_props_string (void) { @@ -68,6 +71,7 @@ test_object_menuitem_props_string (void) return; } +/* Set an integer prop, make sure it's stored as one */ void test_object_menuitem_props_int (void) { @@ -91,6 +95,7 @@ test_object_menuitem_props_int (void) return; } +/* Set a boolean prop, make sure it's stored as one */ void test_object_menuitem_props_bool (void) { @@ -114,6 +119,8 @@ test_object_menuitem_props_bool (void) return; } +/* Set the same property several times with + different types. */ void test_object_menuitem_props_swap (void) { @@ -144,6 +151,7 @@ test_object_menuitem_props_swap (void) return; } +/* Build the test suite */ void test_glib_objects_suite (void) { -- cgit v1.2.3 From f5a12b2235fe0437d58ec2743382eef39f2b40fc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 15:59:41 -0600 Subject: Adding test to signal property changes. --- tests/test-glib-objects.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index d63c26d..1807243 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -151,6 +151,60 @@ test_object_menuitem_props_swap (void) return; } +/* A helper to put a value into a pointer for eval. */ +void +test_object_menuitem_props_signals_helper (DbusmenuMenuitem * mi, gchar * property, GValue * value, GValue ** out) +{ + if (!g_strcmp0(property, "swapper")) { + *out = value; + } + return; +} + +/* Set the same property several times with + different types. */ +void +test_object_menuitem_props_signals (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + GValue * out; + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + + /* Setting up our callback */ + g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(test_object_menuitem_props_signals_helper), &out); + + /* Setting a boolean */ + dbusmenu_menuitem_property_set_bool(item, "swapper", TRUE); + g_assert(out != NULL); + g_assert(g_value_get_boolean(out)); + out = NULL; + + /* Setting a int */ + dbusmenu_menuitem_property_set_int(item, "swapper", 5432); + g_assert(out != NULL); + g_assert(g_value_get_int(out) == 5432); + out = NULL; + + /* Setting a string */ + dbusmenu_menuitem_property_set(item, "swapper", "mystring"); + g_assert(out != NULL); + g_assert(!g_strcmp0(g_value_get_string(out), "mystring")); + out = NULL; + + /* Setting a boolean */ + dbusmenu_menuitem_property_set_bool(item, "swapper", FALSE); + g_assert(out != NULL); + g_assert(g_value_get_boolean(out)); + out = NULL; + + g_object_unref(item); + + return; +} + /* Build the test suite */ void test_glib_objects_suite (void) @@ -160,6 +214,7 @@ test_glib_objects_suite (void) g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_int", test_object_menuitem_props_int); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_swap", test_object_menuitem_props_swap); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_signals", test_object_menuitem_props_signals); return; } -- cgit v1.2.3 From 2d6a51051442499e65f4dade13ba91d13a28fca9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 16:01:49 -0600 Subject: Making functions static so that we can get warnings if we don't use them. --- tests/test-glib-objects.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 1807243..9e46128 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -26,7 +26,7 @@ with this program. If not, see . /* Building the basic menu item, make sure we didn't break any core GObject stuff */ -void +static void test_object_menuitem (void) { /* Build a menu item */ @@ -48,7 +48,7 @@ test_object_menuitem (void) } /* Set a string prop, make sure it's stored as one */ -void +static void test_object_menuitem_props_string (void) { /* Build a menu item */ @@ -72,7 +72,7 @@ test_object_menuitem_props_string (void) } /* Set an integer prop, make sure it's stored as one */ -void +static void test_object_menuitem_props_int (void) { /* Build a menu item */ @@ -96,7 +96,7 @@ test_object_menuitem_props_int (void) } /* Set a boolean prop, make sure it's stored as one */ -void +static void test_object_menuitem_props_bool (void) { /* Build a menu item */ @@ -121,7 +121,7 @@ test_object_menuitem_props_bool (void) /* Set the same property several times with different types. */ -void +static void test_object_menuitem_props_swap (void) { /* Build a menu item */ @@ -152,7 +152,7 @@ test_object_menuitem_props_swap (void) } /* A helper to put a value into a pointer for eval. */ -void +static void test_object_menuitem_props_signals_helper (DbusmenuMenuitem * mi, gchar * property, GValue * value, GValue ** out) { if (!g_strcmp0(property, "swapper")) { @@ -163,12 +163,12 @@ test_object_menuitem_props_signals_helper (DbusmenuMenuitem * mi, gchar * proper /* Set the same property several times with different types. */ -void +static void test_object_menuitem_props_signals (void) { /* Build a menu item */ DbusmenuMenuitem * item = dbusmenu_menuitem_new(); - GValue * out; + GValue * out = NULL; /* Test to make sure it's a happy object */ g_assert(item != NULL); @@ -206,7 +206,7 @@ test_object_menuitem_props_signals (void) } /* Build the test suite */ -void +static void test_glib_objects_suite (void) { g_test_add_func ("/dbusmenu/glib/objects/menuitem/base", test_object_menuitem); -- cgit v1.2.3 From 14e7084968a1ce9fe8a1c1419351f435acd0eda5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 16:15:12 -0600 Subject: Fix an assertion that is the wrong direction --- tests/test-glib-objects.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 9e46128..afa669a 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -155,6 +155,7 @@ test_object_menuitem_props_swap (void) static void test_object_menuitem_props_signals_helper (DbusmenuMenuitem * mi, gchar * property, GValue * value, GValue ** out) { + /* g_debug("Signal handler got: %s", property); */ if (!g_strcmp0(property, "swapper")) { *out = value; } @@ -197,7 +198,7 @@ test_object_menuitem_props_signals (void) /* Setting a boolean */ dbusmenu_menuitem_property_set_bool(item, "swapper", FALSE); g_assert(out != NULL); - g_assert(g_value_get_boolean(out)); + g_assert(!g_value_get_boolean(out)); out = NULL; g_object_unref(item); -- cgit v1.2.3 From 7d0dbc3dd6be6ffaeca675b460767e20e505841e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 16:15:45 -0600 Subject: Switching to a replace so that new values are added. --- libdbusmenu-glib/menuitem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 2cefce4..a03117c 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -815,12 +815,13 @@ dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * prope g_value_init(lval, G_VALUE_TYPE(value)); g_value_copy(value, lval); - g_hash_table_insert(priv->properties, lprop, lval); + g_hash_table_replace(priv->properties, lprop, lval); #ifdef MASSIVEDEBUGGING gchar * valstr = g_strdup_value_contents(lval); g_debug("Menuitem %d (%s) signalling property '%s' changed to '%s'", ID(mi), LABEL(mi), property, g_utf8_strlen(valstr, 50) < 25 ? valstr : ""); g_free(valstr); #endif + g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, lval, TRUE); return TRUE; -- cgit v1.2.3 From e32d593cf3457b68a1f05a5ece4aafd5a5918033 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 16:20:44 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix4 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ab376d2..174aae2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix4) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix4) karmic; urgency=low * Using a hash table replace - -- Ted Gould Mon, 21 Dec 2009 16:16:45 -0600 + -- Ted Gould Mon, 21 Dec 2009 16:20:42 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix3) karmic; urgency=low -- cgit v1.2.3 From 2c02b8e394a55f099b03066774543396078932aa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 16:54:48 -0600 Subject: Adding a test for the string to boolean convertions --- tests/test-glib-objects.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index afa669a..7b22b7a 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -206,6 +206,49 @@ test_object_menuitem_props_signals (void) return; } +/* Set a boolean prop, as a string too! */ +static void +test_object_menuitem_props_boolstr (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + + /* Setting a bool */ + dbusmenu_menuitem_property_set_bool(item, "boolean", TRUE); + g_assert(dbusmenu_menuitem_property_get_bool(item, "boolean")); + + /* Setting "true" */ + dbusmenu_menuitem_property_set(item, "boolean", "true"); + g_assert(dbusmenu_menuitem_property_get_bool(item, "boolean")); + + /* Setting "True" */ + dbusmenu_menuitem_property_set(item, "boolean", "True"); + g_assert(dbusmenu_menuitem_property_get_bool(item, "boolean")); + + /* Setting "TRUE" */ + dbusmenu_menuitem_property_set(item, "boolean", "TRUE"); + g_assert(dbusmenu_menuitem_property_get_bool(item, "boolean")); + + /* Setting "false" */ + dbusmenu_menuitem_property_set(item, "boolean", "false"); + g_assert(!dbusmenu_menuitem_property_get_bool(item, "boolean")); + + /* Setting "False" */ + dbusmenu_menuitem_property_set(item, "boolean", "False"); + g_assert(!dbusmenu_menuitem_property_get_bool(item, "boolean")); + + /* Setting "FALSE" */ + dbusmenu_menuitem_property_set(item, "boolean", "FALSE"); + g_assert(!dbusmenu_menuitem_property_get_bool(item, "boolean")); + + g_object_unref(item); + + return; +} + /* Build the test suite */ static void test_glib_objects_suite (void) @@ -216,6 +259,7 @@ test_glib_objects_suite (void) g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_bool", test_object_menuitem_props_bool); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_swap", test_object_menuitem_props_swap); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_signals", test_object_menuitem_props_signals); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_boolstr", test_object_menuitem_props_boolstr); return; } -- cgit v1.2.3 From 3634997456ea36b66d720fcb7b7f60d51a403e99 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 21:18:35 -0600 Subject: Switching the server function over to values. Oh, how I hate the untyped signals in GLib. --- libdbusmenu-glib/server.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index f61b0fb..0825997 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -92,7 +92,7 @@ static void dbusmenu_server_dispose (GObject *object); static void dbusmenu_server_finalize (GObject *object); static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); -static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, gchar * value, DbusmenuServer * server); +static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server); static void menuitem_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint pos, DbusmenuServer * server); static void menuitem_child_removed (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, DbusmenuServer * server); static void menuitem_signals_create (DbusmenuMenuitem * mi, gpointer data); @@ -292,12 +292,9 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) } static void -menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, gchar * strvalue, DbusmenuServer * server) +menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server) { - GValue value = {0}; - g_value_init(&value, G_TYPE_STRING); - g_value_set_static_string(&value, strvalue); - g_signal_emit(G_OBJECT(server), signals[ID_PROP_UPDATE], 0, dbusmenu_menuitem_get_id(mi), property, &value, TRUE); + g_signal_emit(G_OBJECT(server), signals[ID_PROP_UPDATE], 0, dbusmenu_menuitem_get_id(mi), property, value, TRUE); return; } -- cgit v1.2.3 From f7a7a21c1f4365aa9857f20e420161f3df51c5af Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 21:22:37 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix5 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2e51ca9..cb7d187 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix5) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix5) karmic; urgency=low * string to value fix - -- Ted Gould Mon, 21 Dec 2009 21:19:11 -0600 + -- Ted Gould Mon, 21 Dec 2009 21:22:35 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix4) karmic; urgency=low -- cgit v1.2.3 From c2e4aa4e87800be6c73c3bd3671351959fd7854f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 21:51:44 -0600 Subject: Changing the prop handler to be a pointer. --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 59494a3..8aee45e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -499,8 +499,8 @@ build_proxies (DbusmenuClient * client) dbus_g_proxy_add_signal(priv->menuproxy, "LayoutUpdate", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal(priv->menuproxy, "LayoutUpdate", G_CALLBACK(layout_update), client, NULL); - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_STRING_POINTER, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_STRING_POINTER, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INVALID); + dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INVALID); dbus_g_proxy_connect_signal(priv->menuproxy, "ItemPropertyUpdated", G_CALLBACK(id_prop_update), client, NULL); dbus_g_proxy_add_signal(priv->menuproxy, "ItemUpdated", G_TYPE_UINT, G_TYPE_INVALID); -- cgit v1.2.3 From 6fc4626f2267b38752bb0f8f09fdae21dd25e28a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Dec 2009 21:57:26 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix6 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 67b39ca..15bc87f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix6) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix6) karmic; urgency=low * Signal change - -- Ted Gould Mon, 21 Dec 2009 21:52:10 -0600 + -- Ted Gould Mon, 21 Dec 2009 21:57:24 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix5) karmic; urgency=low -- cgit v1.2.3 From e8b9e2835c71ab60df2fd67b4d78b8d08224a975 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Dec 2009 08:01:25 -0600 Subject: Oops, that didn't work. --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 8aee45e..59494a3 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -499,8 +499,8 @@ build_proxies (DbusmenuClient * client) dbus_g_proxy_add_signal(priv->menuproxy, "LayoutUpdate", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal(priv->menuproxy, "LayoutUpdate", G_CALLBACK(layout_update), client, NULL); - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_STRING_POINTER, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_STRING_POINTER, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); + dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); dbus_g_proxy_connect_signal(priv->menuproxy, "ItemPropertyUpdated", G_CALLBACK(id_prop_update), client, NULL); dbus_g_proxy_add_signal(priv->menuproxy, "ItemUpdated", G_TYPE_UINT, G_TYPE_INVALID); -- cgit v1.2.3 From fe1a34466dc13f83d43f2326e9f1790f83eb83fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Dec 2009 08:10:10 -0600 Subject: releasing version 0.2.0~dev-0ubuntu1~ppa6~sigfix7 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 70df135..f7a8e50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix7) UNRELEASED; urgency=low +libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix7) karmic; urgency=low * Nope, bad idea. - -- Ted Gould Tue, 22 Dec 2009 08:01:39 -0600 + -- Ted Gould Tue, 22 Dec 2009 08:10:08 -0600 libdbusmenu (0.2.0~dev-0ubuntu1~ppa6~sigfix6) karmic; urgency=low -- cgit v1.2.3