Merge branch 'master' into tp-tube
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 24 Apr 2009 15:28:22 +0000 (16:28 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 24 Apr 2009 15:28:22 +0000 (16:28 +0100)
98 files changed:
HACKING [new file with mode: 0644]
configure.ac
docs/libempathy-gtk/libempathy-gtk-docs.sgml
docs/libempathy/libempathy-docs.sgml
docs/libempathy/libempathy.types
empathy.doap
help/es/es.po
libempathy-gtk/Makefile.am
libempathy-gtk/empathy-account-chooser.c
libempathy-gtk/empathy-account-chooser.h
libempathy-gtk/empathy-account-widget-irc.c
libempathy-gtk/empathy-account-widget-irc.ui
libempathy-gtk/empathy-avatar-chooser.c
libempathy-gtk/empathy-avatar-chooser.h
libempathy-gtk/empathy-avatar-image.c
libempathy-gtk/empathy-avatar-image.h
libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-chat.h
libempathy-gtk/empathy-contact-dialogs.c
libempathy-gtk/empathy-contact-dialogs.h
libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-contact-list-view.h
libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-contact-selector.c
libempathy-gtk/empathy-contact-selector.h
libempathy-gtk/empathy-contact-widget.c
libempathy-gtk/empathy-contact-widget.h
libempathy-gtk/empathy-irc-network-dialog.c
libempathy-gtk/empathy-log-window.c
libempathy-gtk/empathy-new-message-dialog.c
libempathy-gtk/empathy-presence-chooser.c
libempathy-gtk/empathy-presence-chooser.h
libempathy-gtk/empathy-presence-chooser.ui [deleted file]
libempathy-gtk/empathy-profile-chooser.c
libempathy-gtk/empathy-profile-chooser.h
libempathy-gtk/empathy-spell-dialog.c [deleted file]
libempathy-gtk/empathy-spell-dialog.h [deleted file]
libempathy-gtk/empathy-spell-dialog.ui [deleted file]
libempathy-gtk/empathy-status-preset-dialog.c [new file with mode: 0644]
libempathy-gtk/empathy-status-preset-dialog.h [new file with mode: 0644]
libempathy-gtk/empathy-status-preset-dialog.ui [new file with mode: 0644]
libempathy-gtk/empathy-theme-boxes.c
libempathy-gtk/empathy-ui-utils.c
libempathy/Makefile.am
libempathy/empathy-account-manager.c
libempathy/empathy-account-manager.h
libempathy/empathy-call-handler.c
libempathy/empathy-chatroom-manager.c
libempathy/empathy-chatroom.c
libempathy/empathy-chatroom.h
libempathy/empathy-contact-factory.c [deleted file]
libempathy/empathy-contact-factory.h [deleted file]
libempathy/empathy-contact-manager.c
libempathy/empathy-contact-manager.h
libempathy/empathy-contact.c
libempathy/empathy-contact.h
libempathy/empathy-dispatch-operation.c
libempathy/empathy-dispatcher.c
libempathy/empathy-dispatcher.h
libempathy/empathy-log-store-empathy.c
libempathy/empathy-tp-call.c
libempathy/empathy-tp-chat.c
libempathy/empathy-tp-chat.h
libempathy/empathy-tp-contact-factory.c
libempathy/empathy-tp-contact-factory.h
libempathy/empathy-tp-contact-list.c
libempathy/empathy-tp-contact-list.h
libempathy/empathy-tp-file.c
libempathy/empathy-tp-file.h
libempathy/empathy-tp-group.c [deleted file]
libempathy/empathy-tp-group.h [deleted file]
libempathy/empathy-tp-tube.c
libempathy/empathy-utils.c
libempathy/empathy-utils.h
megaphone/src/megaphone-applet.c
po/POTFILES.in
po/es.po
python/pyempathy/pyempathy.defs
python/pyempathy/pyempathy.override
python/pyempathygtk/pyempathygtk.defs
python/pyempathygtk/pyempathygtk.override
python/update-binding.sh
src/empathy-accounts-dialog.c
src/empathy-call-window.c
src/empathy-call-window.ui
src/empathy-chat-window.c
src/empathy-chatrooms-window.c
src/empathy-event-manager.c
src/empathy-main-window.c
src/empathy-new-chatroom-dialog.c
src/empathy.c
tests/.gitignore
tests/Makefile.am
tests/check-empathy-helpers.c
tests/contact-run-until-ready-2.c [deleted file]
tests/contact-run-until-ready.c [deleted file]
tests/test-empathy-presence-chooser.c
tests/test-empathy-status-preset-dialog.c [new file with mode: 0644]

diff --git a/HACKING b/HACKING
new file mode 100644 (file)
index 0000000..778244f
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,2 @@
+See http://live.gnome.org/Empathy/ about coding style conventions.
+See also http://live.gnome.org/Empathy/Git to read about our git workflow.
index c3926fdb20aafd2c0e56dc71472ff154cd6323a7..0ff17396d009a367aefc24d767f078f00b004221 100644 (file)
@@ -29,7 +29,7 @@ GLIB_REQUIRED=2.16.0
 GTK_REQUIRED=2.16.0
 GCONF_REQUIRED=1.2.0
 LIBPANELAPPLET_REQUIRED=2.10.0
-TELEPATHY_GLIB_REQUIRED=0.7.23
+TELEPATHY_GLIB_REQUIRED=0.7.27
 MISSION_CONTROL_REQUIRED=4.61
 ENCHANT_REQUIRED=1.2.0
 ISO_CODES_REQUIRED=0.35
index 033ebf018b60419c335f22e7d0dd12d177da6a14..f265de20b4dd899c3c568c306baec2e725695921 100644 (file)
@@ -45,7 +45,6 @@
       <xi:include href="xml/empathy-presence-chooser.xml"/>
       <xi:include href="xml/empathy-profile-chooser.xml"/>
       <xi:include href="xml/empathy-smiley-manager.xml"/>
-      <xi:include href="xml/empathy-spell-dialog.xml"/>
       <xi:include href="xml/empathy-spell.xml"/>
       <xi:include href="xml/empathy-theme-boxes.xml"/>
       <xi:include href="xml/empathy-theme-irc.xml"/>
index a7e3df9b812ca3383a686f3c68719e3694679f12..f3291f7720cd4b041f962fbaba809c970b030cfe 100644 (file)
@@ -21,7 +21,6 @@
       <xi:include href="xml/empathy-call-handler.xml"/>
       <xi:include href="xml/empathy-chatroom-manager.xml"/>
       <xi:include href="xml/empathy-chatroom.xml"/>
-      <xi:include href="xml/empathy-contact-factory.xml"/>
       <xi:include href="xml/empathy-contact-groups.xml"/>
       <xi:include href="xml/empathy-contact-list.xml"/>
       <xi:include href="xml/empathy-contact-manager.xml"/>
@@ -45,7 +44,6 @@
       <xi:include href="xml/empathy-tp-contact-factory.xml"/>
       <xi:include href="xml/empathy-tp-contact-list.xml"/>
       <xi:include href="xml/empathy-tp-file.xml"/>
-      <xi:include href="xml/empathy-tp-group.xml"/>
       <xi:include href="xml/empathy-tp-roomlist.xml"/>
       <xi:include href="xml/empathy-tp-tube.xml"/>
       <xi:include href="xml/empathy-tube-handler.xml"/>
index 1a81ac6718a8f8d79e9365d50bb9f9c67eb406c3..26040474e1bcacf7443c62faefe0ea6475ca9996 100644 (file)
@@ -3,7 +3,6 @@ empathy_call_factory_get_type
 empathy_call_handler_get_type
 empathy_chatroom_get_type
 empathy_chatroom_manager_get_type
-empathy_contact_factory_get_type
 empathy_contact_get_type
 empathy_avatar_get_type
 empathy_contact_list_get_type
@@ -12,7 +11,6 @@ empathy_contact_monitor_get_type
 empathy_dispatcher_get_type
 empathy_dispatch_operation_get_type
 empathy_capabilities_get_type
-empathy_contact_ready_get_type
 empathy_debug_flags_get_type
 empathy_dispatch_operation_state_get_type
 empathy_tp_call_status_get_type
@@ -29,7 +27,6 @@ empathy_tp_chat_get_type
 empathy_tp_contact_factory_get_type
 empathy_tp_contact_list_get_type
 empathy_tp_file_get_type
-empathy_tp_group_get_type
 empathy_tp_roomlist_get_type
 empathy_tp_tube_get_type
 empathy_tube_handler_get_type
index 7b5e7564257500f8f47b82272d0b7655acdf0f14..acd6494bc7f391a1a8bf116f9013f2c66ae05d36 100644 (file)
@@ -6,6 +6,7 @@
          xmlns="http://usefulinc.com/ns/doap#">
   <name xml:lang="en">Empathy Instant Messenger</name>
   <shortdesc xml:lang="en">Send and receive instant messages</shortdesc>
+  <category rdf:resource="http://api.gnome.org/doap-extensions#desktop" />
 
   <homepage rdf:resource="http://live.gnome.org/Empathy" />
   <mailing-list rdf:resource="http://lists.freedesktop.org/mailman/listinfo/telepathy" />
index da48d12575d70096917cb675acc6173a06121648..8357dde94e3df46c5c421f691297810a5a0bddff 100644 (file)
@@ -3,8 +3,8 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: empathy.help.HEAD\n"
-"POT-Creation-Date: 2009-03-10 20:40+0000\n"
-"PO-Revision-Date: 2009-03-22 16:23+0100\n"
+"POT-Creation-Date: 2009-04-18 18:34+0000\n"
+"PO-Revision-Date: 2009-04-21 21:04+0200\n"
 "Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n"
 "Language-Team: Español <gnome-es-list@gnome.org>\n"
 "MIME-Version: 1.0\n"
@@ -15,7 +15,7 @@ msgstr ""
 
 #. When image changes, this message will be marked fuzzy or untranslated for you.
 #. It doesn't matter what you translate it to: it's not used at all.
-#: C/empathy.xml:238(None)
+#: C/empathy.xml:237(None)
 msgid ""
 "@@image: 'figures/empathy-main-window.png'; "
 "md5=38259a866f38ff1f754828e46d2b0e5c"
@@ -199,37 +199,42 @@ msgid "Feedback"
 msgstr "Comentarios"
 
 #: C/empathy.xml:111(para)
+#| msgid ""
+#| "To report a bug or make a suggestion regarding the <application>Empathy</"
+#| "application> application or this manual, follow the directions in the "
+#| "<ulink url=\"ghelp:gnome-feedback\" type=\"help\">GNOME Feedback Page</"
+#| "ulink>."
 msgid ""
 "To report a bug or make a suggestion regarding the <application>Empathy</"
 "application> application or this manual, follow the directions in the <ulink "
-"url=\"ghelp:gnome-feedback\" type=\"help\">GNOME Feedback Page</ulink>."
+"url=\"ghelp:user-guide?feedback\" type=\"help\">GNOME Feedback Page</ulink>."
 msgstr ""
 "Para informar de un fallo, o hacer alguna sugerencia concerniente a la "
 "aplicación <application>Empathy</application> o este manual, siga las "
-"indicaciones en la <ulink url=\"ghelp:gnome-feedback\" type=\"help\">Página "
-"de comentarios de GNOME</ulink>."
+"indicaciones en la <ulink url=\"ghelp:user-guide?feedback\" type=\"help"
+"\">Página de comentarios de GNOME</ulink>."
 
-#: C/empathy.xml:119(para)
+#: C/empathy.xml:118(para)
 msgid "Empathy is an application for instant messaging."
 msgstr "Empathy es una aplicación para mensajería instantánea."
 
-#: C/empathy.xml:127(primary) C/empathy.xml:0(application)
+#: C/empathy.xml:126(primary) C/empathy.xml:0(application)
 msgid "Empathy"
 msgstr "Empathy"
 
-#: C/empathy.xml:130(primary)
+#: C/empathy.xml:129(primary)
 msgid "empathy"
 msgstr "empathy"
 
-#: C/empathy.xml:131(secondary)
+#: C/empathy.xml:130(secondary)
 msgid "istant messaging"
 msgstr "mensajería instantánea"
 
-#: C/empathy.xml:135(title)
+#: C/empathy.xml:134(title)
 msgid "Introduction"
 msgstr "Introducción"
 
-#: C/empathy.xml:136(para)
+#: C/empathy.xml:135(para)
 msgid ""
 "<application>Empathy</application> is a multi-protocol instant messaging "
 "program for the GNOME Desktop. With <application>Empathy</application> you "
@@ -241,47 +246,47 @@ msgstr ""
 "application> puede mantenerse en contacto con sus amigos a través de muchos "
 "de los servicios de mensajería instantánea soportados."
 
-#: C/empathy.xml:146(acronym)
+#: C/empathy.xml:145(acronym)
 msgid "AIM"
 msgstr "AIM"
 
-#: C/empathy.xml:150(para)
+#: C/empathy.xml:149(para)
 msgid "Google Talk"
 msgstr "Google Talk"
 
-#: C/empathy.xml:155(para) C/empathy.xml:1090(title)
+#: C/empathy.xml:154(para) C/empathy.xml:1089(title)
 msgid "ICQ"
 msgstr "ICQ"
 
-#: C/empathy.xml:161(acronym)
+#: C/empathy.xml:160(acronym)
 msgid "IRC"
 msgstr "IRC"
 
-#: C/empathy.xml:165(para)
+#: C/empathy.xml:164(para)
 msgid "Jabber (or <acronym>XMPP</acronym>)"
 msgstr "Jabber (o <acronym>XMPP</acronym>)"
 
-#: C/empathy.xml:171(acronym)
+#: C/empathy.xml:170(acronym)
 msgid "MSN"
 msgstr "MSN"
 
-#: C/empathy.xml:175(para) C/empathy.xml:442(para) C/empathy.xml:1050(title)
+#: C/empathy.xml:174(para) C/empathy.xml:441(para) C/empathy.xml:1049(title)
 msgid "Salut"
 msgstr "Salut"
 
-#: C/empathy.xml:181(acronym)
+#: C/empathy.xml:180(acronym)
 msgid "SIP"
 msgstr "SIP"
 
-#: C/empathy.xml:185(para) C/empathy.xml:920(title)
+#: C/empathy.xml:184(para) C/empathy.xml:919(title)
 msgid "Yahoo"
 msgstr "Yahoo"
 
-#: C/empathy.xml:190(para)
+#: C/empathy.xml:189(para)
 msgid "And many others..."
 msgstr "Y muchos otros…"
 
-#: C/empathy.xml:141(para)
+#: C/empathy.xml:140(para)
 msgid ""
 "<application>Empathy</application> supports the following services: "
 "<placeholder-1/>"
@@ -289,24 +294,24 @@ msgstr ""
 "<application>Empathy</application> soporta los siguientes servicios: "
 "<placeholder-1/>"
 
-#: C/empathy.xml:199(title)
+#: C/empathy.xml:198(title)
 msgid "Getting Started"
 msgstr "Inicio"
 
-#: C/empathy.xml:202(title)
+#: C/empathy.xml:201(title)
 msgid "Starting Empathy"
 msgstr "Iniciar Empathy"
 
-#: C/empathy.xml:203(para)
+#: C/empathy.xml:202(para)
 msgid "You can start <application>Empathy</application> in the following ways:"
 msgstr ""
 "Puede iniciar <application>Empathy</application> de las siguientes formas:"
 
-#: C/empathy.xml:207(term)
+#: C/empathy.xml:206(term)
 msgid "<guimenu>Applications</guimenu> menu"
 msgstr "Menú <guimenu>Aplicaciones</guimenu>"
 
-#: C/empathy.xml:209(para)
+#: C/empathy.xml:208(para)
 msgid ""
 "Choose <menuchoice><guisubmenu>Internet</guisubmenu><guimenuitem>Empathy "
 "Instant Messenger</guimenuitem></menuchoice>."
@@ -314,23 +319,23 @@ msgstr ""
 "Elija <menuchoice><guisubmenu>Internet</guisubmenu><guimenuitem>Mensajería "
 "instantánea Empathy</guimenuitem></menuchoice>."
 
-#: C/empathy.xml:218(term)
+#: C/empathy.xml:217(term)
 msgid "Command line"
 msgstr "Línea de comandos"
 
-#: C/empathy.xml:220(para)
+#: C/empathy.xml:219(para)
 msgid "Type <command>empathy</command> and then press <keycap>Enter</keycap>."
 msgstr "Escriba <command>empathy</command> y pulse <keycap>intro</keycap>."
 
-#: C/empathy.xml:229(title)
+#: C/empathy.xml:228(title)
 msgid "When You Start Empathy"
 msgstr "Al iniciar Empathy"
 
-#: C/empathy.xml:234(title)
+#: C/empathy.xml:233(title)
 msgid "<application>Empathy</application> Main Window"
 msgstr "Ventana principal de <application>Empathy</application>"
 
-#: C/empathy.xml:241(phrase)
+#: C/empathy.xml:240(phrase)
 msgid ""
 "Shows <placeholder-1/> main window. Contains the titlebar, the menubar, "
 "contact list, status icon and status arrow button list."
@@ -339,7 +344,7 @@ msgstr ""
 "título, la barra de menú, la lista de contactos, el icono de estado y la "
 "lista de estados."
 
-#: C/empathy.xml:230(para)
+#: C/empathy.xml:229(para)
 msgid ""
 "When you start <application>Empathy</application> the following window is "
 "shown. <placeholder-1/>"
@@ -347,54 +352,54 @@ msgstr ""
 "Se mostrará la siguiente ventana al iniciar <application>Empathy</"
 "application>. <placeholder-1/>"
 
-#: C/empathy.xml:256(title)
+#: C/empathy.xml:255(title)
 msgid "<application>Empathy</application> Main Components"
 msgstr "Componentes principales de <application>Empathy</application>"
 
-#: C/empathy.xml:263(para)
+#: C/empathy.xml:262(para)
 msgid "Component"
 msgstr "Componente"
 
-#: C/empathy.xml:266(para)
+#: C/empathy.xml:265(para)
 msgid "Description"
 msgstr "Descripción"
 
-#: C/empathy.xml:273(para)
+#: C/empathy.xml:272(para)
 msgid "Menubar"
 msgstr "Barra de menú"
 
-#: C/empathy.xml:276(para)
+#: C/empathy.xml:275(para)
 msgid ""
 "Contains menus used to perform actions in <application>Empathy</application>."
 msgstr ""
 "Contiene los menús usados para realizar acciones en <application>Empathy</"
 "application>."
 
-#: C/empathy.xml:283(para)
+#: C/empathy.xml:282(para)
 msgid "Status Drop-Down List"
 msgstr "Lista desplegable de estados"
 
-#: C/empathy.xml:286(para)
+#: C/empathy.xml:285(para)
 msgid "Allows to update the status."
 msgstr "Permite actualizar el estado."
 
-#: C/empathy.xml:293(para)
+#: C/empathy.xml:292(para)
 msgid "Account Button"
 msgstr "Botón Cuentas"
 
-#: C/empathy.xml:296(para)
+#: C/empathy.xml:295(para)
 msgid "Opens the <guilabel>Accounts</guilabel> dialog."
 msgstr "Abre el diálogo <guilabel>Cuentas</guilabel>."
 
-#: C/empathy.xml:303(para)
+#: C/empathy.xml:302(para)
 msgid "Contact List"
 msgstr "Lista de contactos"
 
-#: C/empathy.xml:306(para)
+#: C/empathy.xml:305(para)
 msgid "Shows all the available contacts and their associated status."
 msgstr "Muestra todos los contactos disponibles y su estado asociado."
 
-#: C/empathy.xml:252(para)
+#: C/empathy.xml:251(para)
 msgid ""
 "<xref linkend=\"empathy-TBL-1\"/> describes the components of "
 "<application>Empathy</application>'s main window. <table frame=\"topbot\" id="
@@ -410,11 +415,11 @@ msgstr ""
 "\"colspec1\" colwidth=\"70.61*\"/><placeholder-2/><placeholder-3/></tgroup></"
 "table>"
 
-#: C/empathy.xml:320(title)
+#: C/empathy.xml:319(title)
 msgid "Accounts"
 msgstr "Cuentas"
 
-#: C/empathy.xml:321(para)
+#: C/empathy.xml:320(para)
 msgid ""
 "To use <application>Empathy</application> you need at least one account of "
 "the supported services."
@@ -422,7 +427,7 @@ msgstr ""
 "Para usar <application>Empathy</application> debe tener al menos una cuenta "
 "de los servicios soportados."
 
-#: C/empathy.xml:324(para)
+#: C/empathy.xml:323(para)
 msgid ""
 "If you don't already have an account and you don't have your <emphasis>user "
 "name</emphasis> and <emphasis>password</emphasis>, you need to register a "
@@ -432,7 +437,7 @@ msgstr ""
 "<emphasis>contraseña</emphasis>, debe registrar una cuenta nueva (consulte "
 "<xref linkend=\"empathy-register-account\"/>)."
 
-#: C/empathy.xml:329(para)
+#: C/empathy.xml:328(para)
 msgid ""
 "In order to talk with other users, also called <emphasis>contacts</"
 "emphasis>, you need to use the same service they are using. If, for example, "
@@ -444,7 +449,7 @@ msgstr ""
 "de sus contactos está usando el servicio <emphasis role=\"strong\">Jabber</"
 "emphasis>, necesita tener una cuenta registrada en ese servicio."
 
-#: C/empathy.xml:336(para)
+#: C/empathy.xml:335(para)
 msgid ""
 "<application>Empathy</application> can handle as many accounts on any "
 "supported services as you want and you can have them all open at the same "
@@ -454,11 +459,11 @@ msgstr ""
 "cualquiera de los servicios soportados que quiera añadir y puede tener todas "
 "ellas abiertas al mismo tiempo."
 
-#: C/empathy.xml:342(title)
+#: C/empathy.xml:341(title)
 msgid "Registering an Account"
 msgstr "Registrar una cuenta"
 
-#: C/empathy.xml:343(para)
+#: C/empathy.xml:342(para)
 msgid ""
 "You can freely register an account on any of the following services. Follow "
 "the instructions reported on each website on how to register your new "
@@ -476,7 +481,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:361(para)
+#: C/empathy.xml:360(para)
 msgid ""
 "The <ulink type=\"http\" url=\"http://dashboard.aim.com/aim\">AIM</ulink> "
 "service."
@@ -486,7 +491,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:368(para)
+#: C/empathy.xml:367(para)
 msgid ""
 "The <ulink type=\"http\" url=\"http://www.google.com/talk/\">Google Talk</"
 "ulink> service."
@@ -496,7 +501,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:376(para)
+#: C/empathy.xml:375(para)
 msgid ""
 "The <ulink type=\"http\" url=\"https://www.icq.com/register/\">ICQ</ulink> "
 "service."
@@ -506,7 +511,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:383(para)
+#: C/empathy.xml:382(para)
 msgid ""
 "The <ulink type=\"http\" url=\"https://accountservices.passport.net\">MSN</"
 "ulink> service."
@@ -516,7 +521,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:390(para)
+#: C/empathy.xml:389(para)
 msgid ""
 "The <ulink type=\"http\" url=\"https://login.yahoo.com/config/login\">Yahoo</"
 "ulink> service."
@@ -524,12 +529,12 @@ msgstr ""
 "El servicio <ulink type=\"http\" url=\"https://login.yahoo.com/config/login"
 "\">Yahoo</ulink>."
 
-#: C/empathy.xml:352(para)
+#: C/empathy.xml:351(para)
 msgid "Click on the name of the service to visit its website: <placeholder-1/>"
 msgstr ""
 "Pulse en el nombre del servicio para visitar su página web: <placeholder-1/>"
 
-#: C/empathy.xml:396(para)
+#: C/empathy.xml:395(para)
 msgid ""
 "For registering a <acronym>SIP</acronym> account, you can use one of the "
 "following service:"
@@ -539,7 +544,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:405(para)
+#: C/empathy.xml:404(para)
 msgid ""
 "The <ulink type=\"http\" url=\"https://www.ekiga.net/index.php?page=register"
 "\">Ekiga</ulink> service."
@@ -549,7 +554,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:412(para)
+#: C/empathy.xml:411(para)
 msgid ""
 "The <ulink type=\"http\" url=\"http://account2.freeworlddialup.com/index.php?"
 "section_id=94\"><acronym>FWD</acronym></ulink> (Free World Dialup) service."
@@ -559,7 +564,7 @@ msgstr ""
 
 #. Translators: try to find a localized version of the
 #.         registration service website
-#: C/empathy.xml:420(para)
+#: C/empathy.xml:419(para)
 msgid ""
 "The <ulink type=\"http\" url=\"https://signup.sipphone.com/new-users/app?"
 "class=NewUser;proc=start\">Sipphone</ulink> service."
@@ -567,7 +572,7 @@ msgstr ""
 "El servicio <ulink type=\"http\" url=\"https://signup.sipphone.com/new-users/"
 "app?class=NewUser;proc=start\">Sipphone</ulink>."
 
-#: C/empathy.xml:426(para)
+#: C/empathy.xml:425(para)
 msgid ""
 "For registering a <emphasis role=\"strong\">Jabber</emphasis> account, you "
 "can use the automatic account creation of <application>Empathy</"
@@ -583,7 +588,7 @@ msgstr ""
 "sabe que funcionan con <application>Empathy</application> es <ulink type="
 "\"http\" url=\"http://www.jabber.org/web/Jabber.org\">jabber.org</ulink>."
 
-#: C/empathy.xml:434(para)
+#: C/empathy.xml:433(para)
 msgid ""
 "If you already have a <emphasis role=\"strong\">Jabber</emphasis> account, "
 "you can use one of the following services:"
@@ -591,12 +596,12 @@ msgstr ""
 "Si ya tiene una cuenta <emphasis role=\"strong\">Jabber</emphasis> puede "
 "usar uno de los siguientes servicios:"
 
-#: C/empathy.xml:451(title)
+#: C/empathy.xml:450(title)
 msgid "Adding your Account to <application>Empathy</application>"
 msgstr "Añadir su cuenta a <application>Empathy</application>"
 
-#: C/empathy.xml:456(para) C/empathy.xml:534(para) C/empathy.xml:586(para)
-#: C/empathy.xml:619(para) C/empathy.xml:649(para) C/empathy.xml:672(para)
+#: C/empathy.xml:455(para) C/empathy.xml:533(para) C/empathy.xml:585(para)
+#: C/empathy.xml:618(para) C/empathy.xml:648(para) C/empathy.xml:671(para)
 msgid ""
 "From the <link linkend=\"empathy-FIG-mainwindow\">main window </link> "
 "(<guilabel>Contact List</guilabel>) click on the account button or press "
@@ -606,7 +611,7 @@ msgstr ""
 "(<guilabel>Lista de contactos</guilabel>) pulse en el botón de cuentas o "
 "<keycap>F4</keycap> para abrir el diálogo <guilabel>Cuentas</guilabel>."
 
-#: C/empathy.xml:468(para) C/empathy.xml:485(para)
+#: C/empathy.xml:467(para) C/empathy.xml:484(para)
 msgid ""
 "From the <guilabel>Type</guilabel> drop-down list choose the service you "
 "wish to add an account for, then click on the <guibutton>Create</guibutton> "
@@ -616,7 +621,7 @@ msgstr ""
 "el que quiere crear la cuenta, después pulse en el botón <guibutton>Crear</"
 "guibutton>."
 
-#: C/empathy.xml:464(para)
+#: C/empathy.xml:463(para)
 msgid ""
 "If it is the first time you launch <application>Empathy</application>: "
 "<placeholder-1/>"
@@ -624,15 +629,15 @@ msgstr ""
 "Si ésta es la primera vez que lanza <application>Empathy</application>: "
 "<placeholder-1/>"
 
-#: C/empathy.xml:480(para)
+#: C/empathy.xml:479(para)
 msgid "Click on the <guilabel>Add</guilabel> button."
 msgstr "Pulse el botón <guibutton>Añadir</guibutton>."
 
-#: C/empathy.xml:476(para)
+#: C/empathy.xml:475(para)
 msgid "Otherwise: <placeholder-1/>"
 msgstr "De otra forma: <placeholder-1/>"
 
-#: C/empathy.xml:495(para)
+#: C/empathy.xml:494(para)
 msgid ""
 "Fill the required fields with your <emphasis>user name</emphasis> and "
 "<emphasis>password</emphasis>. Optionally, you can modify some advanced "
@@ -644,7 +649,7 @@ msgstr ""
 "opciones avanzadas. Para obtener más información consulte <xref linkend="
 "\"empathy-advanced-options\"/>."
 
-#: C/empathy.xml:504(para) C/empathy.xml:567(para)
+#: C/empathy.xml:503(para) C/empathy.xml:566(para)
 msgid ""
 "To enable the new account, select the <guilabel>Enabled</guilabel> check-box "
 "next to the name of the account in the box on the left."
@@ -653,7 +658,7 @@ msgstr ""
 "<guilabel>Activada</guilabel> junto al nombre de la cuenta, en la caja de la "
 "izquierda."
 
-#: C/empathy.xml:452(para)
+#: C/empathy.xml:451(para)
 msgid ""
 "To add your account to <application>Empathy</application>, proceed as "
 "follows: <placeholder-1/>"
@@ -661,11 +666,11 @@ msgstr ""
 "Para añadir su cuenta a <application>Empathy</application>, proceda como "
 "sigue: <placeholder-1/>"
 
-#: C/empathy.xml:514(title)
+#: C/empathy.xml:513(title)
 msgid "Importing Accounts"
 msgstr "Importar cuentas"
 
-#: C/empathy.xml:515(para)
+#: C/empathy.xml:514(para)
 msgid ""
 "If you use another instant messaging program, you can import the accounts "
 "from that program into <application>Empathy</application>"
@@ -673,7 +678,7 @@ msgstr ""
 "Si usa otro programa de mensajería instantánea puede importar las cuentas de "
 "ese programa en <application>Empathy</application>"
 
-#: C/empathy.xml:521(para)
+#: C/empathy.xml:520(para)
 msgid ""
 "At the moment <application>Empathy</application> can import the accounts "
 "only from the instant messaging program <application>Pidgin</application>. "
@@ -685,7 +690,7 @@ msgstr ""
 "información acerca de <application>Pidgin</application> consulte la <ulink "
 "type=\"http\" url=\"http://www.pidgin.im/\">página web de Pidgin</ulink>."
 
-#: C/empathy.xml:542(para)
+#: C/empathy.xml:541(para)
 msgid ""
 "Click on the <guibutton>Import Accounts...</guibutton> button to open the "
 "<guilabel>Import Accounts</guilabel> dialog."
@@ -693,7 +698,7 @@ msgstr ""
 "Pulse en el botón <guibutton>Importar cuentas...</guibutton> para abrir el "
 "diálogo <guilabel>Importar cuentas</guilabel>."
 
-#: C/empathy.xml:549(para)
+#: C/empathy.xml:548(para)
 msgid ""
 "Select the accounts you would like to import by clicking on the "
 "<guilabel>Import</guilabel> check-box."
@@ -701,7 +706,7 @@ msgstr ""
 "Seleccione la cuenta que quiere importar pulsando en la casilla de selección "
 "<guilabel>Importar</guilabel>."
 
-#: C/empathy.xml:555(para)
+#: C/empathy.xml:554(para)
 msgid ""
 "When you have selected all the desired accounts, click <guibutton>OK</"
 "guibutton> to import them. If you don't want to import the accounts, click "
@@ -711,7 +716,7 @@ msgstr ""
 "<guibutton>Aceptar</guibutton> para importarlas. Si no quiere importar las "
 "cuentas, pulse el botón <guibutton>Cancelar</guibutton>."
 
-#: C/empathy.xml:563(para)
+#: C/empathy.xml:562(para)
 msgid ""
 "When you import a new account into <application>Empathy</application>, it "
 "will not be enabled by default."
@@ -719,7 +724,7 @@ msgstr ""
 "Al importar una cuenta nueva en <application>Empathy</application> no se "
 "activará de forma predeterminada."
 
-#: C/empathy.xml:530(para)
+#: C/empathy.xml:529(para)
 msgid ""
 "To import the accounts into <application>Empathy</application>, proceed as "
 "follows: <placeholder-1/>"
@@ -727,19 +732,19 @@ msgstr ""
 "Para importar cuentas en <application>Empathy</application> proceda como "
 "sigue: <placeholder-1/>"
 
-#: C/empathy.xml:579(title)
+#: C/empathy.xml:578(title)
 msgid "Editing an Account"
 msgstr "Editar una cuenta"
 
-#: C/empathy.xml:594(para)
+#: C/empathy.xml:593(para)
 msgid "Select the account you wish to edit in the box on the left."
 msgstr "Seleccione la cuenta que quiere editar en la caja a la izquierda."
 
-#: C/empathy.xml:600(para)
+#: C/empathy.xml:599(para)
 msgid "Modify the desired data."
 msgstr "Modifique los datos deseados."
 
-#: C/empathy.xml:580(para)
+#: C/empathy.xml:579(para)
 msgid ""
 "To edit one of your accounts, i.e. to change the <emphasis>password</"
 "emphasis> or your <emphasis>user name</emphasis>, proceed as follows: "
@@ -749,12 +754,12 @@ msgstr ""
 "<emphasis>contraseña</emphasis> o su <emphasis>usuario</emphasis>, proceda "
 "como sigue: <placeholder-1/>"
 
-#: C/empathy.xml:608(para)
+#: C/empathy.xml:607(para)
 msgid ""
 "Based on the type of the account, it is possibile to edit different settings."
 msgstr "Basado en el tipo de cuenta, es posible editar diferentes ajustes."
 
-#: C/empathy.xml:627(para)
+#: C/empathy.xml:626(para)
 msgid ""
 "Select the account you wish to edit in the box on the left and double-click "
 "on its name."
@@ -762,11 +767,11 @@ msgstr ""
 "Seleccione la cuenta que quiere editar en la caja de la izquierda y pulse "
 "dos veces en su nombre."
 
-#: C/empathy.xml:633(para)
+#: C/empathy.xml:632(para)
 msgid "Change the name of the account as you desire."
 msgstr "Cambie el nombre de la cuenta como desee."
 
-#: C/empathy.xml:614(para)
+#: C/empathy.xml:613(para)
 msgid ""
 "To modify the identifier of an account, how <application>Empathy</"
 "application> identifies an account, proceed as follows: <placeholder-1/>"
@@ -775,15 +780,15 @@ msgstr ""
 "<application>Empathy</application> identifica a la cuente, proceda como "
 "sigue: <placeholder-1/>"
 
-#: C/empathy.xml:642(title)
+#: C/empathy.xml:641(title)
 msgid "Disabling and Removing an Account"
 msgstr "Desactivar y quitaruna cuenta"
 
-#: C/empathy.xml:643(para)
+#: C/empathy.xml:642(para)
 msgid "To disable an account, proceed as follows:"
 msgstr "Para desactivar una cuenta, proceda como sigue:"
 
-#: C/empathy.xml:658(para)
+#: C/empathy.xml:657(para)
 msgid ""
 "Select the account you wish to disable in the box on the left of the dialog "
 "and deselect the <guilabel>Enabled</guilabel> check-box."
@@ -792,22 +797,22 @@ msgstr ""
 "diálogo y deselecicone la casilla de verificación <guilabel>Activada</"
 "guilabel>."
 
-#: C/empathy.xml:666(para)
+#: C/empathy.xml:665(para)
 msgid "To remove an account, proceed as follows:"
 msgstr "Para quitar una cuenta, proceda como sigue:"
 
-#: C/empathy.xml:681(para)
+#: C/empathy.xml:680(para)
 msgid ""
 "Select the account you wish to disable in the box on the left of the dialog."
 msgstr ""
 "Seleccione la cuenta que desea desactivar en la caja a la izquierda del "
 "diálogo."
 
-#: C/empathy.xml:687(para)
+#: C/empathy.xml:686(para)
 msgid "Click on the <guibutton>Remove</guibutton> button."
 msgstr "Pulse en el botón <guibutton>Quitar</guibutton>."
 
-#: C/empathy.xml:692(para)
+#: C/empathy.xml:691(para)
 msgid ""
 "A dialog will be shown asking for confirmation. Click on the "
 "<guibutton>Remove</guibutton> button to remove the account."
@@ -815,11 +820,11 @@ msgstr ""
 "Se mostrará un diálogo preguntando por una confirmación. Pulse en el botón "
 "<guibutton>Quitar</guibutton> para quitar la cuenta."
 
-#: C/empathy.xml:702(title)
+#: C/empathy.xml:701(title)
 msgid "Editing Personal Information"
 msgstr "Editar información personal"
 
-#: C/empathy.xml:703(para)
+#: C/empathy.xml:702(para)
 msgid ""
 "To change your personal information, your alias and your icon (the image "
 "that other contacts will see of you), for each of your accounts, proceed as "
@@ -829,7 +834,7 @@ msgstr ""
 "que otros contactos le ven), para cada una de las cuentas, proceda como "
 "sigue:"
 
-#: C/empathy.xml:711(para)
+#: C/empathy.xml:710(para)
 msgid ""
 "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link>, select "
 "<menuchoice><guimenu>Edit</guimenu><guimenuitem>Personal Information</"
@@ -839,7 +844,7 @@ msgstr ""
 "seleccione <menuchoice><guimenu>Editar</guimenu><guimenuitem>Información "
 "personal</guimenuitem></menuchoice>."
 
-#: C/empathy.xml:720(para)
+#: C/empathy.xml:719(para)
 msgid ""
 "From the <guilabel>Account</guilabel> drop-down list, choose the account you "
 "want to edit."
@@ -847,11 +852,11 @@ msgstr ""
 "Desde la lista desplegable <guilabel>Cuenta</guilabel>, elija la cuenta que "
 "quiere editar."
 
-#: C/empathy.xml:726(para)
+#: C/empathy.xml:725(para)
 msgid "In the <guilabel>Alias</guilabel> text box, write your new alias."
 msgstr "En la caja de texto <guilabel>Apodo</guilabel> escriba su nuevo apodo."
 
-#: C/empathy.xml:732(para)
+#: C/empathy.xml:731(para)
 msgid ""
 "To change your icon, click on the person-looking button and choose an image "
 "file."
@@ -859,11 +864,11 @@ msgstr ""
 "Para cambiar su icono pulse en el botón de apariencia personal y elija un "
 "archivo de imagen."
 
-#: C/empathy.xml:738(para) C/empathy.xml:1319(para) C/empathy.xml:1353(para)
+#: C/empathy.xml:737(para) C/empathy.xml:1318(para) C/empathy.xml:1352(para)
 msgid "When done, click <guibutton>Close</guibutton>."
 msgstr "Cuando termine pulse <guibutton>Cerrar</guibutton>."
 
-#: C/empathy.xml:746(para)
+#: C/empathy.xml:745(para)
 msgid ""
 "An <emphasis>alias</emphasis> is an alternative way you can identify "
 "yourself. You can use your real name or a nickname."
@@ -871,11 +876,11 @@ msgstr ""
 "Un <emphasis>apodo</emphasis> es una forma alternativa por la que se puede "
 "identificar. Puede usar su nombre real o un apodo."
 
-#: C/empathy.xml:756(title)
+#: C/empathy.xml:755(title)
 msgid "Advanced Options"
 msgstr "Opciones avanzadas"
 
-#: C/empathy.xml:757(para)
+#: C/empathy.xml:756(para)
 msgid ""
 "Based on the service you are using, it is possible to configure more "
 "advanced options to modify the normal behavior of <application>Empathy</"
@@ -885,7 +890,7 @@ msgstr ""
 "avanzadas para modificar el comportamiento normal de <application>Empathy</"
 "application>."
 
-#: C/empathy.xml:762(para)
+#: C/empathy.xml:761(para)
 msgid ""
 "To configure these options, when you are <link linkend=\"empathy-create-"
 "account\">adding a new account</link>, click on the drop-down section "
@@ -895,15 +900,15 @@ msgstr ""
 "account\">añadiendo una cuenta nueva</link>, pulse la sección desplegable "
 "<guilabel>Avanzadas</guilabel>."
 
-#: C/empathy.xml:770(title)
+#: C/empathy.xml:769(title)
 msgid "Jabber (or <acronym>XMPP</acronym>) and Google Talk"
 msgstr "Jabber (o <acronym>XMPP</acronym>) y Google Talk"
 
-#: C/empathy.xml:777(guilabel)
+#: C/empathy.xml:776(guilabel)
 msgid "Encryption required (TLS/SSL)"
 msgstr "Se requiere cifrado (TLS/SSL)"
 
-#: C/empathy.xml:780(para)
+#: C/empathy.xml:779(para)
 msgid ""
 "Select this option in order to use some sort of encryption during your "
 "conversations."
@@ -911,11 +916,11 @@ msgstr ""
 "Seleccione esta opción para usar algún tipo de cifrado durante sus "
 "conversaciones."
 
-#: C/empathy.xml:788(guilabel)
+#: C/empathy.xml:787(guilabel)
 msgid "Ignore SSL certificate errors"
 msgstr "Ignorar los errores de certificados SSL"
 
-#: C/empathy.xml:791(para)
+#: C/empathy.xml:790(para)
 msgid ""
 "Select this option in order to ignore the errors that can be generated by "
 "some types of security certificates. Usually these certificates are called "
@@ -925,7 +930,7 @@ msgstr ""
 "tipos de certificados de seguridad. Generalmente esos certificados se llaman "
 "autofirmados."
 
-#: C/empathy.xml:799(para)
+#: C/empathy.xml:798(para)
 msgid ""
 "Select this option only if you are sure the certificate is secure and you "
 "can trust it."
@@ -933,20 +938,11 @@ msgstr ""
 "Seleccione esta opción sólo si está seguro de que su certificado es seguro y "
 "puede confiar en él."
 
-#: C/empathy.xml:809(guilabel)
+#: C/empathy.xml:808(guilabel)
 msgid "Resource"
 msgstr "Recurso"
 
-#: C/empathy.xml:812(para)
-#| msgid ""
-#| "Use this text box to set a name with which you can identify the running "
-#| "program based on where you are running it. With this option, and the "
-#| "<guilabel>Priority</guilabel> one, you can use your account "
-#| "simultaneously in two different devices. For example, if you set one "
-#| "device to <replaceable>desktop</replaceable> and of the other one to "
-#| "<replaceable>mobile</replaceable>, you can connect with both of them and "
-#| "based on the <guilabel>Priority</guilabel> value you will receive "
-#| "messages on one of the two devices or both."
+#: C/empathy.xml:811(para)
 msgid ""
 "Use this text box to set a name with which you can identify the running "
 "program based on where you are running it. With this option, and the "
@@ -966,7 +962,7 @@ msgstr ""
 "dispositivos y basándose en el valor <guilabel>Prioridad</guilabel> recibirá "
 "los mensajes en uno de los dispositivos o en ambos."
 
-#: C/empathy.xml:825(para)
+#: C/empathy.xml:824(para)
 msgid ""
 "This can be useful if you have two devices, a main one and a portable one, "
 "and you move away from the main one bringing with you the other: you can "
@@ -978,7 +974,7 @@ msgstr ""
 "mensajes desde su cuenta con el dispositivo portable incluso si no "
 "desconecta el principal."
 
-#: C/empathy.xml:834(para)
+#: C/empathy.xml:833(para)
 msgid ""
 "If you set the same value for this text box on both the devices, when you "
 "connect with one of them, the other one will be disconnected, even if you "
@@ -989,11 +985,11 @@ msgstr ""
 "establece un valor diferente en la caja incrementable <guilabel>Prioridad</"
 "guilabel>."
 
-#: C/empathy.xml:847(guilabel)
+#: C/empathy.xml:846(guilabel)
 msgid "Priority"
 msgstr "Prioridad"
 
-#: C/empathy.xml:850(para)
+#: C/empathy.xml:849(para)
 msgid ""
 "Use this spin box to indicate wich device, set in the <guilabel>Resource</"
 "guilabel> text box, will receive the new messages. The higher the number, "
@@ -1005,7 +1001,7 @@ msgstr ""
 "Cuanto mayor sea el número, mayor será la prioridad: recibirá los mensajes "
 "nuevos en el dispositivo con el número más alto."
 
-#: C/empathy.xml:857(para)
+#: C/empathy.xml:856(para)
 msgid ""
 "You can set values in the range from <literal>-128</literal> to "
 "<literal>127</literal>."
@@ -1013,7 +1009,7 @@ msgstr ""
 "Puede establecer valores en el rango de <literal>-128</literal> a "
 "<literal>127</literal>."
 
-#: C/empathy.xml:863(para)
+#: C/empathy.xml:862(para)
 msgid ""
 "If you set the same value of this spin box in both the devices, you will "
 "receive messages on both of them."
@@ -1021,13 +1017,13 @@ msgstr ""
 "Si establece el mismo valor de esta caja incrementable en ambos "
 "dispositivos, recibirá mensajes en ambos dos."
 
-#: C/empathy.xml:880(guilabel) C/empathy.xml:973(guilabel)
-#: C/empathy.xml:1021(guilabel) C/empathy.xml:1115(guilabel)
+#: C/empathy.xml:879(guilabel) C/empathy.xml:972(guilabel)
+#: C/empathy.xml:1020(guilabel) C/empathy.xml:1114(guilabel)
 msgid "Server"
 msgstr "Servidor"
 
-#: C/empathy.xml:883(para) C/empathy.xml:976(para) C/empathy.xml:1024(para)
-#: C/empathy.xml:1118(para)
+#: C/empathy.xml:882(para) C/empathy.xml:975(para) C/empathy.xml:1023(para)
+#: C/empathy.xml:1117(para)
 msgid ""
 "Use this text box to write the name of the server you want to use for this "
 "service."
@@ -1035,20 +1031,20 @@ msgstr ""
 "Use esta caja de texto para escribir el nombre del servidor que quiere usar "
 "para este servicio."
 
-#: C/empathy.xml:891(guilabel) C/empathy.xml:984(guilabel)
-#: C/empathy.xml:1032(guilabel) C/empathy.xml:1126(guilabel)
+#: C/empathy.xml:890(guilabel) C/empathy.xml:983(guilabel)
+#: C/empathy.xml:1031(guilabel) C/empathy.xml:1125(guilabel)
 msgid "Port"
 msgstr "Puerto"
 
-#: C/empathy.xml:894(para) C/empathy.xml:987(para) C/empathy.xml:1035(para)
-#: C/empathy.xml:1129(para)
+#: C/empathy.xml:893(para) C/empathy.xml:986(para) C/empathy.xml:1034(para)
+#: C/empathy.xml:1128(para)
 msgid "Use this spin box to set the number of the port of the server to use."
 msgstr ""
 "Use esta caja incrementable para establecer el número del puerto del "
 "servidor que usar."
 
-#: C/empathy.xml:898(para) C/empathy.xml:991(para) C/empathy.xml:1039(para)
-#: C/empathy.xml:1133(para)
+#: C/empathy.xml:897(para) C/empathy.xml:990(para) C/empathy.xml:1038(para)
+#: C/empathy.xml:1132(para)
 msgid ""
 "You can set values in the range from <literal>0</literal> to "
 "<literal>65,555</literal>."
@@ -1056,11 +1052,11 @@ msgstr ""
 "Puede establecer valores en el rango de <literal>0</literal> a "
 "<literal>65.555</literal>."
 
-#: C/empathy.xml:906(guilabel)
+#: C/empathy.xml:905(guilabel)
 msgid "Use old SSL"
 msgstr "Usar SSL antiguo"
 
-#: C/empathy.xml:909(para)
+#: C/empathy.xml:908(para)
 msgid ""
 "Select this option to use the old version of the secure protocol for "
 "encrypting your connection."
@@ -1068,7 +1064,7 @@ msgstr ""
 "Seleccione esta opción para usar la versión antigua del protocolo seguro "
 "para cifrar su conexión."
 
-#: C/empathy.xml:874(para)
+#: C/empathy.xml:873(para)
 msgid ""
 "In the <guilabel>Override server settings</guilabel> section you can set "
 "options that take precedence over the default settings. <placeholder-1/>"
@@ -1077,22 +1073,22 @@ msgstr ""
 "puede establecer opciones que tienen preferencia sobre los ajustes "
 "predeterminados. <placeholder-1/>"
 
-#: C/empathy.xml:925(guilabel)
+#: C/empathy.xml:924(guilabel)
 msgid "Ignore conference and chatrooms invitations"
 msgstr "Ignorar invitaciones a conferencias y salas de chat"
 
-#: C/empathy.xml:929(para)
+#: C/empathy.xml:928(para)
 msgid ""
 "Select this option to ignore the invitations that other people may send you."
 msgstr ""
 "Seleccione esta opción para ignorar las invitaciones que otras personas "
 "pueden enviarle."
 
-#: C/empathy.xml:937(guilabel)
+#: C/empathy.xml:936(guilabel)
 msgid "Room List locale"
 msgstr "Configuración de la lista de salas"
 
-#: C/empathy.xml:940(para)
+#: C/empathy.xml:939(para)
 msgid ""
 "The value of this text box identifies the language used to retrieve the room "
 "list when connecting to the Yahoo service."
@@ -1100,17 +1096,17 @@ msgstr ""
 "El valor de esta caja de texto identifica el idioma que usar al obtener la "
 "lista de salas al conectar con el servicio de Yahoo!"
 
-#: C/empathy.xml:945(para)
+#: C/empathy.xml:944(para)
 msgid ""
 "If you need to change this value, use the two letter code of your language."
 msgstr ""
 "Si necesita cambiar ese valor use el código de dos letras para su idioma."
 
-#: C/empathy.xml:953(guilabel) C/empathy.xml:1095(guilabel)
+#: C/empathy.xml:952(guilabel) C/empathy.xml:1094(guilabel)
 msgid "Charset"
 msgstr "Conjunto de caracteres"
 
-#: C/empathy.xml:956(para) C/empathy.xml:1098(para)
+#: C/empathy.xml:955(para) C/empathy.xml:1097(para)
 msgid ""
 "The value of this text box identifies the set of the characters used by "
 "<application>Empathy</application>."
@@ -1118,7 +1114,7 @@ msgstr ""
 "El valor de esta caja de texto identifica el conjunto de caracteres que usa "
 "<application>Empathy</application>."
 
-#: C/empathy.xml:962(para) C/empathy.xml:1104(para)
+#: C/empathy.xml:961(para) C/empathy.xml:1103(para)
 msgid ""
 "It is advise to leave this value to <literal>UTF-8</literal>. Change it only "
 "if that charset does not cover your language."
@@ -1126,11 +1122,11 @@ msgstr ""
 "Se recomienda dejar este valor en <literal>UTF-8</literal>. Cámbielo sólo si "
 "ese conjunto de caracteres no cubre su idioma."
 
-#: C/empathy.xml:999(guilabel)
+#: C/empathy.xml:998(guilabel)
 msgid "Use Yahoo Japan"
 msgstr "Usar Yahoo Japón"
 
-#: C/empathy.xml:1002(para)
+#: C/empathy.xml:1001(para)
 msgid ""
 "Select this option only if you have a Yahoo! Japan account. With the Yahoo! "
 "Japan service you can only use a Yahoo! Japan account: if you have "
@@ -1142,15 +1138,15 @@ msgstr ""
 "registrado una cuenta con la versión inglesa del servicio, esa cuenta no "
 "funcionará."
 
-#: C/empathy.xml:1016(title)
+#: C/empathy.xml:1015(title)
 msgid "<acronym>AIM</acronym>, GroupWise and <acronym>MSN</acronym>"
 msgstr "<acronym>AIM</acronym>, GroupWise y <acronym>MSN</acronym>"
 
-#: C/empathy.xml:1055(guilabel)
+#: C/empathy.xml:1054(guilabel)
 msgid "Published Name"
 msgstr "Nombre publicado"
 
-#: C/empathy.xml:1058(para)
+#: C/empathy.xml:1057(para)
 msgid ""
 "Use this text box to write the name that will be visible to the other users "
 "of the network."
@@ -1158,42 +1154,42 @@ msgstr ""
 "Use esta caja de texto para escribir el nombre que será visible al resto de "
 "usuarios de la red."
 
-#: C/empathy.xml:1066(guilabel)
+#: C/empathy.xml:1065(guilabel)
 msgid "Email"
 msgstr "Correo-e"
 
-#: C/empathy.xml:1069(para)
+#: C/empathy.xml:1068(para)
 msgid "Use this text box to write your email."
 msgstr "Use esta caja de texto para escribir su correo-e."
 
-#: C/empathy.xml:1076(guilabel)
+#: C/empathy.xml:1075(guilabel)
 msgid "Jabber ID"
 msgstr "ID Jabber"
 
-#: C/empathy.xml:1079(para)
+#: C/empathy.xml:1078(para)
 msgid "Use this text box to write your Jabber ID, if you have one."
 msgstr "Use esta caja de texto para escribir su ID Jabber, si tiene uno."
 
-#: C/empathy.xml:1144(title)
+#: C/empathy.xml:1143(title)
 msgid "Gadu Gadu"
 msgstr "Gadu Gadu"
 
-#: C/empathy.xml:1148(guilabel)
+#: C/empathy.xml:1147(guilabel)
 msgid "Nick"
 msgstr "Apodo"
 
-#: C/empathy.xml:1150(para)
+#: C/empathy.xml:1149(para)
 msgid ""
 "Use this text box to write an alternative name to use with this service."
 msgstr ""
 "Use esta caja de texto para escribir un nombre alternativo que usar con este "
 "servicio."
 
-#: C/empathy.xml:1165(title)
+#: C/empathy.xml:1164(title)
 msgid "Contacts and Groups"
 msgstr "Contactos y grupos"
 
-#: C/empathy.xml:1166(para)
+#: C/empathy.xml:1165(para)
 msgid ""
 "All the contacts are handled within <application>Empathy</application>'s "
 "<link linkend=\"empathy-FIG-mainwindow\">main window</link>."
@@ -1201,7 +1197,7 @@ msgstr ""
 "Todos los contactos se gestionan en la <link linkend=\"empathy-FIG-mainwindow"
 "\">ventana principal</link> de <application>Empathy</application>."
 
-#: C/empathy.xml:1170(para)
+#: C/empathy.xml:1169(para)
 msgid ""
 "You can add or remove a contact or you can edit the information of a "
 "particular contact. It is also possibile to arrange contacts in groups. You "
@@ -1213,15 +1209,15 @@ msgstr ""
 "Puede tener un grupo para sus contactos del trabajo, uno para los contactos "
 "de su familia, y demás."
 
-#: C/empathy.xml:1177(title)
+#: C/empathy.xml:1176(title)
 msgid "Adding and Removing a Contact"
 msgstr "Añadir y quitar un contacto"
 
-#: C/empathy.xml:1178(para)
+#: C/empathy.xml:1177(para)
 msgid "To add a new contact, proceed as follows:"
 msgstr "Para añadir un contacto nuevo, proceda como sigue:"
 
-#: C/empathy.xml:1184(para)
+#: C/empathy.xml:1183(para)
 msgid ""
 "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link> choose "
 "<menuchoice><guimenu>Chat</guimenu><guimenuitem>Add Contact...</"
@@ -1233,7 +1229,7 @@ msgstr ""
 "guimenuitem></menuchoice>. Se mostrará el diálogo <guilabel>Contacto nuevo</"
 "guilabel>."
 
-#: C/empathy.xml:1194(para)
+#: C/empathy.xml:1193(para)
 msgid ""
 "From the <guilabel>Account</guilabel> drop-down list, choose the service "
 "used by the contact you are adding."
@@ -1241,7 +1237,7 @@ msgstr ""
 "Desde la lista desplegable <guilabel>Cuenta</guilabel>, elija el servicio "
 "que usa el contacto que está añadiendo."
 
-#: C/empathy.xml:1200(para)
+#: C/empathy.xml:1199(para)
 msgid ""
 "In the <guilabel>Identifier</guilabel> text box type the <emphasis>address</"
 "emphasis> of the contact in the form of <userinput><replaceable>user name</"
@@ -1254,7 +1250,7 @@ msgstr ""
 "replaceable>@<replaceable>servicio\n"
 "\t     dominio</replaceable></userinput>."
 
-#: C/empathy.xml:1209(para)
+#: C/empathy.xml:1208(para)
 msgid ""
 "In the <guilabel>Alias</guilabel> text box type the name you want to give at "
 "the the new contact."
@@ -1262,15 +1258,15 @@ msgstr ""
 "En la caja de texto <guilabel>Apodo</guilabel> escriba el nombre que quiere "
 "darle a su nuevo contacto."
 
-#: C/empathy.xml:1215(para)
+#: C/empathy.xml:1214(para)
 msgid "Click on <guibutton>Add</guibutton> to add the new contact."
 msgstr "Pulse en <guibutton>Añadir</guibutton> para añadir el contacto nuevo."
 
-#: C/empathy.xml:1221(para)
+#: C/empathy.xml:1220(para)
 msgid "To remove a contact, proceed as follows:"
 msgstr "Para quitar un contacto, proceda como sigue:"
 
-#: C/empathy.xml:1227(para)
+#: C/empathy.xml:1226(para)
 msgid ""
 "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link>, select "
 "the contact you would like to remove and right-click on it."
@@ -1279,7 +1275,7 @@ msgstr ""
 "seleccione el contacto que quiere quitar y pulse con el botón derecho sobre "
 "él."
 
-#: C/empathy.xml:1234(para)
+#: C/empathy.xml:1233(para)
 msgid ""
 "From the popup menu, choose <guilabel>Remove</guilabel> to remove the "
 "contact."
@@ -1287,7 +1283,7 @@ msgstr ""
 "Desde el menú emergente, elija <guilabel>Quitar</guilabel> para quitar el "
 "contacto."
 
-#: C/empathy.xml:1243(para) C/empathy.xml:1279(para)
+#: C/empathy.xml:1242(para) C/empathy.xml:1278(para)
 msgid ""
 "An <emphasis>alias</emphasis> is an alternative way you can identify that "
 "particular contact. You can use the real name or the nickname of that person."
@@ -1295,21 +1291,15 @@ msgstr ""
 "Un <emphasis>apodo</emphasis> es una forma alternativa de identificar un "
 "contacto en particular. Puede usar el nombre real o el apodo de esa persona."
 
-#: C/empathy.xml:1252(title)
+#: C/empathy.xml:1251(title)
 msgid "Editing a Contact"
 msgstr "Editar un contacto"
 
-#: C/empathy.xml:1253(para)
+#: C/empathy.xml:1252(para)
 msgid "To edit a contact, proceed as follows:"
 msgstr "Para editar un contacto, proceda como sigue:"
 
-#: C/empathy.xml:1259(para) C/empathy.xml:1301(para)
-#| msgid ""
-#| "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link>, "
-#| "select the contact you would like to modify and choose "
-#| "<menuchoice><guimenu>Edit</guimenu><guisubmenu>Account</"
-#| "guisubmenu><guimenuitem>Modify</guimenuitem></menuchoice>, or right-click "
-#| "on it and choose <guilabel>Modify</guilabel>."
+#: C/empathy.xml:1258(para) C/empathy.xml:1300(para)
 msgid ""
 "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link>, select "
 "the contact you would like to modify and choose <menuchoice><guimenu>Edit</"
@@ -1322,7 +1312,7 @@ msgstr ""
 "guisubmenu><guimenuitem>Editar</guimenuitem></menuchoice> o pulse con el "
 "botón derecho sobre él y elija <guilabel>Editar</guilabel>."
 
-#: C/empathy.xml:1272(para)
+#: C/empathy.xml:1271(para)
 msgid ""
 "From the <guilabel>Edit Contact Information</guilabel> dialog, you can "
 "modify the <emphasis>alias</emphasis> and the <emphasis>group</emphasis> of "
@@ -1332,7 +1322,7 @@ msgstr ""
 "modificar el <emphasis>apodp</emphasis> y el <emphasis>grupo</emphasis> del "
 "contacto."
 
-#: C/empathy.xml:1286(para)
+#: C/empathy.xml:1285(para)
 msgid ""
 "For more information about groups, see <xref linkend=\"empathy-add-contact-"
 "group\"/> and <xref linkend=\"empathy-add-group\"/>."
@@ -1340,15 +1330,15 @@ msgstr ""
 "Para obtener más información acerca de los grupos, consulte <xref linkend="
 "\"empathy-add-contact-group\"/> y <xref linkend=\"empathy-add-group\"/>."
 
-#: C/empathy.xml:1294(title)
+#: C/empathy.xml:1293(title)
 msgid "Adding a Contact to a Group"
 msgstr "Añadir un contacto a un grupo"
 
-#: C/empathy.xml:1295(para)
+#: C/empathy.xml:1294(para)
 msgid "To add a contact to one or more groups, proceed as follows:"
 msgstr "Para añadir un contacto a uno o más grupos, proceda como sigue:"
 
-#: C/empathy.xml:1313(para)
+#: C/empathy.xml:1312(para)
 msgid ""
 "From the <guilabel>Groups</guilabel> section, select the group, or groups, "
 "you want to add the contact to."
@@ -1356,21 +1346,15 @@ msgstr ""
 "En la sección <guilabel>Grupos</guilabel>, seleccione el grupo o grupos a "
 "los que quiera añadir el contacto."
 
-#: C/empathy.xml:1328(title)
+#: C/empathy.xml:1327(title)
 msgid "Adding a New Group"
 msgstr "Añadir un grupo nuevo"
 
-#: C/empathy.xml:1329(para)
+#: C/empathy.xml:1328(para)
 msgid "To add a new group, proceed as follows:"
 msgstr "Para añadir un grupo nuevo, proceda como sigue:"
 
-#: C/empathy.xml:1335(para)
-#| msgid ""
-#| "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link>, "
-#| "select one contact and choose <menuchoice><guimenu>Edit</"
-#| "guimenu><guisubmenu>Account</guisubmenu><guimenuitem>Modify</"
-#| "guimenuitem></menuchoice>, or right-click on it and choose "
-#| "<guilabel>Modify</guilabel>."
+#: C/empathy.xml:1334(para)
 msgid ""
 "From the <link linkend=\"empathy-FIG-mainwindow\">main window</link>, select "
 "one contact and choose <menuchoice><guimenu>Edit</"
@@ -1382,7 +1366,7 @@ msgstr ""
 "guimenu><guisubmenu>Contacto</guisubmenu><guimenuitem>Editar</guimenuitem></"
 "menuchoice> o pulse con el botón derecho y elija <guilabel>Editar</guilabel>."
 
-#: C/empathy.xml:1346(para)
+#: C/empathy.xml:1345(para)
 msgid ""
 "In the <guilabel>Groups</guilabel> section, write the name of the group you "
 "want to add and then click on <guibutton>Add Group</guibutton>."
index 6f3b99ba6e98282345e3ee69e858bbe9bb5c51e7..2065589e3594b19d11419d9f2318e1bcfcb7fbe9 100644 (file)
@@ -49,7 +49,7 @@ libempathy_gtk_la_SOURCES =                   \
        empathy-profile-chooser.c               \
        empathy-smiley-manager.c                \
        empathy-spell.c                         \
-       empathy-spell-dialog.c                  \
+       empathy-status-preset-dialog.c          \
        empathy-theme-boxes.c                   \
        empathy-theme-irc.c                     \
        empathy-theme-manager.c                 \
@@ -102,7 +102,7 @@ libempathy_gtk_headers =                    \
        empathy-profile-chooser.h               \
        empathy-smiley-manager.h                \
        empathy-spell.h                         \
-       empathy-spell-dialog.h                  \
+       empathy-status-preset-dialog.h          \
        empathy-theme-boxes.h                   \
        empathy-theme-irc.h                     \
        empathy-theme-manager.h                 \
@@ -117,7 +117,6 @@ uidir = $(datadir)/empathy
 ui_DATA =                                      \
        empathy-contact-widget.ui               \
        empathy-contact-dialogs.ui              \
-       empathy-presence-chooser.ui             \
        empathy-account-widget-generic.ui       \
        empathy-account-widget-jabber.ui        \
        empathy-account-widget-msn.ui           \
@@ -128,7 +127,7 @@ ui_DATA =                                   \
        empathy-account-widget-yahoo.ui         \
        empathy-account-widget-groupwise.ui     \
        empathy-account-widget-aim.ui           \
-       empathy-spell-dialog.ui                 \
+       empathy-status-preset-dialog.ui         \
        empathy-log-window.ui                   \
        empathy-chat.ui                         \
        empathy-new-message-dialog.ui
index 8c402c07a0c1e672b188e20a437141d23f675867..5d11e8e1e288d823fe2a30bcb9b4104996f8211c 100644 (file)
 #include "empathy-ui-utils.h"
 #include "empathy-account-chooser.h"
 
+/**
+ * SECTION:empathy-account-chooser
+ * @title:EmpathyAccountChooser
+ * @short_description: A widget used to choose from a list of accounts
+ * @include: libempathy-gtk/empathy-account-chooser.h
+ *
+ * #EmpathyAccountChooser is a widget which extends #GtkComboBox to provide
+ * a chooser of available accounts.
+ */
+
+/**
+ * EmpathyAccountChooser:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkComboBox to provide a chooser of available accounts.
+ */
+
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountChooser)
 typedef struct {
        EmpathyAccountManager          *manager;
@@ -112,6 +129,11 @@ empathy_account_chooser_class_init (EmpathyAccountChooserClass *klass)
        object_class->get_property = account_chooser_get_property;
        object_class->set_property = account_chooser_set_property;
 
+       /**
+        * EmpathyAccountChooser:has-all-option:
+        *
+        * Have an additional option in the list to mean all accounts.
+        */
        g_object_class_install_property (object_class,
                                         PROP_HAS_ALL_OPTION,
                                         g_param_spec_boolean ("has-all-option",
@@ -209,6 +231,13 @@ account_chooser_set_property (GObject      *object,
        };
 }
 
+/**
+ * empathy_account_chooser_new:
+ *
+ * Creates a new #EmpathyAccountChooser.
+ *
+ * Return value: A new #EmpathyAccountChooser
+ */
 GtkWidget *
 empathy_account_chooser_new (void)
 {
@@ -219,8 +248,18 @@ empathy_account_chooser_new (void)
        return chooser;
 }
 
+/**
+ * empathy_account_chooser_dup_account:
+ * @chooser: an #EmpathyAccountChooser
+ *
+ * Returns the account which is currently selected in the chooser or %NULL
+ * if there is no account selected. The #McAccount returned should be
+ * unrefed with g_object_unref() when finished with.
+ *
+ * Return value: a new ref to the #McAccount currently selected, or %NULL.
+ */
 McAccount *
-empathy_account_chooser_get_account (EmpathyAccountChooser *chooser)
+empathy_account_chooser_dup_account (EmpathyAccountChooser *chooser)
 {
        EmpathyAccountChooserPriv *priv;
        McAccount                *account;
@@ -241,6 +280,44 @@ empathy_account_chooser_get_account (EmpathyAccountChooser *chooser)
        return account;
 }
 
+/**
+ * empathy_account_chooser_get_connection:
+ * @chooser: an #EmpathyAccountChooser
+ *
+ * Returns a borrowed reference to the #TpConnection associated with the
+ * account currently selected. The caller must reference the returned object with
+ * g_object_ref() if it will be kept
+ *
+ * Return value: a borrowed reference to the #TpConnection associated with the
+ * account curently selected.
+ */
+TpConnection *
+empathy_account_chooser_get_connection (EmpathyAccountChooser *chooser)
+{
+       EmpathyAccountChooserPriv *priv;
+       McAccount                 *account;
+       TpConnection              *connection;
+
+       g_return_val_if_fail (EMPATHY_IS_ACCOUNT_CHOOSER (chooser), NULL);
+
+       priv = GET_PRIV (chooser);
+
+       account = empathy_account_chooser_dup_account (chooser);
+       connection = empathy_account_manager_get_connection (priv->manager, account);
+       g_object_unref (account);
+
+       return connection;
+}
+
+/**
+ * empathy_account_chooser_set_account:
+ * @chooser: an #EmpathyAccountChooser
+ * @account: an #McAccount
+ *
+ * Sets the currently selected account to @account, if it exists in the list.
+ *
+ * Return value: whether the chooser was set to @account.
+ */
 gboolean
 empathy_account_chooser_set_account (EmpathyAccountChooser *chooser,
                                     McAccount             *account)
@@ -266,6 +343,16 @@ empathy_account_chooser_set_account (EmpathyAccountChooser *chooser,
        return data.set;
 }
 
+/**
+ * empathy_account_chooser_get_has_all_option:
+ * @chooser: an #EmpathyAccountChooser
+ *
+ * Returns whether @chooser has the #EmpathyAccountChooser:has-all-option property
+ * set to true.
+ *
+ * Return value: whether @chooser has the #EmpathyAccountChooser:has-all-option property
+ * enabled.
+ */
 gboolean
 empathy_account_chooser_get_has_all_option (EmpathyAccountChooser *chooser)
 {
@@ -278,6 +365,13 @@ empathy_account_chooser_get_has_all_option (EmpathyAccountChooser *chooser)
        return priv->has_all_option;
 }
 
+/**
+ * empathy_account_chooser_set_has_all_option:
+ * @chooser: an #EmpathyAccountChooser
+ * @has_all_option: a new value for the #EmpathyAccountChooser:has-all-option property
+ *
+ * Sets the #EmpathyAccountChooser:has-all-option property.
+ */
 void
 empathy_account_chooser_set_has_all_option (EmpathyAccountChooser *chooser,
                                           gboolean              has_all_option)
@@ -618,6 +712,15 @@ account_chooser_filter_foreach (GtkTreeModel *model,
        return FALSE;
 }
 
+/**
+ * empathy_account_chooser_set_filter:
+ * @chooser: an #EmpathyAccountChooser
+ * @filter: a filter
+ * @user_data: data to pass to @filter, or %NULL
+ *
+ * Sets a filter on the @chooser so only accounts that are %TRUE in the eyes
+ * of the filter are visible in the @chooser.
+ */
 void
 empathy_account_chooser_set_filter (EmpathyAccountChooser           *chooser,
                                     EmpathyAccountChooserFilterFunc  filter,
@@ -639,6 +742,27 @@ empathy_account_chooser_set_filter (EmpathyAccountChooser           *chooser,
        gtk_tree_model_foreach (model, account_chooser_filter_foreach, chooser);
 }
 
+/**
+ * EmpathyAccountChooserFilterFunc:
+ * @account: an #McAccount
+ * @user_data: user data, or %NULL
+ *
+ * A function which decides whether the account indicated by @account
+ * is visible.
+ *
+ * Return value: whether the account indicated by @account is visible.
+ */
+
+/**
+ * empathy_account_chooser_filter_is_connected:
+ * @account: an #McAccount
+ * @user_data: user data or %NULL
+ *
+ * A useful #EmpathyAccountChooserFilterFunc that one could pass into
+ * empathy_account_chooser_set_filter() and only show connected accounts.
+ *
+ * Return value: Whether @account is connected
+ */
 gboolean
 empathy_account_chooser_filter_is_connected (McAccount *account,
                                             gpointer   user_data)
index c15923bc3ac76a04fe9bf34b0b214007ed3c3403..98d568bccab62ba7d357862502972adc12ec08a5 100644 (file)
@@ -47,6 +47,8 @@ typedef struct _EmpathyAccountChooserClass EmpathyAccountChooserClass;
 
 struct _EmpathyAccountChooser {
        GtkComboBox parent;
+
+       /*<private>*/
        gpointer priv;
 };
 
@@ -56,7 +58,8 @@ struct _EmpathyAccountChooserClass {
 
 GType          empathy_account_chooser_get_type           (void) G_GNUC_CONST;
 GtkWidget *    empathy_account_chooser_new                (void);
-McAccount *    empathy_account_chooser_get_account        (EmpathyAccountChooser *chooser);
+McAccount *    empathy_account_chooser_dup_account        (EmpathyAccountChooser *chooser);
+TpConnection * empathy_account_chooser_get_connection     (EmpathyAccountChooser *chooser);
 gboolean       empathy_account_chooser_set_account        (EmpathyAccountChooser *chooser,
                                                           McAccount            *account);
 gboolean       empathy_account_chooser_get_has_all_option (EmpathyAccountChooser *chooser);
index 3af842415ec219a1e41b4298d86cb05f47408f0b..cc86a5aaa44d539c6c270d7c5632afc574d0b0d3 100644 (file)
@@ -50,9 +50,6 @@ typedef struct {
   GtkWidget *vbox_settings;
 
   GtkWidget *combobox_network;
-  GtkWidget *button_add_network;
-  GtkWidget *button_network;
-  GtkWidget *button_remove;
 } EmpathyAccountWidgetIrc;
 
 enum {
@@ -462,9 +459,6 @@ empathy_account_widget_irc_new (McAccount *account)
   gui = empathy_builder_get_file (filename,
       "vbox_irc_settings", &settings->vbox_settings,
       "combobox_network", &settings->combobox_network,
-      "button_network", &settings->button_network,
-      "button_add_network", &settings->button_add_network,
-      "button_remove", &settings->button_remove,
       NULL);
   g_free (filename);
 
@@ -501,7 +495,7 @@ empathy_account_widget_irc_new (McAccount *account)
       "vbox_irc_settings", "destroy", account_widget_irc_destroy_cb,
       "button_network", "clicked", account_widget_irc_button_edit_network_clicked_cb,
       "button_add_network", "clicked", account_widget_irc_button_add_network_clicked_cb,
-      "button_remove", "clicked", account_widget_irc_button_remove_clicked_cb,
+      "button_remove_network", "clicked", account_widget_irc_button_remove_clicked_cb,
       "combobox_network", "changed", account_widget_irc_combobox_network_changed_cb,
       NULL);
 
index f499866ebe3c9aec740e5ce50e25824977a1b708..76c67f711719697245643c28da0a7e3e8a44a170 100644 (file)
@@ -3,7 +3,6 @@
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkDialog" id="irc_network_dialog">
-    <property name="visible">True</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Network</property>
     <property name="window_position">center-on-parent</property>
           </packing>
         </child>
         <child>
-          <object class="GtkButton" id="button_remove">
+          <object class="GtkButton" id="button_remove_network">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="label_network">
+      <object class="GtkLabel" id="label_network2">
         <property name="visible">True</property>
         <property name="xalign">0</property>
         <property name="label" translatable="yes">Network:</property>
index 02aa689eb28aa48c3db98cf58ad4d54485db5173..c86b85d259a27d4fa31c66c58970f95c057f360f 100644 (file)
@@ -30,7 +30,7 @@
 #include <gio/gio.h>
 
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-contact-factory.h>
+#include <libempathy/empathy-tp-contact-factory.h>
 
 #include "empathy-avatar-chooser.h"
 #include "empathy-conf.h"
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
 
+/**
+ * SECTION:empathy-avatar-chooser
+ * @title: EmpathyAvatarChooser
+ * @short_description: A widget used to change avatar
+ * @include: libempathy-gtk/empathy-avatar-chooser.h
+ *
+ * #EmpathyAvatarChooser is a widget which extends #GtkButton to
+ * provide a way of changing avatar.
+ */
+
+/**
+ * EmpathyAvatarChooser:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkButton to provide a way of changing avatar.
+ */
+
 #define AVATAR_SIZE_SAVE 96
 #define AVATAR_SIZE_VIEW 64
 #define DEFAULT_DIR DATADIR"/pixmaps/faces"
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAvatarChooser)
 typedef struct {
-       EmpathyContactFactory   *contact_factory;
-       McAccount               *account;
-       EmpathyTpContactFactory *tp_contact_factory;
+       EmpathyTpContactFactory *factory;
+       TpConnection            *connection;
        GtkFileChooser          *chooser_dialog;
 
        gulong ready_handler_id;
@@ -56,8 +72,8 @@ typedef struct {
 } EmpathyAvatarChooserPriv;
 
 static void       avatar_chooser_finalize              (GObject              *object);
-static void       avatar_chooser_set_account           (EmpathyAvatarChooser *self,
-                                                       McAccount            *account);
+static void       avatar_chooser_set_connection        (EmpathyAvatarChooser *self,
+                                                       TpConnection         *connection);
 static void       avatar_chooser_set_image             (EmpathyAvatarChooser *chooser,
                                                        EmpathyAvatar        *avatar,
                                                        GdkPixbuf            *pixbuf,
@@ -96,7 +112,7 @@ enum {
 
 enum {
        PROP_0,
-       PROP_ACCOUNT
+       PROP_CONNECTION
 };
 
 static guint signals [LAST_SIGNAL];
@@ -125,8 +141,8 @@ avatar_chooser_get_property (GObject    *object,
        EmpathyAvatarChooserPriv *priv = GET_PRIV (object);
 
        switch (param_id) {
-       case PROP_ACCOUNT:
-               g_value_set_object (value, priv->account);
+       case PROP_CONNECTION:
+               g_value_set_object (value, priv->connection);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -143,8 +159,8 @@ avatar_chooser_set_property (GObject      *object,
        EmpathyAvatarChooser *self = EMPATHY_AVATAR_CHOOSER (object);
 
        switch (param_id) {
-       case PROP_ACCOUNT:
-               avatar_chooser_set_account (self, g_value_get_object (value));
+       case PROP_CONNECTION:
+               avatar_chooser_set_connection (self, g_value_get_object (value));
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -162,6 +178,13 @@ empathy_avatar_chooser_class_init (EmpathyAvatarChooserClass *klass)
        object_class->get_property = avatar_chooser_get_property;
        object_class->set_property = avatar_chooser_set_property;
 
+       /**
+        * EmpathyAvatarChooser::changed:
+        * @chooser: an #EmpathyAvatarChooser
+        *
+        * Emitted when the chosen avatar has changed.
+        *
+        */
        signals[CHANGED] =
                g_signal_new ("changed",
                              G_TYPE_FROM_CLASS (klass),
@@ -171,15 +194,21 @@ empathy_avatar_chooser_class_init (EmpathyAvatarChooserClass *klass)
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE, 0);
 
-       param_spec = g_param_spec_object ("account",
-                                         "McAccount",
-                                         "McAccount whose avatar should be "
+       /**
+        * EmpathyAvatarChooser:connection:
+        *
+        * The #TpConnection whose avatar should be shown and modified by
+        * the #EmpathyAvatarChooser instance.
+        */
+       param_spec = g_param_spec_object ("connection",
+                                         "TpConnection",
+                                         "TpConnection whose avatar should be "
                                          "shown and modified by this widget",
-                                         MC_TYPE_ACCOUNT,
+                                         TP_TYPE_CONNECTION,
                                          G_PARAM_READWRITE |
                                          G_PARAM_STATIC_STRINGS);
        g_object_class_install_property (object_class,
-                                        PROP_ACCOUNT,
+                                        PROP_CONNECTION,
                                         param_spec);
 
        g_type_class_add_private (object_class, sizeof (EmpathyAvatarChooserPriv));
@@ -214,8 +243,6 @@ empathy_avatar_chooser_init (EmpathyAvatarChooser *chooser)
                          G_CALLBACK (avatar_chooser_clicked_cb),
                          chooser);
 
-       priv->contact_factory = empathy_contact_factory_dup_singleton ();
-
        empathy_avatar_chooser_set (chooser, NULL);
 }
 
@@ -226,11 +253,9 @@ avatar_chooser_finalize (GObject *object)
 
        priv = GET_PRIV (object);
 
-       avatar_chooser_set_account (EMPATHY_AVATAR_CHOOSER (object), NULL);
-       g_assert (priv->account == NULL);
-       g_assert (priv->tp_contact_factory == NULL);
-
-       g_object_unref (priv->contact_factory);
+       avatar_chooser_set_connection (EMPATHY_AVATAR_CHOOSER (object), NULL);
+       g_assert (priv->connection == NULL);
+       g_assert (priv->factory == NULL);
 
        if (priv->avatar != NULL) {
                empathy_avatar_unref (priv->avatar);
@@ -240,51 +265,22 @@ avatar_chooser_finalize (GObject *object)
 }
 
 static void
-avatar_chooser_tp_cf_ready_cb (EmpathyTpContactFactory *tp_cf,
-                              GParamSpec              *unused,
-                              EmpathyAvatarChooser    *self)
-{
-       EmpathyAvatarChooserPriv *priv = GET_PRIV (self);
-       gboolean ready;
-
-       /* sanity check that we're listening on the right ETpCF */
-       g_assert (priv->tp_contact_factory == tp_cf);
-
-       ready = empathy_tp_contact_factory_is_ready (tp_cf);
-       gtk_widget_set_sensitive (GTK_WIDGET (self), ready);
-}
-
-static void
-avatar_chooser_set_account (EmpathyAvatarChooser *self,
-                           McAccount            *account)
+avatar_chooser_set_connection (EmpathyAvatarChooser *self,
+                              TpConnection         *connection)
 {
        EmpathyAvatarChooserPriv *priv = GET_PRIV (self);
 
-       if (priv->account != NULL) {
-               g_object_unref (priv->account);
-               priv->account = NULL;
+       if (priv->connection != NULL) {
+               g_object_unref (priv->connection);
+               priv->connection = NULL;
 
-               g_assert (priv->tp_contact_factory != NULL);
-
-               g_signal_handler_disconnect (priv->tp_contact_factory,
-                       priv->ready_handler_id);
-               priv->ready_handler_id = 0;
-
-               g_object_unref (priv->tp_contact_factory);
-               priv->tp_contact_factory = NULL;
+               g_object_unref (priv->factory);
+               priv->factory = NULL;
        }
 
-       if (account != NULL) {
-               priv->account = g_object_ref (account);
-               priv->tp_contact_factory = g_object_ref (
-                       empathy_contact_factory_get_tp_factory (
-                               priv->contact_factory, priv->account));
-
-               priv->ready_handler_id = g_signal_connect (
-                       priv->tp_contact_factory, "notify::ready",
-                       G_CALLBACK (avatar_chooser_tp_cf_ready_cb), self);
-               avatar_chooser_tp_cf_ready_cb (priv->tp_contact_factory, NULL,
-                       self);
+       if (connection != NULL) {
+               priv->connection = g_object_ref (connection);
+               priv->factory = empathy_tp_contact_factory_dup_singleton (connection);
        }
 }
 
@@ -412,7 +408,6 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
                                        EmpathyAvatar        *avatar)
 {
        EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
-       EmpathyTpContactFactory  *tp_cf = priv->tp_contact_factory;
        guint                     max_width = 0, max_height = 0, max_size = 0;
        gchar                   **mime_types = NULL;
        gboolean                  needs_conversion = FALSE;
@@ -424,15 +419,7 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
        gchar                    *converted_image_data = NULL;
        gsize                     converted_image_size = 0;
 
-       /* This should only be called if the user is setting a new avatar,
-        * which should only be allowed once the avatar requirements have been
-        * discovered.
-        */
-       g_return_val_if_fail (tp_cf != NULL, NULL);
-       g_return_val_if_fail (empathy_tp_contact_factory_is_ready (tp_cf),
-               NULL);
-
-       g_object_get (tp_cf,
+       g_object_get (priv->factory,
                "avatar-mime-types", &mime_types, /* Needs g_strfreev-ing */
                "avatar-max-width", &max_width,
                "avatar-max-height", &max_height,
@@ -901,16 +888,6 @@ avatar_chooser_response_cb (GtkWidget            *widget,
 
        priv->chooser_dialog = NULL;
 
-       if (response == GTK_RESPONSE_CANCEL) {
-               goto out;
-       }
-
-       /* Check if we went non-ready since displaying the dialog. */
-       if (!empathy_tp_contact_factory_is_ready (priv->tp_contact_factory)) {
-               DEBUG ("Can't set avatar when contact factory isn't ready.");
-               goto out;
-       }
-
        if (response == GTK_RESPONSE_OK) {
                gchar *filename;
                gchar *path;
@@ -932,7 +909,6 @@ avatar_chooser_response_cb (GtkWidget            *widget,
                avatar_chooser_clear_image (chooser);
        }
 
-out:
        gtk_widget_destroy (widget);
 }
 
@@ -1037,12 +1013,26 @@ avatar_chooser_clicked_cb (GtkWidget            *button,
        g_free (saved_dir);
 }
 
+/**
+ * empathy_avatar_chooser_new:
+ *
+ * Creates a new #EmpathyAvatarChooser.
+ *
+ * Return value: a new #EmpathyAvatarChooser
+ */
 GtkWidget *
 empathy_avatar_chooser_new ()
 {
        return g_object_new (EMPATHY_TYPE_AVATAR_CHOOSER, NULL);
 }
 
+/**
+ * empathy_avatar_chooser_set:
+ * @chooser: an #EmpathyAvatarChooser
+ * @avatar: a new #EmpathyAvatar
+ *
+ * Sets the @chooser to display the avatar indicated by @avatar.
+ */
 void
 empathy_avatar_chooser_set (EmpathyAvatarChooser *chooser,
                            EmpathyAvatar        *avatar)
@@ -1056,6 +1046,15 @@ empathy_avatar_chooser_set (EmpathyAvatarChooser *chooser,
        }
 }
 
+/**
+ * empathy_avatar_chooser_get_image_data:
+ * @chooser: an #EmpathyAvatarChooser
+ * @data: avatar bytes
+ * @data_size: size of @data
+ * @mime_type: avatar mime-type
+ *
+ * Gets image data about the currently selected avatar.
+ */
 void
 empathy_avatar_chooser_get_image_data (EmpathyAvatarChooser  *chooser,
                                       const gchar          **data,
index bdc5b40ae1a159905dfd9a8c7f3c1092f6c67f88..564c1f37d3d81e73304ca5cfd680cdcff176d2f1 100644 (file)
@@ -41,6 +41,8 @@ typedef struct _EmpathyAvatarChooserClass   EmpathyAvatarChooserClass;
 
 struct _EmpathyAvatarChooser {
        GtkButton parent;
+
+       /*<private>*/
        gpointer priv;
 };
 
index 51f30bdd501fe07b502d3932f60316066d480bae..e5513231bf82c83cc97b29717d7f344812ab349d 100644 (file)
 #include "empathy-avatar-image.h"
 #include "empathy-ui-utils.h"
 
+/**
+ * SECTION:empathy-avatar-image
+ * @title: EmpathyAvatarImage
+ * @short_description: A widget to display an avatar
+ * @include: libempathy-gtk/empathy-avatar-image.h
+ *
+ * #EmpathyAvatarImage is a widget which displays an avatar.
+ */
+
+/**
+ * EmpathyAvatarImage:
+ * @parent: parent object
+ *
+ * Widget which displays an avatar.
+ */
+
 #define MAX_SMALL 64
 #define MAX_LARGE 400
 
@@ -251,6 +267,13 @@ avatar_image_button_release_event (GtkWidget *widget, GdkEventButton *event)
        return TRUE;
 }
 
+/**
+ * empathy_avatar_image_new:
+ *
+ * Creates a new #EmpathyAvatarImage.
+ *
+ * Return value: a new #EmpathyAvatarImage
+ */
 GtkWidget *
 empathy_avatar_image_new (void)
 {
@@ -261,6 +284,13 @@ empathy_avatar_image_new (void)
        return GTK_WIDGET (avatar_image);
 }
 
+/**
+ * empathy_avatar_image_set:
+ * @avatar_image: an #EmpathyAvatarImage
+ * @avatar: the #EmpathyAvatar to set @avatar_image to
+ *
+ * Sets @avatar_image to display the avatar indicated by @avatar.
+ */
 void
 empathy_avatar_image_set (EmpathyAvatarImage *avatar_image,
                          EmpathyAvatar      *avatar)
index d6a6cd0b08ccfd1a223ccca42bf61e02f9ea4b02..8969c1227541f5a01102061348ee2221e20a71b2 100644 (file)
@@ -42,6 +42,8 @@ typedef struct _EmpathyAvatarImageClass EmpathyAvatarImageClass;
 
 struct _EmpathyAvatarImage {
        GtkEventBox parent;
+
+       /*<private>*/
        gpointer priv;
 };
 
index 7d939027470ce7c18e58751f462424327ade880f..425a1c555a4c41036c6bc40726e849e5886faff9 100644 (file)
@@ -45,7 +45,6 @@
 #include "empathy-chat.h"
 #include "empathy-conf.h"
 #include "empathy-spell.h"
-#include "empathy-spell-dialog.h"
 #include "empathy-contact-list-store.h"
 #include "empathy-contact-list-view.h"
 #include "empathy-contact-menu.h"
@@ -65,7 +64,6 @@
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChat)
 typedef struct {
        EmpathyTpChat     *tp_chat;
-       gulong            tp_chat_destroy_handler;
        McAccount         *account;
        gchar             *id;
        gchar             *name;
@@ -190,17 +188,15 @@ chat_connect_channel_reconnected (EmpathyDispatchOperation *dispatch,
 }
 
 static void
-chat_connection_changed_cb (EmpathyAccountManager *manager,
-                           McAccount *account,
-                           TpConnectionStatusReason reason,
-                           TpConnectionStatus current,
-                           TpConnectionStatus previous,
-                           EmpathyChat *chat)
+chat_new_connection_cb (EmpathyAccountManager *manager,
+                       TpConnection *connection,
+                       EmpathyChat *chat)
 {
        EmpathyChatPriv *priv = GET_PRIV (chat);
+       McAccount *account;
 
-       if (current == TP_CONNECTION_STATUS_CONNECTED && !priv->tp_chat &&
-           empathy_account_equal (account, priv->account) &&
+       account = empathy_account_manager_get_account (manager, connection);
+       if (!priv->tp_chat && empathy_account_equal (account, priv->account) &&
            priv->handle_type != TP_HANDLE_TYPE_NONE &&
            !EMP_STR_EMPTY (priv->id)) {
                
@@ -208,12 +204,14 @@ chat_connection_changed_cb (EmpathyAccountManager *manager,
 
                switch (priv->handle_type) {
                        case TP_HANDLE_TYPE_CONTACT:
-                               empathy_dispatcher_chat_with_contact_id (account, priv->id,
+                               empathy_dispatcher_chat_with_contact_id (
+                                       connection, priv->id,
                                        chat_connect_channel_reconnected,
                                        chat);
                                break;
                        case TP_HANDLE_TYPE_ROOM:
-                               empathy_dispatcher_join_muc (account, priv->id,
+                               empathy_dispatcher_join_muc (connection,
+                                       priv->id,
                                        chat_connect_channel_reconnected,
                                        chat);
                                break;
@@ -596,7 +594,7 @@ chat_property_changed_cb (EmpathyTpChat *tp_chat,
 
 static void
 chat_input_text_buffer_changed_cb (GtkTextBuffer *buffer,
-                                  EmpathyChat    *chat)
+                                   EmpathyChat    *chat)
 {
        EmpathyChatPriv *priv;
        GtkTextIter     start, end;
@@ -612,8 +610,8 @@ chat_input_text_buffer_changed_cb (GtkTextBuffer *buffer,
        }
 
        empathy_conf_get_bool (empathy_conf_get (),
-                             EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
-                             &spell_checker);
+                           EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
+                           &spell_checker);
 
        gtk_text_buffer_get_start_iter (buffer, &start);
 
@@ -932,13 +930,42 @@ chat_spell_free (EmpathyChatSpell *chat_spell)
 }
 
 static void
-chat_text_check_word_spelling_cb (GtkMenuItem     *menuitem,
-                                 EmpathyChatSpell *chat_spell)
+chat_spelling_menu_activate_cb (GtkMenuItem     *menu_item,
+                                               EmpathyChatSpell *chat_spell)
 {
-       empathy_spell_dialog_show (chat_spell->chat,
-                                 &chat_spell->start,
-                                 &chat_spell->end,
-                                 chat_spell->word);
+    empathy_chat_correct_word (chat_spell->chat,
+                               &(chat_spell->start),
+                               &(chat_spell->end),
+                               gtk_menu_item_get_label (menu_item));
+}
+
+static GtkWidget*
+chat_spelling_build_menu (EmpathyChatSpell *chat_spell)
+{
+    GtkWidget *menu, *menu_item;
+    GList     *suggestions, *l;
+
+    menu = gtk_menu_new ();
+    suggestions = empathy_spell_get_suggestions (chat_spell->word);
+    if (suggestions == NULL) {
+        menu_item = gtk_menu_item_new_with_label (_("(No Suggestions)"));
+       gtk_widget_set_sensitive (menu_item, FALSE);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+    } else {
+        for (l = suggestions; l; l = l->next) {
+            menu_item = gtk_menu_item_new_with_label (l->data);
+            g_signal_connect (G_OBJECT (menu_item),
+                          "activate",
+                          G_CALLBACK (chat_spelling_menu_activate_cb),
+                          chat_spell);
+            gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+        }
+    }
+    empathy_spell_free_suggestions (suggestions);
+
+    gtk_widget_show_all (menu);
+
+    return menu;
 }
 
 static void
@@ -961,7 +988,8 @@ chat_input_populate_popup_cb (GtkTextView *view,
        GtkTextIter           iter, start, end;
        GtkWidget            *item;
        gchar                *str = NULL;
-       EmpathyChatSpell      *chat_spell;
+       EmpathyChatSpell     *chat_spell;
+       GtkWidget            *spell_menu;
        EmpathySmileyManager *smiley_manager;
        GtkWidget            *smiley_menu;
        GtkWidget            *image;
@@ -1026,14 +1054,14 @@ chat_input_populate_popup_cb (GtkTextView *view,
                gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
                gtk_widget_show (item);
 
-               item = gtk_image_menu_item_new_with_mnemonic (_("_Check Word Spelling..."));
+               item = gtk_image_menu_item_new_with_mnemonic (_("_Spelling Suggestions"));
                image = gtk_image_new_from_icon_name (GTK_STOCK_SPELL_CHECK,
                                                      GTK_ICON_SIZE_MENU);
                gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-               g_signal_connect (item,
-                                 "activate",
-                                 G_CALLBACK (chat_text_check_word_spelling_cb),
-                                 chat_spell);
+
+               spell_menu = chat_spelling_build_menu (chat_spell);
+               gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), spell_menu);
+
                gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
                gtk_widget_show (item);
        }
@@ -1139,10 +1167,6 @@ chat_members_changed_cb (EmpathyTpChat  *tp_chat,
        if (priv->block_events_timeout_id == 0) {
                gchar *str;
 
-               empathy_contact_run_until_ready (contact,
-                                                EMPATHY_CONTACT_READY_NAME,
-                                                NULL);
-
                if (is_member) {
                        str = g_strdup_printf (_("%s has joined the room"),
                                               empathy_contact_get_name (contact));
@@ -1434,13 +1458,26 @@ chat_finalize (GObject *object)
        chat_composing_remove_timeout (chat);
 
        g_signal_handlers_disconnect_by_func (priv->account_manager,
-                                             chat_connection_changed_cb, object);
+                                             chat_new_connection_cb, object);
 
        g_object_unref (priv->account_manager);
        g_object_unref (priv->log_manager);
 
        if (priv->tp_chat) {
-               g_signal_handler_disconnect (priv->tp_chat, priv->tp_chat_destroy_handler);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_destroy_cb, chat);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_message_received_cb, chat);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_send_error_cb, chat);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_state_changed_cb, chat);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_property_changed_cb, chat);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_members_changed_cb, chat);
+               g_signal_handlers_disconnect_by_func (priv->tp_chat,
+                       chat_remote_contact_changed_cb, chat);
                empathy_tp_chat_close (priv->tp_chat);
                g_object_unref (priv->tp_chat);
        }
@@ -1578,8 +1615,8 @@ empathy_chat_init (EmpathyChat *chat)
        priv->account_manager = empathy_account_manager_dup_singleton ();
 
        g_signal_connect (priv->account_manager,
-                         "account-connection-changed",
-                         G_CALLBACK (chat_connection_changed_cb),
+                         "new-connection",
+                         G_CALLBACK (chat_new_connection_cb),
                          chat);
 
        /* Block events for some time to avoid having "has come online" or
@@ -1613,6 +1650,7 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
                          EmpathyTpChat *tp_chat)
 {
        EmpathyChatPriv *priv = GET_PRIV (chat);
+       TpConnection    *connection;
 
        g_return_if_fail (EMPATHY_IS_CHAT (chat));
        g_return_if_fail (EMPATHY_IS_TP_CHAT (tp_chat));
@@ -1627,8 +1665,14 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
        }
 
        priv->tp_chat = g_object_ref (tp_chat);
-       priv->account = g_object_ref (empathy_tp_chat_get_account (tp_chat));
+       connection = empathy_tp_chat_get_connection (priv->tp_chat);
+       priv->account = empathy_account_manager_get_account (priv->account_manager,
+                                                            connection);
+       g_object_ref (priv->account);
 
+       g_signal_connect (tp_chat, "destroy",
+                         G_CALLBACK (chat_destroy_cb),
+                         chat);
        g_signal_connect (tp_chat, "message-received",
                          G_CALLBACK (chat_message_received_cb),
                          chat);
@@ -1647,10 +1691,6 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
        g_signal_connect_swapped (tp_chat, "notify::remote-contact",
                                  G_CALLBACK (chat_remote_contact_changed_cb),
                                  chat);
-       priv->tp_chat_destroy_handler =
-               g_signal_connect (tp_chat, "destroy",
-                         G_CALLBACK (chat_destroy_cb),
-                         chat);
 
        chat_remote_contact_changed_cb (chat);
 
@@ -1730,20 +1770,6 @@ empathy_chat_get_remote_contact (EmpathyChat *chat)
        return priv->remote_contact;
 }
 
-guint
-empathy_chat_get_members_count (EmpathyChat *chat)
-{
-       EmpathyChatPriv *priv = GET_PRIV (chat);
-
-       g_return_val_if_fail (EMPATHY_IS_CHAT (chat), 0);
-
-       if (priv->tp_chat) {
-               return empathy_tp_chat_get_members_count (priv->tp_chat);
-       }
-
-       return 0;
-}
-
 GtkWidget *
 empathy_chat_get_contact_menu (EmpathyChat *chat)
 {
index 6b7fcf26e1d0a13a80a0e6a2900e1d0267121a8b..f61ce415415d7ba9700059280c2aef897c87b8b7 100644 (file)
@@ -71,7 +71,6 @@ const gchar *      empathy_chat_get_id               (EmpathyChat   *chat);
 const gchar *      empathy_chat_get_name             (EmpathyChat   *chat);
 const gchar *      empathy_chat_get_subject          (EmpathyChat   *chat);
 EmpathyContact *   empathy_chat_get_remote_contact   (EmpathyChat   *chat);
-guint              empathy_chat_get_members_count    (EmpathyChat   *chat);
 GtkWidget *        empathy_chat_get_contact_menu     (EmpathyChat   *chat);
 void               empathy_chat_clear                (EmpathyChat   *chat);
 void               empathy_chat_scroll_down          (EmpathyChat   *chat);
index 72b5b28b38be9eb4d4611d0e582c7504e8d12031..056ec2d856093b768a80ed0473e18b235a64f503 100644 (file)
@@ -30,6 +30,7 @@
 #include <libmissioncontrol/mission-control.h>
 
 #include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-account-manager.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-utils.h>
 
 
 static GList *subscription_dialogs = NULL;
 static GList *information_dialogs = NULL;
+static GList *edit_dialogs = NULL;
+static GtkWidget *personal_dialog = NULL;
 static GtkWidget *new_contact_dialog = NULL;
 
-
 static gint
 contact_dialogs_find (GtkDialog      *dialog,
                      EmpathyContact *contact)
@@ -114,6 +116,7 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
        g_free (filename);
        g_object_unref (gui);
 
+       /* Contact info widget */
        contact_widget = empathy_contact_widget_new (contact,
                                                     EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
                                                     EMPATHY_CONTACT_WIDGET_EDIT_GROUPS);
@@ -123,7 +126,6 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
                          0);
        gtk_widget_show (contact_widget);
 
-
        g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
        subscription_dialogs = g_list_prepend (subscription_dialogs, dialog);
 
@@ -143,25 +145,22 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
  */
 
 static void
-contact_information_response_cb (GtkDialog *dialog,
-                                gint       response,
-                                GtkWidget *contact_widget)
+contact_dialogs_response_cb (GtkDialog *dialog,
+                            gint       response,
+                            GList    **dialogs)
 {
-       information_dialogs = g_list_remove (information_dialogs, dialog);
+       *dialogs = g_list_remove (*dialogs, dialog);
        gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
 void
 empathy_contact_information_dialog_show (EmpathyContact *contact,
-                                        GtkWindow      *parent,
-                                        gboolean        edit,
-                                        gboolean        is_user)
+                                        GtkWindow      *parent)
 {
-       GtkWidget                *dialog;
-       GtkWidget                *button;
-       GtkWidget                *contact_widget;
-       GList                    *l;
-       EmpathyContactWidgetFlags flags = 0;
+       GtkWidget *dialog;
+       GtkWidget *button;
+       GtkWidget *contact_widget;
+       GList     *l;
 
        g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
@@ -177,15 +176,7 @@ empathy_contact_information_dialog_show (EmpathyContact *contact,
        dialog = gtk_dialog_new ();
        gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-       if (is_user) {
-               gtk_window_set_title (GTK_WINDOW (dialog), _("Personal Information"));
-       }
-       else if (edit) {
-               gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Contact Information"));
-       }
-       else {
-               gtk_window_set_title (GTK_WINDOW (dialog), _("Contact Information"));
-       }
+       gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Contact Information"));
 
        /* Close button */
        button = gtk_button_new_with_label (GTK_STOCK_CLOSE);
@@ -198,34 +189,79 @@ empathy_contact_information_dialog_show (EmpathyContact *contact,
        gtk_widget_show (button);
 
        /* Contact info widget */
-       if (edit) {
-               flags |= EMPATHY_CONTACT_WIDGET_EDIT_ALIAS;
-       }
-       if (is_user) {
-               flags |= EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT;
-               flags |= EMPATHY_CONTACT_WIDGET_EDIT_AVATAR;
+       contact_widget = empathy_contact_widget_new (contact,
+               EMPATHY_CONTACT_WIDGET_EDIT_NONE);
+       gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8);
+       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+                           contact_widget,
+                           TRUE, TRUE, 0);
+       gtk_widget_show (contact_widget);
+
+       g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
+       information_dialogs = g_list_prepend (information_dialogs, dialog);
+
+       g_signal_connect (dialog, "response",
+                         G_CALLBACK (contact_dialogs_response_cb),
+                         &information_dialogs);
+
+       if (parent) {
+               gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
        }
-       if (!is_user && edit) {
-               flags |= EMPATHY_CONTACT_WIDGET_EDIT_GROUPS;
+
+       gtk_widget_show (dialog);
+}
+
+void
+empathy_contact_edit_dialog_show (EmpathyContact *contact,
+                                 GtkWindow      *parent)
+{
+       GtkWidget *dialog;
+       GtkWidget *button;
+       GtkWidget *contact_widget;
+       GList     *l;
+
+       g_return_if_fail (EMPATHY_IS_CONTACT (contact));
+
+       l = g_list_find_custom (edit_dialogs,
+                               contact,
+                               (GCompareFunc) contact_dialogs_find);
+       if (l) {
+               gtk_window_present (GTK_WINDOW (l->data));
+               return;
        }
-       contact_widget = empathy_contact_widget_new (contact, flags);
+
+       /* Create dialog */
+       dialog = gtk_dialog_new ();
+       gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+       gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+       gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Contact Information"));
+
+       /* Close button */
+       button = gtk_button_new_with_label (GTK_STOCK_CLOSE);
+       gtk_button_set_use_stock (GTK_BUTTON (button), TRUE);
+       gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
+                                     button,
+                                     GTK_RESPONSE_CLOSE);
+       GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+       gtk_window_set_default (GTK_WINDOW (dialog), button);
+       gtk_widget_show (button);
+
+       /* Contact info widget */
+       contact_widget = empathy_contact_widget_new (contact,
+               EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
+               EMPATHY_CONTACT_WIDGET_EDIT_GROUPS);
        gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8);
        gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
                            contact_widget,
                            TRUE, TRUE, 0);
-       if (flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) {
-               empathy_contact_widget_set_account_filter (contact_widget,
-                                                          empathy_account_chooser_filter_is_connected,
-                                                          NULL);
-       }
        gtk_widget_show (contact_widget);
 
        g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
-       information_dialogs = g_list_prepend (information_dialogs, dialog);
+       edit_dialogs = g_list_prepend (edit_dialogs, dialog);
 
        g_signal_connect (dialog, "response",
-                         G_CALLBACK (contact_information_response_cb),
-                         contact_widget);
+                         G_CALLBACK (contact_dialogs_response_cb),
+                         &edit_dialogs);
 
        if (parent) {
                gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
@@ -234,6 +270,58 @@ empathy_contact_information_dialog_show (EmpathyContact *contact,
        gtk_widget_show (dialog);
 }
 
+void
+empathy_contact_personal_dialog_show (GtkWindow *parent)
+{
+       GtkWidget *button;
+       GtkWidget *contact_widget;
+
+       if (personal_dialog) {
+               gtk_window_present (GTK_WINDOW (personal_dialog));
+               return;
+       }
+
+       /* Create dialog */
+       personal_dialog = gtk_dialog_new ();
+       gtk_dialog_set_has_separator (GTK_DIALOG (personal_dialog), FALSE);
+       gtk_window_set_resizable (GTK_WINDOW (personal_dialog), FALSE);
+       gtk_window_set_title (GTK_WINDOW (personal_dialog), _("Personal Information"));
+
+       /* Close button */
+       button = gtk_button_new_with_label (GTK_STOCK_CLOSE);
+       gtk_button_set_use_stock (GTK_BUTTON (button), TRUE);
+       gtk_dialog_add_action_widget (GTK_DIALOG (personal_dialog),
+                                     button,
+                                     GTK_RESPONSE_CLOSE);
+       GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+       gtk_window_set_default (GTK_WINDOW (personal_dialog), button);
+       gtk_widget_show (button);
+
+       /* Contact info widget */
+       contact_widget = empathy_contact_widget_new (NULL,
+               EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT |
+               EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
+               EMPATHY_CONTACT_WIDGET_EDIT_AVATAR);
+       gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8);
+       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (personal_dialog)->vbox),
+                           contact_widget,
+                           TRUE, TRUE, 0);
+       empathy_contact_widget_set_account_filter (contact_widget,
+               empathy_account_chooser_filter_is_connected, NULL);
+       gtk_widget_show (contact_widget);
+
+       g_signal_connect (personal_dialog, "response",
+                         G_CALLBACK (gtk_widget_destroy), NULL);
+       g_object_add_weak_pointer (G_OBJECT (personal_dialog),
+                                  (gpointer) &personal_dialog);
+
+       if (parent) {
+               gtk_window_set_transient_for (GTK_WINDOW (personal_dialog), parent);
+       }
+
+       gtk_widget_show (personal_dialog);
+}
+
 /*
  *  New contact dialog
  */
@@ -242,12 +330,23 @@ static gboolean
 can_add_contact_to_account (McAccount *account,
                            gpointer   user_data)
 {
-       EmpathyContactManager *mgr;
+       EmpathyAccountManager *account_manager;
+       EmpathyContactManager *contact_manager;
+       TpConnection          *connection;
        gboolean               result;
 
-       mgr = empathy_contact_manager_dup_singleton ();
-       result = empathy_contact_manager_can_add (mgr, account);
-       g_object_unref (mgr);
+       account_manager = empathy_account_manager_dup_singleton ();
+       connection = empathy_account_manager_get_connection (account_manager,
+                                                            account);
+       if (!connection) {
+               g_object_unref (account_manager);
+               return FALSE;
+       }
+
+       contact_manager = empathy_contact_manager_dup_singleton ();
+       result = empathy_contact_manager_can_add (contact_manager, connection);
+       g_object_unref (contact_manager);
+       g_object_unref (account_manager);
 
        return result;
 }
index e375f959cf0833ee6dda19a1ad6fc0d21e9da4f8..c714c6b9611d3560762d35a5b21cfa99cbc098d0 100644 (file)
 G_BEGIN_DECLS
 
 void empathy_subscription_dialog_show        (EmpathyContact *contact,
-                                             GtkWindow     *parent);
+                                             GtkWindow      *parent);
 void empathy_contact_information_dialog_show (EmpathyContact *contact,
-                                             GtkWindow     *parent,
-                                             gboolean       edit,
-                                             gboolean       is_user);
-void empathy_new_contact_dialog_show         (GtkWindow     *parent);
+                                             GtkWindow      *parent);
+void empathy_contact_edit_dialog_show        (EmpathyContact *contact,
+                                             GtkWindow      *parent);
+void empathy_contact_personal_dialog_show    (GtkWindow      *parent);
+void empathy_new_contact_dialog_show         (GtkWindow      *parent);
 
 G_END_DECLS
 
index 3fdc7b327a91b7c83ee9890508f7cf025e88d791..ca224f52631be53cffa9043d08c45d62d78a4265 100644 (file)
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
+#include <telepathy-glib/util.h>
 #include <libmissioncontrol/mc-account.h>
 
+#include <libempathy/empathy-account-manager.h>
 #include <libempathy/empathy-call-factory.h>
-#include <libempathy/empathy-contact-factory.h>
+#include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-contact-groups.h>
 #include <libempathy/empathy-dispatcher.h>
@@ -122,8 +124,8 @@ contact_list_view_tooltip_destroy_cb (GtkWidget              *widget,
        
        if (priv->tooltip_widget) {
                DEBUG ("Tooltip destroyed");
+               g_object_unref (priv->tooltip_widget);
                priv->tooltip_widget = NULL;
-               g_object_unref (widget);
        }
 }
 
@@ -188,8 +190,52 @@ OUT:
        return ret;
 }
 
+typedef struct {
+       gchar *new_group;
+       gchar *old_group;
+       GdkDragAction action;
+} DndGetContactData;
+
+static void
+contact_list_view_dnd_get_contact_free (DndGetContactData *data)
+{
+       g_free (data->new_group);
+       g_free (data->old_group);
+       g_slice_free (DndGetContactData, data);
+}
+
 static void
-contact_list_view_drag_data_received (GtkWidget         *widget,
+contact_list_view_drag_got_contact (EmpathyTpContactFactory *factory,
+                                   EmpathyContact          *contact,
+                                   const GError            *error,
+                                   gpointer                 user_data,
+                                   GObject                 *view)
+{
+       EmpathyContactListViewPriv *priv = GET_PRIV (view);
+       DndGetContactData          *data = user_data;
+       EmpathyContactList         *list;
+
+       if (error != NULL) {
+               DEBUG ("Error: %s", error->message);
+               return;
+       }
+
+       DEBUG ("contact %s (%d) dragged from '%s' to '%s'",
+               empathy_contact_get_id (contact),
+               empathy_contact_get_handle (contact),
+               data->old_group, data->new_group);
+
+       list = empathy_contact_list_store_get_list_iface (priv->store);
+       if (data->new_group) {
+               empathy_contact_list_add_to_group (list, contact, data->new_group);
+       }
+       if (data->old_group && data->action == GDK_ACTION_MOVE) {       
+               empathy_contact_list_remove_from_group (list, contact, data->old_group);
+       }
+}
+
+static void
+contact_list_view_drag_data_received (GtkWidget         *view,
                                      GdkDragContext    *context,
                                      gint               x,
                                      gint               y,
@@ -198,88 +244,102 @@ contact_list_view_drag_data_received (GtkWidget         *widget,
                                      guint              time)
 {
        EmpathyContactListViewPriv *priv;
-       EmpathyContactList         *list;
-       EmpathyContactFactory      *factory;
+       EmpathyAccountManager      *account_manager;
+       EmpathyTpContactFactory    *factory = NULL;
        McAccount                  *account;
        GtkTreeModel               *model;
-       GtkTreePath                *path;
        GtkTreeViewDropPosition     position;
-       EmpathyContact             *contact = NULL;
+       GtkTreePath                *path;
        const gchar                *id;
-       gchar                     **strv;
+       gchar                     **strv = NULL;
+       const gchar                *account_id;
+       const gchar                *contact_id;
        gchar                      *new_group = NULL;
        gchar                      *old_group = NULL;
+       DndGetContactData          *data;
        gboolean                    is_row;
+       gboolean                    success = TRUE;
 
-       priv = GET_PRIV (widget);
-
-       id = (const gchar*) selection->data;
-       DEBUG ("Received %s%s drag & drop contact from roster with id:'%s'",
-               context->action == GDK_ACTION_MOVE ? "move" : "",
-               context->action == GDK_ACTION_COPY ? "copy" : "",
-               id);
+       priv = GET_PRIV (view);
+       model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
 
-       strv = g_strsplit (id, "/", 2);
-       factory = empathy_contact_factory_dup_singleton ();
-       account = mc_account_lookup (strv[0]);
-       if (account) {
-               contact = empathy_contact_factory_get_from_id (factory,
-                                                              account,
-                                                              strv[1]);
-               g_object_unref (account);
-       }
-       g_object_unref (factory);
-       g_strfreev (strv);
+       /* Get destination group information. */
+       is_row = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (view),
+                                                   x,
+                                                   y,
+                                                   &path,
+                                                   &position);
 
-       if (!contact) {
-               DEBUG ("No contact found associated with drag & drop");
-               return;
+       if (is_row) {
+               new_group = empathy_contact_list_store_get_parent_group (model,
+                       path, NULL);
+               gtk_tree_path_free (path);
        }
 
-       empathy_contact_run_until_ready (contact,
-                                        EMPATHY_CONTACT_READY_HANDLE,
-                                        NULL);
-
-       model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
-
        /* Get source group information. */
        if (priv->drag_row) {
                path = gtk_tree_row_reference_get_path (priv->drag_row);
                if (path) {
-                       old_group = empathy_contact_list_store_get_parent_group (model, path, NULL);
+                       old_group = empathy_contact_list_store_get_parent_group (
+                               model, path, NULL);
                        gtk_tree_path_free (path);
                }
        }
 
-       /* Get destination group information. */
-       is_row = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget),
-                                                   x,
-                                                   y,
-                                                   &path,
-                                                   &position);
-
-       if (is_row) {
-               new_group = empathy_contact_list_store_get_parent_group (model, path, NULL);
-               gtk_tree_path_free (path);
+       if (!tp_strdiff (old_group, new_group)) {
+               g_free (new_group);
+               g_free (old_group);
+               goto OUT;
        }
 
-       DEBUG ("contact %s (%d) dragged from '%s' to '%s'",
-               empathy_contact_get_id (contact),
-               empathy_contact_get_handle (contact),
-               old_group, new_group);
+       id = (const gchar*) selection->data;
+       DEBUG ("Received %s%s drag & drop contact from roster with id:'%s'",
+               context->action == GDK_ACTION_MOVE ? "move" : "",
+               context->action == GDK_ACTION_COPY ? "copy" : "",
+               id);
 
-       list = empathy_contact_list_store_get_list_iface (priv->store);
-       if (new_group) {
-               empathy_contact_list_add_to_group (list, contact, new_group);
+       strv = g_strsplit (id, "/", 2);
+       account_id = strv[0];
+       contact_id = strv[1];
+       account = mc_account_lookup (account_id);
+       if (account) {
+               TpConnection *connection;
+
+               /* FIXME: We assume we have already an account manager */
+               account_manager = empathy_account_manager_dup_singleton ();
+               connection = empathy_account_manager_get_connection (account_manager,
+                                                                    account);
+               if (connection) {
+                       factory = empathy_tp_contact_factory_dup_singleton (connection);
+               }
+               g_object_unref (account_manager);
        }
-       if (old_group && context->action == GDK_ACTION_MOVE) {  
-               empathy_contact_list_remove_from_group (list, contact, old_group);
+
+       if (!factory) {
+               DEBUG ("Failed to get factory for account '%s'", account_id);
+               success = FALSE;
+               g_free (new_group);
+               g_free (old_group);
+               goto OUT;
        }
 
-       g_free (old_group);
-       g_free (new_group);
+       data = g_slice_new0 (DndGetContactData);
+       data->new_group = new_group;
+       data->old_group = old_group;
+       data->action = context->action;
 
-       gtk_drag_finish (context, TRUE, FALSE, GDK_CURRENT_TIME);
+       /* FIXME: We should probably wait for the cb before calling
+        * gtk_drag_finish */
+       empathy_tp_contact_factory_get_from_id (factory, contact_id,
+               contact_list_view_drag_got_contact,
+               data, (GDestroyNotify) contact_list_view_dnd_get_contact_free,
+               G_OBJECT (view));
+
+       g_object_unref (factory);
+
+OUT:
+       g_strfreev (strv);
+       gtk_drag_finish (context, success, FALSE, GDK_CURRENT_TIME);
 }
 
 static gboolean
@@ -414,7 +474,7 @@ contact_list_view_drag_data_get (GtkWidget        *widget,
 
        gtk_tree_path_free (src_path);
 
-       contact = empathy_contact_list_view_get_selected (EMPATHY_CONTACT_LIST_VIEW (widget));
+       contact = empathy_contact_list_view_dup_selected (EMPATHY_CONTACT_LIST_VIEW (widget));
        if (!contact) {
                return;
        }
@@ -1158,7 +1218,7 @@ empathy_contact_list_view_new (EmpathyContactListStore        *store,
 }
 
 EmpathyContact *
-empathy_contact_list_view_get_selected (EmpathyContactListView *view)
+empathy_contact_list_view_dup_selected (EmpathyContactListView *view)
 {
        EmpathyContactListViewPriv *priv;
        GtkTreeSelection          *selection;
@@ -1324,7 +1384,7 @@ contact_list_view_remove_activate_cb (GtkMenuItem            *menuitem,
        EmpathyContactListViewPriv *priv = GET_PRIV (view);
        EmpathyContact             *contact;
                
-       contact = empathy_contact_list_view_get_selected (view);
+       contact = empathy_contact_list_view_dup_selected (view);
 
        if (contact) {
                gchar     *text; 
@@ -1357,7 +1417,7 @@ empathy_contact_list_view_get_contact_menu (EmpathyContactListView *view)
 
        g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view), NULL);
 
-       contact = empathy_contact_list_view_get_selected (view);
+       contact = empathy_contact_list_view_dup_selected (view);
        if (!contact) {
                return NULL;
        }
index 82990d64f5e9b19c050b3acef7154c6d17c4acd6..bb6766c4a9848e48790010ffd3f5e59a925006e3 100644 (file)
@@ -70,7 +70,7 @@ GType                      empathy_contact_list_view_get_type           (void) G
 EmpathyContactListView *   empathy_contact_list_view_new                (EmpathyContactListStore        *store,
                                                                         EmpathyContactListFeatureFlags  list_features,
                                                                         EmpathyContactFeatureFlags      contact_features);
-EmpathyContact *           empathy_contact_list_view_get_selected       (EmpathyContactListView         *view);
+EmpathyContact *           empathy_contact_list_view_dup_selected       (EmpathyContactListView         *view);
 gchar *                    empathy_contact_list_view_get_selected_group (EmpathyContactListView         *view);
 GtkWidget *                empathy_contact_list_view_get_contact_menu   (EmpathyContactListView         *view);
 GtkWidget *                empathy_contact_list_view_get_group_menu     (EmpathyContactListView         *view);
index 9cd9a0b9fb5f1c9a89eefffa7d587f5713b00e58..a3cf1da26f71aeedf5874d1e26c48d96f6cec19c 100644 (file)
@@ -236,7 +236,7 @@ empathy_contact_file_transfer_menu_item_new (EmpathyContact *contact)
 static void
 contact_info_menu_item_activate_cb (EmpathyContact *contact)
 {
-       empathy_contact_information_dialog_show (contact, NULL, FALSE, FALSE);
+       empathy_contact_information_dialog_show (contact, NULL);
 }
 
 GtkWidget *
@@ -263,7 +263,7 @@ empathy_contact_info_menu_item_new (EmpathyContact *contact)
 static void
 contact_edit_menu_item_activate_cb (EmpathyContact *contact)
 {
-       empathy_contact_information_dialog_show (contact, NULL, TRUE, FALSE);
+       empathy_contact_edit_dialog_show (contact, NULL);
 }
 
 GtkWidget *
index 539629a234de8d31aa50c2d0a41f4b52dd348ea8..f4a302c5bcb1a1d4bcfb326b2c657a34883fa12d 100644 (file)
 
 #include "empathy-contact-selector.h"
 
+/**
+ * SECTION:empathy-contact-selector
+ * @title:EmpathyContactSelector
+ * @short_description: A widget used to choose from a list of contacts.
+ * @include: libempathy-gtk/empathy-contact-selector.h
+ *
+ * #EmpathyContactSelector is a widget which extends #GtkComboBox to provide
+ * a chooser of available contacts.
+ */
+
+/**
+ * EmpathyContactSelector:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkComboBox to provide a chooser of available contacts.
+ */
+
 G_DEFINE_TYPE (EmpathyContactSelector, empathy_contact_selector,
     GTK_TYPE_COMBO_BOX)
 
@@ -320,14 +337,27 @@ empathy_contact_selector_class_init (EmpathyContactSelectorClass *klass)
   object_class->get_property = contact_selector_get_property;
   g_type_class_add_private (klass, sizeof (EmpathyContactSelectorPriv));
 
+  /**
+   * EmpathyContactSelector:contact-list:
+   *
+   * An #EmpathyContactList containing the contacts for the
+   * #EmpathyContactSelector.
+   */
   g_object_class_install_property (object_class, PROP_CONTACT_LIST,
       g_param_spec_object ("contact-list", "contact list", "contact list",
       EMPATHY_TYPE_CONTACT_LIST, G_PARAM_CONSTRUCT_ONLY |
       G_PARAM_READWRITE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 }
 
-/* public methods */
-
+/**
+ * empathy_contact_selector_new:
+ * @contact_list: an #EmpathyContactList containing the contacts to list in
+ * the contact selector
+ *
+ * Creates a new #EmpathyContactSelector.
+ *
+ * Return value: A new #EmpathyContactSelector
+ */
 GtkWidget *
 empathy_contact_selector_new (EmpathyContactList *contact_list)
 {
@@ -337,6 +367,16 @@ empathy_contact_selector_new (EmpathyContactList *contact_list)
       "contact-list", contact_list, NULL));
 }
 
+/**
+ * empathy_contact_selector_dup_selected:
+ * @selector: An #EmpathyContactSelector
+ *
+ * Returns a new reference to the contact which is currently selected in
+ * @selector, or %NULL if there is no contact selected. The returned contact
+ * should be unrefed with g_object_unref() when finished with.
+ *
+ * Return value: A new reference to the contact currently selected, or %NULL
+ */
 EmpathyContact *
 empathy_contact_selector_dup_selected (EmpathyContactSelector *selector)
 {
@@ -390,6 +430,19 @@ contact_selector_filter_visible_func (GtkTreeModel *model,
   return visible;
 }
 
+/**
+ * empathy_contact_selector_set_visible:
+ * @selector: an #EmpathyContactSelector
+ * @func: an #EmpathyContactSelectorFilterFunc to filter the contacts
+ * @user_data: data to pass to @func or %NULL
+ *
+ * Sets a filter on the @selector so only contacts that return %TRUE
+ * when passed into @func are visible.
+ *
+ * A typical usage for this function would be to only show contacts that
+ * can send or receive files. In this case, one could use the
+ * empathy_contact_can_send_files() function
+ */
 void
 empathy_contact_selector_set_visible (EmpathyContactSelector *selector,
                                       EmpathyContactSelectorFilterFunc func,
@@ -407,3 +460,14 @@ empathy_contact_selector_set_visible (EmpathyContactSelector *selector,
 
   gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->model));
 }
+
+/**
+ * EmpathyContactSelectorFilterFunc:
+ * @contact: an #EmpathyContact
+ * @user_data: user data or %NULL
+ *
+ * A function which decides whether the contact indicated by @contact
+ * is visible.
+ *
+ * Return value: whether @contact is visible
+ */
index f7af92f2cfc4e010ab26a84e47339fd280d27a62..205b9e411466701a2715cef19b98f4d1f012dcef 100644 (file)
@@ -49,6 +49,8 @@ typedef struct _EmpathyContactSelectorClass EmpathyContactSelectorClass;
 struct _EmpathyContactSelector
 {
   GtkComboBox parent;
+
+  /*<private>*/
   gpointer priv;
 };
 
index ef259b0a44b607da26b11fc717ac1fcd8bbaf403..0821066fa55bb2d724f76e816c291910ef7ada63 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2009 Collabora Ltd.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@
 #include <libmissioncontrol/mc-account.h>
 #include <telepathy-glib/util.h>
 
-#include <libempathy/empathy-contact-factory.h>
+#include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-utils.h>
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
 #include <libempathy/empathy-debug.h>
 
+/**
+ * SECTION:empathy-contact-widget
+ * @title:EmpathyContactWidget
+ * @short_description: A widget used to display and edit details about a contact
+ * @include: libempathy-empathy-contact-widget.h
+ *
+ * #EmpathyContactWidget is a widget which displays appropriate widgets
+ * with details about a contact, also allowing changing these details,
+ * if desired.
+ */
+
+/**
+ * EmpathyContactWidget:
+ * @parent: parent object
+ *
+ * Widget which displays appropriate widgets with details about a contact,
+ * also allowing changing these details, if desired.
+ */
+
 /* Delay before updating the widget when the id entry changed (seconds) */
 #define ID_CHANGED_TIMEOUT 1
 
 typedef struct
 {
-  EmpathyContactFactory *factory;
+  EmpathyTpContactFactory *factory;
   EmpathyContactManager *manager;
   EmpathyContact *contact;
   EmpathyContactWidgetFlags flags;
@@ -106,8 +125,6 @@ static void contact_widget_contact_update (EmpathyContactWidget *information);
 static void contact_widget_change_contact (EmpathyContactWidget *information);
 static void contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
     EmpathyContactWidget *information);
-static void contact_widget_account_changed_cb (GtkComboBox *widget,
-    EmpathyContactWidget *information);
 static gboolean contact_widget_id_focus_out_cb (GtkWidget *widget,
     GdkEventFocus *event, EmpathyContactWidget *information);
 static gboolean contact_widget_entry_alias_focus_event_cb (
@@ -153,6 +170,15 @@ enum
   COL_COUNT
 };
 
+/**
+ * empathy_contact_widget_new:
+ * @contact: an #EmpathyContact
+ * @flags: #EmpathyContactWidgetFlags for the new contact widget
+ *
+ * Creates a new #EmpathyContactWidget.
+ *
+ * Return value: a new #EmpathyContactWidget
+ */
 GtkWidget *
 empathy_contact_widget_new (EmpathyContact *contact,
                             EmpathyContactWidgetFlags flags)
@@ -161,9 +187,10 @@ empathy_contact_widget_new (EmpathyContact *contact,
   GtkBuilder *gui;
   gchar *filename;
 
+  g_return_val_if_fail (contact == NULL || EMPATHY_IS_CONTACT (contact), NULL);
+
   information = g_slice_new0 (EmpathyContactWidget);
   information->flags = flags;
-  information->factory = empathy_contact_factory_dup_singleton ();
 
   filename = empathy_file_lookup ("empathy-contact-widget.ui",
       "libempathy-gtk");
@@ -206,12 +233,25 @@ empathy_contact_widget_new (EmpathyContact *contact,
   contact_widget_details_setup (information);
   contact_widget_client_setup (information);
 
-  contact_widget_set_contact (information, contact);
+  if (contact != NULL)
+    contact_widget_set_contact (information, contact);
+
+  else if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT ||
+      information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
+    contact_widget_change_contact (information);
 
   return empathy_builder_unref_and_keep_widget (gui,
     information->vbox_contact_widget);
 }
 
+/**
+ * empathy_contact_widget_get_contact:
+ * @widget: an #EmpathyContactWidget
+ *
+ * Get the #EmpathyContact related with the #EmpathyContactWidget @widget.
+ *
+ * Returns: the #EmpathyContact associated with @widget
+ */
 EmpathyContact *
 empathy_contact_widget_get_contact (GtkWidget *widget)
 {
@@ -226,6 +266,13 @@ empathy_contact_widget_get_contact (GtkWidget *widget)
   return information->contact;
 }
 
+/**
+ * empathy_contact_widget_set_contact:
+ * @widget: an #EmpathyContactWidget
+ * @contact: a different #EmpathyContact
+ *
+ * Change the #EmpathyContact related with the #EmpathyContactWidget @widget.
+ */
 void
 empathy_contact_widget_set_contact (GtkWidget *widget,
                                     EmpathyContact *contact)
@@ -242,6 +289,15 @@ empathy_contact_widget_set_contact (GtkWidget *widget,
   contact_widget_set_contact (information, contact);
 }
 
+/**
+ * empathy_contact_widget_set_account_filter:
+ * @widget: an #EmpathyContactWidget
+ * @filter: a #EmpathyAccountChooserFilterFunc
+ * @user_data: user data to pass to @filter, or %NULL
+ *
+ * Set a filter on the #EmpathyAccountChooser included in the
+ * #EmpathyContactWidget.
+ */
 void
 empathy_contact_widget_set_account_filter (
     GtkWidget *widget,
@@ -272,10 +328,6 @@ contact_widget_destroy_cb (GtkWidget *widget,
     {
       g_source_remove (information->widget_id_timeout);
     }
-  if (information->factory)
-    {
-      g_object_unref (information->factory);
-    }   
   if (information->manager)
     {
       g_object_unref (information->manager);
@@ -299,7 +351,9 @@ contact_widget_remove_contact (EmpathyContactWidget *information)
           contact_widget_groups_notify_cb, information);
 
       g_object_unref (information->contact);
+      g_object_unref (information->factory);
       information->contact = NULL;
+      information->factory = NULL;
     }
 }
 
@@ -312,7 +366,13 @@ contact_widget_set_contact (EmpathyContactWidget *information,
 
   contact_widget_remove_contact (information);
   if (contact)
+    {
+      TpConnection *connection;
+
+      connection = empathy_contact_get_connection (contact);
       information->contact = g_object_ref (contact);
+      information->factory = empathy_tp_contact_factory_dup_singleton (connection);
+    }
 
   /* Update information for widgets */
   contact_widget_contact_update (information);
@@ -491,10 +551,10 @@ static void
 update_avatar_chooser_account_cb (EmpathyAccountChooser *account_chooser,
                                   EmpathyAvatarChooser *avatar_chooser)
 {
-  McAccount *account;
+  TpConnection *connection;
 
-  account = empathy_account_chooser_get_account (account_chooser);
-  g_object_set (avatar_chooser, "account", account, NULL);
+  connection = empathy_account_chooser_get_connection (account_chooser);
+  g_object_set (avatar_chooser, "connection", connection, NULL);
 }
 
 static void
@@ -505,8 +565,8 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
     {
       information->widget_account = empathy_account_chooser_new ();
 
-      g_signal_connect (information->widget_account, "changed",
-            G_CALLBACK (contact_widget_account_changed_cb),
+      g_signal_connect_swapped (information->widget_account, "changed",
+            G_CALLBACK (contact_widget_change_contact),
             information);
     }
   else
@@ -636,12 +696,12 @@ contact_widget_contact_update (EmpathyContactWidget *information)
       if (account)
         {
           g_signal_handlers_block_by_func (information->widget_account,
-                   contact_widget_account_changed_cb,
+                   contact_widget_change_contact,
                    information);
           empathy_account_chooser_set_account (
               EMPATHY_ACCOUNT_CHOOSER (information->widget_account), account);
           g_signal_handlers_unblock_by_func (information->widget_account,
-              contact_widget_account_changed_cb, information);
+              contact_widget_change_contact, information);
         }
     }
   else
@@ -683,83 +743,71 @@ contact_widget_contact_update (EmpathyContactWidget *information)
 }
 
 static void
-contact_widget_change_contact_cb (EmpathyContact *contact,
-                                  const GError *error,
-                                  gpointer information,
-                                  GObject *weak_object)
+contact_widget_got_contact_cb (EmpathyTpContactFactory *factory,
+                               EmpathyContact *contact,
+                               const GError *error,
+                               gpointer user_data,
+                               GObject *weak_object)
 {
-  if (error)
-    DEBUG ("Error: %s", error->message);
-  else
-    contact_widget_set_contact (information, contact);
-  g_object_unref (contact);
+  EmpathyContactWidget *information = user_data;
+
+  if (error != NULL)
+    {
+      DEBUG ("Error: %s", error->message);
+      return;
+    }
+
+  contact_widget_set_contact (information, contact);
 }
 
 static void
 contact_widget_change_contact (EmpathyContactWidget *information)
 {
-  EmpathyContact *contact;
-  McAccount *account;
+  EmpathyTpContactFactory *factory;
+  TpConnection *connection;
 
-  account = empathy_account_chooser_get_account (
+  connection = empathy_account_chooser_get_connection (
       EMPATHY_ACCOUNT_CHOOSER (information->widget_account));
-  if (!account)
+  if (!connection)
       return;
 
+  factory = empathy_tp_contact_factory_dup_singleton (connection);
   if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
     {
       const gchar *id;
 
       id = gtk_entry_get_text (GTK_ENTRY (information->widget_id));
-      if (EMP_STR_EMPTY (id))
-          return;
-
-      contact = empathy_contact_factory_get_from_id (information->factory,
-          account, id);
+      if (!EMP_STR_EMPTY (id))
+        {
+          empathy_tp_contact_factory_get_from_id (factory, id,
+              contact_widget_got_contact_cb, information, NULL,
+              G_OBJECT (information->vbox_contact_widget));
+        }
     }
   else
     {
-      contact = empathy_contact_factory_get_user (information->factory,
-          account);
-    }
-
-  if (contact)
-    {
-      /* Give the contact ref to the callback */
-      empathy_contact_call_when_ready (contact,
-          EMPATHY_CONTACT_READY_HANDLE |
-          EMPATHY_CONTACT_READY_ID,
-          contact_widget_change_contact_cb,
-          information, NULL,
+      empathy_tp_contact_factory_get_from_handle (factory,
+          tp_connection_get_self_handle (connection),
+          contact_widget_got_contact_cb, information, NULL,
           G_OBJECT (information->vbox_contact_widget));
     }
+
+  g_object_unref (factory);
 }
 
 static void
 contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
                                   EmpathyContactWidget *information)
 {
-  if (information->contact && empathy_contact_is_user (information->contact))
-    {
-      McAccount *account;
-      const gchar *data;
-      gsize size;
-      const gchar *mime_type;
-
-      account = empathy_contact_get_account (information->contact);
-      empathy_avatar_chooser_get_image_data (
-          EMPATHY_AVATAR_CHOOSER (information->widget_avatar),
-          &data, &size, &mime_type);
-      empathy_contact_factory_set_avatar (information->factory, account,
-          data, size, mime_type);
-    }
-}
-
-static void
-contact_widget_account_changed_cb (GtkComboBox *widget,
-                                   EmpathyContactWidget *information)
-{
-  contact_widget_change_contact (information);
+  const gchar *data;
+  gsize size;
+  const gchar *mime_type;
+
+  empathy_avatar_chooser_get_image_data (
+      EMPATHY_AVATAR_CHOOSER (information->widget_avatar),
+      &data, &size, &mime_type);
+  empathy_tp_contact_factory_set_avatar (information->factory,
+      data, size, mime_type);
 }
 
 static gboolean
@@ -781,7 +829,7 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
       const gchar *alias;
 
       alias = gtk_entry_get_text (GTK_ENTRY (editable));
-      empathy_contact_factory_set_alias (information->factory,
+      empathy_tp_contact_factory_set_alias (information->factory,
           information->contact, alias);
     }
 
index 4ba75e17f00a0e2049ad998de77196f2953f2238..0da5580a30149af963defeebe1fd115655de815b 100644 (file)
 
 G_BEGIN_DECLS
 
+/**
+ * EmpathyContactWidgetFlags:
+ * @EMPATHY_CONTACT_WIDGET_EDIT_NONE: Don't show any widgets to edit any details
+ *  of the contact. This should be the option for widgets that merely display
+ *  information about a contact.
+ * @EMPATHY_CONTACT_WIDGET_EDIT_ALIAS: Show a #GtkEntry allowing changes to the
+ *  contact's alias.
+ * @EMPATHY_CONTACT_WIDGET_EDIT_AVATAR: Show an #EmpathyAvatarChooser allowing
+ *  changes to the contact's avatar.
+ * @EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT: Show an #EmpathyAccountChooser allowing
+ *  changes to the contact's account.
+ * @EMPATHY_CONTACT_WIDGET_EDIT_ID: Show a #GtkEntry allowing changes to the
+ *  contact's identifier.
+ * @EMPATHY_CONTACT_WIDGET_EDIT_GROUPS: Show a widget to change the groups the
+ *  contact is in.
+ * @EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP: Make widgets more designed for a tooltip.
+ *  For example, make widgets not selectable.
+ *
+ * Flags used when creating an #EmpathyContactWidget to specify which features
+ * should be available.
+ */
 typedef enum
 {
   EMPATHY_CONTACT_WIDGET_EDIT_NONE    = 0,
index 89ee5b2847388970f8c35552b2532d522de832f3..8f7f47bdaab81c1f0da9eeebad788e7c1fa1d819 100644 (file)
@@ -572,6 +572,7 @@ empathy_irc_network_dialog_show (EmpathyIrcNetwork *network,
   gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
 
   irc_network_dialog_network_update_buttons (dialog);
+  gtk_widget_show_all (dialog->dialog);
 
   return dialog->dialog;
 }
index 2cec17783c52c962b06e170900f430d566993273..13d9bcbd34536181438354f610f369f949a4c473 100644 (file)
@@ -618,7 +618,7 @@ log_window_chats_populate (EmpathyLogWindow *window)
        GtkTreeIter           iter;
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats);
-       account = empathy_account_chooser_get_account (account_chooser);
+       account = empathy_account_chooser_dup_account (account_chooser);
 
        view = GTK_TREE_VIEW (window->treeview_chats);
        model = gtk_tree_view_get_model (view);
index f6eb46a5fccaa674b74986a5d016651706f2c66d..3e6e3f11d3a10ecf8a8a7b727f042db81fd6d7cc 100644 (file)
@@ -31,7 +31,7 @@
 #include <libmissioncontrol/mission-control.h>
 
 #include <libempathy/empathy-call-factory.h>
-#include <libempathy/empathy-contact-factory.h>
+#include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-utils.h>
 #include "empathy-new-message-dialog.h"
 #include "empathy-account-chooser.h"
 
+/**
+ * SECTION:empathy-new-message-dialog
+ * @title: EmpathyNewMessageDialog
+ * @short_description: A dialog to show a new message
+ * @include: libempathy-gtk/empathy-new-message-dialog.h
+ *
+ * #EmpathyNewMessageDialog is a dialog which allows a text chat or
+ * call to be started with any contact on any enabled account.
+ */
+
 typedef struct {
        GtkWidget *dialog;
        GtkWidget *table_contact;
@@ -65,48 +75,54 @@ new_message_dialog_account_changed_cb (GtkWidget               *widget,
                                       EmpathyNewMessageDialog *dialog)
 {
        EmpathyAccountChooser *chooser;
-       McAccount            *account;
+       TpConnection          *connection;
        EmpathyTpContactList *contact_list;
-       GList                *members, *l;
+       GList                *members;
        GtkListStore         *store;
        GtkEntryCompletion   *completion;
        GtkTreeIter           iter;
        gchar                *tmpstr;
 
-       chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
-       account = empathy_account_chooser_get_account (chooser);
-       contact_list = empathy_contact_manager_get_list (dialog->contact_manager,
-                                                        account);
-       members = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (contact_list));
+       /* Remove completions */
        completion = gtk_entry_get_completion (GTK_ENTRY (dialog->entry_id));
        store = GTK_LIST_STORE (gtk_entry_completion_get_model (completion));
        gtk_list_store_clear (store);
 
-       for (l = members; l; l = l->next) {
-               EmpathyContact *contact = l->data;
+       /* Get members of the new account */
+       chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
+       connection = empathy_account_chooser_get_connection (chooser);
+       if (!connection) {
+               return;
+       }
+       contact_list = empathy_contact_manager_get_list (dialog->contact_manager,
+                                                        connection);
+       members = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (contact_list));
+
+       /* Add members to the completion */
+       while (members) {
+               EmpathyContact *contact = members->data;
 
-               if (!empathy_contact_is_online (contact)) {
-                       continue;
-               }
+               if (empathy_contact_is_online (contact)) {
+                       DEBUG ("Adding contact ID %s, Name %s",
+                              empathy_contact_get_id (contact),
+                              empathy_contact_get_name (contact));
 
-               DEBUG ("Adding contact ID %s, Name %s",
-                      empathy_contact_get_id (contact),
-                      empathy_contact_get_name (contact));
+                       tmpstr = g_strdup_printf ("%s (%s)",
+                               empathy_contact_get_name (contact),
+                               empathy_contact_get_id (contact));
 
-               tmpstr = g_strdup_printf ("%s (%s)",
-                                         empathy_contact_get_name (contact),
-                                         empathy_contact_get_id (contact));
+                       gtk_list_store_insert_with_values (store, &iter, -1,
+                               COMPLETION_COL_TEXT, tmpstr,
+                               COMPLETION_COL_ID, empathy_contact_get_id (contact),
+                               COMPLETION_COL_NAME, empathy_contact_get_name (contact),
+                               -1);
 
-               gtk_list_store_insert_with_values (store, &iter, -1,
-                       COMPLETION_COL_TEXT, tmpstr,
-                       COMPLETION_COL_ID, empathy_contact_get_id (contact),
-                       COMPLETION_COL_NAME, empathy_contact_get_name (contact),
-                       -1);
+                       g_free (tmpstr);
+               }
 
-               g_free (tmpstr);
+               g_object_unref (contact);
+               members = g_list_delete_link (members, members);
        }
-
-       g_object_unref (account);
 }
 
 static gboolean
@@ -165,42 +181,52 @@ new_message_dialog_match_func (GtkEntryCompletion *completion,
        return FALSE;
 }
 
+static void
+new_message_dialog_call_got_contact_cb (EmpathyTpContactFactory *factory,
+                                       EmpathyContact          *contact,
+                                       const GError            *error,
+                                       gpointer                 user_data,
+                                       GObject                 *weak_object)
+{
+       EmpathyCallFactory *call_factory;
+
+       if (error != NULL) {
+               DEBUG ("Error: %s", error->message);
+               return;
+       }
+
+       call_factory = empathy_call_factory_get();
+       empathy_call_factory_new_call (call_factory, contact);
+}
+
 static void
 new_message_dialog_response_cb (GtkWidget               *widget,
                                gint                    response,
                                EmpathyNewMessageDialog *dialog)
 {
-       McAccount   *account;
+       TpConnection *connection;
        const gchar *id;
 
-       account = empathy_account_chooser_get_account (EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser));
+       connection = empathy_account_chooser_get_connection (
+               EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser));
        id = gtk_entry_get_text (GTK_ENTRY (dialog->entry_id));
-       if (!account || EMP_STR_EMPTY (id)) {
-               if (account) {
-                       g_object_unref (account);
-               }
+       if (!connection || EMP_STR_EMPTY (id)) {
                gtk_widget_destroy (widget);
                return;
        }
 
        if (response == 1) {
-               EmpathyContactFactory *factory;
-               EmpathyContact *contact;
-               EmpathyCallFactory *call_factory;
-
-               factory = empathy_contact_factory_dup_singleton ();
-               contact = empathy_contact_factory_get_from_id (factory, account, id);
+               EmpathyTpContactFactory *factory;
 
-               call_factory = empathy_call_factory_get();
-               empathy_call_factory_new_call (call_factory, contact);
-
-               g_object_unref (contact);
+               factory = empathy_tp_contact_factory_dup_singleton (connection);
+               empathy_tp_contact_factory_get_from_id (factory, id,
+                       new_message_dialog_call_got_contact_cb,
+                       NULL, NULL, NULL);
                g_object_unref (factory);
        } else if (response == 2) {
-               empathy_dispatcher_chat_with_contact_id (account, id, NULL, NULL);
+               empathy_dispatcher_chat_with_contact_id (connection, id, NULL, NULL);
        }
 
-       g_object_unref (account);
        gtk_widget_destroy (widget);
 }
 
@@ -226,6 +252,14 @@ new_message_dialog_destroy_cb (GtkWidget               *widget,
        g_free (dialog);
 }
 
+/**
+ * empathy_new_message_dialog_show:
+ * @parent: parent #GtkWindow of the dialog
+ *
+ * Create a new #EmpathyNewMessageDialog and show it.
+ *
+ * Return value: the new #EmpathyNewMessageDialog
+ */
 GtkWidget *
 empathy_new_message_dialog_show (GtkWindow *parent)
 {
index 8e9574bc533c10798a195510079395458831785e..f4a325b51f7cb9ef343dd6f60732d923dc1cf742 100644 (file)
 #include "empathy-ui-utils.h"
 #include "empathy-images.h"
 #include "empathy-presence-chooser.h"
+#include "empathy-status-preset-dialog.h"
+
+/**
+ * SECTION:empathy-presence-chooser
+ * @title:EmpathyPresenceChooser
+ * @short_description: A widget used to change presence
+ * @include: libempathy-gtk/empathy-presence-chooser.h
+ *
+ * #EmpathyPresenceChooser is a widget which extends #GtkComboBoxEntry
+ * to change presence.
+ */
+
+/**
+ * EmpathyAccountChooser:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkComboBoxEntry to change presence.
+ */
 
 /* Flashing delay for icons (milliseconds). */
 #define FLASH_TIMEOUT 500
@@ -95,16 +113,6 @@ typedef struct {
        guint        flash_timeout_id;
 } EmpathyPresenceChooserPriv;
 
-typedef struct {
-       GtkWidget    *dialog;
-       GtkWidget    *checkbutton_save;
-       GtkWidget    *comboboxentry_message;
-       GtkWidget    *entry_message;
-       GtkWidget    *combobox_status;
-       GtkTreeModel *model_status;
-} CustomMessageDialog;
-
-static CustomMessageDialog *message_dialog = NULL;
 /* States to be listed in the menu.
  * Each state has a boolean telling if it can have custom message */
 static guint states[] = {MC_PRESENCE_AVAILABLE, TRUE,
@@ -130,7 +138,6 @@ static void            presence_chooser_set_state              (McPresence
                                                                const gchar                *status);
 static void            presence_chooser_custom_activate_cb     (GtkWidget                  *item,
                                                                gpointer                    user_data);
-static void            presence_chooser_dialog_show            (GtkWindow                  *parent);
 
 G_DEFINE_TYPE (EmpathyPresenceChooser, empathy_presence_chooser, GTK_TYPE_COMBO_BOX_ENTRY);
 
@@ -180,7 +187,8 @@ presence_chooser_create_model (EmpathyPresenceChooser *self)
                if (states[i+1]) {
 
                        /* Set custom messages if wanted */
-                       list = empathy_status_presets_get (states[i], 5);
+                       list = empathy_status_presets_get (states[i], -1);
+                       list = g_list_sort (list, (GCompareFunc) g_utf8_collate);
                        for (l = list; l; l = l->next) {
                                gtk_list_store_insert_with_values (store,
                                        NULL, -1,
@@ -576,7 +584,7 @@ presence_chooser_changed_cb (GtkComboBox *self, gpointer user_data)
        }
 
        if (type == ENTRY_TYPE_EDIT_CUSTOM) {
-               GtkWidget *window;
+               GtkWidget *window, *dialog;
 
                presence_chooser_reset_status (EMPATHY_PRESENCE_CHOOSER (self));
 
@@ -586,7 +594,9 @@ presence_chooser_changed_cb (GtkComboBox *self, gpointer user_data)
                        window = NULL;
                }
 
-               presence_chooser_dialog_show (GTK_WINDOW (window));
+               dialog = empathy_status_preset_dialog_new (GTK_WINDOW (window));
+               gtk_dialog_run (GTK_DIALOG (dialog));
+               gtk_widget_destroy (dialog);
        }
        else if (type == ENTRY_TYPE_CUSTOM) {
                gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
@@ -789,6 +799,13 @@ presence_chooser_finalize (GObject *object)
        G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object);
 }
 
+/**
+ * empathy_presence_chooser_new:
+ *
+ * Creates a new #EmpathyPresenceChooser widget.
+ *
+ * Return value: A new #EmpathyPresenceChooser widget
+ */
 GtkWidget *
 empathy_presence_chooser_new (void)
 {
@@ -946,6 +963,13 @@ presence_chooser_flash_stop (EmpathyPresenceChooser *chooser,
                                           empathy_icon_name_for_presence (state));
 }
 
+/**
+ * empathy_presence_chooser_create_menu:
+ *
+ * Creates a new #GtkMenu allowing users to change their presence from a menu.
+ *
+ * Return value: a new #GtkMenu for changing presence in a menu.
+ */
 GtkWidget *
 empathy_presence_chooser_create_menu (void)
 {
@@ -1058,220 +1082,9 @@ static void
 presence_chooser_custom_activate_cb (GtkWidget *item,
                                     gpointer   user_data)
 {
-       presence_chooser_dialog_show (NULL);
-}
-
-static McPresence
-presence_chooser_dialog_get_selected (CustomMessageDialog *dialog)
-{
-       GtkTreeModel *model;
-       GtkTreeIter   iter;
-       McPresence    presence = LAST_MC_PRESENCE;
+       GtkWidget *dialog;
 
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->combobox_status));
-       if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->combobox_status), &iter)) {
-               gtk_tree_model_get (model, &iter,
-                                   COL_PRESENCE, &presence,
-                                   -1);
-       }
-
-       return presence;
+       dialog = empathy_status_preset_dialog_new (NULL);
+       gtk_dialog_run (GTK_DIALOG (dialog));
+       gtk_widget_destroy (dialog);
 }
-
-static void
-presence_chooser_dialog_status_changed_cb (GtkWidget           *widget,
-                                          CustomMessageDialog *dialog)
-{
-       GtkListStore *store;
-       GtkTreeIter   iter;
-       McPresence    presence = LAST_MC_PRESENCE;
-       GList        *messages, *l;
-
-       presence = presence_chooser_dialog_get_selected (dialog);
-
-       store = gtk_list_store_new (1, G_TYPE_STRING);
-       messages = empathy_status_presets_get (presence, -1);
-       for (l = messages; l; l = l->next) {
-               gtk_list_store_append (store, &iter);
-               gtk_list_store_set (store, &iter, 0, l->data, -1);
-       }
-
-       gtk_entry_set_text (GTK_ENTRY (dialog->entry_message),
-                           messages ? messages->data : "");
-
-       g_list_free (messages);
-
-       gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->comboboxentry_message),
-                                GTK_TREE_MODEL (store));
-
-       g_object_unref (store);
-}
-
-static void
-presence_chooser_dialog_message_changed_cb (GtkWidget           *widget,
-                                           CustomMessageDialog *dialog)
-{
-       McPresence   presence;
-       GList       *messages, *l;
-       const gchar *text;
-       gboolean     found = FALSE;
-
-       presence = presence_chooser_dialog_get_selected (dialog);
-       text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
-
-       messages = empathy_status_presets_get (presence, -1);
-       for (l = messages; l; l = l->next) {
-               if (!tp_strdiff (text, l->data)) {
-                       found = TRUE;
-                       break;
-               }
-       }
-       g_list_free (messages);
-
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->checkbutton_save),
-                                     found);
-}
-
-static void
-presence_chooser_dialog_save_toggled_cb (GtkWidget           *widget,
-                                        CustomMessageDialog *dialog)
-{
-       gboolean     active;
-       McPresence   state;
-       const gchar *text;
-
-       active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbutton_save));
-       state = presence_chooser_dialog_get_selected (dialog);
-       text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
-
-       if (active) {
-               empathy_status_presets_set_last (state, text);
-       } else {
-               empathy_status_presets_remove (state, text);
-       }
-}
-
-static void
-presence_chooser_dialog_setup (CustomMessageDialog *dialog)
-{
-       GtkListStore    *store;
-       GtkCellRenderer *renderer;
-       GtkTreeIter      iter;
-       guint            i;
-
-       store = gtk_list_store_new (COL_COUNT,
-                                   G_TYPE_STRING,     /* Icon name */
-                                   G_TYPE_STRING,     /* Label     */
-                                   MC_TYPE_PRESENCE); /* Presence   */
-       gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->combobox_status),
-                                GTK_TREE_MODEL (store));
-
-       renderer = gtk_cell_renderer_pixbuf_new ();
-       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (dialog->combobox_status), renderer, FALSE);
-       gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (dialog->combobox_status), renderer,
-                                       "icon-name", COL_ICON,
-                                       NULL);
-       g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
-
-       renderer = gtk_cell_renderer_text_new ();
-       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (dialog->combobox_status), renderer, TRUE);
-       gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (dialog->combobox_status), renderer,
-                                       "text", COL_LABEL,
-                                       NULL);
-
-       for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
-               if (!states[i+1]) {
-                       continue;
-               }
-
-               gtk_list_store_append (store, &iter);
-               gtk_list_store_set (store, &iter,
-                                   COL_ICON, empathy_icon_name_for_presence (states[i]),
-                                   COL_LABEL, empathy_presence_get_default_message (states[i]),
-                                   COL_PRESENCE, states[i],
-                                   -1);
-       }
-
-       gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->combobox_status), 0);
-}
-
-static void
-presence_chooser_dialog_response_cb (GtkWidget           *widget,
-                                    gint                 response,
-                                    CustomMessageDialog *dialog)
-{
-       if (response == GTK_RESPONSE_APPLY) {
-               McPresence   state;
-               const gchar *text;
-
-               state = presence_chooser_dialog_get_selected (dialog);
-               text = gtk_entry_get_text (GTK_ENTRY (dialog->entry_message));
-
-               presence_chooser_set_state (state, text);
-       }
-
-       gtk_widget_destroy (widget);
-}
-
-static void
-presence_chooser_dialog_destroy_cb (GtkWidget           *widget,
-                                   CustomMessageDialog *dialog)
-{
-
-       g_free (dialog);
-       message_dialog = NULL;
-}
-
-static void
-presence_chooser_dialog_show (GtkWindow *parent)
-{
-       GtkBuilder *gui;
-       gchar      *filename;
-
-       if (message_dialog) {
-               gtk_window_present (GTK_WINDOW (message_dialog->dialog));
-               return;
-       }
-
-       message_dialog = g_new0 (CustomMessageDialog, 1);
-
-       filename = empathy_file_lookup ("empathy-presence-chooser.ui",
-                                       "libempathy-gtk");
-       gui = empathy_builder_get_file (filename,
-                                      "custom_message_dialog", &message_dialog->dialog,
-                                      "checkbutton_save", &message_dialog->checkbutton_save,
-                                      "comboboxentry_message", &message_dialog->comboboxentry_message,
-                                      "combobox_status", &message_dialog->combobox_status,
-                                      NULL);
-       g_free (filename);
-
-       empathy_builder_connect (gui, message_dialog,
-                              "custom_message_dialog", "destroy", presence_chooser_dialog_destroy_cb,
-                              "custom_message_dialog", "response", presence_chooser_dialog_response_cb,
-                              "combobox_status", "changed", presence_chooser_dialog_status_changed_cb,
-                              "checkbutton_save", "toggled", presence_chooser_dialog_save_toggled_cb,
-                              NULL);
-
-       g_object_unref (gui);
-
-       /* Setup the message combobox */
-       message_dialog->entry_message = GTK_BIN (message_dialog->comboboxentry_message)->child;
-       gtk_entry_set_activates_default (GTK_ENTRY (message_dialog->entry_message), TRUE);
-       gtk_entry_set_width_chars (GTK_ENTRY (message_dialog->entry_message), 25);
-       g_signal_connect (message_dialog->entry_message, "changed",
-                         G_CALLBACK (presence_chooser_dialog_message_changed_cb),
-                         message_dialog);
-
-       presence_chooser_dialog_setup (message_dialog);
-
-       gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (message_dialog->comboboxentry_message), 0);
-
-       if (parent) {
-               gtk_window_set_transient_for (
-                       GTK_WINDOW (message_dialog->dialog),
-                       parent);
-       }
-
-       gtk_widget_show_all (message_dialog->dialog);
-}
-
index 138e1dc7feec69f0be8ee7efe102a2b689e514b9..dab95f5537a043eace835c24bb55d61574fe5e1e 100644 (file)
@@ -43,6 +43,8 @@ typedef struct _EmpathyPresenceChooserClass EmpathyPresenceChooserClass;
 
 struct _EmpathyPresenceChooser {
        GtkComboBoxEntry parent;
+
+       /*<private>*/
        gpointer priv;
 };
 
diff --git a/libempathy-gtk/empathy-presence-chooser.ui b/libempathy-gtk/empathy-presence-chooser.ui
deleted file mode 100644 (file)
index 6e0a155..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkDialog" id="custom_message_dialog">
-    <property name="visible">True</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Custom message</property>
-    <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
-    <property name="has_separator">False</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox6">
-        <property name="visible">True</property>
-        <child>
-          <object class="GtkTable" id="table1">
-            <property name="visible">True</property>
-            <property name="border_width">5</property>
-            <property name="n_rows">3</property>
-            <property name="n_columns">2</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkComboBox" id="combobox_status">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkComboBoxEntry" id="comboboxentry_message">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="checkbutton_save">
-                <property name="label" translatable="yes">Save message</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="right_attach">2</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label472">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Message:</property>
-              </object>
-              <packing>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label471">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Status:</property>
-              </object>
-              <packing>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area6">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="closebutton1">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button1">
-                <property name="label">gtk-apply</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-6">closebutton1</action-widget>
-      <action-widget response="-10">button1</action-widget>
-    </action-widgets>
-  </object>
-</interface>
index fd68dd8b01bd50663d819cf7ef1e272de3d46ff3..10eb3791ab552a6e08169c0332511822c2f856f9 100644 (file)
 #include "empathy-profile-chooser.h"
 #include "empathy-ui-utils.h"
 
+/**
+ * SECTION:empathy-profile-chooser
+ * @title: EmpathyProfileChooser
+ * @short_description: A widget used to choose from a list of profiles
+ * @include: libempathy-gtk/empathy-account-chooser.h
+ *
+ * #EmpathyProfileChooser is a widget which provides a chooser of available
+ * profiles.
+ */
+
 enum {
        COL_ICON,
        COL_LABEL,
@@ -37,8 +47,17 @@ enum {
        COL_COUNT
 };
 
+/**
+ * empathy_profile_chooser_dup_selected:
+ * @widget: an #EmpathyProfileChooser
+ *
+ * Returns a new reference to the selected #McProfile in @widget. The returned
+ * #McProfile should be unrefed with g_object_unref() when finished with.
+ *
+ * Return value: a new reference to the selected #McProfile
+ */
 McProfile*
-empathy_profile_chooser_get_selected (GtkWidget *widget)
+empathy_profile_chooser_dup_selected (GtkWidget *widget)
 {
        GtkTreeModel *model;
        GtkTreeIter   iter;
@@ -54,6 +73,14 @@ empathy_profile_chooser_get_selected (GtkWidget *widget)
        return profile;
 }
 
+/**
+ * empathy_profile_chooser_n_profiles:
+ * @widget: an #EmpathyProfileChooser
+ *
+ * Returns the number of profiles in @widget.
+ *
+ * Return value: the number of profiles in @widget
+ */
 gint
 empathy_profile_chooser_n_profiles (GtkWidget *widget)
 {
@@ -115,6 +142,13 @@ profile_chooser_sort_func (GtkTreeModel *model,
        return cmp;
 }
 
+/**
+ * empathy_profile_chooser_new:
+ *
+ * Creates a new #EmpathyProfileChooser widget.
+ *
+ * Return value: a new #EmpathyProfileChooser widget
+ */
 GtkWidget *
 empathy_profile_chooser_new (void)
 {
index 8cdc33d678e0e301f166f455b3be0e1960e4ee0a..74c761cc4e6026245e956f6e908b9b6ad923e405 100644 (file)
@@ -27,7 +27,7 @@
 G_BEGIN_DECLS
 
 GtkWidget * empathy_profile_chooser_new          (void);
-McProfile * empathy_profile_chooser_get_selected (GtkWidget *widget);
+McProfile * empathy_profile_chooser_dup_selected (GtkWidget *widget);
 gint        empathy_profile_chooser_n_profiles   (GtkWidget *widget);
 
 G_END_DECLS
diff --git a/libempathy-gtk/empathy-spell-dialog.c b/libempathy-gtk/empathy-spell-dialog.c
deleted file mode 100644 (file)
index 9ce80ee..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2004-2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-
-#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-
-#include <libempathy/empathy-utils.h>
-
-#include "empathy-chat.h"
-#include "empathy-spell.h"
-#include "empathy-spell-dialog.h"
-#include "empathy-ui-utils.h"
-
-typedef struct {
-       GtkWidget   *window;
-       GtkWidget   *button_replace;
-       GtkWidget   *label_word;
-       GtkWidget   *treeview_words;
-
-       EmpathyChat  *chat;
-
-       gchar       *word;
-       GtkTextIter  start;
-       GtkTextIter  end;
-} EmpathySpellDialog;
-
-enum {
-       COL_SPELL_WORD,
-       COL_SPELL_COUNT
-};
-
-static void spell_dialog_model_populate_columns     (EmpathySpellDialog *dialog);
-static void spell_dialog_model_populate_suggestions (EmpathySpellDialog *dialog);
-static void spell_dialog_model_row_activated_cb     (GtkTreeView       *tree_view,
-                                                    GtkTreePath       *path,
-                                                    GtkTreeViewColumn *column,
-                                                    EmpathySpellDialog *dialog);
-static void spell_dialog_model_selection_changed_cb (GtkTreeSelection  *treeselection,
-                                                    EmpathySpellDialog *dialog);
-static void spell_dialog_model_setup                (EmpathySpellDialog *dialog);
-static void spell_dialog_response_cb                (GtkWidget         *widget,
-                                                    gint               response,
-                                                    EmpathySpellDialog *dialog);
-static void spell_dialog_destroy_cb                 (GtkWidget         *widget,
-                                                    EmpathySpellDialog *dialog);
-
-static void
-spell_dialog_model_populate_columns (EmpathySpellDialog *dialog)
-{
-       GtkTreeModel      *model;
-       GtkTreeViewColumn *column;
-       GtkCellRenderer   *renderer;
-       guint              col_offset;
-
-       model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_words));
-
-       renderer = gtk_cell_renderer_text_new ();
-       col_offset = gtk_tree_view_insert_column_with_attributes (
-               GTK_TREE_VIEW (dialog->treeview_words),
-               -1, _("Word"),
-               renderer,
-               "text", COL_SPELL_WORD,
-               NULL);
-
-       g_object_set_data (G_OBJECT (renderer),
-                          "column", GINT_TO_POINTER (COL_SPELL_WORD));
-
-       column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_words), col_offset - 1);
-       gtk_tree_view_column_set_sort_column_id (column, COL_SPELL_WORD);
-       gtk_tree_view_column_set_resizable (column, FALSE);
-       gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-}
-
-static void
-spell_dialog_model_populate_suggestions (EmpathySpellDialog *dialog)
-{
-       GtkTreeModel *model;
-       GtkListStore *store;
-       GList        *suggestions, *l;
-
-       model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_words));
-       store = GTK_LIST_STORE (model);
-
-       suggestions = empathy_spell_get_suggestions (dialog->word);
-       for (l = suggestions; l; l=l->next) {
-               GtkTreeIter  iter;
-               gchar       *word;
-
-               word = l->data;
-
-               gtk_list_store_append (store, &iter);
-               gtk_list_store_set (store, &iter,
-                                   COL_SPELL_WORD, word,
-                                   -1);
-       }
-
-       empathy_spell_free_suggestions (suggestions);
-}
-
-static void
-spell_dialog_model_row_activated_cb (GtkTreeView       *tree_view,
-                              GtkTreePath       *path,
-                              GtkTreeViewColumn *column,
-                              EmpathySpellDialog *dialog)
-{
-       spell_dialog_response_cb (dialog->window, GTK_RESPONSE_OK, dialog);
-}
-
-static void
-spell_dialog_model_selection_changed_cb (GtkTreeSelection  *treeselection,
-                                  EmpathySpellDialog *dialog)
-{
-       gint count;
-
-       count = gtk_tree_selection_count_selected_rows (treeselection);
-       gtk_widget_set_sensitive (dialog->button_replace, (count == 1));
-}
-
-static void
-spell_dialog_model_setup (EmpathySpellDialog *dialog)
-{
-       GtkTreeView      *view;
-       GtkListStore     *store;
-       GtkTreeSelection *selection;
-
-       view = GTK_TREE_VIEW (dialog->treeview_words);
-
-       g_signal_connect (view, "row-activated",
-                         G_CALLBACK (spell_dialog_model_row_activated_cb),
-                         dialog);
-
-       store = gtk_list_store_new (COL_SPELL_COUNT,
-                                   G_TYPE_STRING);   /* word */
-
-       gtk_tree_view_set_model (view, GTK_TREE_MODEL (store));
-
-       selection = gtk_tree_view_get_selection (view);
-       gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
-       g_signal_connect (selection, "changed",
-                         G_CALLBACK (spell_dialog_model_selection_changed_cb),
-                         dialog);
-
-       spell_dialog_model_populate_columns (dialog);
-       spell_dialog_model_populate_suggestions (dialog);
-
-       g_object_unref (store);
-}
-
-static void
-spell_dialog_destroy_cb (GtkWidget         *widget,
-                        EmpathySpellDialog *dialog)
-{
-       g_object_unref (dialog->chat);
-       g_free (dialog->word);
-
-       g_free (dialog);
-}
-
-static void
-spell_dialog_response_cb (GtkWidget         *widget,
-                         gint               response,
-                         EmpathySpellDialog *dialog)
-{
-       if (response == GTK_RESPONSE_OK) {
-               GtkTreeView      *view;
-               GtkTreeModel     *model;
-               GtkTreeSelection *selection;
-               GtkTreeIter       iter;
-
-               gchar            *new_word;
-
-               view = GTK_TREE_VIEW (dialog->treeview_words);
-               selection = gtk_tree_view_get_selection (view);
-
-               if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
-                       return;
-               }
-
-               gtk_tree_model_get (model, &iter, COL_SPELL_WORD, &new_word, -1);
-
-               empathy_chat_correct_word (dialog->chat,
-                                         &dialog->start,
-                                         &dialog->end,
-                                         new_word);
-
-               g_free (new_word);
-       }
-
-       gtk_widget_destroy (dialog->window);
-}
-
-void
-empathy_spell_dialog_show (EmpathyChat  *chat,
-                         GtkTextIter *start,
-                         GtkTextIter *end,
-                         const gchar *word)
-{
-       EmpathySpellDialog *dialog;
-       GtkBuilder         *gui;
-       gchar              *str;
-       gchar              *filename;
-
-       g_return_if_fail (chat != NULL);
-       g_return_if_fail (word != NULL);
-
-       dialog = g_new0 (EmpathySpellDialog, 1);
-
-       dialog->chat = g_object_ref (chat);
-
-       dialog->word = g_strdup (word);
-
-       dialog->start = *start;
-       dialog->end = *end;
-
-       filename = empathy_file_lookup ("empathy-spell-dialog.ui",
-                                       "libempathy-gtk");
-       gui = empathy_builder_get_file (filename,
-                                    "spell_dialog", &dialog->window,
-                                    "button_replace", &dialog->button_replace,
-                                    "label_word", &dialog->label_word,
-                                    "treeview_words", &dialog->treeview_words,
-                                    NULL);
-       g_free (filename);
-
-       empathy_builder_connect (gui, dialog,
-                             "spell_dialog", "response", spell_dialog_response_cb,
-                             "spell_dialog", "destroy", spell_dialog_destroy_cb,
-                             NULL);
-
-       g_object_unref (gui);
-
-       str = g_markup_printf_escaped ("%s:\n<b>%s</b>",
-                              _("Suggestions for the word"),
-                              word);
-
-       gtk_label_set_markup (GTK_LABEL (dialog->label_word), str);
-       g_free (str);
-
-       spell_dialog_model_setup (dialog);
-
-       gtk_widget_show (dialog->window);
-}
diff --git a/libempathy-gtk/empathy-spell-dialog.h b/libempathy-gtk/empathy-spell-dialog.h
deleted file mode 100644 (file)
index ce02188..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2004-2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Martyn Russell <martyn@imendio.com>
- *          Richard Hult <richard@imendio.com>
- */
-
-#ifndef __EMPATHY_SPELL_DIALOG_H__
-#define __EMPATHY_SPELL_DIALOG_H__
-
-#include <gtk/gtktextiter.h>
-#include "empathy-chat.h"
-
-G_BEGIN_DECLS
-
-void empathy_spell_dialog_show (EmpathyChat  *chat,
-                              GtkTextIter *start,
-                              GtkTextIter *end,
-                              const gchar *word);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_SPELL_DIALOG_H__ */
diff --git a/libempathy-gtk/empathy-spell-dialog.ui b/libempathy-gtk/empathy-spell-dialog.ui
deleted file mode 100644 (file)
index 382346c..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
-<interface>
-  <object class="GtkDialog" id="spell_dialog">
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Spell Checker</property>
-    <property name="modal">True</property>
-    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
-    <property name="default_width">275</property>
-    <property name="default_height">225</property>
-    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-    <property name="has_separator">False</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox7">
-        <property name="visible">True</property>
-        <property name="spacing">2</property>
-        <child>
-          <object class="GtkVBox" id="vbox128">
-            <property name="visible">True</property>
-            <property name="border_width">5</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkLabel" id="label_word">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Suggestions for the word:</property>
-                <property name="use_markup">True</property>
-                <property name="wrap">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow9">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                <property name="shadow_type">GTK_SHADOW_IN</property>
-                <child>
-                  <object class="GtkTreeView" id="treeview_words">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="headers_visible">False</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area7">
-            <property name="visible">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <object class="GtkButton" id="button_cancel">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-cancel</property>
-                <property name="use_stock">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkButton" id="button_replace">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment6">
-                    <property name="visible">True</property>
-                    <property name="xscale">0</property>
-                    <property name="yscale">0</property>
-                    <child>
-                      <object class="GtkHBox" id="hbox135">
-                        <property name="visible">True</property>
-                        <property name="spacing">2</property>
-                        <child>
-                          <object class="GtkImage" id="image245">
-                            <property name="visible">True</property>
-                            <property name="stock">gtk-convert</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label594">
-                            <property name="visible">True</property>
-                            <property name="label">_Replace</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">GTK_PACK_END</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-6">button_cancel</action-widget>
-      <action-widget response="-5">button_replace</action-widget>
-    </action-widgets>
-  </object>
-</interface>
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
new file mode 100644 (file)
index 0000000..734ac35
--- /dev/null
@@ -0,0 +1,549 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * empathy-status-preset-dialog.c
+ *
+ * EmpathyStatusPresetDialog - a dialog for adding and removing preset status
+ * messages.
+ *
+ * Copyright (C) 2009 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Davyd Madeley <davyd.madeley@collabora.co.uk>
+ */
+/**
+ * SECTION:empathy-status-preset-dialog
+ * @title: EmpathyStatusPresetDialog
+ * @short_description: a dialog for editing the saved status messages
+ * @include: libempathy-gtk/empathy-status-preset-dialog.h
+ *
+ * #EmpathyStatusPresetDialog is a dialog allowing the user to add/remove/edit
+ * their saved status messages.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+
+#include <libmissioncontrol/mc-enum-types.h>
+
+#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-status-presets.h>
+
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include <libempathy/empathy-debug.h>
+
+#include "empathy-ui-utils.h"
+#include "empathy-status-preset-dialog.h"
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyStatusPresetDialog)
+
+G_DEFINE_TYPE (EmpathyStatusPresetDialog, empathy_status_preset_dialog, GTK_TYPE_DIALOG);
+
+static McPresence states[] = {
+       MC_PRESENCE_AVAILABLE,
+       MC_PRESENCE_DO_NOT_DISTURB,
+       MC_PRESENCE_AWAY
+};
+
+typedef struct _EmpathyStatusPresetDialogPriv EmpathyStatusPresetDialogPriv;
+struct _EmpathyStatusPresetDialogPriv
+{
+       /* block status_preset_dialog_add_combo_changed() when > 0 */
+       int block_add_combo_changed;
+
+       GtkWidget *presets_treeview;
+       GtkWidget *add_combobox;
+       GtkWidget *add_button;
+
+       GtkTreeIter selected_iter;
+       gboolean add_combo_changed;
+       char *saved_status;
+};
+
+enum
+{
+       PRESETS_STORE_STATE,
+       PRESETS_STORE_ICON_NAME,
+       PRESETS_STORE_STATUS,
+       PRESETS_STORE_N_COLS
+};
+
+enum
+{
+       ADD_COMBO_STATE,
+       ADD_COMBO_ICON_NAME,
+       ADD_COMBO_STATUS,
+       ADD_COMBO_DEFAULT_TEXT,
+       ADD_COMBO_N_COLS
+};
+
+static void
+empathy_status_preset_dialog_finalize (GObject *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+
+       g_free (priv->saved_status);
+
+       G_OBJECT_CLASS (empathy_status_preset_dialog_parent_class)->finalize (self);
+}
+
+static void
+empathy_status_preset_dialog_class_init (EmpathyStatusPresetDialogClass *class)
+{
+       GObjectClass *gobject_class;
+
+       gobject_class = G_OBJECT_CLASS (class);
+       gobject_class->finalize = empathy_status_preset_dialog_finalize;
+
+       g_type_class_add_private (gobject_class,
+                       sizeof (EmpathyStatusPresetDialogPriv));
+}
+
+static void
+status_preset_dialog_presets_update (EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkListStore *store;
+       int i;
+
+       store = GTK_LIST_STORE (gtk_tree_view_get_model (
+                               GTK_TREE_VIEW (priv->presets_treeview)));
+
+       gtk_list_store_clear (store);
+
+       for (i = 0; i < G_N_ELEMENTS (states); i++) {
+               GList *presets, *l;
+               const char *icon_name;
+
+               icon_name = empathy_icon_name_for_presence (states[i]);
+               presets = empathy_status_presets_get (states[i], -1);
+               presets = g_list_sort (presets, (GCompareFunc) g_utf8_collate);
+
+               for (l = presets; l; l = l->next) {
+                       char *preset = (char *) l->data;
+
+                       gtk_list_store_insert_with_values (store,
+                                       NULL, -1,
+                                       PRESETS_STORE_STATE, states[i],
+                                       PRESETS_STORE_ICON_NAME, icon_name,
+                                       PRESETS_STORE_STATUS, preset,
+                                       -1);
+               }
+
+               g_list_free (presets);
+       }
+}
+
+static void
+status_preset_add_combo_reset (EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+
+       gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->add_combobox),
+                       &priv->selected_iter);
+}
+
+static void
+status_preset_dialog_setup_add_combobox (EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkWidget *combobox = priv->add_combobox;
+       GtkListStore *store;
+       GtkCellRenderer *renderer;
+       int i;
+
+       store = gtk_list_store_new (ADD_COMBO_N_COLS,
+                       MC_TYPE_PRESENCE,       /* ADD_COMBO_STATE */
+                       G_TYPE_STRING,          /* ADD_COMBO_ICON_NAME */
+                       G_TYPE_STRING,          /* ADD_COMBO_STATUS */
+                       G_TYPE_STRING);         /* ADD_COMBO_DEFAULT_TEXT */
+
+       gtk_combo_box_set_model (GTK_COMBO_BOX (combobox),
+                                GTK_TREE_MODEL (store));
+       g_object_unref (store);
+
+       gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combobox),
+                       ADD_COMBO_DEFAULT_TEXT);
+
+       for (i = 0; i < G_N_ELEMENTS (states); i++) {
+               gtk_list_store_insert_with_values (store, NULL, -1,
+                               ADD_COMBO_STATE, states[i],
+                               ADD_COMBO_ICON_NAME, empathy_icon_name_for_presence (states[i]),
+                               ADD_COMBO_STATUS, empathy_presence_get_default_message (states[i]),
+                               ADD_COMBO_DEFAULT_TEXT, "",
+                               -1);
+       }
+
+       gtk_cell_layout_clear (GTK_CELL_LAYOUT (combobox));
+
+       renderer = gtk_cell_renderer_pixbuf_new ();
+       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, FALSE);
+       gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox), renderer,
+                       "icon-name", ADD_COMBO_ICON_NAME);
+
+       renderer = gtk_cell_renderer_text_new ();
+       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
+       gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox), renderer,
+                       "text", ADD_COMBO_STATUS);
+       g_object_set (renderer,
+                       "style", PANGO_STYLE_ITALIC,
+                       "foreground", "Gray", /* FIXME - theme */
+                       NULL);
+
+       gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
+}
+
+static void
+status_preset_dialog_status_edited (GtkCellRendererText *renderer,
+                                   char *path_str,
+                                   char *new_status,
+                                   EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkTreeModel *model;
+       GtkTreePath *path;
+       GtkTreeIter iter;
+       McPresence state;
+       char *old_status;
+       gboolean valid;
+
+       if (strlen (new_status) == 0) {
+               /* status is empty, ignore */
+               return;
+       }
+
+       model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->presets_treeview));
+       path = gtk_tree_path_new_from_string (path_str);
+       valid = gtk_tree_model_get_iter (model, &iter, path);
+       gtk_tree_path_free (path);
+
+       if (!valid) return;
+
+       gtk_tree_model_get (model, &iter,
+                       PRESETS_STORE_STATE, &state,
+                       PRESETS_STORE_STATUS, &old_status,
+                       -1);
+
+       if (!strcmp (old_status, new_status)) {
+               /* statuses are the same */
+               g_free (old_status);
+               return;
+       }
+
+       DEBUG ("EDITED STATUS (%s) -> (%s)\n", old_status, new_status);
+
+       empathy_status_presets_remove (state, old_status);
+       empathy_status_presets_set_last (state, new_status);
+
+       g_free (old_status);
+
+       status_preset_dialog_presets_update (self);
+}
+
+static void
+status_preset_dialog_setup_presets_treeview (EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkWidget *treeview = priv->presets_treeview;
+       GtkListStore *store;
+       GtkTreeViewColumn *column;
+       GtkCellRenderer *renderer;
+
+       store = gtk_list_store_new (PRESETS_STORE_N_COLS,
+                       MC_TYPE_PRESENCE,       /* PRESETS_STORE_STATE */
+                       G_TYPE_STRING,          /* PRESETS_STORE_ICON_NAME */
+                       G_TYPE_STRING);         /* PRESETS_STORE_STATUS */
+
+       gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
+                                GTK_TREE_MODEL (store));
+       g_object_unref (store);
+
+       status_preset_dialog_presets_update (self);
+
+       column = gtk_tree_view_column_new ();
+       gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+       renderer = gtk_cell_renderer_pixbuf_new ();
+       gtk_tree_view_column_pack_start (column, renderer, FALSE);
+       gtk_tree_view_column_add_attribute (column, renderer,
+                       "icon-name", PRESETS_STORE_ICON_NAME);
+
+       renderer = gtk_cell_renderer_text_new ();
+       gtk_tree_view_column_pack_start (column, renderer, TRUE);
+       gtk_tree_view_column_add_attribute (column, renderer,
+                       "text", PRESETS_STORE_STATUS);
+       g_object_set (renderer,
+                       "editable", TRUE,
+                       NULL);
+       g_signal_connect (renderer, "edited",
+                       G_CALLBACK (status_preset_dialog_status_edited), self);
+}
+
+static void
+status_preset_dialog_preset_selection_changed (GtkTreeSelection *selection,
+                                              GtkWidget *remove_button)
+{
+       /* update the sensitivity of the Remove button */
+       gtk_widget_set_sensitive (remove_button,
+                       gtk_tree_selection_get_selected (selection, NULL, NULL));
+}
+
+static void
+status_preset_dialog_preset_remove (GtkButton *button,
+                                   EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkTreeSelection *selection;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       McPresence state;
+       char *status;
+
+       selection = gtk_tree_view_get_selection (
+                       GTK_TREE_VIEW (priv->presets_treeview));
+
+       g_return_if_fail (gtk_tree_selection_get_selected (selection,
+                               &model, &iter));
+
+       gtk_tree_model_get (model, &iter,
+                       PRESETS_STORE_STATE, &state,
+                       PRESETS_STORE_STATUS, &status,
+                       -1);
+
+       DEBUG ("REMOVE PRESET (%i, %s)\n", state, status);
+       empathy_status_presets_remove (state, status);
+
+       g_free (status);
+
+       status_preset_dialog_presets_update (self);
+}
+
+static void
+status_preset_dialog_set_add_combo_changed (EmpathyStatusPresetDialog *self,
+                                           gboolean state,
+                                           gboolean reset_text)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkWidget *entry;
+
+       entry = gtk_bin_get_child (GTK_BIN (priv->add_combobox));
+
+       priv->add_combo_changed = state;
+       gtk_widget_set_sensitive (priv->add_button, state);
+
+       if (state) {
+               gtk_widget_modify_text (entry, GTK_STATE_NORMAL, NULL);
+       } else {
+               GdkColor colour;
+
+               gdk_color_parse ("Gray", &colour); /* FIXME - theme */
+               gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &colour);
+
+               if (reset_text) {
+                       priv->block_add_combo_changed++;
+                       gtk_entry_set_text (GTK_ENTRY (entry),
+                                       _("Enter Custom Message"));
+                       priv->block_add_combo_changed--;
+               }
+       }
+}
+
+static void
+status_preset_dialog_add_combo_changed (GtkComboBox *combo,
+                                       EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkWidget *entry;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+
+       if (priv->block_add_combo_changed) return;
+
+       model = gtk_combo_box_get_model (combo);
+       entry = gtk_bin_get_child (GTK_BIN (combo));
+
+       if (gtk_combo_box_get_active_iter (combo, &iter)) {
+               char *icon_name;
+
+               priv->selected_iter = iter;
+               gtk_tree_model_get (model, &iter,
+                               PRESETS_STORE_ICON_NAME, &icon_name,
+                               -1);
+
+               gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+                               GTK_ENTRY_ICON_PRIMARY,
+                               icon_name);
+
+               g_free (icon_name);
+
+               status_preset_dialog_set_add_combo_changed (self, FALSE, TRUE);
+               if (priv->saved_status && strlen (priv->saved_status) > 0) {
+                       gtk_entry_set_text (GTK_ENTRY (entry),
+                                       priv->saved_status);
+               }
+       } else {
+               g_free (priv->saved_status);
+               priv->saved_status = g_strdup (
+                               gtk_entry_get_text (GTK_ENTRY (entry)));
+
+               status_preset_dialog_set_add_combo_changed (self,
+                               strlen (priv->saved_status) > 0, FALSE);
+       }
+}
+
+static void
+status_preset_dialog_add_preset (GtkWidget *widget,
+                                EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       GtkTreeModel *model;
+       GtkWidget *entry;
+       McPresence state;
+       const char *status;
+
+       g_return_if_fail (priv->add_combo_changed);
+
+       model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->add_combobox));
+       entry = gtk_bin_get_child (GTK_BIN (priv->add_combobox));
+
+       status = gtk_entry_get_text (GTK_ENTRY (entry));
+       gtk_tree_model_get (model, &priv->selected_iter,
+                       PRESETS_STORE_STATE, &state,
+                       -1);
+
+       DEBUG ("ADD PRESET (%i, %s)\n", state, status);
+       empathy_status_presets_set_last (state, status);
+
+       status_preset_dialog_presets_update (self);
+       status_preset_add_combo_reset (self);
+}
+
+static gboolean
+status_preset_dialog_add_combo_press_event (GtkWidget *widget,
+                                           GdkEventButton *event,
+                                           EmpathyStatusPresetDialog *self)
+{
+       if (!GTK_WIDGET_HAS_FOCUS (widget)) {
+               /* if the widget isn't focused, focus it and select the text */
+               gtk_widget_grab_focus (widget);
+               gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
+
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+static gboolean
+status_preset_dialog_add_combo_focus_out (GtkWidget *widget,
+                                         GdkEventFocus *event,
+                                         EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+       const char *status;
+
+       gtk_editable_set_position (GTK_EDITABLE (widget), 0);
+
+       status = gtk_entry_get_text (GTK_ENTRY (widget));
+       status_preset_dialog_set_add_combo_changed (self,
+                       priv->add_combo_changed && strlen (status) > 0,
+                       TRUE);
+
+       return FALSE;
+}
+
+static void
+empathy_status_preset_dialog_init (EmpathyStatusPresetDialog *self)
+{
+       EmpathyStatusPresetDialogPriv *priv = self->priv =
+               G_TYPE_INSTANCE_GET_PRIVATE (self,
+                       EMPATHY_TYPE_STATUS_PRESET_DIALOG,
+                       EmpathyStatusPresetDialogPriv);
+       GtkBuilder *gui;
+       GtkWidget *toplevel_vbox, *remove_button, *entry;
+       char *filename;
+
+       gtk_window_set_title (GTK_WINDOW (self),
+                       _("Edit Custom Messages"));
+       gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+       gtk_dialog_add_button (GTK_DIALOG (self),
+                       GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+
+       filename = empathy_file_lookup ("empathy-status-preset-dialog.ui",
+                       "libempathy-gtk");
+       gui = empathy_builder_get_file (filename,
+                       "toplevel-vbox", &toplevel_vbox,
+                       "presets-treeview", &priv->presets_treeview,
+                       "remove-button", &remove_button,
+                       "add-combobox", &priv->add_combobox,
+                       "add-button", &priv->add_button,
+                       NULL);
+       g_free (filename);
+
+       g_signal_connect (gtk_tree_view_get_selection (
+                               GTK_TREE_VIEW (priv->presets_treeview)),
+                       "changed",
+                       G_CALLBACK (status_preset_dialog_preset_selection_changed),
+                       remove_button);
+
+       entry = gtk_bin_get_child (GTK_BIN (priv->add_combobox));
+       g_signal_connect (entry, "activate",
+                       G_CALLBACK (status_preset_dialog_add_preset), self);
+       g_signal_connect (entry, "button-press-event",
+                       G_CALLBACK (status_preset_dialog_add_combo_press_event),
+                       self);
+       g_signal_connect (entry, "focus-out-event",
+                       G_CALLBACK (status_preset_dialog_add_combo_focus_out),
+                       self);
+
+       empathy_builder_connect (gui, self,
+                       "remove-button", "clicked", status_preset_dialog_preset_remove,
+                       "add-combobox", "changed", status_preset_dialog_add_combo_changed,
+                       "add-button", "clicked", status_preset_dialog_add_preset,
+                       NULL);
+
+       status_preset_dialog_setup_presets_treeview (self);
+       status_preset_dialog_setup_add_combobox (self);
+
+       gtk_box_pack_start(GTK_BOX (GTK_DIALOG (self)->vbox), toplevel_vbox,
+                       TRUE, TRUE, 0);
+
+       g_object_unref (gui);
+}
+
+/**
+ * empathy_status_preset_dialog_new:
+ * @parent: the parent window of this dialog (or NULL)
+ *
+ * Creates a new #EmpathyStatusPresetDialog that allows the user to
+ * add/remove/edit their saved status messages.
+ *
+ * Returns: the newly constructed dialog.
+ */
+GtkWidget *
+empathy_status_preset_dialog_new (GtkWindow *parent)
+{
+       GtkWidget *self = g_object_new (EMPATHY_TYPE_STATUS_PRESET_DIALOG,
+                       NULL);
+
+       if (parent) {
+               gtk_window_set_transient_for (GTK_WINDOW (self), parent);
+       }
+
+       return self;
+}
diff --git a/libempathy-gtk/empathy-status-preset-dialog.h b/libempathy-gtk/empathy-status-preset-dialog.h
new file mode 100644 (file)
index 0000000..e53c3d8
--- /dev/null
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * empathy-status-preset-dialog.c
+ *
+ * EmpathyStatusPresetDialog - a dialog for adding and removing preset status
+ * messages.
+ *
+ * Copyright (C) 2009 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Davyd Madeley <davyd.madeley@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_STATUS_PRESET_DIALOG_H__
+#define __EMPATHY_STATUS_PRESET_DIALOG_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_STATUS_PRESET_DIALOG      (empathy_status_preset_dialog_get_type ())
+#define EMPATHY_STATUS_PRESET_DIALOG(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_STATUS_PRESET_DIALOG, EmpathyStatusPresetDialog))
+#define EMPATHY_STATUS_PRESET_DIALOG_CLASS(obj)        (G_TYPE_CHECK_CLASS_CAST ((obj), EMPATHY_TYPE_STATUS_PRESET_DIALOG, EmpathyStatusPresetDialogClass))
+#define EMPATHY_IS_STATUS_PRESET_DIALOG(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_STATUS_PRESET_DIALOG))
+#define EMPATHY_IS_STATUS_PRESET_DIALOG_CLASS(obj)     (G_TYPE_CHECK_CLASS_TYPE ((obj), EMPATHY_TYPE_STATUS_PRESET_DIALOG))
+#define EMPATHY_STATUS_PRESET_DIALOG_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_STATUS_PRESET_DIALOG, EmpathyStatusPresetDialogClass))
+
+typedef struct _EmpathyStatusPresetDialog EmpathyStatusPresetDialog;
+typedef struct _EmpathyStatusPresetDialogClass EmpathyStatusPresetDialogClass;
+
+struct _EmpathyStatusPresetDialog
+{
+       GtkDialog parent;
+
+       /*< private >*/
+       gpointer priv;
+};
+
+struct _EmpathyStatusPresetDialogClass
+{
+       GtkDialogClass parent_class;
+};
+
+GType empathy_status_preset_dialog_get_type (void);
+GtkWidget *empathy_status_preset_dialog_new (GtkWindow *parent);
+
+G_END_DECLS
+
+#endif
diff --git a/libempathy-gtk/empathy-status-preset-dialog.ui b/libempathy-gtk/empathy-status-preset-dialog.ui
new file mode 100644 (file)
index 0000000..ead8ab8
--- /dev/null
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkVBox" id="toplevel-vbox">
+    <property name="visible">True</property>
+    <property name="border_width">6</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Saved Presets</property>
+        <property name="mnemonic_widget">add-combobox</property>
+        <attributes>
+          <attribute name="weight" value="bold"/>
+        </attributes>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow" id="scrolledwindow1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hscrollbar_policy">never</property>
+        <property name="shadow_type">etched-in</property>
+        <child>
+          <object class="GtkTreeView" id="presets-treeview">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="headers_visible">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHButtonBox" id="hbuttonbox1">
+        <property name="visible">True</property>
+        <property name="layout_style">end</property>
+        <child>
+          <object class="GtkButton" id="remove-button">
+            <property name="label" translatable="yes">gtk-remove</property>
+            <property name="visible">True</property>
+            <property name="sensitive">False</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Add _New Preset</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">add-combobox</property>
+        <attributes>
+          <attribute name="weight" value="bold"/>
+        </attributes>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="hbox1">
+        <property name="visible">True</property>
+        <property name="spacing">3</property>
+        <child>
+          <object class="GtkComboBoxEntry" id="add-combobox">
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="add-button">
+            <property name="label" translatable="yes">gtk-add</property>
+            <property name="visible">True</property>
+            <property name="sensitive">False</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
index 0561ecac050e7f192cfcede7c4ec485b0ed02df9..5b435f1d5d9cd9aff3ee05b80ebec9f0c2ad1f07 100644 (file)
@@ -208,9 +208,9 @@ theme_boxes_maybe_append_header (EmpathyThemeBoxes *theme,
        DEBUG ("Maybe add fancy header");
 
        /* Only insert a header if the previously inserted block is not the same
-        * as this one. This catches all the different cases:
+        * as this one.
         */
-       if (last_contact && empathy_contact_equal (last_contact, contact)) {
+       if (last_contact == contact) {
                return;
        }
 
index aa34928998e4feac39d6dcd23127a49e47be6e54..9a249e65be2663beea79c4d37cfa9dbea5b05644 100644 (file)
@@ -102,7 +102,7 @@ builder_get_file_valist (const gchar *filename,
 
        gui = gtk_builder_new ();
        if (!gtk_builder_add_from_file (gui, filename, &error)) {
-               DEBUG ("Error: %s", error->message);
+               g_critical ("GtkBuilder Error: %s", error->message);
                g_clear_error (&error);
                g_object_unref (gui);
                return NULL;
index f82f4cc0fd1c08af946afb3e33328c0ff8ad9df2..ba1f6f8c71cba5edeac9e722e949aa90aa89345c 100644 (file)
@@ -21,10 +21,9 @@ libempathy_la_SOURCES =                                      \
        empathy-account-manager.c                       \
        empathy-chatroom.c                              \
        empathy-chatroom-manager.c                      \
-       empathy-call-factory.c                  \
-       empathy-call-handler.c                  \
+       empathy-call-factory.c                          \
+       empathy-call-handler.c                          \
        empathy-contact.c                               \
-       empathy-contact-factory.c                       \
        empathy-contact-groups.c                        \
        empathy-contact-list.c                          \
        empathy-contact-manager.c                       \
@@ -47,7 +46,6 @@ libempathy_la_SOURCES =                                       \
        empathy-tp-contact-factory.c                    \
        empathy-tp-contact-list.c                       \
        empathy-tp-file.c                               \
-       empathy-tp-group.c                              \
        empathy-tp-roomlist.c                           \
        empathy-tp-tube.c                               \
        empathy-tube-handler.c                          \
@@ -72,7 +70,6 @@ libempathy_headers =                          \
        empathy-call-factory.h                  \
        empathy-call-handler.h                  \
        empathy-contact.h                       \
-       empathy-contact-factory.h               \
        empathy-contact-groups.h                \
        empathy-contact-list.h                  \
        empathy-contact-manager.h               \
@@ -95,7 +92,6 @@ libempathy_headers =                          \
        empathy-tp-contact-factory.h            \
        empathy-tp-contact-list.h               \
        empathy-tp-file.h                       \
-       empathy-tp-group.h                      \
        empathy-tp-roomlist.h                   \
        empathy-tp-tube.h                       \
        empathy-tube-handler.h                  \
index 5962a86767a17d1eb6c59ec8afc60c4fb9ca4a98..b84543176757fcddb7c169c1950270f0f5cd74d3 100644 (file)
 #include "empathy-marshal.h"
 #include "empathy-utils.h"
 
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
+
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountManager)
 
 typedef struct {
   McAccountMonitor *monitor;
   MissionControl   *mc;
 
-  GHashTable       *accounts;
+  GHashTable       *accounts; /* McAccount -> AccountData */
+  GHashTable       *connections; /* TpConnection -> McAccount */
   int               connected;
   int               connecting;
   gboolean          dispose_run;
 } EmpathyAccountManagerPriv;
 
 typedef struct {
+  TpConnection *connection;
   McPresence presence;
   TpConnectionStatus status;
   gboolean is_enabled;
@@ -54,6 +59,7 @@ enum {
   ACCOUNT_CHANGED,
   ACCOUNT_CONNECTION_CHANGED,
   ACCOUNT_PRESENCE_CHANGED,
+  NEW_CONNECTION,
   LAST_SIGNAL
 };
 
@@ -112,10 +118,74 @@ account_data_free (AccountData *data)
       g_source_remove (data->source_id);
       data->source_id = 0;
     }
+  if (data->connection != NULL)
+    {
+      g_object_unref (data->connection);
+      data->connection = NULL;
+    }
 
   g_slice_free (AccountData, data);
 }
 
+static void
+connection_invalidated_cb (TpProxy *connection,
+                           guint    domain,
+                           gint     code,
+                           gchar   *message,
+                           EmpathyAccountManager *manager)
+{
+  EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+  McAccount *account;
+  AccountData *data;
+
+  DEBUG ("Message: %s", message);
+
+  account = g_hash_table_lookup (priv->connections, connection);
+  g_assert (account != NULL);
+
+  data = g_hash_table_lookup (priv->accounts, account);
+  g_assert (data != NULL);
+
+  g_object_unref (data->connection);
+  data->connection = NULL;
+
+  g_hash_table_remove (priv->connections, connection);
+}
+
+static void
+connection_ready_cb (TpConnection *connection,
+                     const GError *error,
+                     gpointer manager)
+{
+  /* Errors will be handled in invalidated callback */
+  if (error != NULL)
+    return;
+
+  g_signal_emit (manager, signals[NEW_CONNECTION], 0, connection);
+}
+
+static void
+account_manager_update_connection (EmpathyAccountManager *manager,
+                                   AccountData *data,
+                                   McAccount *account)
+{
+  EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+
+  if (data->connection)
+    return;
+
+  data->connection = mission_control_get_tpconnection (priv->mc, account, NULL);
+  if (data->connection != NULL)
+    {
+      g_signal_connect (data->connection, "invalidated",
+          G_CALLBACK (connection_invalidated_cb), manager);
+      g_hash_table_insert (priv->connections, g_object_ref (data->connection),
+          g_object_ref (account));
+      tp_connection_call_when_ready (data->connection, connection_ready_cb,
+          manager);
+    }
+}
+
 static void
 account_created_cb (McAccountMonitor *mon,
                     gchar *account_name,
@@ -132,6 +202,7 @@ account_created_cb (McAccountMonitor *mon,
       AccountData *data;
 
       data = account_data_new_default (priv->mc, account);
+      g_hash_table_insert (priv->accounts, g_object_ref (account), data);
 
       initial_status = mission_control_get_connection_status (priv->mc,
                                                              account, NULL);
@@ -141,12 +212,10 @@ account_created_cb (McAccountMonitor *mon,
       else if (initial_status == TP_CONNECTION_STATUS_CONNECTING)
        priv->connecting++;
 
-      /* the reference returned by mc_account_lookup is owned by the
-       * hash table.
-       */
-      g_hash_table_insert (priv->accounts, account, data);
+      account_manager_update_connection (manager, data, account);
 
       g_signal_emit (manager, signals[ACCOUNT_CREATED], 0, account);
+      g_object_unref (account);
     }
 }
 
@@ -313,10 +382,11 @@ account_status_changed_idle_cb (ChangedSignalData *signal_data)
 
           if (status == TP_CONNECTION_STATUS_CONNECTED)
             {
-                if (data->source_id > 0) {
-                  g_source_remove (data->source_id);
-                  data->source_id = 0;
-                }
+                if (data->source_id > 0)
+                  {
+                    g_source_remove (data->source_id);
+                    data->source_id = 0;
+                  }
 
                 data->source_id = g_timeout_add_seconds (10,
                                                          remove_data_timeout,
@@ -325,6 +395,8 @@ account_status_changed_idle_cb (ChangedSignalData *signal_data)
           emit_connection = TRUE;
         }
 
+      account_manager_update_connection (manager, data, account);
+
       if (emit_presence)
         g_signal_emit (manager, signals[ACCOUNT_PRESENCE_CHANGED], 0,
                        account, presence, old_p);
@@ -381,6 +453,8 @@ empathy_account_manager_init (EmpathyAccountManager *manager)
                                           empathy_account_equal,
                                           g_object_unref, 
                                           (GDestroyNotify) account_data_free);
+  priv->connections = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+                                             g_object_unref, g_object_unref);
 
   mc_accounts = mc_accounts_list ();
 
@@ -412,6 +486,7 @@ do_finalize (GObject *obj)
   EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
 
   g_hash_table_unref (priv->accounts);
+  g_hash_table_unref (priv->connections);
 
   G_OBJECT_CLASS (empathy_account_manager_parent_class)->finalize (obj);
 }
@@ -562,6 +637,16 @@ empathy_account_manager_class_init (EmpathyAccountManagerClass *klass)
                   3, MC_TYPE_ACCOUNT,
                   G_TYPE_INT,  /* actual presence */
                   G_TYPE_INT); /* previous presence */
+
+  signals[NEW_CONNECTION] =
+    g_signal_new ("new-connection",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__OBJECT,
+                  G_TYPE_NONE,
+                  1, TP_TYPE_CONNECTION);
   
   g_type_class_add_private (oclass, sizeof (EmpathyAccountManagerPriv));
 }
@@ -634,3 +719,91 @@ empathy_account_manager_get_count (EmpathyAccountManager *manager)
 
   return g_hash_table_size (priv->accounts);
 }
+
+McAccount *
+empathy_account_manager_get_account (EmpathyAccountManager *manager,
+                                     TpConnection          *connection)
+{
+  EmpathyAccountManagerPriv *priv;
+
+  g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), 0);
+
+  priv = GET_PRIV (manager);
+
+  return g_hash_table_lookup (priv->connections, connection);
+}
+
+GList *
+empathy_account_manager_dup_accounts (EmpathyAccountManager *manager)
+{
+  EmpathyAccountManagerPriv *priv;
+  GList *ret;
+
+  g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
+
+  priv = GET_PRIV (manager);
+
+  ret = g_hash_table_get_keys (priv->accounts);
+  g_list_foreach (ret, (GFunc) g_object_ref, NULL);
+
+  return ret;
+}
+
+/**
+ * empathy_account_manager_get_connection:
+ * @manager: a #EmpathyAccountManager
+ * @account: a #McAccount
+ *
+ * Get the connection of the accounts, or NULL if account is offline or the
+ * connection is not yet ready. This function does not return a new ref.
+ *
+ * Returns: the connection of the accounts.
+ **/
+TpConnection *
+empathy_account_manager_get_connection (EmpathyAccountManager *manager,
+                                        McAccount *account)
+{
+  EmpathyAccountManagerPriv *priv;
+  AccountData *data;
+
+  g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
+  g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
+
+  priv = GET_PRIV (manager);
+
+  data = g_hash_table_lookup (priv->accounts, account);
+  if (data && data->connection && tp_connection_is_ready (data->connection))
+    return data->connection;
+
+  return NULL;
+}
+
+/**
+ * empathy_account_manager_dup_connections:
+ * @manager: a #EmpathyAccountManager
+ *
+ * Get a #GList of all ready #TpConnection. The list must be freed with
+ * g_list_free, and its elements must be unreffed.
+ *
+ * Returns: the list of connections
+ **/
+GList *
+empathy_account_manager_dup_connections (EmpathyAccountManager *manager)
+{
+  EmpathyAccountManagerPriv *priv;
+  GHashTableIter iter;
+  gpointer connection;
+  GList *ret = NULL;
+
+  g_return_val_if_fail (EMPATHY_IS_ACCOUNT_MANAGER (manager), NULL);
+
+  priv = GET_PRIV (manager);
+
+  g_hash_table_iter_init (&iter, priv->connections);
+  while (g_hash_table_iter_next (&iter, &connection, NULL)) 
+    if (connection != NULL && tp_connection_is_ready (connection))
+      ret = g_list_prepend (ret, g_object_ref (connection));
+
+  return ret;
+}
+
index b9aecb09f559868b2463a2167b8c6ccaa28be851..ac90a34f7eb3600391bba5a0c6ffdd1789ca1298 100644 (file)
@@ -61,6 +61,16 @@ gboolean                empathy_account_manager_is_account_just_connected
                                  McAccount             *account);
 int                     empathy_account_manager_get_count
                                 (EmpathyAccountManager *manager);
+McAccount *             empathy_account_manager_get_account
+                                (EmpathyAccountManager *manager,
+                                 TpConnection          *connection);
+GList *                 empathy_account_manager_dup_accounts
+                                (EmpathyAccountManager *manager);
+TpConnection *          empathy_account_manager_get_connection
+                                (EmpathyAccountManager *manager,
+                                 McAccount             *account);
+GList *                 empathy_account_manager_dup_connections
+                                (EmpathyAccountManager *manager);
 
 G_END_DECLS
 
index 39d5899bdaa04f6503a944d5f8d3f39ae5d0fde8..820de6de59592cd6f4ff0a62ccc218ae7ea80110 100644 (file)
@@ -402,30 +402,38 @@ empathy_call_handler_request_cb (EmpathyDispatchOperation *operation,
   empathy_dispatch_operation_claim (operation);
 }
 
-static void
-empathy_call_handler_contact_ready_cb (EmpathyContact *contact,
-  const GError *error, gpointer user_data, GObject *object)
+void
+empathy_call_handler_start_call (EmpathyCallHandler *handler)
 {
-  EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (object);
-  EmpathyCallHandlerPriv *priv = GET_PRIV (self);
+
+  EmpathyCallHandlerPriv *priv = GET_PRIV (handler);
   EmpathyDispatcher *dispatcher;
-  McAccount *account;
+  TpConnection *connection;
   GStrv allowed;
   GValue *value;
-  GHashTable *request = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
-      (GDestroyNotify) tp_g_value_slice_free);
+  GHashTable *request;
+
+  if (priv->call != NULL)
+    {
+      empathy_call_handler_start_tpfs (handler);
+      empathy_tp_call_accept_incoming_call (priv->call);
+      return;
+    }
 
   g_assert (priv->contact != NULL);
 
   dispatcher = empathy_dispatcher_dup_singleton ();
-  account = empathy_contact_get_account (priv->contact);
-  allowed = empathy_dispatcher_find_channel_class (dispatcher, account,
+  connection = empathy_contact_get_connection (priv->contact);
+  allowed = empathy_dispatcher_find_channel_class (dispatcher, connection,
     TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_HANDLE_TYPE_CONTACT);
 
   if (!tp_strv_contains ((const gchar * const *) allowed,
       TP_IFACE_CHANNEL ".TargetHandle"))
     return;
 
+  request = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
+      (GDestroyNotify) tp_g_value_slice_free);
+
   /* org.freedesktop.Telepathy.Channel.ChannelType */
   value = tp_g_value_slice_new (G_TYPE_STRING);
   g_value_set_string (value, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA);
@@ -441,27 +449,9 @@ empathy_call_handler_contact_ready_cb (EmpathyContact *contact,
   g_value_set_uint (value, empathy_contact_get_handle (priv->contact));
   g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandle", value);
 
-  empathy_dispatcher_create_channel (dispatcher, account,
-    request, empathy_call_handler_request_cb, self);
+  empathy_dispatcher_create_channel (dispatcher, connection,
+    request, empathy_call_handler_request_cb, handler);
 
   g_object_unref (dispatcher);
 }
 
-void
-empathy_call_handler_start_call (EmpathyCallHandler *handler)
-{
-
-  EmpathyCallHandlerPriv *priv = GET_PRIV (handler);
-
-  if (priv->call == NULL)
-    {
-      empathy_contact_call_when_ready (priv->contact,
-        EMPATHY_CONTACT_READY_HANDLE,
-        empathy_call_handler_contact_ready_cb, NULL, NULL, G_OBJECT (handler));
-    }
-  else
-    {
-      empathy_call_handler_start_tpfs (handler);
-      empathy_tp_call_accept_incoming_call (priv->call);
-    }
-}
index 6765d9e48301b372b58ef80a80be794c389c0f76..e57dae7d325503e0f0580c3168f6a0aa59526239 100644 (file)
@@ -1,7 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2004-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2009 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
@@ -33,6 +32,7 @@
 
 #include "empathy-tp-chat.h"
 #include "empathy-chatroom-manager.h"
+#include "empathy-account-manager.h"
 #include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 static EmpathyChatroomManager *chatroom_manager_singleton = NULL;
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatroomManager)
-typedef struct {
-       GList      *chatrooms;
+typedef struct
+{
+  GList *chatrooms;
   gchar *file;
+  EmpathyAccountManager *account_manager;
   /* source id of the autosave timer */
   gint save_timer_id;
 } EmpathyChatroomManagerPriv;
 
-static void     chatroom_manager_finalize          (GObject                    *object);
-static gboolean chatroom_manager_get_all           (EmpathyChatroomManager      *manager);
-static gboolean chatroom_manager_file_parse        (EmpathyChatroomManager      *manager,
-                                                   const gchar                *filename);
-static void     chatroom_manager_parse_chatroom    (EmpathyChatroomManager      *manager,
-                                                   xmlNodePtr                  node);
-static gboolean chatroom_manager_file_save         (EmpathyChatroomManager      *manager);
-static void reset_save_timeout (EmpathyChatroomManager *self);
-
 enum {
-       CHATROOM_ADDED,
-       CHATROOM_REMOVED,
-       LAST_SIGNAL
+  CHATROOM_ADDED,
+  CHATROOM_REMOVED,
+  LAST_SIGNAL
 };
 
 static guint signals[LAST_SIGNAL];
@@ -78,6 +71,238 @@ enum
 
 G_DEFINE_TYPE (EmpathyChatroomManager, empathy_chatroom_manager, G_TYPE_OBJECT);
 
+/*
+ * API to save/load and parse the chatrooms file.
+ */
+
+static gboolean
+chatroom_manager_file_save (EmpathyChatroomManager *manager)
+{
+       EmpathyChatroomManagerPriv *priv;
+       xmlDocPtr                  doc;
+       xmlNodePtr                 root;
+       GList                     *l;
+
+       priv = GET_PRIV (manager);
+
+       doc = xmlNewDoc ("1.0");
+       root = xmlNewNode (NULL, "chatrooms");
+       xmlDocSetRootElement (doc, root);
+
+       for (l = priv->chatrooms; l; l = l->next) {
+               EmpathyChatroom *chatroom;
+               xmlNodePtr       node;
+               const gchar     *account_id;
+
+               chatroom = l->data;
+
+               if (!empathy_chatroom_is_favorite (chatroom)) {
+                       continue;
+               }
+
+               account_id = mc_account_get_unique_name (empathy_chatroom_get_account (chatroom));
+
+               node = xmlNewChild (root, NULL, "chatroom", NULL);
+               xmlNewTextChild (node, NULL, "name", empathy_chatroom_get_name (chatroom));
+               xmlNewTextChild (node, NULL, "room", empathy_chatroom_get_room (chatroom));
+               xmlNewTextChild (node, NULL, "account", account_id);
+               xmlNewTextChild (node, NULL, "auto_connect",
+                       empathy_chatroom_get_auto_connect (chatroom) ? "yes" : "no");
+       }
+
+       /* Make sure the XML is indented properly */
+       xmlIndentTreeOutput = 1;
+
+       DEBUG ("Saving file:'%s'", priv->file);
+       xmlSaveFormatFileEnc (priv->file, doc, "utf-8", 1);
+       xmlFreeDoc (doc);
+
+       xmlCleanupParser ();
+       xmlMemoryDump ();
+
+       return TRUE;
+}
+
+static gboolean
+save_timeout (EmpathyChatroomManager *self)
+{
+  EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
+
+  priv->save_timer_id = 0;
+  chatroom_manager_file_save (self);
+
+  return FALSE;
+}
+
+static void
+reset_save_timeout (EmpathyChatroomManager *self)
+{
+  EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
+
+  if (priv->save_timer_id > 0)
+    {
+      g_source_remove (priv->save_timer_id);
+    }
+
+  priv->save_timer_id = g_timeout_add_seconds (SAVE_TIMER,
+      (GSourceFunc) save_timeout, self);
+}
+
+static void
+chatroom_changed_cb (EmpathyChatroom *chatroom,
+                     GParamSpec *spec,
+                     EmpathyChatroomManager *self)
+{
+  reset_save_timeout (self);
+}
+
+static void
+add_chatroom (EmpathyChatroomManager *self,
+              EmpathyChatroom *chatroom)
+{
+  EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
+
+  priv->chatrooms = g_list_prepend (priv->chatrooms, g_object_ref (chatroom));
+
+  g_signal_connect (chatroom, "notify",
+      G_CALLBACK (chatroom_changed_cb), self);
+}
+
+static void
+chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
+                                xmlNodePtr             node)
+{
+       EmpathyChatroomManagerPriv *priv;
+       EmpathyChatroom            *chatroom;
+       McAccount                 *account;
+       xmlNodePtr                 child;
+       gchar                     *str;
+       gchar                     *name;
+       gchar                     *room;
+       gchar                     *account_id;
+       gboolean                   auto_connect;
+
+       priv = GET_PRIV (manager);
+
+       /* default values. */
+       name = NULL;
+       room = NULL;
+       auto_connect = TRUE;
+       account_id = NULL;
+
+       for (child = node->children; child; child = child->next) {
+               gchar *tag;
+
+               if (xmlNodeIsText (child)) {
+                       continue;
+               }
+
+               tag = (gchar *) child->name;
+               str = (gchar *) xmlNodeGetContent (child);
+
+               if (strcmp (tag, "name") == 0) {
+                       name = g_strdup (str);
+               }
+               else if (strcmp (tag, "room") == 0) {
+                       room = g_strdup (str);
+               }
+               else if (strcmp (tag, "auto_connect") == 0) {
+                       if (strcmp (str, "yes") == 0) {
+                               auto_connect = TRUE;
+                       } else {
+                               auto_connect = FALSE;
+                       }
+               }
+               else if (strcmp (tag, "account") == 0) {
+                       account_id = g_strdup (str);
+               }
+
+               xmlFree (str);
+       }
+
+       account = mc_account_lookup (account_id);
+       if (!account) {
+               g_free (name);
+               g_free (room);
+               g_free (account_id);
+               return;
+       }
+
+       chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
+       empathy_chatroom_set_favorite (chatroom, TRUE);
+       add_chatroom (manager, chatroom);
+       g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
+
+       g_object_unref (account);
+       g_free (name);
+       g_free (room);
+       g_free (account_id);
+}
+
+static gboolean
+chatroom_manager_file_parse (EmpathyChatroomManager *manager,
+                            const gchar           *filename)
+{
+       EmpathyChatroomManagerPriv *priv;
+       xmlParserCtxtPtr           ctxt;
+       xmlDocPtr                  doc;
+       xmlNodePtr                 chatrooms;
+       xmlNodePtr                 node;
+
+       priv = GET_PRIV (manager);
+
+       DEBUG ("Attempting to parse file:'%s'...", filename);
+
+       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 FALSE;
+       }
+
+       if (!empathy_xml_validate (doc, CHATROOMS_DTD_FILENAME)) {
+               g_warning ("Failed to validate file:'%s'", filename);
+               xmlFreeDoc(doc);
+               xmlFreeParserCtxt (ctxt);
+               return FALSE;
+       }
+
+       /* The root node, chatrooms. */
+       chatrooms = xmlDocGetRootElement (doc);
+
+       for (node = chatrooms->children; node; node = node->next) {
+               if (strcmp ((gchar *) node->name, "chatroom") == 0) {
+                       chatroom_manager_parse_chatroom (manager, node);
+               }
+       }
+
+       DEBUG ("Parsed %d chatrooms", g_list_length (priv->chatrooms));
+
+       xmlFreeDoc(doc);
+       xmlFreeParserCtxt (ctxt);
+
+       return TRUE;
+}
+
+static gboolean
+chatroom_manager_get_all (EmpathyChatroomManager *manager)
+{
+       EmpathyChatroomManagerPriv *priv;
+
+       priv = GET_PRIV (manager);
+
+       /* read file in */
+       if (g_file_test (priv->file, G_FILE_TEST_EXISTS) &&
+           !chatroom_manager_file_parse (manager, priv->file)) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
 static void
 empathy_chatroom_manager_get_property (GObject *object,
                                        guint property_id,
@@ -119,6 +344,41 @@ empathy_chatroom_manager_set_property (GObject *object,
     }
 }
 
+static void
+chatroom_manager_finalize (GObject *object)
+{
+  EmpathyChatroomManager *self = EMPATHY_CHATROOM_MANAGER (object);
+  EmpathyChatroomManagerPriv *priv;
+  GList *l;
+
+  priv = GET_PRIV (object);
+
+  g_object_unref (priv->account_manager);
+
+  if (priv->save_timer_id > 0)
+    {
+      /* have to save before destroy the object */
+      g_source_remove (priv->save_timer_id);
+      priv->save_timer_id = 0;
+      chatroom_manager_file_save (self);
+    }
+
+  for (l = priv->chatrooms; l != NULL; l = g_list_next (l))
+    {
+      EmpathyChatroom *chatroom = l->data;
+
+      g_signal_handlers_disconnect_by_func (chatroom, chatroom_changed_cb,
+          self);
+
+      g_object_unref (chatroom);
+    }
+
+  g_list_free (priv->chatrooms);
+  g_free (priv->file);
+
+  (G_OBJECT_CLASS (empathy_chatroom_manager_parent_class)->finalize) (object);
+}
+
 static GObject *
 empathy_chatroom_manager_constructor (GType type,
                                       guint n_props,
@@ -141,6 +401,8 @@ empathy_chatroom_manager_constructor (GType type,
   chatroom_manager_singleton = self;
   g_object_add_weak_pointer (obj, (gpointer) &chatroom_manager_singleton);
 
+  priv->account_manager = empathy_account_manager_dup_singleton ();
+
   if (priv->file == NULL)
     {
       /* Set the default file path */
@@ -152,230 +414,137 @@ empathy_chatroom_manager_constructor (GType type,
 
       priv->file = g_build_filename (dir, CHATROOMS_XML_FILENAME, NULL);
       g_free (dir);
-    }
-
-  chatroom_manager_get_all (self);
-  return obj;
-}
-
-static void
-empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GParamSpec *param_spec;
-
-  object_class->constructor = empathy_chatroom_manager_constructor;
-  object_class->get_property = empathy_chatroom_manager_get_property;
-  object_class->set_property = empathy_chatroom_manager_set_property;
-       object_class->finalize = chatroom_manager_finalize;
-
-  param_spec = g_param_spec_string (
-      "file",
-      "path of the favorite file",
-      "The path of the XML file containing user's favorites",
-      NULL,
-      G_PARAM_CONSTRUCT_ONLY |
-      G_PARAM_READWRITE |
-      G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_NICK |
-      G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (object_class, PROP_FILE, param_spec);
-
-       signals[CHATROOM_ADDED] =
-               g_signal_new ("chatroom-added",
-                             G_TYPE_FROM_CLASS (klass),
-                             G_SIGNAL_RUN_LAST,
-                             0,
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__OBJECT,
-                             G_TYPE_NONE,
-                             1, EMPATHY_TYPE_CHATROOM);
-       signals[CHATROOM_REMOVED] =
-               g_signal_new ("chatroom-removed",
-                             G_TYPE_FROM_CLASS (klass),
-                             G_SIGNAL_RUN_LAST,
-                             0,
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__OBJECT,
-                             G_TYPE_NONE,
-                             1, EMPATHY_TYPE_CHATROOM);
-
-       g_type_class_add_private (object_class,
-                                 sizeof (EmpathyChatroomManagerPriv));
-}
-
-static void
-empathy_chatroom_manager_init (EmpathyChatroomManager *manager)
-{
-       EmpathyChatroomManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
-               EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv);
-
-       manager->priv = priv;
-}
-
-static void
-chatroom_changed_cb (EmpathyChatroom *chatroom,
-                     GParamSpec *spec,
-                     EmpathyChatroomManager *self)
-{
-  reset_save_timeout (self);
-}
-
-static void
-chatroom_manager_finalize (GObject *object)
-{
-  EmpathyChatroomManager *self = EMPATHY_CHATROOM_MANAGER (object);
-       EmpathyChatroomManagerPriv *priv;
-  GList *l;
-
-       priv = GET_PRIV (object);
-
-  if (priv->save_timer_id > 0)
-    {
-      /* have to save before destroy the object */
-      g_source_remove (priv->save_timer_id);
-      priv->save_timer_id = 0;
-      chatroom_manager_file_save (self);
-    }
-
-  for (l = priv->chatrooms; l != NULL; l = g_list_next (l))
-    {
-      EmpathyChatroom *chatroom = l->data;
-
-      g_signal_handlers_disconnect_by_func (chatroom, chatroom_changed_cb,
-          self);
-
-      g_object_unref (chatroom);
-    }
-
-       g_list_free (priv->chatrooms);
-  g_free (priv->file);
-
-       (G_OBJECT_CLASS (empathy_chatroom_manager_parent_class)->finalize) (object);
-}
-
-EmpathyChatroomManager *
-empathy_chatroom_manager_dup_singleton (const gchar *file)
-{
-       return EMPATHY_CHATROOM_MANAGER (g_object_new (EMPATHY_TYPE_CHATROOM_MANAGER,
-               "file", file, NULL));
-}
-
-static gboolean
-save_timeout (EmpathyChatroomManager *self)
-{
-  EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
-
-  priv->save_timer_id = 0;
-  chatroom_manager_file_save (self);
+    }
 
-  return FALSE;
+  chatroom_manager_get_all (self);
+  return obj;
 }
 
 static void
-reset_save_timeout (EmpathyChatroomManager *self)
+empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass)
 {
-  EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GParamSpec *param_spec;
 
-  if (priv->save_timer_id > 0)
-    {
-      g_source_remove (priv->save_timer_id);
-    }
+  object_class->constructor = empathy_chatroom_manager_constructor;
+  object_class->get_property = empathy_chatroom_manager_get_property;
+  object_class->set_property = empathy_chatroom_manager_set_property;
+       object_class->finalize = chatroom_manager_finalize;
 
-  priv->save_timer_id = g_timeout_add_seconds (SAVE_TIMER,
-      (GSourceFunc) save_timeout, self);
+  param_spec = g_param_spec_string (
+      "file",
+      "path of the favorite file",
+      "The path of the XML file containing user's favorites",
+      NULL,
+      G_PARAM_CONSTRUCT_ONLY |
+      G_PARAM_READWRITE |
+      G_PARAM_STATIC_NAME |
+      G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_FILE, param_spec);
+
+  signals[CHATROOM_ADDED] = g_signal_new ("chatroom-added",
+      G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST,
+      0, NULL, NULL,
+      g_cclosure_marshal_VOID__OBJECT,
+      G_TYPE_NONE,
+      1, EMPATHY_TYPE_CHATROOM);
+
+  signals[CHATROOM_REMOVED] = g_signal_new ("chatroom-removed",
+      G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST,
+      0, NULL, NULL,
+      g_cclosure_marshal_VOID__OBJECT,
+      G_TYPE_NONE,
+      1, EMPATHY_TYPE_CHATROOM);
+
+  g_type_class_add_private (object_class, sizeof (EmpathyChatroomManagerPriv));
 }
 
 static void
-add_chatroom (EmpathyChatroomManager *self,
-              EmpathyChatroom *chatroom)
+empathy_chatroom_manager_init (EmpathyChatroomManager *manager)
 {
-  EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
+  EmpathyChatroomManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
+      EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv);
 
-  priv->chatrooms = g_list_prepend (priv->chatrooms, g_object_ref (chatroom));
+  manager->priv = priv;
+}
 
-  g_signal_connect (chatroom, "notify",
-      G_CALLBACK (chatroom_changed_cb), self);
+EmpathyChatroomManager *
+empathy_chatroom_manager_dup_singleton (const gchar *file)
+{
+  return EMPATHY_CHATROOM_MANAGER (g_object_new (EMPATHY_TYPE_CHATROOM_MANAGER,
+      "file", file, NULL));
 }
 
 gboolean
 empathy_chatroom_manager_add (EmpathyChatroomManager *manager,
                             EmpathyChatroom        *chatroom)
 {
-       EmpathyChatroomManagerPriv *priv;
-
-       g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), FALSE);
-       g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE);
-
-       priv = GET_PRIV (manager);
+  EmpathyChatroomManagerPriv *priv;
 
-       /* don't add more than once */
-       if (!empathy_chatroom_manager_find (manager,
-                                          empathy_chatroom_get_account (chatroom),
-                                          empathy_chatroom_get_room (chatroom))) {
-      gboolean favorite;
+  g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), FALSE);
+  g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE);
 
-      g_object_get (chatroom, "favorite", &favorite, NULL);
+  priv = GET_PRIV (manager);
 
-    add_chatroom (manager, chatroom);
+  /* don't add more than once */
+  if (!empathy_chatroom_manager_find (manager,
+      empathy_chatroom_get_account (chatroom),
+      empathy_chatroom_get_room (chatroom)))
+    {
+      add_chatroom (manager, chatroom);
 
-    if (favorite)
-      {
+      if (empathy_chatroom_is_favorite (chatroom))
         reset_save_timeout (manager);
-      }
-
-               g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
 
-               return TRUE;
-       }
+      g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
+      return TRUE;
+    }
 
-       return FALSE;
+  return FALSE;
 }
 
 void
 empathy_chatroom_manager_remove (EmpathyChatroomManager *manager,
-                               EmpathyChatroom        *chatroom)
+                                 EmpathyChatroom        *chatroom)
 {
-       EmpathyChatroomManagerPriv *priv;
-       GList                     *l;
-
-       g_return_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager));
-       g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
-
-       priv = GET_PRIV (manager);
+  EmpathyChatroomManagerPriv *priv;
+  GList *l;
 
-       for (l = priv->chatrooms; l; l = l->next) {
-               EmpathyChatroom *this_chatroom;
+  g_return_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager));
+  g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
 
-               this_chatroom = l->data;
+  priv = GET_PRIV (manager);
 
-               if (this_chatroom == chatroom ||
-        empathy_chatroom_equal (chatroom, this_chatroom)) {
-        gboolean favorite;
-                       priv->chatrooms = g_list_delete_link (priv->chatrooms, l);
+  for (l = priv->chatrooms; l; l = l->next)
+    {
+      EmpathyChatroom *this_chatroom;
 
-      g_object_get (chatroom, "favorite", &favorite, NULL);
+      this_chatroom = l->data;
 
-      if (favorite)
+      if (this_chatroom == chatroom ||
+          empathy_chatroom_equal (chatroom, this_chatroom))
         {
-          reset_save_timeout (manager);
-        }
-
-                       g_signal_emit (manager, signals[CHATROOM_REMOVED], 0, this_chatroom);
+          priv->chatrooms = g_list_delete_link (priv->chatrooms, l);
+          if (empathy_chatroom_is_favorite (chatroom))
+            reset_save_timeout (manager);
 
-      g_signal_handlers_disconnect_by_func (chatroom, chatroom_changed_cb,
-          manager);
+          g_signal_emit (manager, signals[CHATROOM_REMOVED], 0, this_chatroom);
+          g_signal_handlers_disconnect_by_func (chatroom, chatroom_changed_cb,
+              manager);
 
-                       g_object_unref (this_chatroom);
-                       break;
-               }
-       }
+          g_object_unref (this_chatroom);
+          break;
+        }
+    }
 }
 
 EmpathyChatroom *
 empathy_chatroom_manager_find (EmpathyChatroomManager *manager,
-                             McAccount             *account,
-                             const gchar           *room)
+                               McAccount *account,
+                               const gchar *room)
 {
        EmpathyChatroomManagerPriv *priv;
        GList                     *l;
@@ -457,7 +626,7 @@ empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager,
                chatroom = l->data;
 
                if (empathy_account_equal (account,
-                                         empathy_chatroom_get_account (chatroom))) {
+                                          empathy_chatroom_get_account (chatroom))) {
                        count++;
                }
        }
@@ -465,225 +634,36 @@ empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager,
        return count;
 }
 
-/*
- * API to save/load and parse the chatrooms file.
- */
-
-static gboolean
-chatroom_manager_get_all (EmpathyChatroomManager *manager)
-{
-       EmpathyChatroomManagerPriv *priv;
-
-       priv = GET_PRIV (manager);
-
-       /* read file in */
-       if (g_file_test (priv->file, G_FILE_TEST_EXISTS) &&
-           !chatroom_manager_file_parse (manager, priv->file))
-    return FALSE;
-
-       return TRUE;
-}
-
-static gboolean
-chatroom_manager_file_parse (EmpathyChatroomManager *manager,
-                            const gchar           *filename)
-{
-       EmpathyChatroomManagerPriv *priv;
-       xmlParserCtxtPtr           ctxt;
-       xmlDocPtr                  doc;
-       xmlNodePtr                 chatrooms;
-       xmlNodePtr                 node;
-
-       priv = GET_PRIV (manager);
-
-       DEBUG ("Attempting to parse file:'%s'...", filename);
-
-       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 FALSE;
-       }
-
-       if (!empathy_xml_validate (doc, CHATROOMS_DTD_FILENAME)) {
-               g_warning ("Failed to validate file:'%s'", filename);
-               xmlFreeDoc(doc);
-               xmlFreeParserCtxt (ctxt);
-               return FALSE;
-       }
-
-       /* The root node, chatrooms. */
-       chatrooms = xmlDocGetRootElement (doc);
-
-       for (node = chatrooms->children; node; node = node->next) {
-               if (strcmp ((gchar *) node->name, "chatroom") == 0) {
-                       chatroom_manager_parse_chatroom (manager, node);
-               }
-       }
-
-       DEBUG ("Parsed %d chatrooms", g_list_length (priv->chatrooms));
-
-       xmlFreeDoc(doc);
-       xmlFreeParserCtxt (ctxt);
-
-       return TRUE;
-}
-
-static void
-chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
-                                xmlNodePtr             node)
-{
-       EmpathyChatroomManagerPriv *priv;
-       EmpathyChatroom            *chatroom;
-       McAccount                 *account;
-       xmlNodePtr                 child;
-       gchar                     *str;
-       gchar                     *name;
-       gchar                     *room;
-       gchar                     *account_id;
-       gboolean                   auto_connect;
-
-       priv = GET_PRIV (manager);
-
-       /* default values. */
-       name = NULL;
-       room = NULL;
-       auto_connect = TRUE;
-       account_id = NULL;
-
-       for (child = node->children; child; child = child->next) {
-               gchar *tag;
-
-               if (xmlNodeIsText (child)) {
-                       continue;
-               }
-
-               tag = (gchar *) child->name;
-               str = (gchar *) xmlNodeGetContent (child);
-
-               if (strcmp (tag, "name") == 0) {
-                       name = g_strdup (str);
-               }
-               else if (strcmp (tag, "room") == 0) {
-                       room = g_strdup (str);
-               }
-               else if (strcmp (tag, "auto_connect") == 0) {
-                       if (strcmp (str, "yes") == 0) {
-                               auto_connect = TRUE;
-                       } else {
-                               auto_connect = FALSE;
-                       }
-               }
-               else if (strcmp (tag, "account") == 0) {
-                       account_id = g_strdup (str);
-               }
-
-               xmlFree (str);
-       }
-
-       account = mc_account_lookup (account_id);
-       if (!account) {
-               g_free (name);
-               g_free (room);
-               g_free (account_id);
-               return;
-       }
-
-       chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
-  g_object_set (chatroom, "favorite", TRUE, NULL);
-  add_chatroom (manager, chatroom);
-       g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);
-
-       g_object_unref (account);
-       g_free (name);
-       g_free (room);
-       g_free (account_id);
-}
-
-static gboolean
-chatroom_manager_file_save (EmpathyChatroomManager *manager)
-{
-       EmpathyChatroomManagerPriv *priv;
-       xmlDocPtr                  doc;
-       xmlNodePtr                 root;
-       GList                     *l;
-
-       priv = GET_PRIV (manager);
-
-       doc = xmlNewDoc ("1.0");
-       root = xmlNewNode (NULL, "chatrooms");
-       xmlDocSetRootElement (doc, root);
-
-       for (l = priv->chatrooms; l; l = l->next) {
-               EmpathyChatroom *chatroom;
-               xmlNodePtr      node;
-               const gchar    *account_id;
-    gboolean favorite;
-
-               chatroom = l->data;
-
-    g_object_get (chatroom, "favorite", &favorite, NULL);
-    if (!favorite)
-      continue;
-
-               account_id = mc_account_get_unique_name (empathy_chatroom_get_account (chatroom));
-
-               node = xmlNewChild (root, NULL, "chatroom", NULL);
-               xmlNewTextChild (node, NULL, "name", empathy_chatroom_get_name (chatroom));
-               xmlNewTextChild (node, NULL, "room", empathy_chatroom_get_room (chatroom));
-               xmlNewTextChild (node, NULL, "account", account_id);
-               xmlNewTextChild (node, NULL, "auto_connect", empathy_chatroom_get_auto_connect (chatroom) ? "yes" : "no");
-       }
-
-       /* Make sure the XML is indented properly */
-       xmlIndentTreeOutput = 1;
-
-       DEBUG ("Saving file:'%s'", priv->file);
-       xmlSaveFormatFileEnc (priv->file, doc, "utf-8", 1);
-       xmlFreeDoc (doc);
-
-       xmlCleanupParser ();
-       xmlMemoryDump ();
-
-       return TRUE;
-}
-
 static void
 chatroom_manager_chat_destroyed_cb (EmpathyTpChat *chat,
-  gpointer user_data)
+  gpointer manager)
 {
-  EmpathyChatroomManager *manager = EMPATHY_CHATROOM_MANAGER (user_data);
-  McAccount *account = empathy_tp_chat_get_account (chat);
-  EmpathyChatroom *chatroom;
-  const gchar *roomname;
-  gboolean favorite;
-
-  roomname = empathy_tp_chat_get_id (chat);
-  chatroom = empathy_chatroom_manager_find (manager, account, roomname);
+  EmpathyChatroomManagerPriv *priv = GET_PRIV (manager);
+  GList *l;
 
-  if (chatroom == NULL)
-    return;
+  for (l = priv->chatrooms; l; l = l->next)
+    {
+      EmpathyChatroom *chatroom = l->data;
 
-  g_object_set (chatroom, "tp-chat", NULL, NULL);
-  g_object_get (chatroom, "favorite", &favorite, NULL);
+      if (empathy_chatroom_get_tp_chat (chatroom) != chat)
+        continue;
 
-  if (!favorite)
-    {
-      /* Remove the chatroom from the list, unless it's in the list of
-       * favourites..
-       * FIXME this policy should probably not be in libempathy */
-      empathy_chatroom_manager_remove (manager, chatroom);
+      empathy_chatroom_set_tp_chat (chatroom, NULL);
+      if (!empathy_chatroom_is_favorite (chatroom))
+        {
+          /* Remove the chatroom from the list, unless it's in the list of
+           * favourites..
+           * FIXME this policy should probably not be in libempathy */
+          empathy_chatroom_manager_remove (manager, chatroom);
+        }
     }
 }
 
 static void
 chatroom_manager_observe_channel_cb (EmpathyDispatcher *dispatcher,
-  EmpathyDispatchOperation *operation, gpointer user_data)
+  EmpathyDispatchOperation *operation, gpointer manager)
 {
-  EmpathyChatroomManager *manager = EMPATHY_CHATROOM_MANAGER (user_data);
+  EmpathyChatroomManagerPriv *priv = GET_PRIV (manager);
   EmpathyChatroom *chatroom;
   TpChannel *channel;
   EmpathyTpChat *chat;
@@ -691,6 +671,7 @@ chatroom_manager_observe_channel_cb (EmpathyDispatcher *dispatcher,
   GQuark channel_type;
   TpHandleType handle_type;
   McAccount *account;
+  TpConnection *connection;
 
   channel_type = empathy_dispatch_operation_get_channel_type_id (operation);
 
@@ -706,7 +687,9 @@ chatroom_manager_observe_channel_cb (EmpathyDispatcher *dispatcher,
 
   chat = EMPATHY_TP_CHAT (
     empathy_dispatch_operation_get_channel_wrapper (operation));
-  account = empathy_tp_chat_get_account (chat);
+  connection = empathy_tp_chat_get_connection (chat);
+  account = empathy_account_manager_get_account (priv->account_manager,
+      connection);
 
   roomname = empathy_tp_chat_get_id (chat);
 
@@ -716,13 +699,13 @@ chatroom_manager_observe_channel_cb (EmpathyDispatcher *dispatcher,
     {
       chatroom = empathy_chatroom_new_full (account, roomname, roomname,
         FALSE);
-      g_object_set (G_OBJECT (chatroom), "tp-chat", chat, NULL);
+      empathy_chatroom_set_tp_chat (chatroom, chat);
       empathy_chatroom_manager_add (manager, chatroom);
       g_object_unref (chatroom);
     }
   else
     {
-      g_object_set (G_OBJECT (chatroom), "tp-chat", chat, NULL);
+        empathy_chatroom_set_tp_chat (chatroom, chat);
     }
 
   /* A TpChat is always destroyed as it only gets unreffed after the channel
index 8ffd8a51e11ce2b4766aaa3099bfb68e49f15662..6575bb9982288dacbba51a346bd562d027484278 100644 (file)
@@ -111,17 +111,14 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass)
                                                               FALSE,
                                                               G_PARAM_READWRITE));
 
-  g_object_class_install_property (object_class,
-      PROP_FAVORITE,
-      g_param_spec_boolean ("favorite",
-        "Favorite",
-        "TRUE if the chatroom is in user's favorite list",
-        FALSE,
-        G_PARAM_READWRITE |
-        G_PARAM_CONSTRUCT |
-        G_PARAM_STATIC_NAME |
-        G_PARAM_STATIC_NICK |
-        G_PARAM_STATIC_BLURB));
+       g_object_class_install_property (object_class,
+                                        PROP_FAVORITE,
+                                        g_param_spec_boolean ("favorite",
+                                                              "Favorite",
+                                                              "TRUE if the chatroom is in user's favorite list",
+                                                              FALSE,
+                                                              G_PARAM_READWRITE |
+                                                              G_PARAM_CONSTRUCT));
 
        g_object_class_install_property (object_class,
                                         PROP_TP_CHAT,
@@ -284,30 +281,14 @@ chatroom_set_property (GObject      *object,
                empathy_chatroom_set_auto_connect (EMPATHY_CHATROOM (object),
                                                  g_value_get_boolean (value));
                break;
-  case PROP_FAVORITE:
-    priv->favorite = g_value_get_boolean (value);
-    if (!priv->favorite)
-      {
-        empathy_chatroom_set_auto_connect (EMPATHY_CHATROOM (object),
-            FALSE);
-      }
-    break;
-       case PROP_TP_CHAT: {
-               GObject *chat = g_value_dup_object (value);
-
-               if (chat == (GObject *) priv->tp_chat)
-                       break;
-
-               g_assert (chat == NULL || priv->tp_chat == NULL);
-
-               if (priv->tp_chat != NULL) {
-                       g_object_unref (priv->tp_chat);
-                       priv->tp_chat = NULL;
-               } else {
-                       priv->tp_chat = EMPATHY_TP_CHAT (chat);
-               }
+       case PROP_FAVORITE:
+               empathy_chatroom_set_favorite (EMPATHY_CHATROOM (object),
+                                              g_value_get_boolean (value));
+               break;
+       case PROP_TP_CHAT:
+               empathy_chatroom_set_tp_chat (EMPATHY_CHATROOM (object),
+                                             g_value_get_object (value));
                break;
-       }
   case PROP_SUBJECT:
     empathy_chatroom_set_subject (EMPATHY_CHATROOM (object),
         g_value_get_string (value));
@@ -476,12 +457,11 @@ empathy_chatroom_set_auto_connect (EmpathyChatroom *chatroom,
 
        priv->auto_connect = auto_connect;
 
-  if (priv->auto_connect)
-    {
-      /* auto_connect implies favorite */
-      priv->favorite = TRUE;
-      g_object_notify (G_OBJECT (chatroom), "favorite");
-    }
+       if (priv->auto_connect) {
+               /* auto_connect implies favorite */
+               priv->favorite = TRUE;
+               g_object_notify (G_OBJECT (chatroom), "favorite");
+       }
 
        g_object_notify (G_OBJECT (chatroom), "auto-connect");
 }
@@ -504,12 +484,13 @@ empathy_chatroom_equal (gconstpointer v1,
        room_a = empathy_chatroom_get_room (EMPATHY_CHATROOM (v1));
        room_b = empathy_chatroom_get_room (EMPATHY_CHATROOM (v2));
 
-       return empathy_account_equal (account_a, account_b) && !tp_strdiff (room_a,
-      room_b);
+       return empathy_account_equal (account_a, account_b) &&
+              !tp_strdiff (room_a, room_b);
 }
 
 EmpathyTpChat *
-empathy_chatroom_get_tp_chat (EmpathyChatroom *chatroom) {
+empathy_chatroom_get_tp_chat (EmpathyChatroom *chatroom)
+{
        EmpathyChatroomPriv *priv;
 
        g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), NULL);
@@ -631,3 +612,59 @@ empathy_chatroom_set_invite_only (EmpathyChatroom *chatroom,
   g_object_notify (G_OBJECT (chatroom), "invite-only");
 }
 
+void
+empathy_chatroom_set_tp_chat (EmpathyChatroom *chatroom,
+                             EmpathyTpChat   *tp_chat)
+{
+       EmpathyChatroomPriv *priv;
+
+       g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
+       g_return_if_fail (tp_chat == NULL || EMPATHY_IS_TP_CHAT (tp_chat));
+
+       priv = GET_PRIV (chatroom);
+
+       if (priv->tp_chat == tp_chat) {
+               return;
+       }
+
+       if (priv->tp_chat != NULL) {
+               g_object_unref (priv->tp_chat);
+       }
+
+       priv->tp_chat = tp_chat ? g_object_ref (tp_chat) : NULL;
+       g_object_notify (G_OBJECT (chatroom), "tp-chat");
+}
+
+gboolean
+empathy_chatroom_is_favorite (EmpathyChatroom *chatroom)
+{
+       EmpathyChatroomPriv *priv;
+
+       g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE);
+
+       priv = GET_PRIV (chatroom);
+
+       return priv->favorite;
+}
+
+void
+empathy_chatroom_set_favorite (EmpathyChatroom *chatroom,
+                              gboolean         favorite)
+{
+       EmpathyChatroomPriv *priv;
+
+       g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom));
+
+       priv = GET_PRIV (chatroom);
+
+       if (priv->favorite == favorite) {
+               return;
+       }
+
+       priv->favorite = favorite;
+       if (!priv->favorite) {
+               empathy_chatroom_set_auto_connect (chatroom, FALSE);
+       }
+       g_object_notify (G_OBJECT (chatroom), "favorite");
+}
+
index 08e3bc1eb04e383e6771127e833b1479265a396d..560517d489eab78331530bfb698c45f57d375030 100644 (file)
@@ -84,6 +84,11 @@ void            empathy_chatroom_set_invite_only  (EmpathyChatroom *chatroom,
 gboolean        empathy_chatroom_equal            (gconstpointer    v1,
                                                   gconstpointer    v2);
 EmpathyTpChat * empathy_chatroom_get_tp_chat      (EmpathyChatroom *chatroom);
+void            empathy_chatroom_set_tp_chat      (EmpathyChatroom *chatroom,
+                                                  EmpathyTpChat   *tp_chat);
+gboolean        empathy_chatroom_is_favorite      (EmpathyChatroom *chatroom);
+void            empathy_chatroom_set_favorite     (EmpathyChatroom *chatroom,
+                                                  gboolean         favorite);
 
 G_END_DECLS
 
diff --git a/libempathy/empathy-contact-factory.c b/libempathy/empathy-contact-factory.c
deleted file mode 100644 (file)
index c350057..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007-2008 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: Xavier Claessens <xclaesse@gmail.com>
- */
-
-#include <config.h>
-
-#include "empathy-contact-factory.h"
-#include "empathy-utils.h"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactFactory)
-typedef struct {
-       GHashTable *accounts;
-} EmpathyContactFactoryPriv;
-
-G_DEFINE_TYPE (EmpathyContactFactory, empathy_contact_factory, G_TYPE_OBJECT);
-
-static EmpathyContactFactory * factory_singleton = NULL;
-
-EmpathyTpContactFactory *
-empathy_contact_factory_get_tp_factory (EmpathyContactFactory *factory,
-                                       McAccount             *account)
-{
-       EmpathyContactFactoryPriv *priv = GET_PRIV (factory);
-       EmpathyTpContactFactory   *tp_factory;
-
-       tp_factory = g_hash_table_lookup (priv->accounts, account);
-       if (!tp_factory) {
-               tp_factory = empathy_tp_contact_factory_new (account);
-               g_hash_table_insert (priv->accounts, account, tp_factory);
-       }
-
-       return g_object_ref (tp_factory);
-}
-
-EmpathyContact *
-empathy_contact_factory_get_user (EmpathyContactFactory *factory,
-                                 McAccount             *account)
-{
-       EmpathyTpContactFactory *tp_factory;
-
-       tp_factory = empathy_contact_factory_get_tp_factory (factory, account);
-
-       return empathy_tp_contact_factory_get_user (tp_factory);
-}
-
-EmpathyContact *
-empathy_contact_factory_get_from_id (EmpathyContactFactory *factory,
-                                    McAccount             *account,
-                                    const gchar           *id)
-{
-       EmpathyTpContactFactory *tp_factory;
-
-       tp_factory = empathy_contact_factory_get_tp_factory (factory, account);
-
-       return empathy_tp_contact_factory_get_from_id (tp_factory, id);
-}
-
-EmpathyContact *
-empathy_contact_factory_get_from_handle (EmpathyContactFactory *factory,
-                                        McAccount             *account,
-                                        guint                  handle)
-{
-       EmpathyTpContactFactory *tp_factory;
-
-       tp_factory = empathy_contact_factory_get_tp_factory (factory, account);
-
-       return empathy_tp_contact_factory_get_from_handle (tp_factory, handle);
-}
-
-GList *
-empathy_contact_factory_get_from_handles (EmpathyContactFactory *factory,
-                                         McAccount             *account,
-                                         const GArray          *handles)
-{
-       EmpathyTpContactFactory *tp_factory;
-
-       tp_factory = empathy_contact_factory_get_tp_factory (factory, account);
-
-       return empathy_tp_contact_factory_get_from_handles (tp_factory, handles);
-}
-
-void
-empathy_contact_factory_set_alias (EmpathyContactFactory *factory,
-                                  EmpathyContact        *contact,
-                                  const gchar           *alias)
-{
-       EmpathyTpContactFactory *tp_factory;
-       McAccount               *account;
-
-       account = empathy_contact_get_account (contact);
-       tp_factory = empathy_contact_factory_get_tp_factory (factory, account);
-
-       return empathy_tp_contact_factory_set_alias (tp_factory, contact, alias);
-}
-
-void
-empathy_contact_factory_set_avatar (EmpathyContactFactory *factory,
-                                   McAccount             *account,
-                                   const gchar           *data,
-                                   gsize                  size,
-                                   const gchar           *mime_type)
-{
-       EmpathyTpContactFactory *tp_factory;
-
-       tp_factory = empathy_contact_factory_get_tp_factory (factory, account);
-
-       return empathy_tp_contact_factory_set_avatar (tp_factory,
-                                                     data, size, mime_type);
-}
-
-static void
-contact_factory_finalize (GObject *object)
-{
-       EmpathyContactFactoryPriv *priv = GET_PRIV (object);
-
-       g_hash_table_destroy (priv->accounts);
-
-       G_OBJECT_CLASS (empathy_contact_factory_parent_class)->finalize (object);
-}
-
-static GObject *
-contact_factory_constructor (GType type,
-                            guint n_props,
-                            GObjectConstructParam *props)
-{
-       GObject *retval;
-
-       if (factory_singleton) {
-               retval = g_object_ref (factory_singleton);
-       } else {
-               retval = G_OBJECT_CLASS (empathy_contact_factory_parent_class)->constructor
-                       (type, n_props, props);
-
-               factory_singleton = EMPATHY_CONTACT_FACTORY (retval);
-               g_object_add_weak_pointer (retval, (gpointer) &factory_singleton);
-       }
-
-       return retval;
-}
-
-static void
-empathy_contact_factory_class_init (EmpathyContactFactoryClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       object_class->finalize = contact_factory_finalize;
-       object_class->constructor = contact_factory_constructor;
-
-       g_type_class_add_private (object_class, sizeof (EmpathyContactFactoryPriv));
-}
-
-static void
-empathy_contact_factory_init (EmpathyContactFactory *factory)
-{
-       EmpathyContactFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (factory,
-               EMPATHY_TYPE_CONTACT_FACTORY, EmpathyContactFactoryPriv);
-
-       factory->priv = priv;
-       priv->accounts = g_hash_table_new_full (empathy_account_hash,
-                                               empathy_account_equal,
-                                               g_object_unref,
-                                               g_object_unref);
-}
-
-EmpathyContactFactory *
-empathy_contact_factory_dup_singleton (void)
-{
-       return g_object_new (EMPATHY_TYPE_CONTACT_FACTORY, NULL);
-}
-
diff --git a/libempathy/empathy-contact-factory.h b/libempathy/empathy-contact-factory.h
deleted file mode 100644 (file)
index 16df02b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2007-2008 Collabora Ltd.
- *