]> git.0d.be Git - empathy.git/commitdiff
Merge branch 'approvers-redone-599158'
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 18 Jun 2010 16:11:58 +0000 (18:11 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 18 Jun 2010 16:11:58 +0000 (18:11 +0200)
53 files changed:
GOSSIP-RELICENSING.txt [new file with mode: 0644]
configure.ac
data/.gitignore
data/Makefile.am
data/empathy.convert [new file with mode: 0644]
data/empathy.schemas.in [deleted file]
data/org.gnome.Empathy.gschema.xml.in [new file with mode: 0644]
libempathy-gtk/Makefile.am
libempathy-gtk/empathy-avatar-chooser.c
libempathy-gtk/empathy-chat-text-view.c
libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-conf.c [deleted file]
libempathy-gtk/empathy-conf.h [deleted file]
libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-location-manager.c
libempathy-gtk/empathy-log-window.c
libempathy-gtk/empathy-notify-manager.c
libempathy-gtk/empathy-sound.c
libempathy-gtk/empathy-spell.c
libempathy-gtk/empathy-theme-adium.c
libempathy-gtk/empathy-theme-boxes.c
libempathy-gtk/empathy-theme-manager.c
libempathy-gtk/empathy-ui-utils.c
libempathy/Makefile.am
libempathy/empathy-contact.c
libempathy/empathy-contact.h
libempathy/empathy-gsettings.h [new file with mode: 0644]
libempathy/empathy-log-manager.c [deleted file]
libempathy/empathy-log-manager.h [deleted file]
libempathy/empathy-log-manager.xsl [deleted file]
libempathy/empathy-log-store-empathy.c [deleted file]
libempathy/empathy-log-store-empathy.h [deleted file]
libempathy/empathy-log-store.c [deleted file]
libempathy/empathy-log-store.h [deleted file]
libempathy/empathy-message.c
libempathy/empathy-message.h
libempathy/empathy-time.c
libempathy/empathy-time.h
m4/gsettings.m4 [new file with mode: 0644]
src/Makefile.am
src/empathy-account-assistant.c
src/empathy-accounts-dialog.c
src/empathy-auto-salut-account-helper.c
src/empathy-chat-window.c
src/empathy-event-manager.c
src/empathy-ft-manager.c
src/empathy-import-mc4-accounts.c
src/empathy-main-window.c
src/empathy-main-window.ui
src/empathy-migrate-butterfly-logs.c
src/empathy-preferences.c
src/empathy-status-icon.c
src/empathy.c

diff --git a/GOSSIP-RELICENSING.txt b/GOSSIP-RELICENSING.txt
new file mode 100644 (file)
index 0000000..9b8db1a
--- /dev/null
@@ -0,0 +1,411 @@
+From sjoerd.simons@collabora.co.uk Tue Jun 15 16:28:08 2010
+Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender:
+ sjoerd) with ESMTPSA id 0BEF66002FD
+Received: by night.luon.net (Postfix, from userid 1000) id 3C2161A21B; Tue,
+ 15 Jun 2010 16:28:08 +0100 (BST)
+Date: Tue, 15 Jun 2010 16:28:08 +0100
+From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+To: martyn@lanedo.com, micke@tinybird.com, richard@tinybird.com
+Cc: Robert McQueen <robert.mcqueen@collabora.co.uk>, Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+Subject: Telepathy logger, good old Gossip and licenses
+Message-ID: <20100615152808.GA10311@night.luon.net>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.5.20 (2009-06-14)
+X-Evolution-Source: imap://cassidy@mail.collabora.co.uk/
+Content-Transfer-Encoding: 8bit
+
+Hey,
+
+  Long time ago that i talked with most of you, hopefully you're all doing
+  well and are having fun with your current endeavours :)
+
+  As a bit of background of why i'm mailing you all, we're building a logger
+  service for Telepathy. This allows any IM conversation done via telepathy
+  (whether it be in gnome shell, Empathy or whatever) to be automagically
+  logged. Part of this service will be a little library one can use for writing
+  log viewers.
+
+  The current storage backend is based on the logging code from Empathy, which
+  in turn has its origins in Gossip. Which means the library needs has to be
+  GPL currently, which is not great for obvious reasons. Hence we were
+  wondering if there is a possibility to relicense this code to LGPL v2.1+
+
+  To be more specific we tracked the code down the follow files from Gossip:
+    libgossip/gossip-time.c:
+      Copyright: Imendio AB
+      Main Author is Richard with contributions from Mikael and Martyn
+
+    libgossip/gossip-log.c:
+      Copyright: Imendio AB
+      No main author in the license header, code mostly written by Martyn
+      with contributions from Richard and Mikael
+
+  So what it in the end comes down to is: would you be happy to relicense this
+  code such that we can use it under the LGPL v2.1+ and are you able to make
+  that decision on behalf of Imendio AB (which from a legal perspective own
+  the copyrights ttbomk)
+
+  Sjoerd
+-- 
+One meets his destiny often on the road he takes to avoid it.
+
+From martyn@lanedo.com Wed Jun 16 11:58:43 2010
+X-Greylist: delayed 434 seconds by postgrey-1.31 at bhuna; Wed, 16 Jun 2010
+ 11:58:43 BST
+Received: from lanedo.com (lanedo.com [85.214.136.179]) (using TLSv1 with
+ cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by
+ bhuna.collabora.co.uk (Postfix) with ESMTPS id 7D42D600304; Wed, 16 Jun
+ 2010 11:58:43 +0100 (BST)
+Received: from [192.168.0.2]
+ (host86-172-70-241.range86-172.btcentralplus.com [86.172.70.241])
+ (Authenticated sender: martyn) by lanedo.com (Postfix) with ESMTPSA id
+ A40DC7F407C; Wed, 16 Jun 2010 12:51:26 +0200 (CEST)
+Subject: Re: Telepathy logger, good old Gossip and licenses
+From: Martyn Russell <martyn@lanedo.com>
+To: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+Cc: micke@tinybird.com, richard@tinybird.com, Robert McQueen <robert.mcqueen@collabora.co.uk>, Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+In-Reply-To: <20100615152808.GA10311@night.luon.net>
+References: <20100615152808.GA10311@night.luon.net>
+Content-Type: text/plain; charset="UTF-8"
+Date: Wed, 16 Jun 2010 11:51:26 +0100
+Message-ID: <1276685486.1808.2.camel@petunia>
+Mime-Version: 1.0
+X-Mailer: Evolution 2.28.3 
+X-Evolution-Source: imap://cassidy@mail.collabora.co.uk/
+Content-Transfer-Encoding: 8bit
+
+On Tue, 2010-06-15 at 16:28 +0100, Sjoerd Simons wrote:
+> Hey,
+
+Hi,
+
+>   Long time ago that i talked with most of you, hopefully you're all doing
+>   well and are having fun with your current endeavours :)
+
+Certainly is :)
+
+>   As a bit of background of why i'm mailing you all, we're building a logger
+>   service for Telepathy. This allows any IM conversation done via telepathy
+>   (whether it be in gnome shell, Empathy or whatever) to be automagically
+>   logged. Part of this service will be a little library one can use for writing
+>   log viewers.
+
+I see.
+
+>   The current storage backend is based on the logging code from Empathy, which
+>   in turn has its origins in Gossip. Which means the library needs has to be
+>   GPL currently, which is not great for obvious reasons. Hence we were
+>   wondering if there is a possibility to relicense this code to LGPL v2.1+
+> 
+>   To be more specific we tracked the code down the follow files from Gossip:
+>     libgossip/gossip-time.c:
+>       Copyright: Imendio AB
+>       Main Author is Richard with contributions from Mikael and Martyn
+> 
+>     libgossip/gossip-log.c:
+>       Copyright: Imendio AB
+>       No main author in the license header, code mostly written by Martyn
+>       with contributions from Richard and Mikael
+> 
+>   So what it in the end comes down to is: would you be happy to relicense this
+>   code such that we can use it under the LGPL v2.1+ and are you able to make
+>   that decision on behalf of Imendio AB (which from a legal perspective own
+>   the copyrights ttbomk)
+
+Absolutely fine by me.
+
+-- 
+Regards,
+Martyn
+
+
+From richard@tinybird.com Thu Jun 17 09:21:13 2010
+X-Greylist: delayed 331 seconds by postgrey-1.31 at bhuna; Thu, 17 Jun 2010
+ 09:21:13 BST
+Received: from mail.tinybird.com (static-212-247-165-146.cust.tele2.se
+ [212.247.165.146]) by bhuna.collabora.co.uk (Postfix) with ESMTP id
+ F34FF6006C3; Thu, 17 Jun 2010 09:21:13 +0100 (BST)
+Received: from localhost (localhost [127.0.0.1]) by mail.tinybird.com
+ (Postfix) with ESMTP id 159649D8FC; Thu, 17 Jun 2010 10:15:42 +0200 (CEST)
+X-Virus-Scanned: amavisd-new at tinybird.com
+Received: from mail.tinybird.com ([127.0.0.1]) by localhost
+ (core.tinybird.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id
+ hqkRcJPolNBx; Thu, 17 Jun 2010 10:15:41 +0200 (CEST)
+Received: from [192.168.50.6] (c80-216-159-112.bredband.comhem.se
+ [80.216.159.112]) by mail.tinybird.com (Postfix) with ESMTPSA id
+ A684F9D8F1; Thu, 17 Jun 2010 10:15:41 +0200 (CEST)
+Subject: Re: Telepathy logger, good old Gossip and licenses
+Mime-Version: 1.0 (Apple Message framework v1081)
+Content-Type: text/plain; charset=us-ascii
+From: Richard Hult <richard@tinybird.com>
+In-Reply-To: <20100615152808.GA10311@night.luon.net>
+Date: Thu, 17 Jun 2010 10:15:40 +0200
+Cc: martyn@lanedo.com, micke@tinybird.com, Robert McQueen <robert.mcqueen@collabora.co.uk>, Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+Message-Id: <53541F05-0D68-41C8-B0B2-E42B56B6D862@tinybird.com>
+References: <20100615152808.GA10311@night.luon.net>
+To: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+X-Mailer: Apple Mail (2.1081)
+X-Evolution-Source: imap://cassidy@mail.collabora.co.uk/
+Content-Transfer-Encoding: 8bit
+
+Hi Sjoerd,
+
+Long time no see :) Hope everything is fine!
+
+> To be more specific we tracked the code down the follow files from Gossip:
+>    libgossip/gossip-time.c:
+>      Copyright: Imendio AB
+>      Main Author is Richard with contributions from Mikael and Martyn
+> 
+>    libgossip/gossip-log.c:
+>      Copyright: Imendio AB
+>      No main author in the license header, code mostly written by Martyn
+>      with contributions from Richard and Mikael
+
+>  So what it in the end comes down to is: would you be happy to relicense this
+>  code such that we can use it under the LGPL v2.1+ and are you able to make
+>  that decision on behalf of Imendio AB (which from a legal perspective own
+>  the copyrights ttbomk)
+
+Micke and I are fine with relicensing any Imendio and/or personally owned code in the mentioned files to LGPL v2.1+. I can make that decision on behalf of Imendio AB (now known as Tinybird Interactive AB).
+
+Cheers,
+Richard
+
+-- 
+Tinybird Interactive - Inspiring Software
+
+
+From guillaume.desmottes@collabora.co.uk Thu Jun 17 14:51:24 2010
+Subject: Relicensing of empathy-log-store-empathy to LPGL
+From: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+To: lars@metafoo.de, 84yelo3@gmail.com
+Cc: Robert McQueen <robert.mcqueen@collabora.co.uk>, Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+Content-Type: text/plain; charset="UTF-8"
+Message-ID: <1276779083.2456.12.camel@cass-x200s.lan>
+Mime-Version: 1.0
+X-Mailer: Evolution 2.28.3 
+Date: Thu, 17 Jun 2010 14:51:24 +0200
+X-Evolution-Format: text/plain
+X-Evolution-Account: 1171035114.6047.0@cass-lpt
+X-Evolution-Transport:
+ smtp://cassidy;auth=PLAIN@mail.collabora.co.uk:587/;use_ssl=when-possible
+X-Evolution-Fcc: mbox:/home/cassidy/.evolution/mail/local#Sent
+Content-Transfer-Encoding: 8bit
+
+Hi Nicolò,
+Hi Lars-Peter,
+
+As a bit of background of why i'm mailing you all, we're building a
+logger service for Telepathy. This allows any IM conversation done via
+telepathy (whether it be in gnome shell, Empathy or whatever) to be
+automagically logged. Part of this service will be a little library one
+can use for writing log viewers.
+
+The current storage backend is based on the logging code from Empathy
+which is currently GPL, which is not great for obvious reasons. Hence we
+were wondering if there is a possibility to relicense this code to LGPL
+v2.1+.
+
+Both of you contributed to empathy-log-store-empathy. Would you agree to
+relicense your contributions to LGPL v2.1+ ?
+
+Nicolò:
+http://git.gnome.org/browse/empathy/commit/?id=ee5227403193fe7b5dae7d5c15e33d8a9c385c3f
+
+Lars-Peter:
+http://git.gnome.org/browse/empathy/commit/?id=ddae3ae13b1bf6368bd91327357e3c6999ac6a45
+http://git.gnome.org/browse/empathy/commit/?id=61226f8d9920b92dd5b2defa606efabde6367b2c
+
+
+Regards,
+
+
+
+       G.
+
+
+From lars@metafoo.de Thu Jun 17 16:14:56 2010
+X-Greylist: delayed 562 seconds by postgrey-1.31 at bhuna; Thu, 17 Jun 2010
+ 16:14:56 BST
+Received: from mailhost.informatik.uni-hamburg.de
+ (mailhost.informatik.uni-hamburg.de [134.100.9.70]) (using TLSv1 with
+ cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested)
+ by bhuna.collabora.co.uk (Postfix) with ESMTPS id 241E66006C3; Thu, 17 Jun
+ 2010 16:14:56 +0100 (BST)
+Received: from localhost (localhost [127.0.0.1]) by
+ mailhost.informatik.uni-hamburg.de (Postfix) with ESMTP id 43812668; Thu,
+ 17 Jun 2010 17:05:34 +0200 (CEST)
+X-Virus-Scanned: amavisd-new at informatik.uni-hamburg.de
+Received: from mailhost.informatik.uni-hamburg.de ([127.0.0.1]) by
+ localhost (mailhost.informatik.uni-hamburg.de [127.0.0.1]) (amavisd-new,
+ port 10024) with LMTP id WhF0cb1qF-Gb; Thu, 17 Jun 2010 17:05:33 +0200
+ (CEST)
+Received: from [192.168.37.31] (port-91423.pppoe.wtnet.de [84.46.69.149])
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not
+ present a certificate) (Authenticated sender: 7clausen) by
+ mailhost.informatik.uni-hamburg.de (Postfix) with ESMTPSA id 97DE0667; Thu,
+ 17 Jun 2010 17:05:33 +0200 (CEST)
+Message-ID: <4C1A39A4.8020701@metafoo.de>
+Date: Thu, 17 Jun 2010 17:05:08 +0200
+From: Lars-Peter Clausen <lars@metafoo.de>
+User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)
+MIME-Version: 1.0
+To: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+CC: 84yelo3@gmail.com, Robert McQueen <robert.mcqueen@collabora.co.uk>,  Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+Subject: Re: Relicensing of empathy-log-store-empathy to LPGL
+References: <1276779083.2456.12.camel@cass-x200s.lan>
+In-Reply-To: <1276779083.2456.12.camel@cass-x200s.lan>
+X-Enigmail-Version: 0.95.0
+Content-Type: text/plain; charset=UTF-8
+X-Evolution-Source: imap://cassidy@mail.collabora.co.uk/
+Content-Transfer-Encoding: 8bit
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Guillaume Desmottes wrote:
+> Hi Nicolò, Hi Lars-Peter,
+>
+> [...] Both of you contributed to empathy-log-store-empathy. Would
+> you agree to relicense your contributions to LGPL v2.1+ ?
+>
+> [...]
+Hi
+
+Fine with me.
+
+- - Lars
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
+
+iEYEARECAAYFAkwaOaMACgkQBX4mSR26RiM/dQCaAzquubkWKf3jx1CyIHghWhhQ
+d6YAnRAKhP9uN+NnmhC94ayMr+BeCRul
+=B059
+-----END PGP SIGNATURE-----
+
+
+From nicolo.chieffo@gmail.com Thu Jun 17 16:24:40 2010
+Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com
+ [74.125.82.172]) by bhuna.collabora.co.uk (Postfix) with ESMTP id
+ A2E0F6006C3; Thu, 17 Jun 2010 16:24:40 +0100 (BST)
+Received: by wya21 with SMTP id 21so27253wya.31 for <multiple recipients>;
+ Thu, 17 Jun 2010 08:24:38 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
+ h=domainkey-signature:received:mime-version:sender:received
+ :in-reply-to:references:from:date:x-google-sender-auth:message-id
+ :subject:to:cc:content-type;
+ bh=hmyX3rIMLanTFUJL3nCeh5iR1GDib6JXQiw+blZttN0=;
+ b=U9/xsAQws3wrzopusunxTW9SAkHf1sBc84qe943kJ4kj9XRoSBDqrq5dC8BnLV3VNC
+ 35EIahuYTPH9FEvSh+MBgWBECTLpBUilBizoKAtC+Nj0bk9Oy9TssNi/cNG0wjGqnkPT
+ HfBHHzdktmWKEeXCWqAY6M0CryrTkNHG0AHqI=
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
+ h=mime-version:sender:in-reply-to:references:from:date
+ :x-google-sender-auth:message-id:subject:to:cc:content-type;
+ b=ppfACJwhVh5UUD4FBaNpAtvfscnd+Pz9bYgXfAY5m0BQ10BoSrWRe5/V6AoML76hDM
+ LMSvIHeusFiS/jX4S+hGIAQwK3+MkK7PXXtbiZK6IcBmmvOD1vHyESpAN6gxEIoZNVrM
+ PR8IpueImsXYO+x+IJmrFo1Pc1XTKK8A4kv70=
+Received: by 10.227.137.205 with SMTP id x13mr113184wbt.6.1276787896890;
+ Thu,  17 Jun 2010 08:18:16 -0700 (PDT)
+MIME-Version: 1.0
+Sender: nicolo.chieffo@gmail.com
+Received: by 10.216.180.78 with HTTP; Thu, 17 Jun 2010 08:17:55 -0700 (PDT)
+In-Reply-To: <4C1A39A4.8020701@metafoo.de>
+References: <1276779083.2456.12.camel@cass-x200s.lan>
+        <4C1A39A4.8020701@metafoo.de>
+From: "Nicolo' Chieffo" <84yelo3@gmail.com>
+Date: Thu, 17 Jun 2010 17:17:55 +0200
+X-Google-Sender-Auth: A9mwR_wn2kw1OycMVY0OShQudeo
+Message-ID: <AANLkTilMg-E7CbtlJOQJ-wAwO62U6z1VbeDwNaj7Xl17@mail.gmail.com>
+Subject: Re: Relicensing of empathy-log-store-empathy to LPGL
+To: Lars-Peter Clausen <lars@metafoo.de>
+Cc: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>,  Robert McQueen <robert.mcqueen@collabora.co.uk>,  Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+Content-Type: text/plain; charset=ISO-8859-1
+X-Evolution-Source: imap://cassidy@mail.collabora.co.uk/
+Content-Transfer-Encoding: 8bit
+
+I'm not a license expert so I don't exactly know why GPL is not ok for
+this log service.
+So I just trust your decision.
+
+From guillaume.desmottes@collabora.co.uk Thu Jun 17 17:26:37 2010
+Subject: Re: Relicensing of empathy-log-store-empathy to LPGL
+From: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+To: Nicolo' Chieffo <84yelo3@gmail.com>
+Cc: Lars-Peter Clausen <lars@metafoo.de>, Robert McQueen <robert.mcqueen@collabora.co.uk>, Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+In-Reply-To: <AANLkTilMg-E7CbtlJOQJ-wAwO62U6z1VbeDwNaj7Xl17@mail.gmail.com>
+References: <1276779083.2456.12.camel@cass-x200s.lan>
+        <4C1A39A4.8020701@metafoo.de>
+        <AANLkTilMg-E7CbtlJOQJ-wAwO62U6z1VbeDwNaj7Xl17@mail.gmail.com>
+Content-Type: text/plain; charset="UTF-8"
+Message-ID: <1276788396.2456.14.camel@cass-x200s.lan>
+Mime-Version: 1.0
+X-Mailer: Evolution 2.28.3 
+Date: Thu, 17 Jun 2010 17:26:37 +0200
+X-Evolution-Format: text/plain
+X-Evolution-Account: 1171035114.6047.0@cass-lpt
+X-Evolution-Transport:
+ smtp://cassidy;auth=PLAIN@mail.collabora.co.uk:587/;use_ssl=when-possible
+X-Evolution-Fcc: mbox:/home/cassidy/.evolution/mail/local#Sent
+Content-Transfer-Encoding: 8bit
+
+Le jeudi 17 juin 2010 Ă  17:17 +0200, Nicolo' Chieffo a Ă©crit :
+> I'm not a license expert so I don't exactly know why GPL is not ok for
+> this log service.
+> So I just trust your decision.
+
+We want libtelepathy-logger to be LGPL instead of GPL so non-GPL
+application can link to it.
+That's also a requirement for libraries in the GNOME platform.
+
+
+
+       G. 
+
+From nicolo.chieffo@gmail.com Thu Jun 17 16:27:58 2010
+Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com
+ [74.125.82.172]) by bhuna.collabora.co.uk (Postfix) with ESMTP id
+ 86CF86006C3 for <guillaume.desmottes@collabora.co.uk>; Thu, 17 Jun 2010
+ 16:27:58 +0100 (BST)
+Received: by wya21 with SMTP id 21so30560wya.31 for
+ <guillaume.desmottes@collabora.co.uk>; Thu, 17 Jun 2010 08:27:58 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
+ h=domainkey-signature:received:mime-version:sender:received
+ :in-reply-to:references:from:date:x-google-sender-auth:message-id
+ :subject:to:cc:content-type;
+ bh=orax0p81ikSvJkK+LpN58Qx8sL4dnVGz74R8hVjlW1o=;
+ b=f83vuoMX92uBOszQlHtOpOoe1HF13I86nNH9aiLGzZUIW8cPYJbugmn0QstVoUiUWK
+ LNqLpXTplmG4nXG4R/6V17L4agMmodI4jdc3qUQQ56rN50T+8Hek4b+rXj8ZYbXgyw7X
+ x27V5GiyWGIgrhwb5T1yDcUrwCFox8QmA65Gk=
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
+ h=mime-version:sender:in-reply-to:references:from:date
+ :x-google-sender-auth:message-id:subject:to:cc:content-type;
+ b=A3Za1Mf5DUGfRlP/NqXypn3b8TX7fP3lbsaqM8ZPVO6+TztvH38K7xzDQNMtwYa93c
+ jvWvuNbBGXgx4f1rxZekJrBYDMhPTWJZihJ/5DapW/81ru7iDRRkgEzCTrhvG6vlSjAs
+ axiXV36o28DJ2BZ0+Rsx84+VvUq316JHB9gIg=
+Received: by 10.216.165.208 with SMTP id e58mr50808wel.57.1276788477987;
+ Thu,  17 Jun 2010 08:27:57 -0700 (PDT)
+MIME-Version: 1.0
+Sender: nicolo.chieffo@gmail.com
+Received: by 10.216.180.78 with HTTP; Thu, 17 Jun 2010 08:27:37 -0700 (PDT)
+In-Reply-To: <1276788396.2456.14.camel@cass-x200s.lan>
+References: <1276779083.2456.12.camel@cass-x200s.lan>
+        <4C1A39A4.8020701@metafoo.de>
+         <AANLkTilMg-E7CbtlJOQJ-wAwO62U6z1VbeDwNaj7Xl17@mail.gmail.com>
+         <1276788396.2456.14.camel@cass-x200s.lan>
+From: "Nicolo' Chieffo" <84yelo3@gmail.com>
+Date: Thu, 17 Jun 2010 17:27:37 +0200
+X-Google-Sender-Auth: eHESWH-FxRr__2Ul8LGf0pj9RU0
+Message-ID: <AANLkTiniCDBpJLILee3X55Oodyi5OQKucK3Wr1f_G_Al@mail.gmail.com>
+Subject: Re: Relicensing of empathy-log-store-empathy to LPGL
+To: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
+Cc: Lars-Peter Clausen <lars@metafoo.de>, Robert McQueen <robert.mcqueen@collabora.co.uk>,  Sjoerd Simons <sjoerd.simons@collabora.co.uk>
+Content-Type: text/plain; charset=ISO-8859-1
+X-Evolution-Source: imap://cassidy@mail.collabora.co.uk/
+Content-Transfer-Encoding: 8bit
+
+OK!
+
index 8e09f4dea4354f3f7a539ab347868f03b8ce32bd..edee9e07ea6c66dab730566d859b62331efad18a 100644 (file)
@@ -29,11 +29,11 @@ AC_COPYRIGHT([
 ])
 
 # Minimal version required
-GLIB_REQUIRED=2.22.0
+GLIB_REQUIRED=2.25.9
 GTK_REQUIRED=2.21.2
 GCONF_REQUIRED=1.2.0
 TELEPATHY_GLIB_REQUIRED=0.11.7
-TELEPATHY_LOGGER=0.1.1
+TELEPATHY_LOGGER=0.1.2
 ENCHANT_REQUIRED=1.2.0
 ISO_CODES_REQUIRED=0.35
 LIBNOTIFY_REQUIRED=0.4.4
@@ -82,8 +82,7 @@ IT_PROG_INTLTOOL([0.35.0])
 GNOME_DOC_INIT([0.17.3])
 IDT_COMPILE_WARNINGS
 AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
-AM_GCONF_SOURCE_2
+GLIB_GSETTINGS
 GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
 AC_SUBST(GLIB_GENMARSHAL)
 CONTROL_CENTER_EXTENSIONDIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center-extension`
@@ -137,30 +136,6 @@ AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-d
 
 AC_SUBST(ERROR_CFLAGS)
 
-# -----------------------------------------------------------
-# Enable TPL
-# -----------------------------------------------------------
-
-# It needs to be defined before PKG_CHECK_MODULES calls
-AC_ARG_ENABLE(tpl,
-  AC_HELP_STRING([--enable-tpl],[enable telepathy-logger code and disable the
-    empathy logger]), enable_tpl=$enableval, enable_tpl=no )
-AM_CONDITIONAL(ENABLE_TPL, test "x$enable_tpl" = "xyes")
-
-if test x${enable_tpl} = xyes; then
-  AC_DEFINE(ENABLE_TPL, [], [Enable TPL code])
-fi
-
-if test "x$enable_tpl" = "xyes"; then
-  PKG_CHECK_MODULES(TPL,
-  [
-     telepathy-logger = $TELEPATHY_LOGGER
-  ])
-  AC_SUBST(TPL_CFLAGS)
-  AC_SUBST(TPL_LIBS)
-fi
-
-
 # -----------------------------------------------------------
 # Pkg-Config dependency checks
 # -----------------------------------------------------------
@@ -176,6 +151,7 @@ PKG_CHECK_MODULES(LIBEMPATHY,
    telepathy-farsight
    farsight2-0.10
    gstreamer-0.10
+   telepathy-logger-0.1 >= $TELEPATHY_LOGGER
 ])
 
 PKG_CHECK_MODULES(LIBEMPATHYGTK,
@@ -191,6 +167,7 @@ PKG_CHECK_MODULES(LIBEMPATHYGTK,
    farsight2-0.10
    gstreamer-0.10
    gstreamer-interfaces-0.10
+   telepathy-logger-0.1 >= $TELEPATHY_LOGGER
 ])
 
 PKG_CHECK_MODULES(EMPATHY,
@@ -208,6 +185,7 @@ PKG_CHECK_MODULES(EMPATHY,
    gstreamer-0.10
    unique-1.0 >= $UNIQUE_REQUIRED
    gnome-keyring-1 >= $KEYRING_REQUIRED
+   telepathy-logger-0.1 >= $TELEPATHY_LOGGER
 ])
 
 PKG_CHECK_MODULES(LIBEMPATHY_ACCOUNTS_PANEL,
@@ -222,6 +200,7 @@ PKG_CHECK_MODULES(LIBEMPATHY_ACCOUNTS_PANEL,
    telepathy-glib >= $TELEPATHY_GLIB_REQUIRED
    unique-1.0 >= $UNIQUE_REQUIRED
    gnome-keyring-1 >= $KEYRING_REQUIRED
+   telepathy-logger-0.1 >= $TELEPATHY_LOGGER
 ])
 
 PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
@@ -585,9 +564,6 @@ Configure summary:
        Favourite contacts .........:  ${have_favourite_contacts}
        Control center embedding....:  ${have_control_center_embedding}
 
-    Logging:
-        Telepathy Logger............:  ${enable_tpl}
-
     Connectivity:
        NetworkManager integration..:  ${have_nm}
        ConnMan integration.........:  ${have_connman}
index 423507ea29560349bbc375fe25abc7aa323b9b94..58d6c1ba18beb906e1aaa0b23bbcc6171d54ccb3 100644 (file)
@@ -1,6 +1,7 @@
 empathy.desktop
 empathy.desktop.in
-empathy.schemas
+org.gnome.Empathy.gschema.valid
+org.gnome.Empathy.gschema.xml
 org.freedesktop.Telepathy.Client.Empathy.service
 empathy-accounts.desktop
 empathy-accounts.desktop.in
index 8ba57bd2895ce653c4c270093b68b42e0bcfd7d5..d1f00794d3187f6d2fb812773e2a42e4f7cf4711 100644 (file)
@@ -8,10 +8,16 @@ desktop_in_files = \
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
-schemasdir      = $(GCONF_SCHEMA_FILE_DIR)
-schemas_in_files = empathy.schemas.in
-schemas_DATA    = $(schemas_in_files:.schemas.in=.schemas)
-@INTLTOOL_SCHEMAS_RULE@
+gsettings_SCHEMAS = \
+       org.gnome.Empathy.gschema.xml \
+       $(NULL)
+
+@INTLTOOL_XML_NOMERGE_RULE@
+@GSETTINGS_RULES@
+
+convertdir = $(datarootdir)/GConf/gsettings
+convert_DATA = \
+       empathy.convert
 
 streamingprefsdir =  $(datadir)/empathy
 streamingprefs_DATA =          \
@@ -28,24 +34,14 @@ org.freedesktop.Telepathy.Client.Empathy.service: org.freedesktop.Telepathy.Clie
 clientfiledir = $(datarootdir)/telepathy/clients
 clientfile_DATA = Empathy.client
 
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
-       if test -z "$(DESTDIR)" ; then \
-         for p in $(schemas_DATA) ; do \
-           GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p ; \
-         done \
-       fi
-else
-install-data-local:
-endif
-
 htmldir = $(datadir)/empathy
 html_DATA = Template.html
 
 EXTRA_DIST =                           \
+       $(convert_DATA)                 \
        $(desktop_in_files)             \
        $(desktop_DATA)                 \
-       $(schemas_in_files)             \
+       $(gsettings_SCHEMAS)            \
        $(schemas_DATA)                 \
        $(streamingprefs_DATA)          \
        $(html_DATA)                    \
diff --git a/data/empathy.convert b/data/empathy.convert
new file mode 100644 (file)
index 0000000..4016965
--- /dev/null
@@ -0,0 +1,74 @@
+
+  
+[org.gnome.Empathy]
+use-conn = /apps/empathy/use_conn
+autoconnect = /apps/empathy/autoconnect
+autoaway = /apps/empathy/autoaway
+import-asked = /apps/empathy/import_asked
+butterfly-logs-migrated = /apps/empathy/butterfly_logs_migrated
+file-transfer-default-folder = /apps/empathy/file_transfer_default_folder
+
+  
+[org.gnome.Empathy.ui]
+show-offline = /apps/empathy/ui/show_offline
+show-avatars = /apps/empathy/ui/show_avatars
+show-protocols = /apps/empathy/ui/show_protocols
+compact-contact-list = /apps/empathy/ui/compact_contact_list
+main-window-hidden = /apps/empathy/ui/main_window_hidden
+avatar-directory = /apps/empathy/ui/avatar_directory
+separate-chat-windows = /apps/empathy/ui/separate_chat_windows
+chat-window-paned-pos = /apps/empathy/ui/chat_window_paned_pos
+
+  
+[org.gnome.Empathy.contacts]
+sort-criterium = /apps/empathy/contacts/sort_criterium
+
+  
+[org.gnome.Empathy.sounds]
+sounds-enabled = /apps/empathy/sounds/sounds_enabled
+sounds-disabled-away = /apps/empathy/sounds/sounds_disabled_away
+sounds-incoming-message = /apps/empathy/sounds/sounds_incoming_message
+sounds-outgoing-message = /apps/empathy/sounds/sounds_outgoing_message
+sounds-new-conversation = /apps/empathy/sounds/sounds_new_conversation
+sounds-contact-login = /apps/empathy/sounds/sounds_contact_login
+sounds-contact-logout = /apps/empathy/sounds/sounds_contact_logout
+sounds-service-login = /apps/empathy/sounds/sounds_service_login
+sounds-service-logout = /apps/empathy/sounds/sounds_service_logout
+
+  
+[org.gnome.Empathy.notifications]
+notifications-enabled = /apps/empathy/notifications/notifications_enabled
+notifications-disabled-away = /apps/empathy/notifications/notifications_disabled_away
+notifications-focus = /apps/empathy/notifications/notifications_focus
+notifications-contact-signin = /apps/empathy/notifications/notifications_contact_signin
+notifications-contact-signout = /apps/empathy/notifications/notifications_contact_signout
+
+  
+[org.gnome.Empathy.conversation]
+graphical-smileys = /apps/empathy/conversation/graphical_smileys
+show-contacts-in-rooms = /apps/empathy/conversation/show_contacts_in_rooms
+theme = /apps/empathy/conversation/theme
+adium-path = /apps/empathy/conversation/adium_path
+enable-webkit-developer-tools = /apps/empathy/conversation/enable_webkit_developer_tools
+theme-chat-room = /apps/empathy/conversation/theme_chat_room
+spell-checker-languages = /apps/empathy/conversation/spell_checker_languages
+spell-checker-enabled = /apps/empathy/conversation/spell_checker_enabled
+nick-completion-char = /apps/empathy/conversation/nick_completion_char
+avatar-in-icon = /apps/empathy/conversation/avatar_in_icon
+
+  
+[org.gnome.Empathy.hints]
+close-main-window = /apps/empathy/hints/close_main_window
+
+  
+[org.gnome.Empathy.accounts]
+imported-mc4-accounts = /apps/empathy/accounts/imported_mc4_accounts
+
+  
+[org.gnome.Empathy.location]
+publish = /apps/empathy/location/publish
+resource-network = /apps/empathy/location/resource_network
+resource-cell = /apps/empathy/location/resource_cell
+resource-gps = /apps/empathy/location/resource_gps
+reduce-accuracy = /apps/empathy/location/reduce_accuracy
+
diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in
deleted file mode 100644 (file)
index 5ed04e7..0000000
+++ /dev/null
@@ -1,651 +0,0 @@
-<gconfschemafile>
-  <schemalist>
-
-    <schema>
-      <key>/schemas/apps/empathy/ui/show_offline</key>
-      <applyto>/apps/empathy/ui/show_offline</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Show offline contacts</short>
-        <long>
-        Whether to show contacts that are offline in the contact list.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/contacts/sort_criterium</key>
-      <applyto>/apps/empathy/contacts/sort_criterium</applyto>
-      <owner>empathy</owner>
-      <type>string</type>
-      <default>state</default>
-      <locale name="C">
-        <short>Contact list sort criterion</short>
-        <long>
-        Which criterion to use when sorting the contact list.
-        Default is to sort by the contact's name with the value
-        "name". A value of "state" will sort the contact list by state.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/ui/show_avatars</key>
-      <applyto>/apps/empathy/ui/show_avatars</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Show avatars</short>
-        <long>
-        Whether to show avatars for contacts in the contact
-        list and chat windows.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/ui/show_protocols</key>
-      <applyto>/apps/empathy/ui/show_protocols</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Show protocols</short>
-        <long>
-        Whether to show protocols for contacts in the contact
-        list.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/ui/compact_contact_list</key>
-      <applyto>/apps/empathy/ui/compact_contact_list</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Compact contact list</short>
-        <long>
-        Whether to show the contact list in compact mode.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-       <key>/schemas/apps/empathy/ui/main_window_hidden</key>
-       <applyto>/apps/empathy/ui/main_window_hidden</applyto>
-       <owner>empathy</owner>
-       <type>bool</type>
-       <default>false</default>
-       <locale name="C">
-          <short>Hide main window</short>
-          <long>
-            Hide the main window.
-          </long>
-       </locale>
-    </schema>
-
-    <schema>
-       <key>/schemas/apps/empathy/ui/avatar_directory</key>
-       <applyto>/apps/empathy/ui/avatar_directory</applyto>
-       <owner>empathy</owner>
-       <type>string</type>
-       <default></default>
-       <locale name="C">
-          <short>Default directory to select an avatar image from</short>
-          <long>
-            The last directory that an avatar image was chosen from.
-          </long>
-       </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_enabled</key>
-      <applyto>/apps/empathy/sounds/sounds_enabled</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Use notification sounds</short>
-         <long>
-         Whether to play a sound to notify of events.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_disabled_away</key>
-      <applyto>/apps/empathy/sounds/sounds_disabled_away</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Disable sounds when away</short>
-         <long>
-         Whether to play sound notifications when away or busy.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_incoming_message</key>
-      <applyto>/apps/empathy/sounds/sounds_incoming_message</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Play a sound for incoming messages</short>
-         <long>
-         Whether to play a sound to notify of incoming messages.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_outgoing_message</key>
-      <applyto>/apps/empathy/sounds/sounds_outgoing_message</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Play a sound for outgoing messages</short>
-         <long>
-         Whether to play a sound to notify of outgoing messages.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_new_conversation</key>
-      <applyto>/apps/empathy/sounds/sounds_new_conversation</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Play a sound for new conversations</short>
-         <long>
-         Whether to play a sound to notify of new conversations.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_contact_login</key>
-      <applyto>/apps/empathy/sounds/sounds_contact_login</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Play a sound when a contact logs in</short>
-         <long>
-         Whether to play a sound to notify of contacts logging into the
-         network.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_contact_logout</key>
-      <applyto>/apps/empathy/sounds/sounds_contact_logout</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Play a sound when a contact logs out</short>
-         <long>
-         Whether to play a sound to notify of contacts logging out of the
-         network.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_service_login</key>
-      <applyto>/apps/empathy/sounds/sounds_service_login</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Play a sound when we log in</short>
-         <long>
-         Whether to play a sound when logging into a network.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/sounds/sounds_service_logout</key>
-      <applyto>/apps/empathy/sounds/sounds_service_logout</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Play a sound when we log out</short>
-         <long>
-         Whether to play a sound when logging out of a network.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/notifications/notifications_enabled</key>
-      <applyto>/apps/empathy/notifications/notifications_enabled</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Enable popup notifications for new messages</short>
-         <long>
-         Whether to show a popup notification when receiving a new
-         message.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/notifications/notifications_disabled_away</key>
-      <applyto>/apps/empathy/notifications/notifications_disabled_away</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Disable popup notifications when away</short>
-         <long>
-         Whether to show popup notifications when away or busy.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/notifications/notifications_focus</key>
-      <applyto>/apps/empathy/notifications/notifications_focus</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Pop up notifications if the chat isn't focused</short>
-         <long>
-         Whether to show a popup notification when receiving a new
-         message even if the chat is already opened, but not focused.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/notifications/notifications_contact_signin</key>
-      <applyto>/apps/empathy/notifications/notifications_contact_signin</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Pop up notifications when a contact logs in</short>
-         <long>
-         Whether to show a popup notification when a contact goes
-         online.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/notifications/notifications_contact_signout</key>
-      <applyto>/apps/empathy/notifications/notifications_contact_signout</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Pop up notifications when a contact logs out</short>
-         <long>
-         Whether to show a popup notification when a contact goes
-         offline.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-       <key>/schemas/apps/empathy/ui/separate_chat_windows</key>
-       <applyto>/apps/empathy/ui/separate_chat_windows</applyto>
-       <owner>empathy</owner>
-       <type>bool</type>
-       <default>false</default>
-       <locale name="C">
-          <short>Open new chats in separate windows</short>
-          <long>
-            Always open a separate chat window for new chats.
-          </long>
-       </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/graphical_smileys</key>
-      <applyto>/apps/empathy/conversation/graphical_smileys</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Use graphical smileys</short>
-         <long>
-         Whether to convert smileys into graphical images in
-         conversations.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/show_contacts_in_rooms</key>
-      <applyto>/apps/empathy/conversation/show_contacts_in_rooms</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Show contact list in rooms</short>
-         <long>
-         Whether to show the contact list in chat rooms.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/theme</key>
-      <applyto>/apps/empathy/conversation/theme</applyto>
-      <owner>empathy</owner>
-      <type>string</type>
-      <default>classic</default>
-      <locale name="C">
-         <short>Chat window theme</short>
-         <long>
-           The theme that is used to display the conversation in chat windows.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/adium_path</key>
-      <applyto>/apps/empathy/conversation/adium_path</applyto>
-      <owner>empathy</owner>
-      <type>string</type>
-      <default></default>
-      <locale name="C">
-         <short>Path of the Adium theme to use</short>
-         <long>
-           Path of the Adium theme to use if the theme used for chat is Adium.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/enable_webkit_developer_tools</key>
-      <applyto>/apps/empathy/conversation/enable_webkit_developer_tools</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-         <short>Enable WebKit Developer Tools</short>
-         <long>
-           Whether WebKit developer tools, such as the Web Inspector, should be enabled.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/theme_chat_room</key>
-      <applyto>/apps/empathy/conversation/theme_chat_room</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Use theme for chat rooms</short>
-         <long>
-           Whether to use the theme for chat rooms.
-         </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/spell_checker_languages</key>
-      <applyto>/apps/empathy/conversation/spell_checker_languages</applyto>
-      <owner>empathy</owner>
-      <type>string</type>
-      <default>en</default>
-      <locale name="C">
-        <short>Spell checking languages</short>
-        <long>
-          Comma-separated list of spell checker languages to use (e.g. "en, fr, nl").
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/spell_checker_enabled</key>
-      <applyto>/apps/empathy/conversation/spell_checker_enabled</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Enable spell checker</short>
-        <long>
-        Whether to check words typed against the languages you
-      want to check with.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/nick_completion_char</key>
-      <applyto>/apps/empathy/conversation/nick_completion_char</applyto>
-      <owner>empathy</owner>
-      <type>string</type>
-      <default>:</default>
-      <locale name="C">
-        <short>Nick completed character</short>
-        <long>
-        Character to add after nickname when using nick completion (tab)
-        in group chat.
-        </long>
-
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/conversation/avatar_in_icon</key>
-      <applyto>/apps/empathy/conversation/avatar_in_icon</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Empathy should use the avatar of the contact as the chat window icon</short>
-        <long>
-        Whether Empathy should use the avatar of the contact as the chat window icon.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/hints/close_main_window</key>
-      <applyto>/apps/empathy/hints/close_main_window</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Show hint about closing the main window</short>
-        <long>
-        Whether to show the message dialog about closing the
-      main window with the 'x' button in the title bar.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/accounts/imported_mc4_accounts</key>
-      <applyto>/apps/empathy/accounts/imported_mc4_accounts</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>MC 4 accounts have been imported</short>
-        <long>
-          MC 4 accounts have been imported.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/use_conn</key>
-      <applyto>/apps/empathy/use_conn</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Connection managers should be used</short>
-        <long>
-        Whether connectivity managers should be used to automatically
-        disconnect/reconnect.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/autoconnect</key>
-      <applyto>/apps/empathy/autoconnect</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Empathy should auto-connect on startup</short>
-        <long>
-        Whether Empathy should automatically log into your accounts on startup.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/autoaway</key>
-      <applyto>/apps/empathy/autoaway</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Empathy should auto-away when idle</short>
-        <long>
-        Whether Empathy should go into away mode automatically if user is idle.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/import_asked</key>
-      <applyto>/apps/empathy/import_asked</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Empathy has asked about importing accounts</short>
-        <long>
-        Whether Empathy has asked about importing accounts from other programs.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/butterfly_logs_migrated</key>
-      <applyto>/apps/empathy/butterfly_logs_migrated</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Empathy has migrated butterfly logs</short>
-        <long>
-        Whether Empathy has migrated butterfly logs.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/file_transfer/default_folder</key>
-      <applyto>/apps/empathy/file_transfer_default_folder</applyto>
-      <owner>empathy</owner>
-      <type>string</type>
-      <default></default>
-      <locale name="C">
-        <short>Empathy default download folder</short>
-        <long>
-        The default folder to save file transfers in.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/location/publish</key>
-      <applyto>/apps/empathy/location/publish</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Empathy can publish the user's location</short>
-        <long>
-        Whether Empathy can publish the user's location to their contacts.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/location/resource_network</key>
-      <applyto>/apps/empathy/location/resource_network</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Empathy can use the network to guess the location</short>
-        <long>
-        Whether Empathy can use the network to guess the location.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/location/resource_cell</key>
-      <applyto>/apps/empathy/location/resource_cell</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Empathy can use the cellular network to guess the location</short>
-        <long>
-        Whether Empathy can use the cellular network to guess the location.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/location/resource_gps</key>
-      <applyto>/apps/empathy/location/resource_gps</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>false</default>
-      <locale name="C">
-        <short>Empathy can use the GPS to guess the location</short>
-        <long>
-        Whether Empathy can use the GPS to guess the location.
-        </long>
-      </locale>
-    </schema>
-
-    <schema>
-      <key>/schemas/apps/empathy/location/reduce_accuracy</key>
-      <applyto>/apps/empathy/location/reduce_accuracy</applyto>
-      <owner>empathy</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-        <short>Empathy should reduce the location's accuracy</short>
-        <long>
-        Whether Empathy should reduce the location's accuracy for privacy reasons.
-        </long>
-      </locale>
-    </schema>
-
-  </schemalist>  
-</gconfschemafile>
diff --git a/data/org.gnome.Empathy.gschema.xml.in b/data/org.gnome.Empathy.gschema.xml.in
new file mode 100644 (file)
index 0000000..6075308
--- /dev/null
@@ -0,0 +1,258 @@
+<schemalist>
+  <schema id="org.gnome.Empathy" path="/apps/empathy/">
+    <key name="use-conn" type="b">
+      <default>true</default>
+      <_summary>Connection managers should be used</_summary>
+      <_description>Whether connectivity managers should be used to automatically disconnect/reconnect.</_description>
+    </key>
+    <key name="autoconnect" type="b">
+      <default>true</default>
+      <_summary>Empathy should auto-connect on startup</_summary>
+      <_description>Whether Empathy should automatically log into your accounts on startup.</_description>
+    </key>
+    <key name="autoaway" type="b">
+      <default>true</default>
+      <_summary>Empathy should auto-away when idle</_summary>
+      <_description>Whether Empathy should go into away mode automatically if user is idle.</_description>
+    </key>
+    <key name="import-asked" type="b">
+      <default>false</default>
+      <_summary>Empathy has asked about importing accounts</_summary>
+      <_description>Whether Empathy has asked about importing accounts from other programs.</_description>
+    </key>
+    <key name="butterfly-logs-migrated" type="b">
+      <default>false</default>
+      <_summary>Empathy has migrated butterfly logs</_summary>
+      <_description>Whether Empathy has migrated butterfly logs.</_description>
+    </key>
+    <key name="file-transfer-default-folder" type="s">
+      <default>''</default>
+      <_summary>Empathy default download folder</_summary>
+      <_description>The default folder to save file transfers in.</_description>
+    </key>
+    <child name="ui" schema="org.gnome.Empathy.ui"/>
+    <child name="contacts" schema="org.gnome.Empathy.contacts"/>
+    <child name="sounds" schema="org.gnome.Empathy.sounds"/>
+    <child name="notifications" schema="org.gnome.Empathy.notifications"/>
+    <child name="conversation" schema="org.gnome.Empathy.conversation"/>
+    <child name="hints" schema="org.gnome.Empathy.hints"/>
+    <child name="accounts" schema="org.gnome.Empathy.accounts"/>
+    <child name="location" schema="org.gnome.Empathy.location"/>
+  </schema>
+  <schema id="org.gnome.Empathy.ui" path="/apps/empathy/ui/">
+    <key name="show-offline" type="b">
+      <default>true</default>
+      <_summary>Show offline contacts</_summary>
+      <_description>Whether to show contacts that are offline in the contact list.</_description>
+    </key>
+    <key name="show-avatars" type="b">
+      <default>true</default>
+      <_summary>Show avatars</_summary>
+      <_description>Whether to show avatars for contacts in the contact list and chat windows.</_description>
+    </key>
+    <key name="show-protocols" type="b">
+      <default>false</default>
+      <_summary>Show protocols</_summary>
+      <_description>Whether to show protocols for contacts in the contact list.</_description>
+    </key>
+    <key name="compact-contact-list" type="b">
+      <default>false</default>
+      <_summary>Compact contact list</_summary>
+      <_description>Whether to show the contact list in compact mode.</_description>
+    </key>
+    <key name="main-window-hidden" type="b">
+      <default>false</default>
+      <_summary>Hide main window</_summary>
+      <_description>Hide the main window.</_description>
+    </key>
+    <key name="avatar-directory" type="s">
+      <default>''</default>
+      <_summary>Default directory to select an avatar image from</_summary>
+      <_description>The last directory that an avatar image was chosen from.</_description>
+    </key>
+    <key name="separate-chat-windows" type="b">
+      <default>false</default>
+      <_summary>Open new chats in separate windows</_summary>
+      <_description>Always open a separate chat window for new chats.</_description>
+    </key>
+    <key name="chat-window-paned-pos" type="i">
+      <default>0</default>
+      <_summary>The position for the chat window side pane</_summary>
+      <_description>The stored position (in pixels) of the chat window side pane.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.contacts" path="/apps/empathy/contacts/">
+    <key name="sort-criterium" type="s">
+      <default>'state'</default>
+      <_summary>Contact list sort criterion</_summary>
+      <_description>Which criterion to use when sorting the contact list. Default is to sort by the contact's name with the value "name". A value of "state" will sort the contact list by state.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.sounds" path="/apps/empathy/sounds/">
+    <key name="sounds-enabled" type="b">
+      <default>true</default>
+      <_summary>Use notification sounds</_summary>
+      <_description>Whether to play a sound to notify of events.</_description>
+    </key>
+    <key name="sounds-disabled-away" type="b">
+      <default>true</default>
+      <_summary>Disable sounds when away</_summary>
+      <_description>Whether to play sound notifications when away or busy.</_description>
+    </key>
+    <key name="sounds-incoming-message" type="b">
+      <default>true</default>
+      <_summary>Play a sound for incoming messages</_summary>
+      <_description>Whether to play a sound to notify of incoming messages.</_description>
+    </key>
+    <key name="sounds-outgoing-message" type="b">
+      <default>false</default>
+      <_summary>Play a sound for outgoing messages</_summary>
+      <_description>Whether to play a sound to notify of outgoing messages.</_description>
+    </key>
+    <key name="sounds-new-conversation" type="b">
+      <default>true</default>
+      <_summary>Play a sound for new conversations</_summary>
+      <_description>Whether to play a sound to notify of new conversations.</_description>
+    </key>
+    <key name="sounds-contact-login" type="b">
+      <default>false</default>
+      <_summary>Play a sound when a contact logs in</_summary>
+      <_description>Whether to play a sound to notify of contacts logging into the network.</_description>
+    </key>
+    <key name="sounds-contact-logout" type="b">
+      <default>false</default>
+      <_summary>Play a sound when a contact logs out</_summary>
+      <_description>Whether to play a sound to notify of contacts logging out of the network.</_description>
+    </key>
+    <key name="sounds-service-login" type="b">
+      <default>false</default>
+      <_summary>Play a sound when we log in</_summary>
+      <_description>Whether to play a sound when logging into a network.</_description>
+    </key>
+    <key name="sounds-service-logout" type="b">
+      <default>false</default>
+      <_summary>Play a sound when we log out</_summary>
+      <_description>Whether to play a sound when logging out of a network.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.notifications" path="/apps/empathy/notifications/">
+    <key name="notifications-enabled" type="b">
+      <default>true</default>
+      <_summary>Enable popup notifications for new messages</_summary>
+      <_description>Whether to show a popup notification when receiving a new message.</_description>
+    </key>
+    <key name="notifications-disabled-away" type="b">
+      <default>true</default>
+      <_summary>Disable popup notifications when away</_summary>
+      <_description>Whether to show popup notifications when away or busy.</_description>
+    </key>
+    <key name="notifications-focus" type="b">
+      <default>false</default>
+      <_summary>Pop up notifications if the chat isn't focused</_summary>
+      <_description>Whether to show a popup notification when receiving a new message even if the chat is already opened, but not focused.</_description>
+    </key>
+    <key name="notifications-contact-signin" type="b">
+      <default>false</default>
+      <_summary>Pop up notifications when a contact logs in</_summary>
+      <_description>Whether to show a popup notification when a contact goes online.</_description>
+    </key>
+    <key name="notifications-contact-signout" type="b">
+      <default>false</default>
+      <_summary>Pop up notifications when a contact logs out</_summary>
+      <_description>Whether to show a popup notification when a contact goes offline.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.conversation" path="/apps/empathy/conversation/">
+    <key name="graphical-smileys" type="b">
+      <default>true</default>
+      <_summary>Use graphical smileys</_summary>
+      <_description>Whether to convert smileys into graphical images in conversations.</_description>
+    </key>
+    <key name="show-contacts-in-rooms" type="b">
+      <default>true</default>
+      <_summary>Show contact list in rooms</_summary>
+      <_description>Whether to show the contact list in chat rooms.</_description>
+    </key>
+    <key name="theme" type="s">
+      <default>'classic'</default>
+      <_summary>Chat window theme</_summary>
+      <_description>The theme that is used to display the conversation in chat windows.</_description>
+    </key>
+    <key name="adium-path" type="s">
+      <default>''</default>
+      <_summary>Path of the Adium theme to use</_summary>
+      <_description>Path of the Adium theme to use if the theme used for chat is Adium.</_description>
+    </key>
+    <key name="enable-webkit-developer-tools" type="b">
+      <default>false</default>
+      <_summary>Enable WebKit Developer Tools</_summary>
+      <_description>Whether WebKit developer tools, such as the Web Inspector, should be enabled.</_description>
+    </key>
+    <key name="theme-chat-room" type="b">
+      <default>true</default>
+      <_summary>Use theme for chat rooms</_summary>
+      <_description>Whether to use the theme for chat rooms.</_description>
+    </key>
+    <key name="spell-checker-languages" type="s">
+      <default>'en'</default>
+      <_summary>Spell checking languages</_summary>
+      <_description>Comma-separated list of spell checker languages to use (e.g. "en, fr, nl").</_description>
+    </key>
+    <key name="spell-checker-enabled" type="b">
+      <default>true</default>
+      <_summary>Enable spell checker</_summary>
+      <_description>Whether to check words typed against the languages you want to check with.</_description>
+    </key>
+    <key name="nick-completion-char" type="s">
+      <default>':'</default>
+      <_summary>Nick completed character</_summary>
+      <_description>Character to add after nickname when using nick completion (tab) in group chat.</_description>
+    </key>
+    <key name="avatar-in-icon" type="b">
+      <default>false</default>
+      <_summary>Empathy should use the avatar of the contact as the chat window icon</_summary>
+      <_description>Whether Empathy should use the avatar of the contact as the chat window icon.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.hints" path="/apps/empathy/hints/">
+    <key name="close-main-window" type="b">
+      <default>true</default>
+      <_summary>Show hint about closing the main window</_summary>
+      <_description>Whether to show the message dialog about closing the main window with the 'x' button in the title bar.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.accounts" path="/apps/empathy/accounts/">
+    <key name="imported-mc4-accounts" type="b">
+      <default>false</default>
+      <_summary>MC 4 accounts have been imported</_summary>
+      <_description>MC 4 accounts have been imported.</_description>
+    </key>
+  </schema>
+  <schema id="org.gnome.Empathy.location" path="/apps/empathy/location/">
+    <key name="publish" type="b">
+      <default>false</default>
+      <_summary>Empathy can publish the user's location</_summary>
+      <_description>Whether Empathy can publish the user's location to their contacts.</_description>
+    </key>
+    <key name="resource-network" type="b">
+      <default>true</default>
+      <_summary>Empathy can use the network to guess the location</_summary>
+      <_description>Whether Empathy can use the network to guess the location.</_description>
+    </key>
+    <key name="resource-cell" type="b">
+      <default>true</default>
+      <_summary>Empathy can use the cellular network to guess the location</_summary>
+      <_description>Whether Empathy can use the cellular network to guess the location.</_description>
+    </key>
+    <key name="resource-gps" type="b">
+      <default>false</default>
+      <_summary>Empathy can use the GPS to guess the location</_summary>
+      <_description>Whether Empathy can use the GPS to guess the location.</_description>
+    </key>
+    <key name="reduce-accuracy" type="b">
+      <default>true</default>
+      <_summary>Empathy should reduce the location's accuracy</_summary>
+      <_description>Whether Empathy should reduce the location's accuracy for privacy reasons.</_description>
+    </key>
+  </schema>
+</schemalist>
index 377929adcc46577f200739591b1a9484f2a1bb18..43763d56c0fb8ab24d126346ec18098ab9098ac7 100644 (file)
@@ -7,7 +7,6 @@ AM_CPPFLAGS =                                           \
        -DDATADIR=\""$(datadir)"\"                      \
        -DPKGDATADIR=\""$(pkgdatadir)"\"                \
        $(LIBEMPATHYGTK_CFLAGS)                         \
-       $(TPL_CFLAGS)                                   \
        $(LIBNOTIFY_CFLAGS)                             \
        $(ENCHANT_CFLAGS)                               \
        $(LIBCHAMPLAIN_CFLAGS)                          \
@@ -42,7 +41,6 @@ libempathy_gtk_handwritten_source =                   \
        empathy-chat-text-view.c                \
        empathy-chat-view.c                     \
        empathy-chat.c                          \
-       empathy-conf.c                          \
        empathy-contact-dialogs.c               \
        empathy-contact-list-store.c            \
        empathy-contact-list-view.c             \
@@ -89,7 +87,6 @@ libempathy_gtk_headers =                      \
        empathy-chat-text-view.h                \
        empathy-chat-view.h                     \
        empathy-chat.h                          \
-       empathy-conf.h                          \
        empathy-contact-dialogs.h               \
        empathy-contact-list-store.h            \
        empathy-contact-list-view.h             \
@@ -134,7 +131,6 @@ nodist_libempathy_gtk_la_SOURCES =\
 libempathy_gtk_la_LIBADD =                     \
        $(LIBEMPATHYGTK_LIBS)                   \
        $(LIBNOTIFY_LIBS)                       \
-       $(TPL_LIBS)                             \
        $(ENCHANT_LIBS)                         \
        $(LIBCHAMPLAIN_LIBS)                    \
        $(GEOCLUE_LIBS)                         \
index 7a39f65f1b27a70b5b52fa966971b3e553c2d5aa..552e45dfecc9960374721079e29bb236accaf9d8 100644 (file)
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-avatar-chooser.h"
-#include "empathy-conf.h"
 #include "empathy-images.h"
 #include "empathy-ui-utils.h"
 
@@ -895,10 +895,14 @@ avatar_chooser_response_cb (GtkWidget            *widget,
 
                path = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (widget));
                if (path) {
-                       empathy_conf_set_string (empathy_conf_get (),
-                                                EMPATHY_PREFS_UI_AVATAR_DIRECTORY,
-                                                path);
+                       GSettings *gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
+
+                       g_settings_set_string (gsettings_ui,
+                                              EMPATHY_PREFS_UI_AVATAR_DIRECTORY,
+                                              path);
+
                        g_free (path);
+                       g_object_unref (gsettings_ui);
                }
        }
        else if (response == GTK_RESPONSE_NO) {
@@ -919,6 +923,7 @@ avatar_chooser_clicked_cb (GtkWidget            *button,
        const gchar    *default_dir = DEFAULT_DIR;
        const gchar    *pics_dir;
        GtkFileFilter  *filter;
+       GSettings      *gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
        EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
 
        if (priv->chooser_dialog) {
@@ -941,9 +946,9 @@ avatar_chooser_clicked_cb (GtkWidget            *button,
        gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser_dialog), TRUE);
 
        /* Get special dirs */
-       empathy_conf_get_string (empathy_conf_get (),
-                                EMPATHY_PREFS_UI_AVATAR_DIRECTORY,
-                                &saved_dir);
+       saved_dir = g_settings_get_string (gsettings_ui,
+                                          EMPATHY_PREFS_UI_AVATAR_DIRECTORY);
+
        if (saved_dir && !g_file_test (saved_dir, G_FILE_TEST_IS_DIR)) {
                g_free (saved_dir);
                saved_dir = NULL;
@@ -1007,7 +1012,9 @@ avatar_chooser_clicked_cb (GtkWidget            *button,
                          chooser);
 
        gtk_widget_show (GTK_WIDGET (chooser_dialog));
+
        g_free (saved_dir);
+       g_object_unref (gsettings_ui);
 }
 
 /**
index 0f7400f1d19974570a25b845d66642f72e602a0a..c05b92fb96dfbc40c5b4cebb5312da0a3c44d360 100644 (file)
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
 
 #include <telepathy-glib/util.h>
 
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-chat-text-view.h"
 #include "empathy-chat.h"
-#include "empathy-conf.h"
 #include "empathy-ui-utils.h"
 #include "empathy-smiley-manager.h"
 #include "empathy-string-parser.h"
@@ -68,6 +69,7 @@ typedef struct {
        time_t                last_timestamp;
        gboolean              allow_scrolling;
        guint                 notify_system_fonts_id;
+       GConfClient          *gconf_client;
        EmpathySmileyManager *smiley_manager;
        gboolean              only_if_date;
 } EmpathyChatTextViewPriv;
@@ -203,17 +205,20 @@ chat_text_view_create_tags (EmpathyChatTextView *view)
 static void
 chat_text_view_system_font_update (EmpathyChatTextView *view)
 {
+       EmpathyChatTextViewPriv *priv = GET_PRIV (view);
        PangoFontDescription *font_description = NULL;
        gchar                *font_name;
 
-       if (empathy_conf_get_string (empathy_conf_get (),
-                                    "/desktop/gnome/interface/document_font_name",
-                                    &font_name) && font_name) {
-                                            font_description = pango_font_description_from_string (font_name);
-                                            g_free (font_name);
-                                    } else {
-                                            font_description = NULL;
-                                    }
+       font_name = gconf_client_get_string (priv->gconf_client,
+                       "/desktop/gnome/interface/document_font_name",
+                       NULL);
+
+       if (font_name != NULL) {
+               font_description = pango_font_description_from_string (font_name);
+               g_free (font_name);
+       } else {
+               font_description = NULL;
+       }
 
        gtk_widget_modify_font (GTK_WIDGET (view), font_description);
 
@@ -223,9 +228,10 @@ chat_text_view_system_font_update (EmpathyChatTextView *view)
 }
 
 static void
-chat_text_view_notify_system_font_cb (EmpathyConf *conf,
-                                     const gchar *key,
-                                     gpointer     user_data)
+chat_text_view_notify_system_font_cb (GConfClient *conf,
+                                     guint id,
+                                     GConfEntry *entry,
+                                     gpointer user_data)
 {
        EmpathyChatTextView *view = user_data;
 
@@ -559,7 +565,9 @@ chat_text_view_finalize (GObject *object)
 
        DEBUG ("%p", object);
 
-       empathy_conf_notify_remove (empathy_conf_get (), priv->notify_system_fonts_id);
+       gconf_client_notify_remove (priv->gconf_client,
+                                   priv->notify_system_fonts_id);
+       g_object_unref (priv->gconf_client);
 
        if (priv->last_contact) {
                g_object_unref (priv->last_contact);
@@ -634,11 +642,16 @@ empathy_chat_text_view_init (EmpathyChatTextView *view)
                      "cursor-visible", FALSE,
                      NULL);
 
+       priv->gconf_client = gconf_client_get_default ();
+       gconf_client_add_dir (priv->gconf_client,
+                             "/desktop/gnome/interface",
+                             GCONF_CLIENT_PRELOAD_ONELEVEL,
+                             NULL);
        priv->notify_system_fonts_id =
-               empathy_conf_notify_add (empathy_conf_get (),
+               gconf_client_notify_add (priv->gconf_client,
                                         "/desktop/gnome/interface/document_font_name",
                                         chat_text_view_notify_system_font_cb,
-                                        view);
+                                        view, NULL, NULL);
        chat_text_view_system_font_update (view);
        chat_text_view_create_tags (view);
 
@@ -1405,11 +1418,13 @@ empathy_chat_text_view_append_body (EmpathyChatTextView *view,
        GtkTextIter              start_iter;
        GtkTextIter              iter;
        GtkTextMark             *mark;
+       GSettings               *gsettings_chat;
 
        /* Check if we have to parse smileys */
-       empathy_conf_get_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
-                              &use_smileys);
+       gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+       use_smileys = g_settings_get_boolean (gsettings_chat,
+                       EMPATHY_PREFS_CHAT_SHOW_SMILEYS);
+
        if (use_smileys)
                parsers = string_parsers_with_smiley;
        else
@@ -1434,6 +1449,8 @@ empathy_chat_text_view_append_body (EmpathyChatTextView *view,
                                           &iter);
 
        gtk_text_buffer_delete_mark (priv->buffer, mark);
+
+       g_object_unref (gsettings_chat);
 }
 
 void
index ae78b52cb2f1bf06bba9791322ffab3f20aec7b7..9e69c733a2422e806e2b80942a64166c13964fcf 100644 (file)
 
 #include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/util.h>
-#ifdef ENABLE_TPL
 #include <telepathy-logger/log-manager.h>
-#else
-
-#include <libempathy/empathy-log-manager.h>
-#endif /* ENABLE_TPL */
 #include <libempathy/empathy-contact-list.h>
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-dispatcher.h>
 
 #include "empathy-chat.h"
-#include "empathy-conf.h"
 #include "empathy-spell.h"
 #include "empathy-contact-list-store.h"
 #include "empathy-contact-list-view.h"
@@ -77,11 +72,10 @@ typedef struct {
        EmpathyContact    *remote_contact;
        gboolean           show_contacts;
 
-#ifdef ENABLE_TPL
+       GSettings         *gsettings_chat;
+       GSettings         *gsettings_ui;
+
        TplLogManager     *log_manager;
-#else
-       EmpathyLogManager *log_manager;
-#endif /* ENABLE_TPL */
        TpAccountManager  *account_manager;
        GList             *input_history;
        GList             *input_history_current;
@@ -104,10 +98,6 @@ typedef struct {
        gulong             delete_range_id;
        gulong             notify_cursor_position_id;
 
-       /* This stores the id for the spell checking configuration setting
-        * notification signal handler. */
-       guint              conf_notify_id;
-
        GtkWidget         *widget;
        GtkWidget         *hpaned;
        GtkWidget         *vbox_left;
@@ -1623,7 +1613,6 @@ chat_input_key_press_event_cb (GtkWidget   *widget,
                if (completed) {
                        guint        len;
                        const gchar *text;
-                       gchar       *complete_char = NULL;
                        GString     *message = NULL;
                        GList       *l;
 
@@ -1657,16 +1646,20 @@ chat_input_key_press_event_cb (GtkWidget   *widget,
 
                        gtk_text_buffer_insert_at_cursor (buffer, text, strlen (text));
 
-                       if (len == 1 && is_start_of_buffer &&
-                           empathy_conf_get_string (empathy_conf_get (),
-                                                    EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR,
-                                                    &complete_char) &&
-                           complete_char != NULL) {
+                       if (len == 1 && is_start_of_buffer) {
+                           gchar *complete_char;
+
+                           complete_char = g_settings_get_string (
+                                   priv->gsettings_chat,
+                                   EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR);
+
+                           if (complete_char != NULL) {
                                gtk_text_buffer_insert_at_cursor (buffer,
                                                                  complete_char,
                                                                  strlen (complete_char));
                                gtk_text_buffer_insert_at_cursor (buffer, " ", 1);
                                g_free (complete_char);
+                           }
                        }
 
                        g_free (completed);
@@ -1928,43 +1921,28 @@ chat_input_populate_popup_cb (GtkTextView *view,
 }
 
 
-#ifdef ENABLE_TPL
-static gboolean
-chat_log_filter (TplLogEntry *log,
-                gpointer user_data)
-#else
 static gboolean
-chat_log_filter (EmpathyMessage *message,
+chat_log_filter (TplEntry *log,
                 gpointer user_data)
-#endif /* ENABLE_TPL */
 {
        EmpathyChat *chat = user_data;
-#ifdef ENABLE_TPL
        EmpathyMessage *message;
-#endif /* ENABLE_TPL */
        EmpathyChatPriv *priv = GET_PRIV (chat);
        const GList *pending;
 
-#ifdef ENABLE_TPL
-       g_return_val_if_fail (TPL_IS_LOG_ENTRY (log), FALSE);
-#else
-       g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
-#endif /* ENABLE_TPL */
+       g_return_val_if_fail (TPL_IS_ENTRY (log), FALSE);
        g_return_val_if_fail (EMPATHY_IS_CHAT (chat), FALSE);
 
        pending = empathy_tp_chat_get_pending_messages (priv->tp_chat);
-#ifdef ENABLE_TPL
        message = empathy_message_from_tpl_log_entry (log);
-#endif /* ENABLE_TPL */
 
        for (; pending; pending = g_list_next (pending)) {
                if (empathy_message_equal (message, pending->data)) {
                        return FALSE;
                }
        }
-#ifdef ENABLE_TPL
+
        g_object_unref (message);
-#endif
        return TRUE;
 }
 
@@ -1991,7 +1969,6 @@ show_pending_messages (EmpathyChat *chat) {
 }
 
 
-#ifdef ENABLE_TPL
 static void
 got_filtered_messages_cb (GObject *manager,
                GAsyncResult *result,
@@ -2003,9 +1980,8 @@ got_filtered_messages_cb (GObject *manager,
        EmpathyChatPriv *priv = GET_PRIV (chat);
        GError *error = NULL;
 
-       messages = tpl_log_manager_get_filtered_messages_async_finish (result, &error);
-
-       if (error != NULL) {
+       if (!tpl_log_manager_get_filtered_messages_finish (TPL_LOG_MANAGER (manager),
+               result, &messages, &error)) {
                DEBUG ("%s. Aborting.", error->message);
                empathy_chat_view_append_event (chat->view,
                        _("Failed to retrieve recent logs"));
@@ -2015,7 +1991,7 @@ got_filtered_messages_cb (GObject *manager,
 
        for (l = messages; l; l = g_list_next (l)) {
                EmpathyMessage *message;
-               g_assert (TPL_IS_LOG_ENTRY (l->data));
+               g_assert (TPL_IS_ENTRY (l->data));
 
                message = empathy_message_from_tpl_log_entry (l->data);
                g_object_unref (l->data);
@@ -2038,17 +2014,12 @@ out:
        /* Turn back on scrolling */
        empathy_chat_view_scroll (chat->view, TRUE);
 }
-#endif /* ENABLE_TPL */
-
 
 static void
 chat_add_logs (EmpathyChat *chat)
 {
        EmpathyChatPriv *priv = GET_PRIV (chat);
        gboolean         is_chatroom;
-#ifndef ENABLE_TPL
-       GList           *messages, *l;
-#endif /* ENABLE_TPL */
 
        if (!priv->id) {
                return;
@@ -2060,25 +2031,6 @@ chat_add_logs (EmpathyChat *chat)
        /* Add messages from last conversation */
        is_chatroom = priv->handle_type == TP_HANDLE_TYPE_ROOM;
 
-#ifndef ENABLE_TPL
-       messages = empathy_log_manager_get_filtered_messages (priv->log_manager,
-                                                             priv->account,
-                                                             priv->id,
-                                                             is_chatroom,
-                                                             5,
-                                                             chat_log_filter,
-                                                             chat);
-
-       for (l = messages; l; l = g_list_next (l)) {
-               empathy_chat_view_append_message (chat->view, l->data);
-               g_object_unref (l->data);
-       }
-
-       g_list_free (messages);
-
-       /* Turn back on scrolling */
-       empathy_chat_view_scroll (chat->view, TRUE);
-#else
        priv->retrieving_backlogs = TRUE;
        tpl_log_manager_get_filtered_messages_async (priv->log_manager,
                                                              priv->account,
@@ -2089,7 +2041,6 @@ chat_add_logs (EmpathyChat *chat)
                                                              chat,
                                                              got_filtered_messages_cb,
                                                              (gpointer) chat);
-#endif /* ENABLE_TPL */
 }
 
 static gint
@@ -2386,7 +2337,7 @@ update_misspelled_words (gpointer data)
 }
 
 static void
-conf_spell_checking_cb (EmpathyConf *conf,
+conf_spell_checking_cb (GSettings *gsettings_chat,
                        const gchar *key,
                        gpointer user_data)
 {
@@ -2398,8 +2349,8 @@ conf_spell_checking_cb (EmpathyConf *conf,
        if (strcmp (key, EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED) != 0)
                return;
 
-       empathy_conf_get_bool (conf, EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
-                               &spell_checker);
+       spell_checker = g_settings_get_boolean (gsettings_chat,
+                       EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED);
 
        if (!empathy_spell_supported ()) {
                spell_checker = FALSE;
@@ -2471,11 +2422,16 @@ conf_spell_checking_cb (EmpathyConf *conf,
 static gboolean
 chat_hpaned_pos_changed_cb (GtkWidget* hpaned, gpointer user_data)
 {
+       GSettings *gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
        gint hpaned_pos;
+
        hpaned_pos = gtk_paned_get_position (GTK_PANED(hpaned));
-       empathy_conf_set_int (empathy_conf_get (),
-                             EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS,
-                             hpaned_pos);
+       g_settings_set_int (gsettings_chat,
+                           EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS,
+                           hpaned_pos);
+
+       g_object_unref (gsettings_chat);
+
        return TRUE;
 }
 
@@ -2552,11 +2508,10 @@ chat_create_ui (EmpathyChat *chat)
        tp_g_signal_connect_object  (buffer, "changed",
                          G_CALLBACK (chat_input_text_buffer_changed_cb),
                          chat, 0);
-       priv->conf_notify_id =
-                       empathy_conf_notify_add (empathy_conf_get (),
-                                                EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
-                                                conf_spell_checking_cb, chat);
-       conf_spell_checking_cb (empathy_conf_get (),
+       tp_g_signal_connect_object (priv->gsettings_chat,
+                       "changed::" EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
+                       G_CALLBACK (conf_spell_checking_cb), chat, 0);
+       conf_spell_checking_cb (priv->gsettings_chat,
                                EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED, chat);
        gtk_container_add (GTK_CONTAINER (priv->scrolled_window_input),
                           chat->input_text_view);
@@ -2577,10 +2532,9 @@ chat_create_ui (EmpathyChat *chat)
                          NULL);
 
         /* Load the paned position */
-       if (empathy_conf_get_int (empathy_conf_get (),
-                                EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS,
-                                &paned_pos)
-               && paned_pos)
+       paned_pos = g_settings_get_int (priv->gsettings_ui,
+                       EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS);
+       if (paned_pos != 0)
                gtk_paned_set_position (GTK_PANED(priv->hpaned), paned_pos);
 
        /* Set widget focus order */
@@ -2661,11 +2615,8 @@ chat_finalize (GObject *object)
 
        DEBUG ("Finalized: %p", object);
 
-       if (priv->conf_notify_id != 0) {
-               empathy_conf_notify_remove (empathy_conf_get (),
-                                           priv->conf_notify_id);
-               priv->conf_notify_id = 0;
-       }
+       g_object_unref (priv->gsettings_chat);
+       g_object_unref (priv->gsettings_ui);
 
        g_list_foreach (priv->input_history, (GFunc) chat_input_history_entry_free, NULL);
        g_list_free (priv->input_history);
@@ -2723,12 +2674,6 @@ chat_constructed (GObject *object)
 
        if (priv->handle_type != TP_HANDLE_TYPE_ROOM)
                chat_add_logs (chat);
-#ifndef ENABLE_TPL
-       /* When async API are involved, pending message are shown at the end of the
-        * callbacks' chain fired by chat_add_logs */
-       priv->can_show_pending = TRUE;
-       show_pending_messages (chat);
-#endif /* ENABLE_TPL */
 }
 
 static void
@@ -2871,11 +2816,10 @@ empathy_chat_init (EmpathyChat *chat)
                EMPATHY_TYPE_CHAT, EmpathyChatPriv);
 
        chat->priv = priv;
-#ifndef ENABLE_TPL
-       priv->log_manager = empathy_log_manager_dup_singleton ();
-#else
        priv->log_manager = tpl_log_manager_dup_singleton ();
-#endif /* ENABLE_TPL */
+       priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+       priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
+
        priv->contacts_width = -1;
        priv->input_history = NULL;
        priv->input_history_current = NULL;
@@ -2884,9 +2828,8 @@ empathy_chat_init (EmpathyChat *chat)
        tp_account_manager_prepare_async (priv->account_manager, NULL,
                                          account_manager_prepared_cb, chat);
 
-       empathy_conf_get_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS,
-                              &priv->show_contacts);
+       priv->show_contacts = g_settings_get_boolean (priv->gsettings_chat,
+                       EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS);
 
        /* Block events for some time to avoid having "has come online" or
         * "joined" messages. */
diff --git a/libempathy-gtk/empathy-conf.c b/libempathy-gtk/empathy-conf.c
deleted file mode 100644 (file)
index 62efa60..0000000
+++ /dev/null
@@ -1,371 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2006 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Richard Hult <richard@imendio.com>
- */
-
-#include "config.h"
-
-#include <string.h>
-
-#include <gconf/gconf-client.h>
-
-#include <libempathy/empathy-utils.h>
-#include "empathy-conf.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
-
-#define EMPATHY_CONF_ROOT       "/apps/empathy"
-#define DESKTOP_INTERFACE_ROOT  "/desktop/gnome/interface"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyConf)
-typedef struct {
-       GConfClient *gconf_client;
-} EmpathyConfPriv;
-
-typedef struct {
-       EmpathyConf           *conf;
-       EmpathyConfNotifyFunc  func;
-       gpointer               user_data;
-} EmpathyConfNotifyData;
-
-static void conf_finalize (GObject *object);
-
-G_DEFINE_TYPE (EmpathyConf, empathy_conf, G_TYPE_OBJECT);
-
-static EmpathyConf *global_conf = NULL;
-
-static void
-empathy_conf_class_init (EmpathyConfClass *class)
-{
-       GObjectClass *object_class;
-
-       object_class = G_OBJECT_CLASS (class);
-
-       object_class->finalize = conf_finalize;
-
-       g_type_class_add_private (object_class, sizeof (EmpathyConfPriv));
-}
-
-static void
-empathy_conf_init (EmpathyConf *conf)
-{
-       EmpathyConfPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (conf,
-               EMPATHY_TYPE_CONF, EmpathyConfPriv);
-
-       conf->priv = priv;
-       priv->gconf_client = gconf_client_get_default ();
-
-       gconf_client_add_dir (priv->gconf_client,
-                             EMPATHY_CONF_ROOT,
-                             GCONF_CLIENT_PRELOAD_ONELEVEL,
-                             NULL);
-       gconf_client_add_dir (priv->gconf_client,
-                             DESKTOP_INTERFACE_ROOT,
-                             GCONF_CLIENT_PRELOAD_NONE,
-                             NULL);
-}
-
-static void
-conf_finalize (GObject *object)
-{
-       EmpathyConfPriv *priv;
-
-       priv = GET_PRIV (object);
-
-       gconf_client_remove_dir (priv->gconf_client,
-                                EMPATHY_CONF_ROOT,
-                                NULL);
-       gconf_client_remove_dir (priv->gconf_client,
-                                DESKTOP_INTERFACE_ROOT,
-                                NULL);
-
-       g_object_unref (priv->gconf_client);
-
-       G_OBJECT_CLASS (empathy_conf_parent_class)->finalize (object);
-}
-
-EmpathyConf *
-empathy_conf_get (void)
-{
-       if (!global_conf) {
-               global_conf = g_object_new (EMPATHY_TYPE_CONF, NULL);
-       }
-
-       return global_conf;
-}
-
-void
-empathy_conf_shutdown (void)
-{
-       if (global_conf) {
-               g_object_unref (global_conf);
-               global_conf = NULL;
-       }
-}
-
-gboolean
-empathy_conf_set_int (EmpathyConf  *conf,
-                    const gchar *key,
-                    gint         value)
-{
-       EmpathyConfPriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       DEBUG ("Setting int:'%s' to %d", key, value);
-
-       priv = GET_PRIV (conf);
-
-       return gconf_client_set_int (priv->gconf_client,
-                                    key,
-                                    value,
-                                    NULL);
-}
-
-gboolean
-empathy_conf_get_int (EmpathyConf  *conf,
-                    const gchar *key,
-                    gint        *value)
-{
-       EmpathyConfPriv *priv;
-       GError          *error = NULL;
-
-       *value = 0;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-       g_return_val_if_fail (value != NULL, FALSE);
-
-       priv = GET_PRIV (conf);
-
-       *value = gconf_client_get_int (priv->gconf_client,
-                                      key,
-                                      &error);
-
-       if (error) {
-               g_error_free (error);
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-gboolean
-empathy_conf_set_bool (EmpathyConf  *conf,
-                     const gchar *key,
-                     gboolean     value)
-{
-       EmpathyConfPriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       DEBUG ("Setting bool:'%s' to %d ---> %s", key, value,
-               value ? "true" : "false");
-
-       priv = GET_PRIV (conf);
-
-       return gconf_client_set_bool (priv->gconf_client,
-                                     key,
-                                     value,
-                                     NULL);
-}
-
-gboolean
-empathy_conf_get_bool (EmpathyConf  *conf,
-                     const gchar *key,
-                     gboolean    *value)
-{
-       EmpathyConfPriv *priv;
-       GError          *error = NULL;
-
-       *value = FALSE;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-       g_return_val_if_fail (value != NULL, FALSE);
-
-       priv = GET_PRIV (conf);
-
-       *value = gconf_client_get_bool (priv->gconf_client,
-                                       key,
-                                       &error);
-
-       if (error) {
-               g_error_free (error);
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-gboolean
-empathy_conf_set_string (EmpathyConf  *conf,
-                       const gchar *key,
-                       const gchar *value)
-{
-       EmpathyConfPriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       DEBUG ("Setting string:'%s' to '%s'", key, value);
-
-       priv = GET_PRIV (conf);
-
-       return gconf_client_set_string (priv->gconf_client,
-                                       key,
-                                       value,
-                                       NULL);
-}
-
-gboolean
-empathy_conf_get_string (EmpathyConf   *conf,
-                       const gchar  *key,
-                       gchar       **value)
-{
-       EmpathyConfPriv *priv;
-       GError          *error = NULL;
-
-       *value = NULL;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       priv = GET_PRIV (conf);
-
-       *value = gconf_client_get_string (priv->gconf_client,
-                                         key,
-                                         &error);
-
-       if (error) {
-               g_error_free (error);
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-gboolean
-empathy_conf_set_string_list (EmpathyConf  *conf,
-                            const gchar *key,
-                            GSList      *value)
-{
-       EmpathyConfPriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       priv = GET_PRIV (conf);
-
-       return gconf_client_set_list (priv->gconf_client,
-                                     key,
-                                     GCONF_VALUE_STRING,
-                                     value,
-                                     NULL);
-}
-
-gboolean
-empathy_conf_get_string_list (EmpathyConf   *conf,
-                            const gchar  *key,
-                            GSList      **value)
-{
-       EmpathyConfPriv *priv;
-       GError          *error = NULL;
-
-       *value = NULL;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       priv = GET_PRIV (conf);
-
-       *value = gconf_client_get_list (priv->gconf_client,
-                                       key,
-                                       GCONF_VALUE_STRING,
-                                       &error);
-       if (error) {
-               g_error_free (error);
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-static void
-conf_notify_data_free (EmpathyConfNotifyData *data)
-{
-       g_object_unref (data->conf);
-       g_slice_free (EmpathyConfNotifyData, data);
-}
-
-static void
-conf_notify_func (GConfClient *client,
-                 guint        id,
-                 GConfEntry  *entry,
-                 gpointer     user_data)
-{
-       EmpathyConfNotifyData *data;
-
-       data = user_data;
-
-       data->func (data->conf,
-                   gconf_entry_get_key (entry),
-                   data->user_data);
-}
-
-guint
-empathy_conf_notify_add (EmpathyConf           *conf,
-                       const gchar          *key,
-                       EmpathyConfNotifyFunc func,
-                       gpointer              user_data)
-{
-       EmpathyConfPriv       *priv;
-       guint                  id;
-       EmpathyConfNotifyData *data;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), 0);
-
-       priv = GET_PRIV (conf);
-
-       data = g_slice_new (EmpathyConfNotifyData);
-       data->func = func;
-       data->user_data = user_data;
-       data->conf = g_object_ref (conf);
-
-       id = gconf_client_notify_add (priv->gconf_client,
-                                     key,
-                                     conf_notify_func,
-                                     data,
-                                     (GFreeFunc) conf_notify_data_free,
-                                     NULL);
-
-       return id;
-}
-
-gboolean
-empathy_conf_notify_remove (EmpathyConf *conf,
-                          guint       id)
-{
-       EmpathyConfPriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE);
-
-       priv = GET_PRIV (conf);
-
-       gconf_client_notify_remove (priv->gconf_client, id);
-
-       return TRUE;
-}
-
diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h
deleted file mode 100644 (file)
index c418bb1..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2006 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- */
-
-#ifndef __EMPATHY_CONF_H__
-#define __EMPATHY_CONF_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_CONF         (empathy_conf_get_type ())
-#define EMPATHY_CONF(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONF, EmpathyConf))
-#define EMPATHY_CONF_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONF, EmpathyConfClass))
-#define EMPATHY_IS_CONF(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONF))
-#define EMPATHY_IS_CONF_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONF))
-#define EMPATHY_CONF_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONF, EmpathyConfClass))
-
-typedef struct _EmpathyConf      EmpathyConf;
-typedef struct _EmpathyConfClass EmpathyConfClass;
-
-struct _EmpathyConf  {
-       GObject parent;
-       gpointer priv;
-};
-
-struct _EmpathyConfClass {
-       GObjectClass parent_class;
-};
-
-#define EMPATHY_PREFS_PATH "/apps/empathy"
-#define EMPATHY_PREFS_NOTIFICATIONS_ENABLED        EMPATHY_PREFS_PATH "/notifications/notifications_enabled"
-#define EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY  EMPATHY_PREFS_PATH "/notifications/notifications_disabled_away"
-#define EMPATHY_PREFS_NOTIFICATIONS_FOCUS          EMPATHY_PREFS_PATH "/notifications/notifications_focus"
-#define EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN EMPATHY_PREFS_PATH "/notifications/notifications_contact_signin"
-#define EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT EMPATHY_PREFS_PATH "/notifications/notifications_contact_signout"
-#define EMPATHY_PREFS_SOUNDS_ENABLED               EMPATHY_PREFS_PATH "/sounds/sounds_enabled"
-#define EMPATHY_PREFS_SOUNDS_DISABLED_AWAY         EMPATHY_PREFS_PATH "/sounds/sounds_disabled_away"
-#define EMPATHY_PREFS_SOUNDS_INCOMING_MESSAGE      EMPATHY_PREFS_PATH "/sounds/sounds_incoming_message"
-#define EMPATHY_PREFS_SOUNDS_OUTGOING_MESSAGE      EMPATHY_PREFS_PATH "/sounds/sounds_outgoing_message"
-#define EMPATHY_PREFS_SOUNDS_NEW_CONVERSATION      EMPATHY_PREFS_PATH "/sounds/sounds_new_conversation"
-#define EMPATHY_PREFS_SOUNDS_SERVICE_LOGIN         EMPATHY_PREFS_PATH "/sounds/sounds_service_login"
-#define EMPATHY_PREFS_SOUNDS_SERVICE_LOGOUT        EMPATHY_PREFS_PATH "/sounds/sounds_service_logout"
-#define EMPATHY_PREFS_SOUNDS_CONTACT_LOGIN         EMPATHY_PREFS_PATH "/sounds/sounds_contact_login"
-#define EMPATHY_PREFS_SOUNDS_CONTACT_LOGOUT        EMPATHY_PREFS_PATH "/sounds/sounds_contact_logout"
-#define EMPATHY_PREFS_POPUPS_WHEN_AVAILABLE        EMPATHY_PREFS_PATH "/notifications/popups_when_available"
-#define EMPATHY_PREFS_CHAT_SHOW_SMILEYS            EMPATHY_PREFS_PATH "/conversation/graphical_smileys"
-#define EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS  EMPATHY_PREFS_PATH "/conversation/show_contacts_in_rooms"
-#define EMPATHY_PREFS_CHAT_THEME                   EMPATHY_PREFS_PATH "/conversation/theme"
-#define EMPATHY_PREFS_CHAT_ADIUM_PATH              EMPATHY_PREFS_PATH "/conversation/adium_path"
-#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES EMPATHY_PREFS_PATH "/conversation/spell_checker_languages"
-#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED   EMPATHY_PREFS_PATH "/conversation/spell_checker_enabled"
-#define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR    EMPATHY_PREFS_PATH "/conversation/nick_completion_char"
-#define EMPATHY_PREFS_CHAT_AVATAR_IN_ICON          EMPATHY_PREFS_PATH "/conversation/avatar_in_icon"
-#define EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS  EMPATHY_PREFS_PATH "/conversation/enable_webkit_developer_tools"
-#define EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS     EMPATHY_PREFS_PATH "/ui/separate_chat_windows"
-#define EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN        EMPATHY_PREFS_PATH "/ui/main_window_hidden"
-#define EMPATHY_PREFS_UI_AVATAR_DIRECTORY          EMPATHY_PREFS_PATH "/ui/avatar_directory"
-#define EMPATHY_PREFS_UI_SHOW_AVATARS              EMPATHY_PREFS_PATH "/ui/show_avatars"
-#define EMPATHY_PREFS_UI_SHOW_PROTOCOLS            EMPATHY_PREFS_PATH "/ui/show_protocols"
-#define EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST      EMPATHY_PREFS_PATH "/ui/compact_contact_list"
-#define EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS     EMPATHY_PREFS_PATH "/ui/chat_window_paned_pos"
-#define EMPATHY_PREFS_UI_SHOW_OFFLINE              EMPATHY_PREFS_PATH "/ui/show_offline"
-#define EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM      EMPATHY_PREFS_PATH "/contacts/sort_criterium"
-#define EMPATHY_PREFS_HINTS_CLOSE_MAIN_WINDOW      EMPATHY_PREFS_PATH "/hints/close_main_window"
-#define EMPATHY_PREFS_USE_CONN                     EMPATHY_PREFS_PATH "/use_conn"
-#define EMPATHY_PREFS_AUTOCONNECT                  EMPATHY_PREFS_PATH "/autoconnect"
-#define EMPATHY_PREFS_AUTOAWAY                     EMPATHY_PREFS_PATH "/autoaway"
-#define EMPATHY_PREFS_IMPORT_ASKED                 EMPATHY_PREFS_PATH "/import_asked"
-#define EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED      EMPATHY_PREFS_PATH "/butterfly_logs_migrated"
-#define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER EMPATHY_PREFS_PATH "/file_transfer/default_folder"
-#define EMPATHY_PREFS_LOCATION_PUBLISH             EMPATHY_PREFS_PATH "/location/publish"
-#define EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK    EMPATHY_PREFS_PATH "/location/resource_network"
-#define EMPATHY_PREFS_LOCATION_RESOURCE_CELL       EMPATHY_PREFS_PATH "/location/resource_cell"
-#define EMPATHY_PREFS_LOCATION_RESOURCE_GPS        EMPATHY_PREFS_PATH "/location/resource_gps"
-#define EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY     EMPATHY_PREFS_PATH "/location/reduce_accuracy"
-
-typedef void (*EmpathyConfNotifyFunc) (EmpathyConf  *conf,
-                                     const gchar *key,
-                                     gpointer     user_data);
-
-GType       empathy_conf_get_type        (void) G_GNUC_CONST;
-EmpathyConf *empathy_conf_get             (void);
-void        empathy_conf_shutdown        (void);
-guint       empathy_conf_notify_add      (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        EmpathyConfNotifyFunc   func,
-                                        gpointer               data);
-gboolean    empathy_conf_notify_remove   (EmpathyConf            *conf,
-                                        guint                  id);
-gboolean    empathy_conf_set_int         (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        gint                   value);
-gboolean    empathy_conf_get_int         (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        gint                  *value);
-gboolean    empathy_conf_set_bool        (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        gboolean               value);
-gboolean    empathy_conf_get_bool        (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        gboolean              *value);
-gboolean    empathy_conf_set_string      (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        const gchar           *value);
-gboolean    empathy_conf_get_string      (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        gchar                **value);
-gboolean    empathy_conf_set_string_list (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        GSList                *value);
-gboolean    empathy_conf_get_string_list (EmpathyConf            *conf,
-                                        const gchar           *key,
-                                        GSList              **value);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_CONF_H__ */
-
index 9cc93b1914d101e66231794150eba3d8de0234cf..9ea19af32b24172b5a6a536d03e41d9618e029d6 100644 (file)
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
-#ifdef ENABLE_TPL
 #include <telepathy-logger/log-manager.h>
-#else
 
-#include <libempathy/empathy-log-manager.h>
-#endif /* ENABLE_TPL */
 #include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/empathy-dispatcher.h>
@@ -322,30 +318,19 @@ contact_log_menu_item_activate_cb (EmpathyContact *contact)
 GtkWidget *
 empathy_contact_log_menu_item_new (EmpathyContact *contact)
 {
-#ifndef ENABLE_TPL
-       EmpathyLogManager *manager;
-#else
        TplLogManager     *manager;
-#endif /* ENABLE_TPL */
        gboolean           have_log;
        GtkWidget         *item;
        GtkWidget         *image;
 
        g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
 
-#ifndef ENABLE_TPL
-       manager = empathy_log_manager_dup_singleton ();
-       have_log = empathy_log_manager_exists (manager,
-                                              empathy_contact_get_account (contact),
-                                              empathy_contact_get_id (contact),
-                                              FALSE);
-#else
        manager = tpl_log_manager_dup_singleton ();
        have_log = tpl_log_manager_exists (manager,
                                               empathy_contact_get_account (contact),
                                               empathy_contact_get_id (contact),
                                               FALSE);
-#endif /* ENABLE_TPL */
+
        g_object_unref (manager);
 
        item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations"));
index 89e0a014b0427ed5621fb1799c524a002aa83ae2..1c09c358c0cec9602464353b865a10f48174fcf1 100644 (file)
@@ -34,9 +34,9 @@
 #include <extensions/extensions.h>
 
 #include "empathy-location-manager.h"
-#include "empathy-conf.h"
 
 #include "libempathy/empathy-enum-types.h"
+#include "libempathy/empathy-gsettings.h"
 #include "libempathy/empathy-location.h"
 #include "libempathy/empathy-utils.h"
 
@@ -56,6 +56,8 @@ typedef struct {
      */
     GHashTable *location;
 
+    GSettings *gsettings_loc;
+
     GeoclueResourceFlags resources;
     GeoclueMasterClient *gc_client;
     GeocluePosition *gc_position;
@@ -106,6 +108,12 @@ location_manager_dispose (GObject *object)
     priv->account_manager = NULL;
   }
 
+  if (priv->gsettings_loc != NULL)
+  {
+    g_object_unref (priv->gsettings_loc);
+    priv->gsettings_loc = NULL;
+  }
+
   if (priv->gc_client != NULL)
   {
     g_object_unref (priv->gc_client);
@@ -198,19 +206,14 @@ publish_location (EmpathyLocationManager *self,
 {
   EmpathyLocationManagerPriv *priv = GET_PRIV (self);
   guint connection_status = -1;
-  gboolean can_publish;
-  EmpathyConf *conf = empathy_conf_get ();
 
   if (!conn)
     return;
 
   if (!force_publication)
     {
-      if (!empathy_conf_get_bool (conf, EMPATHY_PREFS_LOCATION_PUBLISH,
-            &can_publish))
-        return;
-
-      if (!can_publish)
+      if (!g_settings_get_boolean (priv->gsettings_loc,
+            EMPATHY_PREFS_LOCATION_PUBLISH))
         return;
     }
 
@@ -599,21 +602,16 @@ setup_geoclue (EmpathyLocationManager *self)
 }
 
 static void
-publish_cb (EmpathyConf *conf,
+publish_cb (GSettings *gsettings_loc,
             const gchar *key,
             gpointer user_data)
 {
   EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
   EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
-  gboolean can_publish;
 
   DEBUG ("Publish Conf changed");
 
-
-  if (!empathy_conf_get_bool (conf, key, &can_publish))
-    return;
-
-  if (can_publish)
+  if (g_settings_get_boolean (gsettings_loc, key))
     {
       if (!priv->geoclue_is_setup)
         setup_geoclue (manager);
@@ -638,20 +636,16 @@ publish_cb (EmpathyConf *conf,
 }
 
 static void
-resource_cb (EmpathyConf  *conf,
+resource_cb (GSettings *gsettings_loc,
              const gchar *key,
              gpointer user_data)
 {
   EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
   EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
   GeoclueResourceFlags resource = 0;
-  gboolean resource_enabled;
 
   DEBUG ("%s changed", key);
 
-  if (!empathy_conf_get_bool (conf, key, &resource_enabled))
-    return;
-
   if (!tp_strdiff (key, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK))
     resource = GEOCLUE_RESOURCE_NETWORK;
   if (!tp_strdiff (key, EMPATHY_PREFS_LOCATION_RESOURCE_CELL))
@@ -659,7 +653,7 @@ resource_cb (EmpathyConf  *conf,
   if (!tp_strdiff (key, EMPATHY_PREFS_LOCATION_RESOURCE_GPS))
     resource = GEOCLUE_RESOURCE_GPS;
 
-  if (resource_enabled)
+  if (g_settings_get_boolean (gsettings_loc, key))
     priv->resources |= resource;
   else
     priv->resources &= ~resource;
@@ -669,20 +663,16 @@ resource_cb (EmpathyConf  *conf,
 }
 
 static void
-accuracy_cb (EmpathyConf  *conf,
+accuracy_cb (GSettings *gsettings_loc,
              const gchar *key,
              gpointer user_data)
 {
   EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
   EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
 
-  gboolean enabled;
-
   DEBUG ("%s changed", key);
 
-  if (!empathy_conf_get_bool (conf, key, &enabled))
-    return;
-  priv->reduce_accuracy = enabled;
+  priv->reduce_accuracy = g_settings_get_boolean (gsettings_loc, key);
 
   if (!priv->geoclue_is_setup)
     return;
@@ -724,7 +714,6 @@ account_manager_prepared_cb (GObject *source_object,
 static void
 empathy_location_manager_init (EmpathyLocationManager *self)
 {
-  EmpathyConf               *conf;
   EmpathyLocationManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
       EMPATHY_TYPE_LOCATION_MANAGER, EmpathyLocationManagerPriv);
 
@@ -732,6 +721,7 @@ empathy_location_manager_init (EmpathyLocationManager *self)
   priv->geoclue_is_setup = FALSE;
   priv->location = g_hash_table_new_full (g_direct_hash, g_direct_equal,
       g_free, (GDestroyNotify) tp_g_value_slice_free);
+  priv->gsettings_loc = g_settings_new (EMPATHY_PREFS_LOCATION_SCHEMA);
 
   /* Setup account status callbacks */
   priv->account_manager = tp_account_manager_dup ();
@@ -740,23 +730,29 @@ empathy_location_manager_init (EmpathyLocationManager *self)
       account_manager_prepared_cb, self);
 
   /* Setup settings status callbacks */
-  conf = empathy_conf_get ();
-  empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_PUBLISH, publish_cb,
+  g_signal_connect (priv->gsettings_loc,
+      "changed::" EMPATHY_PREFS_LOCATION_PUBLISH,
+      G_CALLBACK (publish_cb), self);
+  g_signal_connect (priv->gsettings_loc,
+      "changed::" EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
+      G_CALLBACK (resource_cb), self);
+  g_signal_connect (priv->gsettings_loc,
+      "changed::" EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
+      G_CALLBACK (resource_cb), self);
+  g_signal_connect (priv->gsettings_loc,
+      "changed::" EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
+      G_CALLBACK (resource_cb), self);
+  g_signal_connect (priv->gsettings_loc,
+      "changed::" EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
+      G_CALLBACK (accuracy_cb), self);
+
+  resource_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
+      self);
+  resource_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_RESOURCE_CELL, self);
+  resource_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_RESOURCE_GPS, self);
+  accuracy_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
       self);
-  empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
-      resource_cb, self);
-  empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
-      resource_cb, self);
-  empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
-      resource_cb, self);
-  empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
-      accuracy_cb, self);
-
-  resource_cb (conf, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK, self);
-  resource_cb (conf, EMPATHY_PREFS_LOCATION_RESOURCE_CELL, self);
-  resource_cb (conf, EMPATHY_PREFS_LOCATION_RESOURCE_GPS, self);
-  accuracy_cb (conf, EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY, self);
-  publish_cb (conf, EMPATHY_PREFS_LOCATION_PUBLISH, self);
+  publish_cb (priv->gsettings_loc, EMPATHY_PREFS_LOCATION_PUBLISH, self);
 }
 
 EmpathyLocationManager *
index ac889fc967c529e9a1435a7b33014b8085c4ff51..04abd010217ada6feb770c245e1bc5ad0990f11b 100644 (file)
 #include <gtk/gtk.h>
 
 #include <telepathy-glib/account-manager.h>
-#ifdef ENABLE_TPL
 #include <telepathy-logger/log-manager.h>
-#endif /* ENABLE_TPL */
 
-#ifndef ENABLE_TPL
-#include <libempathy/empathy-log-manager.h>
-#endif /* ENABLE_TPL */
 #include <libempathy/empathy-chatroom-manager.h>
 #include <libempathy/empathy-chatroom.h>
 #include <libempathy/empathy-message.h>
@@ -76,11 +71,7 @@ typedef struct {
 
        gchar             *last_find;
 
-#ifndef ENABLE_TPL
-       EmpathyLogManager *log_manager;
-#else
        TplLogManager     *log_manager;
-#endif /* ENABLE_TPL */
 
        /* Those are only used while waiting for the account chooser to be ready */
        TpAccount         *selected_account;
@@ -120,7 +111,7 @@ static gboolean log_window_chats_get_selected              (EmpathyLogWindow *wi
                                                            gchar           **chat_id,
                                                            gboolean         *is_chatroom);
 static void     log_window_chats_get_messages              (EmpathyLogWindow *window,
-                                                           const gchar      *date_to_show);
+                                                           GDate      *date_to_show);
 static void     log_window_calendar_chats_day_selected_cb  (GtkWidget        *calendar,
                                                            EmpathyLogWindow *window);
 static void     log_window_calendar_chats_month_changed_cb (GtkWidget        *calendar,
@@ -215,11 +206,7 @@ empathy_log_window_show (TpAccount  *account,
        }
 
        window = g_new0 (EmpathyLogWindow, 1);
-#ifndef ENABLE_TPL
-       window->log_manager = empathy_log_manager_dup_singleton ();
-#else
        window->log_manager = tpl_log_manager_dup_singleton ();
-#endif /* ENABLE_TPL */
 
        filename = empathy_file_lookup ("empathy-log-window.ui",
                                        "libempathy-gtk");
@@ -355,7 +342,6 @@ log_window_entry_find_changed_cb (GtkWidget       *entry,
        gtk_widget_set_sensitive (window->button_find, is_sensitive);
 }
 
-#ifdef ENABLE_TPL
 static void
 got_messages_for_date_cb (GObject *manager,
                        GAsyncResult *result,
@@ -368,9 +354,8 @@ got_messages_for_date_cb (GObject *manager,
        gboolean       can_do_next;
        GError        *error = NULL;
 
-       messages = tpl_log_manager_get_messages_for_date_async_finish (result, &error);
-
-       if (error != NULL) {
+       if (!tpl_log_manager_get_messages_for_date_finish (TPL_LOG_MANAGER (manager),
+               result, &messages, &error)) {
                        DEBUG ("Unable to retrieve messages for the selected date: %s. Aborting",
                                        error->message);
                        empathy_chat_view_append_event (window->chatview_find,
@@ -382,7 +367,7 @@ got_messages_for_date_cb (GObject *manager,
        for (l = messages; l; l = l->next) {
                        EmpathyMessage *message;
 
-                       g_assert (TPL_IS_LOG_ENTRY (l->data));
+                       g_assert (TPL_IS_ENTRY (l->data));
 
                        message = empathy_message_from_tpl_log_entry (l->data);
                        g_object_unref (l->data);
@@ -411,7 +396,25 @@ got_messages_for_date_cb (GObject *manager,
        gtk_widget_set_sensitive (window->button_next, can_do_next);
        gtk_widget_set_sensitive (window->button_find, FALSE);
 }
-#endif /* ENABLE_TPL */
+
+static GDate *
+gdate_from_str (const gchar *str)
+{
+       guint u;
+       guint day, month, year;
+
+       if (sscanf (str, "%u", &u) != 1)
+               return NULL;
+
+       day = (u % 100);
+       month = ((u / 100) % 100);
+       year = (u / 10000);
+
+       if (!g_date_valid_dmy (day, month, year))
+               return NULL;
+
+       return g_date_new_dmy (day, month, year);
+}
 
 static void
 log_window_find_changed_cb (GtkTreeSelection *selection,
@@ -424,13 +427,7 @@ log_window_find_changed_cb (GtkTreeSelection *selection,
        gchar         *chat_id;
        gboolean       is_chatroom;
        gchar         *date;
-#ifndef ENABLE_TPL
-       EmpathyMessage *message;
-       GList         *messages;
-       GList         *l;
-       gboolean       can_do_previous;
-       gboolean       can_do_next;
-#endif /* ENABLE_TPL */
+       GDate         *gdate;
 
        /* Get selected information */
        view = GTK_TREE_VIEW (window->treeview_find);
@@ -462,56 +459,26 @@ log_window_find_changed_cb (GtkTreeSelection *selection,
        empathy_chat_view_scroll (window->chatview_find, FALSE);
 
        /* Get messages */
-#ifndef ENABLE_TPL
-       messages = empathy_log_manager_get_messages_for_date (window->log_manager,
-                                                             account,
-                                                             chat_id,
-                                                             is_chatroom,
-                                                             date);
-#else
-       tpl_log_manager_get_messages_for_date_async (window->log_manager,
-                                                             account,
-                                                             chat_id,
-                                                             is_chatroom,
-                                                             date,
-                                                             got_messages_for_date_cb,
-                                                             window);
-#endif /* ENABLE_TPL */
+       gdate = gdate_from_str (date);
+
+       if (gdate != NULL) {
+               tpl_log_manager_get_messages_for_date_async (window->log_manager,
+                                                                     account,
+                                                                     chat_id,
+                                                                     is_chatroom,
+                                                                     gdate,
+                                                                     got_messages_for_date_cb,
+                                                                     window);
+
+               g_date_free (gdate);
+       }
+
        g_object_unref (account);
        g_free (date);
        g_free (chat_id);
-
-#ifndef ENABLE_TPL
-       for (l = messages; l; l = l->next) {
-               message = l->data;
-               empathy_chat_view_append_message (window->chatview_find, message);
-               g_object_unref (message);
-       }
-       g_list_free (messages);
-
-       /* Scroll to the most recent messages */
-       empathy_chat_view_scroll (window->chatview_find, TRUE);
-
-       /* Highlight and find messages */
-       empathy_chat_view_highlight (window->chatview_find,
-                                   window->last_find, FALSE);
-       empathy_chat_view_find_next (window->chatview_find,
-                                   window->last_find,
-                                   TRUE,
-                                   FALSE);
-       empathy_chat_view_find_abilities (window->chatview_find,
-                                        window->last_find,
-                                        FALSE,
-                                        &can_do_previous,
-                                        &can_do_next);
-       gtk_widget_set_sensitive (window->button_previous, can_do_previous);
-       gtk_widget_set_sensitive (window->button_next, can_do_next);
-       gtk_widget_set_sensitive (window->button_find, FALSE);
-#endif /* ENABLE_TPL */
 }
 
 
-#ifdef ENABLE_TPL
 static void
 log_manager_searched_new_cb (GObject *manager,
                              GAsyncResult *result,
@@ -523,9 +490,8 @@ log_manager_searched_new_cb (GObject *manager,
        GtkListStore        *store = user_data;
        GError              *error = NULL;
 
-       hits = tpl_log_manager_search_new_async_finish (result, &error);
-
-       if (error != NULL) {
+       if (!tpl_log_manager_search_finish (TPL_LOG_MANAGER (manager), result,
+               &hits, &error)) {
                        DEBUG ("%s. Aborting", error->message);
                        g_error_free (error);
                        return;
@@ -535,7 +501,8 @@ log_manager_searched_new_cb (GObject *manager,
                        TplLogSearchHit *hit;
                        const gchar         *account_name;
                        const gchar         *account_icon;
-                       gchar               *date_readable;
+                       gchar               date_readable[255];
+                       gchar               tmp[255];
 
                        hit = l->data;
 
@@ -544,7 +511,12 @@ log_manager_searched_new_cb (GObject *manager,
                                        continue;
                        }
 
-                       date_readable = tpl_log_manager_get_date_readable (hit->date);
+                       g_date_strftime (date_readable, sizeof(date_readable),
+                               EMPATHY_TIME_FORMAT_DISPLAY_LONG, hit->date);
+
+                       g_date_strftime (tmp, sizeof(tmp),
+                               "%Y%m%d", hit->date);
+
                        account_name = tp_account_get_display_name (hit->account);
                        account_icon = tp_account_get_icon_name (hit->account);
 
@@ -556,12 +528,10 @@ log_manager_searched_new_cb (GObject *manager,
                                        COL_FIND_CHAT_NAME, hit->chat_id, /* FIXME */
                                        COL_FIND_CHAT_ID, hit->chat_id,
                                        COL_FIND_IS_CHATROOM, hit->is_chatroom,
-                                       COL_FIND_DATE, hit->date,
+                                       COL_FIND_DATE, tmp,
                                        COL_FIND_DATE_READABLE, date_readable,
                                        -1);
 
-                       g_free (date_readable);
-
                        /* FIXME: Update COL_FIND_CHAT_NAME */
                        if (hit->is_chatroom) {
                        } else {
@@ -572,24 +542,15 @@ log_manager_searched_new_cb (GObject *manager,
                        tpl_log_manager_search_free (hits);
        }
 }
-#endif /* ENABLE_TPL */
-
 
 static void
 log_window_find_populate (EmpathyLogWindow *window,
                          const gchar     *search_criteria)
 {
-#ifndef ENABLE_TPL
-       GList              *hits, *l;
-
-#endif /* ENABLE_TPL */
        GtkTreeView        *view;
        GtkTreeModel       *model;
        GtkTreeSelection   *selection;
        GtkListStore       *store;
-#ifndef ENABLE_TPL
-       GtkTreeIter         iter;
-#endif /* ENABLE_TPL */
 
        view = GTK_TREE_VIEW (window->treeview_find);
        model = gtk_tree_view_get_model (view);
@@ -605,53 +566,8 @@ log_window_find_populate (EmpathyLogWindow *window,
                return;
        }
 
-#ifdef ENABLE_TPL
-       tpl_log_manager_search_new_async (window->log_manager, search_criteria,
+       tpl_log_manager_search_async (window->log_manager, search_criteria,
                        log_manager_searched_new_cb, (gpointer) store);
-#else
-       hits = empathy_log_manager_search_new (window->log_manager, search_criteria);
-
-       for (l = hits; l; l = l->next) {
-               EmpathyLogSearchHit *hit;
-               const gchar         *account_name;
-               const gchar         *account_icon;
-               gchar               *date_readable;
-
-               hit = l->data;
-
-               /* Protect against invalid data (corrupt or old log files. */
-               if (!hit->account || !hit->chat_id) {
-                       continue;
-               }
-
-               date_readable = empathy_log_manager_get_date_readable (hit->date);
-               account_name = tp_account_get_display_name (hit->account);
-               account_icon = tp_account_get_icon_name (hit->account);
-
-               gtk_list_store_append (store, &iter);
-               gtk_list_store_set (store, &iter,
-                                   COL_FIND_ACCOUNT_ICON, account_icon,
-                                   COL_FIND_ACCOUNT_NAME, account_name,
-                                   COL_FIND_ACCOUNT, hit->account,
-                                   COL_FIND_CHAT_NAME, hit->chat_id, /* FIXME */
-                                   COL_FIND_CHAT_ID, hit->chat_id,
-                                   COL_FIND_IS_CHATROOM, hit->is_chatroom,
-                                   COL_FIND_DATE, hit->date,
-                                   COL_FIND_DATE_READABLE, date_readable,
-                                   -1);
-
-               g_free (date_readable);
-
-               /* FIXME: Update COL_FIND_CHAT_NAME */
-               if (hit->is_chatroom) {
-               } else {
-               }
-       }
-
-       if (hits) {
-               empathy_log_manager_search_free (hits);
-       }
-#endif /* ENABLE_TPL */
 }
 
 static void
@@ -830,7 +746,6 @@ log_window_chats_changed_cb (GtkTreeSelection *selection,
        log_window_chats_get_messages (window, NULL);
 }
 
-#ifdef ENABLE_TPL
 static void
 log_manager_got_chats_cb (GObject *manager,
                        GAsyncResult *result,
@@ -848,9 +763,8 @@ log_manager_got_chats_cb (GObject *manager,
        GtkTreeIter            iter;
        GError                *error = NULL;
 
-       chats = tpl_log_manager_get_chats_async_finish (result, &error);
-
-       if (error != NULL) {
+       if (!tpl_log_manager_get_chats_finish (TPL_LOG_MANAGER (manager),
+               result, &chats, &error)) {
                        DEBUG ("%s. Aborting", error->message);
                        g_error_free (error);
                        return;
@@ -892,25 +806,17 @@ log_manager_got_chats_cb (GObject *manager,
 
        g_object_unref (account);
 }
-#endif /* ENABLE_TPL */
-
 
 static void
 log_window_chats_populate (EmpathyLogWindow *window)
 {
        EmpathyAccountChooser *account_chooser;
        TpAccount             *account;
-#ifndef ENABLE_TPL
-       GList                *chats, *l;
-#endif /* ENABLE_TPL */
 
        GtkTreeView          *view;
        GtkTreeModel         *model;
        GtkTreeSelection     *selection;
        GtkListStore         *store;
-#ifndef ENABLE_TPL
-       GtkTreeIter           iter;
-#endif /* ENABLE_TPL */
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats);
        account = empathy_account_chooser_dup_account (account_chooser);
@@ -932,40 +838,8 @@ log_window_chats_populate (EmpathyLogWindow *window)
 
        gtk_list_store_clear (store);
 
-#ifdef ENABLE_TPL
        tpl_log_manager_get_chats_async (window->log_manager, account,
                        log_manager_got_chats_cb, (gpointer) window);
-#else
-       chats = empathy_log_manager_get_chats (window->log_manager, account);
-       for (l = chats; l; l = l->next) {
-               EmpathyLogSearchHit *hit;
-
-               hit = l->data;
-
-               gtk_list_store_append (store, &iter);
-               gtk_list_store_set (store, &iter,
-                                   COL_CHAT_ICON, "empathy-available", /* FIXME */
-                                   COL_CHAT_NAME, hit->chat_id,
-                                   COL_CHAT_ACCOUNT, account,
-                                   COL_CHAT_ID, hit->chat_id,
-                                   COL_CHAT_IS_CHATROOM, hit->is_chatroom,
-                                   -1);
-
-               /* FIXME: Update COL_CHAT_ICON/NAME */
-               if (hit->is_chatroom) {
-               } else {
-               }
-       }
-       empathy_log_manager_search_free (chats);
-
-       /* Unblock signals */
-       g_signal_handlers_unblock_by_func (selection,
-                                          log_window_chats_changed_cb,
-                                          window);
-
-
-       g_object_unref (account);
-#endif /* ENABLE_TPL */
 }
 
 static void
@@ -1135,7 +1009,6 @@ log_window_chats_get_selected (EmpathyLogWindow  *window,
        return TRUE;
 }
 
-#ifdef ENABLE_TPL
 static void
 log_window_got_messages_for_date_cb (GObject *manager,
     GAsyncResult *result,
@@ -1146,9 +1019,8 @@ log_window_got_messages_for_date_cb (GObject *manager,
   GList *l;
   GError *error = NULL;
 
-  messages = tpl_log_manager_get_messages_for_date_async_finish (result, &error);
-
-  if (error != NULL) {
+  if (!tpl_log_manager_get_messages_for_date_finish (TPL_LOG_MANAGER (manager),
+        result, &messages, &error)) {
       DEBUG ("Unable to retrieve messages for the selected date: %s. Aborting",
           error->message);
       empathy_chat_view_append_event (window->chatview_find,
@@ -1176,7 +1048,7 @@ log_window_got_messages_for_date_cb (GObject *manager,
 
 static void
 log_window_get_messages_for_date (EmpathyLogWindow *window,
-                                 const gchar *date)
+                                 GDate *date)
 {
   TpAccount *account;
   gchar *chat_id;
@@ -1213,17 +1085,13 @@ log_manager_got_dates_cb (GObject *manager,
   GList         *dates;
   GList         *l;
   guint          year_selected;
-  guint          year;
-  guint          month;
   guint          month_selected;
-  guint          day;
   gboolean       day_selected = FALSE;
-  const gchar   *date = NULL;
+  GDate         *date = NULL;
   GError        *error = NULL;
 
-  dates = tpl_log_manager_get_dates_async_finish (result, &error);
-
-  if (error != NULL) {
+  if (!tpl_log_manager_get_dates_finish (TPL_LOG_MANAGER (manager),
+        result, &dates, &error)) {
     DEBUG ("Unable to retrieve messages' dates: %s. Aborting",
         error->message);
     empathy_chat_view_append_event (window->chatview_find,
@@ -1232,14 +1100,8 @@ log_manager_got_dates_cb (GObject *manager,
   }
 
   for (l = dates; l; l = l->next) {
-      const gchar *str;
-
-      str = l->data;
-      if (!str) {
-          continue;
-      }
+      GDate *d = l->data;
 
-      sscanf (str, "%4d%2d%2d", &year, &month, &day);
       gtk_calendar_get_date (GTK_CALENDAR (window->calendar_chats),
           &year_selected,
           &month_selected,
@@ -1248,15 +1110,19 @@ log_manager_got_dates_cb (GObject *manager,
       month_selected++;
 
       if (!l->next) {
-          date = str;
+          date = d;
       }
 
-      if (year != year_selected || month != month_selected) {
+      if (g_date_get_year (d) != year_selected ||
+          g_date_get_month (d) != month_selected) {
           continue;
       }
 
-      DEBUG ("Marking date:'%s'", str);
-      gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
+      DEBUG ("Marking date: %04u-%02u-%02u", g_date_get_year (d),
+          g_date_get_month (d), g_date_get_day (d));
+
+      gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats),
+          g_date_get_day (d));
 
       if (l->next) {
           continue;
@@ -1264,7 +1130,8 @@ log_manager_got_dates_cb (GObject *manager,
 
       day_selected = TRUE;
 
-      gtk_calendar_select_day (GTK_CALENDAR (window->calendar_chats), day);
+      gtk_calendar_select_day (GTK_CALENDAR (window->calendar_chats),
+          g_date_get_day (d));
   }
 
   if (!day_selected) {
@@ -1287,15 +1154,12 @@ log_manager_got_dates_cb (GObject *manager,
 
 static void
 log_window_chats_get_messages (EmpathyLogWindow *window,
-                              const gchar     *date_to_show)
+                              GDate     *date)
 {
        TpAccount     *account;
        gchar         *chat_id;
        gboolean       is_chatroom;
-       const gchar   *date;
        guint          year_selected;
-       guint          year;
-       guint          month;
        guint          month_selected;
        guint          day;
 
@@ -1310,8 +1174,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
                                         window);
 
        /* Either use the supplied date or get the last */
-       date = date_to_show;
-       if (!date) {
+       if (date == NULL) {
                /* Get a list of dates and show them on the calendar */
                tpl_log_manager_get_dates_async (window->log_manager,
                                                       account, chat_id,
@@ -1319,7 +1182,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
                                                       log_manager_got_dates_cb, (gpointer) window);
     /* signal unblocked at the end of the CB flow */
        } else {
-               sscanf (date, "%4d%2d%2d", &year, &month, &day);
+               day = g_date_get_day (date);
                gtk_calendar_get_date (GTK_CALENDAR (window->calendar_chats),
                                &year_selected,
                                &month_selected,
@@ -1327,7 +1190,8 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
 
                month_selected++;
 
-               if (year != year_selected && month != month_selected) {
+               if (g_date_get_year (date) != year_selected &&
+                       g_date_get_month (date) != month_selected) {
                        day = 0;
                }
 
@@ -1338,7 +1202,7 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
         window);
        }
 
-       if (date) {
+       if (date != NULL) {
       log_window_get_messages_for_date (window, date);
        }
 
@@ -1346,146 +1210,6 @@ log_window_chats_get_messages (EmpathyLogWindow *window,
        g_free (chat_id);
 }
 
-#else
-
-static void
-log_window_chats_get_messages (EmpathyLogWindow *window,
-                              const gchar     *date_to_show)
-{
-       TpAccount     *account;
-       gchar         *chat_id;
-       gboolean       is_chatroom;
-       EmpathyMessage *message;
-       GList         *messages;
-       GList         *dates = NULL;
-       GList         *l;
-       const gchar   *date;
-       guint          year_selected;
-       guint          year;
-       guint          month;
-       guint          month_selected;
-       guint          day;
-
-       if (!log_window_chats_get_selected (window, &account,
-                                           &chat_id, &is_chatroom)) {
-               return;
-       }
-
-       g_signal_handlers_block_by_func (window->calendar_chats,
-                                        log_window_calendar_chats_day_selected_cb,
-                                        window);
-
-       /* Either use the supplied date or get the last */
-       date = date_to_show;
-       if (!date) {
-               gboolean day_selected = FALSE;
-
-               /* Get a list of dates and show them on the calendar */
-               dates = empathy_log_manager_get_dates (window->log_manager,
-                                                      account, chat_id,
-                                                      is_chatroom);
-
-               for (l = dates; l; l = l->next) {
-                       const gchar *str;
-
-                       str = l->data;
-                       if (!str) {
-                               continue;
-                       }
-
-                       sscanf (str, "%4d%2d%2d", &year, &month, &day);
-                       gtk_calendar_get_date (GTK_CALENDAR (window->calendar_chats),
-                                              &year_selected,
-                                              &month_selected,
-                                              NULL);
-
-                       month_selected++;
-
-                       if (!l->next) {
-                               date = str;
-                       }
-
-                       if (year != year_selected || month != month_selected) {
-                               continue;
-                       }
-
-
-                       DEBUG ("Marking date:'%s'", str);
-                       gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
-
-                       if (l->next) {
-                               continue;
-                       }
-
-                       day_selected = TRUE;
-
-                       gtk_calendar_select_day (GTK_CALENDAR (window->calendar_chats), day);
-               }
-
-               if (!day_selected) {
-                       /* Unselect the day in the calendar */
-                       gtk_calendar_select_day (GTK_CALENDAR (window->calendar_chats), 0);
-               }
-       } else {
-               sscanf (date, "%4d%2d%2d", &year, &month, &day);
-               gtk_calendar_get_date (GTK_CALENDAR (window->calendar_chats),
-                                      &year_selected,
-                                      &month_selected,
-                                      NULL);
-
-               month_selected++;
-
-               if (year != year_selected && month != month_selected) {
-                       day = 0;
-               }
-
-               gtk_calendar_select_day (GTK_CALENDAR (window->calendar_chats), day);
-       }
-
-       g_signal_handlers_unblock_by_func (window->calendar_chats,
-                                          log_window_calendar_chats_day_selected_cb,
-                                          window);
-
-       if (!date) {
-               goto OUT;
-       }
-
-       /* Clear all current messages shown in the textview */
-       empathy_chat_view_clear (window->chatview_chats);
-
-       /* Turn off scrolling temporarily */
-       empathy_chat_view_scroll (window->chatview_find, FALSE);
-
-       /* Get messages */
-       messages = empathy_log_manager_get_messages_for_date (window->log_manager,
-                                                             account, chat_id,
-                                                             is_chatroom,
-                                                             date);
-
-       for (l = messages; l; l = l->next) {
-               message = l->data;
-
-               empathy_chat_view_append_message (window->chatview_chats,
-                                                message);
-               g_object_unref (message);
-       }
-       g_list_free (messages);
-
-       /* Turn back on scrolling */
-       empathy_chat_view_scroll (window->chatview_find, TRUE);
-
-       /* Give the search entry main focus */
-       gtk_widget_grab_focus (window->entry_chats);
-
-OUT:
-       g_list_foreach (dates, (GFunc) g_free, NULL);
-       g_list_free (dates);
-       g_object_unref (account);
-       g_free (chat_id);
-}
-
-#endif /* ENABLE_TPL */
-
 static void
 log_window_calendar_chats_day_selected_cb (GtkWidget       *calendar,
                                           EmpathyLogWindow *window)
@@ -1493,25 +1217,25 @@ log_window_calendar_chats_day_selected_cb (GtkWidget       *calendar,
        guint  year;
        guint  month;
        guint  day;
-
-       gchar *date;
+       GDate *date;
 
        gtk_calendar_get_date (GTK_CALENDAR (calendar), &year, &month, &day);
+       if (day == 0)
+               /* No date selected */
+               return;
 
        /* We need this hear because it appears that the months start from 0 */
        month++;
 
-       date = g_strdup_printf ("%4.4d%2.2d%2.2d", year, month, day);
+       date = g_date_new_dmy (day, month, year);
 
-       DEBUG ("Currently selected date is:'%s'", date);
+       DEBUG ("Currently selected date is: %04u-%02u-%02u", year, month, day);
 
        log_window_chats_get_messages (window, date);
 
-       g_free (date);
+       g_date_free (date);
 }
 
-
-#ifdef ENABLE_TPL
 static void
 log_window_updating_calendar_month_cb (GObject *manager,
                GAsyncResult *result, gpointer user_data)
@@ -1523,9 +1247,8 @@ log_window_updating_calendar_month_cb (GObject *manager,
        guint                                    month_selected;
        GError                          *error = NULL;
 
-       dates = tpl_log_manager_get_dates_async_finish (result, &error);
-
-       if (error != NULL) {
+       if (!tpl_log_manager_get_dates_finish (TPL_LOG_MANAGER (manager),
+               result, &dates, &error)) {
                        DEBUG ("Unable to retrieve messages' dates: %s. Aborting",
                                        error->message);
                        empathy_chat_view_append_event (window->chatview_find,
@@ -1544,21 +1267,13 @@ log_window_updating_calendar_month_cb (GObject *manager,
        month_selected++;
 
        for (l = dates; l; l = l->next) {
-                       const gchar *str;
-                       guint        year;
-                       guint        month;
-                       guint        day;
-
-                       str = l->data;
-                       if (!str) {
-                                       continue;
-                       }
+                       GDate *date = l->data;
 
-                       sscanf (str, "%4d%2d%2d", &year, &month, &day);
-
-                       if (year == year_selected && month == month_selected) {
-                                       DEBUG ("Marking date:'%s'", str);
-                                       gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
+                       if (g_date_get_year (date) == year_selected &&
+                           g_date_get_month (date) == month_selected) {
+                                       DEBUG ("Marking date: %04u-%02u-%02u", g_date_get_year (date),
+                                               g_date_get_month (date), g_date_get_day (date));
+                                       gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), g_date_get_day (date));
                        }
        }
 
@@ -1568,8 +1283,6 @@ log_window_updating_calendar_month_cb (GObject *manager,
        DEBUG ("Currently showing month %d and year %d", month_selected,
                        year_selected);
 }
-#endif /* ENABLE_TPL */
-
 
 static void
 log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
@@ -1578,13 +1291,6 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
        TpAccount     *account;
        gchar         *chat_id;
        gboolean       is_chatroom;
-#ifndef ENABLE_TPL
-       guint          year_selected;
-       guint          month_selected;
-
-       GList         *dates;
-       GList         *l;
-#endif /* ENABLE_TPL */
 
        gtk_calendar_clear_marks (GTK_CALENDAR (calendar));
 
@@ -1595,48 +1301,10 @@ log_window_calendar_chats_month_changed_cb (GtkWidget       *calendar,
        }
 
        /* Get the log object for this contact */
-#ifdef ENABLE_TPL
        tpl_log_manager_get_dates_async (window->log_manager, account,
                                               chat_id, is_chatroom,
                                               log_window_updating_calendar_month_cb,
                                               (gpointer) window);
-#else
-       dates = empathy_log_manager_get_dates (window->log_manager, account,
-                                              chat_id, is_chatroom);
-
-       g_object_get (calendar,
-                     "month", &month_selected,
-                     "year", &year_selected,
-                     NULL);
-
-       /* We need this here because it appears that the months start from 0 */
-       month_selected++;
-
-       for (l = dates; l; l = l->next) {
-               const gchar *str;
-               guint        year;
-               guint        month;
-               guint        day;
-
-               str = l->data;
-               if (!str) {
-                       continue;
-               }
-
-               sscanf (str, "%4d%2d%2d", &year, &month, &day);
-
-               if (year == year_selected && month == month_selected) {
-                       DEBUG ("Marking date:'%s'", str);
-                       gtk_calendar_mark_day (GTK_CALENDAR (window->calendar_chats), day);
-               }
-       }
-
-       g_list_foreach (dates, (GFunc) g_free, NULL);
-       g_list_free (dates);
-
-       DEBUG ("Currently showing month %d and year %d", month_selected,
-               year_selected);
-#endif /* ENABLE_TPL */
 
        g_object_unref (account);
        g_free (chat_id);
@@ -1674,4 +1342,3 @@ log_window_entry_chats_activate_cb (GtkWidget       *entry,
                                            FALSE);
        }
 }
-
index 8f7991166044738a8f409ce9b811271dd56334ec..d0e0aadecf1aa62ba4500324df9a706097b91373 100644 (file)
 
 #include <telepathy-glib/account-manager.h>
 
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-conf.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
@@ -184,23 +184,20 @@ gboolean
 empathy_notify_manager_notification_is_enabled  (EmpathyNotifyManager *self)
 {
   EmpathyNotifyManagerPriv *priv = GET_PRIV (self);
-  EmpathyConf *conf;
-  gboolean res;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
   TpConnectionPresenceType presence;
+  gboolean ret = FALSE;
 
-  conf = empathy_conf_get ();
-  res = FALSE;
-
-  empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_ENABLED, &res);
-
-  if (!res)
-    return FALSE;
+  if (!g_settings_get_boolean (gsettings, EMPATHY_PREFS_NOTIFICATIONS_ENABLED))
+    goto finally;
 
   if (!tp_account_manager_is_prepared (priv->account_manager,
         TP_ACCOUNT_MANAGER_FEATURE_CORE))
     {
       DEBUG ("account manager is not ready yet; display the notification");
-      return TRUE;
+      ret = TRUE;
+
+      goto finally;
     }
 
   presence = tp_account_manager_get_most_available_presence (
@@ -210,12 +207,15 @@ empathy_notify_manager_notification_is_enabled  (EmpathyNotifyManager *self)
   if (presence != TP_CONNECTION_PRESENCE_TYPE_AVAILABLE &&
       presence != TP_CONNECTION_PRESENCE_TYPE_UNSET)
     {
-      empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY,
-          &res);
-
-      if (res)
-        return FALSE;
+      if (!g_settings_get_boolean (gsettings,
+            EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY))
+        goto finally;
     }
 
-  return TRUE;
+  ret = TRUE;
+
+finally:
+  g_object_unref (gsettings);
+
+  return ret;
 }
index 74dcf6a2e852af681c81374299240b5353940997..03f04191637179ffcaa3d6dd7af03135d88ac73c 100644 (file)
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
-#include "empathy-conf.h"
-
 typedef struct {
   EmpathySound sound_id;
   const char * event_ca_id;
   const char * event_ca_description;
-  const char * gconf_key;
+  const char * key;
 } EmpathySoundEntry;
 
 typedef struct {
@@ -79,32 +78,37 @@ static gboolean
 empathy_sound_pref_is_enabled (EmpathySound sound_id)
 {
   EmpathySoundEntry *entry;
-  EmpathyConf *conf;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_SOUNDS_SCHEMA);
   gboolean res;
 
   entry = &(sound_entries[sound_id]);
   g_return_val_if_fail (entry->sound_id == sound_id, FALSE);
 
-  if (entry->gconf_key == NULL)
-    return TRUE;
-
-  conf = empathy_conf_get ();
-  res = FALSE;
+  if (entry->key == NULL)
+    {
+      res = TRUE;
+      goto finally;
+    }
 
-  empathy_conf_get_bool (conf, EMPATHY_PREFS_SOUNDS_ENABLED, &res);
+  res = g_settings_get_boolean (gsettings, EMPATHY_PREFS_SOUNDS_ENABLED);
 
   if (!res)
-    return FALSE;
+    goto finally;
 
   if (!empathy_check_available_state ())
     {
-      empathy_conf_get_bool (conf, EMPATHY_PREFS_SOUNDS_DISABLED_AWAY, &res);
-
-      if (res)
-        return FALSE;
+      if (g_settings_get_boolean (gsettings,
+            EMPATHY_PREFS_SOUNDS_DISABLED_AWAY))
+        {
+          res = FALSE;
+          goto finally;
+        }
     }
 
-  empathy_conf_get_bool (conf, entry->gconf_key, &res);
+  res = g_settings_get_boolean (gsettings, entry->key);
+
+finally:
+  g_object_unref (gsettings);
 
   return res;
 }
index 17c7f100e303bff989e9c1e7338b22665107e00c..ff94bb0532d8a06ab77465f89ab1af728cab8c88 100644 (file)
 #endif
 
 #include "empathy-spell.h"
-#include "empathy-conf.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
+#include <libempathy/empathy-gsettings.h>
 
 #ifdef HAVE_ENCHANT
 
@@ -50,7 +50,6 @@ typedef struct {
 
 static GHashTable  *iso_code_names = NULL;
 static GList       *languages = NULL;
-static gboolean     empathy_conf_notify_inited = FALSE;
 
 static void
 spell_iso_codes_parse_start_tag (GMarkupParseContext  *ctx,
@@ -159,7 +158,7 @@ spell_iso_code_names_init (void)
 }
 
 static void
-spell_notify_languages_cb (EmpathyConf  *conf,
+spell_notify_languages_cb (GSettings   *gsettings,
                           const gchar *key,
                           gpointer     user_data)
 {
@@ -186,23 +185,26 @@ spell_notify_languages_cb (EmpathyConf  *conf,
 static void
 spell_setup_languages (void)
 {
+       static GSettings *gsettings = NULL;
        gchar  *str;
 
-       if (!empathy_conf_notify_inited) {
-               empathy_conf_notify_add (empathy_conf_get (),
-                                        EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
-                                        spell_notify_languages_cb, NULL);
+       if (gsettings == NULL) {
+               /* FIXME: this is never uninitialised */
+               gsettings = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
 
-               empathy_conf_notify_inited = TRUE;
+               g_signal_connect (gsettings,
+                       "changed::" EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
+                       G_CALLBACK (spell_notify_languages_cb), NULL);
        }
 
        if (languages) {
                return;
        }
 
-       if (empathy_conf_get_string (empathy_conf_get (),
-                                    EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
-                                    &str) && str) {
+       str = g_settings_get_string (gsettings,
+                       EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES);
+
+       if (str != NULL) {
                gchar **strv;
                gint    i;
 
index ad174ce3b14e197d1527e546aff17748a67f42b5..e3582a7d40d9d876b65e83340b1475442b3a87f9 100644 (file)
 #include <pango/pango.h>
 #include <gdk/gdk.h>
 
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-time.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-theme-adium.h"
 #include "empathy-smiley-manager.h"
-#include "empathy-conf.h"
 #include "empathy-ui-utils.h"
 #include "empathy-plist.h"
 #include "empathy-string-parser.h"
@@ -63,8 +63,8 @@ typedef struct {
        gboolean              last_is_backlog;
        gboolean              page_loaded;
        GList                *message_queue;
-       guint                 notify_enable_webkit_developer_tools_id;
        GtkWidget            *inspector_window;
+       GSettings            *gsettings_chat;
 } EmpathyThemeAdiumPriv;
 
 struct _EmpathyAdiumData {
@@ -111,14 +111,13 @@ G_DEFINE_TYPE_WITH_CODE (EmpathyThemeAdium, empathy_theme_adium,
 static void
 theme_adium_update_enable_webkit_developer_tools (EmpathyThemeAdium *theme)
 {
+       EmpathyThemeAdiumPriv *priv = GET_PRIV (theme);
        WebKitWebView  *web_view = WEBKIT_WEB_VIEW (theme);
        gboolean        enable_webkit_developer_tools;
 
-       if (!empathy_conf_get_bool (empathy_conf_get (),
-                                   EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS,
-                                   &enable_webkit_developer_tools)) {
-               return;
-       }
+       enable_webkit_developer_tools = g_settings_get_boolean (
+                       priv->gsettings_chat,
+                       EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS);
 
        g_object_set (G_OBJECT (webkit_web_view_get_settings (web_view)),
                      "enable-developer-extras",
@@ -127,7 +126,7 @@ theme_adium_update_enable_webkit_developer_tools (EmpathyThemeAdium *theme)
 }
 
 static void
-theme_adium_notify_enable_webkit_developer_tools_cb (EmpathyConf *conf,
+theme_adium_notify_enable_webkit_developer_tools_cb (GSettings   *gsettings,
                                                     const gchar *key,
                                                     gpointer     user_data)
 {
@@ -257,13 +256,10 @@ theme_adium_parse_body (const gchar *text)
 {
        EmpathyStringParser *parsers;
        GString *string;
-       gboolean use_smileys;
+       GSettings *gsettings = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
 
        /* Check if we have to parse smileys */
-       empathy_conf_get_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
-                              &use_smileys);
-       if (use_smileys)
+       if (g_settings_get_boolean (gsettings, EMPATHY_PREFS_CHAT_SHOW_SMILEYS))
                parsers = string_parsers_with_smiley;
        else
                parsers = string_parsers;
@@ -274,6 +270,8 @@ theme_adium_parse_body (const gchar *text)
        string = g_string_sized_new (strlen (text));
        empathy_string_parser_substr (text, -1, parsers, string);
 
+       g_object_unref (gsettings);
+
        return g_string_free (string, FALSE);
 }
 
@@ -875,9 +873,7 @@ theme_adium_finalize (GObject *object)
        EmpathyThemeAdiumPriv *priv = GET_PRIV (object);
 
        empathy_adium_data_unref (priv->data);
-
-       empathy_conf_notify_remove (empathy_conf_get (),
-                                   priv->notify_enable_webkit_developer_tools_id);
+       g_object_unref (priv->gsettings_chat);
 
        G_OBJECT_CLASS (empathy_theme_adium_parent_class)->finalize (object);
 }
@@ -1154,11 +1150,11 @@ empathy_theme_adium_init (EmpathyThemeAdium *theme)
                          G_CALLBACK (theme_adium_navigation_policy_decision_requested_cb),
                          NULL);
 
-       priv->notify_enable_webkit_developer_tools_id =
-               empathy_conf_notify_add (empathy_conf_get (),
-                                        EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS,
-                                        theme_adium_notify_enable_webkit_developer_tools_cb,
-                                        theme);
+       priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+       g_signal_connect (priv->gsettings_chat,
+               "changed::" EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS,
+               G_CALLBACK (theme_adium_notify_enable_webkit_developer_tools_cb),
+               theme);
 
        theme_adium_update_enable_webkit_developer_tools (theme);
 }
index 29fb934f40731613b2d48286d10667d8686e9b5b..531f2baa6a109a5d7f76dc875a7721d66ea21356 100644 (file)
@@ -33,7 +33,6 @@
 #include <libempathy/empathy-utils.h>
 #include "empathy-theme-boxes.h"
 #include "empathy-ui-utils.h"
-#include "empathy-conf.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
index 905e0bf1dd936c8db21b1415a7c2d44593e182c6..bcad60538b49338266c8533a31fdd60cc7f366bf 100644 (file)
 #include <gtk/gtk.h>
 
 #include <telepathy-glib/util.h>
+
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-theme-manager.h"
 #include "empathy-chat-view.h"
-#include "empathy-conf.h"
 #include "empathy-chat-text-view.h"
 #include "empathy-theme-boxes.h"
 #include "empathy-theme-irc.h"
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyThemeManager)
 typedef struct {
+       GSettings   *gsettings_chat;
        gchar       *name;
-       guint        name_notify_id;
        gchar       *adium_path;
-       guint        adium_path_notify_id;
        GtkSettings *settings;
        GList       *boxes_views;
 } EmpathyThemeManagerPriv;
@@ -393,16 +393,17 @@ theme_manager_ensure_theme_exists (const gchar *name)
 }
 
 static void
-theme_manager_notify_name_cb (EmpathyConf *conf,
+theme_manager_notify_name_cb (GSettings   *gsettings_chat,
                              const gchar *key,
                              gpointer     user_data)
 {
        EmpathyThemeManager     *manager = EMPATHY_THEME_MANAGER (user_data);
        EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
-       gchar                   *name = NULL;
+       gchar                   *name;
+
+       name = g_settings_get_string (gsettings_chat, key);
 
-       if (!empathy_conf_get_string (conf, key, &name) ||
-           !theme_manager_ensure_theme_exists (name) ||
+       if (!theme_manager_ensure_theme_exists (name) ||
            !tp_strdiff (priv->name, name)) {
                if (!priv->name) {
                        priv->name = g_strdup ("classic");
@@ -431,7 +432,7 @@ theme_manager_notify_name_cb (EmpathyConf *conf,
 }
 
 static void
-theme_manager_notify_adium_path_cb (EmpathyConf *conf,
+theme_manager_notify_adium_path_cb (GSettings   *gsettings_chat,
                                    const gchar *key,
                                    gpointer     user_data)
 {
@@ -439,8 +440,9 @@ theme_manager_notify_adium_path_cb (EmpathyConf *conf,
        EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
        gchar                   *adium_path = NULL;
 
-       if (!empathy_conf_get_string (conf, key, &adium_path) ||
-           !tp_strdiff (priv->adium_path, adium_path)) {
+       adium_path = g_settings_get_string (gsettings_chat, key);
+
+       if (!tp_strdiff (priv->adium_path, adium_path)) {
                g_free (adium_path);
                return;
        }
@@ -457,9 +459,8 @@ theme_manager_finalize (GObject *object)
        EmpathyThemeManagerPriv *priv = GET_PRIV (object);
        GList                   *l;
 
-       empathy_conf_notify_remove (empathy_conf_get (), priv->name_notify_id);
+       g_object_unref (priv->gsettings_chat);
        g_free (priv->name);
-       empathy_conf_notify_remove (empathy_conf_get (), priv->adium_path_notify_id);
        g_free (priv->adium_path);
 
        for (l = priv->boxes_views; l; l = l->next) {
@@ -500,23 +501,23 @@ empathy_theme_manager_init (EmpathyThemeManager *manager)
 
        manager->priv = priv;
 
+       priv->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+
        /* Take the theme name and track changes */
-       priv->name_notify_id =
-               empathy_conf_notify_add (empathy_conf_get (),
-                                        EMPATHY_PREFS_CHAT_THEME,
-                                        theme_manager_notify_name_cb,
-                                        manager);
-       theme_manager_notify_name_cb (empathy_conf_get (),
+       g_signal_connect (priv->gsettings_chat,
+                         "changed::" EMPATHY_PREFS_CHAT_THEME,
+                         G_CALLBACK (theme_manager_notify_name_cb),
+                         manager);
+       theme_manager_notify_name_cb (priv->gsettings_chat,
                                      EMPATHY_PREFS_CHAT_THEME,
                                      manager);
 
        /* Take the adium path and track changes */
-       priv->adium_path_notify_id =
-               empathy_conf_notify_add (empathy_conf_get (),
-                                        EMPATHY_PREFS_CHAT_ADIUM_PATH,
-                                        theme_manager_notify_adium_path_cb,
-                                        manager);
-       theme_manager_notify_adium_path_cb (empathy_conf_get (),
+       g_signal_connect (priv->gsettings_chat,
+                         "changed::" EMPATHY_PREFS_CHAT_ADIUM_PATH,
+                         G_CALLBACK (theme_manager_notify_adium_path_cb),
+                         manager);
+       theme_manager_notify_adium_path_cb (priv->gsettings_chat,
                                            EMPATHY_PREFS_CHAT_ADIUM_PATH,
                                            manager);
 }
index b5e37cade5b0fe55b2d9a0dc0d795742487570f8..6339a891dac9aaacd37ad7caabaa4294df213aa8 100644 (file)
@@ -41,7 +41,6 @@
 #include "empathy-ui-utils.h"
 #include "empathy-images.h"
 #include "empathy-smiley-manager.h"
-#include "empathy-conf.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
index 6d596bedae85479da4d4ee03de4989e5703cfb43..d44d8afefe3162e38f43e7292d54454b8bfd5282 100644 (file)
@@ -8,7 +8,6 @@ AM_CPPFLAGS =                                           \
        -DDATADIR=\""$(datadir)"\"                      \
        -DLOCALEDIR=\""$(datadir)/locale"\"             \
        -DG_LOG_DOMAIN=\"empathy\"                      \
-       $(TPL_CFLAGS)                                   \
        $(LIBEMPATHY_CFLAGS)                            \
        $(GEOCLUE_CFLAGS)                               \
        $(NETWORK_MANAGER_CFLAGS)                       \
@@ -42,6 +41,7 @@ libempathy_headers =                          \
        empathy-dispatcher.h                    \
        empathy-ft-factory.h                    \
        empathy-ft-handler.h                    \
+       empathy-gsettings.h                     \
        empathy-handler.h                       \
        empathy-idle.h                          \
        empathy-irc-network-manager.h           \
@@ -60,14 +60,6 @@ libempathy_headers =                         \
        empathy-types.h                         \
        empathy-utils.h
 
-if !ENABLE_TPL
-libempathy_headers +=  \
-       empathy-log-manager.h                           \
-       empathy-log-store-empathy.h                     \
-       empathy-log-store.h                             \
-       $(NULL)
-endif
-
 libempathy_la_SOURCES =                                        \
        $(libempathy_headers)                           \
        empathy-account-settings.c                      \
@@ -102,14 +94,6 @@ libempathy_la_SOURCES =                                     \
        empathy-tp-roomlist.c                           \
        empathy-utils.c
 
-if !ENABLE_TPL
-libempathy_la_SOURCES += \
-       empathy-log-manager.c                           \
-       empathy-log-store-empathy.c                     \
-       empathy-log-store.c                             \
-       $(NULL)
-endif
-
 # do not distribute generated files
 nodist_libempathy_la_SOURCES =\
        $(BUILT_SOURCES)
@@ -118,7 +102,6 @@ libempathy_la_LIBADD =              \
        $(top_builddir)/extensions/libemp-extensions.la \
        $(LIBEMPATHY_LIBS) \
        $(GEOCLUE_LIBS) \
-       $(TPL_LIBS) \
        $(NETWORK_MANAGER_LIBS) \
        $(CONNMAN_LIBS)
 
@@ -191,11 +174,6 @@ dtd_DATA =                                         \
        empathy-chatroom-manager.dtd            \
        empathy-irc-networks.dtd
 
-if !ENABLE_TPL
-stylesheetdir = $(datadir)/empathy
-stylesheet_DATA = empathy-log-manager.xsl
-endif
-
 ircnetworksdir = $(datadir)/empathy
 ircnetworks_DATA =             \
        irc-networks.xml
@@ -205,10 +183,6 @@ EXTRA_DIST =                       \
        $(dtd_DATA)             \
        $(ircnetworks_DATA)
 
-if !ENABLE_TPL
-EXTRA_DIST +=  $(stylesheet_DATA)
-endif
-
 CLEANFILES =                           \
        $(BUILT_SOURCES)                \
        stamp-empathy-enum-types.h
index bd8a63efafe5aa332c2d349bccc7ec3c57938e70..cbd3bd0ae306c8a72a7ba7950808b77ab74d1dda 100644 (file)
@@ -28,9 +28,6 @@
 #include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/util.h>
-#ifdef ENABEL_TPL
-#include <telepathy-logger/contact.h>
-#endif /* ENABLE_TPL */
 
 #if HAVE_GEOCLUE
 #include <geoclue/geoclue-geocode.h>
@@ -479,32 +476,30 @@ empathy_contact_new (TpContact *tp_contact)
       NULL);
 }
 
-#ifdef ENABLE_TPL
 EmpathyContact *
 empathy_contact_from_tpl_contact (TpAccount *account,
-    TplContact *tpl_contact)
+    TplEntity *tpl_entity)
 {
   EmpathyContact *retval;
   gboolean is_user;
 
-  g_return_val_if_fail (TPL_IS_CONTACT (tpl_contact), NULL);
+  g_return_val_if_fail (TPL_IS_ENTITY (tpl_entity), NULL);
 
-  is_user = (TPL_CONTACT_USER == tpl_contact_get_contact_type (tpl_contact));
+  is_user = (TPL_ENTITY_SELF == tpl_entity_get_entity_type (tpl_entity));
 
   retval = g_object_new (EMPATHY_TYPE_CONTACT,
-      "id", tpl_contact_get_alias (tpl_contact),
-      "name", tpl_contact_get_identifier (tpl_contact),
+      "id", tpl_entity_get_alias (tpl_entity),
+      "name", tpl_entity_get_identifier (tpl_entity),
       "account", account,
       "is-user", is_user,
       NULL);
 
-  if (!EMP_STR_EMPTY (tpl_contact_get_avatar_token (tpl_contact)))
+  if (!EMP_STR_EMPTY (tpl_entity_get_avatar_token (tpl_entity)))
     empathy_contact_load_avatar_cache (retval,
-        tpl_contact_get_avatar_token (tpl_contact));
+        tpl_entity_get_avatar_token (tpl_entity));
 
   return retval;
 }
-#endif /* ENABLE_TPL */
 
 EmpathyContact *
 empathy_contact_new_for_log (TpAccount *account,
index 568ecd53734b98a86e341fbb9cbe3c78751d8bc5..ddb3f66c0231efb67a4cc32e01f7419d1bbb0219 100644 (file)
@@ -26,9 +26,7 @@
 
 #include <telepathy-glib/contact.h>
 #include <telepathy-glib/account.h>
-#ifdef ENABLE_TPL
-#include <telepathy-logger/contact.h>
-#endif /* ENABLE_TPL */
+#include <telepathy-logger/entity.h>
 
 G_BEGIN_DECLS
 
@@ -73,10 +71,8 @@ typedef enum {
 
 GType empathy_contact_get_type (void) G_GNUC_CONST;
 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
-#ifdef ENABLE_TPL
 EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account,
-    TplContact *tpl_contact);
-#endif /* ENABLE_TPL */
+    TplEntity *tpl_contact);
 EmpathyContact * empathy_contact_new_for_log (TpAccount *account,
     const gchar *id, const gchar *name, gboolean is_user);
 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
diff --git a/libempathy/empathy-gsettings.h b/libempathy/empathy-gsettings.h
new file mode 100644 (file)
index 0000000..eb5074f
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Danielle Madeley <danielle.madeley@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_GSETTINGS_H__
+#define __EMPATHY_GSETTINGS_H__
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_PREFS_SCHEMA "org.gnome.Empathy"
+#define EMPATHY_PREFS_USE_CONN                     "use-conn"
+#define EMPATHY_PREFS_AUTOCONNECT                  "autoconnect"
+#define EMPATHY_PREFS_AUTOAWAY                     "autoaway"
+#define EMPATHY_PREFS_IMPORT_ASKED                 "import-asked"
+#define EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED      "butterfly-logs-migrated"
+#define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER "file-transfer-default-folder"
+
+#define EMPATHY_PREFS_NOTIFICATIONS_SCHEMA EMPATHY_PREFS_SCHEMA ".notifications"
+#define EMPATHY_PREFS_NOTIFICATIONS_ENABLED        "notifications-enabled"
+#define EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY  "notifications-disabled-away"
+#define EMPATHY_PREFS_NOTIFICATIONS_FOCUS          "notifications-focus"
+#define EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN "notifications-contact-signin"
+#define EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT "notifications-contact-signout"
+#define EMPATHY_PREFS_NOTIFICATIONS_POPUPS_WHEN_AVAILABLE "popups-when-available"
+
+#define EMPATHY_PREFS_SOUNDS_SCHEMA EMPATHY_PREFS_SCHEMA ".sounds"
+#define EMPATHY_PREFS_SOUNDS_ENABLED               "sounds-enabled"
+#define EMPATHY_PREFS_SOUNDS_DISABLED_AWAY         "sounds-disabled-away"
+#define EMPATHY_PREFS_SOUNDS_INCOMING_MESSAGE      "sounds-incoming-message"
+#define EMPATHY_PREFS_SOUNDS_OUTGOING_MESSAGE      "sounds-outgoing-message"
+#define EMPATHY_PREFS_SOUNDS_NEW_CONVERSATION      "sounds-new-conversation"
+#define EMPATHY_PREFS_SOUNDS_SERVICE_LOGIN         "sounds-service-login"
+#define EMPATHY_PREFS_SOUNDS_SERVICE_LOGOUT        "sounds-service-logout"
+#define EMPATHY_PREFS_SOUNDS_CONTACT_LOGIN         "sounds-contact-login"
+#define EMPATHY_PREFS_SOUNDS_CONTACT_LOGOUT        "sounds-contact-logout"
+
+#define EMPATHY_PREFS_CHAT_SCHEMA EMPATHY_PREFS_SCHEMA ".conversation"
+#define EMPATHY_PREFS_CHAT_SHOW_SMILEYS            "graphical-smileys"
+#define EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS  "show-contacts-in-rooms"
+#define EMPATHY_PREFS_CHAT_THEME                   "theme"
+#define EMPATHY_PREFS_CHAT_ADIUM_PATH              "adium-path"
+#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES "spell-checker-languages"
+#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED   "spell-checker-enabled"
+#define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR    "nick-completion-char"
+#define EMPATHY_PREFS_CHAT_AVATAR_IN_ICON          "avatar-in-icon"
+#define EMPATHY_PREFS_CHAT_WEBKIT_DEVELOPER_TOOLS  "enable-webkit-developer-tools"
+
+#define EMPATHY_PREFS_UI_SCHEMA EMPATHY_PREFS_SCHEMA ".ui"
+#define EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS     "separate-chat-windows"
+#define EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN        "main-window-hidden"
+#define EMPATHY_PREFS_UI_AVATAR_DIRECTORY          "avatar-directory"
+#define EMPATHY_PREFS_UI_SHOW_AVATARS              "show-avatars"
+#define EMPATHY_PREFS_UI_SHOW_PROTOCOLS            "show-protocols"
+#define EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST      "compact-contact-list"
+#define EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS     "chat-window-paned-pos"
+#define EMPATHY_PREFS_UI_SHOW_OFFLINE              "show-offline"
+
+#define EMPATHY_PREFS_CONTACTS_SCHEMA EMPATHY_PREFS_SCHEMA ".contacts"
+#define EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM      "sort-criterium"
+
+#define EMPATHY_PREFS_HINTS_SCHEMA EMPATHY_PREFS_SCHEMA ".hints"
+#define EMPATHY_PREFS_HINTS_CLOSE_MAIN_WINDOW      "close-main-window"
+
+#define EMPATHY_PREFS_LOCATION_SCHEMA EMPATHY_PREFS_SCHEMA ".location"
+#define EMPATHY_PREFS_LOCATION_PUBLISH             "publish"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK    "resource-network"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_CELL       "resource-cell"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_GPS        "resource-gps"
+#define EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY     "reduce-accuracy"
+
+#define EMPATHY_PREFS_ACCOUNTS_SCHEMA EMPATHY_PREFS_SCHEMA ".accounts"
+#define EMPATHY_PREFS_ACCOUNTS_IMPORTED_MC4_ACCOUNTS "imported-mc4-accounts"
+
+G_END_DECLS
+
+#endif /* __EMPATHY_GSETTINGS_H__ */
+
diff --git a/libempathy/empathy-log-manager.c b/libempathy/empathy-log-manager.c
deleted file mode 100644 (file)
index 5a57f0c..0000000
+++ /dev/null
@@ -1,455 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib/gstdio.h>
-
-#include <telepathy-glib/util.h>
-#include <telepathy-glib/interfaces.h>
-
-#include "empathy-log-manager.h"
-#include "empathy-log-store-empathy.h"
-#include "empathy-log-store.h"
-#include "empathy-tp-chat.h"
-#include "empathy-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include "empathy-debug.h"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogManager)
-typedef struct
-{
-  GList *stores;
-} EmpathyLogManagerPriv;
-
-G_DEFINE_TYPE (EmpathyLogManager, empathy_log_manager, G_TYPE_OBJECT);
-
-static EmpathyLogManager * manager_singleton = NULL;
-
-static void
-log_manager_finalize (GObject *object)
-{
-  EmpathyLogManagerPriv *priv;
-
-  priv = GET_PRIV (object);
-
-  g_list_foreach (priv->stores, (GFunc) g_object_unref, NULL);
-  g_list_free (priv->stores);
-}
-
-static GObject *
-log_manager_constructor (GType type,
-                         guint n_props,
-                         GObjectConstructParam *props)
-{
-  GObject *retval;
-  EmpathyLogManagerPriv *priv;
-
-  if (manager_singleton)
-    {
-      retval = g_object_ref (manager_singleton);
-    }
-  else
-    {
-      retval = G_OBJECT_CLASS (empathy_log_manager_parent_class)->constructor
-          (type, n_props, props);
-
-      manager_singleton = EMPATHY_LOG_MANAGER (retval);
-      g_object_add_weak_pointer (retval, (gpointer *) &manager_singleton);
-
-      priv = GET_PRIV (manager_singleton);
-
-      priv->stores = g_list_append (priv->stores,
-          g_object_new (EMPATHY_TYPE_LOG_STORE_EMPATHY, NULL));
-    }
-
-  return retval;
-}
-
-static void
-empathy_log_manager_class_init (EmpathyLogManagerClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->constructor = log_manager_constructor;
-  object_class->finalize = log_manager_finalize;
-
-  g_type_class_add_private (object_class, sizeof (EmpathyLogManagerPriv));
-}
-
-static void
-empathy_log_manager_init (EmpathyLogManager *manager)
-{
-  EmpathyLogManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
-      EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv);
-
-  manager->priv = priv;
-}
-
-EmpathyLogManager *
-empathy_log_manager_dup_singleton (void)
-{
-  return g_object_new (EMPATHY_TYPE_LOG_MANAGER, NULL);
-}
-
-gboolean
-empathy_log_manager_add_message (EmpathyLogManager *manager,
-                                 const gchar *chat_id,
-                                 gboolean chatroom,
-                                 EmpathyMessage *message,
-                                 GError **error)
-{
-  EmpathyLogManagerPriv *priv;
-  GList *l;
-  gboolean out = FALSE;
-  gboolean found = FALSE;
-
-  /* TODO: When multiple log stores appear with add_message implementations
-   * make this customisable. */
-  const gchar *add_store = "Empathy";
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
-  g_return_val_if_fail (chat_id != NULL, FALSE);
-  g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
-
-  priv = GET_PRIV (manager);
-
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      if (!tp_strdiff (empathy_log_store_get_name (
-              EMPATHY_LOG_STORE (l->data)), add_store))
-        {
-          out = empathy_log_store_add_message (EMPATHY_LOG_STORE (l->data),
-              chat_id, chatroom, message, error);
-          found = TRUE;
-          break;
-        }
-    }
-
-  if (!found)
-    DEBUG ("Failed to find chosen log store to write to.");
-
-  return out;
-}
-
-gboolean
-empathy_log_manager_exists (EmpathyLogManager *manager,
-                            TpAccount *account,
-                            const gchar *chat_id,
-                            gboolean chatroom)
-{
-  GList *l;
-  EmpathyLogManagerPriv *priv;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
-  g_return_val_if_fail (chat_id != NULL, FALSE);
-
-  priv = GET_PRIV (manager);
-
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      if (empathy_log_store_exists (EMPATHY_LOG_STORE (l->data),
-            account, chat_id, chatroom))
-        return TRUE;
-    }
-
-  return FALSE;
-}
-
-GList *
-empathy_log_manager_get_dates (EmpathyLogManager *manager,
-                               TpAccount *account,
-                               const gchar *chat_id,
-                               gboolean chatroom)
-{
-  GList *l, *out = NULL;
-  EmpathyLogManagerPriv *priv;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (chat_id != NULL, NULL);
-
-  priv = GET_PRIV (manager);
-
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
-      GList *new;
-
-      /* Insert dates of each store in the out list. Keep the out list sorted
-       * and avoid to insert dups. */
-      new = empathy_log_store_get_dates (store, account, chat_id, chatroom);
-      while (new)
-        {
-          if (g_list_find_custom (out, new->data, (GCompareFunc) strcmp))
-            g_free (new->data);
-          else
-            out = g_list_insert_sorted (out, new->data, (GCompareFunc) strcmp);
-
-          new = g_list_delete_link (new, new);
-        }
-    }
-
-  return out;
-}
-
-GList *
-empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
-                                           TpAccount *account,
-                                           const gchar *chat_id,
-                                           gboolean chatroom,
-                                           const gchar *date)
-{
-  GList *l, *out = NULL;
-  EmpathyLogManagerPriv *priv;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (chat_id != NULL, NULL);
-
-  priv = GET_PRIV (manager);
-
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
-
-      out = g_list_concat (out, empathy_log_store_get_messages_for_date (
-          store, account, chat_id, chatroom, date));
-    }
-
-  return out;
-}
-
-static gint
-log_manager_message_date_cmp (gconstpointer a,
-                             gconstpointer b)
-{
-       EmpathyMessage *one = (EmpathyMessage *) a;
-       EmpathyMessage *two = (EmpathyMessage *) b;
-       time_t one_time, two_time;
-
-       one_time = empathy_message_get_timestamp (one);
-       two_time = empathy_message_get_timestamp (two);
-
-        /* Return -1 of message1 is older than message2 */
-       return one_time < two_time ? -1 : one_time - two_time;
-}
-
-GList *
-empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
-                                          TpAccount *account,
-                                          const gchar *chat_id,
-                                          gboolean chatroom,
-                                          guint num_messages,
-                                          EmpathyLogMessageFilter filter,
-                                          gpointer user_data)
-{
-  EmpathyLogManagerPriv *priv;
-  GList *out = NULL;
-  GList *l;
-  guint i = 0;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (chat_id != NULL, NULL);
-
-  priv = GET_PRIV (manager);
-
-  /* Get num_messages from each log store and keep only the
-   * newest ones in the out list. Keep that list sorted: Older first. */
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
-      GList *new;
-
-      new = empathy_log_store_get_filtered_messages (store, account, chat_id,
-          chatroom, num_messages, filter, user_data);
-      while (new)
-        {
-          if (i < num_messages)
-            {
-              /* We have less message than needed so far. Keep this message */
-              out = g_list_insert_sorted (out, new->data,
-                  (GCompareFunc) log_manager_message_date_cmp);
-              i++;
-            }
-          else if (log_manager_message_date_cmp (new->data, out->data) > 0)
-            {
-              /* This message is newer than the oldest message we have in out
-               * list. Remove the head of out list and insert this message */
-              g_object_unref (out->data);
-              out = g_list_delete_link (out, out);
-              out = g_list_insert_sorted (out, new->data,
-                  (GCompareFunc) log_manager_message_date_cmp);
-            }
-          else
-            {
-              /* This message is older than the oldest message we have in out
-               * list. Drop it. */
-              g_object_unref (new->data);
-            }
-
-          new = g_list_delete_link (new, new);
-        }
-    }
-
-  return out;
-}
-
-GList *
-empathy_log_manager_get_chats (EmpathyLogManager *manager,
-                               TpAccount *account)
-{
-  GList *l, *out = NULL;
-  EmpathyLogManagerPriv *priv;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-
-  priv = GET_PRIV (manager);
-
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
-
-      out = g_list_concat (out,
-          empathy_log_store_get_chats (store, account));
-    }
-
-  return out;
-}
-
-GList *
-empathy_log_manager_search_new (EmpathyLogManager *manager,
-                                const gchar *text)
-{
-  GList *l, *out = NULL;
-  EmpathyLogManagerPriv *priv;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
-  g_return_val_if_fail (!EMP_STR_EMPTY (text), NULL);
-
-  priv = GET_PRIV (manager);
-
-  for (l = priv->stores; l; l = g_list_next (l))
-    {
-      EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
-
-      out = g_list_concat (out,
-          empathy_log_store_search_new (store, text));
-    }
-
-  return out;
-}
-
-void
-empathy_log_manager_search_hit_free (EmpathyLogSearchHit *hit)
-{
-  if (hit->account != NULL)
-    g_object_unref (hit->account);
-
-  g_free (hit->date);
-  g_free (hit->filename);
-  g_free (hit->chat_id);
-
-  g_slice_free (EmpathyLogSearchHit, hit);
-}
-
-void
-empathy_log_manager_search_free (GList *hits)
-{
-  GList *l;
-
-  for (l = hits; l; l = g_list_next (l))
-    {
-      empathy_log_manager_search_hit_free (l->data);
-    }
-
-  g_list_free (hits);
-}
-
-/* Format is just date, 20061201. */
-gchar *
-empathy_log_manager_get_date_readable (const gchar *date)
-{
-  time_t t;
-
-  t = empathy_time_parse (date);
-
-  return empathy_time_to_string_local (t, "%a %d %b %Y");
-}
-
-static void
-log_manager_chat_received_message_cb (EmpathyTpChat *tp_chat,
-                                      EmpathyMessage *message,
-                                      EmpathyLogManager *log_manager)
-{
-  GError *error = NULL;
-  TpHandleType handle_type;
-  TpChannel *channel;
-
-  channel = empathy_tp_chat_get_channel (tp_chat);
-  tp_channel_get_handle (channel, &handle_type);
-
-  if (!empathy_log_manager_add_message (log_manager,
-        tp_channel_get_identifier (channel),
-        handle_type == TP_HANDLE_TYPE_ROOM,
-        message, &error))
-    {
-      DEBUG ("Failed to write message: %s",
-          error ? error->message : "No error message");
-
-      if (error != NULL)
-        g_error_free (error);
-    }
-}
-
-static void
-log_manager_dispatcher_observe_cb (EmpathyDispatcher *dispatcher,
-                                   EmpathyDispatchOperation *operation,
-                                   EmpathyLogManager *log_manager)
-{
-  GQuark channel_type;
-
-  channel_type = empathy_dispatch_operation_get_channel_type_id (operation);
-
-  if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT)
-    {
-      EmpathyTpChat *tp_chat;
-
-      tp_chat = EMPATHY_TP_CHAT (
-          empathy_dispatch_operation_get_channel_wrapper (operation));
-
-      g_signal_connect (tp_chat, "message-received",
-          G_CALLBACK (log_manager_chat_received_message_cb), log_manager);
-    }
-}
-
-
-void
-empathy_log_manager_observe (EmpathyLogManager *log_manager,
-                             EmpathyDispatcher *dispatcher)
-{
-  g_signal_connect (dispatcher, "observe",
-      G_CALLBACK (log_manager_dispatcher_observe_cb), log_manager);
-}
diff --git a/libempathy/empathy-log-manager.h b/libempathy/empathy-log-manager.h
deleted file mode 100644 (file)
index 4e4097d..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#ifndef __EMPATHY_LOG_MANAGER_H__
-#define __EMPATHY_LOG_MANAGER_H__
-
-#include <config.h>
-#ifndef ENABLE_TPL
-
-#include <glib-object.h>
-
-#include "empathy-message.h"
-#include "empathy-dispatcher.h"
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_LOG_MANAGER (empathy_log_manager_get_type ())
-#define EMPATHY_LOG_MANAGER(o) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_LOG_MANAGER, \
-                               EmpathyLogManager))
-#define EMPATHY_LOG_MANAGER_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_LOG_MANAGER, \
-                            EmpathyLogManagerClass))
-#define EMPATHY_IS_LOG_MANAGER(o) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_LOG_MANAGER))
-#define EMPATHY_IS_LOG_MANAGER_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_LOG_MANAGER))
-#define EMPATHY_LOG_MANAGER_GET_CLASS(o) \
-  (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_LOG_MANAGER, \
-                              EmpathyLogManagerClass))
-
-typedef struct _EmpathyLogManager EmpathyLogManager;
-typedef struct _EmpathyLogManagerClass EmpathyLogManagerClass;
-typedef struct _EmpathyLogSearchHit EmpathyLogSearchHit;
-
-struct _EmpathyLogManager
-{
-  GObject parent;
-  gpointer priv;
-};
-
-struct _EmpathyLogManagerClass
-{
-  GObjectClass parent_class;
-};
-
-struct _EmpathyLogSearchHit
-{
-  TpAccount *account;
-  gchar     *chat_id;
-  gboolean   is_chatroom;
-  gchar     *filename;
-  gchar     *date;
-};
-
-typedef gboolean (*EmpathyLogMessageFilter) (EmpathyMessage *message,
-    gpointer user_data);
-
-GType empathy_log_manager_get_type (void) G_GNUC_CONST;
-EmpathyLogManager *empathy_log_manager_dup_singleton (void);
-gboolean empathy_log_manager_add_message (EmpathyLogManager *manager,
-    const gchar *chat_id, gboolean chatroom, EmpathyMessage *message,
-    GError **error);
-gboolean empathy_log_manager_exists (EmpathyLogManager *manager,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom);
-GList *empathy_log_manager_get_dates (EmpathyLogManager *manager,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom);
-GList *empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom,
-    const gchar *date);
-GList *empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom,
-    guint num_messages, EmpathyLogMessageFilter filter, gpointer user_data);
-GList *empathy_log_manager_get_chats (EmpathyLogManager *manager,
-    TpAccount *account);
-GList *empathy_log_manager_search_new (EmpathyLogManager *manager,
-    const gchar *text);
-void empathy_log_manager_search_free (GList *hits);
-gchar *empathy_log_manager_get_date_readable (const gchar *date);
-void empathy_log_manager_search_hit_free (EmpathyLogSearchHit *hit);
-void empathy_log_manager_observe (EmpathyLogManager *log_manager,
-    EmpathyDispatcher *dispatcher);
-
-G_END_DECLS
-
-#endif /* ENABLE_TPL */
-#endif /* __EMPATHY_LOG_MANAGER_H__ */
diff --git a/libempathy/empathy-log-manager.xsl b/libempathy/empathy-log-manager.xsl
deleted file mode 100644 (file)
index a934f3a..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
-
-  <xsl:output method="html" encoding="utf-8" indent="yes"/>
-
-  <xsl:template match="/">
-    <html>
-      <head>
-        <style type="text/css">
-          <xsl:text>
-            body {
-              background: #fff;
-             font-family: Verdana, "Bitstream Vera Sans", Sans-Serif; 
-             font-size: 10pt;
-            }
-            .stamp {
-              color: #999;
-            }
-            .top-day-stamp {
-              color: #999;
-              text-align: center;
-              margin-bottom: 1em;
-            }
-            .new-day-stamp {
-              color: #999;
-              text-align: center;
-              margin-bottom: 1em;
-              margin-top: 1em;
-            }
-            .nick {
-              color: rgb(54,100, 139);
-            }
-            .nick-self {
-              color: rgb(46,139,87);
-            }
-           .nick-highlight {
-              color: rgb(205,92,92);
-            }
-          </xsl:text>
-        </style>
-        <title><xsl:value-of select="$title"/></title>
-      </head>
-      <body>
-        <xsl:apply-templates/>
-      </body>
-    </html>
-  </xsl:template>
-
-  <xsl:template name="get-day">
-    <xsl:param name="stamp"/>
-    <xsl:value-of select="substring ($stamp, 1, 8)"/>
-  </xsl:template>
-
-  <xsl:template name="format-stamp">
-    <xsl:param name="stamp"/>
-    <xsl:variable name="hour" select="substring ($stamp, 10, 2)"/>
-    <xsl:variable name="min" select="substring ($stamp, 13, 2)"/>
-
-    <xsl:value-of select="$hour"/>:<xsl:value-of select="$min"/>
-  </xsl:template>
-
-  <xsl:template name="format-day-stamp">
-    <xsl:param name="stamp"/>
-    <xsl:variable name="year" select="substring ($stamp, 1, 4)"/>
-    <xsl:variable name="month" select="substring ($stamp, 5, 2)"/>
-    <xsl:variable name="day" select="substring ($stamp, 7, 2)"/>
-
-    <xsl:value-of select="$year"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$day"/>
-  </xsl:template>
-
-  <xsl:template name="header">
-    <xsl:param name="stamp"/>
-    <div class="top-day-stamp">
-      <xsl:call-template name="format-day-stamp">
-        <xsl:with-param name="stamp" select="@time"/>
-      </xsl:call-template>
-    </div>
-  </xsl:template>  
-
-  <xsl:template match="a">
-    <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
-
-    <xsl:value-of disable-output-escaping="yes" select="@href"/>
-
-    <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
-
-    <xsl:value-of select="@href"/>
-    <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="log">
-
-    <div class="top-day-stamp">
-      <xsl:call-template name="format-day-stamp">
-        <xsl:with-param name="stamp" select="//message[1]/@time"/>
-      </xsl:call-template>
-    </div>
-
-    <xsl:for-each select="*">
-
-      <xsl:variable name="prev-time">
-        <xsl:call-template name="get-day">
-          <xsl:with-param name="stamp" select="preceding-sibling::*[1]/@time"/>
-        </xsl:call-template>
-      </xsl:variable>
-
-      <xsl:variable name="this-time">
-        <xsl:call-template name="get-day">
-          <xsl:with-param name="stamp" select="@time"/>
-        </xsl:call-template>
-      </xsl:variable>
-
-      <xsl:if test="$prev-time &lt; $this-time">
-        <div class="new-day-stamp">
-        <xsl:call-template name="format-day-stamp">
-          <xsl:with-param name="stamp" select="@time"/>
-        </xsl:call-template>
-        </div>
-      </xsl:if>
-
-      <xsl:variable name="stamp">
-        <xsl:call-template name="format-stamp">
-          <xsl:with-param name="stamp" select="@time"/>
-        </xsl:call-template>
-      </xsl:variable>
-
-      <span class="stamp">
-       <xsl:value-of select="$stamp"/>
-      </span>
-
-      <xsl:variable name="nick-class">
-        <xsl:choose>
-          <xsl:when test="not(string(@id))">nick-self</xsl:when>
-          <xsl:otherwise>nick</xsl:otherwise>
-        </xsl:choose>
-      </xsl:variable>
-
-      <span class="{$nick-class}">
-        &lt;<xsl:value-of select="@name"/>&gt;
-      </span>
-      <xsl:apply-templates/>
-      <br/>
-
-    </xsl:for-each>
-
-  </xsl:template>
-
-</xsl:stylesheet>
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c
deleted file mode 100644 (file)
index 1aa8c04..0000000
+++ /dev/null
@@ -1,823 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- *          Jonny Lamb <jonny.lamb@collabora.co.uk>
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib/gstdio.h>
-
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/util.h>
-#include <telepathy-glib/defs.h>
-
-#include "empathy-log-store.h"
-#include "empathy-log-store-empathy.h"
-#include "empathy-log-manager.h"
-#include "empathy-contact.h"
-#include "empathy-time.h"
-#include "empathy-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include "empathy-debug.h"
-
-#define LOG_DIR_CREATE_MODE       (S_IRUSR | S_IWUSR | S_IXUSR)
-#define LOG_FILE_CREATE_MODE      (S_IRUSR | S_IWUSR)
-#define LOG_DIR_CHATROOMS         "chatrooms"
-#define LOG_FILENAME_SUFFIX       ".log"
-#define LOG_TIME_FORMAT_FULL      "%Y%m%dT%H:%M:%S"
-#define LOG_TIME_FORMAT           "%Y%m%d"
-#define LOG_HEADER \
-    "<?xml version='1.0' encoding='utf-8'?>\n" \
-    "<?xml-stylesheet type=\"text/xsl\" href=\"empathy-log.xsl\"?>\n" \
-    "<log>\n"
-
-#define LOG_FOOTER \
-    "</log>\n"
-
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogStoreEmpathy)
-typedef struct
-{
-  gchar *basedir;
-  gchar *name;
-  TpAccountManager *account_manager;
-} EmpathyLogStoreEmpathyPriv;
-
-static void log_store_iface_init (gpointer g_iface,gpointer iface_data);
-
-G_DEFINE_TYPE_WITH_CODE (EmpathyLogStoreEmpathy, empathy_log_store_empathy,
-    G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_LOG_STORE,
-      log_store_iface_init));
-
-static void
-log_store_empathy_finalize (GObject *object)
-{
-  EmpathyLogStoreEmpathy *self = EMPATHY_LOG_STORE_EMPATHY (object);
-  EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
-
-  g_object_unref (priv->account_manager);
-  g_free (priv->basedir);
-  g_free (priv->name);
-}
-
-static void
-empathy_log_store_empathy_class_init (EmpathyLogStoreEmpathyClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->finalize = log_store_empathy_finalize;
-
-  g_type_class_add_private (object_class, sizeof (EmpathyLogStoreEmpathyPriv));
-}
-
-static void
-empathy_log_store_empathy_init (EmpathyLogStoreEmpathy *self)
-{
-  EmpathyLogStoreEmpathyPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      EMPATHY_TYPE_LOG_STORE_EMPATHY, EmpathyLogStoreEmpathyPriv);
-
-  self->priv = priv;
-
-  priv->basedir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
-    PACKAGE_NAME, "logs", NULL);
-
-  priv->name = g_strdup ("Empathy");
-  priv->account_manager = tp_account_manager_dup ();
-}
-
-static gchar *
-log_store_account_to_dirname (TpAccount *account)
-{
-  const gchar *name;
-
-  name = tp_proxy_get_object_path (account);
-  if (g_str_has_prefix (name, TP_ACCOUNT_OBJECT_PATH_BASE))
-    name += strlen (TP_ACCOUNT_OBJECT_PATH_BASE);
-
-  return g_strdelimit (g_strdup (name), "/", '_');
-}
-
-
-static gchar *
-log_store_empathy_get_dir (EmpathyLogStore *self,
-                           TpAccount *account,
-                           const gchar *chat_id,
-                           gboolean chatroom)
-{
-  gchar *basedir;
-  gchar *escaped;
-  EmpathyLogStoreEmpathyPriv *priv;
-
-  priv = GET_PRIV (self);
-
-  escaped = log_store_account_to_dirname (account);
-
-  if (chatroom)
-    basedir = g_build_path (G_DIR_SEPARATOR_S, priv->basedir, escaped,
-        LOG_DIR_CHATROOMS, chat_id, NULL);
-  else
-    basedir = g_build_path (G_DIR_SEPARATOR_S, priv->basedir,
-        escaped, chat_id, NULL);
-
-  g_free (escaped);
-
-  return basedir;
-}
-
-static gchar *
-log_store_empathy_get_timestamp_filename (void)
-{
-  time_t t;
-  gchar *time_str;
-  gchar *filename;
-
-  t = empathy_time_get_current ();
-  time_str = empathy_time_to_string_local (t, LOG_TIME_FORMAT);
-  filename = g_strconcat (time_str, LOG_FILENAME_SUFFIX, NULL);
-
-  g_free (time_str);
-
-  return filename;
-}
-
-static gchar *
-log_store_empathy_get_timestamp_from_message (EmpathyMessage *message)
-{
-  time_t t;
-
-  t = empathy_message_get_timestamp (message);
-
-  /* We keep the timestamps in the messages as UTC. */
-  return empathy_time_to_string_utc (t, LOG_TIME_FORMAT_FULL);
-}
-
-static gchar *
-log_store_empathy_get_filename (EmpathyLogStore *self,
-                                TpAccount *account,
-                                const gchar *chat_id,
-                                gboolean chatroom)
-{
-  gchar *basedir;
-  gchar *timestamp;
-  gchar *filename;
-
-  basedir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
-  timestamp = log_store_empathy_get_timestamp_filename ();
-  filename = g_build_filename (basedir, timestamp, NULL);
-
-  g_free (basedir);
-  g_free (timestamp);
-
-  return filename;
-}
-
-static gboolean
-log_store_empathy_add_message (EmpathyLogStore *self,
-                               const gchar *chat_id,
-                               gboolean chatroom,
-                               EmpathyMessage *message,
-                               GError **error)
-{
-  FILE *file;
-  TpAccount *account;
-  EmpathyContact *sender;
-  const gchar *body_str;
-  const gchar *str;
-  EmpathyAvatar *avatar;
-  gchar *avatar_token = NULL;
-  gchar *filename;
-  gchar *basedir;
-  gchar *body;
-  gchar *timestamp;
-  gchar *contact_name;
-  gchar *contact_id;
-  TpChannelTextMessageType msg_type;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), FALSE);
-  g_return_val_if_fail (chat_id != NULL, FALSE);
-  g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
-
-  sender = empathy_message_get_sender (message);
-  account = empathy_contact_get_account (sender);
-  body_str = empathy_message_get_body (message);
-  msg_type = empathy_message_get_tptype (message);
-
-  if (EMP_STR_EMPTY (body_str))
-    return FALSE;
-
-  filename = log_store_empathy_get_filename (self, account, chat_id, chatroom);
-  basedir = g_path_get_dirname (filename);
-  if (!g_file_test (basedir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
-    {
-      DEBUG ("Creating directory:'%s'", basedir);
-      g_mkdir_with_parents (basedir, LOG_DIR_CREATE_MODE);
-    }
-  g_free (basedir);
-
-  DEBUG ("Adding message: '%s' to file: '%s'", body_str, filename);
-
-  if (!g_file_test (filename, G_FILE_TEST_EXISTS))
-    {
-      file = g_fopen (filename, "w+");
-      if (file != NULL)
-        g_fprintf (file, LOG_HEADER);
-
-      g_chmod (filename, LOG_FILE_CREATE_MODE);
-    }
-  else
-    {
-      file = g_fopen (filename, "r+");
-      if (file != NULL)
-        fseek (file, - strlen (LOG_FOOTER), SEEK_END);
-    }
-
-  body = g_markup_escape_text (body_str, -1);
-  timestamp = log_store_empathy_get_timestamp_from_message (message);
-
-  str = empathy_contact_get_name (sender);
-  contact_name = g_markup_escape_text (str, -1);
-
-  str = empathy_contact_get_id (sender);
-  contact_id = g_markup_escape_text (str, -1);
-
-  avatar = empathy_contact_get_avatar (sender);
-  if (avatar != NULL)
-    avatar_token = g_markup_escape_text (avatar->token, -1);
-
-  g_fprintf (file,
-       "<message time='%s' cm_id='%d' id='%s' name='%s' token='%s' isuser='%s' type='%s'>"
-       "%s</message>\n" LOG_FOOTER, timestamp,
-       empathy_message_get_id (message),
-       contact_id, contact_name,
-       avatar_token ? avatar_token : "",
-       empathy_contact_is_user (sender) ? "true" : "false",
-       empathy_message_type_to_str (msg_type), body);
-
-  fclose (file);
-  g_free (filename);
-  g_free (contact_id);
-  g_free (contact_name);
-  g_free (timestamp);
-  g_free (body);
-  g_free (avatar_token);
-
-  return TRUE;
-}
-
-static gboolean
-log_store_empathy_exists (EmpathyLogStore *self,
-                          TpAccount *account,
-                          const gchar *chat_id,
-                          gboolean chatroom)
-{
-  gchar *dir;
-  gboolean exists;
-
-  dir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
-  exists = g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
-  g_free (dir);
-
-  return exists;
-}
-
-static GList *
-log_store_empathy_get_dates (EmpathyLogStore *self,
-                             TpAccount *account,
-                             const gchar *chat_id,
-                             gboolean chatroom)
-{
-  GList *dates = NULL;
-  gchar *date;
-  gchar *directory;
-  GDir *dir;
-  const gchar *filename;
-  const gchar *p;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
-  g_return_val_if_fail (chat_id != NULL, NULL);
-
-  directory = log_store_empathy_get_dir (self, account, chat_id, chatroom);
-  dir = g_dir_open (directory, 0, NULL);
-  if (!dir)
-    {
-      DEBUG ("Could not open directory:'%s'", directory);
-      g_free (directory);
-      return NULL;
-    }
-
-  DEBUG ("Collating a list of dates in:'%s'", directory);
-
-  while ((filename = g_dir_read_name (dir)) != NULL)
-    {
-      if (!g_str_has_suffix (filename, LOG_FILENAME_SUFFIX))
-        continue;
-
-      p = strstr (filename, LOG_FILENAME_SUFFIX);
-      date = g_strndup (filename, p - filename);
-
-      if (!date)
-        continue;
-
-      if (!g_regex_match_simple ("\\d{8}", date, 0, 0))
-        continue;
-
-      dates = g_list_insert_sorted (dates, date, (GCompareFunc) strcmp);
-    }
-
-  g_free (directory);
-  g_dir_close (dir);
-
-  DEBUG ("Parsed %d dates", g_list_length (dates));
-
-  return dates;
-}
-
-static gchar *
-log_store_empathy_get_filename_for_date (EmpathyLogStore *self,
-                                         TpAccount *account,
-                                         const gchar *chat_id,
-                                         gboolean chatroom,
-                                         const gchar *date)
-{
-  gchar *basedir;
-  gchar *timestamp;
-  gchar *filename;
-
-  basedir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
-  timestamp = g_strconcat (date, LOG_FILENAME_SUFFIX, NULL);
-  filename = g_build_filename (basedir, timestamp, NULL);
-
-  g_free (basedir);
-  g_free (timestamp);
-
-  return filename;
-}
-
-static EmpathyLogSearchHit *
-log_store_empathy_search_hit_new (EmpathyLogStore *self,
-                                  const gchar *filename)
-{
-  EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
-  EmpathyLogSearchHit *hit;
-  gchar *account_name;
-  const gchar *end;
-  gchar **strv;
-  guint len;
-  GList *accounts, *l;
-
-  if (!g_str_has_suffix (filename, LOG_FILENAME_SUFFIX))
-    return NULL;
-
-  strv = g_strsplit (filename, G_DIR_SEPARATOR_S, -1);
-  len = g_strv_length (strv);
-
-  hit = g_slice_new0 (EmpathyLogSearchHit);
-
-  end = strstr (strv[len-1], LOG_FILENAME_SUFFIX);
-  hit->date = g_strndup (strv[len-1], end - strv[len-1]);
-  hit->chat_id = g_strdup (strv[len-2]);
-  hit->is_chatroom = (strcmp (strv[len-3], LOG_DIR_CHATROOMS) == 0);
-
-  if (hit->is_chatroom)
-    account_name = strv[len-4];
-  else
-    account_name = strv[len-3];
-
-  /* FIXME: This assumes the account manager is prepared, but the
-   * synchronous API forces this. See bug #599189. */
-  accounts = tp_account_manager_get_valid_accounts (priv->account_manager);
-
-  for (l = accounts; l != NULL; l = g_list_next (l))
-    {
-      TpAccount *account = TP_ACCOUNT (l->data);
-      gchar *name;
-
-      name = log_store_account_to_dirname (account);
-      if (!tp_strdiff (name, account_name))
-        {
-          g_assert (hit->account == NULL);
-          hit->account = account;
-          g_object_ref (account);
-        }
-      g_free (name);
-    }
-  g_list_free (accounts);
-
-  hit->filename = g_strdup (filename);
-
-  g_strfreev (strv);
-
-  return hit;
-}
-
-static GList *
-log_store_empathy_get_messages_for_file (EmpathyLogStore *self,
-                                         TpAccount *account,
-                                         const gchar *filename)
-{
-  GList *messages = NULL;
-  xmlParserCtxtPtr ctxt;
-  xmlDocPtr doc;
-  xmlNodePtr log_node;
-  xmlNodePtr node;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
-  g_return_val_if_fail (filename != NULL, NULL);
-
-  DEBUG ("Attempting to parse filename:'%s'...", filename);
-
-  if (!g_file_test (filename, G_FILE_TEST_EXISTS))
-    {
-      DEBUG ("Filename:'%s' does not exist", filename);
-      return NULL;
-    }
-
-  /* Create parser. */
-  ctxt = xmlNewParserCtxt ();
-
-  /* Parse and validate the file. */
-  doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
-  if (!doc)
-    {
-      g_warning ("Failed to parse file:'%s'", filename);
-      xmlFreeParserCtxt (ctxt);
-      return NULL;
-    }
-
-  /* The root node, presets. */
-  log_node = xmlDocGetRootElement (doc);
-  if (!log_node)
-    {
-      xmlFreeDoc (doc);
-      xmlFreeParserCtxt (ctxt);
-      return NULL;
-    }
-
-  /* Now get the messages. */
-  for (node = log_node->children; node; node = node->next)
-    {
-      EmpathyMessage *message;
-      EmpathyContact *sender;
-      gchar *time_;
-      time_t t;
-      gchar *sender_id;
-      gchar *sender_name;
-      gchar *sender_avatar_token;
-      gchar *body;
-      gchar *is_user_str;
-      gboolean is_user = FALSE;
-      gchar *msg_type_str;
-      gchar *cm_id_str;
-      guint cm_id;
-      TpChannelTextMessageType msg_type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
-
-      if (strcmp ((const gchar *) node->name, "message") != 0)
-        continue;
-
-      body = (gchar *) xmlNodeGetContent (node);
-      time_ = (gchar *) xmlGetProp (node, (const xmlChar *) "time");
-      sender_id = (gchar *) xmlGetProp (node, (const xmlChar *) "id");
-      sender_name = (gchar *) xmlGetProp (node, (const xmlChar *) "name");
-      sender_avatar_token = (gchar *) xmlGetProp (node,
-          (const xmlChar *) "token");
-      is_user_str = (gchar *) xmlGetProp (node, (const xmlChar *) "isuser");
-      msg_type_str = (gchar *) xmlGetProp (node, (const xmlChar *) "type");
-      cm_id_str = (gchar *) xmlGetProp (node, (const xmlChar *) "cm_id");
-
-      if (is_user_str)
-        is_user = strcmp (is_user_str, "true") == 0;
-
-      if (msg_type_str)
-        msg_type = empathy_message_type_from_str (msg_type_str);
-
-      if (cm_id_str)
-        cm_id = atoi (cm_id_str);
-
-      t = empathy_time_parse (time_);
-
-      sender = empathy_contact_new_for_log (account, sender_id, sender_name,
-                                           is_user);
-
-      if (!EMP_STR_EMPTY (sender_avatar_token))
-        empathy_contact_load_avatar_cache (sender,
-            sender_avatar_token);
-
-      message = empathy_message_new (body);
-      empathy_message_set_sender (message, sender);
-      empathy_message_set_timestamp (message, t);
-      empathy_message_set_tptype (message, msg_type);
-      empathy_message_set_is_backlog (message, TRUE);
-
-      if (cm_id_str)
-        empathy_message_set_id (message, cm_id);
-
-      messages = g_list_append (messages, message);
-
-      g_object_unref (sender);
-      xmlFree (time_);
-      xmlFree (sender_id);
-      xmlFree (sender_name);
-      xmlFree (body);
-      xmlFree (is_user_str);
-      xmlFree (msg_type_str);
-      xmlFree (cm_id_str);
-      xmlFree (sender_avatar_token);
-    }
-
-  DEBUG ("Parsed %d messages", g_list_length (messages));
-
-  xmlFreeDoc (doc);
-  xmlFreeParserCtxt (ctxt);
-
-  return messages;
-}
-
-static GList *
-log_store_empathy_get_all_files (EmpathyLogStore *self,
-                                 const gchar *dir)
-{
-  GDir *gdir;
-  GList *files = NULL;
-  const gchar *name;
-  const gchar *basedir;
-  EmpathyLogStoreEmpathyPriv *priv;
-
-  priv = GET_PRIV (self);
-
-  basedir = dir ? dir : priv->basedir;
-
-  gdir = g_dir_open (basedir, 0, NULL);
-  if (!gdir)
-    return NULL;
-
-  while ((name = g_dir_read_name (gdir)) != NULL)
-    {
-      gchar *filename;
-
-      filename = g_build_filename (basedir, name, NULL);
-      if (g_str_has_suffix (filename, LOG_FILENAME_SUFFIX))
-        {
-          files = g_list_prepend (files, filename);
-          continue;
-        }
-
-      if (g_file_test (filename, G_FILE_TEST_IS_DIR))
-        {
-          /* Recursively get all log files */
-          files = g_list_concat (files,
-              log_store_empathy_get_all_files (self, filename));
-        }
-
-      g_free (filename);
-    }
-
-  g_dir_close (gdir);
-
-  return files;
-}
-
-static GList *
-log_store_empathy_search_new (EmpathyLogStore *self,
-                              const gchar *text)
-{
-  GList *files, *l;
-  GList *hits = NULL;
-  gchar *text_casefold;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
-  g_return_val_if_fail (!EMP_STR_EMPTY (text), NULL);
-
-  text_casefold = g_utf8_casefold (text, -1);
-
-  files = log_store_empathy_get_all_files (self, NULL);
-  DEBUG ("Found %d log files in total", g_list_length (files));
-
-  for (l = files; l; l = g_list_next (l))
-    {
-      gchar *filename;
-      GMappedFile *file;
-      gsize length;
-      gchar *contents = NULL;
-      gchar *contents_casefold = NULL;
-
-      filename = l->data;
-
-      file = g_mapped_file_new (filename, FALSE, NULL);
-      if (file == NULL)
-        goto drinking_island;
-
-      length = g_mapped_file_get_length (file);
-      contents = g_mapped_file_get_contents (file);
-
-      if (length == 0 || contents == NULL)
-        goto drinking_island;
-
-      contents_casefold = g_utf8_casefold (contents, length);
-
-      if (strstr (contents_casefold, text_casefold))
-        {
-          EmpathyLogSearchHit *hit;
-
-          hit = log_store_empathy_search_hit_new (self, filename);
-
-          if (hit)
-            {
-              hits = g_list_prepend (hits, hit);
-              DEBUG ("Found text:'%s' in file:'%s' on date:'%s'",
-                  text, hit->filename, hit->date);
-            }
-        }
-
-drinking_island:
-      if (file != NULL)
-        g_mapped_file_unref (file);
-
-      g_free (contents_casefold);
-      g_free (filename);
-    }
-
-  g_list_free (files);
-  g_free (text_casefold);
-
-  return hits;
-}
-
-static GList *
-log_store_empathy_get_chats_for_dir (EmpathyLogStore *self,
-                                     const gchar *dir,
-                                     gboolean is_chatroom)
-{
-  GDir *gdir;
-  GList *hits = NULL;
-  const gchar *name;
-  GError *error = NULL;
-
-  gdir = g_dir_open (dir, 0, &error);
-  if (!gdir)
-    {
-      DEBUG ("Failed to open directory: %s, error: %s", dir, error->message);
-      g_error_free (error);
-      return NULL;
-    }
-
-  while ((name = g_dir_read_name (gdir)) != NULL)
-    {
-      EmpathyLogSearchHit *hit;
-
-      if (!is_chatroom && strcmp (name, LOG_DIR_CHATROOMS) == 0)
-        {
-          gchar *filename = g_build_filename (dir, name, NULL);
-          hits = g_list_concat (hits, log_store_empathy_get_chats_for_dir (
-                self, filename, TRUE));
-          g_free (filename);
-          continue;
-        }
-      hit = g_slice_new0 (EmpathyLogSearchHit);
-      hit->chat_id = g_strdup (name);
-      hit->is_chatroom = is_chatroom;
-
-      hits = g_list_prepend (hits, hit);
-    }
-
-  g_dir_close (gdir);
-
-  return hits;
-}
-
-
-static GList *
-log_store_empathy_get_messages_for_date (EmpathyLogStore *self,
-                                         TpAccount *account,
-                                         const gchar *chat_id,
-                                         gboolean chatroom,
-                                         const gchar *date)
-{
-  gchar *filename;
-  GList *messages;
-
-  g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
-  g_return_val_if_fail (chat_id != NULL, NULL);
-  g_return_val_if_fail (account != NULL, NULL);
-
-  filename = log_store_empathy_get_filename_for_date (self, account,
-      chat_id, chatroom, date);
-  messages = log_store_empathy_get_messages_for_file (self, account,
-    filename);
-  g_free (filename);
-
-  return messages;
-}
-
-static GList *
-log_store_empathy_get_chats (EmpathyLogStore *self,
-                              TpAccount *account)
-{
-  gchar *dir;
-  GList *hits;
-  EmpathyLogStoreEmpathyPriv *priv;
-
-  priv = GET_PRIV (self);
-
-  dir = log_store_empathy_get_dir (self, account, NULL, FALSE);
-
-  hits = log_store_empathy_get_chats_for_dir (self, dir, FALSE);
-
-  g_free (dir);
-
-  return hits;
-}
-
-static const gchar *
-log_store_empathy_get_name (EmpathyLogStore *self)
-{
-  EmpathyLogStoreEmpathyPriv *priv = GET_PRIV (self);
-
-  return priv->name;
-}
-
-static GList *
-log_store_empathy_get_filtered_messages (EmpathyLogStore *self,
-                                         TpAccount *account,
-                                         const gchar *chat_id,
-                                         gboolean chatroom,
-                                         guint num_messages,
-                                         EmpathyLogMessageFilter filter,
-                                         gpointer user_data)
-{
-  GList *dates, *l, *messages = NULL;
-  guint i = 0;
-
-  dates = log_store_empathy_get_dates (self, account, chat_id, chatroom);
-
-  for (l = g_list_last (dates); l && i < num_messages; l = g_list_previous (l))
-    {
-      GList *new_messages, *n, *next;
-
-      /* FIXME: We should really restrict the message parsing to get only
-       * the newest num_messages. */
-      new_messages = log_store_empathy_get_messages_for_date (self, account,
-          chat_id, chatroom, l->data);
-
-      n = new_messages;
-      while (n != NULL)
-        {
-          next = g_list_next (n);
-          if (!filter (n->data, user_data))
-            {
-              g_object_unref (n->data);
-              new_messages = g_list_delete_link (new_messages, n);
-            }
-          else
-            {
-              i++;
-            }
-          n = next;
-        }
-      messages = g_list_concat (messages, new_messages);
-    }
-
-  g_list_foreach (dates, (GFunc) g_free, NULL);
-  g_list_free (dates);
-
-  return messages;
-}
-
-static void
-log_store_iface_init (gpointer g_iface,
-                      gpointer iface_data)
-{
-  EmpathyLogStoreInterface *iface = (EmpathyLogStoreInterface *) g_iface;
-
-  iface->get_name = log_store_empathy_get_name;
-  iface->exists = log_store_empathy_exists;
-  iface->add_message = log_store_empathy_add_message;
-  iface->get_dates = log_store_empathy_get_dates;
-  iface->get_messages_for_date = log_store_empathy_get_messages_for_date;
-  iface->get_chats = log_store_empathy_get_chats;
-  iface->search_new = log_store_empathy_search_new;
-  iface->ack_message = NULL;
-  iface->get_filtered_messages = log_store_empathy_get_filtered_messages;
-}
diff --git a/libempathy/empathy-log-store-empathy.h b/libempathy/empathy-log-store-empathy.h
deleted file mode 100644 (file)
index 5ba9273..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- *          Jonny Lamb <jonny.lamb@collabora.co.uk>
- */
-
-#ifndef __EMPATHY_LOG_STORE_EMPATHY_H__
-#define __EMPATHY_LOG_STORE_EMPATHY_H__
-
-#include <config.h>
-#ifndef ENABLE_TPL
-
-#include <glib.h>
-
-#include <telepathy-glib/account.h>
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_LOG_STORE_EMPATHY \
-  (empathy_log_store_empathy_get_type ())
-#define EMPATHY_LOG_STORE_EMPATHY(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
-                               EmpathyLogStoreEmpathy))
-#define EMPATHY_LOG_STORE_EMPATHY_CLASS(vtable) \
-  (G_TYPE_CHECK_CLASS_CAST ((vtable), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
-                            EmpathyLogStoreEmpathyClass))
-#define EMPATHY_IS_LOG_STORE_EMPATHY(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_LOG_STORE_EMPATHY))
-#define EMPATHY_IS_LOG_STORE_EMPATHY_CLASS(vtable) \
-  (G_TYPE_CHECK_CLASS_TYPE ((vtable), EMPATHY_TYPE_LOG_STORE_EMPATHY))
-#define EMPATHY_LOG_STORE_EMPATHY_GET_CLASS(inst) \
-  (G_TYPE_INSTANCE_GET_CLASS ((inst), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
-                              EmpathyLogStoreEmpathyClass))
-
-typedef struct _EmpathyLogStoreEmpathy EmpathyLogStoreEmpathy;
-typedef struct _EmpathyLogStoreEmpathyClass EmpathyLogStoreEmpathyClass;
-
-struct _EmpathyLogStoreEmpathy
-{
-  GObject parent;
-  gpointer priv;
-};
-
-struct _EmpathyLogStoreEmpathyClass
-{
-  GObjectClass parent;
-};
-
-GType empathy_log_store_empathy_get_type (void);
-
-G_END_DECLS
-
-#endif /* ENABLE_TPL */
-#endif /* __EMPATHY_LOG_STORE_EMPATHY_H__ */
diff --git a/libempathy/empathy-log-store.c b/libempathy/empathy-log-store.c
deleted file mode 100644 (file)
index 512c4c0..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk>
- */
-
-#include "empathy-log-store.h"
-
-GType
-empathy_log_store_get_type (void)
-{
-  static GType type = 0;
-  if (type == 0) {
-    static const GTypeInfo info = {
-      sizeof (EmpathyLogStoreInterface),
-      NULL,   /* base_init */
-      NULL,   /* base_finalize */
-      NULL,   /* class_init */
-      NULL,   /* class_finalize */
-      NULL,   /* class_data */
-      0,
-      0,      /* n_preallocs */
-      NULL    /* instance_init */
-    };
-    type = g_type_register_static (G_TYPE_INTERFACE, "EmpathyLogStore",
-        &info, 0);
-  }
-  return type;
-}
-
-const gchar *
-empathy_log_store_get_name (EmpathyLogStore *self)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name (self);
-}
-
-gboolean
-empathy_log_store_exists (EmpathyLogStore *self,
-                          TpAccount *account,
-                          const gchar *chat_id,
-                          gboolean chatroom)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists)
-    return FALSE;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists (
-      self, account, chat_id, chatroom);
-}
-
-
-
-gboolean
-empathy_log_store_add_message (EmpathyLogStore *self,
-                               const gchar *chat_id,
-                               gboolean chatroom,
-                               EmpathyMessage *message,
-                               GError **error)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message)
-    return FALSE;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message (
-      self, chat_id, chatroom, message, error);
-}
-
-GList *
-empathy_log_store_get_dates (EmpathyLogStore *self,
-                             TpAccount *account,
-                             const gchar *chat_id,
-                             gboolean chatroom)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates (
-      self, account, chat_id, chatroom);
-}
-
-GList *
-empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
-                                         TpAccount *account,
-                                         const gchar *chat_id,
-                                         gboolean chatroom,
-                                         const gchar *date)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date (
-      self, account, chat_id, chatroom, date);
-}
-
-GList *
-empathy_log_store_get_last_messages (EmpathyLogStore *self,
-                                     TpAccount *account,
-                                     const gchar *chat_id,
-                                     gboolean chatroom)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages (
-      self, account, chat_id, chatroom);
-}
-
-GList *
-empathy_log_store_get_chats (EmpathyLogStore *self,
-                             TpAccount *account)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats (self, account);
-}
-
-GList *
-empathy_log_store_search_new (EmpathyLogStore *self,
-                              const gchar *text)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new (self, text);
-}
-
-void
-empathy_log_store_ack_message (EmpathyLogStore *self,
-                               const gchar *chat_id,
-                               gboolean chatroom,
-                               EmpathyMessage *message)
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message)
-    return;
-
-  EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message (
-      self, chat_id, chatroom, message);
-}
-
-GList *
-empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
-                                         TpAccount *account,
-                                         const gchar *chat_id,
-                                         gboolean chatroom,
-                                         guint num_messages,
-                                         EmpathyLogMessageFilter filter,
-                                         gpointer user_data)
-
-{
-  if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_filtered_messages)
-    return NULL;
-
-  return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_filtered_messages (
-      self, account, chat_id, chatroom, num_messages, filter, user_data);
-}
diff --git a/libempathy/empathy-log-store.h b/libempathy/empathy-log-store.h
deleted file mode 100644 (file)
index 185e38c..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk>
- */
-
-#ifndef __EMPATHY_LOG_STORE_H__
-#define __EMPATHY_LOG_STORE_H__
-
-#include <config.h>
-#ifndef ENABLE_TPL
-
-#include <glib-object.h>
-
-#include <telepathy-glib/account.h>
-
-#include "empathy-message.h"
-#include "empathy-log-manager.h"
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_LOG_STORE (empathy_log_store_get_type ())
-#define EMPATHY_LOG_STORE(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_LOG_STORE, \
-                               EmpathyLogStore))
-#define EMPATHY_IS_LOG_STORE(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_LOG_STORE))
-#define EMPATHY_LOG_STORE_GET_INTERFACE(inst) \
-  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EMPATHY_TYPE_LOG_STORE, \
-                                  EmpathyLogStoreInterface))
-
-typedef struct _EmpathyLogStore EmpathyLogStore; /* dummy object */
-typedef struct _EmpathyLogStoreInterface EmpathyLogStoreInterface;
-
-struct _EmpathyLogStoreInterface
-{
-  GTypeInterface parent;
-
-  const gchar * (*get_name) (EmpathyLogStore *self);
-  gboolean (*exists) (EmpathyLogStore *self, TpAccount *account,
-      const gchar *chat_id, gboolean chatroom);
-  gboolean (*add_message) (EmpathyLogStore *self, const gchar *chat_id,
-      gboolean chatroom, EmpathyMessage *message, GError **error);
-  GList * (*get_dates) (EmpathyLogStore *self, TpAccount *account,
-      const gchar *chat_id, gboolean chatroom);
-  GList * (*get_messages_for_date) (EmpathyLogStore *self,
-      TpAccount *account, const gchar *chat_id, gboolean chatroom,
-      const gchar *date);
-  GList * (*get_last_messages) (EmpathyLogStore *self, TpAccount *account,
-      const gchar *chat_id, gboolean chatroom);
-  GList * (*get_chats) (EmpathyLogStore *self,
-            TpAccount    *account);
-  GList * (*search_new) (EmpathyLogStore *self, const gchar *text);
-  void (*ack_message) (EmpathyLogStore *self, const gchar *chat_id,
-      gboolean chatroom, EmpathyMessage *message);
-  GList * (*get_filtered_messages) (EmpathyLogStore *self, TpAccount *account,
-      const gchar *chat_id, gboolean chatroom, guint num_messages,
-      EmpathyLogMessageFilter filter, gpointer user_data);
-};
-
-GType empathy_log_store_get_type (void) G_GNUC_CONST;
-
-const gchar *empathy_log_store_get_name (EmpathyLogStore *self);
-gboolean empathy_log_store_exists (EmpathyLogStore *self,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom);
-gboolean empathy_log_store_add_message (EmpathyLogStore *self,
-    const gchar *chat_id, gboolean chatroom, EmpathyMessage *message,
-    GError **error);
-GList *empathy_log_store_get_dates (EmpathyLogStore *self,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom);
-GList *empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom,
-    const gchar *date);
-GList *empathy_log_store_get_last_messages (EmpathyLogStore *self,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom);
-GList *empathy_log_store_get_chats (EmpathyLogStore *self,
-    TpAccount *account);
-GList *empathy_log_store_search_new (EmpathyLogStore *self,
-    const gchar *text);
-void empathy_log_store_ack_message (EmpathyLogStore *self,
-    const gchar *chat_id, gboolean chatroom, EmpathyMessage *message);
-GList *empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
-    TpAccount *account, const gchar *chat_id, gboolean chatroom,
-    guint num_messages, EmpathyLogMessageFilter filter, gpointer user_data);
-
-G_END_DECLS
-
-#endif /* ENABLE_TPL */
-#endif /* __EMPATHY_LOG_STORE_H__ */
index 85d5cbc588bf107e5cce92eef8057e2d71b03540..3d755c92b3520ede964c6415cdbb9bdd1602aad7 100644 (file)
 #include <string.h>
 
 #include <telepathy-glib/util.h>
-#ifdef ENABLE_TPL
 #include <telepathy-glib/account.h>
 #include <telepathy-glib/account-manager.h>
 
-#include <telepathy-logger/contact.h>
-#include <telepathy-logger/log-entry.h>
-#include <telepathy-logger/log-entry-text.h>
-#endif /* ENABLE_TPL */
+#include <telepathy-logger/entity.h>
+#include <telepathy-logger/entry.h>
+#include <telepathy-logger/entry-text.h>
 
 #include "empathy-message.h"
 #include "empathy-utils.h"
@@ -260,18 +258,17 @@ empathy_message_new (const gchar *body)
                             NULL);
 }
 
-#ifdef ENABLE_TPL
 EmpathyMessage *
-empathy_message_from_tpl_log_entry (TplLogEntry *logentry)
+empathy_message_from_tpl_log_entry (TplEntry *logentry)
 {
        EmpathyMessage *retval = NULL;
        TpAccountManager *acc_man = NULL;
        TpAccount *account = NULL;
-       TplContact *receiver = NULL;
-       TplContact *sender = NULL;
+       TplEntity *receiver = NULL;
+       TplEntity *sender = NULL;
        gchar *body= NULL;
 
-       g_return_val_if_fail (TPL_IS_LOG_ENTRY (logentry), NULL);
+       g_return_val_if_fail (TPL_IS_ENTRY (logentry), NULL);
 
        acc_man = tp_account_manager_dup ();
        /* FIXME Currently Empathy shows in the log viewer only valid accounts, so it
@@ -279,31 +276,31 @@ empathy_message_from_tpl_log_entry (TplLogEntry *logentry)
         * When #610455 will be fixed, calling tp_account_manager_ensure_account ()
         * might add a not existing account to the AM. tp_account_new () probably
         * will be the best way to handle it.
-        * Note: When creating an EmpathyContact from a TplContact instance, the
+        * Note: When creating an EmpathyContact from a TplEntity instance, the
         * TpAccount is passed *only* to let EmpathyContact be able to retrieve the
         * avatar (contact_get_avatar_filename () need a TpAccount).
         * If the way EmpathyContact stores the avatar is changes, it might not be
         * needed anymore any TpAccount passing and the following call will be
         * useless */
        account = tp_account_manager_ensure_account (acc_man,
-                       tpl_log_entry_get_account_path (logentry));
+                       tpl_entry_get_account_path (logentry));
        g_object_unref (acc_man);
 
-       /* TODO Currently only TplLogEntryText exists as subclass of TplLogEntry, in
-        * future more TplLogEntry will exist and EmpathyMessage should probably
+       /* TODO Currently only TplLogEntryText exists as subclass of TplEntry, in
+        * future more TplEntry will exist and EmpathyMessage should probably
         * be enhanced to support other types of log entries (ie TplLogEntryCall).
         *
         * For now we just check (simply) that we are dealing with the only supported type,
         * then there will be a if/then/else or switch handling all the supported
         * cases.
         */
-       if (!TPL_IS_LOG_ENTRY_TEXT (logentry))
+       if (!TPL_IS_ENTRY_TEXT (logentry))
                return NULL;
 
-       body = g_strdup (tpl_log_entry_text_get_message (
-                               TPL_LOG_ENTRY_TEXT (logentry)));
-       receiver = tpl_log_entry_text_get_receiver (TPL_LOG_ENTRY_TEXT (logentry));
-       sender = tpl_log_entry_text_get_sender (TPL_LOG_ENTRY_TEXT (logentry));
+       body = g_strdup (tpl_entry_text_get_message (
+                               TPL_ENTRY_TEXT (logentry)));
+       receiver = tpl_entry_get_receiver (logentry);
+       sender = tpl_entry_get_sender (logentry);
 
        retval = empathy_message_new (body);
        if (receiver != NULL)
@@ -314,16 +311,15 @@ empathy_message_from_tpl_log_entry (TplLogEntry *logentry)
                                empathy_contact_from_tpl_contact (account, sender));
 
        empathy_message_set_timestamp (retval,
-                       tpl_log_entry_get_timestamp (logentry));
+                       tpl_entry_get_timestamp (logentry));
        empathy_message_set_id (retval,
-                       tpl_log_entry_text_get_log_id (TPL_LOG_ENTRY_TEXT (logentry)));
+                       tpl_entry_text_get_pending_msg_id (TPL_ENTRY_TEXT (logentry)));
        empathy_message_set_is_backlog (retval, FALSE);
 
        g_free (body);
 
        return retval;
 }
-#endif /* ENABLE_TPL */
 
 TpChannelTextMessageType
 empathy_message_get_tptype (EmpathyMessage *message)
index d8d0c96039e718a990f885ad75bcc30b1cf50700..b7a63f81e027f7301212e2c25af74e63a72330c2 100644 (file)
@@ -26,9 +26,7 @@
 #define __EMPATHY_MESSAGE_H__
 
 #include <glib-object.h>
-#ifdef ENABLE_TPL
-#include <telepathy-logger/log-entry.h>
-#endif
+#include <telepathy-logger/entry.h>
 
 #include "empathy-contact.h"
 #include "empathy-time.h"
@@ -56,9 +54,7 @@ struct _EmpathyMessageClass {
 
 GType                    empathy_message_get_type          (void) G_GNUC_CONST;
 EmpathyMessage *         empathy_message_new               (const gchar              *body);
-#ifdef ENABLE_TPL
-EmpathyMessage *         empathy_message_from_tpl_log_entry (TplLogEntry             *logentry);
-#endif /* ENABLE_TPL */
+EmpathyMessage *         empathy_message_from_tpl_log_entry (TplEntry                *logentry);
 TpChannelTextMessageType empathy_message_get_tptype        (EmpathyMessage           *message);
 void                     empathy_message_set_tptype        (EmpathyMessage           *message,
                                                            TpChannelTextMessageType  type);
index a39636dde6f0101c14382dd7585504c1b0c1bc98..13e17d152730e9a23f49c903a08e6a7f868b80a3 100644 (file)
@@ -1,21 +1,21 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2003-2007 Imendio AB
+ * Copyright (C) 2007-2010 Collabora Ltd.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * Authors: Richard Hult <richard@imendio.com>
  */
index 2875d2f9f57bb98dc09c6e9681417e5d5cc10471..224b25cbf52da56e6cbc19763eddba9f79eb486b 100644 (file)
@@ -1,21 +1,21 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2004 Imendio AB
+ * Copyright (C) 2007-2010 Collabora Ltd.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef __EMPATHY_TIME_H__
diff --git a/m4/gsettings.m4 b/m4/gsettings.m4
new file mode 100644 (file)
index 0000000..b686989
--- /dev/null
@@ -0,0 +1,80 @@
+dnl GLIB_GSETTINGS
+dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
+dnl the schema should be compiled
+dnl
+
+AC_DEFUN([GLIB_GSETTINGS],
+[
+  m4_pattern_allow([AM_V_GEN])
+  AC_ARG_ENABLE(schemas-compile,
+                AC_HELP_STRING([--disable-schemas-compile],
+                               [Disable regeneration of gschemas.compiled on install]),
+                [case ${enableval} in
+                  yes) GSETTINGS_DISABLE_SCHEMAS_COMPILE=""  ;;
+                  no)  GSETTINGS_DISABLE_SCHEMAS_COMPILE="1" ;;
+                  *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-compile]) ;;
+                 esac])
+  AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
+  PKG_PROG_PKG_CONFIG([0.16])
+  AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
+  AC_SUBST(GLIB_COMPILE_SCHEMAS, `$PKG_CONFIG --variable glib_compile_schemas gio-2.0`)
+  if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
+    AC_MSG_ERROR([glib-compile-schemas not found.])
+  fi
+
+  GSETTINGS_RULES='
+.PHONY : uninstall-gsettings-schemas install-gsettings-schemas clean-gsettings-schemas
+
+mostlyclean-am: clean-gsettings-schemas
+
+%.gschema.valid: %.gschema.xml
+       $(AM_V_GEN) if test -f "$^"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --dry-run --schema-file=$${d}$^ && touch [$]@
+
+all-am: $(gsettings_SCHEMAS:.xml=.valid)
+uninstall-am: uninstall-gsettings-schemas
+install-data-am: install-gsettings-schemas
+
+.SECONDARY: $(gsettings_SCHEMAS)
+
+gsettings__base_list = \
+  sed "$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g" | \
+  sed "$$!N;$$!N;$$!N;$$!N;s/\n/ /g"
+
+install-gsettings-schemas: $(gsettings_SCHEMAS:.xml=.valid)
+       @$(NORMAL_INSTALL)
+       test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"
+       @list='\''$(gsettings_SCHEMAS)'\''; test -n "$(gsettingsschemadir)" || list=; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(gsettings__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '\''$(DESTDIR)$(gsettingsschemadir)'\''"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(gsettingsschemadir)" || exit $$?; \
+       done
+       test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
+
+uninstall-gsettings-schemas:
+       @$(NORMAL_UNINSTALL)
+       @list='\''$(gsettings_SCHEMAS)'\''; test -n "$(gsettingsschemadir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+       test -n "$$files" || exit 0; \
+       echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
+       cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
+       test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) --uninstall $(gsettingsschemadir)
+
+clean-gsettings-schemas:
+       rm -f $(gsettings_SCHEMAS:.xml=.valid)
+
+'
+  _GSETTINGS_SUBST(GSETTINGS_RULES)
+])
+
+dnl _GSETTINGS_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_GSETTINGS_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)
index 41020dd11551d65b1f2717dd195d1d1a701d6166..6f8017f4583fa94ba280cec3335cae1eec5a1f1b 100644 (file)
@@ -13,7 +13,6 @@ CPPFLAGS_COMMON =                                     \
 AM_LDFLAGS = -lm
 AM_CPPFLAGS =                                          \
        $(CPPFLAGS_COMMON)                              \
-       $(TPL_CFLAGS)                                   \
        $(LIBNOTIFY_CFLAGS)                             \
        $(LIBCHAMPLAIN_CFLAGS)                          \
        $(WEBKIT_CFLAGS)                                \
@@ -23,7 +22,6 @@ LDADD =                                                               \
        $(top_builddir)/libempathy-gtk/libempathy-gtk.la        \
        $(top_builddir)/libempathy/libempathy.la                \
        $(top_builddir)/extensions/libemp-extensions.la         \
-       $(TPL_LIBS)                                             \
        $(LIBNOTIFY_LIBS)                                       \
        $(EMPATHY_LIBS)                                         \
        $(LIBCHAMPLAIN_LIBS)                                    \
index 060345a9e10ca55a4a9c5885f1d3513f27a68166..6ad4756522f5c815cb6a00023bd03bae0a97d4b4 100644 (file)
@@ -36,7 +36,6 @@
 #include <libempathy-gtk/empathy-account-widget.h>
 #include <libempathy-gtk/empathy-protocol-chooser.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-conf.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
 #include <libempathy/empathy-debug.h>
index d81d3de2ddb2c7a260f8de65b5fbc3217552bdb9..12ac5b24438282692c8fce4c2a210428d0d89096 100644 (file)
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-connection-managers.h>
 #include <libempathy/empathy-connectivity.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy/empathy-gsettings.h>
 
+#include <libempathy-gtk/empathy-ui-utils.h>
 #include <libempathy-gtk/empathy-protocol-chooser.h>
 #include <libempathy-gtk/empathy-account-widget.h>
 #include <libempathy-gtk/empathy-account-widget-irc.h>
 #include <libempathy-gtk/empathy-account-widget-sip.h>
 #include <libempathy-gtk/empathy-cell-renderer-activatable.h>
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-images.h>
 
 #include "empathy-accounts-dialog.h"
@@ -2219,8 +2219,8 @@ do_constructed (GObject *object)
 {
   EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (object);
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-  gboolean import_asked;
   GtkTreeModel *model;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
 
   accounts_dialog_build_ui (dialog);
   accounts_dialog_model_setup (dialog);
@@ -2237,19 +2237,15 @@ do_constructed (GObject *object)
   tp_account_manager_prepare_async (priv->account_manager, NULL,
       accounts_dialog_manager_ready_cb, dialog);
 
-  empathy_conf_get_bool (empathy_conf_get (),
-      EMPATHY_PREFS_IMPORT_ASKED, &import_asked);
-
   if (empathy_import_accounts_to_import ())
     {
       gtk_widget_show (priv->button_import);
 
-      if (!import_asked)
+      if (!g_settings_get_boolean (gsettings, EMPATHY_PREFS_IMPORT_ASKED))
         {
           GtkWidget *import_dialog;
 
-          empathy_conf_set_bool (empathy_conf_get (),
-              EMPATHY_PREFS_IMPORT_ASKED, TRUE);
+          g_settings_set_boolean (gsettings, EMPATHY_PREFS_IMPORT_ASKED, TRUE);
           import_dialog = empathy_import_dialog_new (GTK_WINDOW (dialog),
               FALSE);
           gtk_widget_show (import_dialog);
@@ -2257,6 +2253,8 @@ do_constructed (GObject *object)
     }
 
   priv->connectivity = empathy_connectivity_dup_singleton ();
+
+  g_object_unref (gsettings);
 }
 
 static void
index 0a96316f13a90cdbcb327482dd89c7c75533f4e9..23484dd457065d8d4e70385324010e10ea13ddd6 100644 (file)
@@ -29,7 +29,6 @@
 #include <libebook/e-book.h>
 
 #include <libempathy/empathy-account-settings.h>
-#include <libempathy-gtk/empathy-conf.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
 #include <libempathy/empathy-debug.h>
index 8a0502b262e2bb2735016b45d3ff3a6cdd7f4907..a80d3fee5be7214e95cbabb457b93d92dcc4368b 100644 (file)
 #include <libempathy/empathy-contact.h>
 #include <libempathy/empathy-message.h>
 #include <libempathy/empathy-chatroom-manager.h>
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-contact-list.h>
 
 #include <libempathy-gtk/empathy-images.h>
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-contact-dialogs.h>
 #include <libempathy-gtk/empathy-log-window.h>
 #include <libempathy-gtk/empathy-geometry.h>
@@ -519,9 +519,10 @@ chat_window_icon_update (EmpathyChatWindowPriv *priv)
                gtk_window_set_icon_name (GTK_WINDOW (priv->dialog),
                                          EMPATHY_IMAGE_MESSAGE);
        } else {
-               empathy_conf_get_bool (empathy_conf_get (),
-                                      EMPATHY_PREFS_CHAT_AVATAR_IN_ICON,
-                                      &avatar_in_icon);
+               GSettings *gsettings = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+
+               avatar_in_icon = g_settings_get_boolean (gsettings,
+                               EMPATHY_PREFS_CHAT_AVATAR_IN_ICON);
 
                if (n_chats == 1 && avatar_in_icon) {
                        remote_contact = empathy_chat_get_remote_contact (priv->current_chat);
@@ -534,6 +535,8 @@ chat_window_icon_update (EmpathyChatWindowPriv *priv)
                } else {
                        gtk_window_set_icon_name (GTK_WINDOW (priv->dialog), NULL);
                }
+
+               g_object_unref (gsettings);
        }
 }
 
@@ -1264,8 +1267,14 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
        if (!empathy_notify_manager_notification_is_enabled (priv->notify_mgr)) {
                return;
        } else {
-               empathy_conf_get_bool (empathy_conf_get (),
-                                      EMPATHY_PREFS_NOTIFICATIONS_FOCUS, &res);
+               GSettings *gsettings = g_settings_new (
+                               EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
+
+               res = g_settings_get_boolean (gsettings,
+                               EMPATHY_PREFS_NOTIFICATIONS_FOCUS);
+
+               g_object_unref (gsettings);
+
                if (!res) {
                        return;
                }
@@ -2068,12 +2077,14 @@ empathy_chat_window_new (void)
 EmpathyChatWindow *
 empathy_chat_window_get_default (gboolean room)
 {
+       GSettings *gsettings = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
        GList    *l;
        gboolean  separate_windows = TRUE;
 
-       empathy_conf_get_bool (empathy_conf_get (),
-                             EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
-                             &separate_windows);
+       separate_windows = g_settings_get_boolean (gsettings,
+                       EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS);
+
+       g_object_unref (gsettings);
 
        if (separate_windows) {
                /* Always create a new window */
@@ -2141,12 +2152,14 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window,
 
        /* If this window has just been created, position it */
        if (priv->chats == NULL) {
+               GSettings *gsettings = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
                const gchar *name = "chat-window";
                gboolean     separate_windows;
 
-               empathy_conf_get_bool (empathy_conf_get (),
-                                      EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
-                                      &separate_windows);
+               separate_windows = g_settings_get_boolean (gsettings,
+                               EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS);
+
+               g_object_unref (gsettings);
 
                if (separate_windows) {
                        name = empathy_chat_get_id (chat);
index 7d144dda874548c773f0feedfc7df81cf39dbddc..1a91c22fa50b49b36b8d90aecde5dba5a3273719 100644 (file)
 #include <libempathy/empathy-tp-file.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-call-factory.h>
+#include <libempathy/empathy-gsettings.h>
 
 #include <extensions/extensions.h>
 
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-images.h>
 #include <libempathy-gtk/empathy-contact-dialogs.h>
 #include <libempathy-gtk/empathy-sound.h>
@@ -939,8 +939,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
 {
   TpAccount *account;
   gchar *header = NULL;
-  gboolean preference = FALSE;
   EmpathyIdle *idle;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
 
   account = empathy_contact_get_account (contact);
   idle = empathy_idle_dup_singleton ();
@@ -949,7 +949,7 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
     goto out;
 
   if (tp_connection_presence_type_cmp_availability (previous,
-     TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+        TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
     {
       /* contact was online */
       if (tp_connection_presence_type_cmp_availability (current,
@@ -959,9 +959,8 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
           empathy_sound_play (empathy_main_window_get (),
               EMPATHY_SOUND_CONTACT_DISCONNECTED);
 
-          empathy_conf_get_bool (empathy_conf_get (),
-              EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT, &preference);
-          if (preference)
+          if (g_settings_get_boolean (gsettings,
+                EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT))
             {
               header = g_strdup_printf (_("%s is now offline."),
                   empathy_contact_get_name (contact));
@@ -974,16 +973,15 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
   else
     {
       /* contact was offline */
-      if (preference && tp_connection_presence_type_cmp_availability (current,
-          TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+      if (tp_connection_presence_type_cmp_availability (current,
+            TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
         {
           /* someone is logging in */
           empathy_sound_play (empathy_main_window_get (),
               EMPATHY_SOUND_CONTACT_CONNECTED);
 
-          empathy_conf_get_bool (empathy_conf_get (),
-              EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN, &preference);
-          if (preference)
+          if (g_settings_get_boolean (gsettings,
+                EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN))
             {
               header = g_strdup_printf (_("%s is now online."),
                   empathy_contact_get_name (contact));
@@ -997,6 +995,7 @@ event_manager_presence_changed_cb (EmpathyContact *contact,
 
 out:
   g_object_unref (idle);
+  g_object_unref (gsettings);
 }
 
 static void
index e681f8441f1a76be01881779718afa66d3a3be38..34ac1adac583a8f1dfc7a102c4eb187cb61dc8c0 100644 (file)
@@ -40,7 +40,6 @@
 #include <libempathy/empathy-tp-file.h>
 #include <libempathy/empathy-utils.h>
 
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 #include <libempathy-gtk/empathy-geometry.h>
 #include <libempathy-gtk/empathy-images.h>
index 1d5fd674a008912f99f8e60fe002d581528079e9..24332d23a5a6fd376d4fbbaf1089bff11971520a 100644 (file)
@@ -33,6 +33,7 @@
 #include <gnome-keyring.h>
 #include <libempathy/empathy-account-settings.h>
 #include <libempathy/empathy-connection-managers.h>
+#include <libempathy/empathy-gsettings.h>
 
 #include "empathy-import-mc4-accounts.h"
 
@@ -40,7 +41,6 @@
 #include <libempathy/empathy-debug.h>
 
 #define MC_ACCOUNTS_GCONF_BASE "/apps/telepathy/mc/accounts"
-#define IMPORTED_MC4_ACCOUNTS "/apps/empathy/accounts/imported_mc4_accounts"
 
 typedef struct
 {
@@ -463,13 +463,15 @@ failed:
 gboolean
 empathy_import_mc4_has_imported (void)
 {
-  GConfClient *client;
+  GSettings *gsettings;
   gboolean ret;
 
-  client = gconf_client_get_default ();
+  gsettings = g_settings_new (EMPATHY_PREFS_ACCOUNTS_SCHEMA);
 
-  ret = gconf_client_get_bool (client, IMPORTED_MC4_ACCOUNTS, NULL);
-  g_object_unref (client);
+  ret = g_settings_get_boolean (gsettings,
+      EMPATHY_PREFS_ACCOUNTS_IMPORTED_MC4_ACCOUNTS);
+
+  g_object_unref (gsettings);
 
   return ret;
 }
@@ -478,6 +480,7 @@ gboolean
 empathy_import_mc4_accounts (EmpathyConnectionManagers *managers)
 {
   GConfClient *client;
+  GSettings *gsettings;
   GError *error = NULL;
   GSList *dir, *dirs = NULL;
   gboolean imported_mc4_accounts;
@@ -486,17 +489,10 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers)
   g_return_val_if_fail (empathy_connection_managers_is_ready (managers),
     FALSE);
 
+  gsettings = g_settings_new (EMPATHY_PREFS_ACCOUNTS_SCHEMA);
   client = gconf_client_get_default ();
 
-  imported_mc4_accounts = gconf_client_get_bool (client,
-      IMPORTED_MC4_ACCOUNTS, &error);
-
-  if (error != NULL)
-    {
-      DEBUG ("Failed to get import_mc4_accounts key: %s", error->message);
-      g_error_free (error);
-      goto out;
-    }
+  imported_mc4_accounts = empathy_import_mc4_has_imported ();
 
   if (imported_mc4_accounts)
     {
@@ -525,9 +521,12 @@ empathy_import_mc4_accounts (EmpathyConnectionManagers *managers)
     }
 
 out:
-  gconf_client_set_bool (client, IMPORTED_MC4_ACCOUNTS, TRUE, NULL);
+  g_settings_set_boolean (gsettings,
+      EMPATHY_PREFS_ACCOUNTS_IMPORTED_MC4_ACCOUNTS, TRUE);
 
   g_slist_free (dirs);
   g_object_unref (client);
+  g_object_unref (gsettings);
+
   return imported;
 }
index 998c024fe20a94dbb20cbd35084671571c631ad6..3a6bf0ae4ab3c5beb084a451f50324152c90a1c7 100644 (file)
@@ -38,9 +38,9 @@
 #include <libempathy/empathy-chatroom.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-status-presets.h>
 
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-contact-dialogs.h>
 #include <libempathy-gtk/empathy-contact-list-store.h>
 #include <libempathy-gtk/empathy-contact-list-view.h>
@@ -91,6 +91,9 @@ typedef struct {
        guint                    flash_timeout_id;
        gboolean                 flash_on;
 
+       GSettings              *gsettings_ui;
+       GSettings              *gsettings_contacts;
+
        GtkWidget              *window;
        GtkWidget              *main_vbox;
        GtkWidget              *throbber;
@@ -622,6 +625,9 @@ main_window_destroy_cb (GtkWidget         *widget,
        g_object_unref (window->ui_manager);
        g_object_unref (window->chatroom_manager);
 
+       g_object_unref (window->gsettings_ui);
+       g_object_unref (window->gsettings_contacts);
+
        g_free (window);
 }
 
@@ -691,9 +697,9 @@ main_window_view_show_offline_cb (GtkToggleAction   *action,
        gboolean current;
 
        current = gtk_toggle_action_get_active (action);
-       empathy_conf_set_bool (empathy_conf_get (),
-                             EMPATHY_PREFS_UI_SHOW_OFFLINE,
-                             current);
+       g_settings_set_boolean (window->gsettings_ui,
+                               EMPATHY_PREFS_UI_SHOW_OFFLINE,
+                               current);
 
        /* Turn off sound just while we alter the contact list. */
        // FIXME: empathy_sound_set_enabled (FALSE);
@@ -702,13 +708,15 @@ main_window_view_show_offline_cb (GtkToggleAction   *action,
 }
 
 static void
-main_window_notify_sort_contact_cb (EmpathyConf       *conf,
+main_window_notify_sort_contact_cb (GSettings         *gsettings,
                                    const gchar       *key,
                                    EmpathyMainWindow *window)
 {
-       gchar *str = NULL;
+       gchar *str;
 
-       if (empathy_conf_get_string (conf, key, &str) && str) {
+       str = g_settings_get_string (gsettings, key);
+
+       if (str != NULL) {
                GType       type;
                GEnumClass *enum_class;
                GEnumValue *enum_value;
@@ -752,9 +760,9 @@ main_window_view_sort_contacts_cb (GtkRadioAction    *action,
                g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioAction index:%d",
                           g_slist_index (group, action));
        } else {
-               empathy_conf_set_string (empathy_conf_get (),
-                                        EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
-                                        enum_value->value_nick);
+               g_settings_set_string (window->gsettings_contacts,
+                                      EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
+                                      enum_value->value_nick);
        }
        empathy_contact_list_store_set_sort_criterium (window->list_store, value);
 }
@@ -767,11 +775,11 @@ main_window_view_show_protocols_cb (GtkToggleAction   *action,
 
        value = gtk_toggle_action_get_active (action);
 
-       empathy_conf_set_bool (empathy_conf_get (),
-                                        EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
-                                        value == TRUE);
+       g_settings_set_boolean (window->gsettings_ui,
+                               EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
+                               value);
        empathy_contact_list_store_set_show_protocols (window->list_store,
-                                        value == TRUE);
+                                                      value);
 }
 
 /* Matches GtkRadioAction values set in empathy-main-window.ui */
@@ -788,12 +796,13 @@ main_window_view_contacts_list_size_cb (GtkRadioAction    *action,
 
        value = gtk_radio_action_get_current_value (action);
 
-       empathy_conf_set_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_UI_SHOW_AVATARS,
-                              value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
-       empathy_conf_set_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
-                              value == CONTACT_LIST_COMPACT_SIZE);
+       g_settings_set_boolean (window->gsettings_ui,
+                               EMPATHY_PREFS_UI_SHOW_AVATARS,
+                               value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
+
+       g_settings_set_boolean (window->gsettings_ui,
+                               EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
+                               value == CONTACT_LIST_COMPACT_SIZE);
 
        empathy_contact_list_store_set_show_avatars (window->list_store,
                                                     value == CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS);
@@ -801,44 +810,33 @@ main_window_view_contacts_list_size_cb (GtkRadioAction    *action,
                                                   value == CONTACT_LIST_COMPACT_SIZE);
 }
 
-static void main_window_notify_show_protocols_cb (EmpathyConf       *conf,
+static void main_window_notify_show_protocols_cb (GSettings         *gsettings,
                                                  const gchar       *key,
                                                  EmpathyMainWindow *window)
 {
-       gboolean show_protocols;
-
-       if (empathy_conf_get_bool (conf,
-                                  EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
-                                  &show_protocols)) {
-               gtk_toggle_action_set_active (window->show_protocols,
-                                             show_protocols);
-       }
+       gtk_toggle_action_set_active (window->show_protocols,
+                       g_settings_get_boolean (gsettings,
+                               EMPATHY_PREFS_UI_SHOW_PROTOCOLS));
 }
 
 
 static void
-main_window_notify_contact_list_size_cb (EmpathyConf       *conf,
+main_window_notify_contact_list_size_cb (GSettings         *gsettings,
                                         const gchar       *key,
                                         EmpathyMainWindow *window)
 {
-       gboolean show_avatars;
-       gboolean compact_contact_list;
        gint value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS;
 
-       if (empathy_conf_get_bool (conf,
-                                  EMPATHY_PREFS_UI_SHOW_AVATARS,
-                                  &show_avatars)
-           && empathy_conf_get_bool (conf,
-                                     EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
-                                     &compact_contact_list)) {
-               if (compact_contact_list) {
-                       value = CONTACT_LIST_COMPACT_SIZE;
-               } else if (show_avatars) {
-                       value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS;
-               } else {
-                       value = CONTACT_LIST_NORMAL_SIZE;
-               }
+       if (g_settings_get_boolean (gsettings,
+                       EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST)) {
+               value = CONTACT_LIST_COMPACT_SIZE;
+       } else if (g_settings_get_boolean (gsettings,
+                       EMPATHY_PREFS_UI_SHOW_AVATARS)) {
+               value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS;
+       } else {
+               value = CONTACT_LIST_NORMAL_SIZE;
        }
+
        /* By changing the value of the GtkRadioAction,
           it emits a signal that calls main_window_view_contacts_list_size_cb
           which updates the contacts list */
@@ -1277,15 +1275,12 @@ main_window_account_validity_changed_cb (TpAccountManager  *manager,
 }
 
 static void
-main_window_notify_show_offline_cb (EmpathyConf *conf,
+main_window_notify_show_offline_cb (GSettings   *gsettings,
                                    const gchar *key,
                                    gpointer     toggle_action)
 {
-       gboolean show_offline;
-
-       if (empathy_conf_get_bool (conf, key, &show_offline)) {
-               gtk_toggle_action_set_active (toggle_action, show_offline);
-       }
+       gtk_toggle_action_set_active (toggle_action,
+                       g_settings_get_boolean (gsettings, key));
 }
 
 static void
@@ -1383,7 +1378,6 @@ empathy_main_window_show (void)
        EmpathyMainWindow        *window;
        EmpathyContactList       *list_iface;
        GtkBuilder               *gui;
-       EmpathyConf              *conf;
        GtkWidget                *sw;
        GtkToggleAction          *show_offline_widget;
        GtkAction                *show_map_widget;
@@ -1400,6 +1394,9 @@ empathy_main_window_show (void)
        main_window = g_new0 (EmpathyMainWindow, 1);
        window = main_window;
 
+       window->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
+       window->gsettings_contacts = g_settings_new (EMPATHY_PREFS_CONTACTS_SCHEMA);
+
        /* Set up interface */
        filename = empathy_file_lookup ("empathy-main-window.ui", "src");
        gui = empathy_builder_get_file (filename,
@@ -1572,50 +1569,47 @@ empathy_main_window_show (void)
                l = l->next;
        }
 
-       conf = empathy_conf_get ();
-
        /* Show offline ? */
-       empathy_conf_get_bool (conf,
-                             EMPATHY_PREFS_UI_SHOW_OFFLINE,
-                             &show_offline);
-       empathy_conf_notify_add (conf,
-                               EMPATHY_PREFS_UI_SHOW_OFFLINE,
-                               main_window_notify_show_offline_cb,
-                               show_offline_widget);
+       show_offline = g_settings_get_boolean (window->gsettings_ui,
+                                              EMPATHY_PREFS_UI_SHOW_OFFLINE);
+       g_signal_connect (window->gsettings_ui,
+                         "changed::" EMPATHY_PREFS_UI_SHOW_OFFLINE,
+                         G_CALLBACK (main_window_notify_show_offline_cb),
+                         show_offline_widget);
 
        gtk_toggle_action_set_active (show_offline_widget, show_offline);
 
        /* Show protocol ? */
-       empathy_conf_notify_add (conf,
-                                EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
-                                (EmpathyConfNotifyFunc) main_window_notify_show_protocols_cb,
-                                window);
+       g_signal_connect (window->gsettings_ui,
+                         "changed::" EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
+                         G_CALLBACK (main_window_notify_show_protocols_cb),
+                         window);
 
-       main_window_notify_show_protocols_cb (conf,
-                                           EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
-                                           window);
+       main_window_notify_show_protocols_cb (window->gsettings_ui,
+                                             EMPATHY_PREFS_UI_SHOW_PROTOCOLS,
+                                             window);
 
        /* Sort by name / by status ? */
-       empathy_conf_notify_add (conf,
-                                EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
-                                (EmpathyConfNotifyFunc) main_window_notify_sort_contact_cb,
-                                window);
+       g_signal_connect (window->gsettings_contacts,
+                         "changed::" EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
+                         G_CALLBACK (main_window_notify_sort_contact_cb),
+                         window);
 
-       main_window_notify_sort_contact_cb (conf,
+       main_window_notify_sort_contact_cb (window->gsettings_contacts,
                                            EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
                                            window);
 
        /* Contacts list size */
-       empathy_conf_notify_add (conf,
-                                EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
-                                (EmpathyConfNotifyFunc) main_window_notify_contact_list_size_cb,
-                                window);
-       empathy_conf_notify_add (conf,
-                                EMPATHY_PREFS_UI_SHOW_AVATARS,
-                                (EmpathyConfNotifyFunc) main_window_notify_contact_list_size_cb,
-                                window);
-
-       main_window_notify_contact_list_size_cb (conf,
+       g_signal_connect (window->gsettings_ui,
+                         "changed::" EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
+                         G_CALLBACK (main_window_notify_contact_list_size_cb),
+                         window);
+       g_signal_connect (window->gsettings_ui,
+                         "changed::" EMPATHY_PREFS_UI_SHOW_AVATARS,
+                         G_CALLBACK (main_window_notify_contact_list_size_cb),
+                         window);
+
+       main_window_notify_contact_list_size_cb (window->gsettings_ui,
                                                 EMPATHY_PREFS_UI_SHOW_AVATARS,
                                                 window);
 
index 79bb8be04165163daa48719443f2838ea91b7ccc..2fc81b40811bd726b6476a6ff0d69774d402310c 100644 (file)
             <property name="value">0</property>
             <property name="current-value">0</property>
           </object>
+          <accelerator key="1" modifiers="GDK_CONTROL_MASK"/>
         </child>
         <child>
           <object class="GtkRadioAction" id="view_normal_size">
             <property name="group">view_normal_size_with_avatars</property>
             <property name="value">1</property>
           </object>
+          <accelerator key="2" modifiers="GDK_CONTROL_MASK"/>
         </child>
         <child>
           <object class="GtkRadioAction" id="view_compact_size">
             <property name="group">view_normal_size_with_avatars</property>
             <property name="value">2</property>
           </object>
+          <accelerator key="3" modifiers="GDK_CONTROL_MASK"/>
         </child>
         <child>
           <object class="GtkAction" id="room">
index 9ee135ef078f7c3b486201a88ee37d00b8e23602..4a8bf973ce2597094cb38162c1ad8678c3e96b37 100644 (file)
@@ -22,8 +22,7 @@
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
-
-#include <libempathy-gtk/empathy-conf.h>
+#include <libempathy/empathy-gsettings.h>
 
 #include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/util.h>
@@ -139,7 +138,7 @@ migration_account_manager_prepared_cb (GObject *source_object,
   TpAccountManager *am = TP_ACCOUNT_MANAGER (source_object);
   GError *error = NULL;
   GList *accounts, *l;
-  EmpathyConf *conf;
+  GSettings *gsettings;
 
   if (!tp_account_manager_prepare_finish (am, result, &error))
     {
@@ -175,8 +174,10 @@ migration_account_manager_prepared_cb (GObject *source_object,
 
   DEBUG ("Finished all migrating");
 
-  conf = empathy_conf_get ();
-  empathy_conf_set_bool (conf, EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED, TRUE);
+  gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
+  g_settings_set_boolean (gsettings, EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED,
+      TRUE);
+  g_object_unref (gsettings);
 
   g_list_free (accounts);
 }
@@ -199,22 +200,15 @@ migrate_logs (gpointer data)
 gboolean
 empathy_migrate_butterfly_logs (EmpathyContact *contact)
 {
-  EmpathyConf *conf;
-  gboolean logs_migrated;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
   gchar *cm;
 
-  conf = empathy_conf_get ();
-
   /* Already in progress. */
   if (butterfly_log_migration_id != 0)
     return FALSE;
 
   /* Already done. */
-  if (!empathy_conf_get_bool (conf, EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED,
-          &logs_migrated))
-    return FALSE;
-
-  if (logs_migrated)
+  if (g_settings_get_boolean (gsettings, EMPATHY_PREFS_BUTTERFLY_LOGS_MIGRATED))
     return FALSE;
 
   tp_account_parse_object_path (
index 993cf77d4a783b98dc7de03d064b3f03cce94b52..8192049e7afd60bb6a0c3937097be238780e4025 100644 (file)
@@ -31,9 +31,9 @@
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/util.h>
 
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 #include <libempathy-gtk/empathy-theme-manager.h>
 #include <libempathy-gtk/empathy-spell.h>
@@ -75,7 +75,12 @@ typedef struct {
        GtkWidget *checkbutton_location_resource_cell;
        GtkWidget *checkbutton_location_resource_gps;
 
-       GList     *notify_ids;
+       GSettings *gsettings;
+       GSettings *gsettings_chat;
+       GSettings *gsettings_loc;
+       GSettings *gsettings_notify;
+       GSettings *gsettings_sound;
+       GSettings *gsettings_ui;
 } EmpathyPreferences;
 
 static void     preferences_setup_widgets                (EmpathyPreferences      *preferences);
@@ -94,22 +99,6 @@ static gboolean preferences_languages_load_foreach       (GtkTreeModel
 static void     preferences_languages_cell_toggled_cb    (GtkCellRendererToggle  *cell,
                                                          gchar                  *path_string,
                                                          EmpathyPreferences      *preferences);
-static void     preferences_widget_sync_bool             (const gchar            *key,
-                                                         GtkWidget              *widget);
-static void     preferences_notify_bool_cb               (EmpathyConf             *conf,
-                                                         const gchar            *key,
-                                                         gpointer                user_data);
-static void     preferences_notify_sensitivity_cb        (EmpathyConf             *conf,
-                                                         const gchar            *key,
-                                                         gpointer                user_data);
-static void     preferences_hookup_toggle_button         (EmpathyPreferences      *preferences,
-                                                         const gchar            *key,
-                                                         GtkWidget              *widget);
-static void     preferences_hookup_sensitivity           (EmpathyPreferences      *preferences,
-                                                         const gchar            *key,
-                                                         GtkWidget              *widget);
-static void     preferences_toggle_button_toggled_cb     (GtkWidget              *button,
-                                                         gpointer                user_data);
 static void     preferences_destroy_cb                   (GtkWidget              *widget,
                                                          EmpathyPreferences      *preferences);
 static void     preferences_response_cb                  (GtkWidget              *widget,
@@ -154,106 +143,150 @@ static SoundEventEntry sound_entries [] = {
        { N_("Account disconnected"), EMPATHY_PREFS_SOUNDS_SERVICE_LOGOUT }
 };
 
-static void
-preferences_add_id (EmpathyPreferences *preferences, guint id)
-{
-       preferences->notify_ids = g_list_prepend (preferences->notify_ids,
-                                                 GUINT_TO_POINTER (id));
-}
-
 static void
 preferences_setup_widgets (EmpathyPreferences *preferences)
 {
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
-                                         preferences->checkbutton_notifications_enabled);
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY,
-                                         preferences->checkbutton_notifications_disabled_away);
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_NOTIFICATIONS_FOCUS,
-                                         preferences->checkbutton_notifications_focus);
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN,
-                                         preferences->checkbutton_notifications_contact_signin);
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT,
-                                         preferences->checkbutton_notifications_contact_signout);
-
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
-                                       preferences->checkbutton_notifications_disabled_away);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
-                                       preferences->checkbutton_notifications_focus);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
-                                       preferences->checkbutton_notifications_contact_signin);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
-                                       preferences->checkbutton_notifications_contact_signout);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_SOUNDS_ENABLED,
-                                         preferences->checkbutton_sounds_enabled);
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_SOUNDS_DISABLED_AWAY,
-                                         preferences->checkbutton_sounds_disabled_away);
-
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_SOUNDS_ENABLED,
-                                       preferences->checkbutton_sounds_disabled_away);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_SOUNDS_ENABLED,
-                                       preferences->treeview_sounds);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
-                                         preferences->checkbutton_separate_chat_windows);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
-                                         preferences->checkbutton_show_smileys);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS,
-                                         preferences->checkbutton_show_contacts_in_rooms);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_AUTOCONNECT,
-                                         preferences->checkbutton_autoconnect);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_LOCATION_PUBLISH,
-                                         preferences->checkbutton_location_publish);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
-                                         preferences->checkbutton_location_resource_network);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_LOCATION_PUBLISH,
-                                       preferences->checkbutton_location_resource_network);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
-                                         preferences->checkbutton_location_resource_cell);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_LOCATION_PUBLISH,
-                                       preferences->checkbutton_location_resource_cell);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
-                                         preferences->checkbutton_location_resource_gps);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_LOCATION_PUBLISH,
-                                       preferences->checkbutton_location_resource_gps);
-
-       preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
-                                         preferences->checkbutton_location_reduce_accuracy);
-       preferences_hookup_sensitivity (preferences,
-                                       EMPATHY_PREFS_LOCATION_PUBLISH,
-                                       preferences->checkbutton_location_reduce_accuracy);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                        preferences->checkbutton_notifications_enabled,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY,
+                        preferences->checkbutton_notifications_disabled_away,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_FOCUS,
+                        preferences->checkbutton_notifications_focus,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN,
+                        preferences->checkbutton_notifications_contact_signin,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT,
+                        preferences->checkbutton_notifications_contact_signout,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                        preferences->checkbutton_notifications_disabled_away,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                        preferences->checkbutton_notifications_focus,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                        preferences->checkbutton_notifications_contact_signin,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+       g_settings_bind (preferences->gsettings_notify,
+                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                        preferences->checkbutton_notifications_contact_signout,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+
+       g_settings_bind (preferences->gsettings_sound,
+                        EMPATHY_PREFS_SOUNDS_ENABLED,
+                        preferences->checkbutton_sounds_enabled,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_sound,
+                        EMPATHY_PREFS_SOUNDS_DISABLED_AWAY,
+                        preferences->checkbutton_sounds_disabled_away,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+
+       g_settings_bind (preferences->gsettings_sound,
+                        EMPATHY_PREFS_SOUNDS_ENABLED,
+                        preferences->checkbutton_sounds_disabled_away,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+       g_settings_bind (preferences->gsettings_sound,
+                       EMPATHY_PREFS_SOUNDS_ENABLED,
+                       preferences->treeview_sounds,
+                       "sensitive",
+                       G_SETTINGS_BIND_GET);
+
+       g_settings_bind (preferences->gsettings_ui,
+                        EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
+                        preferences->checkbutton_separate_chat_windows,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+
+       g_settings_bind (preferences->gsettings_chat,
+                        EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
+                        preferences->checkbutton_show_smileys,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_chat,
+                        EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS,
+                        preferences->checkbutton_show_contacts_in_rooms,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+
+       g_settings_bind (preferences->gsettings,
+                        EMPATHY_PREFS_AUTOCONNECT,
+                        preferences->checkbutton_autoconnect,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_PUBLISH,
+                        preferences->checkbutton_location_publish,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
+                        preferences->checkbutton_location_resource_network,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_PUBLISH,
+                        preferences->checkbutton_location_resource_network,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
+                        preferences->checkbutton_location_resource_cell,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_PUBLISH,
+                        preferences->checkbutton_location_resource_cell,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
+                        preferences->checkbutton_location_resource_gps,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_PUBLISH,
+                        preferences->checkbutton_location_resource_gps,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
+
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
+                        preferences->checkbutton_location_reduce_accuracy,
+                        "active",
+                        G_SETTINGS_BIND_DEFAULT);
+       g_settings_bind (preferences->gsettings_loc,
+                        EMPATHY_PREFS_LOCATION_PUBLISH,
+                        preferences->checkbutton_location_reduce_accuracy,
+                        "sensitive",
+                        G_SETTINGS_BIND_GET);
 }
 
 static void
@@ -283,7 +316,7 @@ preferences_sound_cell_toggled_cb (GtkCellRendererToggle *toggle,
        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                            COL_SOUND_ENABLED, instore, -1);
 
-       empathy_conf_set_bool (empathy_conf_get (), key, instore);
+       g_settings_set_boolean (preferences->gsettings_sound, key, instore);
 
        g_free (key);
        gtk_tree_path_free (path);
@@ -297,14 +330,13 @@ preferences_sound_load (EmpathyPreferences *preferences)
        GtkListStore *store;
        GtkTreeIter iter;
        gboolean set;
-       EmpathyConf *conf;
 
        view = GTK_TREE_VIEW (preferences->treeview_sounds);
        store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
-       conf = empathy_conf_get ();
 
        for (i = 0; i < G_N_ELEMENTS (sound_entries); i++) {
-               empathy_conf_get_bool (conf, sound_entries[i].key, &set);
+               set = g_settings_get_boolean (preferences->gsettings_sound,
+                                             sound_entries[i].key);
 
                gtk_list_store_insert_with_values (store, &iter, i,
                                                   COL_SOUND_NAME, gettext (sound_entries[i].name),
@@ -419,9 +451,9 @@ preferences_languages_add (EmpathyPreferences *preferences)
 
        codes = empathy_spell_get_language_codes ();
 
-       empathy_conf_set_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
-                              codes != NULL);
+       g_settings_set_boolean (preferences->gsettings_chat,
+                               EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
+                               codes != NULL);
        if (!codes) {
                gtk_widget_set_sensitive (preferences->treeview_spell_checker, FALSE);
        }
@@ -463,13 +495,13 @@ preferences_languages_save (EmpathyPreferences *preferences)
                                &languages);
 
        /* if user selects no languages, we don't want spell check */
-       empathy_conf_set_bool (empathy_conf_get (),
-                              EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
-                              languages != NULL);
+       g_settings_set_boolean (preferences->gsettings_chat,
+                               EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
+                               languages != NULL);
 
-       empathy_conf_set_string (empathy_conf_get (),
-                                EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
-                                languages ? languages : "");
+       g_settings_set_string (preferences->gsettings_chat,
+                              EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
+                              languages != NULL ? languages : "");
 
        g_free (languages);
 }
@@ -518,11 +550,11 @@ preferences_languages_load (EmpathyPreferences *preferences)
        gchar         *value;
        gchar        **vlanguages;
 
-       if (!empathy_conf_get_string (empathy_conf_get (),
-                                     EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES,
-                                     &value) || !value) {
+       value = g_settings_get_string (preferences->gsettings_chat,
+                                      EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES);
+
+       if (value == NULL)
                return;
-       }
 
        vlanguages = g_strsplit (value, ",", -1);
        g_free (value);
@@ -598,316 +630,7 @@ preferences_languages_cell_toggled_cb (GtkCellRendererToggle *cell,
 }
 
 static void
-preferences_widget_sync_bool (const gchar *key, GtkWidget *widget)
-{
-       gboolean value;
-
-       if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
-       }
-}
-
-#if 0
-static void
-preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
-{
-       gchar *value;
-
-       if (empathy_conf_get_string (empathy_conf_get (), key, &value) && value) {
-               if (GTK_IS_ENTRY (widget)) {
-                       gtk_entry_set_text (GTK_ENTRY (widget), value);
-               } else if (GTK_IS_RADIO_BUTTON (widget)) {
-                       if (!tp_strdiff (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM)) {
-                               GType        type;
-                               GEnumClass  *enum_class;
-                               GEnumValue  *enum_value;
-                               GSList      *list;
-                               GtkWidget   *toggle_widget;
-
-                               /* Get index from new string */
-                               type = empathy_contact_list_store_sort_get_type ();
-                               enum_class = G_ENUM_CLASS (g_type_class_peek (type));
-                               enum_value = g_enum_get_value_by_nick (enum_class, value);
-
-                               if (enum_value) {
-                                       list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
-                                       toggle_widget = g_slist_nth_data (list, enum_value->value);
-                                       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_widget), TRUE);
-                               }
-                       } else {
-                               g_warning ("Unhandled key:'%s' just had string change", key);
-                       }
-               }
-
-               g_free (value);
-       }
-}
-
-static void
-preferences_notify_string_cb (EmpathyConf  *conf,
-                             const gchar *key,
-                             gpointer     user_data)
-{
-       preferences_widget_sync_string (key, user_data);
-}
-#endif
-
-static void
-preferences_notify_bool_cb (EmpathyConf  *conf,
-                           const gchar *key,
-                           gpointer     user_data)
-{
-       preferences_widget_sync_bool (key, user_data);
-}
-
-static void
-preferences_notify_sensitivity_cb (EmpathyConf  *conf,
-                                  const gchar *key,
-                                  gpointer     user_data)
-{
-       gboolean value;
-
-       if (empathy_conf_get_bool (conf, key, &value)) {
-               gtk_widget_set_sensitive (GTK_WIDGET (user_data), value);
-       }
-}
-
-#if 0
-static void
-preferences_widget_sync_int (const gchar *key, GtkWidget *widget)
-{
-       gint value;
-
-       if (empathy_conf_get_int (empathy_conf_get (), key, &value)) {
-               if (GTK_IS_SPIN_BUTTON (widget)) {
-                       gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
-               }
-       }
-}
-
-static void
-preferences_notify_int_cb (EmpathyConf  *conf,
-                          const gchar *key,
-                          gpointer     user_data)
-{
-       preferences_widget_sync_int (key, user_data);
-}
-
-static void
-preferences_hookup_spin_button (EmpathyPreferences *preferences,
-                               const gchar       *key,
-                               GtkWidget         *widget)
-{
-       guint id;
-
-       preferences_widget_sync_int (key, widget);
-
-       g_object_set_data_full (G_OBJECT (widget), "key",
-                               g_strdup (key), g_free);
-
-       g_signal_connect (widget,
-                         "value_changed",
-                         G_CALLBACK (preferences_spin_button_value_changed_cb),
-                         NULL);
-
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     key,
-                                     preferences_notify_int_cb,
-                                     widget);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-}
-
-static void
-preferences_hookup_entry (EmpathyPreferences *preferences,
-                         const gchar       *key,
-                         GtkWidget         *widget)
-{
-       guint id;
-
-       preferences_widget_sync_string (key, widget);
-
-       g_object_set_data_full (G_OBJECT (widget), "key",
-                               g_strdup (key), g_free);
-
-       g_signal_connect (widget,
-                         "changed",
-                         G_CALLBACK (preferences_entry_value_changed_cb),
-                         NULL);
-
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     key,
-                                     preferences_notify_string_cb,
-                                     widget);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-}
-
-static void
-preferences_spin_button_value_changed_cb (GtkWidget *button,
-                                         gpointer   user_data)
-{
-       const gchar *key;
-
-       key = g_object_get_data (G_OBJECT (button), "key");
-
-       empathy_conf_set_int (empathy_conf_get (),
-                             key,
-                             gtk_spin_button_get_value (GTK_SPIN_BUTTON (button)));
-}
-
-static void
-preferences_entry_value_changed_cb (GtkWidget *entry,
-                                   gpointer   user_data)
-{
-       const gchar *key;
-
-       key = g_object_get_data (G_OBJECT (entry), "key");
-
-       empathy_conf_set_string (empathy_conf_get (),
-                                key,
-                                gtk_entry_get_text (GTK_ENTRY (entry)));
-}
-#endif
-
-static void
-preferences_hookup_toggle_button (EmpathyPreferences *preferences,
-                                 const gchar       *key,
-                                 GtkWidget         *widget)
-{
-       guint id;
-
-       preferences_widget_sync_bool (key, widget);
-
-       g_object_set_data_full (G_OBJECT (widget), "key",
-                               g_strdup (key), g_free);
-
-       g_signal_connect (widget,
-                         "toggled",
-                         G_CALLBACK (preferences_toggle_button_toggled_cb),
-                         NULL);
-
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                    key,
-                                    preferences_notify_bool_cb,
-                                    widget);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-}
-
-#if 0
-static void
-preferences_hookup_radio_button (EmpathyPreferences *preferences,
-                                const gchar       *key,
-                                GtkWidget         *widget)
-{
-       GSList *group, *l;
-       guint   id;
-
-       preferences_widget_sync_string (key, widget);
-
-       group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
-       for (l = group; l; l = l->next) {
-               g_signal_connect (l->data,
-                                 "toggled",
-                                 G_CALLBACK (preferences_radio_button_toggled_cb),
-                                 NULL);
-
-               g_object_set_data_full (G_OBJECT (l->data), "key",
-                                       g_strdup (key), g_free);
-       }
-
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                    key,
-                                    preferences_notify_string_cb,
-                                    widget);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-}
-#endif
-
-static void
-preferences_hookup_sensitivity (EmpathyPreferences *preferences,
-                               const gchar       *key,
-                               GtkWidget         *widget)
-{
-       gboolean value;
-       guint    id;
-
-       if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
-               gtk_widget_set_sensitive (widget, value);
-       }
-
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     key,
-                                     preferences_notify_sensitivity_cb,
-                                     widget);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-}
-
-static void
-preferences_toggle_button_toggled_cb (GtkWidget *button,
-                                     gpointer   user_data)
-{
-       const gchar *key;
-
-       key = g_object_get_data (G_OBJECT (button), "key");
-
-       empathy_conf_set_bool (empathy_conf_get (),
-                              key,
-                              gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
-}
-
-#if 0
-static void
-preferences_radio_button_toggled_cb (GtkWidget *button,
-                                    gpointer   user_data)
-{
-       const gchar *key;
-       const gchar *value = NULL;
-
-       if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
-               return;
-       }
-
-       key = g_object_get_data (G_OBJECT (button), "key");
-
-       if (!tp_strdiff (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM)) {
-               GSList      *group;
-               GType        type;
-               GEnumClass  *enum_class;
-               GEnumValue  *enum_value;
-
-               group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
-
-               /* Get string from index */
-               type = empathy_contact_list_store_sort_get_type ();
-               enum_class = G_ENUM_CLASS (g_type_class_peek (type));
-               enum_value = g_enum_get_value (enum_class, g_slist_index (group, button));
-
-               if (!enum_value) {
-                       g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioButton index:%d",
-                                  g_slist_index (group, button));
-                       return;
-               }
-
-               value = enum_value->value_nick;
-       } else if (!tp_strdiff (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM)) {
-           return;
-       }
-
-       empathy_conf_set_string (empathy_conf_get (), key, value);
-}
-#endif
-
-static void
-preferences_theme_notify_cb (EmpathyConf *conf,
+preferences_theme_notify_cb (GSettings   *gsettings,
                             const gchar *key,
                             gpointer     user_data)
 {
@@ -919,14 +642,8 @@ preferences_theme_notify_cb (EmpathyConf *conf,
        GtkTreeIter         iter;
        gboolean            found = FALSE;
 
-       if (!empathy_conf_get_string (conf, EMPATHY_PREFS_CHAT_THEME, &conf_name)) {
-               return;
-       }
-
-       if (!empathy_conf_get_string (conf, EMPATHY_PREFS_CHAT_ADIUM_PATH, &conf_path)) {
-               g_free (conf_name);
-               return;
-       }
+       conf_name = g_settings_get_string (gsettings, EMPATHY_PREFS_CHAT_THEME);
+       conf_path = g_settings_get_string (gsettings, EMPATHY_PREFS_CHAT_ADIUM_PATH);
 
        combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
        model = gtk_combo_box_get_model (combo);
@@ -988,13 +705,13 @@ preferences_theme_changed_cb (GtkComboBox        *combo,
                                    COL_COMBO_PATH, &path,
                                    -1);
 
-               empathy_conf_set_string (empathy_conf_get (),
-                                        EMPATHY_PREFS_CHAT_THEME,
-                                        name);
+               g_settings_set_string (preferences->gsettings_chat,
+                                      EMPATHY_PREFS_CHAT_THEME,
+                                      name);
                if (is_adium == TRUE)
-                       empathy_conf_set_string (empathy_conf_get (),
-                                                EMPATHY_PREFS_CHAT_ADIUM_PATH,
-                                                path);
+                       g_settings_set_string (preferences->gsettings_chat,
+                                              EMPATHY_PREFS_CHAT_ADIUM_PATH,
+                                              path);
                g_free (name);
                g_free (path);
        }
@@ -1010,7 +727,6 @@ preferences_themes_setup (EmpathyPreferences *preferences)
        const gchar  **themes;
        GList         *adium_themes;
        gint           i;
-       guint          id;
 
        combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
        cell_layout = GTK_CELL_LAYOUT (combo);
@@ -1071,24 +787,18 @@ preferences_themes_setup (EmpathyPreferences *preferences)
                          preferences);
 
        /* Select the theme from the gconf key and track changes */
-       preferences_theme_notify_cb (empathy_conf_get (),
+       preferences_theme_notify_cb (preferences->gsettings_chat,
                                     EMPATHY_PREFS_CHAT_THEME,
                                     preferences);
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     EMPATHY_PREFS_CHAT_THEME,
-                                     preferences_theme_notify_cb,
-                                     preferences);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
+       g_signal_connect (preferences->gsettings_chat,
+                         "changed::" EMPATHY_PREFS_CHAT_THEME,
+                         G_CALLBACK (preferences_theme_notify_cb),
+                         preferences);
 
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     EMPATHY_PREFS_CHAT_ADIUM_PATH,
-                                     preferences_theme_notify_cb,
-                                     preferences);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
+       g_signal_connect (preferences->gsettings_chat,
+                         "changed::" EMPATHY_PREFS_CHAT_ADIUM_PATH,
+                         G_CALLBACK (preferences_theme_notify_cb),
+                         preferences);
 }
 
 static void
@@ -1103,16 +813,13 @@ static void
 preferences_destroy_cb (GtkWidget         *widget,
                        EmpathyPreferences *preferences)
 {
-       GList *l;
+       g_object_unref (preferences->gsettings);
+       g_object_unref (preferences->gsettings_chat);
+       g_object_unref (preferences->gsettings_loc);
+       g_object_unref (preferences->gsettings_notify);
+       g_object_unref (preferences->gsettings_sound);
+       g_object_unref (preferences->gsettings_ui);
 
-       for (l = preferences->notify_ids; l; l = l->next) {
-               guint id;
-
-               id = GPOINTER_TO_UINT (l->data);
-               empathy_conf_notify_remove (empathy_conf_get (), id);
-       }
-
-       g_list_free (preferences->notify_ids);
        g_free (preferences);
 }
 
@@ -1166,6 +873,13 @@ empathy_preferences_show (GtkWindow *parent)
 
        g_object_add_weak_pointer (G_OBJECT (preferences->dialog), (gpointer) &preferences);
 
+       preferences->gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
+       preferences->gsettings_chat = g_settings_new (EMPATHY_PREFS_CHAT_SCHEMA);
+       preferences->gsettings_loc = g_settings_new (EMPATHY_PREFS_LOCATION_SCHEMA);
+       preferences->gsettings_notify = g_settings_new (EMPATHY_PREFS_NOTIFICATIONS_SCHEMA);
+       preferences->gsettings_sound = g_settings_new (EMPATHY_PREFS_SOUNDS_SCHEMA);
+       preferences->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
+
        preferences_themes_setup (preferences);
 
        preferences_setup_widgets (preferences);
index 81409696e70e47af2915c43aec5f8e2ca889b0cf..a002a7fb78826d1e01e72b24c018ac9dc34f17e4 100644 (file)
 #include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/util.h>
 
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-presence-chooser.h>
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 #include <libempathy-gtk/empathy-images.h>
 #include <libempathy-gtk/empathy-new-message-dialog.h>
@@ -66,6 +66,7 @@ typedef struct {
        EmpathyEventManager *event_manager;
        EmpathyEvent        *event;
        NotifyNotification  *notification;
+       GSettings           *gsettings_ui;
 
        GtkWindow           *window;
        GtkUIManager        *ui_manager;
@@ -356,8 +357,9 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
        EmpathyStatusIconPriv *priv = GET_PRIV (icon);
 
        if (store) {
-               empathy_conf_set_bool (empathy_conf_get (),
-                                      EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN, !visible);
+               g_settings_set_boolean (priv->gsettings_ui,
+                                       EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
+                                       !visible);
        }
 
        if (!visible) {
@@ -368,16 +370,15 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
 }
 
 static void
-status_icon_notify_visibility_cb (EmpathyConf *conf,
+status_icon_notify_visibility_cb (GSettings   *gsettings,
                                  const gchar *key,
                                  gpointer     user_data)
 {
        EmpathyStatusIcon *icon = user_data;
        gboolean           hidden = FALSE;
 
-       if (empathy_conf_get_bool (conf, key, &hidden)) {
-               status_icon_set_visibility (icon, !hidden, FALSE);
-       }
+       hidden = g_settings_get_boolean (gsettings, key);
+       status_icon_set_visibility (icon, !hidden, FALSE);
 }
 
 static void
@@ -571,6 +572,7 @@ status_icon_finalize (GObject *object)
        g_object_unref (priv->event_manager);
        g_object_unref (priv->ui_manager);
        g_object_unref (priv->notify_mgr);
+       g_object_unref (priv->gsettings_ui);
 }
 
 static void
@@ -625,10 +627,11 @@ empathy_status_icon_init (EmpathyStatusIcon *icon)
            account_manager_prepared_cb, icon);
 
        /* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */
-       empathy_conf_notify_add (empathy_conf_get (),
-                                EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
-                                status_icon_notify_visibility_cb,
-                                icon);
+       priv->gsettings_ui = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
+       g_signal_connect (priv->gsettings_ui,
+                         "changed::" EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
+                         G_CALLBACK (status_icon_notify_visibility_cb),
+                         icon);
 
        status_icon_create_menu (icon);
 
@@ -678,13 +681,8 @@ empathy_status_icon_new (GtkWindow *window, gboolean hide_contact_list)
                          G_CALLBACK (status_icon_delete_event_cb),
                          icon);
 
-       if (!hide_contact_list) {
-               empathy_conf_get_bool (empathy_conf_get (),
-                                      EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
-                                      &should_hide);
-       } else {
-               should_hide = TRUE;
-       }
+       should_hide = g_settings_get_boolean (priv->gsettings_ui,
+                       EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN);
 
        if (gtk_window_is_active (priv->window) == should_hide) {
                status_icon_set_visibility (icon, !should_hide, FALSE);
index 5f313138975912fdb9680c585b8b3409435b00f4..2c7ea2a7f4d59c35057b09a171a6f9b525827e03 100644 (file)
 #include <telepathy-glib/connection-manager.h>
 #include <telepathy-glib/interfaces.h>
 
-#ifdef ENABLE_TPL
 #include <telepathy-logger/log-manager.h>
-#include <telepathy-logger/log-store-empathy.h>
-#else
 
-#include <libempathy/empathy-log-manager.h>
-#endif /* ENABLE_TPL */
 #include <libempathy/empathy-idle.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-dispatch-operation.h>
 #include <libempathy/empathy-ft-factory.h>
+#include <libempathy/empathy-gsettings.h>
 #include <libempathy/empathy-tp-chat.h>
 #include <libempathy/empathy-tp-call.h>
 
-#include <libempathy-gtk/empathy-conf.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
 #include <libempathy-gtk/empathy-location-manager.h>
 
@@ -168,17 +163,14 @@ dispatch_cb (EmpathyDispatcher *dispatcher,
 }
 
 static void
-use_conn_notify_cb (EmpathyConf *conf,
+use_conn_notify_cb (GSettings *gsettings,
     const gchar *key,
     gpointer     user_data)
 {
   EmpathyConnectivity *connectivity = user_data;
-  gboolean     use_conn;
 
-  if (empathy_conf_get_bool (conf, key, &use_conn))
-    {
-      empathy_connectivity_set_use_conn (connectivity, use_conn);
-    }
+  empathy_connectivity_set_use_conn (connectivity,
+      g_settings_get_boolean (gsettings, key));
 }
 
 static void
@@ -353,8 +345,8 @@ account_manager_ready_cb (GObject *source_object,
   GError *error = NULL;
   EmpathyIdle *idle;
   EmpathyConnectivity *connectivity;
-  gboolean autoconnect = TRUE;
   TpConnectionPresenceType presence;
+  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
 
   if (!tp_account_manager_prepare_finish (manager, result, &error))
     {
@@ -370,9 +362,8 @@ account_manager_ready_cb (GObject *source_object,
   presence = tp_account_manager_get_most_available_presence (manager, NULL,
       NULL);
 
-  empathy_conf_get_bool (empathy_conf_get (),
-      EMPATHY_PREFS_AUTOCONNECT, &autoconnect);
-  if (autoconnect && !no_connect &&
+  if (g_settings_get_boolean (gsettings, EMPATHY_PREFS_AUTOCONNECT) &&
+      !no_connect &&
       tp_connection_presence_type_cmp_availability
           (presence, TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
             <= 0)
@@ -387,6 +378,7 @@ account_manager_ready_cb (GObject *source_object,
 
   g_object_unref (idle);
   g_object_unref (connectivity);
+  g_object_unref (gsettings);
 }
 
 static EmpathyDispatcher *
@@ -561,15 +553,14 @@ chatroom_manager_ready_cb (EmpathyChatroomManager *chatroom_manager,
 }
 
 static void
-empathy_idle_set_auto_away_cb (EmpathyConf *conf,
+empathy_idle_set_auto_away_cb (GSettings *gsettings,
                                const gchar *key,
                                gpointer user_data)
 {
-       gboolean autoaway;
        EmpathyIdle *idle = user_data;
 
-       empathy_conf_get_bool (conf, key, &autoaway);
-       empathy_idle_set_auto_away (idle, autoaway);
+       empathy_idle_set_auto_away (idle,
+      g_settings_get_boolean (gsettings, key));
 }
 
 int
@@ -581,11 +572,7 @@ main (int argc, char *argv[])
   EmpathyStatusIcon *icon;
   EmpathyDispatcher *dispatcher;
   TpAccountManager *account_manager;
-#ifdef ENABLE_TPL
   TplLogManager *log_manager;
-#else
-  EmpathyLogManager *log_manager;
-#endif /* ENABLE_TPL */
   EmpathyChatroomManager *chatroom_manager;
   EmpathyCallFactory *call_factory;
   EmpathyFTFactory  *ft_factory;
@@ -600,6 +587,7 @@ main (int argc, char *argv[])
 #ifdef ENABLE_DEBUG
   TpDebugSender *debug_sender;
 #endif
+  GSettings *gsettings;
 
   GOptionContext *optcontext;
   GOptionEntry options[] = {
@@ -666,22 +654,22 @@ main (int argc, char *argv[])
   /* Setting up Idle */
   idle = empathy_idle_dup_singleton ();
 
-  empathy_conf_get_bool (empathy_conf_get (),
-      EMPATHY_PREFS_AUTOAWAY, &autoaway);
+  gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
+  autoaway = g_settings_get_boolean (gsettings, EMPATHY_PREFS_AUTOAWAY);
 
-  empathy_conf_notify_add (empathy_conf_get (),
-                          EMPATHY_PREFS_AUTOAWAY,
-                          empathy_idle_set_auto_away_cb,
-                          idle);
+  g_signal_connect (gsettings,
+      "changed::" EMPATHY_PREFS_AUTOAWAY,
+      G_CALLBACK (empathy_idle_set_auto_away_cb), idle);
 
   empathy_idle_set_auto_away (idle, autoaway);
 
   /* Setting up Connectivity */
   connectivity = empathy_connectivity_dup_singleton ();
-  use_conn_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
+  use_conn_notify_cb (gsettings, EMPATHY_PREFS_USE_CONN,
       connectivity);
-  empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_CONN,
-      use_conn_notify_cb, connectivity);
+  g_signal_connect (gsettings,
+      "changed::" EMPATHY_PREFS_USE_CONN,
+      G_CALLBACK (use_conn_notify_cb), connectivity);
 
   /* account management */
   account_manager = tp_account_manager_dup ();
@@ -705,12 +693,7 @@ main (int argc, char *argv[])
       G_CALLBACK (unique_app_message_cb), window);
 
   /* Logging */
-#ifdef ENABLE_TPL
   log_manager = tpl_log_manager_dup_singleton ();
-#else
-  log_manager = empathy_log_manager_dup_singleton ();
-  empathy_log_manager_observe (log_manager, dispatcher);
-#endif
 
   chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
   empathy_chatroom_manager_observe (chatroom_manager, dispatcher);
@@ -763,6 +746,7 @@ main (int argc, char *argv[])
 #endif
   g_object_unref (ft_factory);
   g_object_unref (unique_app);
+  g_object_unref (gsettings);
 
   notify_uninit ();
   xmlCleanupParser ();