diff options
-rw-r--r-- | .bzrignore | 3 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | example/Makefile.am | 19 | ||||
-rw-r--r-- | example/simple-client.c | 34 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/custom-service-appstore.c | 2 | ||||
-rw-r--r-- | src/indicator-custom.c | 6 |
9 files changed, 73 insertions, 0 deletions
@@ -32,3 +32,6 @@ src/stamp-marshal src/dbus-properties-client.h src/dbus-properties-server.h tests/test-simple-app +example/.deps +example/.libs +example/simple-client diff --git a/Makefile.am b/Makefile.am index 4eb69d7..33f9f3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ SUBDIRS = data \ src \ + example \ tests DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall diff --git a/configure.ac b/configure.ac index 015677c..d76aec8 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,7 @@ Makefile src/Makefile data/Makefile tests/Makefile +example/Makefile ]) ########################### diff --git a/debian/changelog b/debian/changelog index 096037b..e00649b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +indicator-custom (0.0.1-0ubuntu3~ppa1~service4) karmic; urgency=low + + * Adding marshallers + + -- Ted Gould <ted@ubuntu.com> Mon, 23 Nov 2009 16:37:51 -0600 + indicator-custom (0.0.1-0ubuntu3~ppa1~service3) karmic; urgency=low * Adding more fun. Now we're cookin'! diff --git a/example/Makefile.am b/example/Makefile.am new file mode 100644 index 0000000..954b04e --- /dev/null +++ b/example/Makefile.am @@ -0,0 +1,19 @@ + +check_PROGRAMS = \ + simple-client + +######################################### +## simple-client +######################################### + +simple_client_SOURCES = \ + simple-client.c + +simple_client_CFLAGS = \ + $(INDICATOR_CFLAGS) \ + -Wall -Werror \ + -I$(top_srcdir)/src + +simple_client_LDADD = \ + $(INDICATOR_LIBS) \ + $(top_builddir)/src/libcustomindicator.la diff --git a/example/simple-client.c b/example/simple-client.c new file mode 100644 index 0000000..1c29647 --- /dev/null +++ b/example/simple-client.c @@ -0,0 +1,34 @@ + +#include "libcustomindicator/custom-indicator.h" +#include "libdbusmenu-glib/server.h" +#include "libdbusmenu-glib/menuitem.h" + +GMainLoop * mainloop = NULL; + +int +main (int argc, char ** argv) +{ + g_type_init(); + + CustomIndicator * ci = CUSTOM_INDICATOR(g_object_new(CUSTOM_INDICATOR_TYPE, NULL)); + g_assert(ci != NULL); + + custom_indicator_set_id(ci, "example-simple-client"); + custom_indicator_set_category(ci, CUSTOM_INDICATOR_CATEGORY_APPLICATION_STATUS); + custom_indicator_set_status(ci, CUSTOM_INDICATOR_STATUS_ACTIVE); + custom_indicator_set_icon(ci, "indicator-messages"); + custom_indicator_set_attention_icon(ci, "indicator-messages-new"); + + DbusmenuMenuitem * root = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(root, "label", "Root"); + + DbusmenuServer * menuservice = dbusmenu_server_new ("/need/a/menu/path"); + dbusmenu_server_set_root(menuservice, root); + + custom_indicator_set_menu(ci, menuservice); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + return 0; +} diff --git a/src/Makefile.am b/src/Makefile.am index 21d7cf8..102804e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,6 +13,7 @@ include $(top_srcdir)/Makefile.am.marshal customlibdir = $(INDICATORDIR) customlib_LTLIBRARIES = libcustom.la libcustom_la_SOURCES = \ + custom-service-marshal.c \ dbus-shared.h \ indicator-custom.c libcustom_la_CFLAGS = $(INDICATOR_CFLAGS) \ diff --git a/src/custom-service-appstore.c b/src/custom-service-appstore.c index 6cb2dd9..fdb227a 100644 --- a/src/custom-service-appstore.c +++ b/src/custom-service-appstore.c @@ -174,6 +174,8 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err void custom_service_appstore_application_add (CustomServiceAppstore * appstore, const gchar * dbus_name, const gchar * dbus_object) { + g_debug("Adding new application: %s:%s", dbus_name, dbus_object); + /* Make sure we got a sensible request */ g_return_if_fail(IS_CUSTOM_SERVICE_APPSTORE(appstore)); g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0'); diff --git a/src/indicator-custom.c b/src/indicator-custom.c index 3bd2aa9..53e2269 100644 --- a/src/indicator-custom.c +++ b/src/indicator-custom.c @@ -16,6 +16,7 @@ /* Local Stuff */ #include "dbus-shared.h" #include "custom-service-client.h" +#include "custom-service-marshal.h" #define INDICATOR_CUSTOM_TYPE (indicator_custom_get_type ()) #define INDICATOR_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_CUSTOM_TYPE, IndicatorCustom)) @@ -87,6 +88,10 @@ indicator_custom_class_init (IndicatorCustomClass *klass) io_class->get_entries = get_entries; + /* Register the marshallers for the dbus signals */ + dbus_g_object_register_marshaller(g_cclosure_marshal_VOID__INT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_custom_service_marshal_VOID__STRING_INT_STRING_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + return; } @@ -184,6 +189,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorCustom * c G_TYPE_INT, G_TYPE_NONE); + /* Connect to them */ dbus_g_proxy_connect_signal(priv->service_proxy, "ApplicationAdded", G_CALLBACK(application_added), |