Re: Getting a phone number from an OssoABookContact

2010-08-24 Thread Andrew Flegg
Here's some code from Hermes'[1] org/maemo/hermes/engine/contact.py:

8<-
# Constants from 
http://library.gnome.org/devel/libebook/stable/EContact.html#EContactField
ebook = CDLL('libebook-1.2.so.5')
E_CONTACT_PHONE_OTHER = 30  

def get_phones(self):
"""Return a list of phone numbers associated with this contact."""

nums = []
ai = GList.new(ebook.e_contact_get_attributes(hash(self._contact), 
E_CONTACT_PHONE_OTHER))
while ai.has_next():
attr = ai.next(as_a = EVCardAttribute)
types = set()
if attr.params:
params = 
GList.new(ebook.e_vcard_attribute_param_get_values(attr.params.contents.next()))
while params.has_next():
types.add(string_at(params.next()))

device = 'VOICE' in types and 'landline' \
  or 'CELL'  in types and 'mobile'   \
  or None
type = 'HOME' in types and 'home' \
or 'WORK' in types and 'work' \
or None  
number = string_at(attr.value().next())
nums.append(PhoneNumber(number, type = type, device = device))
 
return nums  
--->8

If you don't speak Python, what is basically does is (dealing with an EContact, 
but you can get that from an OssoABookContact IIRC:

  1) Get all attributes of type 30 - this returns all
 phone numbers, I've found.
  2) Loop over each attribute, the value of which is
 the phone number.
  3) The parameters of the attribute will tell you the different
 types flagged against this number.

HTH,

Andrew

[1] http://hermes.garage.maemo.org/

-- 
Andrew Flegg -- mailto:and...@bleb.org   |   http://www.bleb.org/
Maemo Community Council chair
- Original message -
> Hello maemo-developers!
> 
> Does anyone know how to get a phone number (any number) out of an
> OssoABookContact instance? I'm at my wit's end; all of the online hits
> i've found have been doing the opposite and I can't figure this out.
> My guess was using the osso_abook_contact_get_value function, but I
> have no idea what the appropriate attribute would be. I've tried a
> great many (Cell, for instance) and gotten nothing.
> 
> Ideas?
> 
> Thanks!
> ___
> maemo-developers mailing list
> maemo-developers@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Getting a phone number from an OssoABookContact

2010-08-24 Thread Kurtis Heimerl
Hello maemo-developers!

Does anyone know how to get a phone number (any number) out of an
OssoABookContact instance? I'm at my wit's end; all of the online hits
i've found have been doing the opposite and I can't figure this out.
My guess was using the osso_abook_contact_get_value function, but I
have no idea what the appropriate attribute would be. I've tried a
great many (Cell, for instance) and gotten nothing.

Ideas?

Thanks!
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Building pulseaudio for N900

2010-08-24 Thread tarantism
On Mon, 2010-08-23 at 16:54 +0200, Marc-André Lureau wrote:
> Hi
> 
> The only way that really works well, whatever autotools you have in
> scratchbox, is to run autogen.sh/bootstrap.sh (with NOCONFIGURE=1)
> outside of scratchbox, and then build the rest in scratchbox.
> 
> I understand that can make development a bit more complicated, but
> it's a fact, scratchbox is outdated, and your desktop will often be
> better suited for development task (whether it is to do modifications,
> or prepare a release etc...). I used to be pushing tools such as
> libtool / autotools in maemo because of PulseAudio and such.
> 
> So prepare your source tree outside of scratchbox, and then run
> ./configure (or dpkg-buildpackage) inside it, there are no better
> ways, afaik.
Thanks for the suggestion. It sounds like a good plan for autotools but,
as I understand it, for libtool you need the ltdl headers and have to
link with the correct version of libltdl so that really has to be within
scratchbox.

I've still got to check-out what Mohammad Abu-Garbeyyeh has been doing
but in case anyone's interested, I've got it going as follows:

Autoconf & Automake:
Scratchbox has different versions of autotools in directories
within /scratchbox/tools/autotools. These are selected dependant on
circumstances by sb_xyz_wrapper scripts in /scratchbox/tools/bin.

You should be able to install new versions to subdirectories
of /scratchbox/tools/autotools, hack the wrapper scripts and force a
particular version using eg SBOX_DEFAULT_AUTOCONF=2.63 or
SBOX_DEFAULT_AUTOMAKE=1.10.

However, I found that for some deep and dark mechanism buried somewhere
in some indecipherable incantation (probably something in the third
recursive iteration of confauto.m4local.ac.in.ss), these
SBOX_DEFAULT variables are not always respected.

Rather than hacking the sb_xyz_wrapper scripts, you're better off
installing the updated versions to a ~/tools directory and sticking
~/tools/bin on the front of your path. The new tools will then always
run ahead of the older ones.

Libtool:
I merrily followed the same process for libtool and pulse built without
errors - hooray. Unfortunately, my module_xyz.so files were broken and
just made noise. I'd missed the fact (as mentioned above) that you need
to include the right version of the ltdl headers and link to the right
version of libltdl. Being tired at this point, I simply ran ./config
--prefix=/usr for libtool-2.2.6 and installed it over any previous
versions. Success.

Chris


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers