[epiphany-extensions] rss: fix subscribe dialog availability checks
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany-extensions] rss: fix subscribe dialog availability checks
- Date: Thu, 28 Jan 2010 19:25:05 +0000 (UTC)
commit 7ee5427865adcd14e7c2f89230a4ff755a443703
Author: Estêvão Samuel Procópio <tevaum gmail com>
Date: Fri Jan 15 23:18:15 2010 -0200
rss: fix subscribe dialog availability checks
Bug #607120
Signed-off-by: Diego Escalante Urrelo <descalante igalia com>
extensions/rss/ephy-rss-extension.c | 14 ++++++++++-
extensions/rss/ephy-rss-extension.h | 6 +++++
extensions/rss/rss-ui.c | 43 +++++++++++++++++++++++++++++-----
extensions/rss/rss-ui.h | 4 +-
4 files changed, 57 insertions(+), 10 deletions(-)
---
diff --git a/extensions/rss/ephy-rss-extension.c b/extensions/rss/ephy-rss-extension.c
index 7e23db3..9ce880d 100644
--- a/extensions/rss/ephy-rss-extension.c
+++ b/extensions/rss/ephy-rss-extension.c
@@ -222,7 +222,7 @@ ephy_rss_dialog_display (EphyWindow *window)
if (priv->dialog == NULL)
{
LOG ("Trying to build dialog");
- priv->dialog = rss_ui_new (list, embed);
+ priv->dialog = rss_ui_new (list, embed, data->extension);
}
ephy_dialog_set_parent (EPHY_DIALOG (priv->dialog),
@@ -603,3 +603,15 @@ ephy_rss_extension_register_type (GTypeModule *module)
return type;
}
+
+RssUI *
+ephy_rss_extension_get_dialog (EphyRssExtension *extension)
+{
+ return extension->priv->dialog;
+}
+
+void
+ephy_rss_extension_set_dialog (EphyRssExtension *extension, RssUI *dialog)
+{
+ extension->priv->dialog = dialog;
+}
diff --git a/extensions/rss/ephy-rss-extension.h b/extensions/rss/ephy-rss-extension.h
index c222868..df73441 100644
--- a/extensions/rss/ephy-rss-extension.h
+++ b/extensions/rss/ephy-rss-extension.h
@@ -24,6 +24,8 @@
#include <glib.h>
#include <glib-object.h>
+typedef struct _RssUI RssUI;
+
/* How to contact feed readers via dbus */
#define RSS_DBUS_SERVICE "org.gnome.feed.Reader"
#define RSS_DBUS_OBJECT_PATH "/org/gnome/feed/Reader"
@@ -60,6 +62,10 @@ GType ephy_rss_extension_get_type (void);
GType ephy_rss_extension_register_type (GTypeModule *module);
+RssUI *ephy_rss_extension_get_dialog (EphyRssExtension *extension);
+
+void ephy_rss_extension_set_dialog (EphyRssExtension *extension, RssUI *dialog);
+
G_END_DECLS
#endif
diff --git a/extensions/rss/rss-ui.c b/extensions/rss/rss-ui.c
index fa7e7f7..a1d01d8 100644
--- a/extensions/rss/rss-ui.c
+++ b/extensions/rss/rss-ui.c
@@ -54,6 +54,8 @@ struct _RssUIPrivate
DBusGProxy *proxy;
/* A boolean flag indicating a dbus error */
gboolean dbus_error;
+ /* Extension reference to unset the dialog when it's unrefed */
+ EphyRssExtension *extension;
};
enum
@@ -61,6 +63,7 @@ enum
PROP_WINDOW,
PROP_LIST,
PROP_EMBED,
+ PROP_EXTENSION
};
enum
@@ -167,8 +170,9 @@ rss_ui_subscribe_selected (GtkTreeModel *model,
static void
rss_ui_response_cb (GtkWidget *widget,
int response,
- RssUI *dialog)
+ EphyRssExtension *extension)
{
+ RssUI *dialog = ephy_rss_extension_get_dialog (extension);
RssUIPrivate *priv = dialog->priv;
if (response == GTK_RESPONSE_OK)
@@ -185,6 +189,7 @@ rss_ui_response_cb (GtkWidget *widget,
}
g_object_unref (dialog);
+ ephy_rss_extension_set_dialog (extension, NULL);
}
static FeedType
@@ -313,8 +318,6 @@ rss_ui_treeview_button_pressed_cb (GtkTreeView *treeview,
GdkEventButton *event,
RssUI *dialog)
{
- RssUIPrivate *priv = dialog->priv;
- GtkTreeSelection *selection;
GtkTreePath *path = NULL;
GtkMenu *menu;
@@ -503,6 +506,7 @@ rss_ui_constructor (GType type,
EphyDialog *edialog;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
+ EphyRssExtension *extension;
object = parent_class->constructor (type, n_construct_properties,
construct_params);
@@ -525,8 +529,11 @@ rss_ui_constructor (GType type,
properties[PROP_CLOSE].id, &priv->close,
NULL);
+ g_object_get (object,
+ "extension", &extension,
+ NULL);
g_signal_connect (priv->dialog, "response",
- G_CALLBACK (rss_ui_response_cb), dialog);
+ G_CALLBACK (rss_ui_response_cb), extension);
priv->store = gtk_list_store_new (N_COLUMNS,
RSS_TYPE_NEWSFEED,
@@ -604,8 +611,14 @@ rss_ui_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- /* no readable properties */
- g_return_if_reached ();
+ RssUI *dialog = RSS_UI (object);
+
+ switch (prop_id)
+ {
+ case PROP_EXTENSION:
+ g_value_set_object (value, dialog->priv->extension);
+ break;
+ }
}
static void
@@ -624,6 +637,9 @@ rss_ui_set_property (GObject *object,
case PROP_EMBED:
dialog->priv->embed = g_value_get_object (value);
break;
+ case PROP_EXTENSION:
+ dialog->priv->extension = g_value_get_object (value);
+ break;
}
}
@@ -659,6 +675,17 @@ rss_ui_class_init (RssUIClass *klass)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property
+ (object_class,
+ PROP_EXTENSION,
+ g_param_spec_object ("extension",
+ "Extension",
+ "Extension",
+ EPHY_TYPE_RSS_EXTENSION,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_type_class_add_private (object_class, sizeof (RssUIPrivate));
}
@@ -694,10 +721,12 @@ rss_ui_register_type (GTypeModule *module)
RssUI *
rss_ui_new (FeedList *list,
- EphyEmbed *embed)
+ EphyEmbed *embed,
+ EphyRssExtension *extension)
{
return g_object_new (TYPE_RSS_UI,
"list", list,
"embed", embed,
+ "extension", extension,
NULL);
}
diff --git a/extensions/rss/rss-ui.h b/extensions/rss/rss-ui.h
index f37f945..598aaa8 100644
--- a/extensions/rss/rss-ui.h
+++ b/extensions/rss/rss-ui.h
@@ -38,7 +38,6 @@ G_BEGIN_DECLS
#define IS_RSS_UI_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), TYPE_RSS_UI))
#define RSS_UI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), TYPE_RSS_UI, RssUIClass))
-typedef struct _RssUI RssUI;
typedef struct _RssUIClass RssUIClass;
typedef struct _RssUIPrivate RssUIPrivate;
@@ -60,7 +59,8 @@ GType rss_ui_get_type (void);
GType rss_ui_register_type (GTypeModule *module);
RssUI *rss_ui_new (FeedList *list,
- EphyEmbed *embed);
+ EphyEmbed *embed,
+ EphyRssExtension *extension);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]