Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8620783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:39:46+00:00 2026-06-12T06:39:46+00:00

I’ve just started fiddling with writing gnome-shell extensions, and would like to know how

  • 0

I’ve just started fiddling with writing gnome-shell extensions, and would like to know how to get a list of contacts a user has.

I’ve tracked down some likely files: gnome-shell/js/ui/contactDisplay.js and gnome-shell/src/shell_contact_system.c.

Now I notice in shell_contact_system.c the following function:

/**
 * shell_contact_system_get_all:
 * @self: A #ShellContactSystem
 *
 * Returns: (transfer none): All individuals
 */
GeeMap *
shell_contact_system_get_all (ShellContactSystem *self)
{
  GeeMap *individuals;

  g_return_val_if_fail (SHELL_IS_CONTACT_SYSTEM (self), NULL);

  individuals = folks_individual_aggregator_get_individuals (self->priv->aggregator);

  return individuals;
}

This suggests that inthe javascript interface I can use function get_all (my belief is reinforced by the fact that the .c file also has a shell_contact_system_get_individual and contactDisplay.js demonstrates the use of Shell.ContactSystem.get_default().get_individual), so I try:

contactSys = Shell.ContactSystem.get_default();
// get contacts
contacts = contactSys.get_all();

It works! (I’m trying it out in Gnome-shell’s “looking glass” javascript interpreter).

It appears to be a ‘Gobject’ so I have no idea what to do with this object to get the names of my contacts out. I notice (from the C code) that this object is a GeeMap *, so looking at the documentation for Gee.Map, I see I can do the following:

contacts.size   // returns 31, which is the number of contacts I have !
contacts.values // is a Gee.Collection
contacts.keys   // is a Gee.Set

I then try to look at contacts.values and contacts.key, noting the to_array() method these have:

contacts.values.to_array()
contacts.keys.to_array()

However when I do this I get an empty array back out: contacts.xxx.to_array().size is 0, yet contacts.size is 31 ?? !!

The same occurs when I attempt to use a contacts.map_iterator() to iterate through the map; it.get_value() and it.get_key() appear to be null.

So, my question is: How can I access the individual elements of contacts?

I do note that the comment for shell_contact_system_get_all says Returns: (transfer none): ... whilst shell_contact_system_get_individual says Returns: (transfer full): ..., and the latter function works (provided I know the ID of the individual I want to look up, which is my problem), whereas the former doesn’t. Could this be something to do with it?

Also, as a workaround, I can currently make use of the contactSearchProvider class to achieve this (used by the overview when you intall gnome-contacts where you can type the name of a contact and they’ll appear in the overview). I basically search for '' which should return me a list of every contact. It seems roundabout though – I feel I should just be able to use the get_all() method to get all the contacts without having to search on an empty string…

    const ContactDisplay = imports.ui.contactDisplay;
    cds = new ContactDisplay.contactSearchProvider;
    res = cds.getInitialResultSet(['']); 
    // woohoo! res.length is 31, and res[0], res[1], ... are all not null!

Any help would be greatly appreciated (by the way, is there any sort of documentation about for this? I feel extremely inadequate when I stare at the source and try to deduce all the documentation from it!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:39:47+00:00Added an answer on June 12, 2026 at 6:39 am

    I believe this is a bug and that you already found where it is: the annotation on the C method should say Returns: (transfer full): in order to give back results to the bindings.

    The next logical step would be to report the bug and the patch to their bugzilla, but I need to note that code was removed in gnome 3.6 so I’m skeptical it will be ever fixed.

    The contact search code now lives in the gnome-contact app at:

    http://git.gnome.org/browse/gnome-contacts

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I would like to count the length of a string with PHP. The string
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.