rendered paste bodyIndex: Makefile.am===================================================================RCS file: /cvs/gnome/epiphany-extensions/extensions/rss/Makefile.am,vretrieving revision 1.5diff -u -p -r1.5 Makefile.am--- Makefile.am 14 Dec 2005 13:50:28 -0000 1.5+++ Makefile.am 22 Dec 2005 21:26:23 -0000@@ -8,8 +8,6 @@ librssextension_la_SOURCES = \ rss-ui.h \ rss-feedlist.c \ rss-feedlist.h \- rss-dbus.c \- rss-dbus.h \ extension.c librssextension_la_CPPFLAGS = \ -I$(top_srcdir)/include \Index: ephy-rss-extension.c===================================================================RCS file: /cvs/gnome/epiphany-extensions/extensions/rss/ephy-rss-extension.c,vretrieving revision 1.7diff -u -p -r1.7 ephy-rss-extension.c--- ephy-rss-extension.c 19 Sep 2005 14:05:46 -0000 1.7+++ ephy-rss-extension.c 22 Dec 2005 21:26:23 -0000@@ -22,7 +22,6 @@ #include "ephy-rss-extension.h" #include "rss-ui.h"-#include "rss-dbus.h" #include "rss-feedlist.h" #include "ephy-debug.h"@@ -45,11 +44,15 @@ #include <glib/gi18n-lib.h> +#include <dbus/dbus-glib.h>+ #define EPHY_RSS_EXTENSION_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE((object), EPHY_TYPE_RSS_EXTENSION, EphyRssExtensionPrivate)) struct _EphyRssExtensionPrivate { RssUI *dialog;+ /* The proxy to the rss reader */+ DBusGProxy *proxy; }; static GObjectClass *parent_class = NULL;@@ -57,6 +60,7 @@ static GType type = 0; /* Menu item stuff */ #define WINDOW_DATA_KEY "EphyRssExtensionWindowData"+#define RSS_FEEDREADER_PROXY_DATA_KEY "EphyRssExtensionRssFeedreaderProxy" #define MENU_PATH "/menubar/ToolsMenu" /* Status Bar stuff */@@ -130,7 +134,9 @@ ephy_rss_feed_subscribe_cb (GtkAction *a EphyWindow *window) { const GValue *value;+ GError *error = NULL; EphyEmbedEvent *event;+ gboolean success; LOG ("Subscribing to the feed"); @@ -139,7 +145,15 @@ ephy_rss_feed_subscribe_cb (GtkAction *a ephy_embed_event_get_property (event, "link", &value); - rss_dbus_subscribe_feed (g_value_get_string (value));+ if (!dbus_g_proxy_call (priv->proxy, RSS_DBUS_SUBSCRIBE, &error,+ G_TYPE_STRING, g_value_get_string (value),+ G_TYPE_INVALID,+ G_TYPE_BOOLEAN, &success,+ G_TYPE_INVALID))+ {+ LOG ("Error while retreiveing method answer: %s: %s", error.name, error.message);+ g_error_free (error);+ } g_object_set(action, "sensitive", FALSE, "visible", FALSE, NULL); }@@ -456,6 +470,8 @@ impl_attach_window (EphyExtension *ext, g_object_set_data_full (G_OBJECT (window), WINDOW_DATA_KEY, data, (GDestroyNotify) g_free); + g_object_set_data (G_OBJECT (window), RSS_FEEDREADER_PROXY_DATA_KEY, extension->priv->proxy);+ /* Create the status bar icon */ ephy_rss_create_statusbar_icon (window, data); @@ -491,13 +507,29 @@ impl_detach_window (EphyExtension *ext, /* Destroy data */ g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);+ g_object_set_data (G_OBJECT (window), RSS_FEEDREADER_PROXY_DATA_KEY, NULL); } /* Epiphany init/dispose stuff ------------------------- */ static void ephy_rss_extension_init (EphyRssExtension *extension) {+ DBusGConnection *connection;+ GError *error = NULL; extension->priv = EPHY_RSS_EXTENSION_GET_PRIVATE (extension);+ + connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);+ if (connection == NULL)+ {+ LOG ("No connection to dbus:%s", error->message);+ g_error_free (error);+ return;+ }+ + extension->priv->proxy = dbus_g_proxy_new_for_name (connection,+ RSS_DBUS_SERVICE,+ RSS_DBUS_OBJECT_PATH,+ RSS_DBUS_INTERFACE); } static void@@ -505,6 +537,8 @@ ephy_rss_extension_finalize (GObject *ob { EphyRssExtension *extension = EPHY_RSS_EXTENSION (object); + g_object_unref (extension->priv->proxy);+ /* Dispose the dialog */ if (extension->priv->dialog != NULL) {Index: ephy-rss-extension.h===================================================================RCS file: /cvs/gnome/epiphany-extensions/extensions/rss/ephy-rss-extension.h,vretrieving revision 1.1diff -u -p -r1.1 ephy-rss-extension.h--- ephy-rss-extension.h 10 Apr 2005 18:52:19 -0000 1.1+++ ephy-rss-extension.h 22 Dec 2005 21:26:23 -0000@@ -24,6 +24,12 @@ #include <glib.h> #include <glib-object.h> +/* How to contact feed readers via dbus */+#define RSS_DBUS_SERVICE "org.gnome.feed.Reader"+#define RSS_DBUS_OBJECT_PATH "/org/gnome/feed/Reader"+#define RSS_DBUS_INTERFACE "org.gnome.feed.Reader"+#define RSS_DBUS_SUBSCRIBE "Subscribe"+ G_BEGIN_DECLS #define EPHY_TYPE_RSS_EXTENSION (ephy_rss_extension_get_type ())Index: rss-ui.c===================================================================RCS file: /cvs/gnome/epiphany-extensions/extensions/rss/rss-ui.c,vretrieving revision 1.6diff -u -p -r1.6 rss-ui.c--- rss-ui.c 2 Dec 2005 12:50:18 -0000 1.6+++ rss-ui.c 22 Dec 2005 21:26:23 -0000@@ -21,7 +21,7 @@ #include "config.h" #include "rss-ui.h"-#include "rss-dbus.h"+#include <dbus/dbus-glib.h> #include "ephy-gui.h" #include "ephy-dnd.h"@@ -64,6 +64,8 @@ struct _RssUIPrivate FeedList *list; /* Embed in which we have the feeds */ EphyEmbed *embed;+ /* The proxy to the rss reader */+ DBusGProxy *proxy; /* A boolean flag indicating a dbus error */ gboolean dbus_error; };@@ -145,7 +147,18 @@ rss_ui_subscribe_selected (GtkTreeModel if (selected && feed != NULL && feed->title != NULL && feed->type != NULL && feed->address != NULL) { - success = rss_dbus_subscribe_feed (feed->address);+ GError *error = NULL;+ if (!dbus_g_proxy_call (priv->proxy, RSS_DBUS_SUBSCRIBE, &error,+ G_TYPE_STRING, feed->address,+ G_TYPE_INVALID,+ G_TYPE_BOOLEAN, &success,+ G_TYPE_INVALID))+ {+ LOG ("Error while retreiveing method answer: %s: %s", error.name, error.message);+ g_error_free (error);+ success = FALSE;+ }+ if (success == FALSE) { GtkWidget *image;@@ -505,8 +518,24 @@ rss_ui_populate_store (RssUI *dialog) static void rss_ui_init (RssUI *dialog)-{ +{+ DBusGConnection *connection;+ GError *error = NULL;+ dialog->priv = RSS_UI_GET_PRIVATE (dialog);+ + connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);+ if (connection == NULL)+ {+ LOG ("No connection to dbus:%s", error->message);+ g_error_free (error);+ return;+ }+ + dialog->priv->proxy = dbus_g_proxy_new_for_name (connection,+ RSS_DBUS_SERVICE,+ RSS_DBUS_OBJECT_PATH,+ RSS_DBUS_INTERFACE); } static GObject *@@ -608,6 +637,7 @@ rss_ui_finalize (GObject *object) RssUI *dialog = RSS_UI (object); RssUIPrivate *priv = dialog->priv; + g_object_unref (priv->proxy); rss_feedlist_free (priv->list); parent_class->finalize (object);