grim/guifications3

Parents 61b6b132ace3
Children c41852d742dc
the way the eggdbus-binding-tool names generated files, it creates a mess in our source directory. Since I can't tell it to use underscores in the generated file names, i have removed the underscores from non-generated source files
--- a/gflib-eggdbus/gflib-eggdbus/Makefile.am Mon Sep 21 19:01:03 2009 -0500
+++ b/gflib-eggdbus/gflib-eggdbus/Makefile.am Sun Sep 27 16:05:45 2009 -0500
@@ -28,10 +28,10 @@
EXTRA_DIST = \
$(INTROSPECTION_XML) \
- gf_eggdbus_errors.h \
- gf_eggdbus_server_connection.h \
- gf_eggdbus_server_feed.h \
- gf_eggdbus_server_feed_manager.h
+ gfeggdbuserrors.h \
+ gfeggdbusserverconnection.h \
+ gfeggdbusserverfeed.h \
+ gfeggdbusserverfeedmanager.h
CLEANFILES = \
$(BUILDHEADERS) \
@@ -44,11 +44,11 @@
gflib_eggdbus_la_SOURCES = \
$(BUILTSOURCES) \
- gf_eggdbus_core.c \
- gf_eggdbus_errors.c \
- gf_eggdbus_server_feed.c \
- gf_eggdbus_server_connection.c \
- gf_eggdbus_server_feed_manager.c
+ gfeggdbuscore.c \
+ gfeggdbuserrors.c \
+ gfeggdbusserverfeed.c \
+ gfeggdbusserverconnection.c \
+ gfeggdbusserverfeedmanager.c
gflib_eggdbus_la_LDFLAGS = -avoid-version -module
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_core.c Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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/>.
- */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <eggdbus/eggdbus.h>
-
-#include <gflib/gf_lib.h>
-
-#include "gf_eggdbus_server_connection.h"
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-static gboolean initialized = FALSE;
-
-/******************************************************************************
- * Plugin Stuff
- *****************************************************************************/
-G_MODULE_EXPORT gboolean
-gf_native_plugin_load(GfNativePlugin *plugin) {
- GModule *gmodule = NULL;
-
- if(initialized)
- return TRUE;
-
- gmodule = gf_native_plugin_get_module(plugin);
-
- g_module_make_resident(gmodule);
-
- gf_eggdbus_server_connection_register(plugin);
-
- initialized = TRUE;
-
- return TRUE;
-}
-
-G_MODULE_EXPORT gboolean
-gf_native_plugin_unload(GfNativePlugin *plugin) {
- return FALSE;
-}
-
-static GfPluginInfo info = {
- GF_NATIVE_PLUGIN_ABI_VERSION,
- PACKAGE_NAME,
- PACKAGE_VERSION,
- "D-Bus connectivity for gflib using eggdbus",
- "This plugin provides D-Bus client and server connection implementations for gflib",
- "Gary Kramlich <grim@reaperworld.com>",
- "http://www.guifications.org/"
-};
-
-G_MODULE_EXPORT GfPluginInfo *
-gf_native_plugin_query(GfPlugin *plugin) {
- return &info;
-}
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_errors.c Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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/>.
- */
-#include <gflib-eggdbus/gf_eggdbus_errors.h>
-
-GQuark
-gf_eggdbus_errors_quark(void) {
- static GQuark quark = 0;
-
- if(G_UNLIKELY(quark == 0))
- quark = g_quark_from_static_string("gflib-eggdbus-errors");
-
- return quark;
-}
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_errors.h Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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 GF_EGGDBUS_ERRORS_H
-#define GF_EGGDBUS_ERRORS_H
-
-#include <glib.h>
-
-typedef enum {
- RequestNameFailed,
- NoFeedsRegistered,
-} GfEggDBusErrors;
-
-#define GF_EGGDBUS_ERRORS (gf_eggdbus_errors_quark())
-
-G_BEGIN_DECLS
-
-GQuark gf_eggdbus_errors_quark(void);
-
-G_END_DECLS
-
-#endif /* GF_EGGDBUS_ERRORS_H */
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_server_connection.c Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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/>.
- */
-#include <gflib-eggdbus/gf_eggdbus_server_connection.h>
-
-#include <gflib-eggdbus/gf_eggdbus_server_feed.h>
-#include <gflib-eggdbus/gf_eggdbus_server_feed_manager.h>
-#include <gflib-eggdbus/gf_eggdbus_errors.h>
-
-#include <gflib-eggdbus/gfeggdbusfeedmanager.h>
-
-#define GF_EGGDBUS_SERVER_CONNECTION_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnectionPrivate))
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-typedef struct {
- EggDBusConnection *connection;
- GfFeedManager *feed_manager_proxy;
-} GfEggDBusServerConnectionPrivate;
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-static GfServerConnectionClass *parent_class = NULL;
-static GType type = 0;
-
-/******************************************************************************
- * GfServerConnection Methods
- *****************************************************************************/
-static gboolean
-gf_eggdbus_server_connection_listen(GfServerConnection *server_connection,
- GError **error)
-{
- GfConnection *connection = GF_CONNECTION(server_connection);
- GfFeedManager *feed_manager = NULL;
- GfEggDBusServerConnectionPrivate *priv = NULL;
- EggDBusBus *bus = NULL;
- EggDBusRequestNameReply request_name_reply;
-
- gf_connection_set_state(connection, GF_CONNECTION_STATE_CONNECTING);
-
- priv = GF_EGGDBUS_SERVER_CONNECTION_GET_PRIVATE(server_connection);
-
- priv->connection =
- egg_dbus_connection_get_for_bus(EGG_DBUS_BUS_TYPE_SESSION);
-
- bus = egg_dbus_connection_get_bus(priv->connection);
-
- if(!egg_dbus_bus_request_name_sync(bus, 0, "org.guifications",
- EGG_DBUS_REQUEST_NAME_FLAGS_NONE,
- &request_name_reply, NULL, error))
- {
- g_object_unref(priv->connection);
-
- gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTED);
-
- return FALSE;
- }
-
- if(request_name_reply != EGG_DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- if(error) {
- *error = g_error_new(GF_EGGDBUS_ERRORS, RequestNameFailed,
- "Failed to become the primary name owner.");
- }
-
- g_object_unref(priv->connection);
-
- gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTED);
-
- return FALSE;
- }
-
- /* register the feed manager object */
- feed_manager = gf_connection_get_feed_manager(connection);
- if(GF_IS_FEED_MANAGER(feed_manager)) {
- priv->feed_manager_proxy = gf_eggdbus_server_feed_manager_new(feed_manager);
-
- egg_dbus_connection_register_interface(priv->connection,
- GF_EGGDBUS_PATH "feeds/manager",
- GF_EGG_DBUS_TYPE_FEED_MANAGER,
- priv->feed_manager_proxy,
- G_TYPE_INVALID);
- }
-
- gf_connection_set_state(connection, GF_CONNECTION_STATE_CONNECTED);
-
- return TRUE;
-}
-
-/******************************************************************************
- * GfConnection Methods
- *****************************************************************************/
-static gboolean
-gf_eggdbus_server_connection_disconnect(GfConnection *connection,
- GError **error)
-{
- GfEggDBusServerConnectionPrivate *priv = NULL;
-
- gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTING);
-
- priv = GF_EGGDBUS_SERVER_CONNECTION_GET_PRIVATE(connection);
-
- /* do the unregistering stuff here... */
- g_object_unref(priv->connection);
- priv->connection = NULL;
-
- gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTED);
-
- return TRUE;
-}
-
-/******************************************************************************
- * Object Stuff
- *****************************************************************************/
-static void
-gf_eggdbus_server_connection_finalize(GObject *obj) {
- GfConnection *connection = GF_CONNECTION(obj);
-
- if(gf_connection_is_connected(connection))
- gf_connection_disconnect(connection, NULL);
-
- G_OBJECT_CLASS(parent_class)->finalize(obj);
-}
-
-static void
-gf_eggdbus_server_connection_class_init(GfEggDBusServerConnectionClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- GfNamedObjectClass *gfno_class = GF_NAMED_OBJECT_CLASS(klass);
- GfConnectionClass *conn_class = GF_CONNECTION_CLASS(klass);
- GfServerConnectionClass *server_class = GF_SERVER_CONNECTION_CLASS(klass);
-
- parent_class = g_type_class_peek_parent(klass);
-
- g_type_class_add_private(klass, sizeof(GfEggDBusServerConnectionPrivate));
-
- obj_class->finalize = gf_eggdbus_server_connection_finalize;
-
- gfno_class->name = "EggDBus";
-
- server_class->listen = gf_eggdbus_server_connection_listen;
-
- conn_class->disconnect = gf_eggdbus_server_connection_disconnect;
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-void
-gf_eggdbus_server_connection_register(GfNativePlugin *plugin) {
- if(type == 0) {
- static const GTypeInfo info = {
- sizeof(GfEggDBusServerConnectionClass),
- NULL,
- NULL,
- (GClassInitFunc)gf_eggdbus_server_connection_class_init,
- NULL,
- NULL,
- sizeof(GfEggDBusServerConnection),
- 0,
- NULL,
- };
-
- type = gf_native_plugin_register_type(plugin,
- GF_TYPE_SERVER_CONNECTION,
- "GfEggDBusServerConnection",
- &info,
- 0);
-
- gf_eggdbus_server_feed_manager_register(plugin);
- gf_eggdbus_server_feed_register(plugin);
- }
-
-}
-
-GType
-gf_eggdbus_server_connection_get_type(void) {
- if(G_UNLIKELY(type == 0)) {
- gf_log_warning("GfEggDBusServerConnection",
- "gf_eggdbus_server_connection called before the type "
- "was registered!\n");
- }
-
- return type;
-}
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_server_connection.h Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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 GF_EGGDBUS_SERVER_CONNECTION_H
-#define GF_EGGDBUS_SERVER_CONNECTION_H
-
-#define GF_TYPE_EGGDBUS_SERVER_CONNECTION (gf_eggdbus_server_connection_get_type())
-#define GF_EGGDBUS_SERVER_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnection))
-#define GF_EGGDBUS_SERVER_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klas), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnectionClass))
-#define GF_IS_EGGDBUS_SERVER_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION))
-#define GF_IS_EGGDBUS_SERVER_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION))
-#define GF_EGGDBUS_SERVER_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnectionClass))
-
-typedef struct _GfEggDBusServerConnection GfEggDBusServerConnection;
-typedef struct _GfEggDBusServerConnectionClass GfEggDBusServerConnectionClass;
-
-#include <glib.h>
-
-#include <eggdbus/eggdbus.h>
-
-#include <gflib/gf_lib.h>
-
-struct _GfEggDBusServerConnection {
- GfServerConnection parent;
-
- void (*_gf_reserved1)(void);
- void (*_gf_reserved2)(void);
- void (*_gf_reserved3)(void);
- void (*_gf_reserved4)(void);
-};
-
-struct _GfEggDBusServerConnectionClass {
- GfServerConnectionClass parent;
-
- void (*_gf_reserved1)(void);
- void (*_gf_reserved2)(void);
- void (*_gf_reserved3)(void);
- void (*_gf_reserved4)(void);
-};
-
-G_BEGIN_DECLS
-
-void gf_eggdbus_server_connection_register(GfNativePlugin *plugin);
-GType gf_eggdbus_server_connection_get_type(void);
-
-G_END_DECLS
-
-#endif /* GF_EGGDBUS_SERVER_CONNECTION_H */
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_server_feed.c Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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/>.
- */
-#include <gflib-eggdbus/gf_eggdbus_server_feed.h>
-
-#include "gfeggdbusfeed.h"
-
-#define GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeedPrivate))
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-enum {
- PROP_ZERO,
- PROP_FEED,
- PROP_LAST,
-};
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-typedef struct {
- GfFeed *feed;
-} GfEggDBusServerFeedPrivate;
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-static GObjectClass *parent_class = NULL;
-static GType type = 0;
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_set_real_feed(GfEggDBusServerFeed *server_feed,
- GfFeed *feed)
-{
- GfEggDBusServerFeedPrivate *priv = NULL;
-
- priv = GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(server_feed);
-
- if(GF_IS_FEED(priv->feed))
- g_object_unref(priv->feed);
-
- priv->feed = GF_IS_FEED(feed) ? g_object_ref(feed) : NULL;
-}
-
-/******************************************************************************
- * Feed Stuff
- *****************************************************************************/
-static gchar *
-gf_eggdbus_server_feed_get_name(const GfFeed *feed) {
- GfEggDBusServerFeedPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
-
- return gf_feed_get_name(priv->feed);
-}
-
-static GfImage *
-gf_eggdbus_server_feed_get_image(const GfFeed *feed) {
- GfEggDBusServerFeedPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
-
- return gf_feed_get_image(priv->feed);
-}
-
-static gchar *
-gf_eggdbus_server_feed_get_i18n(const GfFeed *feed) {
- GfEggDBusServerFeedPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
-
- return gf_feed_get_i18n(priv->feed);
-}
-
-static gchar *
-gf_eggdbus_server_feed_get_description(const GfFeed *feed) {
- GfEggDBusServerFeedPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
-
- return gf_feed_get_description(priv->feed);
-}
-
-/******************************************************************************
- * Interface stuff
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_interface_init(GfEggDBusFeedIface *iface) {
-}
-
-/******************************************************************************
- * Object stuff
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_get_property(GObject *obj, guint param_id,
- GValue *value, GParamSpec *pspec)
-{
- GfEggDBusServerFeed *feed = GF_EGGDBUS_SERVER_FEED(obj);
-
- switch(param_id) {
- case PROP_FEED:
- g_value_set_object(value,
- gf_eggdbus_server_feed_get_real_feed(feed));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-gf_eggdbus_server_feed_set_property(GObject *obj, guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GfEggDBusServerFeed *feed = GF_EGGDBUS_SERVER_FEED(obj);
-
- switch(param_id) {
- case PROP_FEED:
- gf_eggdbus_server_feed_set_real_feed(feed,
- g_value_get_object(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-static void
-gf_eggdbus_server_feed_finalize(GObject *obj) {
- GfEggDBusServerFeedPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(obj);
-
- if(GF_IS_FEED(priv->feed))
- g_object_unref(priv->feed);
-
- G_OBJECT_CLASS(parent_class)->finalize(obj);
-}
-
-static void
-gf_eggdbus_server_feed_class_init(GfEggDBusServerFeedClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- GfFeedClass *feed_class = GF_FEED_CLASS(klass);
- GParamSpec *pspec = NULL;
-
- parent_class = g_type_class_peek_parent(klass);
-
- g_type_class_add_private(klass, sizeof(GfEggDBusServerFeedPrivate));
-
- obj_class->finalize = gf_eggdbus_server_feed_finalize;
- obj_class->get_property = gf_eggdbus_server_feed_get_property;
- obj_class->set_property = gf_eggdbus_server_feed_set_property;
-
- feed_class->get_name = gf_eggdbus_server_feed_get_name;
- feed_class->get_image = gf_eggdbus_server_feed_get_image;
- feed_class->get_i18n = gf_eggdbus_server_feed_get_i18n;
- feed_class->get_description = gf_eggdbus_server_feed_get_description;
-
- pspec = g_param_spec_object("feed", "feed", "The feed we're wrapping",
- GF_TYPE_FEED,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property(obj_class, PROP_FEED, pspec);
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-void
-gf_eggdbus_server_feed_register(GfNativePlugin *plugin) {
- if(G_UNLIKELY(type == 0)) {
- static const GTypeInfo info = {
- sizeof(GfEggDBusServerFeedClass),
- NULL,
- NULL,
- (GClassInitFunc)gf_eggdbus_server_feed_class_init,
- NULL,
- NULL,
- sizeof(GfEggDBusServerFeed),
- 0,
- NULL,
- };
-
- static const GInterfaceInfo iface_info = {
- (GInterfaceInitFunc)gf_eggdbus_server_feed_interface_init,
- NULL,
- NULL,
- };
-
- type = gf_native_plugin_register_type(plugin,
- GF_TYPE_FEED,
- "GfEggDBusServerFeed",
- &info,
- 0);
-
- gf_native_plugin_add_interface(plugin,
- type,
- GF_EGG_DBUS_TYPE_FEED,
- &iface_info);
- }
-}
-
-GType
-gf_eggdbus_server_feed_get_type(void) {
- if(G_UNLIKELY(type == 0)) {
- gf_log_warning("GfEggDBusServerFeed",
- "gf_eggdbus_server_feed called before the type was "
- "registered!\n");
- }
-
- return type;
-}
-
-GfFeed *
-gf_eggdbus_server_feed_new(GfFeed *feed) {
- g_return_val_if_fail(GF_IS_FEED(feed), NULL);
-
- return g_object_new(GF_TYPE_EGGDBUS_SERVER_FEED,
- "feed", feed,
- NULL);
-}
-
-GfFeed *
-gf_eggdbus_server_feed_get_real_feed(GfEggDBusServerFeed *feed) {
- GfEggDBusServerFeedPrivate *priv = NULL;
-
- g_return_val_if_fail(GF_IS_EGGDBUS_SERVER_FEED(feed), NULL);
-
- priv = GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
-
- return priv->feed;
-}
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_server_feed.h Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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 GF_EGGDBUS_SERVER_FEED_H
-#define GF_EGGDBUS_SERVER_FEED_H
-
-#define GF_TYPE_EGGDBUS_SERVER_FEED (gf_eggdbus_server_feed_get_type())
-#define GF_EGGDBUS_SERVER_FEED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeed))
-#define GF_EGGDBUS_SERVER_FEED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeedClass))
-#define GF_IS_EGGDBUS_SERVER_FEED(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED))
-#define GF_IS_EGGDBUS_SERVER_FEED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED))
-#define GF_EGGDBUS_SERVER_FEED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeedClass))
-
-typedef struct _GfEggDBusServerFeed GfEggDBusServerFeed;
-typedef struct _GfEggDBusServerFeedClass GfEggDBusServerFeedClass;
-
-#include <glib.h>
-
-#include <eggdbus/eggdbus.h>
-
-#include <gflib/gf_lib.h>
-
-struct _GfEggDBusServerFeed {
- GfFeed parent;
-
- void (*_gf_reserved1)(void);
- void (*_gf_reserved2)(void);
- void (*_gf_reserved3)(void);
- void (*_gf_reserved4)(void);
-};
-
-struct _GfEggDBusServerFeedClass {
- GfFeedClass parent;
-
- void (*_gf_reserved1)(void);
- void (*_gf_reserved2)(void);
- void (*_gf_reserved3)(void);
- void (*_gf_reserved4)(void);
-};
-
-G_BEGIN_DECLS
-
-void gf_eggdbus_server_feed_register(GfNativePlugin *plugin);
-GType gf_eggdbus_server_feed_get_type(void);
-
-GfFeed *gf_eggdbus_server_feed_new(GfFeed *feed);
-
-GfFeed *gf_eggdbus_server_feed_get_real_feed(GfEggDBusServerFeed *feed);
-
-G_END_DECLS
-
-#endif /* GF_EGGDBUS_SERVER_FEED_H */
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_server_feed_manager.c Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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/>.
- */
-#include <gflib-eggdbus/gf_eggdbus_server_feed_manager.h>
-
-#include <gflib-eggdbus/gf_eggdbus_server_connection.h>
-#include <gflib-eggdbus/gf_eggdbus_server_feed.h>
-#include <gflib-eggdbus/gf_eggdbus_errors.h>
-
-#include "gfeggdbusfeedmanager.h"
-
-#define GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManagerPrivate))
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-enum {
- PROP_ZERO = 0,
- PROP_CONNECTION,
- PROP_FEED_MANAGER,
- PROP_LAST,
-};
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-typedef struct {
- GfEggDBusServerConnection *connection;
- GfFeedManager *feed_manager;
-} GfEggDBusServerFeedManagerPrivate;
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-static GfFeedManagerClass *parent_class = NULL;
-static GType type = 0;
-
-/******************************************************************************
- * Callbacks
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_manager_feed_register_cb(GfFeedManager *feed_manager,
- GfFeed *feed,
- gpointer data)
-{
- gchar *path = g_strdup_printf("%sFeeds/%s",
- GF_EGGDBUS_PATH, gf_feed_get_name(feed));
-}
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_manager_set_connection(GfEggDBusServerFeedManager *manager,
- GfEggDBusServerConnection *conn)
-{
- GfEggDBusServerFeedManagerPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(manager);
-
- if(priv->connection)
- g_object_unref(priv->connection);
-
-
- priv->connection =
- GF_IS_EGGDBUS_SERVER_CONNECTION(conn) ? g_object_ref(conn) : NULL;
-}
-
-static void
-gf_eggdbus_server_feed_manager_set_real_feed_manager(GfEggDBusServerFeedManager *manager,
- GfFeedManager *real)
-{
- GfEggDBusServerFeedManagerPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(manager);
-
- if(GF_IS_FEED_MANAGER(priv->feed_manager))
- g_object_unref(priv->feed_manager);
-
- if(GF_IS_FEED_MANAGER(real)) {
- priv->feed_manager = g_object_ref(real);
-
- g_signal_connect(real, "registered-feed",
- G_CALLBACK(gf_eggdbus_server_feed_manager_feed_register_cb),
- NULL);
- } else {
- priv->feed_manager = NULL;
- }
-}
-
-/******************************************************************************
- * FeedManager Stuff
- *****************************************************************************/
-static GfFeed *
-gf_eggdbus_server_feed_manager_register_feed(GfFeedManager *manager, GfFeed *feed) {
- GfEggDBusServerFeedManagerPrivate *priv = NULL;
- GfFeed *server_feed = NULL;
-
- server_feed = gf_eggdbus_server_feed_new(feed);
-
- priv = GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(manager);
-
- gf_feed_manager_register_feed(priv->feed_manager, server_feed);
-
- return server_feed;
-}
-
-/******************************************************************************
- * DBus Interface stuff
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_manager_handle_register(GfEggDBusFeedManager *manager,
- const gchar *name,
- EggDBusArraySeq *image_data,
- const gchar *i18n,
- const gchar *description,
- EggDBusMethodInvocation *method)
-{
- GfFeed *feed = NULL, *server_feed = NULL;
- GfImage *image = NULL;
-
- if(image_data) {
- guint image_data_sz = 0;
- }
-
- /* we create a simple feed for us to wrap */
- feed = gf_feed_new(name, image, i18n, description);
-
- /* clean up the image if we created one */
- if(GF_IS_IMAGE(image))
- g_object_unref(image);
-
- /* now create the server feed */
- server_feed = gf_feed_manager_register_feed(GF_FEED_MANAGER(manager), feed);
-
- /* remove our ref to the feed since the server feed is holding what should
- * be the only ref.
- */
- g_object_unref(feed);
-
- if(!GF_IS_FEED(server_feed)) {
- gf_log_warning("GfEggDBusServerFeedManager",
- "Failed to register feed '%s'\n",
- name);
-
- egg_dbus_method_invocation_return_error(method, GF_EGGDBUS_ERRORS, 100,
- "Failed to create the server feed");
- } else {
- gchar *path = g_strdup_printf("%sFeeds/%s", GF_EGGDBUS_PATH, name);
-
- gf_egg_dbus_feed_manager_handle_register_finish(method, path);
-
- g_free(path);
- }
-}
-
-static void
-gf_eggdbus_server_feed_manager_interface_init(GfEggDBusFeedManagerIface *iface) {
- iface->handle_register = gf_eggdbus_server_feed_manager_handle_register;
-}
-
-/******************************************************************************
- * Object Stuff
- *****************************************************************************/
-static void
-gf_eggdbus_server_feed_manager_get_property(GObject *obj, guint param_id,
- GValue *value, GParamSpec *pspec)
-{
- GfEggDBusServerFeedManager *feed_manager = GF_EGGDBUS_SERVER_FEED_MANAGER(obj);
-
- switch(param_id) {
- case PROP_FEED_MANAGER:
- g_value_set_object(value,
- gf_eggdbus_server_feed_manager_get_real_feed_manager(feed_manager));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-gf_eggdbus_server_feed_manager_set_property(GObject *obj, guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GfEggDBusServerFeedManager *feed_manager = GF_EGGDBUS_SERVER_FEED_MANAGER(obj);
-
- switch(param_id) {
- case PROP_FEED_MANAGER:
- gf_eggdbus_server_feed_manager_set_real_feed_manager(feed_manager,
- g_value_get_object(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-gf_eggdbus_server_feed_manager_finalize(GObject *obj) {
- GfEggDBusServerFeedManagerPrivate *priv =
- GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(obj);
-
- g_object_unref(priv->feed_manager);
-
- G_OBJECT_CLASS(parent_class)->finalize(obj);
-}
-
-static void
-gf_eggdbus_server_feed_manager_class_init(GfEggDBusServerFeedManagerClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- GParamSpec *pspec = NULL;
- GfFeedManagerClass *manager_class = GF_FEED_MANAGER_CLASS(klass);
-
- parent_class = g_type_class_peek_parent(klass);
-
- g_type_class_add_private(klass, sizeof(GfEggDBusServerFeedManagerPrivate));
-
- obj_class->finalize = gf_eggdbus_server_feed_manager_finalize;
- obj_class->get_property = gf_eggdbus_server_feed_manager_get_property;
- obj_class->set_property = gf_eggdbus_server_feed_manager_set_property;
-
- manager_class->register_feed = gf_eggdbus_server_feed_manager_register_feed;
-
- pspec = g_param_spec_object("feed-manager", "feed-manager",
- "The concrete GfFeedManager that is wrapped.",
- GF_TYPE_FEED_MANAGER,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property(obj_class, PROP_FEED_MANAGER, pspec);
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-void
-gf_eggdbus_server_feed_manager_register(GfNativePlugin *plugin) {
- if(G_UNLIKELY(type == 0)) {
- static const GTypeInfo info = {
- sizeof(GfEggDBusServerFeedManagerClass),
- NULL,
- NULL,
- (GClassInitFunc)gf_eggdbus_server_feed_manager_class_init,
- NULL,
- NULL,
- sizeof(GfEggDBusServerFeedManager),
- 0,
- NULL,
- };
-
- static const GInterfaceInfo manager_info = {
- (GInterfaceInitFunc)gf_eggdbus_server_feed_manager_interface_init,
- NULL,
- NULL,
- };
-
- type = gf_native_plugin_register_type(plugin,
- GF_TYPE_FEED_MANAGER,
- "GfEggDBusServerFeedManager",
- &info,
- 0);
-
- gf_native_plugin_add_interface(plugin, type,
- GF_EGG_DBUS_TYPE_FEED_MANAGER, &manager_info);
- }
-}
-
-GType
-gf_eggdbus_server_feed_manager_get_type(void) {
- if(G_UNLIKELY(type == 0)) {
- gf_log_warning("GfEggDBusServerFeedManager",
- "gf_eggdbus_server_feed_manager called before the type "
- "was registered!\n");
- }
-
- return type;
-}
-
-GfFeedManager *
-gf_eggdbus_server_feed_manager_new(GfFeedManager *feed_manager) {
- g_return_val_if_fail(GF_IS_FEED_MANAGER(feed_manager), NULL);
-
- return g_object_new(GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER,
- "feed-manager", feed_manager,
- NULL);
-}
-
-GfFeedManager *
-gf_eggdbus_server_feed_manager_get_real_feed_manager(const GfEggDBusServerFeedManager *feed_manager) {
- GfEggDBusServerFeedManagerPrivate *priv = NULL;
-
- g_return_val_if_fail(GF_IS_EGGDBUS_SERVER_FEED_MANAGER(feed_manager), NULL);
-
- priv = GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(feed_manager);
-
- return priv->feed_manager;
-}
-
--- a/gflib-eggdbus/gflib-eggdbus/gf_eggdbus_server_feed_manager.h Mon Sep 21 19:01:03 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY 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 GF_EGGDBUS_SERVER_FEED_MANAGER_H
-#define GF_EGGDBUS_SERVER_FEED_MANAGER_H
-
-#define GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER (gf_eggdbus_server_feed_manager_get_type())
-#define GF_EGGDBUS_SERVER_FEED_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManager))
-#define GF_EGGDBUS_SERVER_FEED_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManagerClass))
-#define GF_IS_EGGDBUS_SERVER_FEED_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER))
-#define GF_IS_EGGDBUS_SERVER_FEED_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER))
-#define GF_EGGDBUS_SERVER_FEED_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManagerClass))
-
-typedef struct _GfEggDBusServerFeedManager GfEggDBusServerFeedManager;
-typedef struct _GfEggDBusServerFeedManagerClass GfEggDBusServerFeedManagerClass;
-
-#include <glib.h>
-
-#include <eggdbus/eggdbus.h>
-
-#include <gflib/gf_lib.h>
-
-struct _GfEggDBusServerFeedManager {
- GfFeedManager parent;
-
- void (*_gf_reserved1)(void);
- void (*_gf_reserved2)(void);
- void (*_gf_reserved3)(void);
- void (*_gf_reserved4)(void);
-};
-
-struct _GfEggDBusServerFeedManagerClass {
- GfFeedManagerClass parent;
-
- void (*_gf_reserved1)(void);
- void (*_gf_reserved2)(void);
- void (*_gf_reserved3)(void);
- void (*_gf_reserved4)(void);
-};
-
-G_BEGIN_DECLS
-
-void gf_eggdbus_server_feed_manager_register(GfNativePlugin *plugin);
-GType gf_eggdbus_server_feed_manager_get_type(void);
-
-GfFeedManager *gf_eggdbus_server_feed_manager_new(GfFeedManager *feed_manager);
-GfFeedManager *gf_eggdbus_server_feed_manager_get_real_feed_manager(const GfEggDBusServerFeedManager *feed_manager);
-
-G_END_DECLS
-
-#endif /* GF_EGGDBUS_SERVER_FEED_MANAGER_H */
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbuscore.c Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,73 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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/>.
+ */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <eggdbus/eggdbus.h>
+
+#include <gflib/gf_lib.h>
+
+#include "gfeggdbusserverconnection.h"
+
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+static gboolean initialized = FALSE;
+
+/******************************************************************************
+ * Plugin Stuff
+ *****************************************************************************/
+G_MODULE_EXPORT gboolean
+gf_native_plugin_load(GfNativePlugin *plugin) {
+ GModule *gmodule = NULL;
+
+ if(initialized)
+ return TRUE;
+
+ gmodule = gf_native_plugin_get_module(plugin);
+
+ g_module_make_resident(gmodule);
+
+ gf_eggdbus_server_connection_register(plugin);
+
+ initialized = TRUE;
+
+ return TRUE;
+}
+
+G_MODULE_EXPORT gboolean
+gf_native_plugin_unload(GfNativePlugin *plugin) {
+ return FALSE;
+}
+
+static GfPluginInfo info = {
+ GF_NATIVE_PLUGIN_ABI_VERSION,
+ PACKAGE_NAME,
+ PACKAGE_VERSION,
+ "D-Bus connectivity for gflib using eggdbus",
+ "This plugin provides D-Bus client and server connection implementations for gflib",
+ "Gary Kramlich <grim@reaperworld.com>",
+ "http://www.guifications.org/"
+};
+
+G_MODULE_EXPORT GfPluginInfo *
+gf_native_plugin_query(GfPlugin *plugin) {
+ return &info;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbuserrors.c Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,29 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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/>.
+ */
+#include <gflib-eggdbus/gfeggdbuserrors.h>
+
+GQuark
+gf_eggdbus_errors_quark(void) {
+ static GQuark quark = 0;
+
+ if(G_UNLIKELY(quark == 0))
+ quark = g_quark_from_static_string("gflib-eggdbus-errors");
+
+ return quark;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbuserrors.h Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,37 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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 GF_EGGDBUS_ERRORS_H
+#define GF_EGGDBUS_ERRORS_H
+
+#include <glib.h>
+
+typedef enum {
+ RequestNameFailed,
+ NoFeedsRegistered,
+} GfEggDBusErrors;
+
+#define GF_EGGDBUS_ERRORS (gf_eggdbus_errors_quark())
+
+G_BEGIN_DECLS
+
+GQuark gf_eggdbus_errors_quark(void);
+
+G_END_DECLS
+
+#endif /* GF_EGGDBUS_ERRORS_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbusserverconnection.c Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,202 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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/>.
+ */
+#include <gflib-eggdbus/gfeggdbusserverconnection.h>
+
+#include <gflib-eggdbus/gfeggdbusserverfeed.h>
+#include <gflib-eggdbus/gfeggdbusserverfeedmanager.h>
+#include <gflib-eggdbus/gfeggdbuserrors.h>
+
+#include <gflib-eggdbus/gfeggdbusfeedmanager.h>
+
+#define GF_EGGDBUS_SERVER_CONNECTION_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnectionPrivate))
+
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
+typedef struct {
+ EggDBusConnection *connection;
+ GfFeedManager *feed_manager_proxy;
+} GfEggDBusServerConnectionPrivate;
+
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+static GfServerConnectionClass *parent_class = NULL;
+static GType type = 0;
+
+/******************************************************************************
+ * GfServerConnection Methods
+ *****************************************************************************/
+static gboolean
+gf_eggdbus_server_connection_listen(GfServerConnection *server_connection,
+ GError **error)
+{
+ GfConnection *connection = GF_CONNECTION(server_connection);
+ GfFeedManager *feed_manager = NULL;
+ GfEggDBusServerConnectionPrivate *priv = NULL;
+ EggDBusBus *bus = NULL;
+ EggDBusRequestNameReply request_name_reply;
+
+ gf_connection_set_state(connection, GF_CONNECTION_STATE_CONNECTING);
+
+ priv = GF_EGGDBUS_SERVER_CONNECTION_GET_PRIVATE(server_connection);
+
+ priv->connection =
+ egg_dbus_connection_get_for_bus(EGG_DBUS_BUS_TYPE_SESSION);
+
+ bus = egg_dbus_connection_get_bus(priv->connection);
+
+ if(!egg_dbus_bus_request_name_sync(bus, 0, "org.guifications",
+ EGG_DBUS_REQUEST_NAME_FLAGS_NONE,
+ &request_name_reply, NULL, error))
+ {
+ g_object_unref(priv->connection);
+
+ gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTED);
+
+ return FALSE;
+ }
+
+ if(request_name_reply != EGG_DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ if(error) {
+ *error = g_error_new(GF_EGGDBUS_ERRORS, RequestNameFailed,
+ "Failed to become the primary name owner.");
+ }
+
+ g_object_unref(priv->connection);
+
+ gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTED);
+
+ return FALSE;
+ }
+
+ /* register the feed manager object */
+ feed_manager = gf_connection_get_feed_manager(connection);
+ if(GF_IS_FEED_MANAGER(feed_manager)) {
+ priv->feed_manager_proxy = gf_eggdbus_server_feed_manager_new(feed_manager);
+
+ egg_dbus_connection_register_interface(priv->connection,
+ GF_EGGDBUS_PATH "feeds/manager",
+ GF_EGG_DBUS_TYPE_FEED_MANAGER,
+ priv->feed_manager_proxy,
+ G_TYPE_INVALID);
+ }
+
+ gf_connection_set_state(connection, GF_CONNECTION_STATE_CONNECTED);
+
+ return TRUE;
+}
+
+/******************************************************************************
+ * GfConnection Methods
+ *****************************************************************************/
+static gboolean
+gf_eggdbus_server_connection_disconnect(GfConnection *connection,
+ GError **error)
+{
+ GfEggDBusServerConnectionPrivate *priv = NULL;
+
+ gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTING);
+
+ priv = GF_EGGDBUS_SERVER_CONNECTION_GET_PRIVATE(connection);
+
+ /* do the unregistering stuff here... */
+ g_object_unref(priv->connection);
+ priv->connection = NULL;
+
+ gf_connection_set_state(connection, GF_CONNECTION_STATE_DISCONNECTED);
+
+ return TRUE;
+}
+
+/******************************************************************************
+ * Object Stuff
+ *****************************************************************************/
+static void
+gf_eggdbus_server_connection_finalize(GObject *obj) {
+ GfConnection *connection = GF_CONNECTION(obj);
+
+ if(gf_connection_is_connected(connection))
+ gf_connection_disconnect(connection, NULL);
+
+ G_OBJECT_CLASS(parent_class)->finalize(obj);
+}
+
+static void
+gf_eggdbus_server_connection_class_init(GfEggDBusServerConnectionClass *klass)
+{
+ GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+ GfNamedObjectClass *gfno_class = GF_NAMED_OBJECT_CLASS(klass);
+ GfConnectionClass *conn_class = GF_CONNECTION_CLASS(klass);
+ GfServerConnectionClass *server_class = GF_SERVER_CONNECTION_CLASS(klass);
+
+ parent_class = g_type_class_peek_parent(klass);
+
+ g_type_class_add_private(klass, sizeof(GfEggDBusServerConnectionPrivate));
+
+ obj_class->finalize = gf_eggdbus_server_connection_finalize;
+
+ gfno_class->name = "EggDBus";
+
+ server_class->listen = gf_eggdbus_server_connection_listen;
+
+ conn_class->disconnect = gf_eggdbus_server_connection_disconnect;
+}
+
+/******************************************************************************
+ * API
+ *****************************************************************************/
+void
+gf_eggdbus_server_connection_register(GfNativePlugin *plugin) {
+ if(type == 0) {
+ static const GTypeInfo info = {
+ sizeof(GfEggDBusServerConnectionClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)gf_eggdbus_server_connection_class_init,
+ NULL,
+ NULL,
+ sizeof(GfEggDBusServerConnection),
+ 0,
+ NULL,
+ };
+
+ type = gf_native_plugin_register_type(plugin,
+ GF_TYPE_SERVER_CONNECTION,
+ "GfEggDBusServerConnection",
+ &info,
+ 0);
+
+ gf_eggdbus_server_feed_manager_register(plugin);
+ gf_eggdbus_server_feed_register(plugin);
+ }
+
+}
+
+GType
+gf_eggdbus_server_connection_get_type(void) {
+ if(G_UNLIKELY(type == 0)) {
+ gf_log_warning("GfEggDBusServerConnection",
+ "gf_eggdbus_server_connection called before the type "
+ "was registered!\n");
+ }
+
+ return type;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbusserverconnection.h Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,63 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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 GF_EGGDBUS_SERVER_CONNECTION_H
+#define GF_EGGDBUS_SERVER_CONNECTION_H
+
+#define GF_TYPE_EGGDBUS_SERVER_CONNECTION (gf_eggdbus_server_connection_get_type())
+#define GF_EGGDBUS_SERVER_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnection))
+#define GF_EGGDBUS_SERVER_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klas), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnectionClass))
+#define GF_IS_EGGDBUS_SERVER_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION))
+#define GF_IS_EGGDBUS_SERVER_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION))
+#define GF_EGGDBUS_SERVER_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GF_TYPE_EGGDBUS_SERVER_CONNECTION, GfEggDBusServerConnectionClass))
+
+typedef struct _GfEggDBusServerConnection GfEggDBusServerConnection;
+typedef struct _GfEggDBusServerConnectionClass GfEggDBusServerConnectionClass;
+
+#include <glib.h>
+
+#include <eggdbus/eggdbus.h>
+
+#include <gflib/gf_lib.h>
+
+struct _GfEggDBusServerConnection {
+ GfServerConnection parent;
+
+ void (*_gf_reserved1)(void);
+ void (*_gf_reserved2)(void);
+ void (*_gf_reserved3)(void);
+ void (*_gf_reserved4)(void);
+};
+
+struct _GfEggDBusServerConnectionClass {
+ GfServerConnectionClass parent;
+
+ void (*_gf_reserved1)(void);
+ void (*_gf_reserved2)(void);
+ void (*_gf_reserved3)(void);
+ void (*_gf_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+void gf_eggdbus_server_connection_register(GfNativePlugin *plugin);
+GType gf_eggdbus_server_connection_get_type(void);
+
+G_END_DECLS
+
+#endif /* GF_EGGDBUS_SERVER_CONNECTION_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbusserverfeed.c Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,246 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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/>.
+ */
+#include <gflib-eggdbus/gfeggdbusserverfeed.h>
+
+#include "gfeggdbusfeed.h"
+
+#define GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeedPrivate))
+
+/******************************************************************************
+ * Enums
+ *****************************************************************************/
+enum {
+ PROP_ZERO,
+ PROP_FEED,
+ PROP_LAST,
+};
+
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
+typedef struct {
+ GfFeed *feed;
+} GfEggDBusServerFeedPrivate;
+
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+static GObjectClass *parent_class = NULL;
+static GType type = 0;
+
+/******************************************************************************
+ * Helpers
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_set_real_feed(GfEggDBusServerFeed *server_feed,
+ GfFeed *feed)
+{
+ GfEggDBusServerFeedPrivate *priv = NULL;
+
+ priv = GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(server_feed);
+
+ if(GF_IS_FEED(priv->feed))
+ g_object_unref(priv->feed);
+
+ priv->feed = GF_IS_FEED(feed) ? g_object_ref(feed) : NULL;
+}
+
+/******************************************************************************
+ * Feed Stuff
+ *****************************************************************************/
+static gchar *
+gf_eggdbus_server_feed_get_name(const GfFeed *feed) {
+ GfEggDBusServerFeedPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
+
+ return gf_feed_get_name(priv->feed);
+}
+
+static GfImage *
+gf_eggdbus_server_feed_get_image(const GfFeed *feed) {
+ GfEggDBusServerFeedPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
+
+ return gf_feed_get_image(priv->feed);
+}
+
+static gchar *
+gf_eggdbus_server_feed_get_i18n(const GfFeed *feed) {
+ GfEggDBusServerFeedPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
+
+ return gf_feed_get_i18n(priv->feed);
+}
+
+static gchar *
+gf_eggdbus_server_feed_get_description(const GfFeed *feed) {
+ GfEggDBusServerFeedPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
+
+ return gf_feed_get_description(priv->feed);
+}
+
+/******************************************************************************
+ * Interface stuff
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_interface_init(GfEggDBusFeedIface *iface) {
+}
+
+/******************************************************************************
+ * Object stuff
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_get_property(GObject *obj, guint param_id,
+ GValue *value, GParamSpec *pspec)
+{
+ GfEggDBusServerFeed *feed = GF_EGGDBUS_SERVER_FEED(obj);
+
+ switch(param_id) {
+ case PROP_FEED:
+ g_value_set_object(value,
+ gf_eggdbus_server_feed_get_real_feed(feed));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_eggdbus_server_feed_set_property(GObject *obj, guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GfEggDBusServerFeed *feed = GF_EGGDBUS_SERVER_FEED(obj);
+
+ switch(param_id) {
+ case PROP_FEED:
+ gf_eggdbus_server_feed_set_real_feed(feed,
+ g_value_get_object(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+static void
+gf_eggdbus_server_feed_finalize(GObject *obj) {
+ GfEggDBusServerFeedPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(obj);
+
+ if(GF_IS_FEED(priv->feed))
+ g_object_unref(priv->feed);
+
+ G_OBJECT_CLASS(parent_class)->finalize(obj);
+}
+
+static void
+gf_eggdbus_server_feed_class_init(GfEggDBusServerFeedClass *klass) {
+ GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+ GfFeedClass *feed_class = GF_FEED_CLASS(klass);
+ GParamSpec *pspec = NULL;
+
+ parent_class = g_type_class_peek_parent(klass);
+
+ g_type_class_add_private(klass, sizeof(GfEggDBusServerFeedPrivate));
+
+ obj_class->finalize = gf_eggdbus_server_feed_finalize;
+ obj_class->get_property = gf_eggdbus_server_feed_get_property;
+ obj_class->set_property = gf_eggdbus_server_feed_set_property;
+
+ feed_class->get_name = gf_eggdbus_server_feed_get_name;
+ feed_class->get_image = gf_eggdbus_server_feed_get_image;
+ feed_class->get_i18n = gf_eggdbus_server_feed_get_i18n;
+ feed_class->get_description = gf_eggdbus_server_feed_get_description;
+
+ pspec = g_param_spec_object("feed", "feed", "The feed we're wrapping",
+ GF_TYPE_FEED,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(obj_class, PROP_FEED, pspec);
+}
+
+/******************************************************************************
+ * API
+ *****************************************************************************/
+void
+gf_eggdbus_server_feed_register(GfNativePlugin *plugin) {
+ if(G_UNLIKELY(type == 0)) {
+ static const GTypeInfo info = {
+ sizeof(GfEggDBusServerFeedClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)gf_eggdbus_server_feed_class_init,
+ NULL,
+ NULL,
+ sizeof(GfEggDBusServerFeed),
+ 0,
+ NULL,
+ };
+
+ static const GInterfaceInfo iface_info = {
+ (GInterfaceInitFunc)gf_eggdbus_server_feed_interface_init,
+ NULL,
+ NULL,
+ };
+
+ type = gf_native_plugin_register_type(plugin,
+ GF_TYPE_FEED,
+ "GfEggDBusServerFeed",
+ &info,
+ 0);
+
+ gf_native_plugin_add_interface(plugin,
+ type,
+ GF_EGG_DBUS_TYPE_FEED,
+ &iface_info);
+ }
+}
+
+GType
+gf_eggdbus_server_feed_get_type(void) {
+ if(G_UNLIKELY(type == 0)) {
+ gf_log_warning("GfEggDBusServerFeed",
+ "gf_eggdbus_server_feed called before the type was "
+ "registered!\n");
+ }
+
+ return type;
+}
+
+GfFeed *
+gf_eggdbus_server_feed_new(GfFeed *feed) {
+ g_return_val_if_fail(GF_IS_FEED(feed), NULL);
+
+ return g_object_new(GF_TYPE_EGGDBUS_SERVER_FEED,
+ "feed", feed,
+ NULL);
+}
+
+GfFeed *
+gf_eggdbus_server_feed_get_real_feed(GfEggDBusServerFeed *feed) {
+ GfEggDBusServerFeedPrivate *priv = NULL;
+
+ g_return_val_if_fail(GF_IS_EGGDBUS_SERVER_FEED(feed), NULL);
+
+ priv = GF_EGGDBUS_SERVER_FEED_GET_PRIVATE(feed);
+
+ return priv->feed;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbusserverfeed.h Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,67 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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 GF_EGGDBUS_SERVER_FEED_H
+#define GF_EGGDBUS_SERVER_FEED_H
+
+#define GF_TYPE_EGGDBUS_SERVER_FEED (gf_eggdbus_server_feed_get_type())
+#define GF_EGGDBUS_SERVER_FEED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeed))
+#define GF_EGGDBUS_SERVER_FEED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeedClass))
+#define GF_IS_EGGDBUS_SERVER_FEED(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED))
+#define GF_IS_EGGDBUS_SERVER_FEED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED))
+#define GF_EGGDBUS_SERVER_FEED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GF_TYPE_EGGDBUS_SERVER_FEED, GfEggDBusServerFeedClass))
+
+typedef struct _GfEggDBusServerFeed GfEggDBusServerFeed;
+typedef struct _GfEggDBusServerFeedClass GfEggDBusServerFeedClass;
+
+#include <glib.h>
+
+#include <eggdbus/eggdbus.h>
+
+#include <gflib/gf_lib.h>
+
+struct _GfEggDBusServerFeed {
+ GfFeed parent;
+
+ void (*_gf_reserved1)(void);
+ void (*_gf_reserved2)(void);
+ void (*_gf_reserved3)(void);
+ void (*_gf_reserved4)(void);
+};
+
+struct _GfEggDBusServerFeedClass {
+ GfFeedClass parent;
+
+ void (*_gf_reserved1)(void);
+ void (*_gf_reserved2)(void);
+ void (*_gf_reserved3)(void);
+ void (*_gf_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+void gf_eggdbus_server_feed_register(GfNativePlugin *plugin);
+GType gf_eggdbus_server_feed_get_type(void);
+
+GfFeed *gf_eggdbus_server_feed_new(GfFeed *feed);
+
+GfFeed *gf_eggdbus_server_feed_get_real_feed(GfEggDBusServerFeed *feed);
+
+G_END_DECLS
+
+#endif /* GF_EGGDBUS_SERVER_FEED_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbusserverfeedmanager.c Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,311 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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/>.
+ */
+#include <gflib-eggdbus/gfeggdbusserverfeedmanager.h>
+
+#include <gflib-eggdbus/gfeggdbusserverconnection.h>
+#include <gflib-eggdbus/gfeggdbusserverfeed.h>
+#include <gflib-eggdbus/gfeggdbuserrors.h>
+
+#include "gfeggdbusfeedmanager.h"
+
+#define GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManagerPrivate))
+
+/******************************************************************************
+ * Enums
+ *****************************************************************************/
+enum {
+ PROP_ZERO = 0,
+ PROP_CONNECTION,
+ PROP_FEED_MANAGER,
+ PROP_LAST,
+};
+
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
+typedef struct {
+ GfEggDBusServerConnection *connection;
+ GfFeedManager *feed_manager;
+} GfEggDBusServerFeedManagerPrivate;
+
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+static GfFeedManagerClass *parent_class = NULL;
+static GType type = 0;
+
+/******************************************************************************
+ * Callbacks
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_manager_feed_register_cb(GfFeedManager *feed_manager,
+ GfFeed *feed,
+ gpointer data)
+{
+ gchar *path = g_strdup_printf("%sFeeds/%s",
+ GF_EGGDBUS_PATH, gf_feed_get_name(feed));
+}
+
+/******************************************************************************
+ * Helpers
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_manager_set_connection(GfEggDBusServerFeedManager *manager,
+ GfEggDBusServerConnection *conn)
+{
+ GfEggDBusServerFeedManagerPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(manager);
+
+ if(priv->connection)
+ g_object_unref(priv->connection);
+
+
+ priv->connection =
+ GF_IS_EGGDBUS_SERVER_CONNECTION(conn) ? g_object_ref(conn) : NULL;
+}
+
+static void
+gf_eggdbus_server_feed_manager_set_real_feed_manager(GfEggDBusServerFeedManager *manager,
+ GfFeedManager *real)
+{
+ GfEggDBusServerFeedManagerPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(manager);
+
+ if(GF_IS_FEED_MANAGER(priv->feed_manager))
+ g_object_unref(priv->feed_manager);
+
+ if(GF_IS_FEED_MANAGER(real)) {
+ priv->feed_manager = g_object_ref(real);
+
+ g_signal_connect(real, "registered-feed",
+ G_CALLBACK(gf_eggdbus_server_feed_manager_feed_register_cb),
+ NULL);
+ } else {
+ priv->feed_manager = NULL;
+ }
+}
+
+/******************************************************************************
+ * FeedManager Stuff
+ *****************************************************************************/
+static GfFeed *
+gf_eggdbus_server_feed_manager_register_feed(GfFeedManager *manager, GfFeed *feed) {
+ GfEggDBusServerFeedManagerPrivate *priv = NULL;
+ GfFeed *server_feed = NULL;
+
+ server_feed = gf_eggdbus_server_feed_new(feed);
+
+ priv = GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(manager);
+
+ gf_feed_manager_register_feed(priv->feed_manager, server_feed);
+
+ return server_feed;
+}
+
+/******************************************************************************
+ * DBus Interface stuff
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_manager_handle_register(GfEggDBusFeedManager *manager,
+ const gchar *name,
+ EggDBusArraySeq *image_data,
+ const gchar *i18n,
+ const gchar *description,
+ EggDBusMethodInvocation *method)
+{
+ GfFeed *feed = NULL, *server_feed = NULL;
+ GfImage *image = NULL;
+
+ if(image_data) {
+ guint image_data_sz = 0;
+ }
+
+ /* we create a simple feed for us to wrap */
+ feed = gf_feed_new(name, image, i18n, description);
+
+ /* clean up the image if we created one */
+ if(GF_IS_IMAGE(image))
+ g_object_unref(image);
+
+ /* now create the server feed */
+ server_feed = gf_feed_manager_register_feed(GF_FEED_MANAGER(manager), feed);
+
+ /* remove our ref to the feed since the server feed is holding what should
+ * be the only ref.
+ */
+ g_object_unref(feed);
+
+ if(!GF_IS_FEED(server_feed)) {
+ gf_log_warning("GfEggDBusServerFeedManager",
+ "Failed to register feed '%s'\n",
+ name);
+
+ egg_dbus_method_invocation_return_error(method, GF_EGGDBUS_ERRORS, 100,
+ "Failed to create the server feed");
+ } else {
+ gchar *path = g_strdup_printf("%sFeeds/%s", GF_EGGDBUS_PATH, name);
+
+ gf_egg_dbus_feed_manager_handle_register_finish(method, path);
+
+ g_free(path);
+ }
+}
+
+static void
+gf_eggdbus_server_feed_manager_interface_init(GfEggDBusFeedManagerIface *iface) {
+ iface->handle_register = gf_eggdbus_server_feed_manager_handle_register;
+}
+
+/******************************************************************************
+ * Object Stuff
+ *****************************************************************************/
+static void
+gf_eggdbus_server_feed_manager_get_property(GObject *obj, guint param_id,
+ GValue *value, GParamSpec *pspec)
+{
+ GfEggDBusServerFeedManager *feed_manager = GF_EGGDBUS_SERVER_FEED_MANAGER(obj);
+
+ switch(param_id) {
+ case PROP_FEED_MANAGER:
+ g_value_set_object(value,
+ gf_eggdbus_server_feed_manager_get_real_feed_manager(feed_manager));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_eggdbus_server_feed_manager_set_property(GObject *obj, guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GfEggDBusServerFeedManager *feed_manager = GF_EGGDBUS_SERVER_FEED_MANAGER(obj);
+
+ switch(param_id) {
+ case PROP_FEED_MANAGER:
+ gf_eggdbus_server_feed_manager_set_real_feed_manager(feed_manager,
+ g_value_get_object(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_eggdbus_server_feed_manager_finalize(GObject *obj) {
+ GfEggDBusServerFeedManagerPrivate *priv =
+ GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(obj);
+
+ g_object_unref(priv->feed_manager);
+
+ G_OBJECT_CLASS(parent_class)->finalize(obj);
+}
+
+static void
+gf_eggdbus_server_feed_manager_class_init(GfEggDBusServerFeedManagerClass *klass) {
+ GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+ GParamSpec *pspec = NULL;
+ GfFeedManagerClass *manager_class = GF_FEED_MANAGER_CLASS(klass);
+
+ parent_class = g_type_class_peek_parent(klass);
+
+ g_type_class_add_private(klass, sizeof(GfEggDBusServerFeedManagerPrivate));
+
+ obj_class->finalize = gf_eggdbus_server_feed_manager_finalize;
+ obj_class->get_property = gf_eggdbus_server_feed_manager_get_property;
+ obj_class->set_property = gf_eggdbus_server_feed_manager_set_property;
+
+ manager_class->register_feed = gf_eggdbus_server_feed_manager_register_feed;
+
+ pspec = g_param_spec_object("feed-manager", "feed-manager",
+ "The concrete GfFeedManager that is wrapped.",
+ GF_TYPE_FEED_MANAGER,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(obj_class, PROP_FEED_MANAGER, pspec);
+}
+
+/******************************************************************************
+ * API
+ *****************************************************************************/
+void
+gf_eggdbus_server_feed_manager_register(GfNativePlugin *plugin) {
+ if(G_UNLIKELY(type == 0)) {
+ static const GTypeInfo info = {
+ sizeof(GfEggDBusServerFeedManagerClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)gf_eggdbus_server_feed_manager_class_init,
+ NULL,
+ NULL,
+ sizeof(GfEggDBusServerFeedManager),
+ 0,
+ NULL,
+ };
+
+ static const GInterfaceInfo manager_info = {
+ (GInterfaceInitFunc)gf_eggdbus_server_feed_manager_interface_init,
+ NULL,
+ NULL,
+ };
+
+ type = gf_native_plugin_register_type(plugin,
+ GF_TYPE_FEED_MANAGER,
+ "GfEggDBusServerFeedManager",
+ &info,
+ 0);
+
+ gf_native_plugin_add_interface(plugin, type,
+ GF_EGG_DBUS_TYPE_FEED_MANAGER, &manager_info);
+ }
+}
+
+GType
+gf_eggdbus_server_feed_manager_get_type(void) {
+ if(G_UNLIKELY(type == 0)) {
+ gf_log_warning("GfEggDBusServerFeedManager",
+ "gf_eggdbus_server_feed_manager called before the type "
+ "was registered!\n");
+ }
+
+ return type;
+}
+
+GfFeedManager *
+gf_eggdbus_server_feed_manager_new(GfFeedManager *feed_manager) {
+ g_return_val_if_fail(GF_IS_FEED_MANAGER(feed_manager), NULL);
+
+ return g_object_new(GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER,
+ "feed-manager", feed_manager,
+ NULL);
+}
+
+GfFeedManager *
+gf_eggdbus_server_feed_manager_get_real_feed_manager(const GfEggDBusServerFeedManager *feed_manager) {
+ GfEggDBusServerFeedManagerPrivate *priv = NULL;
+
+ g_return_val_if_fail(GF_IS_EGGDBUS_SERVER_FEED_MANAGER(feed_manager), NULL);
+
+ priv = GF_EGGDBUS_SERVER_FEED_MANAGER_GET_PRIVATE(feed_manager);
+
+ return priv->feed_manager;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib-eggdbus/gflib-eggdbus/gfeggdbusserverfeedmanager.h Sun Sep 27 16:05:45 2009 -0500
@@ -0,0 +1,66 @@
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY 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 GF_EGGDBUS_SERVER_FEED_MANAGER_H
+#define GF_EGGDBUS_SERVER_FEED_MANAGER_H
+
+#define GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER (gf_eggdbus_server_feed_manager_get_type())
+#define GF_EGGDBUS_SERVER_FEED_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManager))
+#define GF_EGGDBUS_SERVER_FEED_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManagerClass))
+#define GF_IS_EGGDBUS_SERVER_FEED_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER))
+#define GF_IS_EGGDBUS_SERVER_FEED_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER))
+#define GF_EGGDBUS_SERVER_FEED_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GF_TYPE_EGGDBUS_SERVER_FEED_MANAGER, GfEggDBusServerFeedManagerClass))
+
+typedef struct _GfEggDBusServerFeedManager GfEggDBusServerFeedManager;
+typedef struct _GfEggDBusServerFeedManagerClass GfEggDBusServerFeedManagerClass;
+
+#include <glib.h>
+
+#include <eggdbus/eggdbus.h>
+
+#include <gflib/gf_lib.h>
+
+struct _GfEggDBusServerFeedManager {
+ GfFeedManager parent;
+
+ void (*_gf_reserved1)(void);
+ void (*_gf_reserved2)(void);
+ void (*_gf_reserved3)(void);
+ void (*_gf_reserved4)(void);
+};
+
+struct _GfEggDBusServerFeedManagerClass {
+ GfFeedManagerClass parent;
+
+ void (*_gf_reserved1)(void);
+ void (*_gf_reserved2)(void);
+ void (*_gf_reserved3)(void);
+ void (*_gf_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+void gf_eggdbus_server_feed_manager_register(GfNativePlugin *plugin);
+GType gf_eggdbus_server_feed_manager_get_type(void);
+
+GfFeedManager *gf_eggdbus_server_feed_manager_new(GfFeedManager *feed_manager);
+GfFeedManager *gf_eggdbus_server_feed_manager_get_real_feed_manager(const GfEggDBusServerFeedManager *feed_manager);
+
+G_END_DECLS
+
+#endif /* GF_EGGDBUS_SERVER_FEED_MANAGER_H */
+