[gedit] Port checkupdate plugin to use the window construct property.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Port checkupdate plugin to use the window construct property.
- Date: Wed, 28 Jul 2010 13:44:03 +0000 (UTC)
commit 3388621b8e28a7036dec7f03055deb1b4d0ef888
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Wed Jul 28 15:43:45 2010 +0200
Port checkupdate plugin to use the window construct property.
plugins/checkupdate/gedit-check-update-plugin.c | 67 ++++++++++++++++++++---
1 files changed, 60 insertions(+), 7 deletions(-)
---
diff --git a/plugins/checkupdate/gedit-check-update-plugin.c b/plugins/checkupdate/gedit-check-update-plugin.c
index 6da4d45..550e326 100644
--- a/plugins/checkupdate/gedit-check-update-plugin.c
+++ b/plugins/checkupdate/gedit-check-update-plugin.c
@@ -75,6 +75,12 @@ struct _GeditCheckUpdatePluginPrivate
gchar *version;
};
+enum
+{
+ PROP_0,
+ PROP_WINDOW
+};
+
static void
gedit_check_update_plugin_init (GeditCheckUpdatePlugin *plugin)
{
@@ -104,6 +110,12 @@ gedit_check_update_plugin_dispose (GObject *object)
g_object_unref (plugin->priv->settings);
plugin->priv->settings = NULL;
}
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
gedit_debug_message (DEBUG_PLUGINS,
"GeditCheckUpdatePlugin disposing");
@@ -126,6 +138,46 @@ gedit_check_update_plugin_finalize (GObject *object)
}
static void
+gedit_check_update_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GeditCheckUpdatePlugin *plugin = GEDIT_CHECK_UPDATE_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_WINDOW:
+ plugin->priv->window = GEDIT_WINDOW (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gedit_check_update_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GeditCheckUpdatePlugin *plugin = GEDIT_CHECK_UPDATE_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_WINDOW:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
set_contents (GtkWidget *infobar,
GtkWidget *contents)
{
@@ -567,8 +619,7 @@ parse_page_version (SoupSession *session,
}
static void
-gedit_check_update_plugin_activate (GeditWindowActivatable *activatable,
- GeditWindow *window)
+gedit_check_update_plugin_activate (GeditWindowActivatable *activatable)
{
GeditCheckUpdatePluginPrivate *priv;
SoupMessage *msg;
@@ -576,7 +627,6 @@ gedit_check_update_plugin_activate (GeditWindowActivatable *activatable,
gedit_debug (DEBUG_PLUGINS);
priv = GEDIT_CHECK_UPDATE_PLUGIN (activatable)->priv;
- priv->window = window;
msg = soup_message_new ("GET", GEDIT_URL);
@@ -586,8 +636,7 @@ gedit_check_update_plugin_activate (GeditWindowActivatable *activatable,
}
static void
-gedit_check_update_plugin_deactivate (GeditWindowActivatable *activatable,
- GeditWindow *window)
+gedit_check_update_plugin_deactivate (GeditWindowActivatable *activatable)
{
gedit_debug (DEBUG_PLUGINS);
@@ -600,10 +649,14 @@ gedit_check_update_plugin_class_init (GeditCheckUpdatePluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (GeditCheckUpdatePluginPrivate));
-
object_class->finalize = gedit_check_update_plugin_finalize;
object_class->dispose = gedit_check_update_plugin_dispose;
+ object_class->set_property = gedit_check_update_plugin_set_property;
+ object_class->get_property = gedit_check_update_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_WINDOW, "window");
+
+ g_type_class_add_private (object_class, sizeof (GeditCheckUpdatePluginPrivate));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]