From 8aadb6326f3ad54696a3f7af19c2f9f97462584c Mon Sep 17 00:00:00 2001 From: Jason Conti Date: Tue, 10 May 2011 14:03:04 -0400 Subject: Removed the interface from example, no longer needed, so removing it here too. --- src/Makefile.am | 24 ------- src/dbus-shared.h | 15 ++-- src/example-interface.c | 182 ------------------------------------------------ src/example-interface.h | 54 -------------- src/example-service.c | 5 -- src/example-service.xml | 10 --- 6 files changed, 5 insertions(+), 285 deletions(-) delete mode 100644 src/example-interface.c delete mode 100644 src/example-interface.h delete mode 100644 src/example-service.xml (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 816c9fd..c92cece 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,9 +2,6 @@ libexec_PROGRAMS = indicator-example-service indicator_example_service_SOURCES = \ - example-interface.c \ - example-interface.h \ - gen-example-service.xml.c \ example-service.c \ dbus-shared.h \ settings-shared.h @@ -18,7 +15,6 @@ indicator_example_service_LDADD = \ examplelibdir = $(INDICATORDIR) examplelib_LTLIBRARIES = libexample.la libexample_la_SOURCES = \ - gen-example-service.xml.h \ dbus-shared.h \ settings-shared.h \ indicator-example.c @@ -32,23 +28,3 @@ libexample_la_LDFLAGS = \ -module \ -avoid-version -gen-%.xml.c: %.xml - @echo "Building $@ from $<" - @echo "const char * _$(subst -,_,$(subst .,_,$(basename $<))) = " > $@ - @sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": $< >> $@ - @echo ";" >> $@ - -gen-%.xml.h: %.xml - @echo "Building $@ from $<" - @echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $<)));" > $@ - -BUILT_SOURCES = \ - gen-example-service.xml.c \ - gen-example-service.xml.h - - -CLEANFILES = \ - $(BUILT_SOURCES) - -EXTRA_DIST = \ - example-service.xml diff --git a/src/dbus-shared.h b/src/dbus-shared.h index 313ccf1..0b97483 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -1,10 +1,5 @@ /* -An example indicator. - -Copyright 2010 Canonical Ltd. - -Authors: - Ted Gould +An indicator to display recent notifications. 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 @@ -19,9 +14,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#define SERVICE_NAME "com.example.indicator.example" -#define SERVICE_IFACE "com.example.indicator.example.service" -#define SERVICE_OBJ "/com/example/indicator/example/service" +#define SERVICE_NAME "com.launchpad.recent-notifications.indicator" +#define SERVICE_IFACE "com.launchpad.recent-notifications.indicator.service" +#define SERVICE_OBJ "/com/launchpad/recent-notifications/indicator/service" #define SERVICE_VERSION 1 -#define MENU_OBJ "/com/example/indicator/example/menu" +#define MENU_OBJ "/com/launchpad/recent-notifications/indicator/menu" diff --git a/src/example-interface.c b/src/example-interface.c deleted file mode 100644 index 3f99538..0000000 --- a/src/example-interface.c +++ /dev/null @@ -1,182 +0,0 @@ -/* -An example indicator. - -Copyright 2010 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 . -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "example-interface.h" -#include "gen-example-service.xml.h" -#include "dbus-shared.h" - -/** -ExampleInterfacePrivate: -@dbus_registration: The handle for this object being registered -on dbus. - -Structure to define the memory for the private area -of the example interface instance. -*/ -struct _ExampleInterfacePrivate { - GDBusConnection *bus; - GCancellable *bus_cancel; - guint dbus_registration; -}; - -#define EXAMPLE_INTERFACE_GET_PRIVATE(o) (EXAMPLE_INTERFACE(o)->priv) - -/* GDBus Stuff */ -static GDBusNodeInfo *node_info = NULL; -static GDBusInterfaceInfo *interface_info = NULL; - -static void example_interface_class_init(ExampleInterfaceClass *klass); -static void example_interface_init(ExampleInterface *self); -static void example_interface_dispose(GObject *object); -static void example_interface_finalize(GObject *object); -static void bus_get_cb(GObject *object, GAsyncResult *res, gpointer user_data); - -G_DEFINE_TYPE (ExampleInterface, example_interface, G_TYPE_OBJECT); - -static void -example_interface_class_init(ExampleInterfaceClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private(klass, sizeof(ExampleInterfacePrivate)); - - object_class->dispose = example_interface_dispose; - object_class->finalize = example_interface_finalize; - - /* Setting up the DBus interfaces */ - if(node_info == NULL) { - GError * error = NULL; - - node_info = g_dbus_node_info_new_for_xml(_example_service, &error); - if(error != NULL) { - g_error("Unable to parse Example Service Interface description: %s", error->message); - g_error_free(error); - } - } - - if (interface_info == NULL) { - interface_info = g_dbus_node_info_lookup_interface(node_info, SERVICE_IFACE); - - if (interface_info == NULL) { - g_error("Unable to find interface '" SERVICE_IFACE "'"); - } - } - - return; -} - -static void -example_interface_init(ExampleInterface *self) -{ - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EXAMPLE_INTERFACE_TYPE, ExampleInterfacePrivate); - - self->priv->bus = NULL; - self->priv->bus_cancel = NULL; - self->priv->dbus_registration = 0; - - self->priv->bus_cancel = g_cancellable_new(); - g_bus_get(G_BUS_TYPE_SESSION, - self->priv->bus_cancel, - bus_get_cb, - self); - - return; -} - -static void -bus_get_cb(GObject *object, GAsyncResult *res, gpointer user_data) -{ - GError *error = NULL; - GDBusConnection *connection = g_bus_get_finish(res, &error); - - if(error != NULL) { - g_error("OMG! Unable to get a connection to DBus: %s", error->message); - g_error_free(error); - return; - } - - ExampleInterfacePrivate *priv = EXAMPLE_INTERFACE_GET_PRIVATE(user_data); - - g_warn_if_fail(priv->bus == NULL); - priv->bus = connection; - - if(priv->bus_cancel != NULL) { - g_object_unref(priv->bus_cancel); - priv->bus_cancel = NULL; - } - - /* Now register our object on our new connection */ - priv->dbus_registration = g_dbus_connection_register_object(priv->bus, - SERVICE_OBJ, - interface_info, - NULL, - user_data, - NULL, - &error); - - if(error != NULL) { - g_error("Unable to register the object to DBus: %s", error->message); - g_error_free(error); - return; - } - - return; -} - -static void -example_interface_dispose(GObject *object) -{ - ExampleInterfacePrivate * priv = EXAMPLE_INTERFACE_GET_PRIVATE(object); - - if(priv->dbus_registration != 0) { - g_dbus_connection_unregister_object(priv->bus, priv->dbus_registration); - /* Don't care if it fails, there's nothing we can do */ - priv->dbus_registration = 0; - } - - if(priv->bus != NULL) { - g_object_unref(priv->bus); - priv->bus = NULL; - } - - if(priv->bus_cancel != NULL) { - g_cancellable_cancel(priv->bus_cancel); - g_object_unref(priv->bus_cancel); - priv->bus_cancel = NULL; - } - - G_OBJECT_CLASS (example_interface_parent_class)->dispose (object); - return; -} - -static void -example_interface_finalize(GObject *object) -{ - G_OBJECT_CLASS (example_interface_parent_class)->finalize (object); - return; -} - diff --git a/src/example-interface.h b/src/example-interface.h deleted file mode 100644 index fc6860c..0000000 --- a/src/example-interface.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -An example indicator. - -Copyright 2010 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 . -*/ - -#ifndef __EXAMPLE_INTERFACE_H__ -#define __EXAMPLE_INTERFACE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define EXAMPLE_INTERFACE_TYPE (example_interface_get_type ()) -#define EXAMPLE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_INTERFACE_TYPE, ExampleInterface)) -#define EXAMPLE_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EXAMPLE_INTERFACE_TYPE, ExampleInterfaceClass)) -#define IS_EXAMPLE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXAMPLE_INTERFACE_TYPE)) -#define IS_EXAMPLE_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EXAMPLE_INTERFACE_TYPE)) -#define EXAMPLE_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EXAMPLE_INTERFACE_TYPE, ExampleInterfaceClass)) - -typedef struct _ExampleInterface ExampleInterface; -typedef struct _ExampleInterfacePrivate ExampleInterfacePrivate; -typedef struct _ExampleInterfaceClass ExampleInterfaceClass; - -struct _ExampleInterfaceClass { - GObjectClass parent_class; -}; - -struct _ExampleInterface { - GObject parent; - ExampleInterfacePrivate *priv; -}; - -GType example_interface_get_type(void); - -G_END_DECLS - -#endif diff --git a/src/example-service.c b/src/example-service.c index 8f87c74..1b197af 100644 --- a/src/example-service.c +++ b/src/example-service.c @@ -33,7 +33,6 @@ with this program. If not, see . #include #include -#include "example-interface.h" #include "dbus-shared.h" #include "settings-shared.h" @@ -41,7 +40,6 @@ static IndicatorService *service = NULL; static GMainLoop *mainloop = NULL; static DbusmenuServer *server = NULL; static DbusmenuMenuitem *root = NULL; -static ExampleInterface *dbus = NULL; /* Global Items */ static DbusmenuMenuitem *item_1 = NULL; @@ -116,9 +114,6 @@ main(int argc, char **argv) build_menus(root); - /* Setup dbus interface */ - dbus = g_object_new(EXAMPLE_INTERFACE_TYPE, NULL); - mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/src/example-service.xml b/src/example-service.xml deleted file mode 100644 index 6f19914..0000000 --- a/src/example-service.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - -- cgit v1.2.3