diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/datetime-interface.h | 57 | ||||
-rw-r--r-- | src/example-interface.c (renamed from src/datetime-interface.c) | 58 | ||||
-rw-r--r-- | src/example-interface.h | 57 |
3 files changed, 86 insertions, 86 deletions
diff --git a/src/datetime-interface.h b/src/datetime-interface.h deleted file mode 100644 index ae85605..0000000 --- a/src/datetime-interface.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -An indicator to time and date related information in the menubar. - -Copyright 2010 Canonical Ltd. - -Authors: - Ted Gould <ted@canonical.com> - -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 <http://www.gnu.org/licenses/>. -*/ - -#ifndef __DATETIME_INTERFACE_H__ -#define __DATETIME_INTERFACE_H__ - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define DATETIME_INTERFACE_TYPE (datetime_interface_get_type ()) -#define DATETIME_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DATETIME_INTERFACE_TYPE, DatetimeInterface)) -#define DATETIME_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DATETIME_INTERFACE_TYPE, DatetimeInterfaceClass)) -#define IS_DATETIME_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DATETIME_INTERFACE_TYPE)) -#define IS_DATETIME_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DATETIME_INTERFACE_TYPE)) -#define DATETIME_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DATETIME_INTERFACE_TYPE, DatetimeInterfaceClass)) - -typedef struct _DatetimeInterface DatetimeInterface; -typedef struct _DatetimeInterfacePrivate DatetimeInterfacePrivate; -typedef struct _DatetimeInterfaceClass DatetimeInterfaceClass; - -struct _DatetimeInterfaceClass { - GObjectClass parent_class; - - void (*update_time) (void); -}; - -struct _DatetimeInterface { - GObject parent; - DatetimeInterfacePrivate * priv; -}; - -GType datetime_interface_get_type (void); -void datetime_interface_update (DatetimeInterface *self); - -G_END_DECLS - -#endif diff --git a/src/datetime-interface.c b/src/example-interface.c index 5939061..1ca729a 100644 --- a/src/datetime-interface.c +++ b/src/example-interface.c @@ -1,5 +1,5 @@ /* -An indicator to time and date related information in the menubar. +An example indicator. Copyright 2010 Canonical Ltd. @@ -25,55 +25,55 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gio/gio.h> -#include "datetime-interface.h" -#include "gen-datetime-service.xml.h" +#include "example-interface.h" +#include "gen-example-service.xml.h" #include "dbus-shared.h" /** - DatetimeInterfacePrivate: + ExampleInterfacePrivate: @dbus_registration: The handle for this object being registered on dbus. Structure to define the memory for the private area - of the datetime interface instance. + of the example interface instance. */ -struct _DatetimeInterfacePrivate { +struct _ExampleInterfacePrivate { GDBusConnection * bus; GCancellable * bus_cancel; guint dbus_registration; }; -#define DATETIME_INTERFACE_GET_PRIVATE(o) (DATETIME_INTERFACE(o)->priv) +#define EXAMPLE_INTERFACE_GET_PRIVATE(o) (EXAMPLE_INTERFACE(o)->priv) /* GDBus Stuff */ static GDBusNodeInfo * node_info = NULL; static GDBusInterfaceInfo * interface_info = NULL; -static void datetime_interface_class_init (DatetimeInterfaceClass *klass); -static void datetime_interface_init (DatetimeInterface *self); -static void datetime_interface_dispose (GObject *object); -static void datetime_interface_finalize (GObject *object); +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 (DatetimeInterface, datetime_interface, G_TYPE_OBJECT); +G_DEFINE_TYPE (ExampleInterface, example_interface, G_TYPE_OBJECT); static void -datetime_interface_class_init (DatetimeInterfaceClass *klass) +example_interface_class_init (ExampleInterfaceClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (DatetimeInterfacePrivate)); + g_type_class_add_private (klass, sizeof (ExampleInterfacePrivate)); - object_class->dispose = datetime_interface_dispose; - object_class->finalize = datetime_interface_finalize; + 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(_datetime_service, &error); + node_info = g_dbus_node_info_new_for_xml(_example_service, &error); if (error != NULL) { - g_error("Unable to parse Datetime Service Interface description: %s", error->message); + g_error("Unable to parse Example Service Interface description: %s", error->message); g_error_free(error); } } @@ -90,9 +90,9 @@ datetime_interface_class_init (DatetimeInterfaceClass *klass) } static void -datetime_interface_init (DatetimeInterface *self) +example_interface_init (ExampleInterface *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, DATETIME_INTERFACE_TYPE, DatetimeInterfacePrivate); + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EXAMPLE_INTERFACE_TYPE, ExampleInterfacePrivate); self->priv->bus = NULL; self->priv->bus_cancel = NULL; @@ -119,7 +119,7 @@ bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data) return; } - DatetimeInterfacePrivate * priv = DATETIME_INTERFACE_GET_PRIVATE(user_data); + ExampleInterfacePrivate * priv = EXAMPLE_INTERFACE_GET_PRIVATE(user_data); g_warn_if_fail(priv->bus == NULL); priv->bus = connection; @@ -148,9 +148,9 @@ bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data) } static void -datetime_interface_dispose (GObject *object) +example_interface_dispose (GObject *object) { - DatetimeInterfacePrivate * priv = DATETIME_INTERFACE_GET_PRIVATE(object); + ExampleInterfacePrivate * priv = EXAMPLE_INTERFACE_GET_PRIVATE(object); if (priv->dbus_registration != 0) { g_dbus_connection_unregister_object(priv->bus, priv->dbus_registration); @@ -169,24 +169,24 @@ datetime_interface_dispose (GObject *object) priv->bus_cancel = NULL; } - G_OBJECT_CLASS (datetime_interface_parent_class)->dispose (object); + G_OBJECT_CLASS (example_interface_parent_class)->dispose (object); return; } static void -datetime_interface_finalize (GObject *object) +example_interface_finalize (GObject *object) { - G_OBJECT_CLASS (datetime_interface_parent_class)->finalize (object); + G_OBJECT_CLASS (example_interface_parent_class)->finalize (object); return; } void -datetime_interface_update (DatetimeInterface *self) +example_interface_update (ExampleInterface *self) { - g_return_if_fail(IS_DATETIME_INTERFACE(self)); + g_return_if_fail(IS_EXAMPLE_INTERFACE(self)); - DatetimeInterfacePrivate * priv = DATETIME_INTERFACE_GET_PRIVATE(self); + ExampleInterfacePrivate * priv = EXAMPLE_INTERFACE_GET_PRIVATE(self); GError * error = NULL; g_dbus_connection_emit_signal (priv->bus, diff --git a/src/example-interface.h b/src/example-interface.h new file mode 100644 index 0000000..3c18c48 --- /dev/null +++ b/src/example-interface.h @@ -0,0 +1,57 @@ +/* +An example indicator. + +Copyright 2010 Canonical Ltd. + +Authors: + Ted Gould <ted@canonical.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef __EXAMPLE_INTERFACE_H__ +#define __EXAMPLE_INTERFACE_H__ + +#include <glib.h> +#include <glib-object.h> + +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; + + void (*update_time) (void); +}; + +struct _ExampleInterface { + GObject parent; + ExampleInterfacePrivate * priv; +}; + +GType example_interface_get_type (void); +void example_interface_update (ExampleInterface *self); + +G_END_DECLS + +#endif |