[empathy] Removed the manager from the view, relying only on the model



commit b3c361fdca7f6a0bb2a63e676cd0a5d488261127
Author: Laurent Contzen <lcontzen gmail com>
Date:   Sat Aug 4 14:38:25 2012 +0200

    Removed the manager from the view, relying only on the model

 libempathy-gtk/empathy-roster-view.c              |   31 +-------------------
 libempathy-gtk/empathy-roster-view.h              |    7 +----
 nautilus-sendto-plugin/empathy-nautilus-sendto.c  |    6 ++--
 src/empathy-roster-window.c                       |    3 +-
 tests/interactive/test-empathy-dual-roster-view.c |    3 +-
 tests/interactive/test-empathy-roster-view.c      |    2 +-
 6 files changed, 9 insertions(+), 43 deletions(-)
---
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index 2b8154e..06a4ebf 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -17,8 +17,7 @@ G_DEFINE_TYPE (EmpathyRosterView, empathy_roster_view, EGG_TYPE_LIST_BOX)
 
 enum
 {
-  PROP_MANAGER = 1,
-  PROP_MODEL,
+  PROP_MODEL = 1,
   PROP_SHOW_OFFLINE,
   PROP_SHOW_GROUPS,
   PROP_EMPTY,
@@ -40,8 +39,6 @@ static guint signals[LAST_SIGNAL];
 
 struct _EmpathyRosterViewPriv
 {
-  EmpathyIndividualManager *manager;
-
   /* FolksIndividual (borrowed) -> GHashTable (
    * (gchar * group_name) -> EmpathyRosterContact (borrowed))
    *
@@ -114,9 +111,6 @@ empathy_roster_view_get_property (GObject *object,
 
   switch (property_id)
     {
-      case PROP_MANAGER:
-        g_value_set_object (value, self->priv->manager);
-        break;
       case PROP_MODEL:
         g_value_set_object (value, self->priv->model);
         break;
@@ -145,10 +139,6 @@ empathy_roster_view_set_property (GObject *object,
 
   switch (property_id)
     {
-      case PROP_MANAGER:
-        g_assert (self->priv->manager == NULL); /* construct only */
-        self->priv->manager = g_value_dup_object (value);
-        break;
       case PROP_MODEL:
         g_assert (self->priv->model == NULL);
         self->priv->model = g_value_dup_object (value);
@@ -1076,7 +1066,6 @@ empathy_roster_view_constructed (GObject *object)
   if (chain_up != NULL)
     chain_up (object);
 
-  g_assert (EMPATHY_IS_INDIVIDUAL_MANAGER (self->priv->manager));
   g_assert (EMPATHY_IS_ROSTER_MODEL (self->priv->model));
 
   populate_view (self);
@@ -1113,7 +1102,6 @@ empathy_roster_view_dispose (GObject *object)
   stop_flashing (self);
 
   empathy_roster_view_set_live_search (self, NULL);
-  g_clear_object (&self->priv->manager);
   g_clear_object (&self->priv->model);
 
   if (chain_up != NULL)
@@ -1341,12 +1329,6 @@ empathy_roster_view_class_init (
 
   box_class->child_activated = empathy_roster_view_child_activated;
 
-  spec = g_param_spec_object ("manager", "Manager",
-      "EmpathyIndividualManager",
-      EMPATHY_TYPE_INDIVIDUAL_MANAGER,
-      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-  g_object_class_install_property (oclass, PROP_MANAGER, spec);
-
   spec = g_param_spec_object ("model", "Model",
       "EmpathyRosterModel",
       EMPATHY_TYPE_ROSTER_MODEL,
@@ -1420,24 +1402,15 @@ empathy_roster_view_init (EmpathyRosterView *self)
 }
 
 GtkWidget *
-empathy_roster_view_new (EmpathyIndividualManager *manager,
-    EmpathyRosterModel *model)
+empathy_roster_view_new (EmpathyRosterModel *model)
 {
-  g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (manager), NULL);
   g_return_val_if_fail (EMPATHY_IS_ROSTER_MODEL (model), NULL);
 
   return g_object_new (EMPATHY_TYPE_ROSTER_VIEW,
-      "manager", manager,
       "model", model,
       NULL);
 }
 
-EmpathyIndividualManager *
-empathy_roster_view_get_manager (EmpathyRosterView *self)
-{
-  return self->priv->manager;
-}
-
 void
 empathy_roster_view_show_offline (EmpathyRosterView *self,
     gboolean show)
diff --git a/libempathy-gtk/empathy-roster-view.h b/libempathy-gtk/empathy-roster-view.h
index fd4f13e..6d5d760 100644
--- a/libempathy-gtk/empathy-roster-view.h
+++ b/libempathy-gtk/empathy-roster-view.h
@@ -5,7 +5,6 @@
 #include <libempathy-gtk/egg-list-box/egg-list-box.h>
 #include <libempathy-gtk/empathy-live-search.h>
 
-#include <libempathy/empathy-individual-manager.h>
 #include <libempathy-gtk/empathy-roster-model.h>
 
 G_BEGIN_DECLS
@@ -55,11 +54,7 @@ GType empathy_roster_view_get_type (void);
     EMPATHY_TYPE_ROSTER_VIEW, \
     EmpathyRosterViewClass))
 
-GtkWidget * empathy_roster_view_new (EmpathyIndividualManager *manager,
-    EmpathyRosterModel *model);
-
-EmpathyIndividualManager * empathy_roster_view_get_manager (
-    EmpathyRosterView *self);
+GtkWidget * empathy_roster_view_new (EmpathyRosterModel *model);
 
 void empathy_roster_view_show_offline (EmpathyRosterView *self,
     gboolean show);
diff --git a/nautilus-sendto-plugin/empathy-nautilus-sendto.c b/nautilus-sendto-plugin/empathy-nautilus-sendto.c
index fcfc282..56c55f5 100644
--- a/nautilus-sendto-plugin/empathy-nautilus-sendto.c
+++ b/nautilus-sendto-plugin/empathy-nautilus-sendto.c
@@ -114,15 +114,15 @@ get_contacts_widget (NstPlugin *plugin)
   GtkWidget *roster_view, *box, *scrolled;
   EmpathyIndividualManager *mgr;
   EmpathyRosterModel *model;
-  
+
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
 
   mgr = empathy_individual_manager_dup_singleton ();
   model = EMPATHY_ROSTER_MODEL (empathy_roster_model_manager_new (mgr));
-  roster_view = empathy_roster_view_new (mgr, model);
+  roster_view = empathy_roster_view_new (model);
 
   g_object_unref (model);
-  
+
   scrolled = gtk_scrolled_window_new (NULL, NULL);
 
   g_object_unref (mgr);
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index 2b7f98a..cc25c19 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -2233,8 +2233,7 @@ empathy_roster_window_init (EmpathyRosterWindow *self)
     }
 
   self->priv->view = EMPATHY_ROSTER_VIEW (
-      empathy_roster_view_new (self->priv->individual_manager,
-          model));
+      empathy_roster_view_new (model));
 
   g_object_unref (model);
 
diff --git a/tests/interactive/test-empathy-dual-roster-view.c b/tests/interactive/test-empathy-dual-roster-view.c
index eae4f82..50903c0 100644
--- a/tests/interactive/test-empathy-dual-roster-view.c
+++ b/tests/interactive/test-empathy-dual-roster-view.c
@@ -78,8 +78,7 @@ create_view_box (EmpathyRosterModel *model,
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
 
-  view = empathy_roster_view_new (empathy_individual_manager_dup_singleton (),
-      model);
+  view = empathy_roster_view_new (model);
 
   g_signal_connect (view, "individual-activated",
       G_CALLBACK (individual_activated_cb), NULL);
diff --git a/tests/interactive/test-empathy-roster-view.c b/tests/interactive/test-empathy-roster-view.c
index 6ab56c8..96137c3 100644
--- a/tests/interactive/test-empathy-roster-view.c
+++ b/tests/interactive/test-empathy-roster-view.c
@@ -110,7 +110,7 @@ main (int argc,
   mgr = empathy_individual_manager_dup_singleton ();
 
   model = EMPATHY_ROSTER_MODEL (empathy_roster_model_manager_new (mgr));
-  view = empathy_roster_view_new (mgr, model);
+  view = empathy_roster_view_new (model);
 
   g_object_unref (model);
   g_signal_connect (view, "individual-activated",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]