[gedit-collaboration] Pass io from window helper to manager
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-collaboration] Pass io from window helper to manager
- Date: Sun, 3 Apr 2011 15:43:48 +0000 (UTC)
commit b4bbf1f4198f466ceddaa7ed5f7f972962532528
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Sun Apr 3 17:08:22 2011 +0200
Pass io from window helper to manager
src/gedit-collaboration-manager.c | 34 +++++++++++++++++++++++++++++-
src/gedit-collaboration-manager.h | 3 +-
src/gedit-collaboration-window-helper.c | 10 ++++----
3 files changed, 39 insertions(+), 8 deletions(-)
---
diff --git a/src/gedit-collaboration-manager.c b/src/gedit-collaboration-manager.c
index 55f57f8..6d43204 100644
--- a/src/gedit-collaboration-manager.c
+++ b/src/gedit-collaboration-manager.c
@@ -27,6 +27,8 @@ struct _GeditCollaborationManagerPrivate
GSList *subscriptions;
GHashTable *subscription_map;
+
+ InfIo *io;
};
enum
@@ -67,7 +69,8 @@ struct _GeditCollaborationSubscription
enum
{
PROP_0,
- PROP_WINDOW
+ PROP_WINDOW,
+ PROP_IO
};
/* Signals */
@@ -110,6 +113,12 @@ gedit_collaboration_manager_dispose (GObject *object)
g_slist_free (manager->priv->subscriptions);
}
+
+ if (manager->priv->io)
+ {
+ g_object_unref (manager->priv->io);
+ manager->priv->io = NULL;
+ }
}
static void
@@ -125,6 +134,9 @@ gedit_collaboration_manager_get_property (GObject *object,
case PROP_WINDOW:
g_value_set_object (value, self->priv->window);
break;
+ case PROP_IO:
+ g_value_set_object (value, self->priv->io);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -149,6 +161,14 @@ gedit_collaboration_manager_set_property (GObject *object,
self->priv->window = g_value_dup_object (value);
break;
+ case PROP_IO:
+ if (self->priv->io)
+ {
+ g_object_unref (self->priv->io);
+ }
+
+ self->priv->io = g_value_dup_object (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -173,6 +193,14 @@ gedit_collaboration_manager_class_init (GeditCollaborationManagerClass *klass)
GEDIT_TYPE_WINDOW,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
+ PROP_IO,
+ g_param_spec_object ("io",
+ "Io",
+ "Io",
+ INF_TYPE_IO,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
signals[CHANGED] =
g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
@@ -413,10 +441,12 @@ gedit_collaboration_manager_init (GeditCollaborationManager *self)
}
GeditCollaborationManager *
-gedit_collaboration_manager_new (GeditWindow *window)
+gedit_collaboration_manager_new (GeditWindow *window,
+ InfIo *io)
{
return g_object_new (GEDIT_COLLABORATION_TYPE_MANAGER,
"window", window,
+ "io", io,
NULL);
}
diff --git a/src/gedit-collaboration-manager.h b/src/gedit-collaboration-manager.h
index 4c56dee..54498bb 100644
--- a/src/gedit-collaboration-manager.h
+++ b/src/gedit-collaboration-manager.h
@@ -41,7 +41,8 @@ struct _GeditCollaborationManagerClass
GType gedit_collaboration_manager_get_type (void) G_GNUC_CONST;
void _gedit_collaboration_manager_register_type (GTypeModule *type_module);
-GeditCollaborationManager *gedit_collaboration_manager_new (GeditWindow *window);
+GeditCollaborationManager *gedit_collaboration_manager_new (GeditWindow *window,
+ InfIo *io);
InfcNotePlugin *gedit_collaboration_manager_get_note_plugin (GeditCollaborationManager *manager);
InfcNodeRequest *gedit_collaboration_manager_subscribe (GeditCollaborationManager *manager,
diff --git a/src/gedit-collaboration-window-helper.c b/src/gedit-collaboration-window-helper.c
index a61b9eb..4425b98 100644
--- a/src/gedit-collaboration-window-helper.c
+++ b/src/gedit-collaboration-window-helper.c
@@ -1416,20 +1416,17 @@ compare_func (GtkTreeModel *model,
static void
init_infinity (GeditCollaborationWindowHelper *helper)
{
- InfGtkIo *io;
InfCommunicationManager *communication_manager;
InfXmppManager *xmpp_manager;
InfCertificateCredentials *certificate_credentials;
InfGtkBrowserModel *model_sort;
- io = inf_gtk_io_new ();
communication_manager = inf_communication_manager_new ();
xmpp_manager = inf_xmpp_manager_new ();
certificate_credentials = inf_certificate_credentials_new ();
- helper->priv->io = INF_IO (io);
helper->priv->certificate_credentials = certificate_credentials;
- helper->priv->browser_store = inf_gtk_browser_store_new (INF_IO (io),
+ helper->priv->browser_store = inf_gtk_browser_store_new (helper->priv->io,
communication_manager);
model_sort = INF_GTK_BROWSER_MODEL (
@@ -1661,7 +1658,10 @@ gedit_collaboration_window_helper_constructor (GType type,
helper = GEDIT_COLLABORATION_WINDOW_HELPER (ret);
- helper->priv->manager = gedit_collaboration_manager_new (helper->priv->window);
+ helper->priv->io = INF_IO (inf_gtk_io_new ());
+
+ helper->priv->manager = gedit_collaboration_manager_new (helper->priv->window,
+ helper->priv->io);
if (!build_ui (helper))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]