After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680302 - Move model logic out of EmpathyRosterView
Move model logic out of EmpathyRosterView
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
2.33.x
Other Linux
: Normal enhancement
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2012-07-20 08:37 UTC by Guillaume Desmottes
Modified: 2012-08-07 14:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
empathy-roster-model-manager: Pass an EmpathyIndividualManager to EmpathyRosterModelManager (5.12 KB, patch)
2012-07-22 15:43 UTC, Laurent Contzen
committed Details | Review
empathy-roster-model-manager.c: implement empathy_roster_model_manager_get_individuals () (1.20 KB, patch)
2012-07-22 15:52 UTC, Laurent Contzen
committed Details | Review
empathy-roster-view: start using empathy-roster-model (8.58 KB, patch)
2012-07-22 15:53 UTC, Laurent Contzen
committed Details | Review
empathy-roster-model-manager: deal with members-changed signals empathy-roster-view: use empathy-roster-model-manager signals (3.60 KB, patch)
2012-07-22 15:55 UTC, Laurent Contzen
committed Details | Review
empathy-roster-model, empathy-roster-model-manager: Now deals with groups-changed signal empathy-roster-view.c: now uses roster-model's groups-changed signal (5.06 KB, patch)
2012-07-22 15:55 UTC, Laurent Contzen
committed Details | Review
empathy-roster-model: New virtual method _get_groups_for_individual empathy-roster-model-manager: implemented _get_groups_for_individual empathy-roster-view.c: using _get_groups_for_individual (5.47 KB, patch)
2012-07-22 15:56 UTC, Laurent Contzen
committed Details | Review
empathy-roster-model-manager: added xmpp-local contacts support empathy-roster-view: removed xmpp-local contacts support (3.56 KB, patch)
2012-07-22 15:56 UTC, Laurent Contzen
committed Details | Review
empathy-roster-model-manager: checks if individual is in top_group empathy-roster-view: removed this check (2.61 KB, patch)
2012-07-22 15:57 UTC, Laurent Contzen
reviewed Details | Review
empathy-roster-model-manager: now catches and treats notify::top-individuals empathy-roster-model: new function _notify_top_individuals empathy-roster-view: now catches the model's notify::top-individuals instead of the manager's (3.87 KB, patch)
2012-07-22 15:58 UTC, Laurent Contzen
none Details | Review
empathy-roster-model and empathy-roster-model-manager: now deals with notify::favourites_changed signal empathy-roster-view: now catches favourites_changed from model instead of manager (4.63 KB, patch)
2012-07-22 15:58 UTC, Laurent Contzen
none Details | Review
empathy-roster-model and empathy-roster-model-manager: new function _get_top_individuals empathy-roster-view: now uses empathy_roster_model_get_top_individuals instead of empathy_individual_manager_get_top_individuals (4.14 KB, patch)
2012-07-22 15:58 UTC, Laurent Contzen
none Details | Review
empathy-roster-view: removed the manager, relying only on the model empathy-roster-window, empathy-nautilus-sendto and test-empathy-roster-view: adapted the roster_view_new call (6.55 KB, patch)
2012-07-22 15:59 UTC, Laurent Contzen
accepted-commit_now Details | Review
Moved contact_is_favourite from roster-view to the model (5.17 KB, patch)
2012-07-22 16:00 UTC, Laurent Contzen
reviewed Details | Review
Moved contact_in_top from roster-view to roster-model (4.93 KB, patch)
2012-07-22 16:01 UTC, Laurent Contzen
none Details | Review
Renamed #define'd groups names to EMPATHY_ROSTER_MODEL_GROUP_* (2.21 KB, patch)
2012-07-23 09:11 UTC, Laurent Contzen
reviewed Details | Review
Moved roster_contacts from roster-view to the model empathy-roster-model and empathy-roster-model-manager: Added roster_contacts and methods to insert, remove, remove_all and lookup for an individual empathy-roster-view: removed roster_contact and modifie (13.30 KB, patch)
2012-07-23 09:13 UTC, Laurent Contzen
none Details | Review
Moved roster_groups from view to model empathy-roster-model and empathy-roster-model-manager: added roster_groups and methods to insert, remove_all and lookup for a group empathy-roster-view: removed roster_groups and modified roster_groups usages to use (10.87 KB, patch)
2012-07-23 09:14 UTC, Laurent Contzen
none Details | Review
Renamed #define'd groups names to EMPATHY_ROSTER_MODEL_GROUP_* (7.05 KB, patch)
2012-07-23 12:15 UTC, Laurent Contzen
none Details | Review
Documented public functions in empathy-roster-model (6.28 KB, patch)
2012-07-24 11:40 UTC, Laurent Contzen
none Details | Review
Documented public functions in empathy-roster-model (6.27 KB, patch)
2012-07-24 17:22 UTC, Laurent Contzen
none Details | Review

Description Guillaume Desmottes 2012-07-20 08:37:02 UTC
.
Comment 1 Laurent Contzen 2012-07-22 15:43:31 UTC
Created attachment 219421 [details] [review]
empathy-roster-model-manager: Pass an EmpathyIndividualManager to EmpathyRosterModelManager
Comment 2 Laurent Contzen 2012-07-22 15:52:59 UTC
Created attachment 219423 [details] [review]
empathy-roster-model-manager.c: implement empathy_roster_model_manager_get_individuals ()

https://bugzilla.gnome.org/show_bug.cgi?id=679868
Comment 3 Laurent Contzen 2012-07-22 15:53:45 UTC
Created attachment 219424 [details] [review]
empathy-roster-view: start using empathy-roster-model
Comment 4 Laurent Contzen 2012-07-22 15:55:17 UTC
Created attachment 219425 [details] [review]
empathy-roster-model-manager: deal with members-changed signals empathy-roster-view: use empathy-roster-model-manager signals
Comment 5 Laurent Contzen 2012-07-22 15:55:43 UTC
Created attachment 219426 [details] [review]
empathy-roster-model, empathy-roster-model-manager: Now deals with groups-changed signal empathy-roster-view.c: now uses roster-model's groups-changed signal
Comment 6 Laurent Contzen 2012-07-22 15:56:19 UTC
Created attachment 219427 [details] [review]
empathy-roster-model: New virtual method _get_groups_for_individual empathy-roster-model-manager: implemented _get_groups_for_individual empathy-roster-view.c: using _get_groups_for_individual
Comment 7 Laurent Contzen 2012-07-22 15:56:49 UTC
Created attachment 219428 [details] [review]
empathy-roster-model-manager: added xmpp-local contacts support empathy-roster-view: removed xmpp-local contacts support
Comment 8 Laurent Contzen 2012-07-22 15:57:14 UTC
Created attachment 219429 [details] [review]
empathy-roster-model-manager: checks if individual is in top_group empathy-roster-view: removed this check
Comment 9 Laurent Contzen 2012-07-22 15:58:02 UTC
Created attachment 219430 [details] [review]
empathy-roster-model-manager: now catches and treats notify::top-individuals empathy-roster-model: new function _notify_top_individuals empathy-roster-view: now catches the model's notify::top-individuals instead of the manager's
Comment 10 Laurent Contzen 2012-07-22 15:58:27 UTC
Created attachment 219431 [details] [review]
empathy-roster-model and empathy-roster-model-manager: now deals with notify::favourites_changed signal empathy-roster-view: now catches favourites_changed from model instead of manager
Comment 11 Laurent Contzen 2012-07-22 15:58:56 UTC
Created attachment 219432 [details] [review]
empathy-roster-model and empathy-roster-model-manager: new function _get_top_individuals empathy-roster-view: now uses empathy_roster_model_get_top_individuals instead of empathy_individual_manager_get_top_individuals
Comment 12 Laurent Contzen 2012-07-22 15:59:21 UTC
Created attachment 219433 [details] [review]
empathy-roster-view: removed the manager, relying only on the model empathy-roster-window, empathy-nautilus-sendto and test-empathy-roster-view: adapted the roster_view_new call
Comment 13 Laurent Contzen 2012-07-22 16:00:06 UTC
Created attachment 219434 [details] [review]
Moved contact_is_favourite from roster-view to the model
Comment 14 Laurent Contzen 2012-07-22 16:01:10 UTC
Created attachment 219435 [details] [review]
Moved contact_in_top from roster-view to roster-model
Comment 15 Guillaume Desmottes 2012-07-23 07:47:33 UTC
Review of attachment 219421 [details] [review]:

++
Comment 16 Guillaume Desmottes 2012-07-23 07:48:01 UTC
Review of attachment 219423 [details] [review]:

++
Comment 17 Guillaume Desmottes 2012-07-23 07:50:10 UTC
Review of attachment 219424 [details] [review]:

++
Comment 18 Guillaume Desmottes 2012-07-23 07:51:30 UTC
Review of attachment 219425 [details] [review]:

++
Comment 19 Guillaume Desmottes 2012-07-23 07:53:11 UTC
Review of attachment 219426 [details] [review]:

::: libempathy-gtk/empathy-roster-model-manager.c
@@ +87,3 @@
+  empathy_roster_model_fire_groups_changed (EMPATHY_ROSTER_MODEL (self),
+      individual,
+    gboolean is_member,

No need to split on multi lines.

::: libempathy-gtk/empathy-roster-view.c
@@ +1459,3 @@
   g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (manager), NULL);
   g_return_val_if_fail (EMPATHY_IS_ROSTER_MODEL (model), NULL);
+

What has been changed here?
Comment 20 Guillaume Desmottes 2012-07-23 08:00:33 UTC
Attachment 219421 [details] pushed as 2a6cc7b - empathy-roster-model-manager: Pass an EmpathyIndividualManager to EmpathyRosterModelManager
Attachment 219423 [details] pushed as 3ba0b11 - empathy-roster-model-manager.c: implement empathy_roster_model_manager_get_individuals ()
Attachment 219424 [details] pushed as 8751131 - empathy-roster-view: start using empathy-roster-model
Attachment 219425 [details] pushed as 18ded7a - empathy-roster-model-manager: deal with members-changed signals empathy-roster-view: use empathy-roster-model-manager signals
Comment 21 Guillaume Desmottes 2012-07-23 08:13:33 UTC
Review of attachment 219427 [details] [review]:

::: libempathy-gtk/empathy-roster-model.c
@@ +105,3 @@
+
+GList *
+empathy_roster_model_get_groups_for_individual (EmpathyRosterModel *self,

It would be nice to document (in a new commit) the transfer type of those functions. Looking at your implementation this one seems to be transfer container, so add a something like that before the function definition:
/* Returns: (transfer container) */

Ditto for the other public API.
Comment 22 Guillaume Desmottes 2012-07-23 08:15:03 UTC
Review of attachment 219428 [details] [review]:

::: libempathy-gtk/empathy-roster-model-manager.c
@@ +54,3 @@
 */
 
+#define PEOPLE_NEARBY _("People Nearby")

You can now use EMPATHY_ROSTER_VIEW_GROUP_PEOPLE_NEARBY
Comment 23 Guillaume Desmottes 2012-07-23 08:18:34 UTC
Review of attachment 219429 [details] [review]:

commit message should be something like "start moving top individuals logic from roster-view to roster-model".

::: libempathy-gtk/empathy-roster-model-manager.c
@@ +54,3 @@
 */
 
+#define TOP_GROUP _("Top Contacts")

Same, use the EMPATHY_ROSTER_VIEW_GROUP_UNGROUPED. Actually, this should probably be renamed EMPATHY_ROSTER_MODEL_GROUP_* and moved to roster-model.h
Comment 24 Laurent Contzen 2012-07-23 09:11:58 UTC
Created attachment 219466 [details] [review]
Renamed #define'd groups names to EMPATHY_ROSTER_MODEL_GROUP_*
Comment 25 Laurent Contzen 2012-07-23 09:13:47 UTC
Created attachment 219467 [details] [review]
Moved roster_contacts from roster-view to the model empathy-roster-model and empathy-roster-model-manager: Added roster_contacts and methods to insert, remove, remove_all and lookup for an individual empathy-roster-view: removed roster_contact and modifie
Comment 26 Laurent Contzen 2012-07-23 09:14:10 UTC
Created attachment 219468 [details] [review]
Moved roster_groups from view to model empathy-roster-model and empathy-roster-model-manager: added roster_groups and methods to insert, remove_all and lookup for a group empathy-roster-view: removed roster_groups and modified roster_groups usages to use
Comment 27 Guillaume Desmottes 2012-07-23 11:34:06 UTC
Review of attachment 219466 [details] [review]:

You should remove the #define in roster-view.h
Comment 28 Laurent Contzen 2012-07-23 12:15:34 UTC
Created attachment 219480 [details] [review]
Renamed #define'd groups names to EMPATHY_ROSTER_MODEL_GROUP_*
Comment 29 Guillaume Desmottes 2012-07-23 14:11:46 UTC
Attachment 219426 [details] pushed as 5e102f0 - empathy-roster-model, empathy-roster-model-manager: Now deals with groups-changed signal empathy-roster-view.c: now uses roster-model's groups-changed signal
Attachment 219427 [details] pushed as f7200ee - empathy-roster-model: New virtual method _get_groups_for_individual empathy-roster-model-manager: implemented _get_groups_for_individual empathy-roster-view.c: using _get_groups_for_individual
Attachment 219428 [details] pushed as f253f50 - empathy-roster-model-manager: added xmpp-local contacts support empathy-roster-view: removed xmpp-local contacts support
Comment 30 Laurent Contzen 2012-07-24 11:40:07 UTC
Created attachment 219570 [details] [review]
Documented public functions in empathy-roster-model
Comment 31 Laurent Contzen 2012-07-24 17:22:07 UTC
Created attachment 219593 [details] [review]
Documented public functions in empathy-roster-model
Comment 32 Guillaume Desmottes 2012-07-26 16:24:13 UTC
Review of attachment 219433 [details] [review]:

++
Comment 33 Guillaume Desmottes 2012-07-26 16:26:19 UTC
Review of attachment 219434 [details] [review]:

I don't understand this. Isn't 'favorite' just an implementation details of being in the 'top group'? Do we really need to expose this?
Comment 34 Laurent Contzen 2012-07-31 08:42:55 UTC
(In reply to comment #33)
> Review of attachment 219434 [details] [review]:
> 
> I don't understand this. Isn't 'favorite' just an implementation details of
> being in the 'top group'? Do we really need to expose this?

I considered that it was the model's role to decide if a contact is favourite or not, but I may have been wrong.
Comment 35 Guillaume Desmottes 2012-08-03 09:43:52 UTC
I get this when running the test app with your branch:


(lt-test-empathy-roster-view:31497): GLib-GObject-WARNING **: invalid cast from `GParamPointer' to `EmpathyRosterModel'

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff3e441e9 in g_logv (log_domain=0x7ffff4178350 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=0x7ffff4179ac0 "invalid cast from `%s' to `%s'", args1=0x7fffffffbac8) at gmessages.c:758
758			G_BREAKPOINT ();
(gdb) bt full
  • #0 g_logv
    at gmessages.c line 758
  • #1 g_log
    at gmessages.c line 792
  • #2 g_type_check_instance_cast
    at gtype.c line 4005
  • #3 top_individuals_changed_cb
    at empathy-roster-model-manager.c line 144
  • #4 g_cclosure_marshal_VOID__PARAM
    at gmarshal.c line 1042
  • #5 g_closure_invoke
    at gclosure.c line 777
  • #6 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #7 g_signal_emit_valist
    at gsignal.c line 3300
  • #8 g_signal_emit
    at gsignal.c line 3356
  • #9 g_object_dispatch_properties_changed
    at gobject.c line 1041
  • #10 g_object_notify_by_spec_internal
    at gobject.c line 1135
  • #11 g_object_notify
    at gobject.c line 1177
  • #12 check_top_individuals
    at empathy-individual-manager.c line 229
  • #13 individual_notify_im_interaction_count
    at empathy-individual-manager.c line 261
  • #14 g_cclosure_marshal_VOID__PARAM
    at gmarshal.c line 1042
  • #15 g_closure_invoke
    at gclosure.c line 777
  • #16 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #17 g_signal_emit_valist
    at gsignal.c line 3300
  • #18 g_signal_emit
    at gsignal.c line 3356
  • #19 g_object_dispatch_properties_changed
    at gobject.c line 1041
  • #20 g_object_notify_by_spec_internal
    at gobject.c line 1135
  • #21 g_object_notify
    at gobject.c line 1177
  • #22 _folks_individual_notify_im_interaction_count_cb
    at individual.c line 2699
  • #23 __folks_individual_notify_im_interaction_count_cb_g_object_notify
    at individual.c line 4545
  • #24 g_cclosure_marshal_VOID__PARAM
    at gmarshal.c line 1042
  • #25 g_closure_invoke
    at gclosure.c line 777
  • #26 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #27 g_signal_emit_valist
    at gsignal.c line 3300
  • #28 g_signal_emit
    at gsignal.c line 3356
  • #29 g_object_dispatch_properties_changed
    at gobject.c line 1041
  • #30 g_object_notify_queue_thaw
    at gobject.c line 291
  • #31 g_object_thaw_notify
    at gobject.c line 1269
  • #32 _tpf_persona_store_populate_counters_co
    at tpf-persona-store.c line 6399
  • #33 _tpf_persona_store_populate_counters_ready
    at tpf-persona-store.c line 6239
  • #34 dispatch_async_callback
    at zeitgeist-log.c line 318
  • #35 g_simple_async_result_complete
    at gsimpleasyncresult.c line 767
  • #36 reply_cb
    at gdbusproxy.c line 2632
  • #37 g_simple_async_result_complete
    at gsimpleasyncresult.c line 767
  • #38 g_dbus_connection_call_done
    at gdbusconnection.c line 5339
  • #39 g_simple_async_result_complete
    at gsimpleasyncresult.c line 767
  • #40 complete_in_idle_cb
    at gsimpleasyncresult.c line 779
  • #41 g_idle_dispatch
    at gmain.c line 4777
  • #42 g_main_dispatch
    at gmain.c line 2691
  • #43 g_main_context_dispatch
    at gmain.c line 3195
  • #44 g_main_context_iterate
    at gmain.c line 3266
  • #45 g_main_loop_run
    at gmain.c line 3460
  • #46 gtk_main
    at gtkmain.c line 1162
  • #47 main
    at test-empathy-roster-view.c line 153

Comment 36 Guillaume Desmottes 2012-08-07 14:48:21 UTC
I just pushed Laurent's latest patches; closing.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.