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 648914 - Favourite contacts appear in other contact list groups when offline
Favourite contacts appear in other contact list groups when offline
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Contact List
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2011-04-29 03:07 UTC by Michael Gratton
Modified: 2011-05-02 08:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Display favorite offline contacts only in the Favorite group (#648914) (4.00 KB, patch)
2011-04-29 13:49 UTC, Guillaume Desmottes
reviewed Details | Review
Display favorite offline contacts only in the Favorite group (#648914) (4.04 KB, patch)
2011-04-29 15:27 UTC, Guillaume Desmottes
none Details | Review
Display favorite offline contacts only in the Favorite group (#648914) (3.81 KB, patch)
2011-05-02 07:24 UTC, Guillaume Desmottes
accepted-commit_now Details | Review

Description Michael Gratton 2011-04-29 03:07:43 UTC
When View > Offline Contacts is not selected, favourite contacts still appear in groups in the contact list when they are offline.

It may well be useful for them to be displayed in the Favourites group even when offline, but they should not appear in user-defined groups unless View > Offline Contacts is selected.
Comment 1 Guillaume Desmottes 2011-04-29 12:42:04 UTC
I think you're right, they are displayed by design but should only be in the Favorite group.
Comment 2 Guillaume Desmottes 2011-04-29 13:49:17 UTC
Created attachment 186885 [details] [review]
Display favorite offline contacts only in the Favorite group (#648914)
Comment 3 Emilio Pozuelo Monfort 2011-04-29 14:59:28 UTC
Comment on attachment 186885 [details] [review]
Display favorite offline contacts only in the Favorite group (#648914)

>+  GtkTreePath *path = gtk_tree_model_get_path (model, iter);
>+  GtkTreePath *parent_path;
>+  GtkTreeIter parent_iter;
>+  gchar *name;
>+
>+  *is_fake = FALSE;
>+
>+  parent_path = gtk_tree_path_copy (path);
>+  if (!gtk_tree_path_up (parent_path))
>+    return NULL;
>+
>+  if (!gtk_tree_model_get_iter (model, &parent_iter, parent_path))
>+    return NULL;
>+
>+  gtk_tree_model_get (model, &parent_iter,
>+      EMPATHY_INDIVIDUAL_STORE_COL_NAME, &name,
>+      EMPATHY_INDIVIDUAL_STORE_COL_IS_FAKE_GROUP, is_fake,
>+      -1);
>+
>+  return name;
>+}

You're leaking parent_path.

Looks good otherwise.
Comment 4 Guillaume Desmottes 2011-04-29 15:27:28 UTC
Created attachment 186891 [details] [review]
Display favorite offline contacts only in the Favorite group (#648914)
Comment 5 Guillaume Desmottes 2011-04-29 15:28:09 UTC
Nice catch! When I wrote this code I said myself "Don't forget to add the free after testing" and guess what... I forgot. :)

Anyway, fixed.
Comment 6 Emilio Pozuelo Monfort 2011-04-29 15:32:47 UTC
Looks good. I have just remembered that you can do

if (gtk_tree_model_iter_parent (model, &parent_iter, iter))
  return NULL;

instead of getting, copying and freeing the path. Should make the code cleaner
Comment 7 Guillaume Desmottes 2011-05-02 07:24:28 UTC
Created attachment 187011 [details] [review]
Display favorite offline contacts only in the Favorite group (#648914)
Comment 8 Emilio Pozuelo Monfort 2011-05-02 08:36:50 UTC
Comment on attachment 187011 [details] [review]
Display favorite offline contacts only in the Favorite group (#648914)

Looks good
Comment 9 Guillaume Desmottes 2011-05-02 08:52:01 UTC
Merged to master and 3.0.


commit 85058e4e3f88412683771172f7dace66366ad069
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Fri Apr 29 15:47:50 2011 +0200

    Display favorite offline contacts only in the Favorite group (#648914)


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.