Re: Correct individual id to pass to command line option ?



On Fri, 2017-03-10 at 20:48 +0500, Khurshid Alam wrote:
Hi,

I was trying to take advantage of shell search provider dbus
interface for gnome-contacts to search and open contacts for app-
launchers like kupfer or synapse. (Ideally I should probably access
eds backend through python gobject, but that's not reason why it
shouldn't work for dbus in the first place)

For Gnome calendar,

bus = dbus.SessionBus()
proxy = bus.get_object("org.gnome.Calendar", 
                       "/org/gnome/Calendar/SearchProvider")
iface = dbus.Interface(proxy, "org.gnome.Shell.SearchProvider2")
event_uids = iface.GetInitialResultSet([""])

...directly returns uids of events which then, I can pass to "gnome-
calendar --uuid $uuid" to open that particular event in calendar.

However it doesn't work for contacts. 

bus = dbus.SessionBus()
proxy = bus.get_object("org.gnome.Contacts.SearchProvider", 
                       "/org/gnome/Contacts/SearchProvider")
iface = dbus.Interface(proxy, "org.gnome.Shell.SearchProvider2")

contact_ids = iface.GetInitialResultSet([""])
for contact_id in contacts_ids:
    print (contact_id)


It gave me search ids (1, 77, 134) instead of uids. I also tried
using folks-inspect. For example,

Correct, these search IDs can only be dereferenced inside gnome-
contacts.

$folks-inspect personas 'eds:1428657577.4552.2@saturnica:pas-id-
552925C400000080'

Persona 'eds:1428657577.4552.2@saturnica:pas-id-552925C400000080':
  iid 1428657577.4552.2@saturnica:pas-id-552925C400000080
  uid eds:1428657577.4552.2@saturnica:pas-id-552925C400000080
  display-id 1428657577.4552.2@saturnica:pas-id-552925C400000080
  is-user FALSE
  store 0x9c0b5b0: eds, 1428657577.4552.2@saturnica (Android)
  individual 0x9ec9d58
  contact 0xb4f766a8

I tried iid, uid, display-id to command line like "gnome-contacts --
individual $iid "......but nothing worked. I am always getting
"individual id not found"

That’s because you are using the IDs from a persona, not an individual.
In libfolks, personas and individuals are separate concepts: an
individual is formed of one or more personas. Even if an individual
only contains one persona, its ID is different from the persona’s.

So what should be correct "individual ID" in above case? 

Try using `folks-inspect individuals`.

Philip

Attachment: signature.asc
Description: This is a digitally signed message part



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