]> git.0d.be Git - empathy.git/commitdiff
tp-account-widgets: rename all the files from empathy-* to tpaw-*
authorMarco Barisione <marco.barisione@collabora.co.uk>
Wed, 8 May 2013 16:17:30 +0000 (17:17 +0100)
committerMarco Barisione <marco.barisione@collabora.co.uk>
Tue, 20 Aug 2013 10:03:04 +0000 (11:03 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=699492

72 files changed:
libempathy-gtk/empathy-local-xmpp-assistant-widget.c
libempathy-gtk/empathy-new-account-dialog.c
src/empathy-accounts-dialog.c
tests/empathy-irc-network-manager-test.c
tests/empathy-irc-network-test.c
tests/empathy-irc-server-test.c
tests/test-irc-helper.h
tp-account-widgets/.gitignore
tp-account-widgets/Makefile.am
tp-account-widgets/empathy-account-widget-aim.ui [deleted file]
tp-account-widgets/empathy-account-widget-generic.ui [deleted file]
tp-account-widgets/empathy-account-widget-groupwise.ui [deleted file]
tp-account-widgets/empathy-account-widget-icq.ui [deleted file]
tp-account-widgets/empathy-account-widget-irc.c [deleted file]
tp-account-widgets/empathy-account-widget-irc.h [deleted file]
tp-account-widgets/empathy-account-widget-irc.ui [deleted file]
tp-account-widgets/empathy-account-widget-jabber.ui [deleted file]
tp-account-widgets/empathy-account-widget-local-xmpp.ui [deleted file]
tp-account-widgets/empathy-account-widget-msn.ui [deleted file]
tp-account-widgets/empathy-account-widget-private.h [deleted file]
tp-account-widgets/empathy-account-widget-sip.c [deleted file]
tp-account-widgets/empathy-account-widget-sip.h [deleted file]
tp-account-widgets/empathy-account-widget-sip.ui [deleted file]
tp-account-widgets/empathy-account-widget-yahoo.ui [deleted file]
tp-account-widgets/empathy-account-widget.c [deleted file]
tp-account-widgets/empathy-account-widget.h [deleted file]
tp-account-widgets/empathy-account-widgets.gresource.xml [deleted file]
tp-account-widgets/empathy-irc-network-chooser-dialog.c [deleted file]
tp-account-widgets/empathy-irc-network-chooser-dialog.h [deleted file]
tp-account-widgets/empathy-irc-network-chooser.c [deleted file]
tp-account-widgets/empathy-irc-network-chooser.h [deleted file]
tp-account-widgets/empathy-irc-network-dialog.c [deleted file]
tp-account-widgets/empathy-irc-network-dialog.h [deleted file]
tp-account-widgets/empathy-irc-network-manager.c [deleted file]
tp-account-widgets/empathy-irc-network-manager.h [deleted file]
tp-account-widgets/empathy-irc-network.c [deleted file]
tp-account-widgets/empathy-irc-network.h [deleted file]
tp-account-widgets/empathy-irc-networks.dtd [deleted file]
tp-account-widgets/empathy-irc-server.c [deleted file]
tp-account-widgets/empathy-irc-server.h [deleted file]
tp-account-widgets/tpaw-account-widget-aim.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-generic.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-groupwise.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-icq.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-irc.c [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-irc.h [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-irc.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-jabber.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-local-xmpp.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-msn.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-private.h [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-sip.c [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-sip.h [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-sip.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget-yahoo.ui [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget.c [new file with mode: 0644]
tp-account-widgets/tpaw-account-widget.h [new file with mode: 0644]
tp-account-widgets/tpaw-account-widgets.gresource.xml [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-chooser-dialog.c [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-chooser-dialog.h [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-chooser.c [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-chooser.h [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-dialog.c [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-dialog.h [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-manager.c [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network-manager.h [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network.c [new file with mode: 0644]
tp-account-widgets/tpaw-irc-network.h [new file with mode: 0644]
tp-account-widgets/tpaw-irc-networks.dtd [new file with mode: 0644]
tp-account-widgets/tpaw-irc-server.c [new file with mode: 0644]
tp-account-widgets/tpaw-irc-server.h [new file with mode: 0644]
ubuntu-online-accounts/cc-plugins/account-plugins/empathy-accounts-plugin-widget.c

index 26d2bbf8b47dd223f65c4381a8f7e2fc171bf058..d9fecc1c0056bb3ba9cbfe117c387037f64130dc 100644 (file)
@@ -22,8 +22,8 @@
 #include "empathy-local-xmpp-assistant-widget.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-account-widget.h>
 
-#include "empathy-account-widget.h"
 #include "empathy-ui-utils.h"
 #include "empathy-utils.h"
 
index b26423f910fc1f99b0c390fe6e246949e61d8cba..eaa8b07edf04236c4cfcac56334b54c6f13b6c98 100644 (file)
@@ -21,8 +21,8 @@
 #include "empathy-new-account-dialog.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-account-widget.h>
 
-#include "empathy-account-widget.h"
 #include "empathy-protocol-chooser.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
index 2d971994de70f55d665280fe5be2647245566761..a175261bab9c6482a696a3f44efb5754c9edaa8f 100644 (file)
@@ -28,9 +28,9 @@
 #include "empathy-accounts-dialog.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-account-widget.h>
 
 #include "empathy-accounts-common.h"
-#include "empathy-account-widget.h"
 #include "empathy-import-dialog.h"
 #include "empathy-import-utils.h"
 #include "empathy-local-xmpp-assistant-widget.h"
index ac6d4bbd1cdfffb5c88bf82cd2e28643b563b19a..7b7e7a42de97f41668b25266295d67cf6f21572a 100644 (file)
@@ -2,8 +2,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <glib/gstdio.h>
+#include <tp-account-widgets/tpaw-irc-network-manager.h>
 
-#include "empathy-irc-network-manager.h"
 #include "test-helper.h"
 #include "test-irc-helper.h"
 
index 2657d788ab3c5b2ef000e4c8bd3d60e179d68ac6..c784641f25e988d564c6cd9143725a151200e99f 100644 (file)
@@ -1,8 +1,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <tp-account-widgets/tpaw-irc-network.h>
 
-#include "empathy-irc-network.h"
 #include "test-helper.h"
 #include "test-irc-helper.h"
 
index ff56a02da934213299078cd21d49ded9d7e3be5b..fc0eb5b1591f94800005cbf61e94a078eb7e20de 100644 (file)
@@ -1,8 +1,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <tp-account-widgets/tpaw-irc-server.h>
 
-#include "empathy-irc-server.h"
 #include "test-helper.h"
 #include "test-irc-helper.h"
 
index 2dedf50c9466423f779b7758827fb22c88261c05..02eda91789ce35a189c5defd8dc00bfc3b82f121 100644 (file)
@@ -1,6 +1,6 @@
 #include <string.h>
 
-#include "empathy-irc-network-manager.h"
+#include <tp-account-widgets/tpaw-irc-network-manager.h>
 
 #ifndef __CHECK_IRC_HELPER_H__
 #define __CHECK_IRC_HELPER_H__
index 3c37f3d0c435aced731ee8c7abbf0bb0cf1a1a9c..ac10b9d38b2014214a2188ac6a8cfa74c9bbd32b 100644 (file)
@@ -1 +1 @@
-empathy-account-widgets-resources.[ch]
+tpaw-account-widgets-resources.[ch]
index d0c73bfa4f2238991ad0b4daa6a30e02d70e32a9..0d2d5011d6fb203800e6b89ba55361d802321f18 100644 (file)
@@ -11,35 +11,35 @@ AM_CPPFLAGS =                                           \
        $(DISABLE_DEPRECATED)
 
 BUILT_SOURCES =                                        \
-       empathy-account-widgets-resources.c             \
-       empathy-account-widgets-resources.h             \
+       tpaw-account-widgets-resources.c                \
+       tpaw-account-widgets-resources.h                \
        $(NULL)
 
 libtp_account_widgets_sources =                \
-       empathy-account-widget.c                \
-       empathy-account-widget-irc.c            \
-       empathy-account-widget-private.h        \
-       empathy-account-widget-sip.c            \
-       empathy-irc-network-chooser.c           \
-       empathy-irc-network-chooser-dialog.c    \
-       empathy-irc-network-dialog.c            \
-       empathy-irc-network-manager.c           \
-       empathy-irc-network.c                   \
-       empathy-irc-server.c                    \
+       tpaw-account-widget.c                   \
+       tpaw-account-widget-irc.c               \
+       tpaw-account-widget-private.h           \
+       tpaw-account-widget-sip.c               \
+       tpaw-irc-network-chooser.c              \
+       tpaw-irc-network-chooser-dialog.c       \
+       tpaw-irc-network-dialog.c               \
+       tpaw-irc-network-manager.c              \
+       tpaw-irc-network.c                      \
+       tpaw-irc-server.c                       \
        totem-subtitle-encoding.c               \
        $(NULL)
 
 libtp_account_widgets_headers =                        \
-       empathy-account-widget.h                \
-       empathy-account-widget-irc.h            \
-       empathy-account-widget-sip.h            \
-       empathy-irc-network-chooser-dialog.h    \
-       empathy-irc-network-chooser.h           \
-       empathy-irc-network-dialog.h            \
-       empathy-irc-network-manager.h           \
-       empathy-irc-network.h                   \
-       empathy-irc-server.h                    \
-       empathy-utils.h                         \
+       tpaw-account-widget.h                   \
+       tpaw-account-widget-irc.h               \
+       tpaw-account-widget-sip.h               \
+       tpaw-irc-network-chooser-dialog.h       \
+       tpaw-irc-network-chooser.h              \
+       tpaw-irc-network-dialog.h               \
+       tpaw-irc-network-manager.h              \
+       tpaw-irc-network.h                      \
+       tpaw-irc-server.h                       \
+       tpaw-utils.h                            \
        totem-subtitle-encoding.h               \
        $(NULL)
 
@@ -68,8 +68,8 @@ check_c_sources = \
 include $(top_srcdir)/tools/check-coding-style.mk
 check-local: check-coding-style
 
-account_widgets_dtd_files =                    \
-       empathy-irc-networks.dtd                \
+account_widgets_dtd_files =            \
+       tpaw-irc-networks.dtd           \
        $(NULL)
 
 ircnetworksdir = $(datadir)/empathy
@@ -77,28 +77,28 @@ ircnetworks_DATA =          \
        irc-networks.xml
 
 account_widgets_ui_files =                     \
-       empathy-account-widget-generic.ui       \
-       empathy-account-widget-jabber.ui        \
-       empathy-account-widget-msn.ui           \
-       empathy-account-widget-sip.ui           \
-       empathy-account-widget-local-xmpp.ui    \
-       empathy-account-widget-irc.ui           \
-       empathy-account-widget-icq.ui           \
-       empathy-account-widget-yahoo.ui         \
-       empathy-account-widget-groupwise.ui     \
-       empathy-account-widget-aim.ui           \
+       tpaw-account-widget-generic.ui          \
+       tpaw-account-widget-jabber.ui           \
+       tpaw-account-widget-msn.ui              \
+       tpaw-account-widget-sip.ui              \
+       tpaw-account-widget-local-xmpp.ui       \
+       tpaw-account-widget-irc.ui              \
+       tpaw-account-widget-icq.ui              \
+       tpaw-account-widget-yahoo.ui            \
+       tpaw-account-widget-groupwise.ui        \
+       tpaw-account-widget-aim.ui              \
        $(NULL)
 
-account_widgets_resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir=$(srcdir) $(srcdir)/empathy-account-widgets.gresource.xml)
+account_widgets_resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir=$(srcdir) $(srcdir)/tpaw-account-widgets.gresource.xml)
 
-empathy-account-widgets-resources.c: empathy-account-widgets.gresource.xml $(account_widgets_resource_files)
+tpaw-account-widgets-resources.c: tpaw-account-widgets.gresource.xml $(account_widgets_resource_files)
        $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
 
-empathy-account-widgets-resources.h: empathy-account-widgets.gresource.xml $(account_widgets_resource_files)
+tpaw-account-widgets-resources.h: tpaw-account-widgets.gresource.xml $(account_widgets_resource_files)
        $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-header $<
 
 EXTRA_DIST =                                   \
-       empathy-account-widgets.gresource.xml   \
+       tpaw-account-widgets.gresource.xml      \
        $(account_widgets_dtd_files)            \
        $(account_widgets_ui_files)             \
        $(ircnetworks_DATA)                     \
diff --git a/tp-account-widgets/empathy-account-widget-aim.ui b/tp-account-widgets/empathy-account-widget-aim.ui
deleted file mode 100644 (file)
index 8ceacbf..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="value">5222</property>
-    <property name="upper">65555</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_aim_settings">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Pass_word</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_password</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_screenname">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Screen _Name</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_screenname</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_screenname">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_username_example">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; MyScreenName</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_advanced_settings">
-            <property name="visible">True</property>
-            <property name="column_spacing">12</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkSpinButton" id="spinbutton_port">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="adjustment">adjustment1</property>
-                <property name="climb_rate">1</property>
-                <property name="numeric">True</property>
-                <property name="hexpand">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_port">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Port</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">spinbutton_port</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_server">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_server">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Server</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_server</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_aim_simple">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkLabel" id="label_screenname_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your AIM screen name?</property>
-      </object>
-      <packing>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">4</property>
-            <child>
-              <object class="GtkEntry" id="entry_screenname_simple">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_example">
-                <property name="visible">True</property>
-                <property name="xalign">0.10000000149011612</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; MyScreenName</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-                </attributes>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your AIM password?</property>
-      </object>
-      <packing>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment2">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-generic.ui b/tp-account-widgets/empathy-account-widget-generic.ui
deleted file mode 100644 (file)
index c37da5e..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkVBox" id="vbox_generic_settings">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">12</property>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander_advanced_settings">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkScrolledWindow" id="scrolledwindow1">
-            <property name="height_request">150</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hscrollbar_policy">never</property>
-            <property name="shadow_type">in</property>
-            <child>
-              <object class="GtkViewport" id="viewport1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">6</property>
-                <property name="resize_mode">queue</property>
-                <child>
-                  <object class="GtkGrid" id="grid_advanced_settings">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-groupwise.ui b/tp-account-widgets/empathy-account-widget-groupwise.ui
deleted file mode 100644 (file)
index cfca2e3..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">65535</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_groupwise_settings">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_groupwise_settings">
-        <property name="visible">True</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Pass_word</property>
-            <property name="use_underline">True</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_id">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Login I_D</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_id</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_id">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_username_example">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_advanced_groupwise_settings">
-            <property name="visible">True</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkLabel" id="label_port">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Port</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">spinbutton_port</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_server">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Server</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_server</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_server">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSpinButton" id="spinbutton_port">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="adjustment">adjustment1</property>
-                <property name="climb_rate">1</property>
-                <property name="numeric">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_groupwise_simple">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkLabel" id="label_id_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your GroupWise User ID?</property>
-      </object>
-      <packing>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">4</property>
-            <child>
-              <object class="GtkEntry" id="entry_id_simple">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_example">
-                <property name="visible">True</property>
-                <property name="xalign">0.10000000149011612</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-                </attributes>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your GroupWise password?</property>
-      </object>
-      <packing>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment2">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-icq.ui b/tp-account-widgets/empathy-account-widget-icq.ui
deleted file mode 100644 (file)
index 865a33c..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="value">5222</property>
-    <property name="upper">65555</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_icq_settings">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Pass_word</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_password</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_uin">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">ICQ _UIN</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_uin</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_uin">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_username_example">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; 123456789</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_advanced_settings">
-            <property name="visible">True</property>
-            <property name="column_spacing">12</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkLabel" id="label_charset">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">Ch_aracter set</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_charset</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSpinButton" id="spinbutton_port">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="adjustment">adjustment1</property>
-                <property name="climb_rate">1</property>
-                <property name="numeric">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_server">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_port">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Port</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">spinbutton_port</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="top_attach">2</property>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_server">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Server</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_server</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="top_attach">1</property>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_charset">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_icq_simple">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkLabel" id="label_uin_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your ICQ UIN?</property>
-      </object>
-      <packing>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">4</property>
-            <child>
-              <object class="GtkEntry" id="entry_uin_simple">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_example">
-                <property name="visible">True</property>
-                <property name="xalign">0.10000000149011612</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; 123456789</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-                </attributes>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your ICQ password?</property>
-      </object>
-      <packing>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment2">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-irc.c b/tp-account-widgets/empathy-account-widget-irc.c
deleted file mode 100644 (file)
index 417d309..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-account-widget-irc.h"
-
-#include "empathy-account-widget-private.h"
-#include "empathy-ui-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
-#include "empathy-debug.h"
-
-typedef struct {
-  TpawAccountWidget *self;
-
-  GtkWidget *vbox_settings;
-
-  GtkWidget *network_chooser;
-} TpawAccountWidgetIrc;
-
-static void
-account_widget_irc_destroy_cb (GtkWidget *widget,
-                               TpawAccountWidgetIrc *settings)
-{
-  g_slice_free (TpawAccountWidgetIrc, settings);
-}
-
-static void
-account_widget_irc_setup (TpawAccountWidgetIrc *settings)
-{
-  gchar *nick = NULL;
-  gchar *fullname = NULL;
-  EmpathyAccountSettings *ac_settings;
-
-  g_object_get (settings->self, "settings", &ac_settings, NULL);
-
-  nick = empathy_account_settings_dup_string (ac_settings, "account");
-  fullname = empathy_account_settings_dup_string (ac_settings,
-      "fullname");
-
-  if (nick == NULL)
-    {
-      nick = g_strdup (g_get_user_name ());
-
-      empathy_account_settings_set (ac_settings,
-        "account", g_variant_new_string (nick));
-    }
-
-  if (fullname == NULL)
-    {
-      fullname = g_strdup (g_get_real_name ());
-
-      if (fullname == NULL)
-          fullname = g_strdup (nick);
-
-      empathy_account_settings_set (ac_settings,
-          "fullname", g_variant_new_string (fullname));
-    }
-
-  g_free (nick);
-  g_free (fullname);
-}
-
-static void
-network_changed_cb (TpawIrcNetworkChooser *chooser,
-    TpawAccountWidgetIrc *settings)
-{
-  tpaw_account_widget_changed (settings->self);
-}
-
-/**
- * set_password_prompt_if_needed:
- *
- * If @password is not empty, this function sets the 'password-prompt' param
- * on @ac_settings. This will ensure that Idle actually asks for the password
- * when connecting.
- *
- * Return: %TRUE if the password-prompt param has been changed
- */
-static gboolean
-set_password_prompt_if_needed (EmpathyAccountSettings *ac_settings,
-    const gchar *password)
-{
-  gboolean prompt;
-
-  prompt = !tp_str_empty (password);
-
-  if (prompt == empathy_account_settings_get_boolean (ac_settings,
-        "password-prompt"))
-    return FALSE;
-
-  empathy_account_settings_set (ac_settings, "password-prompt",
-      g_variant_new_boolean (prompt));
-
-  return TRUE;
-}
-
-static void
-entry_password_changed_cb (GtkEntry *entry,
-    TpawAccountWidgetIrc *settings)
-{
-  const gchar *password;
-  EmpathyAccountSettings *ac_settings;
-
-  g_object_get (settings->self, "settings", &ac_settings, NULL);
-
-  password = gtk_entry_get_text (entry);
-
-  set_password_prompt_if_needed (ac_settings, password);
-
-  g_object_unref (ac_settings);
-}
-
-TpawIrcNetworkChooser *
-tpaw_account_widget_irc_build (TpawAccountWidget *self,
-    const char *filename,
-    GtkWidget **table_common_settings,
-    GtkWidget **box)
-{
-  TpawAccountWidgetIrc *settings;
-  EmpathyAccountSettings *ac_settings;
-  GtkWidget *entry_password;
-  gchar *password;
-
-  settings = g_slice_new0 (TpawAccountWidgetIrc);
-  settings->self = self;
-
-  self->ui_details->gui = empathy_builder_get_resource (filename,
-      "table_irc_settings", table_common_settings,
-      "vbox_irc", box,
-      "table_irc_settings", &settings->vbox_settings,
-      "entry_password", &entry_password,
-      NULL);
-
-  /* Add network chooser button */
-  g_object_get (settings->self, "settings", &ac_settings, NULL);
-
-  settings->network_chooser = tpaw_irc_network_chooser_new (ac_settings);
-
-  g_signal_connect (settings->network_chooser, "changed",
-      G_CALLBACK (network_changed_cb), settings);
-
-  gtk_grid_attach (GTK_GRID (*table_common_settings),
-      settings->network_chooser, 1, 0, 1, 1);
-
-  gtk_widget_show (settings->network_chooser);
-
-  account_widget_irc_setup (settings);
-
-  tpaw_account_widget_handle_params (self,
-      "entry_nick", "account",
-      "entry_fullname", "fullname",
-      "entry_password", "password",
-      "entry_quit_message", "quit-message",
-      "entry_username", "username",
-      NULL);
-
-  empathy_builder_connect (self->ui_details->gui, settings,
-      "table_irc_settings", "destroy", account_widget_irc_destroy_cb,
-      NULL);
-
-  self->ui_details->default_focus = g_strdup ("entry_nick");
-
-  g_object_unref (ac_settings);
-
-  /* Automatically set password-prompt when needed */
-  password = empathy_account_settings_dup_string (ac_settings, "password");
-
-  if (set_password_prompt_if_needed (ac_settings, password))
-    {
-      /* Apply right now to save password-prompt */
-      empathy_account_settings_apply_async (ac_settings, NULL, NULL);
-    }
-
-  g_free (password);
-
-  g_signal_connect (entry_password, "changed",
-      G_CALLBACK (entry_password_changed_cb), settings);
-
-  return TPAW_IRC_NETWORK_CHOOSER (settings->network_chooser);
-}
-
-TpawIrcNetworkChooser *
-tpaw_account_widget_irc_build_simple (TpawAccountWidget *self,
-    const char *filename,
-    GtkWidget **box)
-{
-  TpawAccountWidgetIrc *settings;
-  EmpathyAccountSettings *ac_settings;
-  GtkAlignment *alignment;
-
-  settings = g_slice_new0 (TpawAccountWidgetIrc);
-  settings->self = self;
-
-  self->ui_details->gui = empathy_builder_get_resource (filename,
-      "vbox_irc_simple", box,
-      "alignment_network_simple", &alignment,
-      NULL);
-
-  /* Add network chooser button */
-  g_object_get (settings->self, "settings", &ac_settings, NULL);
-
-  settings->network_chooser = tpaw_irc_network_chooser_new (ac_settings);
-
-  g_signal_connect (settings->network_chooser, "changed",
-      G_CALLBACK (network_changed_cb), settings);
-
-  gtk_container_add (GTK_CONTAINER (alignment), settings->network_chooser);
-
-  gtk_widget_show (settings->network_chooser);
-
-  tpaw_account_widget_handle_params (self,
-      "entry_nick_simple", "account",
-      NULL);
-
-  empathy_builder_connect (self->ui_details->gui, settings,
-      "vbox_irc_simple", "destroy", account_widget_irc_destroy_cb,
-      NULL);
-
-  self->ui_details->default_focus = g_strdup ("entry_nick_simple");
-
-  g_object_unref (ac_settings);
-
-  return TPAW_IRC_NETWORK_CHOOSER (settings->network_chooser);
-}
diff --git a/tp-account-widgets/empathy-account-widget-irc.h b/tp-account-widgets/empathy-account-widget-irc.h
deleted file mode 100644 (file)
index 991ab9a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_ACCOUNT_WIDGET_IRC_H__
-#define __TPAW_ACCOUNT_WIDGET_IRC_H__
-
-#include "empathy-account-widget.h"
-#include "empathy-irc-network-chooser.h"
-
-G_BEGIN_DECLS
-
-TpawIrcNetworkChooser * tpaw_account_widget_irc_build (
-    TpawAccountWidget *self,
-    const char *filename,
-    GtkWidget **table_common_settings,
-    GtkWidget **box);
-
-TpawIrcNetworkChooser * tpaw_account_widget_irc_build_simple (
-    TpawAccountWidget *self,
-    const char *filename,
-    GtkWidget **box);
-
-G_END_DECLS
-
-#endif /* __TPAW_ACCOUNT_WIDGET_IRC_H__ */
diff --git a/tp-account-widgets/empathy-account-widget-irc.ui b/tp-account-widgets/empathy-account-widget-irc.ui
deleted file mode 100644 (file)
index fc72974..0000000
+++ /dev/null
@@ -1,603 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <object class="GtkDialog" id="irc_network_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Network</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="icon_name">gtk-edit</property>
-    <property name="type_hint">dialog</property>
-    <property name="skip_taskbar_hint">True</property>
-    <property name="skip_pager_hint">True</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox10">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area10">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="button_close">
-                <property name="label">gtk-close</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_action_appearance">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>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkFrame" id="frame14">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label_xalign">0</property>
-            <property name="shadow_type">none</property>
-            <child>
-              <object class="GtkAlignment" id="alignment28">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="top_padding">6</property>
-                <property name="left_padding">12</property>
-                <child>
-                  <object class="GtkGrid" id="greid14">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <object class="GtkLabel" id="label_network">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Network</property>
-                        <style>
-                          <class name="dim-label"/>
-                        </style>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_charset">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Character set</property>
-                        <style>
-                          <class name="dim-label"/>
-                        </style>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkEntry" id="entry_network">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkComboBox" id="combobox_charset">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-            <child type="label">
-              <object class="GtkLabel" id="label_network1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Network</property>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkFrame" id="frame15">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label_xalign">0</property>
-            <property name="shadow_type">none</property>
-            <child>
-              <object class="GtkAlignment" id="alignment29">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="top_padding">6</property>
-                <property name="left_padding">12</property>
-                <child>
-                  <object class="GtkGrid" id="grid15">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
-                    <child>
-                        <object class="GtkVBox" id="vbox1">
-                        <property name="visible">True</property>
-                       <property name="spacing">0</property>
-                    <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindow_network_server">
-                        <property name="height_request">120</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">never</property>
-                        <property name="shadow_type">in</property>
-                        <property name="expand">True</property>
-                        <child>
-                          <object class="GtkTreeView" id="treeview_servers">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="enable_search">False</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="treeview-selection1"/>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkToolbar" id="toolbar_network_server">
-                        <property name="visible">True</property>
-                        <property name="icon_size">1</property>
-                        <style>
-                          <class name="inline-toolbar"/>
-                        </style>
-                        <child>
-                          <object class="GtkToolButton" id="button_add">
-                            <property name="tooltip-text" translatable="yes">Add…</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="icon_name">list-add-symbolic</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkToolButton" id="button_remove">
-                            <property name="tooltip-text" translatable="yes">Remove</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="icon_name">list-remove-symbolic</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkToolButton" id="button_up">
-                            <property name="tooltip-text" translatable="yes" comments="Translators: tooltip on a 'Go Up' button used to sort IRC servers by priority">Up</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="icon_name">go-up-symbolic</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkToolButton" id="button_down">
-                            <property name="tooltip-text" translatable="yes" comments="Translators: tooltip on a 'Go Down' button used to sort IRC servers by priority">Down</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="icon_name">go-down-symbolic</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                </child>
-               </object>
-              </child>
-             </object>
-            </child>
-            <child type="label">
-              <object class="GtkLabel" id="label_servers">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Servers</property>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-7">button_close</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkVBox" id="vbox_irc">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkGrid" id="table_irc_settings">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_nick">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_password_note">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="xalign">0</property>
-            <property name="yalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">Most IRC servers don't need a password, so if you're not sure, don't enter a password.</property>
-            <property name="use_markup">True</property>
-            <property name="wrap">True</property>
-            <attributes>
-              <attribute name="scale" value="0.80000000000000004"/>
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_network2">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Network</property>
-            <property name="use_underline">True</property>A
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_nick">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Nickname</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_nick</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Password</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander_advanced">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_irc_settings1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="row_spacing">6</property>
-            <property name="column_spacing">12</property>
-            <child>
-              <object class="GtkEntry" id="entry_quit_message">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_quit_message">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">Quit message</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_fullname">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_fullname">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">Real name</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_nick</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_username">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">Username</property>
-                <property name="use_underline">True</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_username">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label_advanced">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_irc_simple">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkLabel" id="label_network_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">Which IRC network?</property>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment_network_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="top_padding">6</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_nick_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your IRC nickname?</property>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment_nick_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="top_padding">6</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_nick_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkSizeGroup" id="sg_field_labels">
-    <widgets>
-      <widget name="label_network2"/>
-      <widget name="label_nick"/>
-      <widget name="label_password"/>
-      <widget name="label_username"/>
-      <widget name="label_fullname"/>
-      <widget name="label_quit_message"/>
-    </widgets>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-jabber.ui b/tp-account-widgets/empathy-account-widget-jabber.ui
deleted file mode 100644 (file)
index 8422daa..0000000
+++ /dev/null
@@ -1,792 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">127</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment2">
-    <property name="upper">65555</property>
-    <property name="value">5222</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_fb_simple">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkLabel" id="label_id_fb_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Facebook username?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkVBox" id="vbox2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin_left">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_id_fb_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_fb_example">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="margin_top">4</property>
-            <property name="xalign">0.10000000149011612</property>
-            <property name="label" translatable="yes">This is your username, not your normal Facebook login.
-If you are facebook.com/&lt;b&gt;badger&lt;/b&gt;, enter &lt;b&gt;badger&lt;/b&gt;.
-Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to choose a Facebook username if you don't have one.</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.80000000000000004"/>
-            </attributes>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_fb_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="ypad">6</property>
-        <property name="label" translatable="yes">What is your Facebook password?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkEntry" id="entry_password_fb_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="margin_left">12</property>
-        <property name="visibility">False</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_fb_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_action_appearance">False</property>
-        <property name="xalign">0</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_gtalk_simple">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkLabel" id="label_id_g_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Google ID?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkVBox" id="vbox1b">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin_left">12</property>
-        <property name="spacing">4</property>
-        <child>
-          <object class="GtkEntry" id="entry_id_g_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_g_example">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0.10000000149011612</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@gmail.com</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.80000000000000004"/>
-            </attributes>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_g_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="ypad">6</property>
-        <property name="label" translatable="yes">What is your Google password?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkEntry" id="entry_password_g_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="margin_left">12</property>
-        <property name="visibility">False</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_g_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_action_appearance">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_jabber_settings">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="hexpand">True</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="valign">start</property>
-            <property name="hexpand">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_id">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkGrid" id="vbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="valign">start</property>
-            <child>
-              <object class="GtkLabel" id="label_username_example">
-                <property name="can_focus">False</property>
-                <property name="valign">start</property>
-                <property name="hexpand">True</property>
-                <property name="xalign">0</property>
-                <property name="xpad">3</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@jabber.org</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.80000000000000004"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_username_g_example">
-                <property name="can_focus">False</property>
-                <property name="valign">start</property>
-                <property name="hexpand">True</property>
-                <property name="xalign">0</property>
-                <property name="xpad">3</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@gmail.com</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.80000000000000004"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_username_f_example">
-                <property name="can_focus">False</property>
-                <property name="valign">start</property>
-                <property name="hexpand">True</property>
-                <property name="xalign">0</property>
-                <property name="xpad">3</property>
-                <property name="label" translatable="yes" comments="This string is not wrapped in the dialog so you may have to add some '\n' to make it look nice.">This is your username, not your normal Facebook login.
-If you are facebook.com/&lt;b&gt;badger&lt;/b&gt;, enter &lt;b&gt;badger&lt;/b&gt;.
-Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to choose a Facebook username if you don't have one.</property>
-                <property name="use_markup">True</property>
-                <property name="wrap">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.80000000000000004"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="hexpand">True</property>
-            <property name="use_action_appearance">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_id">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Login I_D</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_id</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Pass_word</property>
-            <property name="use_underline">True</property>
-            <property name="justify">right</property>
-            <property name="mnemonic_widget">entry_password</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander_advanced">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkScrolledWindow" id="scrolledwindow1">
-            <property name="height_request">200</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hscrollbar_policy">never</property>
-            <property name="shadow_type">in</property>
-            <child>
-              <object class="GtkViewport" id="viewport1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkGrid" id="grid_advanced_settings">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="border_width">6</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <object class="GtkEntry" id="entry_resource">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinbutton_priority">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="adjustment">adjustment1</property>
-                        <property name="climb_rate">1</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkCheckButton" id="checkbutton_ignore_ssl_errors">
-                        <property name="label" translatable="yes">I_gnore SSL certificate errors</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">2</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_priority">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Priori_ty</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">spinbutton_priority</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_resource">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Reso_urce</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">entry_resource</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkCheckButton" id="checkbutton_encryption">
-                        <property name="label" translatable="yes">Encr_yption required (TLS/SSL)</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                        <property name="width">2</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Override server settings</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">4</property>
-                        <property name="width">2</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_server">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">_Server</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">entry_server</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">5</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_port">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">_Port</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">spinbutton_port</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">6</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkCheckButton" id="checkbutton_ssl">
-                        <property name="label" translatable="yes">Use old SS_L</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">7</property>
-                        <property name="width">2</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkEntry" id="entry_server">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">●</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">5</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinbutton_port">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">●</property>
-                        <property name="adjustment">adjustment2</property>
-                        <property name="climb_rate">1</property>
-                        <property name="numeric">True</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">6</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_jabber_simple">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkLabel" id="label_id_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Jabber ID?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_id_create">
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your desired Jabber ID?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkVBox" id="vbox1a">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin_left">12</property>
-        <property name="spacing">4</property>
-        <child>
-          <object class="GtkEntry" id="entry_id_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_example">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0.10000000149011612</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@jabber.org</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.80000000000000004"/>
-            </attributes>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="ypad">6</property>
-        <property name="label" translatable="yes">What is your Jabber password?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_create">
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="ypad">6</property>
-        <property name="label" translatable="yes">What is your desired Jabber password?</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">4</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkEntry" id="entry_password_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="margin_left">12</property>
-        <property name="visibility">False</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">5</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_action_appearance">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">6</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-local-xmpp.ui b/tp-account-widgets/empathy-account-widget-local-xmpp.ui
deleted file mode 100644 (file)
index 460c41c..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkVBox" id="vbox_salut_settings">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkEntry" id="entry_nickname">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_last_name">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_first_name">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_nickname">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Nic_kname</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_nickname</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-            <property name="left_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_last_name">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_Last Name</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_last_name</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">1</property>
-            <property name="left_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_first_name">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_First Name</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_first_name</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander_advanced_settings">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_advanced_settings">
-            <property name="visible">True</property>
-            <property name="column_spacing">12</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkEntry" id="entry_published">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_published">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Published Name</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_published</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_jid">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_email">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_jid">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Jabber ID</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_jid</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="top_attach">2</property>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_email">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">E-_mail address</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_email</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="top_attach">1</property>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkSizeGroup" id="sg_field_labels">
-    <widgets>
-      <widget name="label_nickname"/>
-      <widget name="label_last_name"/>
-      <widget name="label_first_name"/>
-      <widget name="label_published"/>
-      <widget name="label_jid"/>
-      <widget name="label_email"/>
-    </widgets>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-msn.ui b/tp-account-widgets/empathy-account-widget-msn.ui
deleted file mode 100644 (file)
index 4b0614f..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">65535</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_msn_settings">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_msn_settings">
-        <property name="visible">True</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Pass_word</property>
-            <property name="use_underline">True</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_id">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Login I_D</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_id</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_id">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_username_example">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@hotmail.com</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkGrid" id="grid_advanced_msn_settings">
-            <property name="visible">True</property>
-            <property name="column_spacing">6</property>
-            <property name="row_spacing">6</property>
-            <child>
-              <object class="GtkLabel" id="label_port">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Port</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">spinbutton_port</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_server">
-                <property name="visible">True</property>
-                <property name="xalign">1</property>
-                <property name="label" translatable="yes">_Server</property>
-                <property name="use_underline">True</property>
-                <property name="mnemonic_widget">entry_server</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkEntry" id="entry_server">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSpinButton" id="spinbutton_port">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="adjustment">adjustment1</property>
-                <property name="climb_rate">1</property>
-                <property name="numeric">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_msn_simple">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkLabel" id="label_id_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Windows Live ID?</property>
-      </object>
-      <packing>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">4</property>
-            <child>
-              <object class="GtkEntry" id="entry_id_simple">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_example">
-                <property name="visible">True</property>
-                <property name="xalign">0.10000000149011612</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@hotmail.com</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-                </attributes>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Windows Live password?</property>
-      </object>
-      <packing>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment2">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-private.h b/tp-account-widgets/empathy-account-widget-private.h
deleted file mode 100644 (file)
index 6b5c060..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
- */
-
-#ifndef __TPAW_ACCOUNT_WIDGET_PRIVATE_H__
-#define __TPAW_ACCOUNT_WIDGET_PRIVATE_H__
-
-#include "empathy-account-widget.h"
-
-G_BEGIN_DECLS
-
-struct _TpawAccountWidgetUIDetails {
-  GtkBuilder *gui;
-
-  char *default_focus;
-};
-
-
-void tpaw_account_widget_handle_params (TpawAccountWidget *self,
-    const gchar *first_widget,
-    ...);
-
-void tpaw_account_widget_setup_widget (TpawAccountWidget *self,
-    GtkWidget *widget,
-    const gchar *param_name);
-
-G_END_DECLS
-
-#endif /* __TPAW_ACCOUNT_WIDGET_PRIVATE_H__ */
diff --git a/tp-account-widgets/empathy-account-widget-sip.c b/tp-account-widgets/empathy-account-widget-sip.c
deleted file mode 100644 (file)
index eb4a27a..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- *          Frederic Peters <fpeters@0d.be>
- */
-
-#include "config.h"
-#include "empathy-account-widget-sip.h"
-
-#include <glib/gi18n-lib.h>
-
-#include "empathy-account-widget-private.h"
-#include "empathy-ui-utils.h"
-
-typedef struct {
-  TpawAccountWidget *self;
-  GtkWidget *vbox_settings;
-
-  GtkWidget *label_stun_server;
-  GtkWidget *entry_stun_server;
-  GtkWidget *label_stun_port;
-  GtkWidget *spinbutton_stun_port;
-  GtkWidget *checkbutton_discover_stun;
-  GtkWidget *combobox_transport;
-  GtkWidget *combobox_keep_alive_mechanism;
-  GtkWidget *spinbutton_keepalive_interval;
-} TpawAccountWidgetSip;
-
-static void
-account_widget_sip_destroy_cb (GtkWidget *widget,
-                               TpawAccountWidgetSip *settings)
-{
-  g_slice_free (TpawAccountWidgetSip, settings);
-}
-
-static void
-account_widget_sip_discover_stun_toggled_cb (
-    GtkWidget *checkbox,
-    TpawAccountWidgetSip *settings)
-{
-  gboolean active;
-
-  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
-  gtk_widget_set_sensitive (settings->label_stun_server, !active);
-  gtk_widget_set_sensitive (settings->entry_stun_server, !active);
-  gtk_widget_set_sensitive (settings->label_stun_port, !active);
-  gtk_widget_set_sensitive (settings->spinbutton_stun_port, !active);
-}
-
-static void
-keep_alive_mechanism_combobox_change_cb (GtkWidget *widget,
-    TpawAccountWidgetSip *self)
-{
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  gchar *mechanism;
-  gboolean enabled;
-
-  /* Unsensitive the keep-alive spin button if keep-alive is disabled */
-  if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter))
-    return;
-
-  model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-  gtk_tree_model_get (model, &iter, 0, &mechanism, -1);
-
-  enabled = tp_strdiff (mechanism, "none");
-
-  gtk_widget_set_sensitive (self->spinbutton_keepalive_interval, enabled);
-  g_free (mechanism);
-}
-
-static void
-checkbutton_tel_toggled (
-    GtkWidget *checkbox,
-    TpawAccountWidgetSip *sip_settings)
-{
-  EmpathyAccountSettings *settings;
-
-  settings = tpaw_account_widget_get_settings (sip_settings->self);
-
-  empathy_account_settings_set_uri_scheme_tel (settings,
-      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)));
-
-  tpaw_account_widget_changed (sip_settings->self);
-}
-
-GtkWidget *
-tpaw_account_widget_sip_build (TpawAccountWidget *self,
-    const char *filename,
-    GtkWidget **grid_common_settings)
-{
-  TpawAccountWidgetSip *settings;
-  GtkWidget *vbox_settings;
-  gboolean is_simple;
-  GtkWidget *grid_advanced;
-
-  g_object_get (self, "simple", &is_simple, NULL);
-
-  if (is_simple)
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_sip_simple", &vbox_settings,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_userid_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_userid_simple");
-    }
-  else
-    {
-      GtkListStore *store;
-      GtkCellRenderer *renderer;
-      GtkToggleButton *checkbutton_tel;
-
-      settings = g_slice_new0 (TpawAccountWidgetSip);
-      settings->self = self;
-
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_settings", grid_common_settings,
-          "grid_advanced_sip_settings", &grid_advanced,
-          "vbox_sip_settings", &vbox_settings,
-          "label_stun-server", &settings->label_stun_server,
-          "entry_stun-server", &settings->entry_stun_server,
-          "label_stun-port", &settings->label_stun_port,
-          "spinbutton_stun-port", &settings->spinbutton_stun_port,
-          "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
-          "spinbutton_keepalive-interval",
-            &settings->spinbutton_keepalive_interval,
-          "checkbutton_tel", &checkbutton_tel,
-          NULL);
-      settings->vbox_settings = vbox_settings;
-
-      gtk_toggle_button_set_active (checkbutton_tel,
-          empathy_account_settings_has_uri_scheme_tel (
-            tpaw_account_widget_get_settings (self)));
-
-      tpaw_account_widget_handle_params (self,
-          "entry_userid", "account",
-          "entry_password", "password",
-          "checkbutton_discover-stun", "discover-stun",
-          "entry_stun-server", "stun-server",
-          "spinbutton_stun-port", "stun-port",
-          "entry_auth-user", "auth-user",
-          "entry_proxy-host", "proxy-host",
-          "spinbutton_port", "port",
-          "checkbutton_loose-routing", "loose-routing",
-          "checkbutton_discover-binding", "discover-binding",
-          "spinbutton_keepalive-interval", "keepalive-interval",
-          "checkbutton_ignore-tls-errors", "ignore-tls-errors",
-          "entry_local-ip-address", "local-ip-address",
-          "spinbutton_local-port", "local-port",
-          NULL);
-
-      account_widget_sip_discover_stun_toggled_cb (
-          settings->checkbutton_discover_stun,
-          settings);
-
-      empathy_builder_connect (self->ui_details->gui, settings,
-          "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
-          "checkbutton_discover-stun", "toggled",
-          account_widget_sip_discover_stun_toggled_cb,
-          "checkbutton_tel", "toggled", checkbutton_tel_toggled,
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_userid");
-
-      /* Create the 'transport' combo box. The first column has to contain the
-       * value of the param. */
-      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
-      settings->combobox_transport = gtk_combo_box_new_with_model (
-          GTK_TREE_MODEL (store));
-
-      renderer = gtk_cell_renderer_text_new ();
-      gtk_cell_layout_pack_start (
-          GTK_CELL_LAYOUT (settings->combobox_transport), renderer, TRUE);
-      gtk_cell_layout_add_attribute (
-          GTK_CELL_LAYOUT (settings->combobox_transport), renderer, "text", 1);
-
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "auto", 1, _("Auto"), -1);
-
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "udp", 1, _("UDP"), -1);
-
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "tcp", 1, _("TCP"), -1);
-
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "tls", 1, _("TLS"), -1);
-
-      tpaw_account_widget_setup_widget (self, settings->combobox_transport,
-          "transport");
-
-      gtk_grid_attach (GTK_GRID (grid_advanced), settings->combobox_transport,
-          1, 11, 3, 1);
-
-      gtk_widget_show (settings->combobox_transport);
-
-      /* Create the 'keep-alive mechanism' combo box */
-      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
-      settings->combobox_keep_alive_mechanism = gtk_combo_box_new_with_model (
-          GTK_TREE_MODEL (store));
-
-      renderer = gtk_cell_renderer_text_new ();
-      gtk_cell_layout_pack_start (
-          GTK_CELL_LAYOUT (settings->combobox_keep_alive_mechanism), renderer,
-          TRUE);
-      gtk_cell_layout_add_attribute (
-          GTK_CELL_LAYOUT (settings->combobox_keep_alive_mechanism), renderer,
-          "text", 1);
-
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "auto", 1, _("Auto"), -1);
-
-      /* translators: this string is very specific to SIP's internal; maybe
-       * best to keep the English version. */
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "register", 1, _("Register"), -1);
-
-      /* translators: this string is very specific to SIP's internal; maybe
-       * best to keep the English version. */
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "options", 1, _("Options"), -1);
-
-      gtk_list_store_insert_with_values (store, NULL, -1,
-          0, "none", 1, _("None"), -1);
-
-      g_signal_connect (settings->combobox_keep_alive_mechanism, "changed",
-          G_CALLBACK (keep_alive_mechanism_combobox_change_cb), settings);
-
-      tpaw_account_widget_setup_widget (self,
-          settings->combobox_keep_alive_mechanism, "keepalive-mechanism");
-
-      gtk_grid_attach (GTK_GRID (grid_advanced),
-          settings->combobox_keep_alive_mechanism,
-          1, 7, 3, 1);
-
-      gtk_widget_show (settings->combobox_keep_alive_mechanism);
-    }
-
-  return vbox_settings;
-}
diff --git a/tp-account-widgets/empathy-account-widget-sip.h b/tp-account-widgets/empathy-account-widget-sip.h
deleted file mode 100644 (file)
index aac3004..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Frederic Peters <fpeters@0d.be>
- */
-
-#ifndef __TPAW_ACCOUNT_WIDGET_SIP_H__
-#define __TPAW_ACCOUNT_WIDGET_SIP_H__
-
-#include "empathy-account-widget.h"
-
-G_BEGIN_DECLS
-
-GtkWidget * tpaw_account_widget_sip_build (TpawAccountWidget *self,
-    const char *filename,
-    GtkWidget **grid_common_settings);
-
-G_END_DECLS
-
-#endif /* __TPAW_ACCOUNT_WIDGET_SIP_H__ */
diff --git a/tp-account-widgets/empathy-account-widget-sip.ui b/tp-account-widgets/empathy-account-widget-sip.ui
deleted file mode 100644 (file)
index 7caa7ca..0000000
+++ /dev/null
@@ -1,731 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">65535</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment2">
-    <property name="upper">65535</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment3">
-    <property name="upper">10000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment4">
-    <property name="upper">65535</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_sip_settings">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">Pass_word</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_password</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_userid">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_userid">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">1</property>
-            <property name="label" translatable="yes">_Username</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_userid</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_username_example">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@my.sip.server</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.80000000000000004"/>
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="use_action_appearance">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="checkbutton_tel">
-            <property name="label" translatable="yes">Use this account to call _landlines and mobile phones</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="use_action_appearance">False</property>
-            <property name="use_underline">True</property>
-            <property name="xalign">0</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="top_attach">4</property>
-            <property name="left_attach">0</property>
-            <property name="width">4</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander_advanced">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkScrolledWindow" id="scrolledwindow1">
-            <property name="height_request">200</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hscrollbar_policy">never</property>
-            <property name="shadow_type">in</property>
-            <child>
-              <object class="GtkViewport" id="viewport1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="resize_mode">queue</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkAlignment" id="alignment3">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="border_width">6</property>
-                    <child>
-                      <object class="GtkGrid" id="grid_advanced_sip_settings">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="column_spacing">6</property>
-                        <property name="row_spacing">6</property>
-                        <child>
-                          <object class="GtkEntry" id="entry_stun-server">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkEntry" id="entry_auth-user">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">10</property>
-                            <property name="width">3</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkEntry" id="entry_proxy-host">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="spinbutton_keepalive-interval">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">adjustment3</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">8</property>
-                            <property name="width">3</property>
-                          </packing>
-                        </child>
-                        <child>
-                         <object class="GtkEntry" id="entry_local-ip-address">
-                           <property name="visible">True</property>
-                           <property name="can_focus">True</property>
-                         </object>
-                         <packing>
-                           <property name="left_attach">1</property>
-                           <property name="top_attach">14</property>
-                         </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_nat_traversal">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">NAT Traversal Options</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_proxy">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Proxy Options</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">4</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_misc">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Miscellaneous Options</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">9</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment7">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">24</property>
-                            <child>
-                              <object class="GtkLabel" id="label_stun-server">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">STUN Server</property>
-                                <property name="mnemonic_widget">entry_stun-server</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">2</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment4">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkCheckButton" id="checkbutton_discover-stun">
-                                <property name="label" translatable="yes">Discover the STUN server automatically</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">1</property>
-                            <property name="left_attach">0</property>
-                            <property name="width">4</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment5">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkCheckButton" id="checkbutton_discover-binding">
-                                <property name="label" translatable="yes">Discover Binding</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">3</property>
-                            <property name="left_attach">0</property>
-                            <property name="width">4</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment8">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkLabel" id="label_proxy-host">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Server</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">5</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_keep_alive">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Keep-Alive Options</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"/>
-                            </attributes>
-                          </object>
-                          <packing>
-                            <property name="top_attach">6</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment10">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkLabel" id="label_keepalive-mechanism">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Mechanism</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">7</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment11">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkLabel" id="label_keepalive-interval">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Interval (seconds)</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">8</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment12">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkLabel" id="label_auth-user">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Authentication username</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">10</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment13">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkLabel" id="label_transport">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Transport</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">11</property>
-                            <property name="left_attach">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment14">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkCheckButton" id="checkbutton_loose-routing">
-                                <property name="label" translatable="yes">Loose Routing</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">12</property>
-                            <property name="left_attach">0</property>
-                            <property name="width">4</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment15">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkCheckButton" id="checkbutton_ignore-tls-errors">
-                                <property name="label" translatable="yes">Ignore TLS Errors</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="top_attach">13</property>
-                            <property name="left_attach">0</property>
-                            <property name="width">4</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_stun-port">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Port</property>
-                            <property name="mnemonic_widget">spinbutton_stun-port</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="top_attach">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="spinbutton_stun-port">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">adjustment1</property>
-                            <property name="climb_rate">1</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">3</property>
-                            <property name="top_attach">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_port">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Port</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="top_attach">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="spinbutton_port">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">adjustment2</property>
-                            <property name="climb_rate">1</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">3</property>
-                            <property name="top_attach">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment16">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="left_padding">12</property>
-                            <child>
-                              <object class="GtkLabel" id="label_local-ip-address">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Local IP Address</property>
-                                <property name="mnemonic_widget">entry_local-ip-address</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">14</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label_local-port">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Port</property>
-                            <property name="mnemonic_widget">spinbutton_local-port</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">2</property>
-                            <property name="top_attach">14</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSpinButton" id="spinbutton_local-port">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">adjustment4</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">3</property>
-                            <property name="top_attach">14</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label_expander">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_sip_simple">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkLabel" id="label_userid_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your SIP login ID?</property>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">4</property>
-            <child>
-              <object class="GtkEntry" id="entry_userid_simple">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_example">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0.10000000149011612</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@my.sip.server</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.80000000000000004"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your SIP account password?</property>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember Password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="use_action_appearance">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget-yahoo.ui b/tp-account-widgets/empathy-account-widget-yahoo.ui
deleted file mode 100644 (file)
index 9d00253..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="value">5050</property>
-    <property name="lower">1</property>
-    <property name="upper">65555</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkVBox" id="vbox_yahoo_settings">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkGrid" id="grid_common_settings">
-        <property name="visible">True</property>
-        <property name="column_spacing">12</property>
-        <property name="row_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="label_password">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Pass_word:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_password</property>
-          </object>
-          <packing>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_id">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Yahoo! I_D:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">entry_id</property>
-          </object>
-          <packing>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_id">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="entry_password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="label_username_example">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="xpad">3</property>
-            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
-            <property name="use_markup">True</property>
-            <attributes>
-              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-            </attributes>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="remember_password">
-            <property name="label" translatable="yes">Remember password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="active">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkExpander" id="expander1">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <child>
-          <object class="GtkVBox" id="vbox1">
-            <property name="visible">True</property>
-            <child>
-              <object class="GtkGrid" id="grid_advanced_settings">
-                <property name="visible">True</property>
-                <property name="column_spacing">12</property>
-                <property name="row_spacing">6</property>
-                <child>
-                  <object class="GtkCheckButton" id="checkbutton_ignore_invites">
-                    <property name="label" translatable="yes">I_gnore conference and chat room invitations</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="width">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label_locale">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">_Room List locale:</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">entry_locale</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="left_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label_charset">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Ch_aracter set:</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">entry_charset</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">2</property>
-                    <property name="left_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="entry_locale">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="entry_charset">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label_port">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">_Port:</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">spinbutton_port</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">3</property>
-                    <property name="left_attach">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="spinbutton_port">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="adjustment">adjustment1</property>
-                    <property name="climb_rate">1</property>
-                    <property name="numeric">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">3</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Advanced</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
-  <object class="GtkVBox" id="vbox_yahoo_simple">
-    <property name="visible">True</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">6</property>
-    <child>
-      <object class="GtkLabel" id="label_id_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Yahoo! ID?</property>
-      </object>
-      <packing>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="bottom_padding">3</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkVBox" id="vbox2">
-            <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">4</property>
-            <child>
-              <object class="GtkEntry" id="entry_id_simple">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="label_example">
-                <property name="visible">True</property>
-                <property name="xalign">0.10000000149011612</property>
-                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
-                <property name="use_markup">True</property>
-                <attributes>
-                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
-                </attributes>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label_password_simple">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">What is your Yahoo! password?</property>
-      </object>
-      <packing>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkAlignment" id="alignment2">
-        <property name="visible">True</property>
-        <property name="xalign">0</property>
-        <property name="yalign">0</property>
-        <property name="xscale">0.34999999403953552</property>
-        <property name="yscale">0.34999999403953552</property>
-        <property name="left_padding">12</property>
-        <child>
-          <object class="GtkEntry" id="entry_password_simple">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="visibility">False</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="position">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkCheckButton" id="remember_password_simple">
-        <property name="label" translatable="yes">Remember password</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="active">True</property>
-        <property name="draw_indicator">True</property>
-      </object>
-      <packing>
-        <property name="position">4</property>
-      </packing>
-    </child>
-  </object>
-</interface>
diff --git a/tp-account-widgets/empathy-account-widget.c b/tp-account-widgets/empathy-account-widget.c
deleted file mode 100644 (file)
index a26d2ab..0000000
+++ /dev/null
@@ -1,2331 +0,0 @@
-/*
- * Copyright (C) 2006-2007 Imendio AB
- * 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
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- *          Martyn Russell <martyn@imendio.com>
- *          Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
- *          Jonathan Tellier <jonathan.tellier@gmail.com>
- *          Danielle Madeley <danielle.madeley@collabora.co.uk>
- */
-
-#include "config.h"
-#include "empathy-account-widget.h"
-#include "empathy-account-widget-private.h"
-
-#include <glib/gi18n-lib.h>
-#include <dbus/dbus-protocol.h>
-
-#include "empathy-account-widget-irc.h"
-#include "empathy-account-widget-private.h"
-#include "empathy-account-widget-sip.h"
-#include "empathy-ui-utils.h"
-#include "empathy-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
-#include "empathy-debug.h"
-
-G_DEFINE_TYPE (TpawAccountWidget, tpaw_account_widget, GTK_TYPE_BOX)
-
-typedef enum
-{
-  NO_SERVICE = 0,
-  GTALK_SERVICE,
-  FACEBOOK_SERVICE,
-  N_SERVICES
-} Service;
-
-typedef struct
-{
-  const gchar *label_username_example;
-  gboolean show_advanced;
-} ServiceInfo;
-
-static ServiceInfo services_infos[N_SERVICES] = {
-    { "label_username_example", TRUE },
-    { "label_username_g_example", FALSE },
-    { "label_username_f_example", FALSE },
-};
-
-struct _TpawAccountWidgetPriv {
-  EmpathyAccountSettings *settings;
-
-  GtkWidget *grid_common_settings;
-  GtkWidget *apply_button;
-  GtkWidget *cancel_button;
-  GtkWidget *entry_password;
-  GtkWidget *spinbutton_port;
-  GtkWidget *radiobutton_reuse;
-  GtkWidget *hbox_buttons;
-
-  gboolean simple;
-
-  gboolean contains_pending_changes;
-
-  /* An TpawAccountWidget can be used to either create an account or
-   * modify it. When we are creating an account, this member is set to TRUE */
-  gboolean creating_account;
-
-  /* whether there are any other real accounts. Necessary so we know whether
-   * it's safe to dismiss this widget in some cases (eg, whether the Cancel
-   * button should be sensitive) */
-  gboolean other_accounts_exist;
-
-  /* if TRUE, the GTK+ destroy signal has been fired and so the widgets
-   * embedded in this account widget can't be used any more
-   * workaround because some async callbacks can be called after the
-   * widget has been destroyed */
-  gboolean destroyed;
-
-  TpAccountManager *account_manager;
-
-  GtkWidget *param_account_widget;
-  GtkWidget *param_password_widget;
-
-  gboolean automatic_change;
-  GtkWidget *remember_password_widget;
-
-  /* Used only for IRC accounts */
-  TpawIrcNetworkChooser *irc_network_chooser;
-
-  /* Used for 'special' XMPP account having a service associated ensuring that
-   * JIDs have a specific suffix; such as Facebook for example */
-  gchar *jid_suffix;
-};
-
-enum {
-  PROP_PROTOCOL = 1,
-  PROP_SETTINGS,
-  PROP_SIMPLE,
-  PROP_CREATING_ACCOUNT,
-  PROP_OTHER_ACCOUNTS_EXIST,
-};
-
-enum {
-  HANDLE_APPLY,
-  ACCOUNT_CREATED,
-  CANCELLED,
-  CLOSE,
-  LAST_SIGNAL
-};
-
-enum {
-  RESPONSE_LAUNCH
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-#define CHANGED_TIMEOUT 300
-
-#define DIGIT             "0-9"
-#define DIGITS            "(["DIGIT"]+)"
-#define ALPHA             "a-zA-Z"
-#define ALPHAS            "(["ALPHA"]+)"
-#define ALPHADIGIT        ALPHA DIGIT
-#define ALPHADIGITS       "(["ALPHADIGIT"]+)"
-#define ALPHADIGITDASH    ALPHA DIGIT "-"
-#define ALPHADIGITDASHS   "(["ALPHADIGITDASH"]*)"
-
-#define HOSTNUMBER        "("DIGITS"\\."DIGITS"\\."DIGITS"\\."DIGITS")"
-#define TOPLABEL          "("ALPHAS \
-                            "| (["ALPHA"]"ALPHADIGITDASHS "["ALPHADIGIT"]))"
-#define DOMAINLABEL       "("ALPHADIGITS"|(["ALPHADIGIT"]" ALPHADIGITDASHS \
-                                       "["ALPHADIGIT"]))"
-#define HOSTNAME          "((" DOMAINLABEL "\\.)+" TOPLABEL ")"
-/* Based on http://www.ietf.org/rfc/rfc1738.txt (section 5) */
-#define HOST              "("HOSTNAME "|" HOSTNUMBER")"
-/* Based on http://www.ietf.org/rfc/rfc0822.txt (appendix D) */
-#define EMAIL_LOCALPART   "([^\\(\\)<>@,;:\\\\\"\\[\\]\\s]+)"
-
-/* UIN is digital according to the unofficial specification:
- * http://iserverd.khstu.ru/docum_ext/icqv5.html#CTS
- * 5 digits minimum according to http://en.wikipedia.org/wiki/ICQ#UIN
- * According to an user, we can also provide an email address instead of the
- * ICQ UIN. */
-#define ICQ_USER_NAME     "((["DIGIT"]{5,})|"EMAIL_LOCALPART"@"HOST")"
-
-/* Based on http://www.ietf.org/rfc/rfc2812.txt (section 2.3.1) */
-#define IRC_SPECIAL       "_\\[\\]{}\\\\|`^"
-#define IRC_NICK_NAME     "(["ALPHA IRC_SPECIAL"]["ALPHADIGITDASH IRC_SPECIAL"]*)"
-
-/* Based on http://www.ietf.org/rfc/rfc4622.txt (section 2.2)
- * We just exclude invalid characters to avoid ucschars and other redundant
- * complexity */
-#define JABBER_USER_NAME  "([^@:'\"<>&\\s]+)"
-/* ID is an email according to the unofficial specification:
- * http://www.hypothetic.org/docs/msn/general/names.php */
-#define MSN_USER_NAME     EMAIL_LOCALPART
-/* Based on the official help:
- * http://help.yahoo.com/l/us/yahoo/edit/registration/edit-01.html
- * Looks like an email address can be used as well (bgo #655959)
- * */
-#define YAHOO_USER_NAME   "(["ALPHA"]["ALPHADIGIT"_\\.]{3,31})|("EMAIL_LOCALPART"@"HOST")"
-
-#define ACCOUNT_REGEX_ICQ      "^"ICQ_USER_NAME"$"
-#define ACCOUNT_REGEX_IRC      "^"IRC_NICK_NAME"$"
-#define ACCOUNT_REGEX_JABBER   "^"JABBER_USER_NAME"@[^@/]+"
-#define ACCOUNT_REGEX_MSN      "^"MSN_USER_NAME"@"HOST"$"
-#define ACCOUNT_REGEX_YAHOO    "^"YAHOO_USER_NAME"$"
-
-static void
-account_widget_set_control_buttons_sensitivity (TpawAccountWidget *self,
-    gboolean sensitive)
-{
-  /* we hit this case because of the 'other-accounts-exist' property handler
-   * being called during init (before constructed()) */
-  if (self->priv->apply_button == NULL || self->priv->cancel_button == NULL)
-    return;
-
-  gtk_widget_set_sensitive (self->priv->apply_button, sensitive);
-
-  if (sensitive)
-    {
-      /* We can't grab default if the widget hasn't be packed in a
-       * window */
-      GtkWidget *window;
-
-      window = gtk_widget_get_toplevel (self->priv->apply_button);
-      if (window != NULL &&
-          gtk_widget_is_toplevel (window))
-        {
-          gtk_widget_set_can_default (self->priv->apply_button, TRUE);
-          gtk_widget_grab_default (self->priv->apply_button);
-        }
-    }
-}
-
-static void
-account_widget_set_entry_highlighting (GtkEntry *entry,
-    gboolean highlight)
-{
-  g_return_if_fail (GTK_IS_ENTRY (entry));
-
-  if (highlight)
-    {
-      GtkStyleContext *style;
-      GdkRGBA color;
-
-      style = gtk_widget_get_style_context (GTK_WIDGET (entry));
-      gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
-          &color);
-
-      /* Here we take the current theme colour and add it to
-       * the colour for white and average the two. This
-       * gives a colour which is inline with the theme but
-       * slightly whiter.
-       */
-      empathy_make_color_whiter (&color);
-
-      gtk_widget_override_background_color (GTK_WIDGET (entry), 0, &color);
-    }
-  else
-    {
-      gtk_widget_override_background_color (GTK_WIDGET (entry), 0, NULL);
-    }
-}
-
-static void
-account_widget_handle_control_buttons_sensitivity (TpawAccountWidget *self)
-{
-  gboolean is_valid;
-
-  is_valid = empathy_account_settings_is_valid (self->priv->settings);
-
-  account_widget_set_control_buttons_sensitivity (self, is_valid);
-
-  g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid);
-}
-
-static void
-account_widget_entry_changed_common (TpawAccountWidget *self,
-    GtkEntry *entry, gboolean focus)
-{
-  const gchar *str;
-  const gchar *param_name;
-  gboolean prev_status;
-  gboolean curr_status;
-
-  str = gtk_entry_get_text (entry);
-  param_name = g_object_get_data (G_OBJECT (entry), "param_name");
-  prev_status = empathy_account_settings_parameter_is_valid (
-      self->priv->settings, param_name);
-
-  if (EMP_STR_EMPTY (str))
-    {
-      empathy_account_settings_unset (self->priv->settings, param_name);
-
-      if (focus)
-        {
-          gchar *value;
-
-          value = empathy_account_settings_dup_string (self->priv->settings,
-              param_name);
-
-          DEBUG ("Unset %s and restore to %s", param_name, value);
-          gtk_entry_set_text (entry, value ? value : "");
-          g_free (value);
-        }
-    }
-  else
-    {
-      DEBUG ("Setting %s to %s", param_name,
-          tp_strdiff (param_name, "password") ? str : "***");
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_string (str));
-    }
-
-  curr_status = empathy_account_settings_parameter_is_valid (
-      self->priv->settings, param_name);
-
-  if (curr_status != prev_status)
-    account_widget_set_entry_highlighting (entry, !curr_status);
-}
-
-static void
-account_widget_entry_changed_cb (GtkEditable *entry,
-    TpawAccountWidget *self)
-{
-  if (self->priv->automatic_change)
-    return;
-
-  account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
-  tpaw_account_widget_changed (self);
-}
-
-static void
-account_widget_entry_map_cb (GtkEntry *entry,
-    TpawAccountWidget *self)
-{
-  const gchar *param_name;
-  gboolean is_valid;
-
-  /* need to initialize input highlighting */
-  param_name = g_object_get_data (G_OBJECT (entry), "param_name");
-  is_valid = empathy_account_settings_parameter_is_valid (self->priv->settings,
-      param_name);
-  account_widget_set_entry_highlighting (entry, !is_valid);
-}
-
-static void
-account_widget_int_changed_cb (GtkWidget *widget,
-    TpawAccountWidget *self)
-{
-  const gchar *param_name;
-  gint value;
-  const gchar *signature;
-
-  value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
-  param_name = g_object_get_data (G_OBJECT (widget), "param_name");
-
-  signature = empathy_account_settings_get_dbus_signature (self->priv->settings,
-    param_name);
-  g_return_if_fail (signature != NULL);
-
-  DEBUG ("Setting %s to %d", param_name, value);
-
-  switch ((int)*signature)
-    {
-    case DBUS_TYPE_INT16:
-    case DBUS_TYPE_INT32:
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_int32 (value));
-      break;
-    case DBUS_TYPE_INT64:
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_int64 (value));
-      break;
-    case DBUS_TYPE_UINT16:
-    case DBUS_TYPE_UINT32:
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_uint32 (value));
-      break;
-    case DBUS_TYPE_UINT64:
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_uint64 (value));
-      break;
-    default:
-      g_return_if_reached ();
-    }
-
-  tpaw_account_widget_changed (self);
-}
-
-static void
-account_widget_checkbutton_toggled_cb (GtkWidget *widget,
-    TpawAccountWidget *self)
-{
-  gboolean     value;
-  gboolean     default_value;
-  const gchar *param_name;
-
-  value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
-  param_name = g_object_get_data (G_OBJECT (widget), "param_name");
-
-  /* FIXME: This is ugly! checkbox don't have a "not-set" value so we
-   * always unset the param and set the value if different from the
-   * default value. */
-  empathy_account_settings_unset (self->priv->settings, param_name);
-  default_value = empathy_account_settings_get_boolean (self->priv->settings,
-      param_name);
-
-  if (default_value == value)
-    {
-      DEBUG ("Unset %s and restore to %d", param_name, default_value);
-    }
-  else
-    {
-      DEBUG ("Setting %s to %d", param_name, value);
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_boolean (value));
-    }
-
-  tpaw_account_widget_changed (self);
-}
-
-static void
-account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
-    TpawAccountWidget *self)
-{
-  gboolean   value;
-  gint32       port = 0;
-
-  value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
-  port = empathy_account_settings_get_uint32 (self->priv->settings, "port");
-
-  if (value)
-    {
-      if (port == 5222 || port == 0)
-        port = 5223;
-    }
-  else
-    {
-      if (port == 5223 || port == 0)
-        port = 5222;
-    }
-
-  gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->priv->spinbutton_port),
-      port);
-
-  self->priv->contains_pending_changes = TRUE;
-}
-
-static void
-account_widget_combobox_changed_cb (GtkWidget *widget,
-    TpawAccountWidget *self)
-{
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  const gchar *value;
-  GVariant *v;
-  const gchar *default_value = NULL;
-  const gchar *param_name;
-
-  if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter))
-    return;
-
-  model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-  /* the param value is stored in the first column */
-  gtk_tree_model_get (model, &iter, 0, &value, -1);
-
-  param_name = g_object_get_data (G_OBJECT (widget), "param_name");
-
-  v = empathy_account_settings_dup_default (self->priv->settings, param_name);
-  if (v != NULL && g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
-    default_value = g_variant_get_string (v, NULL);
-
-  if (!tp_strdiff (value, default_value))
-    {
-      DEBUG ("Unset %s and restore to %s", param_name, default_value);
-      empathy_account_settings_unset (self->priv->settings, param_name);
-    }
-  else
-    {
-      DEBUG ("Setting %s to %s", param_name, value);
-      empathy_account_settings_set (self->priv->settings, param_name,
-          g_variant_new_string (value));
-    }
-
-  tpaw_account_widget_changed (self);
-
-  tp_clear_pointer (&v, g_variant_unref);
-}
-
-static void
-clear_icon_released_cb (GtkEntry *entry,
-    GtkEntryIconPosition icon_pos,
-    GdkEvent *event,
-    TpawAccountWidget *self)
-{
-  const gchar *param_name;
-
-  param_name = g_object_get_data (G_OBJECT (entry), "param_name");
-
-  DEBUG ("Unset %s", param_name);
-  empathy_account_settings_unset (self->priv->settings, param_name);
-  gtk_entry_set_text (entry, "");
-
-  tpaw_account_widget_changed (self);
-}
-
-static void
-password_entry_changed_cb (GtkEditable *entry,
-    TpawAccountWidget *self)
-{
-  const gchar *str;
-
-  str = gtk_entry_get_text (GTK_ENTRY (entry));
-
-  gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
-      GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
-}
-
-static void
-password_entry_activated_cb (GtkEntry *entry,
-    TpawAccountWidget *self)
-{
-    if (gtk_widget_get_sensitive (self->priv->apply_button))
-        tpaw_account_widget_apply_and_log_in (self);
-}
-
-static void
-account_entry_activated_cb (GtkEntry *entry,
-    TpawAccountWidget *self)
-{
-    if (gtk_widget_get_sensitive (self->priv->apply_button))
-        tpaw_account_widget_apply_and_log_in (self);
-}
-
-void
-tpaw_account_widget_setup_widget (TpawAccountWidget *self,
-    GtkWidget *widget,
-    const gchar *param_name)
-{
-  g_object_set_data_full (G_OBJECT (widget), "param_name",
-      g_strdup (param_name), g_free);
-
-  if (GTK_IS_SPIN_BUTTON (widget))
-    {
-      gint value = 0;
-      const gchar *signature;
-
-      signature = empathy_account_settings_get_dbus_signature (
-          self->priv->settings, param_name);
-      g_return_if_fail (signature != NULL);
-
-      switch ((int)*signature)
-        {
-          case DBUS_TYPE_INT16:
-          case DBUS_TYPE_INT32:
-            value = empathy_account_settings_get_int32 (self->priv->settings,
-              param_name);
-            break;
-          case DBUS_TYPE_INT64:
-            value = empathy_account_settings_get_int64 (self->priv->settings,
-              param_name);
-            break;
-          case DBUS_TYPE_UINT16:
-          case DBUS_TYPE_UINT32:
-            value = empathy_account_settings_get_uint32 (self->priv->settings,
-              param_name);
-            break;
-          case DBUS_TYPE_UINT64:
-            value = empathy_account_settings_get_uint64 (self->priv->settings,
-                param_name);
-            break;
-          default:
-            g_return_if_reached ();
-        }
-
-      gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
-
-      g_signal_connect (widget, "value-changed",
-          G_CALLBACK (account_widget_int_changed_cb),
-          self);
-    }
-  else if (GTK_IS_ENTRY (widget))
-    {
-      gchar *str;
-
-      str = empathy_account_settings_dup_string (self->priv->settings,
-          param_name);
-      gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
-
-      if (!tp_strdiff (param_name, "account"))
-        self->priv->param_account_widget = widget;
-      else if (!tp_strdiff (param_name, "password"))
-        self->priv->param_password_widget = widget;
-
-      if (strstr (param_name, "password"))
-        {
-          gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
-
-          /* Add 'clear' icon */
-          gtk_entry_set_icon_from_stock (GTK_ENTRY (widget),
-              GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
-
-          gtk_entry_set_icon_sensitive (GTK_ENTRY (widget),
-              GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
-
-          g_signal_connect (widget, "icon-release",
-              G_CALLBACK (clear_icon_released_cb), self);
-          g_signal_connect (widget, "changed",
-              G_CALLBACK (password_entry_changed_cb), self);
-          g_signal_connect (widget, "activate",
-              G_CALLBACK (password_entry_activated_cb), self);
-        }
-      else if (strstr (param_name, "account"))
-        g_signal_connect (widget, "activate",
-            G_CALLBACK (account_entry_activated_cb), self);
-
-      g_signal_connect (widget, "changed",
-          G_CALLBACK (account_widget_entry_changed_cb), self);
-      g_signal_connect (widget, "map",
-          G_CALLBACK (account_widget_entry_map_cb), self);
-
-      g_free (str);
-    }
-  else if (GTK_IS_TOGGLE_BUTTON (widget))
-    {
-      gboolean value = FALSE;
-
-      value = empathy_account_settings_get_boolean (self->priv->settings,
-          param_name);
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
-
-      g_signal_connect (widget, "toggled",
-          G_CALLBACK (account_widget_checkbutton_toggled_cb),
-          self);
-    }
-  else if (GTK_IS_COMBO_BOX (widget))
-    {
-      /* The combo box's model has to contain the param value in its first
-       * column (as a string) */
-      gchar *str;
-      GtkTreeModel *model;
-      GtkTreeIter iter;
-      gboolean valid;
-
-      str = empathy_account_settings_dup_string (self->priv->settings,
-          param_name);
-      model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-
-      valid = gtk_tree_model_get_iter_first (model, &iter);
-      while (valid)
-        {
-          gchar *name;
-
-          gtk_tree_model_get (model, &iter, 0, &name, -1);
-          if (!tp_strdiff (name, str))
-            {
-              gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);
-              valid = FALSE;
-            }
-          else
-            {
-              valid = gtk_tree_model_iter_next (model, &iter);
-            }
-
-          g_free (name);
-        }
-
-      g_free (str);
-
-      g_signal_connect (widget, "changed",
-          G_CALLBACK (account_widget_combobox_changed_cb),
-          self);
-    }
-  else
-    {
-      DEBUG ("Unknown type of widget for param %s", param_name);
-    }
-
-  gtk_widget_set_sensitive (widget,
-      empathy_account_settings_param_is_supported (self->priv->settings,
-        param_name));
-}
-
-static GHashTable *
-build_translated_params (void)
-{
-  GHashTable *hash;
-
-  hash = g_hash_table_new (g_str_hash, g_str_equal);
-  g_hash_table_insert (hash, "account", _("Account"));
-  g_hash_table_insert (hash, "password", _("Password"));
-  g_hash_table_insert (hash, "server", _("Server"));
-  g_hash_table_insert (hash, "port", _("Port"));
-
-  return hash;
-}
-
-static gchar *
-account_widget_generic_format_param_name (const gchar *param_name)
-{
-  gchar *str;
-  gchar *p;
-  static GHashTable *translated_params = NULL;
-
-  g_return_val_if_fail (param_name != NULL, NULL);
-
-  if (G_UNLIKELY (translated_params == NULL))
-    translated_params = build_translated_params ();
-
-  /* Translate most common parameters */
-  str = g_hash_table_lookup (translated_params, param_name);
-  if (str != NULL)
-    return g_strdup (str);
-
-  str = g_strdup (param_name);
-
-  if (str && g_ascii_isalpha (str[0]))
-    str[0] = g_ascii_toupper (str[0]);
-
-  while ((p = strchr (str, '-')) != NULL)
-    {
-      if (p[1] != '\0' && g_ascii_isalpha (p[1]))
-        {
-          p[0] = ' ';
-          p[1] = g_ascii_toupper (p[1]);
-        }
-
-      p++;
-    }
-
-  return str;
-}
-
-static void
-accounts_widget_generic_setup (TpawAccountWidget *self,
-    GtkWidget *grid_common_settings,
-    GtkWidget *grid_advanced_settings)
-{
-  GList *params, *l;
-  guint row_common = 0, row_advanced = 0;
-
-  params = empathy_account_settings_dup_tp_params (self->priv->settings);
-
-  for (l = params; l != NULL; l = g_list_next (l))
-    {
-      TpConnectionManagerParam *param = l->data;
-      GtkWidget       *grid_settings;
-      guint           row;
-      GtkWidget       *widget = NULL;
-      gchar           *param_name_formatted;
-      const gchar *dbus_signature;
-
-      if (tp_connection_manager_param_is_required (param))
-        {
-          grid_settings = grid_common_settings;
-          row = row_common++;
-        }
-      else if (self->priv->simple)
-        {
-          continue;
-        }
-      else
-        {
-          grid_settings = grid_advanced_settings;
-          row = row_advanced++;
-        }
-
-      param_name_formatted = account_widget_generic_format_param_name (
-          tp_connection_manager_param_get_name (param));
-
-      dbus_signature = tp_connection_manager_param_get_dbus_signature (param);
-
-      if (dbus_signature[0] == 's')
-        {
-          gchar *str;
-
-          str = g_strdup_printf (_("%s"), param_name_formatted);
-          widget = gtk_label_new (str);
-          gtk_misc_set_alignment (GTK_MISC (widget), 1., 0.5);
-          gtk_style_context_add_class (gtk_widget_get_style_context (widget),
-              GTK_STYLE_CLASS_DIM_LABEL);
-          g_free (str);
-
-          gtk_grid_attach (GTK_GRID (grid_settings),
-              widget, 0, row, 1, 1);
-
-          gtk_widget_show (widget);
-
-          widget = gtk_entry_new ();
-          if (strcmp (tp_connection_manager_param_get_name (param),
-                "account") == 0)
-            {
-              g_signal_connect (widget, "realize",
-                  G_CALLBACK (gtk_widget_grab_focus),
-                  NULL);
-            }
-
-          gtk_grid_attach (GTK_GRID (grid_settings),
-              widget, 1, row, 1, 1);
-
-          gtk_widget_show (widget);
-        }
-      /* int types: ynqiuxt. double type is 'd' */
-      else if (dbus_signature[0] == 'y' ||
-          dbus_signature[0] == 'n' ||
-          dbus_signature[0] == 'q' ||
-          dbus_signature[0] == 'i' ||
-          dbus_signature[0] == 'u' ||
-          dbus_signature[0] == 'x' ||
-          dbus_signature[0] == 't' ||
-          dbus_signature[0] == 'd')
-        {
-          gchar   *str = NULL;
-          gdouble  minint = 0;
-          gdouble  maxint = 0;
-          gdouble  step = 1;
-
-          switch (dbus_signature[0])
-            {
-            case 'y': minint = G_MININT8;  maxint = G_MAXINT8;   break;
-            case 'n': minint = G_MININT16; maxint = G_MAXINT16;  break;
-            case 'q': minint = 0;          maxint = G_MAXUINT16; break;
-            case 'i': minint = G_MININT32; maxint = G_MAXINT32;  break;
-            case 'u': minint = 0;          maxint = G_MAXUINT32; break;
-            case 'x': minint = G_MININT64; maxint = G_MAXINT64;  break;
-            case 't': minint = 0;          maxint = G_MAXUINT64; break;
-            case 'd': minint = G_MININT32; maxint = G_MAXINT32;
-              step = 0.1; break;
-            default: g_assert_not_reached ();
-            }
-
-          str = g_strdup_printf (_("%s:"), param_name_formatted);
-          widget = gtk_label_new (str);
-          gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-          g_free (str);
-
-          gtk_grid_attach (GTK_GRID (grid_settings),
-              widget, 0, row, 1, 1);
-          gtk_widget_show (widget);
-
-          widget = gtk_spin_button_new_with_range (minint, maxint, step);
-          gtk_grid_attach (GTK_GRID (grid_settings),
-              widget, 1, row, 1, 1);
-          gtk_widget_show (widget);
-        }
-      else if (dbus_signature[0] == 'b')
-        {
-          widget = gtk_check_button_new_with_label (param_name_formatted);
-          gtk_grid_attach (GTK_GRID (grid_settings),
-              widget, 0, row, 2, 1);
-          gtk_widget_show (widget);
-        }
-      else
-        {
-          DEBUG ("Unknown signature for param %s: %s",
-              param_name_formatted, dbus_signature);
-        }
-
-      if (widget)
-        tpaw_account_widget_setup_widget (self, widget,
-            tp_connection_manager_param_get_name (param));
-
-      g_free (param_name_formatted);
-    }
-
-  g_list_free_full (params, (GDestroyNotify) tp_connection_manager_param_free);
-}
-
-static void
-account_widget_handle_params_valist (TpawAccountWidget *self,
-    const gchar *first_widget,
-    va_list args)
-{
-  GObject *object;
-  const gchar *name;
-
-  for (name = first_widget; name; name = va_arg (args, const gchar *))
-    {
-      const gchar *param_name;
-
-      param_name = va_arg (args, const gchar *);
-      object = gtk_builder_get_object (self->ui_details->gui, name);
-
-      if (!object)
-        {
-          g_warning ("Builder is missing object '%s'.", name);
-          continue;
-        }
-
-      tpaw_account_widget_setup_widget (self, GTK_WIDGET (object),
-          param_name);
-    }
-}
-
-static void
-account_widget_cancel_clicked_cb (GtkWidget *button,
-    TpawAccountWidget *self)
-{
-  g_signal_emit (self, signals[CANCELLED], 0);
-  g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_CANCEL);
-}
-
-static void
-account_widget_account_enabled_cb (GObject *source_object,
-    GAsyncResult *res,
-    gpointer user_data)
-{
-  GError *error = NULL;
-  TpAccount *account = TP_ACCOUNT (source_object);
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data);
-
-  tp_account_set_enabled_finish (account, res, &error);
-
-  if (error != NULL)
-    {
-      DEBUG ("Could not enable the account: %s", error->message);
-      g_error_free (error);
-    }
-  else
-    {
-      empathy_connect_new_account (account, self->priv->account_manager);
-    }
-
-  g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_APPLY);
-
-  /* unref self - part of the workaround */
-  g_object_unref (self);
-}
-
-static void
-account_widget_applied_cb (GObject *source_object,
-    GAsyncResult *res,
-    gpointer user_data)
-{
-  GError *error = NULL;
-  TpAccount *account;
-  EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source_object);
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data);
-  gboolean reconnect_required;
-  gboolean fire_close = TRUE;
-
-  empathy_account_settings_apply_finish (settings, res, &reconnect_required,
-      &error);
-
-  if (error != NULL)
-    {
-      DEBUG ("Could not apply changes to account: %s", error->message);
-      g_error_free (error);
-      return;
-    }
-
-  account = empathy_account_settings_get_account (self->priv->settings);
-
-  if (account != NULL)
-    {
-      if (self->priv->creating_account)
-        {
-          /* By default, when an account is created, we enable it. */
-
-          /* workaround to keep self alive during async call */
-          g_object_ref (self);
-
-          tp_account_set_enabled_async (account, TRUE,
-              account_widget_account_enabled_cb, self);
-          g_signal_emit (self, signals[ACCOUNT_CREATED], 0, account);
-
-          /* Will be fired in account_widget_account_enabled_cb */
-          fire_close = FALSE;
-        }
-      else
-        {
-          /* If the account was offline, we always want to try reconnecting,
-           * to give it a chance to connect if the previous params were wrong.
-           * tp_account_reconnect_async() won't do anything if the requested
-           * presence is offline anyway. */
-          if (tp_account_get_connection_status (account, NULL) ==
-              TP_CONNECTION_STATUS_DISCONNECTED)
-            reconnect_required = TRUE;
-
-          if (reconnect_required && tp_account_is_enabled (account)
-              && tp_account_is_enabled (account))
-            {
-              /* After having applied changes to a user account, we
-               * reconnect it if needed. This is done so the new
-               * information entered by the user is validated on the server. */
-              tp_account_reconnect_async (account, NULL, NULL);
-            }
-        }
-    }
-
-  if (!self->priv->destroyed)
-    account_widget_set_control_buttons_sensitivity (self, FALSE);
-
-  self->priv->contains_pending_changes = FALSE;
-
-  if (fire_close)
-    {
-      /* announce the widget can be closed */
-      g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_APPLY);
-    }
-
-  /* unref the widget - part of the workaround */
-  g_object_unref (self);
-}
-
-void
-tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self)
-{
-  gboolean display_name_overridden;
-
-  if (self->priv->radiobutton_reuse != NULL)
-    {
-      gboolean reuse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
-            self->priv->radiobutton_reuse));
-
-      DEBUG ("Set register param: %d", !reuse);
-      empathy_account_settings_set (self->priv->settings, "register",
-          g_variant_new_boolean (!reuse));
-    }
-
-  g_object_get (self->priv->settings,
-      "display-name-overridden", &display_name_overridden, NULL);
-
-  if (self->priv->creating_account || !display_name_overridden)
-    {
-      gchar *display_name;
-
-      /* set default display name for new accounts or update if user didn't
-       * manually override it. */
-      display_name = tpaw_account_widget_get_default_display_name (self);
-
-      empathy_account_settings_set_display_name_async (self->priv->settings,
-          display_name, NULL, NULL);
-
-      g_free (display_name);
-    }
-
-  /* workaround to keep widget alive during async call */
-  g_object_ref (self);
-  empathy_account_settings_apply_async (self->priv->settings,
-      account_widget_applied_cb, self);
-}
-
-static void
-account_widget_apply_clicked_cb (GtkWidget *button,
-    TpawAccountWidget *self)
-{
-    tpaw_account_widget_apply_and_log_in (self);
-}
-
-static void
-account_widget_setup_generic (TpawAccountWidget *self)
-{
-  GtkWidget *grid_common_settings;
-  GtkWidget *grid_advanced_settings;
-
-  grid_common_settings = GTK_WIDGET (gtk_builder_get_object
-      (self->ui_details->gui, "grid_common_settings"));
-  grid_advanced_settings = GTK_WIDGET (gtk_builder_get_object
-      (self->ui_details->gui, "grid_advanced_settings"));
-
-  accounts_widget_generic_setup (self, grid_common_settings,
-      grid_advanced_settings);
-
-  g_object_unref (self->ui_details->gui);
-}
-
-static void
-account_widget_settings_ready_cb (EmpathyAccountSettings *settings,
-    GParamSpec *pspec,
-    gpointer user_data)
-{
-  TpawAccountWidget *self = user_data;
-
-  if (empathy_account_settings_is_ready (self->priv->settings))
-    account_widget_setup_generic (self);
-}
-
-static GtkWidget *
-account_widget_build_generic (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *expander_advanced, *box;
-
-  self->ui_details->gui = empathy_builder_get_resource (filename,
-      "grid_common_settings", &self->priv->grid_common_settings,
-      "vbox_generic_settings", &box,
-      "expander_advanced_settings", &expander_advanced,
-      NULL);
-
-  if (self->priv->simple)
-    gtk_widget_hide (expander_advanced);
-
-  g_object_ref (self->ui_details->gui);
-
-  if (empathy_account_settings_is_ready (self->priv->settings))
-    account_widget_setup_generic (self);
-  else
-    g_signal_connect (self->priv->settings, "notify::ready",
-        G_CALLBACK (account_widget_settings_ready_cb), self);
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_salut (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *expander_advanced, *box;
-
-  self->ui_details->gui = empathy_builder_get_resource (filename,
-      "grid_common_settings", &self->priv->grid_common_settings,
-      "vbox_salut_settings", &box,
-      "expander_advanced_settings", &expander_advanced,
-      NULL);
-
-  tpaw_account_widget_handle_params (self,
-      "entry_published", "published-name",
-      "entry_nickname", "nickname",
-      "entry_first_name", "first-name",
-      "entry_last_name", "last-name",
-      "entry_email", "email",
-      "entry_jid", "jid",
-      NULL);
-
-  if (self->priv->simple)
-    gtk_widget_hide (expander_advanced);
-
-  self->ui_details->default_focus = g_strdup ("entry_first_name");
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_irc (TpawAccountWidget *self,
-  const char *filename)
-{
-  GtkWidget *box;
-
-  empathy_account_settings_set_regex (self->priv->settings, "account",
-      ACCOUNT_REGEX_IRC);
-
-  if (self->priv->simple)
-    {
-      self->priv->irc_network_chooser = tpaw_account_widget_irc_build_simple
-        (self, filename, &box);
-    }
-  else
-    {
-      self->priv->irc_network_chooser = tpaw_account_widget_irc_build (self,
-          filename, &self->priv->grid_common_settings, &box);
-    }
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_sip (TpawAccountWidget *self,
-  const char *filename)
-{
-  GtkWidget *box;
-
-  box = tpaw_account_widget_sip_build (self, filename,
-    &self->priv->grid_common_settings);
-
-  if (self->priv->simple)
-    {
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else
-    {
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-    }
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_msn (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *box;
-
-  empathy_account_settings_set_regex (self->priv->settings, "account",
-      ACCOUNT_REGEX_MSN);
-
-  if (self->priv->simple)
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_msn_simple", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_msn_settings", &self->priv->grid_common_settings,
-          "vbox_msn_settings", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id", "account",
-          "entry_password", "password",
-          "entry_server", "server",
-          "spinbutton_port", "port",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-    }
-
-  return box;
-}
-
-static void
-suffix_id_widget_changed_cb (GtkWidget *entry,
-    TpawAccountWidget *self)
-{
-  gchar *account;
-
-  g_assert (self->priv->jid_suffix != NULL);
-
-  account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
-
-  account = empathy_account_settings_dup_string (self->priv->settings,
-      "account");
-
-  if (!EMP_STR_EMPTY (account) &&
-      !g_str_has_suffix (account, self->priv->jid_suffix))
-    {
-      gchar *tmp;
-
-      tmp = g_strdup_printf ("%s%s", account, self->priv->jid_suffix);
-
-      DEBUG ("Change account from '%s' to '%s'", account, tmp);
-
-      empathy_account_settings_set (self->priv->settings, "account",
-          g_variant_new_string (tmp));
-      g_free (tmp);
-    }
-
-  tpaw_account_widget_changed (self);
-
-  g_free (account);
-}
-
-static gchar *
-remove_jid_suffix (TpawAccountWidget *self,
-    const gchar *str)
-{
-  g_assert (self->priv->jid_suffix != NULL);
-
-  if (!g_str_has_suffix (str, self->priv->jid_suffix))
-    return g_strdup (str);
-
-  return g_strndup (str, strlen (str) - strlen (self->priv->jid_suffix));
-}
-
-static void
-setup_id_widget_with_suffix (TpawAccountWidget *self,
-    GtkWidget *widget,
-    const gchar *suffix)
-{
-  gchar *str = NULL;
-
-  g_object_set_data_full (G_OBJECT (widget), "param_name",
-      g_strdup ("account"), g_free);
-
-  g_assert (self->priv->jid_suffix == NULL);
-  self->priv->jid_suffix = g_strdup (suffix);
-
-  str = empathy_account_settings_dup_string (self->priv->settings, "account");
-  if (str != NULL)
-    {
-      gchar *tmp;
-
-      tmp = remove_jid_suffix (self, str);
-      gtk_entry_set_text (GTK_ENTRY (widget), tmp);
-      g_free (tmp);
-      g_free (str);
-    }
-
-  self->priv->param_account_widget = widget;
-
-  g_signal_connect (widget, "changed",
-      G_CALLBACK (suffix_id_widget_changed_cb), self);
-}
-
-static Service
-account_widget_get_service (TpawAccountWidget *self)
-{
-  const gchar *icon_name, *service;
-
-  icon_name = empathy_account_settings_get_icon_name (self->priv->settings);
-  service = empathy_account_settings_get_service (self->priv->settings);
-
-  /* Previous versions of Tpaw didn't set the Service property on Facebook
-   * and gtalk accounts, so we check using the icon name as well. */
-  if (!tp_strdiff (icon_name, "im-google-talk") ||
-      !tp_strdiff (service, "google-talk"))
-    return GTALK_SERVICE;
-
-  if (!tp_strdiff (icon_name, "im-facebook") ||
-      !tp_strdiff (service, "facebook"))
-    return FACEBOOK_SERVICE;
-
-  return NO_SERVICE;
-}
-
-static GtkWidget *
-account_widget_build_jabber (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *spinbutton_port;
-  GtkWidget *checkbutton_ssl;
-  GtkWidget *label_id, *label_password;
-  GtkWidget *label_id_create, *label_password_create;
-  GtkWidget *label_example_fb;
-  GtkWidget *label_example;
-  GtkWidget *expander_advanced;
-  GtkWidget *entry_id;
-  GtkWidget *box;
-  Service service;
-
-  service = account_widget_get_service (self);
-
-  empathy_account_settings_set_regex (self->priv->settings, "account",
-      ACCOUNT_REGEX_JABBER);
-
-  if (self->priv->simple && service == NO_SERVICE)
-    {
-      /* Simple widget for XMPP */
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_jabber_simple", &box,
-          "label_id_simple", &label_id,
-          "label_id_create", &label_id_create,
-          "label_password_simple", &label_password,
-          "label_password_create", &label_password_create,
-          NULL);
-
-      if (empathy_account_settings_get_boolean (self->priv->settings,
-            "register"))
-        {
-          gtk_widget_hide (label_id);
-          gtk_widget_hide (label_password);
-          gtk_widget_show (label_id_create);
-          gtk_widget_show (label_password_create);
-        }
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else if (self->priv->simple && service == GTALK_SERVICE)
-    {
-      /* Simple widget for Google Talk */
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_gtalk_simple", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id_g_simple", "account",
-          "entry_password_g_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id_g_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_g_simple"));
-    }
-  else if (self->priv->simple && service == FACEBOOK_SERVICE)
-    {
-      /* Simple widget for Facebook */
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_fb_simple", &box,
-          "entry_id_fb_simple", &entry_id,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_password_fb_simple", "password",
-          NULL);
-
-      setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
-
-      self->ui_details->default_focus = g_strdup ("entry_id_fb_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_fb_simple"));
-    }
-  else
-    {
-      ServiceInfo info = services_infos[service];
-
-      /* Full widget for XMPP, Google Talk and Facebook*/
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_settings", &self->priv->grid_common_settings,
-          "vbox_jabber_settings", &box,
-          "spinbutton_port", &spinbutton_port,
-          "checkbutton_ssl", &checkbutton_ssl,
-          "label_username_f_example", &label_example_fb,
-          info.label_username_example, &label_example,
-          "expander_advanced", &expander_advanced,
-          "entry_id", &entry_id,
-          "label_id", &label_id,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_password", "password",
-          "entry_resource", "resource",
-          "entry_server", "server",
-          "spinbutton_port", "port",
-          "spinbutton_priority", "priority",
-          "checkbutton_ssl", "old-ssl",
-          "checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
-          "checkbutton_encryption", "require-encryption",
-          NULL);
-
-      if (service == FACEBOOK_SERVICE)
-        {
-          gtk_label_set_label (GTK_LABEL (label_id), _("Username:"));
-
-          /* Facebook special case the entry ID widget to hide the
-           * "@chat.facebook.com" part */
-          setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
-        }
-      else
-        {
-          tpaw_account_widget_setup_widget (self, entry_id, "account");
-        }
-
-      self->ui_details->default_focus = g_strdup ("entry_id");
-      self->priv->spinbutton_port = spinbutton_port;
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-
-      g_signal_connect (checkbutton_ssl, "toggled",
-          G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
-          self);
-
-      if (service == FACEBOOK_SERVICE)
-        {
-          GtkContainer *parent;
-          GList *children;
-
-          /* Removing the label from list of focusable widgets */
-          parent = GTK_CONTAINER (gtk_widget_get_parent (label_example_fb));
-          children = gtk_container_get_children (parent);
-          children = g_list_remove (children, label_example_fb);
-          gtk_container_set_focus_chain (parent, children);
-          g_list_free (children);
-        }
-
-      gtk_widget_show (label_example);
-
-      if (!info.show_advanced)
-        gtk_widget_hide (expander_advanced);
-    }
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_icq (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *spinbutton_port;
-  GtkWidget *box;
-
-  empathy_account_settings_set_regex (self->priv->settings, "account",
-      ACCOUNT_REGEX_ICQ);
-
-  if (self->priv->simple)
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_icq_simple", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_uin_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_uin_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_settings", &self->priv->grid_common_settings,
-          "vbox_icq_settings", &box,
-          "spinbutton_port", &spinbutton_port,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_uin", "account",
-          "entry_password", "password",
-          "entry_server", "server",
-          "spinbutton_port", "port",
-          "entry_charset", "charset",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_uin");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-    }
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_aim (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *spinbutton_port, *box;
-
-  if (self->priv->simple)
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_aim_simple", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_screenname_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_screenname_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_settings", &self->priv->grid_common_settings,
-          "vbox_aim_settings", &box,
-          "spinbutton_port", &spinbutton_port,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_screenname", "account",
-          "entry_password", "password",
-          "entry_server", "server",
-          "spinbutton_port", "port",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_screenname");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-    }
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_yahoo (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *box;
-
-  empathy_account_settings_set_regex (self->priv->settings, "account",
-      ACCOUNT_REGEX_YAHOO);
-
-  if (self->priv->simple)
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_yahoo_simple", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_settings", &self->priv->grid_common_settings,
-          "vbox_yahoo_settings", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id", "account",
-          "entry_password", "password",
-          "entry_locale", "room-list-locale",
-          "entry_charset", "charset",
-          "spinbutton_port", "port",
-          "checkbutton_ignore_invites", "ignore-invites",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-    }
-
-  return box;
-}
-
-static GtkWidget *
-account_widget_build_groupwise (TpawAccountWidget *self,
-    const char *filename)
-{
-  GtkWidget *box;
-
-  if (self->priv->simple)
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "vbox_groupwise_simple", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id_simple", "account",
-          "entry_password_simple", "password",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id_simple");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui,
-            "remember_password_simple"));
-    }
-  else
-    {
-      self->ui_details->gui = empathy_builder_get_resource (filename,
-          "grid_common_groupwise_settings", &self->priv->grid_common_settings,
-          "vbox_groupwise_settings", &box,
-          NULL);
-
-      tpaw_account_widget_handle_params (self,
-          "entry_id", "account",
-          "entry_password", "password",
-          "entry_server", "server",
-          "spinbutton_port", "port",
-          NULL);
-
-      self->ui_details->default_focus = g_strdup ("entry_id");
-
-      self->priv->remember_password_widget = GTK_WIDGET (
-          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
-    }
-
-  return box;
-}
-
-void
-tpaw_account_widget_set_other_accounts_exist (TpawAccountWidget *self,
-    gboolean others_exist)
-{
-  self->priv->other_accounts_exist = others_exist;
-
-  if (self->priv->creating_account)
-    account_widget_handle_control_buttons_sensitivity (self);
-}
-
-static void
-do_set_property (GObject *object,
-    guint prop_id,
-    const GValue *value,
-    GParamSpec *pspec)
-{
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (object);
-
-  switch (prop_id)
-    {
-    case PROP_SETTINGS:
-      self->priv->settings = g_value_dup_object (value);
-      break;
-    case PROP_SIMPLE:
-      self->priv->simple = g_value_get_boolean (value);
-      break;
-    case PROP_CREATING_ACCOUNT:
-      self->priv->creating_account = g_value_get_boolean (value);
-      break;
-    case PROP_OTHER_ACCOUNTS_EXIST:
-      tpaw_account_widget_set_other_accounts_exist (
-          TPAW_ACCOUNT_WIDGET (object), g_value_get_boolean (value));
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
-}
-
-static void
-do_get_property (GObject *object,
-    guint prop_id,
-    GValue *value,
-    GParamSpec *pspec)
-{
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (object);
-
-  switch (prop_id)
-    {
-    case PROP_PROTOCOL:
-      g_value_set_string (value,
-        empathy_account_settings_get_protocol (self->priv->settings));
-      break;
-    case PROP_SETTINGS:
-      g_value_set_object (value, self->priv->settings);
-      break;
-    case PROP_SIMPLE:
-      g_value_set_boolean (value, self->priv->simple);
-      break;
-    case PROP_CREATING_ACCOUNT:
-      g_value_set_boolean (value, self->priv->creating_account);
-      break;
-    case PROP_OTHER_ACCOUNTS_EXIST:
-      g_value_set_boolean (value, self->priv->other_accounts_exist);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
-}
-
-static void
-set_apply_button (TpawAccountWidget *self)
-{
-  GtkWidget *image;
-
-  /* We can't use the stock button as its accelerator ('A') clashes with the
-   * Add button. */
-  gtk_button_set_use_stock (GTK_BUTTON (self->priv->apply_button), FALSE);
-
-  gtk_button_set_label (GTK_BUTTON (self->priv->apply_button), _("A_pply"));
-  gtk_button_set_use_underline (GTK_BUTTON (self->priv->apply_button), TRUE);
-
-  image = gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
-  gtk_button_set_image (GTK_BUTTON (self->priv->apply_button), image);
-}
-
-static void
-presence_changed_cb (TpAccountManager *manager,
-    TpConnectionPresenceType state,
-    const gchar *status,
-    const gchar *message,
-    TpawAccountWidget *self)
-{
-  if (self->priv->destroyed)
-    return;
-
-  if (self->priv->apply_button == NULL)
-    /* This button doesn't exist in 'simple' mode */
-    return;
-
-  if (state > TP_CONNECTION_PRESENCE_TYPE_OFFLINE &&
-      self->priv->creating_account)
-    {
-      /* We are online and creating a new account, display a Login button */
-      GtkWidget *image;
-
-      gtk_button_set_use_stock (GTK_BUTTON (self->priv->apply_button), FALSE);
-      gtk_button_set_label (GTK_BUTTON (self->priv->apply_button),
-          _("L_og in"));
-
-      image = gtk_image_new_from_stock (GTK_STOCK_CONNECT,
-          GTK_ICON_SIZE_BUTTON);
-      gtk_button_set_image (GTK_BUTTON (self->priv->apply_button), image);
-    }
-  else
-    {
-      /* We are offline or modifying an existing account, display
-       * a Save button */
-      set_apply_button (self);
-    }
-}
-
-static void
-account_manager_ready_cb (GObject *source_object,
-    GAsyncResult *result,
-    gpointer user_data)
-{
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data);
-  TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
-  GError *error = NULL;
-  TpConnectionPresenceType state;
-
-  if (!tp_proxy_prepare_finish (account_manager, result, &error))
-    {
-      DEBUG ("Failed to prepare account manager: %s", error->message);
-      g_error_free (error);
-      goto out;
-    }
-
-  state = tp_account_manager_get_most_available_presence (account_manager, NULL,
-      NULL);
-
-  /* simulate a presence change so the apply button will be changed
-   * if needed */
-  presence_changed_cb (account_manager, state, NULL, NULL, self);
-
-out:
-  g_object_unref (self);
-}
-
-#define WIDGET(cm, proto) \
-  { #cm, #proto, ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-"#proto".ui", \
-    account_widget_build_##proto }
-
-static void
-add_register_buttons (TpawAccountWidget *self,
-    TpAccount *account)
-{
-  TpProtocol *protocol;
-  GtkWidget *radiobutton_register;
-
-  if (!self->priv->creating_account)
-    return;
-
-  protocol = empathy_account_settings_get_tp_protocol (self->priv->settings);
-  if (protocol == NULL)
-    return;
-
-  if (!tp_protocol_can_register (protocol))
-    return;
-
-  if (account_widget_get_service (self) != NO_SERVICE)
-    return;
-
-  if (self->priv->simple)
-    return;
-
-  self->priv->radiobutton_reuse = gtk_radio_button_new_with_label (NULL,
-      _("This account already exists on the server"));
-  radiobutton_register = gtk_radio_button_new_with_label (
-      gtk_radio_button_get_group (
-        GTK_RADIO_BUTTON (self->priv->radiobutton_reuse)),
-      _("Create a new account on the server"));
-
-  gtk_box_pack_start (GTK_BOX (self), self->priv->radiobutton_reuse, FALSE,
-      FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (self), radiobutton_register, FALSE, FALSE, 0);
-  gtk_box_reorder_child (GTK_BOX (self), self->priv->radiobutton_reuse, 0);
-  gtk_box_reorder_child (GTK_BOX (self), radiobutton_register, 1);
-  gtk_widget_show (self->priv->radiobutton_reuse);
-  gtk_widget_show (radiobutton_register);
-}
-
-static void
-remember_password_toggled_cb (GtkToggleButton *button,
-    TpawAccountWidget *self)
-{
-  empathy_account_settings_set_remember_password (self->priv->settings,
-      gtk_toggle_button_get_active (button));
-
-  if (!self->priv->automatic_change)
-    tpaw_account_widget_changed (self);
-}
-
-static void
-account_settings_password_retrieved_cb (GObject *object,
-    gpointer user_data)
-{
-  TpawAccountWidget *self = user_data;
-  gchar *password;
-
-  password = empathy_account_settings_dup_string (
-      self->priv->settings, "password");
-
-  /* We have to do this so that when we call gtk_entry_set_text,
-   * the ::changed callback doesn't think the user made the
-   * change. This is also used in remember_password_toggled_cb. */
-  self->priv->automatic_change = TRUE;
-
-  if (password != NULL)
-    {
-      gtk_entry_set_text (GTK_ENTRY (self->priv->param_password_widget),
-          password);
-    }
-
-  gtk_toggle_button_set_active (
-      GTK_TOGGLE_BUTTON (self->priv->remember_password_widget),
-      !EMP_STR_EMPTY (password));
-
-  self->priv->automatic_change = FALSE;
-
-  g_free (password);
-}
-
-static void
-do_constructed (GObject *obj)
-{
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (obj);
-  TpAccount *account;
-  const gchar *display_name, *default_display_name;
-  guint i = 0;
-  struct {
-    const gchar *cm_name;
-    const gchar *protocol;
-    const char *file;
-    GtkWidget * (*func)(TpawAccountWidget *self, const gchar *filename);
-  } widgets [] = {
-    { "salut", "local-xmpp", ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-local-xmpp.ui",
-        account_widget_build_salut },
-    WIDGET (gabble, jabber),
-    WIDGET (haze, msn),
-    WIDGET (haze, icq),
-    WIDGET (haze, aim),
-    WIDGET (haze, yahoo),
-    WIDGET (haze, groupwise),
-    WIDGET (idle, irc),
-    WIDGET (sofiasip, sip),
-  };
-  const gchar *protocol, *cm_name;
-  GtkWidget *box;
-
-  account = empathy_account_settings_get_account (self->priv->settings);
-
-  cm_name = empathy_account_settings_get_cm (self->priv->settings);
-  protocol = empathy_account_settings_get_protocol (self->priv->settings);
-
-  for (i = 0 ; i < G_N_ELEMENTS (widgets); i++)
-    {
-      if (!tp_strdiff (widgets[i].cm_name, cm_name) &&
-          !tp_strdiff (widgets[i].protocol, protocol))
-        {
-          box = widgets[i].func (self, widgets[i].file);
-          break;
-        }
-    }
-
-  if (i == G_N_ELEMENTS (widgets))
-    {
-      gchar *filename = ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-generic.ui";
-      box = account_widget_build_generic (self, filename);
-    }
-
-  gtk_container_add (GTK_CONTAINER (self), box);
-
-  /* handle default focus */
-  if (self->ui_details->default_focus != NULL)
-    {
-      GObject *default_focus_entry;
-
-      default_focus_entry = gtk_builder_get_object
-        (self->ui_details->gui, self->ui_details->default_focus);
-      g_signal_connect (default_focus_entry, "realize",
-          G_CALLBACK (gtk_widget_grab_focus),
-          NULL);
-    }
-
-  /* remember password */
-  if (self->priv->param_password_widget != NULL
-      && self->priv->remember_password_widget != NULL
-      && empathy_account_settings_supports_sasl (self->priv->settings))
-    {
-      if (self->priv->simple)
-        {
-          gtk_toggle_button_set_active (
-              GTK_TOGGLE_BUTTON (self->priv->remember_password_widget), TRUE);
-        }
-      else
-        {
-          gchar *password;
-
-          password = empathy_account_settings_dup_string (self->priv->settings,
-              "password");
-
-          /* FIXME: we should enable this checkbox only if the password is
-           * stored for good in the password storage, not only for the session
-           * (bgo #683571) */
-          gtk_toggle_button_set_active (
-              GTK_TOGGLE_BUTTON (self->priv->remember_password_widget),
-              !EMP_STR_EMPTY (password));
-
-          /* The password might not have been retrieved from the
-           * keyring yet. We should update the remember password
-           * toggle button and the password entry when/if it is. */
-          tp_g_signal_connect_object (self->priv->settings,
-              "password-retrieved",
-              G_CALLBACK (account_settings_password_retrieved_cb), self, 0);
-
-          g_free (password);
-        }
-
-      g_signal_connect (self->priv->remember_password_widget, "toggled",
-          G_CALLBACK (remember_password_toggled_cb), self);
-
-      self->priv->automatic_change = TRUE;
-      remember_password_toggled_cb (
-          GTK_TOGGLE_BUTTON (self->priv->remember_password_widget), self);
-      self->priv->automatic_change = FALSE;
-    }
-  else if (self->priv->remember_password_widget != NULL
-      && !empathy_account_settings_supports_sasl (self->priv->settings))
-    {
-      gtk_widget_set_visible (self->priv->remember_password_widget, FALSE);
-      empathy_account_settings_set_remember_password (self->priv->settings,
-          TRUE);
-    }
-
-  /* dup and init the account-manager */
-  self->priv->account_manager = tp_account_manager_dup ();
-
-  g_object_ref (self);
-  tp_proxy_prepare_async (self->priv->account_manager, NULL,
-      account_manager_ready_cb, self);
-
-  /* handle apply and cancel button */
-  self->priv->hbox_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
-
-  gtk_box_set_homogeneous (GTK_BOX (self->priv->hbox_buttons), TRUE);
-
-  self->priv->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
-
-  self->priv->apply_button = gtk_button_new ();
-  set_apply_button (self);
-
-  /* We'll change this button to a "Log in" one if we are creating a new
-   * account and are connected. */
-  tp_g_signal_connect_object (self->priv->account_manager,
-      "most-available-presence-changed",
-      G_CALLBACK (presence_changed_cb), obj, 0);
-
-  gtk_box_pack_end (GTK_BOX (self->priv->hbox_buttons),
-      self->priv->apply_button, TRUE, TRUE, 3);
-  gtk_box_pack_end (GTK_BOX (self->priv->hbox_buttons),
-      self->priv->cancel_button, TRUE, TRUE, 3);
-
-  gtk_box_pack_end (GTK_BOX (self), self->priv->hbox_buttons, FALSE,
-      FALSE, 3);
-
-  g_signal_connect (self->priv->cancel_button, "clicked",
-      G_CALLBACK (account_widget_cancel_clicked_cb),
-      self);
-  g_signal_connect (self->priv->apply_button, "clicked",
-      G_CALLBACK (account_widget_apply_clicked_cb),
-      self);
-  gtk_widget_show_all (self->priv->hbox_buttons);
-
-  if (self->priv->creating_account)
-    /* When creating an account, the user might have nothing to enter.
-     * That means that no control interaction might occur,
-     * so we update the control button sensitivity manually.
-     */
-    account_widget_handle_control_buttons_sensitivity (self);
-  else
-    account_widget_set_control_buttons_sensitivity (self, FALSE);
-
-  add_register_buttons (self, account);
-
-  g_clear_object (&self->ui_details->gui);
-
-  display_name = empathy_account_settings_get_display_name (
-      self->priv->settings);
-  default_display_name = tpaw_account_widget_get_default_display_name (self);
-
-  if (tp_strdiff (display_name, default_display_name) &&
-      !self->priv->creating_account)
-    {
-      /* The display name of the account is not the one that we'd assign by
-       * default; assume that the user changed it manually */
-      g_object_set (self->priv->settings, "display-name-overridden", TRUE,
-          NULL);
-    }
-}
-
-static void
-do_dispose (GObject *obj)
-{
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (obj);
-
-  g_clear_object (&self->priv->settings);
-  g_clear_object (&self->priv->account_manager);
-
-  if (G_OBJECT_CLASS (tpaw_account_widget_parent_class)->dispose != NULL)
-    G_OBJECT_CLASS (tpaw_account_widget_parent_class)->dispose (obj);
-}
-
-static void
-do_finalize (GObject *obj)
-{
-  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (obj);
-
-  g_free (self->ui_details->default_focus);
-  g_slice_free (TpawAccountWidgetUIDetails, self->ui_details);
-
-  g_free (self->priv->jid_suffix);
-
-  if (G_OBJECT_CLASS (tpaw_account_widget_parent_class)->finalize != NULL)
-    G_OBJECT_CLASS (tpaw_account_widget_parent_class)->finalize (obj);
-}
-
-static void
-tpaw_account_widget_class_init (TpawAccountWidgetClass *klass)
-{
-  GObjectClass *oclass = G_OBJECT_CLASS (klass);
-  GParamSpec *param_spec;
-
-  oclass->get_property = do_get_property;
-  oclass->set_property = do_set_property;
-  oclass->constructed = do_constructed;
-  oclass->dispose = do_dispose;
-  oclass->finalize = do_finalize;
-
-  param_spec = g_param_spec_string ("protocol",
-      "protocol", "The protocol of the account",
-      NULL,
-      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
-  g_object_class_install_property (oclass, PROP_PROTOCOL, param_spec);
-
-  param_spec = g_param_spec_object ("settings",
-      "settings", "The settings of the account",
-      EMPATHY_TYPE_ACCOUNT_SETTINGS,
-      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
-  g_object_class_install_property (oclass, PROP_SETTINGS, param_spec);
-
-  param_spec = g_param_spec_boolean ("simple",
-      "simple", "Whether the account widget is a simple or an advanced one",
-      FALSE,
-      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
-  g_object_class_install_property (oclass, PROP_SIMPLE, param_spec);
-
-  param_spec = g_param_spec_boolean ("creating-account",
-      "creating-account",
-      "TRUE if we're creating an account, FALSE if we're modifying it",
-      FALSE,
-      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
-  g_object_class_install_property (oclass, PROP_CREATING_ACCOUNT, param_spec);
-
-  param_spec = g_param_spec_boolean ("other-accounts-exist",
-      "other-accounts-exist",
-      "TRUE if there are any other accounts (even if this isn't yet saved)",
-      FALSE,
-      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
-  g_object_class_install_property (oclass, PROP_OTHER_ACCOUNTS_EXIST,
-                  param_spec);
-
-  signals[HANDLE_APPLY] =
-    g_signal_new ("handle-apply", G_TYPE_FROM_CLASS (klass),
-        G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-        g_cclosure_marshal_generic,
-        G_TYPE_NONE,
-        1, G_TYPE_BOOLEAN);
-
-  /* This signal is emitted when an account has been created and enabled. */
-  signals[ACCOUNT_CREATED] =
-      g_signal_new ("account-created", G_TYPE_FROM_CLASS (klass),
-          G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-          g_cclosure_marshal_generic,
-          G_TYPE_NONE,
-          1, G_TYPE_OBJECT);
-
-  signals[CANCELLED] =
-      g_signal_new ("cancelled", G_TYPE_FROM_CLASS (klass),
-          G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-          g_cclosure_marshal_generic,
-          G_TYPE_NONE,
-          0);
-
-  signals[CLOSE] =
-    g_signal_new ("close", G_TYPE_FROM_CLASS (klass),
-        G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-        g_cclosure_marshal_VOID__INT,
-        G_TYPE_NONE,
-        1, G_TYPE_INT);
-
-  g_type_class_add_private (klass, sizeof (TpawAccountWidgetPriv));
-}
-
-static void
-tpaw_account_widget_init (TpawAccountWidget *self)
-{
-  self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), TPAW_TYPE_ACCOUNT_WIDGET,
-        TpawAccountWidgetPriv);
-
-  self->ui_details = g_slice_new0 (TpawAccountWidgetUIDetails);
-}
-
-/* public methods */
-
-void
-tpaw_account_widget_discard_pending_changes (TpawAccountWidget *self)
-{
-  empathy_account_settings_discard_changes (self->priv->settings);
-  self->priv->contains_pending_changes = FALSE;
-}
-
-gboolean
-tpaw_account_widget_contains_pending_changes (TpawAccountWidget *self)
-{
-  return self->priv->contains_pending_changes;
-}
-
-void
-tpaw_account_widget_handle_params (TpawAccountWidget *self,
-    const gchar *first_widget,
-    ...)
-{
-  va_list args;
-
-  va_start (args, first_widget);
-  account_widget_handle_params_valist (self, first_widget, args);
-  va_end (args);
-}
-
-TpawAccountWidget *
-tpaw_account_widget_new_for_protocol (EmpathyAccountSettings *settings,
-    gboolean simple)
-{
-  g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL);
-
-  return g_object_new (TPAW_TYPE_ACCOUNT_WIDGET,
-        "orientation", GTK_ORIENTATION_VERTICAL,
-        "settings", settings,
-        "simple", simple,
-        "creating-account",
-          empathy_account_settings_get_account (settings) == NULL,
-        NULL);
-}
-
-gchar *
-tpaw_account_widget_get_default_display_name (TpawAccountWidget *self)
-{
-  gchar *login_id;
-  const gchar *protocol, *p;
-  gchar *default_display_name;
-  Service service;
-
-  login_id = empathy_account_settings_dup_string (self->priv->settings,
-      "account");
-  protocol = empathy_account_settings_get_protocol (self->priv->settings);
-  service = account_widget_get_service (self);
-
-  if (login_id != NULL)
-    {
-      /* TODO: this should be done in empathy-account-widget-irc */
-      if (!tp_strdiff (protocol, "irc"))
-        {
-          TpawIrcNetwork *network;
-
-          network = tpaw_irc_network_chooser_get_network (
-              self->priv->irc_network_chooser);
-          g_assert (network != NULL);
-
-          /* To translators: The first parameter is the login id and the
-           * second one is the network. The resulting string will be something
-           * like: "MyUserName on freenode".
-           * You should reverse the order of these arguments if the
-           * server should come before the login id in your locale.*/
-          default_display_name = g_strdup_printf (_("%1$s on %2$s"),
-              login_id, tpaw_irc_network_get_name (network));
-        }
-      else if (service == FACEBOOK_SERVICE && self->priv->jid_suffix != NULL)
-        {
-          gchar *tmp;
-
-          tmp = remove_jid_suffix (self, login_id);
-          default_display_name = g_strdup_printf ("Facebook (%s)", tmp);
-          g_free (tmp);
-        }
-      else
-        {
-          default_display_name = g_strdup (login_id);
-        }
-
-      return default_display_name;
-    }
-
-  if ((p = empathy_protocol_name_to_display_name (protocol)) != NULL)
-    protocol = p;
-
-  if (protocol != NULL)
-    {
-      /* To translators: The parameter is the protocol name. The resulting
-       * string will be something like: "Jabber Account" */
-      default_display_name = g_strdup_printf (_("%s Account"), protocol);
-    }
-  else
-    {
-      default_display_name = g_strdup (_("New account"));
-    }
-
-  g_free (login_id);
-
-  return default_display_name;
-}
-
-/* Used by subclass to indicate that widget contains pending changes */
-void
-tpaw_account_widget_changed (TpawAccountWidget *self)
-{
-  account_widget_handle_control_buttons_sensitivity (self);
-  self->priv->contains_pending_changes = TRUE;
-}
-
-void
-tpaw_account_widget_set_account_param (TpawAccountWidget *self,
-    const gchar *account)
-{
-  if (self->priv->param_account_widget == NULL)
-    return;
-
-  gtk_entry_set_text (GTK_ENTRY (self->priv->param_account_widget), account);
-}
-
-void
-tpaw_account_widget_set_password_param (TpawAccountWidget *self,
-    const gchar *account)
-{
-  if (self->priv->param_password_widget == NULL)
-    return;
-
-  gtk_entry_set_text (GTK_ENTRY (self->priv->param_password_widget), account);
-}
-
-EmpathyAccountSettings *
-tpaw_account_widget_get_settings (TpawAccountWidget *self)
-{
-  return self->priv->settings;
-}
-
-void
-tpaw_account_widget_hide_buttons (TpawAccountWidget *self)
-{
-  gtk_widget_hide (self->priv->hbox_buttons);
-}
diff --git a/tp-account-widgets/empathy-account-widget.h b/tp-account-widgets/empathy-account-widget.h
deleted file mode 100644 (file)
index 261901f..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2006-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- *          Martyn Russell <martyn@imendio.com>
- */
-
-#ifndef __TPAW_ACCOUNT_WIDGET_H__
-#define __TPAW_ACCOUNT_WIDGET_H__
-
-#include <gtk/gtk.h>
-
-#include "empathy-account-settings.h"
-
-G_BEGIN_DECLS
-
-#define TPAW_TYPE_ACCOUNT_WIDGET tpaw_account_widget_get_type()
-#define TPAW_ACCOUNT_WIDGET(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPAW_TYPE_ACCOUNT_WIDGET, TpawAccountWidget))
-#define TPAW_ACCOUNT_WIDGET_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), TPAW_TYPE_ACCOUNT_WIDGET, TpawAccountWidgetClass))
-#define TPAW_IS_ACCOUNT_WIDGET(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPAW_TYPE_ACCOUNT_WIDGET))
-#define TPAW_IS_ACCOUNT_WIDGET_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), TPAW_TYPE_ACCOUNT_WIDGET))
-#define TPAW_ACCOUNT_WIDGET_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), TPAW_TYPE_ACCOUNT_WIDGET, TpawAccountWidgetClass))
-
-typedef struct _TpawAccountWidgetPriv TpawAccountWidgetPriv;
-typedef struct _TpawAccountWidgetUIDetails TpawAccountWidgetUIDetails;
-
-typedef struct {
-  GtkBox parent;
-
-  TpawAccountWidgetUIDetails *ui_details;
-
-  TpawAccountWidgetPriv *priv;
-} TpawAccountWidget;
-
-typedef struct {
-  GtkBoxClass parent_class;
-} TpawAccountWidgetClass;
-
-GType tpaw_account_widget_get_type (void);
-
-TpawAccountWidget * tpaw_account_widget_new_for_protocol (
-    EmpathyAccountSettings *settings,
-    gboolean simple);
-
-gboolean tpaw_account_widget_contains_pending_changes
-    (TpawAccountWidget *widget);
-void tpaw_account_widget_discard_pending_changes
-    (TpawAccountWidget *widget);
-
-gchar * tpaw_account_widget_get_default_display_name (
-    TpawAccountWidget *widget);
-
-void tpaw_account_widget_set_account_param (TpawAccountWidget *widget,
-    const gchar *account);
-
-void tpaw_account_widget_set_password_param (TpawAccountWidget *self,
-    const gchar *password);
-
-void tpaw_account_widget_set_other_accounts_exist (
-    TpawAccountWidget *self, gboolean others_exist);
-
-void tpaw_account_widget_hide_buttons (TpawAccountWidget *self);
-
-void tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self);
-
-/* protected methods */
-void tpaw_account_widget_changed (TpawAccountWidget *widget);
-
-EmpathyAccountSettings * tpaw_account_widget_get_settings (
-    TpawAccountWidget *self);
-
-G_END_DECLS
-
-#endif /* __TPAW_ACCOUNT_WIDGET_H__ */
diff --git a/tp-account-widgets/empathy-account-widgets.gresource.xml b/tp-account-widgets/empathy-account-widgets.gresource.xml
deleted file mode 100644 (file)
index 7ee09e2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gresources>
-  <gresource prefix="/org/gnome/AccountWidgets">
-    <file>empathy-irc-networks.dtd</file>
-    <file compressed="true">empathy-account-widget-generic.ui</file>
-    <file compressed="true">empathy-account-widget-jabber.ui</file>
-    <file compressed="true">empathy-account-widget-msn.ui</file>
-    <file compressed="true">empathy-account-widget-sip.ui</file>
-    <file compressed="true">empathy-account-widget-local-xmpp.ui</file>
-    <file compressed="true">empathy-account-widget-irc.ui</file>
-    <file compressed="true">empathy-account-widget-icq.ui</file>
-    <file compressed="true">empathy-account-widget-yahoo.ui</file>
-    <file compressed="true">empathy-account-widget-groupwise.ui</file>
-    <file compressed="true">empathy-account-widget-aim.ui</file>
-  </gresource>
-</gresources>
-
diff --git a/tp-account-widgets/empathy-irc-network-chooser-dialog.c b/tp-account-widgets/empathy-irc-network-chooser-dialog.c
deleted file mode 100644 (file)
index cd0a716..0000000
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- * Copyright (C) 2010 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Authors: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-irc-network-chooser-dialog.h"
-
-#include <glib/gi18n-lib.h>
-
-#include "empathy-irc-network-dialog.h"
-#include "empathy-irc-network-manager.h"
-#include "empathy-live-search.h"
-#include "empathy-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
-#include "empathy-debug.h"
-
-#include "empathy-irc-network-chooser-dialog.h"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetworkChooserDialog)
-
-enum {
-    PROP_SETTINGS = 1,
-    PROP_NETWORK
-};
-
-enum {
-       RESPONSE_RESET = 0
-};
-
-typedef struct {
-    EmpathyAccountSettings *settings;
-    TpawIrcNetwork *network;
-
-    TpawIrcNetworkManager *network_manager;
-    gboolean changed;
-
-    GtkWidget *treeview;
-    GtkListStore *store;
-    GtkTreeModelFilter *filter;
-    GtkWidget *search;
-    GtkWidget *select_button;
-
-    gulong search_sig;
-    gulong activate_sig;
-} TpawIrcNetworkChooserDialogPriv;
-
-enum {
-  COL_NETWORK_OBJ,
-  COL_NETWORK_NAME,
-};
-
-G_DEFINE_TYPE (TpawIrcNetworkChooserDialog, tpaw_irc_network_chooser_dialog,
-    GTK_TYPE_DIALOG);
-
-static void
-tpaw_irc_network_chooser_dialog_set_property (GObject *object,
-    guint prop_id,
-    const GValue *value,
-    GParamSpec *pspec)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (object);
-
-  switch (prop_id)
-    {
-      case PROP_SETTINGS:
-        priv->settings = g_value_dup_object (value);
-        break;
-      case PROP_NETWORK:
-        priv->network = g_value_dup_object (value);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_network_chooser_dialog_get_property (GObject *object,
-    guint prop_id,
-    GValue *value,
-    GParamSpec *pspec)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (object);
-
-  switch (prop_id)
-    {
-      case PROP_SETTINGS:
-        g_value_set_object (value, priv->settings);
-        break;
-      case PROP_NETWORK:
-        g_value_set_object (value, priv->network);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-/* The iter returned by *it is a priv->store iter (not a filter one) */
-static TpawIrcNetwork *
-dup_selected_network (TpawIrcNetworkChooserDialog *self,
-    GtkTreeIter *it)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork *network;
-  GtkTreeSelection *selection;
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-
-  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
-  if (selection == NULL)
-    return NULL;
-
-  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-    return NULL;
-
-  gtk_tree_model_get (model, &iter, COL_NETWORK_OBJ, &network, -1);
-  g_assert (network != NULL);
-
-  if (it != NULL)
-    {
-      gtk_tree_model_filter_convert_iter_to_child_iter (priv->filter, it,
-          &iter);
-    }
-
-  return network;
-}
-
-static void
-treeview_changed_cb (GtkTreeView *treeview,
-    TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork *network;
-
-  network = dup_selected_network (self, NULL);
-  if (network == priv->network)
-    {
-      g_clear_object (&network);
-      return;
-    }
-
-  tp_clear_object (&priv->network);
-  /* Transfer the reference */
-  priv->network = network;
-
-  priv->changed = TRUE;
-}
-
-/* Take a filter iterator as argument */
-static void
-scroll_to_iter (TpawIrcNetworkChooserDialog *self,
-    GtkTreeIter *filter_iter)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GtkTreePath *path;
-
-  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->filter), filter_iter);
-
-  if (path != NULL)
-    {
-      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->treeview),
-          path, NULL, FALSE, 0, 0);
-
-      gtk_tree_path_free (path);
-    }
-}
-
-/* Take a filter iterator as argument */
-static void
-select_iter (TpawIrcNetworkChooserDialog *self,
-    GtkTreeIter *filter_iter,
-    gboolean emulate_changed)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GtkTreeSelection *selection;
-  GtkTreePath *path;
-
-  /* Select the network */
-  selection = gtk_tree_view_get_selection (
-      GTK_TREE_VIEW (priv->treeview));
-
-  gtk_tree_selection_select_iter (selection, filter_iter);
-
-  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->filter), filter_iter);
-  if (path != NULL)
-    {
-      gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->treeview), path,
-          NULL, FALSE);
-
-      gtk_tree_path_free (path);
-    }
-
-  /* Scroll to the selected network */
-  scroll_to_iter (self, filter_iter);
-
-  if (emulate_changed)
-    {
-      /* gtk_tree_selection_select_iter doesn't fire the 'cursor-changed' signal
-       * so we call the callback manually. */
-      treeview_changed_cb (GTK_TREE_VIEW (priv->treeview), self);
-    }
-}
-
-static GtkTreeIter
-iter_to_filter_iter (TpawIrcNetworkChooserDialog *self,
-    GtkTreeIter *iter)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GtkTreeIter filter_iter;
-
-  g_assert (gtk_tree_model_filter_convert_child_iter_to_iter (priv->filter,
-        &filter_iter, iter));
-
-  return filter_iter;
-}
-
-static void
-fill_store (TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GSList *networks, *l;
-
-  networks = tpaw_irc_network_manager_get_networks (
-      priv->network_manager);
-
-  for (l = networks; l != NULL; l = g_slist_next (l))
-    {
-      TpawIrcNetwork *network = l->data;
-      GtkTreeIter iter;
-
-      gtk_list_store_insert_with_values (priv->store, &iter, -1,
-          COL_NETWORK_OBJ, network,
-          COL_NETWORK_NAME, tpaw_irc_network_get_name (network),
-          -1);
-
-      if (network == priv->network)
-        {
-          GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter);
-
-          select_iter (self, &filter_iter, FALSE);
-        }
-
-      g_object_unref (network);
-    }
-
-  g_slist_free (networks);
-}
-
-static void
-irc_network_dialog_destroy_cb (GtkWidget *widget,
-    TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork *network;
-  GtkTreeIter iter, filter_iter;
-
-  priv->changed = TRUE;
-
-  network = dup_selected_network (self, &iter);
-  if (network == NULL)
-    return;
-
-  /* name could be changed */
-  gtk_list_store_set (GTK_LIST_STORE (priv->store), &iter,
-      COL_NETWORK_NAME, tpaw_irc_network_get_name (network), -1);
-
-  filter_iter = iter_to_filter_iter (self, &iter);
-  scroll_to_iter (self, &filter_iter);
-
-  gtk_widget_grab_focus (priv->treeview);
-
-  g_object_unref (network);
-}
-
-static void
-display_irc_network_dialog (TpawIrcNetworkChooserDialog *self,
-    TpawIrcNetwork *network)
-{
-  GtkWidget *dialog;
-
-  dialog = tpaw_irc_network_dialog_show (network, GTK_WIDGET (self));
-
-  g_signal_connect (dialog, "destroy",
-      G_CALLBACK (irc_network_dialog_destroy_cb), self);
-}
-
-static void
-edit_network (TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetwork *network;
-
-  network = dup_selected_network (self, NULL);
-  if (network == NULL)
-    return;
-
-  display_irc_network_dialog (self, network);
-
-  g_object_unref (network);
-}
-
-static void
-add_network (TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork *network;
-  GtkTreeIter iter, filter_iter;
-
-  gtk_widget_hide (priv->search);
-
-  network = tpaw_irc_network_new (_("New Network"));
-  tpaw_irc_network_manager_add (priv->network_manager, network);
-
-  gtk_list_store_insert_with_values (priv->store, &iter, -1,
-      COL_NETWORK_OBJ, network,
-      COL_NETWORK_NAME, tpaw_irc_network_get_name (network),
-      -1);
-
-  filter_iter = iter_to_filter_iter (self, &iter);
-  select_iter (self, &filter_iter, TRUE);
-
-  display_irc_network_dialog (self, network);
-
-  g_object_unref (network);
-}
-
-static void
-remove_network (TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork *network;
-  GtkTreeIter iter;
-
-  network = dup_selected_network (self, &iter);
-  if (network == NULL)
-    return;
-
-  /* Hide the search after picking the network to get the right one */
-  gtk_widget_hide (priv->search);
-
-  DEBUG ("Remove network %s", tpaw_irc_network_get_name (network));
-
-  /* Delete network and select next network */
-  if (gtk_list_store_remove (priv->store, &iter))
-    {
-      GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter);
-
-      select_iter (self, &filter_iter, TRUE);
-    }
-  else
-    {
-      /* this should only happen if the last network was deleted */
-      GtkTreeIter last, filter_iter;
-      gint n_elements;
-
-      n_elements = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store),
-          NULL);
-
-      if (n_elements > 0)
-        {
-          gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->store), &last,
-              NULL, (n_elements-1));
-          filter_iter = iter_to_filter_iter (self, &last);
-
-          select_iter (self, &filter_iter, TRUE);
-        }
-    }
-
-  tpaw_irc_network_manager_remove (priv->network_manager, network);
-  gtk_widget_grab_focus (priv->treeview);
-
-  g_object_unref (network);
-}
-
-static void
-reset_networks (TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GSList *networks, *l;
-
-  networks = tpaw_irc_network_manager_get_dropped_networks (
-      priv->network_manager);
-
-  for (l = networks; l != NULL; l = g_slist_next (l))
-    {
-      TpawIrcNetwork *network;
-      GtkTreeIter iter;
-
-      network = TPAW_IRC_NETWORK (l->data);
-      tpaw_irc_network_activate (network);
-
-      gtk_list_store_insert_with_values (priv->store, &iter, -1,
-          COL_NETWORK_OBJ, network,
-          COL_NETWORK_NAME, tpaw_irc_network_get_name (network),
-          -1);
-    }
-
-  g_slist_foreach (networks, (GFunc) g_object_unref, NULL);
-}
-
-static void
-dialog_response_cb (GtkDialog *dialog,
-    gint response,
-    TpawIrcNetworkChooserDialog *self)
-{
-  if (response == RESPONSE_RESET)
-    reset_networks (self);
-}
-
-static gboolean
-filter_visible_func (GtkTreeModel *model,
-    GtkTreeIter *iter,
-    gpointer user_data)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (user_data);
-  TpawIrcNetwork *network;
-  gboolean visible;
-
-  gtk_tree_model_get (model, iter, COL_NETWORK_OBJ, &network, -1);
-
-  visible = empathy_live_search_match (EMPATHY_LIVE_SEARCH (priv->search),
-      tpaw_irc_network_get_name (network));
-
-  g_object_unref (network);
-  return visible;
-}
-
-static void
-search_activate_cb (GtkWidget *search,
-  TpawIrcNetworkChooserDialog *self)
-{
-  gtk_widget_hide (search);
-  gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
-}
-
-static void
-search_text_notify_cb (EmpathyLiveSearch *search,
-    GParamSpec *pspec,
-    TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GtkTreeIter filter_iter;
-  gboolean sensitive = FALSE;
-
-  gtk_tree_model_filter_refilter (priv->filter);
-
-  /* Is there at least one network in the view ? */
-  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->filter),
-        &filter_iter))
-    {
-      const gchar *text;
-
-      text = empathy_live_search_get_text (EMPATHY_LIVE_SEARCH (priv->search));
-      if (!EMP_STR_EMPTY (text))
-        {
-          /* We are doing a search, select the first matching network */
-          select_iter (self, &filter_iter, TRUE);
-        }
-      else
-        {
-          /* Search has been cancelled. Scroll to the selected network */
-          GtkTreeSelection *selection;
-
-          selection = gtk_tree_view_get_selection (
-              GTK_TREE_VIEW (priv->treeview));
-
-          if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter))
-            scroll_to_iter (self, &filter_iter);
-        }
-
-      sensitive = TRUE;
-    }
-
-  gtk_widget_set_sensitive (priv->select_button, sensitive);
-}
-
-static void
-add_clicked_cb (GtkToolButton *button,
-    TpawIrcNetworkChooserDialog *self)
-{
-  add_network (self);
-}
-
-static void
-remove_clicked_cb (GtkToolButton *button,
-    TpawIrcNetworkChooserDialog *self)
-{
-  remove_network (self);
-}
-
-static void
-edit_clicked_cb (GtkToolButton *button,
-    TpawIrcNetworkChooserDialog *self)
-{
-  edit_network (self);
-}
-
-static void
-tpaw_irc_network_chooser_dialog_constructed (GObject *object)
-{
-  TpawIrcNetworkChooserDialog *self = (TpawIrcNetworkChooserDialog *) object;
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-  GtkDialog *dialog = GTK_DIALOG (self);
-  GtkCellRenderer *renderer;
-  GtkWidget *vbox;
-  GtkTreeViewColumn *column;
-  GtkWidget *scroll;
-  GtkWidget *toolbar;
-  GtkToolItem *item;
-  GtkStyleContext *context;
-
-  g_assert (priv->settings != NULL);
-
-  gtk_window_set_title (GTK_WINDOW (self), _("Choose an IRC network"));
-
-  /* Create store and treeview */
-  priv->store = gtk_list_store_new (2, G_TYPE_OBJECT, G_TYPE_STRING);
-
-  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
-      COL_NETWORK_NAME,
-      GTK_SORT_ASCENDING);
-
-  priv->treeview = gtk_tree_view_new ();
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE);
-  gtk_tree_view_set_enable_search (GTK_TREE_VIEW (priv->treeview), FALSE);
-
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->treeview), column);
-
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, TRUE);
-  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column),
-      renderer,
-      "text", COL_NETWORK_NAME,
-      NULL);
-
-  /* add the treeview in a GtkScrolledWindow */
-  vbox = gtk_dialog_get_content_area (dialog);
-
-  scroll = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
-      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
-  gtk_container_add (GTK_CONTAINER (scroll), priv->treeview);
-  gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 6);
-
-  /* Treeview toolbar */
-  toolbar = gtk_toolbar_new ();
-  gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
-  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
-
-  item = gtk_tool_button_new (NULL, "");
-  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-add-symbolic");
-  g_signal_connect (item, "clicked", G_CALLBACK (add_clicked_cb), self);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-
-  item = gtk_tool_button_new (NULL, "");
-  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
-      "list-remove-symbolic");
-  g_signal_connect (item, "clicked", G_CALLBACK (remove_clicked_cb), self);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-
-  item = gtk_tool_button_new (NULL, "");
-  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
-      "preferences-system-symbolic");
-  g_signal_connect (item, "clicked", G_CALLBACK (edit_clicked_cb), self);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-
-  context = gtk_widget_get_style_context (scroll);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-
-  context = gtk_widget_get_style_context (toolbar);
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
-
-  /* Live search */
-  priv->search = empathy_live_search_new (priv->treeview);
-
-  gtk_box_pack_start (GTK_BOX (vbox), priv->search, FALSE, TRUE, 0);
-
-  priv->filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (
-          GTK_TREE_MODEL (priv->store), NULL));
-  gtk_tree_model_filter_set_visible_func (priv->filter,
-          filter_visible_func, self, NULL);
-
-  gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview),
-          GTK_TREE_MODEL (priv->filter));
-
-  priv->search_sig = g_signal_connect (priv->search, "notify::text",
-      G_CALLBACK (search_text_notify_cb), self);
-
-  priv->activate_sig = g_signal_connect (priv->search, "activate",
-      G_CALLBACK (search_activate_cb), self);
-
-  /* Add buttons */
-  gtk_dialog_add_buttons (dialog,
-      _("Reset _Networks List"), RESPONSE_RESET,
-      NULL);
-
-  priv->select_button = gtk_dialog_add_button (dialog,
-      C_("verb displayed on a button to select an IRC network", "Select"),
-      GTK_RESPONSE_CLOSE);
-
-  fill_store (self);
-
-  g_signal_connect (priv->treeview, "cursor-changed",
-      G_CALLBACK (treeview_changed_cb), self);
-
-  g_signal_connect (self, "response",
-      G_CALLBACK (dialog_response_cb), self);
-
-  /* Request a side ensuring to display at least some networks */
-  gtk_widget_set_size_request (GTK_WIDGET (self), -1, 300);
-
-  gtk_window_set_modal (GTK_WINDOW (self), TRUE);
-}
-
-static void
-tpaw_irc_network_chooser_dialog_dispose (GObject *object)
-{
-  TpawIrcNetworkManager *self = (TpawIrcNetworkManager *) object;
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-
-  if (priv->search_sig != 0)
-    {
-      g_signal_handler_disconnect (priv->search, priv->search_sig);
-      priv->search_sig = 0;
-    }
-
-  if (priv->activate_sig != 0)
-    {
-      g_signal_handler_disconnect (priv->search, priv->activate_sig);
-      priv->activate_sig = 0;
-    }
-
-  if (priv->search != NULL)
-    {
-      empathy_live_search_set_hook_widget (EMPATHY_LIVE_SEARCH (priv->search),
-          NULL);
-
-      priv->search = NULL;
-    }
-
-  tp_clear_object (&priv->settings);
-  tp_clear_object (&priv->network);
-  tp_clear_object (&priv->network_manager);
-  tp_clear_object (&priv->store);
-  tp_clear_object (&priv->filter);
-
-  if (G_OBJECT_CLASS (tpaw_irc_network_chooser_dialog_parent_class)->dispose)
-    G_OBJECT_CLASS (tpaw_irc_network_chooser_dialog_parent_class)->dispose (object);
-}
-
-static void
-tpaw_irc_network_chooser_dialog_class_init (TpawIrcNetworkChooserDialogClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->get_property = tpaw_irc_network_chooser_dialog_get_property;
-  object_class->set_property = tpaw_irc_network_chooser_dialog_set_property;
-  object_class->constructed = tpaw_irc_network_chooser_dialog_constructed;
-  object_class->dispose = tpaw_irc_network_chooser_dialog_dispose;
-
-  g_object_class_install_property (object_class, PROP_SETTINGS,
-    g_param_spec_object ("settings",
-      "Settings",
-      "The EmpathyAccountSettings to show and edit",
-      EMPATHY_TYPE_ACCOUNT_SETTINGS,
-      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  g_object_class_install_property (object_class, PROP_NETWORK,
-    g_param_spec_object ("network",
-      "Network",
-      "The TpawIrcNetwork selected in the treeview",
-      TPAW_TYPE_IRC_NETWORK,
-      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  g_type_class_add_private (object_class,
-      sizeof (TpawIrcNetworkChooserDialogPriv));
-}
-
-static void
-tpaw_irc_network_chooser_dialog_init (TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv;
-
-  priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, TpawIrcNetworkChooserDialogPriv);
-  self->priv = priv;
-
-  priv->network_manager = tpaw_irc_network_manager_dup_default ();
-}
-
-GtkWidget *
-tpaw_irc_network_chooser_dialog_new (EmpathyAccountSettings *settings,
-    TpawIrcNetwork *network,
-    GtkWindow *parent)
-{
-  return g_object_new (TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG,
-      "settings", settings,
-      "network", network,
-      "transient-for", parent,
-      NULL);
-}
-
-TpawIrcNetwork *
-tpaw_irc_network_chooser_dialog_get_network (
-    TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-
-  return priv->network;
-}
-
-gboolean
-tpaw_irc_network_chooser_dialog_get_changed (
-    TpawIrcNetworkChooserDialog *self)
-{
-  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
-
-  return priv->changed;
-}
diff --git a/tp-account-widgets/empathy-irc-network-chooser-dialog.h b/tp-account-widgets/empathy-irc-network-chooser-dialog.h
deleted file mode 100644 (file)
index b1d5c21..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- * Copyright (C) 2010 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Authors: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_IRC_NETWORK_CHOOSER_DIALOG_H__
-#define __TPAW_IRC_NETWORK_CHOOSER_DIALOG_H__
-
-#include <gtk/gtk.h>
-
-#include "empathy-account-settings.h"
-#include "empathy-irc-network.h"
-
-G_BEGIN_DECLS
-
-#define TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG (tpaw_irc_network_chooser_dialog_get_type ())
-#define TPAW_IRC_NETWORK_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, TpawIrcNetworkChooserDialog))
-#define TPAW_IRC_NETWORK_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, TpawIrcNetworkChooserDialogClass))
-#define TPAW_IS_IRC_NETWORK_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG))
-#define TPAW_IS_IRC_NETWORK_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG))
-#define TPAW_IRC_NETWORK_CHOOSER_DIALOG_GET_CLASS(o) ( \
-    G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, \
-        TpawIrcNetworkChooserDialogClass))
-
-typedef struct {
-  GtkDialog parent;
-
-  /*<private>*/
-  gpointer priv;
-} TpawIrcNetworkChooserDialog;
-
-typedef struct {
-  GtkDialogClass parent_class;
-} TpawIrcNetworkChooserDialogClass;
-
-GType tpaw_irc_network_chooser_dialog_get_type (void) G_GNUC_CONST;
-
-GtkWidget * tpaw_irc_network_chooser_dialog_new (
-    EmpathyAccountSettings *settings,
-    TpawIrcNetwork *network,
-    GtkWindow *parent);
-
-TpawIrcNetwork * tpaw_irc_network_chooser_dialog_get_network (
-    TpawIrcNetworkChooserDialog *self);
-
-gboolean tpaw_irc_network_chooser_dialog_get_changed (
-    TpawIrcNetworkChooserDialog *self);
-
-G_END_DECLS
-
-#endif /* __TPAW_IRC_NETWORK_CHOOSER_DIALOG_H__ */
diff --git a/tp-account-widgets/empathy-irc-network-chooser.c b/tp-account-widgets/empathy-irc-network-chooser.c
deleted file mode 100644 (file)
index e64fdae..0000000
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- * Copyright (C) 2010 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Authors: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-irc-network-chooser.h"
-
-#include "empathy-irc-network-chooser-dialog.h"
-#include "empathy-irc-network-manager.h"
-#include "empathy-ui-utils.h"
-#include "empathy-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
-#include "empathy-debug.h"
-
-#define DEFAULT_IRC_NETWORK "irc.gimp.org"
-#define DEFAULT_IRC_PORT 6667
-#define DEFAULT_IRC_SSL FALSE
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetworkChooser)
-
-enum {
-    PROP_SETTINGS = 1
-};
-
-enum {
-    SIG_CHANGED,
-    LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-typedef struct {
-    EmpathyAccountSettings *settings;
-
-    TpawIrcNetworkManager *network_manager;
-    GtkWidget *dialog;
-    /* Displayed network */
-    TpawIrcNetwork *network;
-} TpawIrcNetworkChooserPriv;
-
-G_DEFINE_TYPE (TpawIrcNetworkChooser, tpaw_irc_network_chooser,
-    GTK_TYPE_BUTTON);
-
-static void
-tpaw_irc_network_chooser_set_property (GObject *object,
-    guint prop_id,
-    const GValue *value,
-    GParamSpec *pspec)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (object);
-
-  switch (prop_id)
-    {
-      case PROP_SETTINGS:
-        priv->settings = g_value_dup_object (value);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_network_chooser_get_property (GObject *object,
-    guint prop_id,
-    GValue *value,
-    GParamSpec *pspec)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (object);
-
-  switch (prop_id)
-    {
-      case PROP_SETTINGS:
-        g_value_set_object (value, priv->settings);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-static void
-unset_server_params (TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-
-  DEBUG ("Unset server, port and use-ssl");
-  empathy_account_settings_unset (priv->settings, "server");
-  empathy_account_settings_unset (priv->settings, "port");
-  empathy_account_settings_unset (priv->settings, "use-ssl");
-}
-
-static gchar *
-dup_network_service (TpawIrcNetwork *network)
-{
-  /* Account.Service has to be a lower case alphanumeric string which may
-   * also contain '-' but not start with it. */
-#define VALID G_CSET_a_2_z G_CSET_DIGITS "-"
-  gchar *service, *tmp;
-
-  service = g_strdup (tpaw_irc_network_get_name (network));
-  service = g_strstrip (service);
-
-  if (tp_str_empty (service))
-    {
-      g_free (service);
-      return NULL;
-    }
-
-  tmp = service;
-  service = g_ascii_strdown (service, -1);
-  g_free (tmp);
-
-  service = g_strcanon (service, VALID, '-');
-
-  if (service[0] == '-')
-    {
-      tmp = service;
-      service = g_strdup (service + 1);
-
-      g_free (tmp);
-    }
-
-  return service;
-}
-
-static void
-update_server_params (TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-  GSList *servers;
-  const gchar *charset;
-
-  g_assert (priv->network != NULL);
-
-  charset = tpaw_irc_network_get_charset (priv->network);
-  DEBUG ("Setting charset to %s", charset);
-  empathy_account_settings_set (priv->settings, "charset",
-      g_variant_new_string (charset));
-
-  servers = tpaw_irc_network_get_servers (priv->network);
-  if (g_slist_length (servers) > 0)
-    {
-      /* set the first server as CM server */
-      TpawIrcServer *server = servers->data;
-      gchar *address;
-      guint port;
-      gboolean ssl;
-      gchar *service;
-
-      g_object_get (server,
-          "address", &address,
-          "port", &port,
-          "ssl", &ssl,
-          NULL);
-
-      DEBUG ("Setting server to %s", address);
-      empathy_account_settings_set (priv->settings, "server",
-          g_variant_new_string (address));
-      DEBUG ("Setting port to %u", port);
-      empathy_account_settings_set (priv->settings, "port",
-          g_variant_new_uint32 (port));
-      DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" );
-      empathy_account_settings_set (priv->settings, "use-ssl",
-          g_variant_new_boolean (ssl));
-
-      /* Set Account.Service */
-      service = dup_network_service (priv->network);
-      DEBUG ("Setting Service to %s", service);
-      empathy_account_settings_set_service (priv->settings, service);
-
-      g_free (address);
-      g_free (service);
-    }
-  else
-    {
-      /* No server. Unset values */
-      unset_server_params (self);
-    }
-
-  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
-  g_slist_free (servers);
-}
-
-static void
-set_label (TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-
-  g_assert (priv->network != NULL);
-
-  gtk_button_set_label (GTK_BUTTON (self),
-      tpaw_irc_network_get_name (priv->network));
-}
-
-static void
-set_label_from_settings (TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-  gchar *server;
-
-  tp_clear_object (&priv->network);
-
-  server = empathy_account_settings_dup_string (priv->settings, "server");
-
-  if (server != NULL)
-    {
-      TpawIrcServer *srv;
-      gint port;
-      gboolean ssl;
-
-      priv->network = tpaw_irc_network_manager_find_network_by_address (
-          priv->network_manager, server);
-
-      if (priv->network != NULL)
-        {
-          /* The network is known */
-          g_object_ref (priv->network);
-          set_label (self);
-          return;
-        }
-
-      /* We don't have this network. Let's create it */
-      port = empathy_account_settings_get_uint32 (priv->settings, "port");
-      ssl = empathy_account_settings_get_boolean (priv->settings,
-          "use-ssl");
-
-      DEBUG ("Create a network %s", server);
-      priv->network = tpaw_irc_network_new (server);
-      srv = tpaw_irc_server_new (server, port, ssl);
-
-      tpaw_irc_network_append_server (priv->network, srv);
-      tpaw_irc_network_manager_add (priv->network_manager, priv->network);
-
-      set_label (self);
-
-      g_object_unref (srv);
-      g_free (server);
-      return;
-    }
-
-  /* Set default network */
-  priv->network = tpaw_irc_network_manager_find_network_by_address (
-          priv->network_manager, DEFAULT_IRC_NETWORK);
-
-  if (priv->network == NULL)
-    {
-      /* Default network is not known, recreate it */
-      TpawIrcServer *srv;
-
-      priv->network = tpaw_irc_network_new (DEFAULT_IRC_NETWORK);
-
-      srv = tpaw_irc_server_new (DEFAULT_IRC_NETWORK, DEFAULT_IRC_PORT,
-          DEFAULT_IRC_SSL);
-
-      tpaw_irc_network_append_server (priv->network, srv);
-      tpaw_irc_network_manager_add (priv->network_manager, priv->network);
-
-      g_object_unref (srv);
-    }
-
-  set_label (self);
-  update_server_params (self);
-  g_object_ref (priv->network);
-}
-
-static void
-dialog_response_cb (GtkDialog *dialog,
-    gint response,
-    TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-  TpawIrcNetworkChooserDialog *chooser =
-    TPAW_IRC_NETWORK_CHOOSER_DIALOG (priv->dialog);
-
-  if (response != GTK_RESPONSE_CLOSE &&
-      response != GTK_RESPONSE_DELETE_EVENT)
-    return;
-
-  if (tpaw_irc_network_chooser_dialog_get_changed (chooser))
-    {
-      tp_clear_object (&priv->network);
-
-      priv->network = g_object_ref (
-          tpaw_irc_network_chooser_dialog_get_network (chooser));
-
-      update_server_params (self);
-      set_label (self);
-
-      g_signal_emit (self, signals[SIG_CHANGED], 0);
-    }
-
-  gtk_widget_destroy (priv->dialog);
-  priv->dialog = NULL;
-}
-
-static void
-clicked_cb (GtkButton *button,
-    gpointer user_data)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (button);
-  GtkWindow *window;
-
-  if (priv->dialog != NULL)
-    goto out;
-
-  window = empathy_get_toplevel_window (GTK_WIDGET (button));
-
-  priv->dialog = tpaw_irc_network_chooser_dialog_new (priv->settings,
-      priv->network, window);
-  gtk_widget_show_all (priv->dialog);
-
-  tp_g_signal_connect_object (priv->dialog, "response",
-      G_CALLBACK (dialog_response_cb), button, 0);
-
-out:
-  empathy_window_present (GTK_WINDOW (priv->dialog));
-}
-
-static void
-tpaw_irc_network_chooser_constructed (GObject *object)
-{
-  TpawIrcNetworkChooser *self = (TpawIrcNetworkChooser *) object;
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-
-  g_assert (priv->settings != NULL);
-
-  set_label_from_settings (self);
-
-  g_signal_connect (self, "clicked", G_CALLBACK (clicked_cb), self);
-}
-
-static void
-tpaw_irc_network_chooser_dispose (GObject *object)
-{
-  TpawIrcNetworkManager *self = (TpawIrcNetworkManager *) object;
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-
-  tp_clear_object (&priv->settings);
-  tp_clear_object (&priv->network_manager);
-  tp_clear_object (&priv->network);
-
-  if (G_OBJECT_CLASS (tpaw_irc_network_chooser_parent_class)->dispose)
-    G_OBJECT_CLASS (tpaw_irc_network_chooser_parent_class)->dispose (object);
-}
-
-static void
-tpaw_irc_network_chooser_class_init (TpawIrcNetworkChooserClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->get_property = tpaw_irc_network_chooser_get_property;
-  object_class->set_property = tpaw_irc_network_chooser_set_property;
-  object_class->constructed = tpaw_irc_network_chooser_constructed;
-  object_class->dispose = tpaw_irc_network_chooser_dispose;
-
-  g_object_class_install_property (object_class, PROP_SETTINGS,
-    g_param_spec_object ("settings",
-      "Settings",
-      "The EmpathyAccountSettings to show and edit",
-      EMPATHY_TYPE_ACCOUNT_SETTINGS,
-      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
-  signals[SIG_CHANGED] = g_signal_new ("changed",
-      G_OBJECT_CLASS_TYPE (object_class),
-      G_SIGNAL_RUN_LAST,
-      0,
-      NULL, NULL,
-      g_cclosure_marshal_generic,
-      G_TYPE_NONE,
-      0);
-
-  g_type_class_add_private (object_class,
-      sizeof (TpawIrcNetworkChooserPriv));
-}
-
-static void
-tpaw_irc_network_chooser_init (TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv;
-
-  priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      TPAW_TYPE_IRC_NETWORK_CHOOSER, TpawIrcNetworkChooserPriv);
-  self->priv = priv;
-
-  priv->network_manager = tpaw_irc_network_manager_dup_default ();
-}
-
-GtkWidget *
-tpaw_irc_network_chooser_new (EmpathyAccountSettings *settings)
-{
-  return g_object_new (TPAW_TYPE_IRC_NETWORK_CHOOSER,
-      "settings", settings,
-      NULL);
-}
-
-TpawIrcNetwork *
-tpaw_irc_network_chooser_get_network (TpawIrcNetworkChooser *self)
-{
-  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
-
-  return priv->network;
-}
diff --git a/tp-account-widgets/empathy-irc-network-chooser.h b/tp-account-widgets/empathy-irc-network-chooser.h
deleted file mode 100644 (file)
index e2bb157..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- * Copyright (C) 2010 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Authors: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_IRC_NETWORK_CHOOSER_H__
-#define __TPAW_IRC_NETWORK_CHOOSER_H__
-
-#include <gtk/gtk.h>
-
-#include "empathy-account-settings.h"
-#include "empathy-irc-network.h"
-
-G_BEGIN_DECLS
-
-#define TPAW_TYPE_IRC_NETWORK_CHOOSER (tpaw_irc_network_chooser_get_type ())
-#define TPAW_IRC_NETWORK_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER, TpawIrcNetworkChooser))
-#define TPAW_IRC_NETWORK_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER, TpawIrcNetworkChooserClass))
-#define TPAW_IS_IRC_NETWORK_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER))
-#define TPAW_IS_IRC_NETWORK_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
-    TPAW_TYPE_IRC_NETWORK_CHOOSER))
-#define TPAW_IRC_NETWORK_CHOOSER_GET_CLASS(o) ( \
-    G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK_CHOOSER, \
-        TpawIrcNetworkChooserClass))
-
-typedef struct {
-  GtkButton parent;
-
-  /*<private>*/
-  gpointer priv;
-} TpawIrcNetworkChooser;
-
-typedef struct {
-  GtkButtonClass parent_class;
-} TpawIrcNetworkChooserClass;
-
-GType tpaw_irc_network_chooser_get_type (void) G_GNUC_CONST;
-
-GtkWidget * tpaw_irc_network_chooser_new (EmpathyAccountSettings *settings);
-
-TpawIrcNetwork * tpaw_irc_network_chooser_get_network (
-    TpawIrcNetworkChooser *self);
-
-G_END_DECLS
-
-#endif /* __TPAW_IRC_NETWORK_CHOOSER_H__ */
diff --git a/tp-account-widgets/empathy-irc-network-dialog.c b/tp-account-widgets/empathy-irc-network-dialog.c
deleted file mode 100644 (file)
index 8683637..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-irc-network-dialog.h"
-
-#include <glib/gi18n-lib.h>
-
-#include "empathy-ui-utils.h"
-#include "totem-subtitle-encoding.h"
-
-typedef struct {
-  TpawIrcNetwork *network;
-
-  GtkWidget *dialog;
-  GtkWidget *button_close;
-
-  GtkWidget *entry_network;
-  GtkWidget *combobox_charset;
-
-  GtkWidget *treeview_servers;
-  GtkWidget *button_add;
-  GtkWidget *button_remove;
-  GtkWidget *button_up;
-  GtkWidget *button_down;
-} TpawIrcNetworkDialog;
-
-static void
-irc_network_dialog_destroy_cb (GtkWidget *widget,
-                               TpawIrcNetworkDialog *dialog)
-{
-  g_object_unref (dialog->network);
-
-  g_slice_free (TpawIrcNetworkDialog, dialog);
-}
-
-static void
-irc_network_dialog_close_clicked_cb (GtkWidget *widget,
-                                     TpawIrcNetworkDialog *dialog)
-{
-  gtk_widget_destroy (dialog->dialog);
-}
-
-enum {
-  COL_SRV_OBJ,
-  COL_ADR,
-  COL_PORT,
-  COL_SSL
-};
-
-static void
-add_server_to_store (GtkListStore *store,
-                     TpawIrcServer *server,
-                     GtkTreeIter *iter)
-{
-  gchar *address;
-  guint port;
-  gboolean ssl;
-
-  g_object_get (server,
-      "address", &address,
-      "port", &port,
-      "ssl", &ssl,
-      NULL);
-
-  gtk_list_store_insert_with_values (store, iter, -1,
-      COL_SRV_OBJ, server,
-      COL_ADR, address,
-      COL_PORT, port,
-      COL_SSL, ssl,
-      -1);
-
-  g_free (address);
-}
-
-static void
-irc_network_dialog_setup (TpawIrcNetworkDialog *dialog)
-{
-  gchar *name, *charset;
-  GSList *servers, *l;
-  GtkListStore *store;
-
-  g_object_get (dialog->network,
-      "name", &name,
-      "charset", &charset,
-      NULL);
-  gtk_entry_set_text (GTK_ENTRY (dialog->entry_network), name);
-
-  store = GTK_LIST_STORE (gtk_tree_view_get_model (
-        GTK_TREE_VIEW (dialog->treeview_servers)));
-
-  servers = tpaw_irc_network_get_servers (dialog->network);
-  for (l = servers; l != NULL; l = g_slist_next (l))
-    {
-      TpawIrcServer *server = l->data;
-      GtkTreeIter iter;
-
-      add_server_to_store (store, server, &iter);
-    }
-
-  totem_subtitle_encoding_set (GTK_COMBO_BOX (dialog->combobox_charset),
-      charset);
-
-  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
-  g_slist_free (servers);
-  g_free (name);
-  g_free (charset);
-}
-
-static void
-irc_network_dialog_address_edited_cb (GtkCellRendererText *renderer,
-                                      gchar *path,
-                                      gchar *new_text,
-                                      TpawIrcNetworkDialog *dialog)
-{
-  TpawIrcServer *server;
-  GtkTreeModel *model;
-  GtkTreePath  *treepath;
-  GtkTreeIter iter;
-
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_servers));
-  treepath = gtk_tree_path_new_from_string (path);
-  gtk_tree_model_get_iter (model, &iter, treepath);
-  gtk_tree_model_get (model, &iter,
-      COL_SRV_OBJ, &server,
-      -1);
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-      COL_ADR, new_text,
-      -1);
-
-  g_object_set (server, "address", new_text, NULL);
-
-  gtk_tree_path_free (treepath);
-  g_object_unref (server);
-}
-
-static void
-irc_network_dialog_port_edited_cb (GtkCellRendererText *renderer,
-                                   gchar *path,
-                                   gchar *new_text,
-                                   TpawIrcNetworkDialog *dialog)
-{
-  TpawIrcServer *server;
-  GtkTreeModel *model;
-  GtkTreePath  *treepath;
-  GtkTreeIter iter;
-  guint port;
-
-  port = strtoul (new_text, NULL, 10);
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_servers));
-  treepath = gtk_tree_path_new_from_string (path);
-  gtk_tree_model_get_iter (model, &iter, treepath);
-  gtk_tree_model_get (model, &iter,
-      COL_SRV_OBJ, &server,
-      -1);
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-      COL_PORT, port,
-      -1);
-
-  g_object_set (server, "port", port, NULL);
-
-  gtk_tree_path_free (treepath);
-  g_object_unref (server);
-}
-
-static void
-irc_network_dialog_ssl_toggled_cb (GtkCellRendererText *renderer,
-                                   gchar *path,
-                                   TpawIrcNetworkDialog *dialog)
-{
-  TpawIrcServer *server;
-  GtkTreeModel *model;
-  GtkTreePath  *treepath;
-  GtkTreeIter iter;
-  gboolean ssl;
-
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_servers));
-  treepath = gtk_tree_path_new_from_string (path);
-  gtk_tree_model_get_iter (model, &iter, treepath);
-  gtk_tree_model_get (model, &iter,
-      COL_SRV_OBJ, &server,
-      COL_SSL, &ssl,
-      -1);
-  ssl = !ssl;
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-      COL_SSL, ssl,
-      -1);
-
-  g_object_set (server, "ssl", ssl, NULL);
-
-  gtk_tree_path_free (treepath);
-  g_object_unref (server);
-}
-
-static gboolean
-irc_network_dialog_network_focus_cb (GtkWidget *widget,
-                                     GdkEventFocus *event,
-                                     TpawIrcNetworkDialog *dialog)
-{
-  const gchar *str;
-
-  str = gtk_entry_get_text (GTK_ENTRY (widget));
-
-  g_object_set (dialog->network, "name", str, NULL);
-
-  return FALSE;
-}
-
-static void
-irc_network_dialog_network_update_buttons (TpawIrcNetworkDialog *dialog)
-{
-  GtkTreeSelection *selection;
-  GtkTreeModel *model;
-  GtkTreePath *path;
-  GtkTreeIter iter;
-  gboolean can_remove = FALSE, can_move_up = FALSE, can_move_down = FALSE;
-  int selected;
-
-  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (
-        dialog->treeview_servers));
-
-  if (gtk_tree_selection_get_selected (selection, &model, &iter))
-  {
-    path = gtk_tree_model_get_path (model, &iter);
-
-    selected = gtk_tree_path_get_indices (path)[0];
-
-    can_remove = TRUE;
-    can_move_up = selected > 0;
-    can_move_down =
-      selected < gtk_tree_model_iter_n_children (model, NULL) - 1;
-
-    gtk_tree_path_free (path);
-  }
-
-  gtk_widget_set_sensitive (dialog->button_remove, can_remove);
-  gtk_widget_set_sensitive (dialog->button_up, can_move_up);
-  gtk_widget_set_sensitive (dialog->button_down, can_move_down);
-}
-
-static void
-irc_network_dialog_button_add_clicked_cb (GtkWidget *widget,
-                                          TpawIrcNetworkDialog *dialog)
-{
-  TpawIrcServer *server;
-  GtkListStore *store;
-  GtkTreeIter iter;
-  GtkTreePath *path;
-  GtkTreeViewColumn *column;
-
-  store = GTK_LIST_STORE (gtk_tree_view_get_model (
-        GTK_TREE_VIEW (dialog->treeview_servers)));
-
-  server = tpaw_irc_server_new (_("new server"), 6667, FALSE);
-  tpaw_irc_network_append_server (dialog->network, server);
-  add_server_to_store (store, server, &iter);
-
-  path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
-  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
-      0);
-  gtk_tree_view_set_cursor (GTK_TREE_VIEW (dialog->treeview_servers), path,
-      column, TRUE);
-
-  irc_network_dialog_network_update_buttons (dialog);
-
-  gtk_tree_path_free (path);
-  g_object_unref (server);
-}
-
-static void
-irc_network_dialog_button_remove_clicked_cb (GtkWidget *widget,
-                                             TpawIrcNetworkDialog *dialog)
-{
-  GtkTreeSelection *selection;
-  GtkTreeModel *model;
-  GtkTreeIter iter;
-  TpawIrcServer *server;
-
-  selection = gtk_tree_view_get_selection (
-      GTK_TREE_VIEW (dialog->treeview_servers));
-
-  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-    return;
-
-  gtk_tree_model_get (model, &iter, COL_SRV_OBJ, &server, -1);
-
-  gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
-  tpaw_irc_network_remove_server (dialog->network, server);
-
-  irc_network_dialog_network_update_buttons (dialog);
-
-  g_object_unref (server);
-}
-
-static void
-irc_network_dialog_button_up_clicked_cb (GtkWidget *widget,
-                                         TpawIrcNetworkDialog *dialog)
-{
-  GtkTreeSelection *selection;
-  GtkTreeModel *model;
-  GtkTreeIter iter, iter_prev;
-  GtkTreePath *path;
-  gint *pos;
-  TpawIrcServer *server;
-
-  selection = gtk_tree_view_get_selection (
-      GTK_TREE_VIEW (dialog->treeview_servers));
-
-  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-    return;
-
-  path = gtk_tree_model_get_path (model, &iter);
-
-  if (!gtk_tree_path_prev (path))
-  {
-    gtk_tree_path_free (path);
-    return;
-  }
-
-  gtk_tree_model_get (model, &iter, COL_SRV_OBJ, &server, -1);
-
-  gtk_tree_model_get_iter (model, &iter_prev, path);
-  gtk_list_store_swap (GTK_LIST_STORE (model), &iter_prev, &iter);
-
-  pos = gtk_tree_path_get_indices (path);
-  tpaw_irc_network_set_server_position (dialog->network, server, *pos);
-
-  irc_network_dialog_network_update_buttons (dialog);
-
-  g_object_unref (server);
-  gtk_tree_path_free (path);
-}
-
-static void
-irc_network_dialog_button_down_clicked_cb (GtkWidget *widget,
-                                           TpawIrcNetworkDialog *dialog)
-{
-  GtkTreeSelection *selection;
-  GtkTreeModel *model;
-  GtkTreeIter iter, iter_prev;
-  GtkTreePath *path;
-  TpawIrcServer *server;
-  gint *pos;
-
-  selection = gtk_tree_view_get_selection (
-      GTK_TREE_VIEW (dialog->treeview_servers));
-
-  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-    return;
-
-  path = gtk_tree_model_get_path (model, &iter);
-
-  gtk_tree_path_next (path);
-  if (!gtk_tree_model_get_iter (model, &iter_prev, path))
-    {
-      gtk_tree_path_free (path);
-      return;
-    }
-
-  gtk_tree_model_get (model, &iter, COL_SRV_OBJ, &server, -1);
-
-  gtk_list_store_swap (GTK_LIST_STORE (model), &iter_prev, &iter);
-
-  pos = gtk_tree_path_get_indices (path);
-  tpaw_irc_network_set_server_position (dialog->network, server, *pos);
-
-  irc_network_dialog_network_update_buttons (dialog);
-
-  gtk_tree_path_free (path);
-}
-
-static void
-irc_network_dialog_selection_changed_cb (GtkTreeSelection  *treeselection,
-                                         TpawIrcNetworkDialog *dialog)
-{
-  irc_network_dialog_network_update_buttons (dialog);
-}
-
-static void
-irc_network_dialog_combobox_charset_changed_cb (GtkWidget *combobox,
-                                                TpawIrcNetworkDialog *dialog)
-{
-  const gchar *charset;
-
-  charset = totem_subtitle_encoding_get_selected (GTK_COMBO_BOX (combobox));
-  g_object_set (dialog->network, "charset", charset, NULL);
-}
-
-static void
-change_network (TpawIrcNetworkDialog *dialog,
-                TpawIrcNetwork *network)
-{
-  GtkListStore *store;
-
-  if (dialog->network == network)
-    /* No need to change */
-    return;
-
-  if (dialog->network != NULL)
-    {
-      g_object_unref (dialog->network);
-    }
-
-  dialog->network = network;
-  g_object_ref (network);
-
-  store = GTK_LIST_STORE (gtk_tree_view_get_model (
-        GTK_TREE_VIEW (dialog->treeview_servers)));
-  gtk_list_store_clear (store);
-
-  irc_network_dialog_setup (dialog);
-}
-
-/**
- * tpaw_irc_network_dialog_show:
- * @network: the #TpawIrcNetwork to configure
- * @parent: the parent of this dialog
- *
- * Display a dialog to configure a given #TpawIrcNetwork.
- * This function is a singleton so if a configuration dialog already
- * exists we use this one to edit the network.
- *
- * Returns: The displayed #GtkDialog
- */
-GtkWidget *
-tpaw_irc_network_dialog_show (TpawIrcNetwork *network,
-                                 GtkWidget *parent)
-{
-  static TpawIrcNetworkDialog *dialog = NULL;
-  GtkBuilder *gui;
-  GtkListStore *store;
-  GtkCellRenderer *renderer;
-  GtkAdjustment *adjustment;
-  GtkTreeSelection *selection;
-  GtkTreeViewColumn *column;
-  GtkWidget *sw, *toolbar;
-  GtkStyleContext *context;
-
-  g_return_val_if_fail (network != NULL, NULL);
-
-  if (dialog != NULL)
-    {
-      change_network (dialog, network);
-      gtk_window_present (GTK_WINDOW (dialog->dialog));
-
-      return dialog->dialog;
-    }
-
-  dialog = g_slice_new0 (TpawIrcNetworkDialog);
-
-  dialog->network = network;
-  g_object_ref (dialog->network);
-
-  gui = empathy_builder_get_resource (ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-irc.ui",
-      "irc_network_dialog", &dialog->dialog,
-      "button_close", &dialog->button_close,
-      "entry_network", &dialog->entry_network,
-      "combobox_charset", &dialog->combobox_charset,
-      "treeview_servers", &dialog->treeview_servers,
-      "button_add", &dialog->button_add,
-      "button_remove", &dialog->button_remove,
-      "button_up", &dialog->button_up,
-      "button_down", &dialog->button_down,
-      "scrolledwindow_network_server", &sw,
-      "toolbar_network_server", &toolbar,
-      NULL);
-
-  store = gtk_list_store_new (4, G_TYPE_OBJECT, G_TYPE_STRING,
-      G_TYPE_UINT, G_TYPE_BOOLEAN);
-  gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview_servers),
-      GTK_TREE_MODEL (store));
-  g_object_unref (store);
-
-  /* address */
-  renderer = gtk_cell_renderer_text_new ();
-  g_object_set (renderer, "editable", TRUE, NULL);
-  g_signal_connect (renderer, "edited",
-      G_CALLBACK (irc_network_dialog_address_edited_cb), dialog);
-  gtk_tree_view_insert_column_with_attributes (
-      GTK_TREE_VIEW (dialog->treeview_servers),
-      -1, _("Server"), renderer, "text", COL_ADR,
-      NULL);
-  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
-      0);
-
-  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_column_set_expand (column, TRUE);
-
-  /* port */
-  adjustment = (GtkAdjustment *) gtk_adjustment_new (6667, 1, G_MAXUINT16,
-      1, 10, 0);
-  renderer = gtk_cell_renderer_spin_new ();
-  g_object_set (renderer,
-      "editable", TRUE,
-      "adjustment", adjustment,
-      NULL);
-  g_signal_connect (renderer, "edited",
-      G_CALLBACK (irc_network_dialog_port_edited_cb), dialog);
-
-  gtk_tree_view_insert_column_with_attributes (
-      GTK_TREE_VIEW (dialog->treeview_servers),
-      -1, _("Port"), renderer, "text", COL_PORT,
-      NULL);
-
-  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
-      1);
-  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_column_set_expand (column, TRUE);
-
-  /* SSL */
-  renderer = gtk_cell_renderer_toggle_new ();
-  g_object_set (renderer, "activatable", TRUE, NULL);
-  g_signal_connect (renderer, "toggled",
-      G_CALLBACK (irc_network_dialog_ssl_toggled_cb), dialog);
-  gtk_tree_view_insert_column_with_attributes (
-      GTK_TREE_VIEW (dialog->treeview_servers),
-      -1, _("SSL"), renderer, "active", COL_SSL,
-      NULL);
-
-  selection = gtk_tree_view_get_selection (
-      GTK_TREE_VIEW (dialog->treeview_servers));
-  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
-  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
-      2);
-  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-
-  gtk_tree_view_column_set_expand (column, TRUE);
-  /* charset */
-  totem_subtitle_encoding_init (GTK_COMBO_BOX (dialog->combobox_charset));
-
-  irc_network_dialog_setup (dialog);
-
-  empathy_builder_connect (gui, dialog,
-      "irc_network_dialog", "destroy", irc_network_dialog_destroy_cb,
-      "button_close", "clicked", irc_network_dialog_close_clicked_cb,
-      "entry_network", "focus-out-event", irc_network_dialog_network_focus_cb,
-      "button_add", "clicked", irc_network_dialog_button_add_clicked_cb,
-      "button_remove", "clicked", irc_network_dialog_button_remove_clicked_cb,
-      "button_up", "clicked", irc_network_dialog_button_up_clicked_cb,
-      "button_down", "clicked", irc_network_dialog_button_down_clicked_cb,
-      "combobox_charset", "changed", irc_network_dialog_combobox_charset_changed_cb,
-      NULL);
-
-  g_object_unref (gui);
-
-  g_object_add_weak_pointer (G_OBJECT (dialog->dialog),
-      (gpointer) &dialog);
-
-  g_signal_connect (selection, "changed",
-      G_CALLBACK (irc_network_dialog_selection_changed_cb),
-      dialog);
-
-  gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
-      GTK_WINDOW (parent));
-  gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
-
-  /* join the add/remove toolbar to the treeview */
-  context = gtk_widget_get_style_context (sw);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-
-  context = gtk_widget_get_style_context (toolbar);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
-
-  irc_network_dialog_network_update_buttons (dialog);
-  gtk_widget_show_all (dialog->dialog);
-
-  gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
-
-  return dialog->dialog;
-}
diff --git a/tp-account-widgets/empathy-irc-network-dialog.h b/tp-account-widgets/empathy-irc-network-dialog.h
deleted file mode 100644 (file)
index a879ea4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_IRC_NETWORK_DIALOG_H__
-#define __TPAW_IRC_NETWORK_DIALOG_H__
-
-#include <gtk/gtk.h>
-
-#include "empathy-irc-network.h"
-
-G_BEGIN_DECLS
-
-GtkWidget * tpaw_irc_network_dialog_show (TpawIrcNetwork *network,
-    GtkWidget *parent);
-
-G_END_DECLS
-
-#endif /* __TPAW_IRC_NETWORK_DIALOG_H__ */
diff --git a/tp-account-widgets/empathy-irc-network-manager.c b/tp-account-widgets/empathy-irc-network-manager.c
deleted file mode 100644 (file)
index 2bf84e2..0000000
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-irc-network-manager.h"
-
-#include <sys/stat.h>
-
-#include "empathy-utils.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_IRC
-#include "empathy-debug.h"
-
-#define IRC_NETWORKS_DTD_RESOURCENAME "/org/gnome/AccountWidgets/empathy-irc-networks.dtd"
-#define IRC_NETWORKS_FILENAME "irc-networks.xml"
-#define SAVE_TIMER 4
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetworkManager)
-typedef struct {
-  GHashTable *networks;
-
-  gchar *global_file;
-  gchar *user_file;
-  guint last_id;
-
-  /* Do we have to save modifications to the user file ? */
-  gboolean have_to_save;
-  /* Are we loading networks from XML files ? */
-  gboolean loading;
-  /* source id of the autosave timer */
-  gint save_timer_id;
-} TpawIrcNetworkManagerPriv;
-
-/* properties */
-enum
-{
-  PROP_GLOBAL_FILE = 1,
-  PROP_USER_FILE,
-  LAST_PROPERTY
-};
-
-G_DEFINE_TYPE (TpawIrcNetworkManager, tpaw_irc_network_manager,
-    G_TYPE_OBJECT);
-
-static void irc_network_manager_load_servers (
-    TpawIrcNetworkManager *manager);
-static gboolean irc_network_manager_file_parse (
-    TpawIrcNetworkManager *manager, const gchar *filename,
-    gboolean user_defined);
-static gboolean irc_network_manager_file_save (
-    TpawIrcNetworkManager *manager);
-
-static void
-tpaw_irc_network_manager_get_property (GObject *object,
-                                          guint property_id,
-                                          GValue *value,
-                                          GParamSpec *pspec)
-{
-  TpawIrcNetworkManager *self = TPAW_IRC_NETWORK_MANAGER (object);
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  switch (property_id)
-    {
-      case PROP_GLOBAL_FILE:
-        g_value_set_string (value, priv->global_file);
-        break;
-      case PROP_USER_FILE:
-        g_value_set_string (value, priv->user_file);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_network_manager_set_property (GObject *object,
-                                          guint property_id,
-                                          const GValue *value,
-                                          GParamSpec *pspec)
-{
-  TpawIrcNetworkManager *self = TPAW_IRC_NETWORK_MANAGER (object);
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  switch (property_id)
-    {
-      case PROP_GLOBAL_FILE:
-        g_free (priv->global_file);
-        priv->global_file = g_value_dup_string (value);
-        break;
-      case PROP_USER_FILE:
-        g_free (priv->user_file);
-        priv->user_file = g_value_dup_string (value);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-        break;
-    }
-}
-
-static GObject *
-tpaw_irc_network_manager_constructor (GType type,
-                                         guint n_props,
-                                         GObjectConstructParam *props)
-{
-  GObject *obj;
-  TpawIrcNetworkManager *self;
-
-  /* Parent constructor chain */
-  obj = G_OBJECT_CLASS (tpaw_irc_network_manager_parent_class)->
-        constructor (type, n_props, props);
-
-  self = TPAW_IRC_NETWORK_MANAGER (obj);
-  irc_network_manager_load_servers (self);
-
-  return obj;
-}
-
-static void
-tpaw_irc_network_manager_finalize (GObject *object)
-{
-  TpawIrcNetworkManager *self = TPAW_IRC_NETWORK_MANAGER (object);
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  if (priv->save_timer_id > 0)
-    {
-      g_source_remove (priv->save_timer_id);
-    }
-
-  if (priv->have_to_save)
-    {
-      irc_network_manager_file_save (self);
-    }
-
-  g_free (priv->global_file);
-  g_free (priv->user_file);
-
-  g_hash_table_unref (priv->networks);
-
-  G_OBJECT_CLASS (tpaw_irc_network_manager_parent_class)->finalize (object);
-}
-
-static void
-tpaw_irc_network_manager_init (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      TPAW_TYPE_IRC_NETWORK_MANAGER, TpawIrcNetworkManagerPriv);
-
-  self->priv = priv;
-
-  priv->networks = g_hash_table_new_full (g_str_hash, g_str_equal,
-      (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref);
-
-  priv->last_id = 0;
-
-  priv->have_to_save = FALSE;
-  priv->loading = FALSE;
-  priv->save_timer_id = 0;
-}
-
-static void
-tpaw_irc_network_manager_class_init (TpawIrcNetworkManagerClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GParamSpec *param_spec;
-
-  object_class->constructor = tpaw_irc_network_manager_constructor;
-  object_class->get_property = tpaw_irc_network_manager_get_property;
-  object_class->set_property = tpaw_irc_network_manager_set_property;
-
-  g_type_class_add_private (object_class, sizeof (TpawIrcNetworkManagerPriv));
-
-  object_class->finalize = tpaw_irc_network_manager_finalize;
-
-  param_spec = g_param_spec_string (
-      "global-file",
-      "path of the global networks file",
-      "The path of the system-wide filename from which we have to load"
-      " the networks list",
-      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_GLOBAL_FILE, param_spec);
-
-  param_spec = g_param_spec_string (
-      "user-file",
-      "path of the user networks file",
-      "The path of user's  filename from which we have to load"
-      " the networks list and to which we'll save his modifications",
-      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_USER_FILE, param_spec);
-}
-
-/**
- * tpaw_irc_network_manager_new:
- * @global_file: the path of the global networks file, or %NULL
- * @user_file: the path of the user networks file, or %NULL
- *
- * Creates a new #TpawIrcNetworkManager
- *
- * Returns: a new #TpawIrcNetworkManager
- */
-TpawIrcNetworkManager *
-tpaw_irc_network_manager_new (const gchar *global_file,
-                                 const gchar *user_file)
-{
-  TpawIrcNetworkManager *manager;
-
-  manager = g_object_new (TPAW_TYPE_IRC_NETWORK_MANAGER,
-      "global-file", global_file,
-      "user-file", user_file,
-      NULL);
-
-  return manager;
-}
-
-static gboolean
-save_timeout (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  priv->save_timer_id = 0;
-  irc_network_manager_file_save (self);
-
-  return FALSE;
-}
-
-static void
-reset_save_timeout (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *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
-network_modified (TpawIrcNetwork *network,
-                  TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  network->user_defined = TRUE;
-
-  if (!priv->loading)
-    {
-      priv->have_to_save = TRUE;
-      reset_save_timeout (self);
-    }
-}
-
-static void
-add_network (TpawIrcNetworkManager *self,
-             TpawIrcNetwork *network,
-             const gchar *id)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  g_hash_table_insert (priv->networks, g_strdup (id), g_object_ref (network));
-
-  g_signal_connect (network, "modified", G_CALLBACK (network_modified), self);
-}
-
-/**
- * tpaw_irc_network_manager_add:
- * @manager: an #TpawIrcNetworkManager
- * @network: the #TpawIrcNetwork to add
- *
- * Add an #TpawIrcNetwork to the given #TpawIrcNetworkManager.
- *
- */
-void
-tpaw_irc_network_manager_add (TpawIrcNetworkManager *self,
-                                 TpawIrcNetwork *network)
-{
-  TpawIrcNetworkManagerPriv *priv;
-  gchar *id = NULL;
-
-  g_return_if_fail (TPAW_IS_IRC_NETWORK_MANAGER (self));
-  g_return_if_fail (TPAW_IS_IRC_NETWORK (network));
-
-  priv = GET_PRIV (self);
-
-  /* generate an id for this network */
-  do
-    {
-      g_free (id);
-      id = g_strdup_printf ("id%u", ++priv->last_id);
-    } while (g_hash_table_lookup (priv->networks, id) != NULL &&
-        priv->last_id < G_MAXUINT);
-
-  if (priv->last_id == G_MAXUINT)
-    {
-      DEBUG ("Can't add network: too many networks using a similar ID");
-      return;
-    }
-
-  DEBUG ("add server with \"%s\" as ID", id);
-
-  network->user_defined = TRUE;
-  add_network (self, network, id);
-
-  priv->have_to_save = TRUE;
-  reset_save_timeout (self);
-
-  g_free (id);
-}
-
-/**
- * tpaw_irc_network_manager_remove:
- * @manager: an #TpawIrcNetworkManager
- * @network: the #TpawIrcNetwork to remove
- *
- * Remove an #TpawIrcNetwork from the given #TpawIrcNetworkManager.
- *
- */
-void
-tpaw_irc_network_manager_remove (TpawIrcNetworkManager *self,
-                                    TpawIrcNetwork *network)
-{
-  TpawIrcNetworkManagerPriv *priv;
-
-  g_return_if_fail (TPAW_IS_IRC_NETWORK_MANAGER (self));
-  g_return_if_fail (TPAW_IS_IRC_NETWORK (network));
-
-  priv = GET_PRIV (self);
-
-  network->user_defined = TRUE;
-  network->dropped = TRUE;
-
-  priv->have_to_save = TRUE;
-  reset_save_timeout (self);
-}
-
-static void
-append_active_networks_to_list (const gchar *id,
-                        TpawIrcNetwork *network,
-                        GSList **list)
-{
-  if (network->dropped)
-    return;
-
-  *list = g_slist_prepend (*list, g_object_ref (network));
-}
-
-static void
-append_dropped_networks_to_list (const gchar *id,
-                        TpawIrcNetwork *network,
-                        GSList **list)
-{
-  if (!network->dropped)
-    return;
-
-  *list = g_slist_prepend (*list, g_object_ref (network));
-}
-
-static GSList *
-get_network_list (TpawIrcNetworkManager *self,
-    gboolean get_active)
-{
-  TpawIrcNetworkManagerPriv *priv;
-  GSList *irc_networks = NULL;
-
-  g_return_val_if_fail (TPAW_IS_IRC_NETWORK_MANAGER (self), NULL);
-
-  priv = GET_PRIV (self);
-
-  if (get_active)
-    {
-      g_hash_table_foreach (priv->networks,
-          (GHFunc) append_active_networks_to_list, &irc_networks);
-    }
-  else
-    {
-      g_hash_table_foreach (priv->networks,
-          (GHFunc) append_dropped_networks_to_list, &irc_networks);
-    }
-
-  return irc_networks;
-}
-
-/**
- * tpaw_irc_network_manager_get_networks:
- * @manager: an #TpawIrcNetworkManager
- *
- * Get the list of #TpawIrcNetwork associated with the given
- * manager.
- *
- * Returns: a new #GSList of refed #TpawIrcNetwork
- */
-GSList *
-tpaw_irc_network_manager_get_networks (TpawIrcNetworkManager *self)
-{
-  return get_network_list (self, TRUE);
-}
-
-/**
- * tpaw_irc_network_manager_get_dropped_networks:
- * @manager: an #TpawIrcNetworkManager
- *
- * Get the list of dropped #TpawIrcNetworks associated with the given
- * manager.
- *
- * Returns: a new #GSList of refed dropped #TpawIrcNetworks
- */
-GSList *
-tpaw_irc_network_manager_get_dropped_networks (TpawIrcNetworkManager *self)
-{
-  return get_network_list (self, FALSE);
-}
-
-/*
- * API to save/load and parse the irc_networks file.
- */
-
-static void
-load_global_file (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  if (priv->global_file == NULL)
-    return;
-
-  if (!g_file_test (priv->global_file, G_FILE_TEST_EXISTS))
-    {
-      DEBUG ("Global networks file %s doesn't exist", priv->global_file);
-      return;
-    }
-
-  irc_network_manager_file_parse (self, priv->global_file, FALSE);
-}
-
-static void
-load_user_file (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  if (priv->user_file == NULL)
-    return;
-
-  if (!g_file_test (priv->user_file, G_FILE_TEST_EXISTS))
-    {
-      DEBUG ("User networks file %s doesn't exist", priv->global_file);
-      return;
-    }
-
-  irc_network_manager_file_parse (self, priv->user_file, TRUE);
-}
-
-static void
-irc_network_manager_load_servers (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-
-  priv->loading = TRUE;
-
-  load_global_file (self);
-  load_user_file (self);
-
-  priv->loading = FALSE;
-  priv->have_to_save = FALSE;
-}
-
-static void
-irc_network_manager_parse_irc_server (TpawIrcNetwork *network,
-                                      xmlNodePtr node)
-{
-  xmlNodePtr server_node;
-
-  for (server_node = node->children; server_node;
-      server_node = server_node->next)
-    {
-      gchar *address = NULL, *port = NULL, *ssl = NULL;
-
-      if (strcmp ((const gchar *) server_node->name, "server") != 0)
-        continue;
-
-      address = (gchar *) xmlGetProp (server_node, (const xmlChar *) "address");
-      port = (gchar *) xmlGetProp (server_node, (const xmlChar *) "port");
-      ssl = (gchar *) xmlGetProp (server_node, (const xmlChar *) "ssl");
-
-      if (address != NULL)
-        {
-          gint port_nb = 0;
-          gboolean have_ssl = FALSE;
-          TpawIrcServer *server;
-
-          if (port != NULL)
-            port_nb = strtol (port, NULL, 10);
-
-          if (port_nb <= 0 || port_nb > G_MAXUINT16)
-            port_nb = 6667;
-
-          if (ssl == NULL || strcmp (ssl, "TRUE") == 0)
-            have_ssl = TRUE;
-
-          DEBUG ("parsed server %s port %d ssl %d", address, port_nb, have_ssl);
-
-          server = tpaw_irc_server_new (address, port_nb, have_ssl);
-          tpaw_irc_network_append_server (network, server);
-        }
-
-      if (address)
-        xmlFree (address);
-      if (port)
-        xmlFree (port);
-      if (ssl)
-        xmlFree (ssl);
-    }
-}
-
-static void
-irc_network_manager_parse_irc_network (TpawIrcNetworkManager *self,
-                                       xmlNodePtr node,
-                                       gboolean user_defined)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork  *network;
-  xmlNodePtr child;
-  gchar *str;
-  gchar *id, *name;
-
-  id = (gchar *) xmlGetProp (node, (const xmlChar *) "id");
-  if (xmlHasProp (node, (const xmlChar *) "dropped"))
-    {
-      if (!user_defined)
-        {
-          DEBUG ("the 'dropped' attribute shouldn't be used in the global file");
-        }
-
-      network = g_hash_table_lookup (priv->networks, id);
-      if (network != NULL)
-        {
-          network->dropped = TRUE;
-          network->user_defined = TRUE;
-        }
-       xmlFree (id);
-      return;
-    }
-
-  if (!xmlHasProp (node, (const xmlChar *) "name"))
-    return;
-
-  name = (gchar *) xmlGetProp (node, (const xmlChar *) "name");
-  network = tpaw_irc_network_new (name);
-
-  if (xmlHasProp (node, (const xmlChar *) "network_charset"))
-    {
-      gchar *charset;
-      charset = (gchar *) xmlGetProp (node, (const xmlChar *) "network_charset");
-      g_object_set (network, "charset", charset, NULL);
-      xmlFree (charset);
-    }
-
-  add_network (self, network, id);
-  DEBUG ("add network %s (id %s)", name, id);
-
-  for (child = node->children; child; child = child->next)
-    {
-      gchar *tag;
-
-      tag = (gchar *) child->name;
-      str = (gchar *) xmlNodeGetContent (child);
-
-      if (!str)
-        continue;
-
-      if (strcmp (tag, "servers") == 0)
-        {
-          irc_network_manager_parse_irc_server (network, child);
-        }
-
-      xmlFree (str);
-    }
-
-  network->user_defined = user_defined;
-  g_object_unref (network);
-  xmlFree (name);
-  xmlFree (id);
-}
-
-static gboolean
-irc_network_manager_file_parse (TpawIrcNetworkManager *self,
-                                const gchar *filename,
-                                gboolean user_defined)
-{
-  xmlParserCtxtPtr ctxt;
-  xmlDocPtr doc;
-  xmlNodePtr networks;
-  xmlNodePtr node;
-
-  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_from_resource (doc, IRC_NETWORKS_DTD_RESOURCENAME)) {
-    g_warning ("Failed to validate file:'%s'", filename);
-    xmlFreeDoc (doc);
-    xmlFreeParserCtxt (ctxt);
-    return FALSE;
-  }
-
-  /* The root node, networks. */
-  networks = xmlDocGetRootElement (doc);
-
-  for (node = networks->children; node; node = node->next)
-    {
-      irc_network_manager_parse_irc_network (self, node, user_defined);
-    }
-
-  xmlFreeDoc (doc);
-  xmlFreeParserCtxt (ctxt);
-
-  return TRUE;
-}
-
-static void
-write_network_to_xml (const gchar *id,
-                      TpawIrcNetwork *network,
-                      xmlNodePtr root)
-{
-  xmlNodePtr network_node, servers_node;
-  GSList *servers, *l;
-  gchar *name, *charset;
-
-  if (!network->user_defined)
-    /* no need to write this network to the XML */
-    return;
-
-  network_node = xmlNewChild (root, NULL, (const xmlChar *) "network", NULL);
-  xmlNewProp (network_node, (const xmlChar *) "id", (const xmlChar *) id);
-
-  if (network->dropped)
-    {
-      xmlNewProp (network_node, (const xmlChar *) "dropped",
-          (const xmlChar *)  "1");
-      return;
-    }
-
-  g_object_get (network,
-      "name", &name,
-      "charset", &charset,
-      NULL);
-  xmlNewProp (network_node, (const xmlChar *) "name", (const xmlChar *) name);
-  xmlNewProp (network_node, (const xmlChar *) "network_charset",
-      (const xmlChar *) charset);
-  g_free (name);
-  g_free (charset);
-
-  servers = tpaw_irc_network_get_servers (network);
-
-  servers_node = xmlNewChild (network_node, NULL, (const xmlChar *) "servers",
-      NULL);
-  for (l = servers; l != NULL; l = g_slist_next (l))
-    {
-      TpawIrcServer *server;
-      xmlNodePtr server_node;
-      gchar *address, *tmp;
-      guint port;
-      gboolean ssl;
-
-      server = l->data;
-
-      server_node = xmlNewChild (servers_node, NULL, (const xmlChar *) "server",
-          NULL);
-
-      g_object_get (server,
-          "address", &address,
-          "port", &port,
-          "ssl", &ssl,
-          NULL);
-
-      xmlNewProp (server_node, (const xmlChar *) "address",
-          (const xmlChar *) address);
-
-      tmp = g_strdup_printf ("%u", port);
-      xmlNewProp (server_node, (const xmlChar *) "port",
-          (const xmlChar *) tmp);
-      g_free (tmp);
-
-      xmlNewProp (server_node, (const xmlChar *) "ssl",
-          ssl ? (const xmlChar *) "TRUE": (const xmlChar *) "FALSE");
-
-      g_free (address);
-    }
-
-  /* free the list */
-  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
-  g_slist_free (servers);
-}
-
-static gboolean
-irc_network_manager_file_save (TpawIrcNetworkManager *self)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-  xmlDocPtr doc;
-  xmlNodePtr root;
-
-  if (priv->user_file == NULL)
-    {
-      DEBUG ("can't save: no user file defined");
-      return FALSE;
-    }
-
-  DEBUG ("Saving IRC networks");
-
-  doc = xmlNewDoc ((const xmlChar *)  "1.0");
-  root = xmlNewNode (NULL, (const xmlChar *) "networks");
-  xmlDocSetRootElement (doc, root);
-
-  g_hash_table_foreach (priv->networks, (GHFunc) write_network_to_xml, root);
-
-  /* Make sure the XML is indented properly */
-  xmlIndentTreeOutput = 1;
-
-  xmlSaveFormatFileEnc (priv->user_file, doc, "utf-8", 1);
-  xmlFreeDoc (doc);
-
-  xmlMemoryDump ();
-
-  priv->have_to_save = FALSE;
-
-  return TRUE;
-}
-
-static gboolean
-find_network_by_address (const gchar *id,
-                         TpawIrcNetwork *network,
-                         const gchar *address)
-{
-  GSList *servers, *l;
-  gboolean found = FALSE;
-
-  if (network->dropped)
-    return FALSE;
-
-  servers = tpaw_irc_network_get_servers (network);
-
-  for (l = servers; l != NULL && !found; l = g_slist_next (l))
-    {
-      TpawIrcServer *server = l->data;
-      gchar *_address;
-
-      g_object_get (server, "address", &_address, NULL);
-      found = (_address != NULL && strcmp (address, _address) == 0);
-
-      g_free (_address);
-    }
-
-  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
-  g_slist_free (servers);
-
-  return found;
-}
-
-/**
- * tpaw_irc_network_manager_find_network_by_address:
- * @manager: an #TpawIrcNetworkManager
- * @address: the server address to look for
- *
- * Find the #TpawIrcNetwork which owns an #TpawIrcServer
- * that has the given address.
- *
- * Returns: the found #TpawIrcNetwork, or %NULL if not found.
- */
-TpawIrcNetwork *
-tpaw_irc_network_manager_find_network_by_address (
-    TpawIrcNetworkManager *self,
-    const gchar *address)
-{
-  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
-  TpawIrcNetwork *network;
-
-  g_return_val_if_fail (address != NULL, NULL);
-
-  network = g_hash_table_find (priv->networks,
-      (GHRFunc) find_network_by_address, (gchar *) address);
-
-  return network;
-}
-
-TpawIrcNetworkManager *
-tpaw_irc_network_manager_dup_default (void)
-{
-  static TpawIrcNetworkManager *default_mgr = NULL;
-  gchar *dir, *user_file_with_path, *global_file_with_path;
-
-  if (default_mgr != NULL)
-    return g_object_ref (default_mgr);
-
-  dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
-  g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
-  user_file_with_path = g_build_filename (dir, IRC_NETWORKS_FILENAME, NULL);
-  g_free (dir);
-
-  global_file_with_path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"),
-      "tp-account-widgets", IRC_NETWORKS_FILENAME, NULL);
-  if (!g_file_test (global_file_with_path, G_FILE_TEST_EXISTS))
-    {
-      g_free (global_file_with_path);
-      global_file_with_path = g_build_filename (DATADIR, "empathy",
-          IRC_NETWORKS_FILENAME, NULL);
-    }
-
-  default_mgr = tpaw_irc_network_manager_new (
-      global_file_with_path, user_file_with_path);
-
-  g_object_add_weak_pointer (G_OBJECT (default_mgr), (gpointer *) &default_mgr);
-
-  g_free (global_file_with_path);
-  g_free (user_file_with_path);
-  return default_mgr;
-}
diff --git a/tp-account-widgets/empathy-irc-network-manager.h b/tp-account-widgets/empathy-irc-network-manager.h
deleted file mode 100644 (file)
index a708a3e..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_IRC_NETWORK_MANAGER_H__
-#define __TPAW_IRC_NETWORK_MANAGER_H__
-
-#include <glib-object.h>
-
-#include "empathy-irc-network.h"
-
-G_BEGIN_DECLS
-
-typedef struct _TpawIrcNetworkManager      TpawIrcNetworkManager;
-typedef struct _TpawIrcNetworkManagerClass TpawIrcNetworkManagerClass;
-
-struct _TpawIrcNetworkManager
-{
-  GObject parent;
-  gpointer priv;
-};
-
-struct _TpawIrcNetworkManagerClass
-{
-  GObjectClass parent_class;
-};
-
-GType tpaw_irc_network_manager_get_type (void);
-
-/* TYPE MACROS */
-#define TPAW_TYPE_IRC_NETWORK_MANAGER \
-  (tpaw_irc_network_manager_get_type ())
-#define TPAW_IRC_NETWORK_MANAGER(o) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_IRC_NETWORK_MANAGER, \
-                               TpawIrcNetworkManager))
-#define TPAW_IRC_NETWORK_MANAGER_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_IRC_NETWORK_MANAGER, \
-                            TpawIrcNetworkManagerClass))
-#define TPAW_IS_IRC_NETWORK_MANAGER(o) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_IRC_NETWORK_MANAGER))
-#define TPAW_IS_IRC_NETWORK_MANAGER_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_IRC_NETWORK_MANAGER))
-#define TPAW_IRC_NETWORK_MANAGER_GET_CLASS(o) \
-  (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK_MANAGER, \
-                              TpawIrcNetworkManagerClass))
-
-TpawIrcNetworkManager * tpaw_irc_network_manager_new (
-    const gchar *global_file, const gchar *user_file);
-
-TpawIrcNetworkManager * tpaw_irc_network_manager_dup_default (void);
-
-void tpaw_irc_network_manager_add (TpawIrcNetworkManager *manager,
-    TpawIrcNetwork *network);
-
-void tpaw_irc_network_manager_remove (TpawIrcNetworkManager *manager,
-    TpawIrcNetwork *network);
-
-GSList * tpaw_irc_network_manager_get_networks (
-    TpawIrcNetworkManager *manager);
-
-GSList * tpaw_irc_network_manager_get_dropped_networks (
-    TpawIrcNetworkManager *manager);
-
-TpawIrcNetwork * tpaw_irc_network_manager_find_network_by_address (
-    TpawIrcNetworkManager *manager, const gchar *address);
-
-G_END_DECLS
-
-#endif /* __TPAW_IRC_NETWORK_MANAGER_H__ */
diff --git a/tp-account-widgets/empathy-irc-network.c b/tp-account-widgets/empathy-irc-network.c
deleted file mode 100644 (file)
index cda171b..0000000
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright (C) 2007 Guillaume Desmottes
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * Authors: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-irc-network.h"
-
-#include "empathy-utils.h"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetwork)
-typedef struct
-{
-  gchar *name;
-  gchar *charset;
-  GSList *servers;
-} TpawIrcNetworkPriv;
-
-/* properties */
-enum
-{
-  PROP_NAME = 1,
-  PROP_CHARSET,
-  LAST_PROPERTY
-};
-
-/* signals */
-enum
-{
-  MODIFIED,
-  LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = {0};
-
-G_DEFINE_TYPE (TpawIrcNetwork, tpaw_irc_network, G_TYPE_OBJECT);
-
-static void
-server_modified_cb (TpawIrcServer *server,
-                    TpawIrcNetwork *self)
-{
-  g_signal_emit (self, signals[MODIFIED], 0);
-}
-
-static void
-tpaw_irc_network_get_property (GObject *object,
-                                  guint property_id,
-                                  GValue *value,
-                                  GParamSpec *pspec)
-{
-  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
-  TpawIrcNetworkPriv *priv = GET_PRIV (self);
-
-  switch (property_id)
-    {
-      case PROP_NAME:
-        g_value_set_string (value, priv->name);
-        break;
-      case PROP_CHARSET:
-        g_value_set_string (value, priv->charset);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_network_set_property (GObject *object,
-                                  guint property_id,
-                                  const GValue *value,
-                                  GParamSpec *pspec)
-{
-  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
-  TpawIrcNetworkPriv *priv = GET_PRIV (self);
-
-  switch (property_id)
-    {
-      case PROP_NAME:
-        if (tp_strdiff (priv->name, g_value_get_string (value)))
-          {
-            g_free (priv->name);
-            priv->name = g_value_dup_string (value);
-            g_signal_emit (object, signals[MODIFIED], 0);
-          }
-        break;
-      case PROP_CHARSET:
-        if (tp_strdiff (priv->charset, g_value_get_string (value)))
-          {
-            g_free (priv->charset);
-            priv->charset = g_value_dup_string (value);
-            g_signal_emit (object, signals[MODIFIED], 0);
-          }
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_network_dispose (GObject *object)
-{
-  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
-  TpawIrcNetworkPriv *priv = GET_PRIV (self);
-  GSList *l;
-
-  for (l = priv->servers; l != NULL; l = g_slist_next (l))
-    {
-      g_signal_handlers_disconnect_by_func (l->data,
-          G_CALLBACK (server_modified_cb), self);
-      g_object_unref (l->data);
-    }
-
-  G_OBJECT_CLASS (tpaw_irc_network_parent_class)->dispose (object);
-}
-
-static void
-tpaw_irc_network_finalize (GObject *object)
-{
-  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
-  TpawIrcNetworkPriv *priv = GET_PRIV (self);
-
-  g_slist_free (priv->servers);
-  g_free (priv->name);
-  g_free (priv->charset);
-
-  G_OBJECT_CLASS (tpaw_irc_network_parent_class)->finalize (object);
-}
-
-static void
-tpaw_irc_network_init (TpawIrcNetwork *self)
-{
-  TpawIrcNetworkPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      TPAW_TYPE_IRC_NETWORK, TpawIrcNetworkPriv);
-
-  self->priv = priv;
-
-  priv->servers = NULL;
-
-  self->user_defined = TRUE;
-  self->dropped = FALSE;
-}
-
-static void
-tpaw_irc_network_class_init (TpawIrcNetworkClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GParamSpec *param_spec;
-
-  object_class->get_property = tpaw_irc_network_get_property;
-  object_class->set_property = tpaw_irc_network_set_property;
-
-  g_type_class_add_private (object_class, sizeof (TpawIrcNetworkPriv));
-
-  object_class->dispose = tpaw_irc_network_dispose;
-  object_class->finalize = tpaw_irc_network_finalize;
-
-  param_spec = g_param_spec_string (
-      "name",
-      "Network name",
-      "The displayed name of this network",
-      NULL,
-      G_PARAM_READWRITE |
-      G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_NICK |
-      G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (object_class, PROP_NAME, param_spec);
-
-  param_spec = g_param_spec_string (
-      "charset",
-      "Charset",
-      "The charset to use on this network",
-      "UTF-8",
-      G_PARAM_CONSTRUCT |
-      G_PARAM_READWRITE |
-      G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_NICK |
-      G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (object_class, PROP_CHARSET, param_spec);
-
-  /**
-   * TpawIrcNetwork::modified:
-   * @network: the object that received the signal
-   *
-   * Emitted when either a property or a server of the network is modified or
-   * when a network is activated.
-   *
-   */
-  signals[MODIFIED] = g_signal_new (
-      "modified",
-      G_OBJECT_CLASS_TYPE (object_class),
-      G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-      0,
-      NULL, NULL,
-      g_cclosure_marshal_generic,
-      G_TYPE_NONE, 0);
-}
-
-/**
- * tpaw_irc_network_activate:
- * @self: the name of the network
- *
- * Activates a #TpawIrcNetwork.
- *
- */
-void
-tpaw_irc_network_activate (TpawIrcNetwork *self)
-{
-  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
-  g_return_if_fail (self->dropped);
-
-  self->dropped = FALSE;
-
-  g_signal_emit (self, signals[MODIFIED], 0);
-}
-
-/**
- * tpaw_irc_network_new:
- * @name: the name of the network
- *
- * Creates a new #TpawIrcNetwork.
- *
- * Returns: a new #TpawIrcNetwork
- */
-TpawIrcNetwork *
-tpaw_irc_network_new (const gchar *name)
-{
-  return g_object_new (TPAW_TYPE_IRC_NETWORK,
-      "name", name,
-      NULL);
-}
-
-/**
- * tpaw_irc_network_get_servers:
- * @network: an #TpawIrcNetwork
- *
- * Get the list of #TpawIrcServer that belongs to this network.
- * These servers are sorted according their priority.
- * So the first one will be the first used when trying to connect to
- * the network.
- *
- * Returns: a new #GSList of refed #TpawIrcServer.
- */
-GSList *
-tpaw_irc_network_get_servers (TpawIrcNetwork *self)
-{
-  TpawIrcNetworkPriv *priv;
-  GSList *servers = NULL, *l;
-
-  g_return_val_if_fail (TPAW_IS_IRC_NETWORK (self), NULL);
-  priv = GET_PRIV (self);
-
-  for (l = priv->servers; l != NULL; l = g_slist_next (l))
-    {
-      servers = g_slist_prepend (servers, g_object_ref (l->data));
-    }
-
-  return g_slist_reverse (servers);
-}
-
-/**
- * tpaw_irc_network_append_server:
- * @network: an #TpawIrcNetwork
- * @server: the #TpawIrcServer to add
- *
- * Add an #TpawIrcServer to the given #TpawIrcNetwork. The server
- * is added at the last position in network's servers list.
- *
- */
-void
-tpaw_irc_network_append_server (TpawIrcNetwork *self,
-                                   TpawIrcServer *server)
-{
-  TpawIrcNetworkPriv *priv;
-
-  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
-  g_return_if_fail (server != NULL && TPAW_IS_IRC_SERVER (server));
-
-  priv = GET_PRIV (self);
-
-  g_return_if_fail (g_slist_find (priv->servers, server) == NULL);
-
-  priv->servers = g_slist_append (priv->servers, g_object_ref (server));
-
-  g_signal_connect (server, "modified", G_CALLBACK (server_modified_cb), self);
-
-  g_signal_emit (self, signals[MODIFIED], 0);
-}
-
-/**
- * tpaw_irc_network_remove_server:
- * @network: an #TpawIrcNetwork
- * @server: the #TpawIrcServer to remove
- *
- * Remove an #TpawIrcServer from the servers list of the
- * given #TpawIrcNetwork.
- *
- */
-void
-tpaw_irc_network_remove_server (TpawIrcNetwork *self,
-                                   TpawIrcServer *server)
-{
-  TpawIrcNetworkPriv *priv;
-  GSList *l;
-
-  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
-  g_return_if_fail (server != NULL && TPAW_IS_IRC_SERVER (server));
-
-  priv = GET_PRIV (self);
-
-  l = g_slist_find (priv->servers, server);
-  if (l == NULL)
-    return;
-
-  g_object_unref (l->data);
-  priv->servers = g_slist_delete_link (priv->servers, l);
-  g_signal_handlers_disconnect_by_func (server, G_CALLBACK (server_modified_cb),
-      self);
-
-  g_signal_emit (self, signals[MODIFIED], 0);
-}
-
-/**
- * tpaw_irc_network_set_server_position:
- * @network: an #TpawIrcNetwork
- * @server: the #TpawIrcServer to move
- * @pos: the position to move the server. If this is negative, or is larger than
- * the number of servers in the list, the server is moved to the end of the
- * list.
- *
- * Move an #TpawIrcServer in the servers list of the given
- * #TpawIrcNetwork.
- *
- */
-void
-tpaw_irc_network_set_server_position (TpawIrcNetwork *self,
-                                         TpawIrcServer *server,
-                                         gint pos)
-{
-  TpawIrcNetworkPriv *priv;
-  GSList *l;
-
-  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
-  g_return_if_fail (server != NULL && TPAW_IS_IRC_SERVER (server));
-
-  priv = GET_PRIV (self);
-
-  l = g_slist_find (priv->servers, server);
-  if (l == NULL)
-    return;
-
-  priv->servers = g_slist_delete_link (priv->servers, l);
-  priv->servers = g_slist_insert (priv->servers, server, pos);
-
-  g_signal_emit (self, signals[MODIFIED], 0);
-}
-
-const gchar *
-tpaw_irc_network_get_name (TpawIrcNetwork *self)
-{
-  TpawIrcNetworkPriv *priv = GET_PRIV (self);
-
-  return priv->name;
-}
-
-const gchar *
-tpaw_irc_network_get_charset (TpawIrcNetwork *self)
-{
-  TpawIrcNetworkPriv *priv = GET_PRIV (self);
-
-  return priv->charset;
-}
diff --git a/tp-account-widgets/empathy-irc-network.h b/tp-account-widgets/empathy-irc-network.h
deleted file mode 100644 (file)
index e5a6aa3..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_IRC_NETWORK_H__
-#define __TPAW_IRC_NETWORK_H__
-
-#include <glib-object.h>
-
-#include "empathy-irc-server.h"
-
-G_BEGIN_DECLS
-
-typedef struct _TpawIrcNetwork TpawIrcNetwork;
-typedef struct _TpawIrcNetworkClass TpawIrcNetworkClass;
-
-struct _TpawIrcNetwork
-{
-  GObject parent;
-  gpointer priv;
-
-  gboolean user_defined;
-  gboolean dropped;
-};
-
-struct _TpawIrcNetworkClass
-{
-    GObjectClass parent_class;
-};
-
-GType tpaw_irc_network_get_type (void);
-
-/* TYPE MACROS */
-#define TPAW_TYPE_IRC_NETWORK (tpaw_irc_network_get_type ())
-#define TPAW_IRC_NETWORK(o) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_IRC_NETWORK, \
-                               TpawIrcNetwork))
-#define TPAW_IRC_NETWORK_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_IRC_NETWORK,\
-                            TpawIrcNetworkClass))
-#define TPAW_IS_IRC_NETWORK(o) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_IRC_NETWORK))
-#define TPAW_IS_IRC_NETWORK_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_IRC_NETWORK))
-#define TPAW_IRC_NETWORK_GET_CLASS(o) \
-  (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK, \
-                              TpawIrcNetworkClass))
-
-void tpaw_irc_network_activate (TpawIrcNetwork *self);
-
-TpawIrcNetwork * tpaw_irc_network_new (const gchar *name);
-
-GSList * tpaw_irc_network_get_servers (TpawIrcNetwork *network);
-
-void tpaw_irc_network_append_server (TpawIrcNetwork *network,
-    TpawIrcServer *server);
-
-void tpaw_irc_network_remove_server (TpawIrcNetwork *network,
-    TpawIrcServer *server);
-
-void tpaw_irc_network_set_server_position (TpawIrcNetwork *network,
-    TpawIrcServer *server, gint pos);
-
-const gchar * tpaw_irc_network_get_name (TpawIrcNetwork *network);
-
-const gchar * tpaw_irc_network_get_charset (TpawIrcNetwork *network);
-
-G_END_DECLS
-
-#endif /* __TPAW_IRC_NETWORK_H__ */
diff --git a/tp-account-widgets/empathy-irc-networks.dtd b/tp-account-widgets/empathy-irc-networks.dtd
deleted file mode 100644 (file)
index 692e613..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
-  DTD for Empathys irc networks.
-  by Xavier Claessens <xclaesse@gmail.com>
--->
-
-
-<!ELEMENT networks (network*)>
-<!ELEMENT network (servers*)>
-<!ATTLIST network id ID #REQUIRED>
-<!ATTLIST network name CDATA #IMPLIED>
-<!ATTLIST network network_charset CDATA #IMPLIED>
-<!ATTLIST network dropped CDATA #IMPLIED>
-
-<!ELEMENT servers (server*)>
-<!ELEMENT server EMPTY>
-<!ATTLIST server address CDATA #REQUIRED>
-<!ATTLIST server port CDATA #REQUIRED>
-<!ATTLIST server ssl CDATA #REQUIRED>
diff --git a/tp-account-widgets/empathy-irc-server.c b/tp-account-widgets/empathy-irc-server.c
deleted file mode 100644 (file)
index 4b08570..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#include "config.h"
-#include "empathy-irc-server.h"
-
-#include "empathy-utils.h"
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcServer)
-typedef struct
-{
-  gchar *address;
-  guint port;
-  gboolean ssl;
-} TpawIrcServerPriv;
-
-/* properties */
-enum
-{
-  PROP_ADDRESS = 1,
-  PROP_PORT,
-  PROP_SSL,
-  LAST_PROPERTY
-};
-
-/* signals */
-enum
-{
-  MODIFIED,
-  LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = {0};
-
-G_DEFINE_TYPE (TpawIrcServer, tpaw_irc_server, G_TYPE_OBJECT);
-
-static void
-tpaw_irc_server_get_property (GObject *object,
-                                 guint property_id,
-                                 GValue *value,
-                                 GParamSpec *pspec)
-{
-  TpawIrcServer *self = TPAW_IRC_SERVER (object);
-  TpawIrcServerPriv *priv = GET_PRIV (self);
-
-  switch (property_id)
-    {
-      case PROP_ADDRESS:
-        g_value_set_string (value, priv->address);
-        break;
-      case PROP_PORT:
-        g_value_set_uint (value, priv->port);
-        break;
-      case PROP_SSL:
-        g_value_set_boolean (value, priv->ssl);
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_server_set_property (GObject *object,
-                                 guint property_id,
-                                 const GValue *value,
-                                 GParamSpec *pspec)
-{
-  TpawIrcServer *self = TPAW_IRC_SERVER (object);
-  TpawIrcServerPriv *priv = GET_PRIV (self);
-
-  switch (property_id)
-    {
-      case PROP_ADDRESS:
-        if (tp_strdiff (priv->address, g_value_get_string (value)))
-          {
-            g_free (priv->address);
-            priv->address = g_value_dup_string (value);
-            g_signal_emit (object, signals[MODIFIED], 0);
-          }
-        break;
-      case PROP_PORT:
-        if (priv->port != g_value_get_uint (value))
-          {
-            priv->port = g_value_get_uint (value);
-            g_signal_emit (object, signals[MODIFIED], 0);
-          }
-        break;
-      case PROP_SSL:
-        if (priv->ssl != g_value_get_boolean (value))
-          {
-            priv->ssl = g_value_get_boolean (value);
-            g_signal_emit (object, signals[MODIFIED], 0);
-          }
-        break;
-      default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-        break;
-    }
-}
-
-static void
-tpaw_irc_server_finalize (GObject *object)
-{
-  TpawIrcServer *self = TPAW_IRC_SERVER (object);
-  TpawIrcServerPriv *priv = GET_PRIV (self);
-
-  g_free (priv->address);
-
-  G_OBJECT_CLASS (tpaw_irc_server_parent_class)->finalize (object);
-}
-
-static void
-tpaw_irc_server_init (TpawIrcServer *self)
-{
-  TpawIrcServerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
-      TPAW_TYPE_IRC_SERVER, TpawIrcServerPriv);
-
-  self->priv = priv;
-}
-
-static void
-tpaw_irc_server_class_init (TpawIrcServerClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GParamSpec *param_spec;
-
-  object_class->get_property = tpaw_irc_server_get_property;
-  object_class->set_property = tpaw_irc_server_set_property;
-
-  g_type_class_add_private (object_class, sizeof (TpawIrcServerPriv));
-
-  object_class->finalize = tpaw_irc_server_finalize;
-
-  param_spec = g_param_spec_string (
-      "address",
-      "Server address",
-      "The address of this server",
-      NULL,
-      G_PARAM_READWRITE |
-      G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_NICK |
-      G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (object_class, PROP_ADDRESS, param_spec);
-
-  param_spec = g_param_spec_uint (
-      "port",
-      "Server port",
-      "The port to use to connect on this server",
-      1, G_MAXUINT16, 6667,
-      G_PARAM_READWRITE |
-      G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_NICK |
-      G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (object_class, PROP_PORT, param_spec);
-
-  param_spec = g_param_spec_boolean (
-      "ssl",
-      "SSL",
-      "If this server needs SSL connection",
-      FALSE,
-      G_PARAM_READWRITE |
-      G_PARAM_STATIC_NAME |
-      G_PARAM_STATIC_NICK |
-      G_PARAM_STATIC_BLURB);
-  g_object_class_install_property (object_class, PROP_SSL, param_spec);
-
-  /**
-   * TpawIrcServer::modified:
-   * @server: the object that received the signal
-   *
-   * Emitted when a property of the server is modified.
-   *
-   */
-  signals[MODIFIED] = g_signal_new (
-      "modified",
-      G_OBJECT_CLASS_TYPE (object_class),
-      G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
-      0,
-      NULL, NULL,
-      g_cclosure_marshal_generic,
-      G_TYPE_NONE, 0);
-}
-
-/**
- * tpaw_irc_server_new:
- * @address: the address
- * @port: the port
- * @ssl: %TRUE if the server needs a SSL connection
- *
- * Creates a new #TpawIrcServer
- *
- * Returns: a new #TpawIrcServer
- */
-TpawIrcServer *
-tpaw_irc_server_new (const gchar *address,
-                        guint port,
-                        gboolean ssl)
-{
-  return g_object_new (TPAW_TYPE_IRC_SERVER,
-      "address", address,
-      "port", port,
-      "ssl", ssl,
-      NULL);
-}
diff --git a/tp-account-widgets/empathy-irc-server.h b/tp-account-widgets/empathy-irc-server.h
deleted file mode 100644 (file)
index ef9e0c8..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007-2008 Guillaume Desmottes
- *
- * 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: Guillaume Desmottes <gdesmott@gnome.org>
- */
-
-#ifndef __TPAW_IRC_SERVER_H__
-#define __TPAW_IRC_SERVER_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-typedef struct _TpawIrcServer TpawIrcServer;
-typedef struct _TpawIrcServerClass TpawIrcServerClass;
-
-struct _TpawIrcServer
-{
-  GObject parent;
-  gpointer priv;
-};
-
-struct _TpawIrcServerClass
-{
-    GObjectClass parent_class;
-};
-
-GType tpaw_irc_server_get_type (void);
-
-/* TYPE MACROS */
-#define TPAW_TYPE_IRC_SERVER (tpaw_irc_server_get_type ())
-#define TPAW_IRC_SERVER(o)  \
-  (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_IRC_SERVER, TpawIrcServer))
-#define TPAW_IRC_SERVER_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_IRC_SERVER, \
-                            TpawIrcServerClass))
-#define TPAW_IS_IRC_SERVER(o) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_IRC_SERVER))
-#define TPAW_IS_IRC_SERVER_CLASS(k) \
-  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_IRC_SERVER))
-#define TPAW_IRC_SERVER_GET_CLASS(o) \
-  (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_SERVER,\
-                              TpawIrcServerClass))
-
-TpawIrcServer * tpaw_irc_server_new (const gchar *address, guint port,
-    gboolean ssl);
-
-G_END_DECLS
-
-#endif /* __TPAW_IRC_SERVER_H__ */
diff --git a/tp-account-widgets/tpaw-account-widget-aim.ui b/tp-account-widgets/tpaw-account-widget-aim.ui
new file mode 100644 (file)
index 0000000..8ceacbf
--- /dev/null
@@ -0,0 +1,299 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="value">5222</property>
+    <property name="upper">65555</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_aim_settings">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Pass_word</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_password</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_screenname">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Screen _Name</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_screenname</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_screenname">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_username_example">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; MyScreenName</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_advanced_settings">
+            <property name="visible">True</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkSpinButton" id="spinbutton_port">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">adjustment1</property>
+                <property name="climb_rate">1</property>
+                <property name="numeric">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_port">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Port</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">spinbutton_port</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_server">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_server">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Server</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_server</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_aim_simple">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label_screenname_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your AIM screen name?</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_screenname_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_example">
+                <property name="visible">True</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; MyScreenName</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your AIM password?</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-generic.ui b/tp-account-widgets/tpaw-account-widget-generic.ui
new file mode 100644 (file)
index 0000000..c37da5e
--- /dev/null
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkVBox" id="vbox_generic_settings">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">12</property>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander_advanced_settings">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="height_request">150</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkViewport" id="viewport1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">6</property>
+                <property name="resize_mode">queue</property>
+                <child>
+                  <object class="GtkGrid" id="grid_advanced_settings">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">12</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-groupwise.ui b/tp-account-widgets/tpaw-account-widget-groupwise.ui
new file mode 100644 (file)
index 0000000..cfca2e3
--- /dev/null
@@ -0,0 +1,292 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_groupwise_settings">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_groupwise_settings">
+        <property name="visible">True</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Pass_word</property>
+            <property name="use_underline">True</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_id">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Login I_D</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_id</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_id">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_username_example">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_advanced_groupwise_settings">
+            <property name="visible">True</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label_port">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Port</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">spinbutton_port</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_server">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Server</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_server</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_server">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="spinbutton_port">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="adjustment">adjustment1</property>
+                <property name="climb_rate">1</property>
+                <property name="numeric">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_groupwise_simple">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label_id_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your GroupWise User ID?</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_id_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_example">
+                <property name="visible">True</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your GroupWise password?</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-icq.ui b/tp-account-widgets/tpaw-account-widget-icq.ui
new file mode 100644 (file)
index 0000000..865a33c
--- /dev/null
@@ -0,0 +1,320 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="value">5222</property>
+    <property name="upper">65555</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_icq_settings">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Pass_word</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_password</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_uin">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">ICQ _UIN</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_uin</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_uin">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_username_example">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; 123456789</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_advanced_settings">
+            <property name="visible">True</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label_charset">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">Ch_aracter set</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_charset</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="spinbutton_port">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">adjustment1</property>
+                <property name="climb_rate">1</property>
+                <property name="numeric">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_server">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_port">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Port</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">spinbutton_port</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_server">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Server</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_server</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_charset">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_icq_simple">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label_uin_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your ICQ UIN?</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_uin_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_example">
+                <property name="visible">True</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; 123456789</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your ICQ password?</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-irc.c b/tp-account-widgets/tpaw-account-widget-irc.c
new file mode 100644 (file)
index 0000000..f98394b
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-account-widget-irc.h"
+
+#include "tpaw-account-widget-private.h"
+#include "empathy-ui-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
+#include "empathy-debug.h"
+
+typedef struct {
+  TpawAccountWidget *self;
+
+  GtkWidget *vbox_settings;
+
+  GtkWidget *network_chooser;
+} TpawAccountWidgetIrc;
+
+static void
+account_widget_irc_destroy_cb (GtkWidget *widget,
+                               TpawAccountWidgetIrc *settings)
+{
+  g_slice_free (TpawAccountWidgetIrc, settings);
+}
+
+static void
+account_widget_irc_setup (TpawAccountWidgetIrc *settings)
+{
+  gchar *nick = NULL;
+  gchar *fullname = NULL;
+  EmpathyAccountSettings *ac_settings;
+
+  g_object_get (settings->self, "settings", &ac_settings, NULL);
+
+  nick = empathy_account_settings_dup_string (ac_settings, "account");
+  fullname = empathy_account_settings_dup_string (ac_settings,
+      "fullname");
+
+  if (nick == NULL)
+    {
+      nick = g_strdup (g_get_user_name ());
+
+      empathy_account_settings_set (ac_settings,
+        "account", g_variant_new_string (nick));
+    }
+
+  if (fullname == NULL)
+    {
+      fullname = g_strdup (g_get_real_name ());
+
+      if (fullname == NULL)
+          fullname = g_strdup (nick);
+
+      empathy_account_settings_set (ac_settings,
+          "fullname", g_variant_new_string (fullname));
+    }
+
+  g_free (nick);
+  g_free (fullname);
+}
+
+static void
+network_changed_cb (TpawIrcNetworkChooser *chooser,
+    TpawAccountWidgetIrc *settings)
+{
+  tpaw_account_widget_changed (settings->self);
+}
+
+/**
+ * set_password_prompt_if_needed:
+ *
+ * If @password is not empty, this function sets the 'password-prompt' param
+ * on @ac_settings. This will ensure that Idle actually asks for the password
+ * when connecting.
+ *
+ * Return: %TRUE if the password-prompt param has been changed
+ */
+static gboolean
+set_password_prompt_if_needed (EmpathyAccountSettings *ac_settings,
+    const gchar *password)
+{
+  gboolean prompt;
+
+  prompt = !tp_str_empty (password);
+
+  if (prompt == empathy_account_settings_get_boolean (ac_settings,
+        "password-prompt"))
+    return FALSE;
+
+  empathy_account_settings_set (ac_settings, "password-prompt",
+      g_variant_new_boolean (prompt));
+
+  return TRUE;
+}
+
+static void
+entry_password_changed_cb (GtkEntry *entry,
+    TpawAccountWidgetIrc *settings)
+{
+  const gchar *password;
+  EmpathyAccountSettings *ac_settings;
+
+  g_object_get (settings->self, "settings", &ac_settings, NULL);
+
+  password = gtk_entry_get_text (entry);
+
+  set_password_prompt_if_needed (ac_settings, password);
+
+  g_object_unref (ac_settings);
+}
+
+TpawIrcNetworkChooser *
+tpaw_account_widget_irc_build (TpawAccountWidget *self,
+    const char *filename,
+    GtkWidget **table_common_settings,
+    GtkWidget **box)
+{
+  TpawAccountWidgetIrc *settings;
+  EmpathyAccountSettings *ac_settings;
+  GtkWidget *entry_password;
+  gchar *password;
+
+  settings = g_slice_new0 (TpawAccountWidgetIrc);
+  settings->self = self;
+
+  self->ui_details->gui = empathy_builder_get_resource (filename,
+      "table_irc_settings", table_common_settings,
+      "vbox_irc", box,
+      "table_irc_settings", &settings->vbox_settings,
+      "entry_password", &entry_password,
+      NULL);
+
+  /* Add network chooser button */
+  g_object_get (settings->self, "settings", &ac_settings, NULL);
+
+  settings->network_chooser = tpaw_irc_network_chooser_new (ac_settings);
+
+  g_signal_connect (settings->network_chooser, "changed",
+      G_CALLBACK (network_changed_cb), settings);
+
+  gtk_grid_attach (GTK_GRID (*table_common_settings),
+      settings->network_chooser, 1, 0, 1, 1);
+
+  gtk_widget_show (settings->network_chooser);
+
+  account_widget_irc_setup (settings);
+
+  tpaw_account_widget_handle_params (self,
+      "entry_nick", "account",
+      "entry_fullname", "fullname",
+      "entry_password", "password",
+      "entry_quit_message", "quit-message",
+      "entry_username", "username",
+      NULL);
+
+  empathy_builder_connect (self->ui_details->gui, settings,
+      "table_irc_settings", "destroy", account_widget_irc_destroy_cb,
+      NULL);
+
+  self->ui_details->default_focus = g_strdup ("entry_nick");
+
+  g_object_unref (ac_settings);
+
+  /* Automatically set password-prompt when needed */
+  password = empathy_account_settings_dup_string (ac_settings, "password");
+
+  if (set_password_prompt_if_needed (ac_settings, password))
+    {
+      /* Apply right now to save password-prompt */
+      empathy_account_settings_apply_async (ac_settings, NULL, NULL);
+    }
+
+  g_free (password);
+
+  g_signal_connect (entry_password, "changed",
+      G_CALLBACK (entry_password_changed_cb), settings);
+
+  return TPAW_IRC_NETWORK_CHOOSER (settings->network_chooser);
+}
+
+TpawIrcNetworkChooser *
+tpaw_account_widget_irc_build_simple (TpawAccountWidget *self,
+    const char *filename,
+    GtkWidget **box)
+{
+  TpawAccountWidgetIrc *settings;
+  EmpathyAccountSettings *ac_settings;
+  GtkAlignment *alignment;
+
+  settings = g_slice_new0 (TpawAccountWidgetIrc);
+  settings->self = self;
+
+  self->ui_details->gui = empathy_builder_get_resource (filename,
+      "vbox_irc_simple", box,
+      "alignment_network_simple", &alignment,
+      NULL);
+
+  /* Add network chooser button */
+  g_object_get (settings->self, "settings", &ac_settings, NULL);
+
+  settings->network_chooser = tpaw_irc_network_chooser_new (ac_settings);
+
+  g_signal_connect (settings->network_chooser, "changed",
+      G_CALLBACK (network_changed_cb), settings);
+
+  gtk_container_add (GTK_CONTAINER (alignment), settings->network_chooser);
+
+  gtk_widget_show (settings->network_chooser);
+
+  tpaw_account_widget_handle_params (self,
+      "entry_nick_simple", "account",
+      NULL);
+
+  empathy_builder_connect (self->ui_details->gui, settings,
+      "vbox_irc_simple", "destroy", account_widget_irc_destroy_cb,
+      NULL);
+
+  self->ui_details->default_focus = g_strdup ("entry_nick_simple");
+
+  g_object_unref (ac_settings);
+
+  return TPAW_IRC_NETWORK_CHOOSER (settings->network_chooser);
+}
diff --git a/tp-account-widgets/tpaw-account-widget-irc.h b/tp-account-widgets/tpaw-account-widget-irc.h
new file mode 100644 (file)
index 0000000..f913cbc
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_ACCOUNT_WIDGET_IRC_H__
+#define __TPAW_ACCOUNT_WIDGET_IRC_H__
+
+#include "tpaw-account-widget.h"
+#include "tpaw-irc-network-chooser.h"
+
+G_BEGIN_DECLS
+
+TpawIrcNetworkChooser * tpaw_account_widget_irc_build (
+    TpawAccountWidget *self,
+    const char *filename,
+    GtkWidget **table_common_settings,
+    GtkWidget **box);
+
+TpawIrcNetworkChooser * tpaw_account_widget_irc_build_simple (
+    TpawAccountWidget *self,
+    const char *filename,
+    GtkWidget **box);
+
+G_END_DECLS
+
+#endif /* __TPAW_ACCOUNT_WIDGET_IRC_H__ */
diff --git a/tp-account-widgets/tpaw-account-widget-irc.ui b/tp-account-widgets/tpaw-account-widget-irc.ui
new file mode 100644 (file)
index 0000000..fc72974
--- /dev/null
@@ -0,0 +1,603 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <object class="GtkDialog" id="irc_network_dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Network</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="icon_name">gtk-edit</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox10">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area10">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button_close">
+                <property name="label">gtk-close</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_action_appearance">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>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame14">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment28">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkGrid" id="greid14">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="label_network">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Network</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_charset">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Character set</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="entry_network">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="combobox_charset">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label_network1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Network</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame15">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment29">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="top_padding">6</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <object class="GtkGrid" id="grid15">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                        <object class="GtkVBox" id="vbox1">
+                        <property name="visible">True</property>
+                       <property name="spacing">0</property>
+                    <child>
+                      <object class="GtkScrolledWindow" id="scrolledwindow_network_server">
+                        <property name="height_request">120</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">never</property>
+                        <property name="shadow_type">in</property>
+                        <property name="expand">True</property>
+                        <child>
+                          <object class="GtkTreeView" id="treeview_servers">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="enable_search">False</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="treeview-selection1"/>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolbar" id="toolbar_network_server">
+                        <property name="visible">True</property>
+                        <property name="icon_size">1</property>
+                        <style>
+                          <class name="inline-toolbar"/>
+                        </style>
+                        <child>
+                          <object class="GtkToolButton" id="button_add">
+                            <property name="tooltip-text" translatable="yes">Add…</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="icon_name">list-add-symbolic</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkToolButton" id="button_remove">
+                            <property name="tooltip-text" translatable="yes">Remove</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="icon_name">list-remove-symbolic</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkToolButton" id="button_up">
+                            <property name="tooltip-text" translatable="yes" comments="Translators: tooltip on a 'Go Up' button used to sort IRC servers by priority">Up</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="icon_name">go-up-symbolic</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkToolButton" id="button_down">
+                            <property name="tooltip-text" translatable="yes" comments="Translators: tooltip on a 'Go Down' button used to sort IRC servers by priority">Down</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="icon_name">go-down-symbolic</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+               </object>
+              </child>
+             </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label_servers">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Servers</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-7">button_close</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkVBox" id="vbox_irc">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkGrid" id="table_irc_settings">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_nick">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_password_note">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="xalign">0</property>
+            <property name="yalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">Most IRC servers don't need a password, so if you're not sure, don't enter a password.</property>
+            <property name="use_markup">True</property>
+            <property name="wrap">True</property>
+            <attributes>
+              <attribute name="scale" value="0.80000000000000004"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_network2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Network</property>
+            <property name="use_underline">True</property>A
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_nick">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Nickname</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_nick</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Password</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander_advanced">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_irc_settings1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkEntry" id="entry_quit_message">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_quit_message">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">Quit message</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_fullname">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_fullname">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">Real name</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_nick</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_username">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">Username</property>
+                <property name="use_underline">True</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_username">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label_advanced">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_irc_simple">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkLabel" id="label_network_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">Which IRC network?</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment_network_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="top_padding">6</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_nick_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your IRC nickname?</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment_nick_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="top_padding">6</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_nick_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkSizeGroup" id="sg_field_labels">
+    <widgets>
+      <widget name="label_network2"/>
+      <widget name="label_nick"/>
+      <widget name="label_password"/>
+      <widget name="label_username"/>
+      <widget name="label_fullname"/>
+      <widget name="label_quit_message"/>
+    </widgets>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-jabber.ui b/tp-account-widgets/tpaw-account-widget-jabber.ui
new file mode 100644 (file)
index 0000000..8422daa
--- /dev/null
@@ -0,0 +1,792 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">127</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">65555</property>
+    <property name="value">5222</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_fb_simple">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkLabel" id="label_id_fb_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Facebook username?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="vbox2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_id_fb_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_fb_example">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_top">4</property>
+            <property name="xalign">0.10000000149011612</property>
+            <property name="label" translatable="yes">This is your username, not your normal Facebook login.
+If you are facebook.com/&lt;b&gt;badger&lt;/b&gt;, enter &lt;b&gt;badger&lt;/b&gt;.
+Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to choose a Facebook username if you don't have one.</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.80000000000000004"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_fb_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="ypad">6</property>
+        <property name="label" translatable="yes">What is your Facebook password?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="entry_password_fb_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="margin_left">12</property>
+        <property name="visibility">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_fb_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_action_appearance">False</property>
+        <property name="xalign">0</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_gtalk_simple">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkLabel" id="label_id_g_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Google ID?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="vbox1b">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">12</property>
+        <property name="spacing">4</property>
+        <child>
+          <object class="GtkEntry" id="entry_id_g_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_g_example">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0.10000000149011612</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@gmail.com</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.80000000000000004"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_g_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="ypad">6</property>
+        <property name="label" translatable="yes">What is your Google password?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="entry_password_g_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="margin_left">12</property>
+        <property name="visibility">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_g_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_action_appearance">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_jabber_settings">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="valign">start</property>
+            <property name="hexpand">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_id">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="vbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="valign">start</property>
+            <child>
+              <object class="GtkLabel" id="label_username_example">
+                <property name="can_focus">False</property>
+                <property name="valign">start</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">3</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@jabber.org</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.80000000000000004"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_username_g_example">
+                <property name="can_focus">False</property>
+                <property name="valign">start</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">3</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@gmail.com</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.80000000000000004"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_username_f_example">
+                <property name="can_focus">False</property>
+                <property name="valign">start</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">3</property>
+                <property name="label" translatable="yes" comments="This string is not wrapped in the dialog so you may have to add some '\n' to make it look nice.">This is your username, not your normal Facebook login.
+If you are facebook.com/&lt;b&gt;badger&lt;/b&gt;, enter &lt;b&gt;badger&lt;/b&gt;.
+Use &lt;a href="http://www.facebook.com/username/"&gt;this page&lt;/a&gt; to choose a Facebook username if you don't have one.</property>
+                <property name="use_markup">True</property>
+                <property name="wrap">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.80000000000000004"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="hexpand">True</property>
+            <property name="use_action_appearance">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_id">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Login I_D</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_id</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Pass_word</property>
+            <property name="use_underline">True</property>
+            <property name="justify">right</property>
+            <property name="mnemonic_widget">entry_password</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander_advanced">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="height_request">200</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkViewport" id="viewport1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkGrid" id="grid_advanced_settings">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">6</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">12</property>
+                    <child>
+                      <object class="GtkEntry" id="entry_resource">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinbutton_priority">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="adjustment">adjustment1</property>
+                        <property name="climb_rate">1</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_ignore_ssl_errors">
+                        <property name="label" translatable="yes">I_gnore SSL certificate errors</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_priority">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Priori_ty</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">spinbutton_priority</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_resource">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Reso_urce</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">entry_resource</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_encryption">
+                        <property name="label" translatable="yes">Encr_yption required (TLS/SSL)</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Override server settings</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_server">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">_Server</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">entry_server</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">5</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label_port">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">_Port</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">spinbutton_port</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">6</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="checkbutton_ssl">
+                        <property name="label" translatable="yes">Use old SS_L</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">7</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="entry_server">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">●</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">5</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="spinbutton_port">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">●</property>
+                        <property name="adjustment">adjustment2</property>
+                        <property name="climb_rate">1</property>
+                        <property name="numeric">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">6</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_jabber_simple">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkLabel" id="label_id_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Jabber ID?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_id_create">
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your desired Jabber ID?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="vbox1a">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">12</property>
+        <property name="spacing">4</property>
+        <child>
+          <object class="GtkEntry" id="entry_id_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_example">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0.10000000149011612</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@jabber.org</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.80000000000000004"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="ypad">6</property>
+        <property name="label" translatable="yes">What is your Jabber password?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_create">
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="ypad">6</property>
+        <property name="label" translatable="yes">What is your desired Jabber password?</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">4</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="entry_password_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="margin_left">12</property>
+        <property name="visibility">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">5</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_action_appearance">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">6</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-local-xmpp.ui b/tp-account-widgets/tpaw-account-widget-local-xmpp.ui
new file mode 100644 (file)
index 0000000..460c41c
--- /dev/null
@@ -0,0 +1,217 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkVBox" id="vbox_salut_settings">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkEntry" id="entry_nickname">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_last_name">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_first_name">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_nickname">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Nic_kname</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_nickname</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+            <property name="left_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_last_name">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">_Last Name</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_last_name</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">1</property>
+            <property name="left_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_first_name">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">_First Name</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_first_name</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander_advanced_settings">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_advanced_settings">
+            <property name="visible">True</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkEntry" id="entry_published">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_published">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Published Name</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_published</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_jid">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_email">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_jid">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Jabber ID</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_jid</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_email">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">E-_mail address</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_email</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkSizeGroup" id="sg_field_labels">
+    <widgets>
+      <widget name="label_nickname"/>
+      <widget name="label_last_name"/>
+      <widget name="label_first_name"/>
+      <widget name="label_published"/>
+      <widget name="label_jid"/>
+      <widget name="label_email"/>
+    </widgets>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-msn.ui b/tp-account-widgets/tpaw-account-widget-msn.ui
new file mode 100644 (file)
index 0000000..4b0614f
--- /dev/null
@@ -0,0 +1,292 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_msn_settings">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_msn_settings">
+        <property name="visible">True</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Pass_word</property>
+            <property name="use_underline">True</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_id">
+            <property name="visible">True</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Login I_D</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_id</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_id">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_username_example">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@hotmail.com</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_advanced_msn_settings">
+            <property name="visible">True</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label_port">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Port</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">spinbutton_port</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_server">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">_Server</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry_server</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry_server">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="spinbutton_port">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="adjustment">adjustment1</property>
+                <property name="climb_rate">1</property>
+                <property name="numeric">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_msn_simple">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label_id_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Windows Live ID?</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_id_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_example">
+                <property name="visible">True</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@hotmail.com</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Windows Live password?</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-private.h b/tp-account-widgets/tpaw-account-widget-private.h
new file mode 100644 (file)
index 0000000..28fc537
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
+ *
+ * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
+ */
+
+#ifndef __TPAW_ACCOUNT_WIDGET_PRIVATE_H__
+#define __TPAW_ACCOUNT_WIDGET_PRIVATE_H__
+
+#include "tpaw-account-widget.h"
+
+G_BEGIN_DECLS
+
+struct _TpawAccountWidgetUIDetails {
+  GtkBuilder *gui;
+
+  char *default_focus;
+};
+
+
+void tpaw_account_widget_handle_params (TpawAccountWidget *self,
+    const gchar *first_widget,
+    ...);
+
+void tpaw_account_widget_setup_widget (TpawAccountWidget *self,
+    GtkWidget *widget,
+    const gchar *param_name);
+
+G_END_DECLS
+
+#endif /* __TPAW_ACCOUNT_WIDGET_PRIVATE_H__ */
diff --git a/tp-account-widgets/tpaw-account-widget-sip.c b/tp-account-widgets/tpaw-account-widget-sip.c
new file mode 100644 (file)
index 0000000..b28b089
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ *          Frederic Peters <fpeters@0d.be>
+ */
+
+#include "config.h"
+#include "tpaw-account-widget-sip.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "tpaw-account-widget-private.h"
+#include "empathy-ui-utils.h"
+
+typedef struct {
+  TpawAccountWidget *self;
+  GtkWidget *vbox_settings;
+
+  GtkWidget *label_stun_server;
+  GtkWidget *entry_stun_server;
+  GtkWidget *label_stun_port;
+  GtkWidget *spinbutton_stun_port;
+  GtkWidget *checkbutton_discover_stun;
+  GtkWidget *combobox_transport;
+  GtkWidget *combobox_keep_alive_mechanism;
+  GtkWidget *spinbutton_keepalive_interval;
+} TpawAccountWidgetSip;
+
+static void
+account_widget_sip_destroy_cb (GtkWidget *widget,
+                               TpawAccountWidgetSip *settings)
+{
+  g_slice_free (TpawAccountWidgetSip, settings);
+}
+
+static void
+account_widget_sip_discover_stun_toggled_cb (
+    GtkWidget *checkbox,
+    TpawAccountWidgetSip *settings)
+{
+  gboolean active;
+
+  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
+  gtk_widget_set_sensitive (settings->label_stun_server, !active);
+  gtk_widget_set_sensitive (settings->entry_stun_server, !active);
+  gtk_widget_set_sensitive (settings->label_stun_port, !active);
+  gtk_widget_set_sensitive (settings->spinbutton_stun_port, !active);
+}
+
+static void
+keep_alive_mechanism_combobox_change_cb (GtkWidget *widget,
+    TpawAccountWidgetSip *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  gchar *mechanism;
+  gboolean enabled;
+
+  /* Unsensitive the keep-alive spin button if keep-alive is disabled */
+  if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter))
+    return;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+  gtk_tree_model_get (model, &iter, 0, &mechanism, -1);
+
+  enabled = tp_strdiff (mechanism, "none");
+
+  gtk_widget_set_sensitive (self->spinbutton_keepalive_interval, enabled);
+  g_free (mechanism);
+}
+
+static void
+checkbutton_tel_toggled (
+    GtkWidget *checkbox,
+    TpawAccountWidgetSip *sip_settings)
+{
+  EmpathyAccountSettings *settings;
+
+  settings = tpaw_account_widget_get_settings (sip_settings->self);
+
+  empathy_account_settings_set_uri_scheme_tel (settings,
+      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)));
+
+  tpaw_account_widget_changed (sip_settings->self);
+}
+
+GtkWidget *
+tpaw_account_widget_sip_build (TpawAccountWidget *self,
+    const char *filename,
+    GtkWidget **grid_common_settings)
+{
+  TpawAccountWidgetSip *settings;
+  GtkWidget *vbox_settings;
+  gboolean is_simple;
+  GtkWidget *grid_advanced;
+
+  g_object_get (self, "simple", &is_simple, NULL);
+
+  if (is_simple)
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_sip_simple", &vbox_settings,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_userid_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_userid_simple");
+    }
+  else
+    {
+      GtkListStore *store;
+      GtkCellRenderer *renderer;
+      GtkToggleButton *checkbutton_tel;
+
+      settings = g_slice_new0 (TpawAccountWidgetSip);
+      settings->self = self;
+
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_settings", grid_common_settings,
+          "grid_advanced_sip_settings", &grid_advanced,
+          "vbox_sip_settings", &vbox_settings,
+          "label_stun-server", &settings->label_stun_server,
+          "entry_stun-server", &settings->entry_stun_server,
+          "label_stun-port", &settings->label_stun_port,
+          "spinbutton_stun-port", &settings->spinbutton_stun_port,
+          "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
+          "spinbutton_keepalive-interval",
+            &settings->spinbutton_keepalive_interval,
+          "checkbutton_tel", &checkbutton_tel,
+          NULL);
+      settings->vbox_settings = vbox_settings;
+
+      gtk_toggle_button_set_active (checkbutton_tel,
+          empathy_account_settings_has_uri_scheme_tel (
+            tpaw_account_widget_get_settings (self)));
+
+      tpaw_account_widget_handle_params (self,
+          "entry_userid", "account",
+          "entry_password", "password",
+          "checkbutton_discover-stun", "discover-stun",
+          "entry_stun-server", "stun-server",
+          "spinbutton_stun-port", "stun-port",
+          "entry_auth-user", "auth-user",
+          "entry_proxy-host", "proxy-host",
+          "spinbutton_port", "port",
+          "checkbutton_loose-routing", "loose-routing",
+          "checkbutton_discover-binding", "discover-binding",
+          "spinbutton_keepalive-interval", "keepalive-interval",
+          "checkbutton_ignore-tls-errors", "ignore-tls-errors",
+          "entry_local-ip-address", "local-ip-address",
+          "spinbutton_local-port", "local-port",
+          NULL);
+
+      account_widget_sip_discover_stun_toggled_cb (
+          settings->checkbutton_discover_stun,
+          settings);
+
+      empathy_builder_connect (self->ui_details->gui, settings,
+          "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
+          "checkbutton_discover-stun", "toggled",
+          account_widget_sip_discover_stun_toggled_cb,
+          "checkbutton_tel", "toggled", checkbutton_tel_toggled,
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_userid");
+
+      /* Create the 'transport' combo box. The first column has to contain the
+       * value of the param. */
+      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
+      settings->combobox_transport = gtk_combo_box_new_with_model (
+          GTK_TREE_MODEL (store));
+
+      renderer = gtk_cell_renderer_text_new ();
+      gtk_cell_layout_pack_start (
+          GTK_CELL_LAYOUT (settings->combobox_transport), renderer, TRUE);
+      gtk_cell_layout_add_attribute (
+          GTK_CELL_LAYOUT (settings->combobox_transport), renderer, "text", 1);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "auto", 1, _("Auto"), -1);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "udp", 1, _("UDP"), -1);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "tcp", 1, _("TCP"), -1);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "tls", 1, _("TLS"), -1);
+
+      tpaw_account_widget_setup_widget (self, settings->combobox_transport,
+          "transport");
+
+      gtk_grid_attach (GTK_GRID (grid_advanced), settings->combobox_transport,
+          1, 11, 3, 1);
+
+      gtk_widget_show (settings->combobox_transport);
+
+      /* Create the 'keep-alive mechanism' combo box */
+      store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
+      settings->combobox_keep_alive_mechanism = gtk_combo_box_new_with_model (
+          GTK_TREE_MODEL (store));
+
+      renderer = gtk_cell_renderer_text_new ();
+      gtk_cell_layout_pack_start (
+          GTK_CELL_LAYOUT (settings->combobox_keep_alive_mechanism), renderer,
+          TRUE);
+      gtk_cell_layout_add_attribute (
+          GTK_CELL_LAYOUT (settings->combobox_keep_alive_mechanism), renderer,
+          "text", 1);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "auto", 1, _("Auto"), -1);
+
+      /* translators: this string is very specific to SIP's internal; maybe
+       * best to keep the English version. */
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "register", 1, _("Register"), -1);
+
+      /* translators: this string is very specific to SIP's internal; maybe
+       * best to keep the English version. */
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "options", 1, _("Options"), -1);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+          0, "none", 1, _("None"), -1);
+
+      g_signal_connect (settings->combobox_keep_alive_mechanism, "changed",
+          G_CALLBACK (keep_alive_mechanism_combobox_change_cb), settings);
+
+      tpaw_account_widget_setup_widget (self,
+          settings->combobox_keep_alive_mechanism, "keepalive-mechanism");
+
+      gtk_grid_attach (GTK_GRID (grid_advanced),
+          settings->combobox_keep_alive_mechanism,
+          1, 7, 3, 1);
+
+      gtk_widget_show (settings->combobox_keep_alive_mechanism);
+    }
+
+  return vbox_settings;
+}
diff --git a/tp-account-widgets/tpaw-account-widget-sip.h b/tp-account-widgets/tpaw-account-widget-sip.h
new file mode 100644 (file)
index 0000000..7f08ab1
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Frederic Peters <fpeters@0d.be>
+ */
+
+#ifndef __TPAW_ACCOUNT_WIDGET_SIP_H__
+#define __TPAW_ACCOUNT_WIDGET_SIP_H__
+
+#include "tpaw-account-widget.h"
+
+G_BEGIN_DECLS
+
+GtkWidget * tpaw_account_widget_sip_build (TpawAccountWidget *self,
+    const char *filename,
+    GtkWidget **grid_common_settings);
+
+G_END_DECLS
+
+#endif /* __TPAW_ACCOUNT_WIDGET_SIP_H__ */
diff --git a/tp-account-widgets/tpaw-account-widget-sip.ui b/tp-account-widgets/tpaw-account-widget-sip.ui
new file mode 100644 (file)
index 0000000..7caa7ca
--- /dev/null
@@ -0,0 +1,731 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment3">
+    <property name="upper">10000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment4">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_sip_settings">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">Pass_word</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_password</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_userid">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_userid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">1</property>
+            <property name="label" translatable="yes">_Username</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_userid</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_username_example">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@my.sip.server</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.80000000000000004"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="checkbutton_tel">
+            <property name="label" translatable="yes">Use this account to call _landlines and mobile phones</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+            <property name="xalign">0</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="top_attach">4</property>
+            <property name="left_attach">0</property>
+            <property name="width">4</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander_advanced">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
+            <property name="height_request">200</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">never</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkViewport" id="viewport1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="resize_mode">queue</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="border_width">6</property>
+                    <child>
+                      <object class="GtkGrid" id="grid_advanced_sip_settings">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="column_spacing">6</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkEntry" id="entry_stun-server">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="entry_auth-user">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">10</property>
+                            <property name="width">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="entry_proxy-host">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">5</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="spinbutton_keepalive-interval">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="adjustment">adjustment3</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">8</property>
+                            <property name="width">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                         <object class="GtkEntry" id="entry_local-ip-address">
+                           <property name="visible">True</property>
+                           <property name="can_focus">True</property>
+                         </object>
+                         <packing>
+                           <property name="left_attach">1</property>
+                           <property name="top_attach">14</property>
+                         </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_nat_traversal">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">NAT Traversal Options</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_proxy">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Proxy Options</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">4</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_misc">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Miscellaneous Options</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">9</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">24</property>
+                            <child>
+                              <object class="GtkLabel" id="label_stun-server">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">STUN Server</property>
+                                <property name="mnemonic_widget">entry_stun-server</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_discover-stun">
+                                <property name="label" translatable="yes">Discover the STUN server automatically</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="left_attach">0</property>
+                            <property name="width">4</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_discover-binding">
+                                <property name="label" translatable="yes">Discover Binding</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">3</property>
+                            <property name="left_attach">0</property>
+                            <property name="width">4</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment8">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_proxy-host">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Server</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">5</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_keep_alive">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Keep-Alive Options</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top_attach">6</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment10">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_keepalive-mechanism">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Mechanism</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">7</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment11">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_keepalive-interval">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Interval (seconds)</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">8</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment12">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_auth-user">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Authentication username</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">10</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment13">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_transport">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Transport</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">11</property>
+                            <property name="left_attach">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment14">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_loose-routing">
+                                <property name="label" translatable="yes">Loose Routing</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">12</property>
+                            <property name="left_attach">0</property>
+                            <property name="width">4</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment15">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton_ignore-tls-errors">
+                                <property name="label" translatable="yes">Ignore TLS Errors</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="top_attach">13</property>
+                            <property name="left_attach">0</property>
+                            <property name="width">4</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_stun-port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Port</property>
+                            <property name="mnemonic_widget">spinbutton_stun-port</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="spinbutton_stun-port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="adjustment">adjustment1</property>
+                            <property name="climb_rate">1</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="top_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Port</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">5</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="spinbutton_port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="adjustment">adjustment2</property>
+                            <property name="climb_rate">1</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="top_attach">5</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment16">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_local-ip-address">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Local IP Address</property>
+                                <property name="mnemonic_widget">entry_local-ip-address</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">14</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_local-port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Port</property>
+                            <property name="mnemonic_widget">spinbutton_local-port</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">14</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="spinbutton_local-port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="adjustment">adjustment4</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="top_attach">14</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label_expander">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_sip_simple">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label_userid_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your SIP login ID?</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_userid_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_example">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; user@my.sip.server</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.80000000000000004"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your SIP account password?</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember Password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="use_action_appearance">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget-yahoo.ui b/tp-account-widgets/tpaw-account-widget-yahoo.ui
new file mode 100644 (file)
index 0000000..9d00253
--- /dev/null
@@ -0,0 +1,330 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="value">5050</property>
+    <property name="lower">1</property>
+    <property name="upper">65555</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="vbox_yahoo_settings">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkGrid" id="grid_common_settings">
+        <property name="visible">True</property>
+        <property name="column_spacing">12</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_password">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Pass_word:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_password</property>
+          </object>
+          <packing>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_id">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Yahoo! I_D:</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">entry_id</property>
+          </object>
+          <packing>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_id">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkEntry" id="entry_password">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_username_example">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xpad">3</property>
+            <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="remember_password">
+            <property name="label" translatable="yes">Remember password</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkGrid" id="grid_advanced_settings">
+                <property name="visible">True</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton_ignore_invites">
+                    <property name="label" translatable="yes">I_gnore conference and chat room invitations</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="width">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label_locale">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Room List locale:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_locale</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="left_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label_charset">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Ch_aracter set:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">entry_charset</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="left_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_locale">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="entry_charset">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label_port">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Port:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">spinbutton_port</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">3</property>
+                    <property name="left_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinbutton_port">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="climb_rate">1</property>
+                    <property name="numeric">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Advanced</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+  <object class="GtkVBox" id="vbox_yahoo_simple">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="label_id_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Yahoo! ID?</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="bottom_padding">3</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkVBox" id="vbox2">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkEntry" id="entry_id_simple">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_example">
+                <property name="visible">True</property>
+                <property name="xalign">0.10000000149011612</property>
+                <property name="label" translatable="yes">&lt;b&gt;Example:&lt;/b&gt; username</property>
+                <property name="use_markup">True</property>
+                <attributes>
+                  <attribute name="scale" value="0.8"/><!-- PANGO_SCALE_SMALL -->
+                </attributes>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_password_simple">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="label" translatable="yes">What is your Yahoo! password?</property>
+      </object>
+      <packing>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkAlignment" id="alignment2">
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xscale">0.34999999403953552</property>
+        <property name="yscale">0.34999999403953552</property>
+        <property name="left_padding">12</property>
+        <child>
+          <object class="GtkEntry" id="entry_password_simple">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="visibility">False</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="remember_password_simple">
+        <property name="label" translatable="yes">Remember password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="position">4</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c
new file mode 100644 (file)
index 0000000..7300ea1
--- /dev/null
@@ -0,0 +1,2331 @@
+/*
+ * Copyright (C) 2006-2007 Imendio AB
+ * 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
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
+ *
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ *          Martyn Russell <martyn@imendio.com>
+ *          Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
+ *          Jonathan Tellier <jonathan.tellier@gmail.com>
+ *          Danielle Madeley <danielle.madeley@collabora.co.uk>
+ */
+
+#include "config.h"
+#include "tpaw-account-widget.h"
+#include "tpaw-account-widget-private.h"
+
+#include <glib/gi18n-lib.h>
+#include <dbus/dbus-protocol.h>
+
+#include "tpaw-account-widget-irc.h"
+#include "tpaw-account-widget-private.h"
+#include "tpaw-account-widget-sip.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include "empathy-debug.h"
+
+G_DEFINE_TYPE (TpawAccountWidget, tpaw_account_widget, GTK_TYPE_BOX)
+
+typedef enum
+{
+  NO_SERVICE = 0,
+  GTALK_SERVICE,
+  FACEBOOK_SERVICE,
+  N_SERVICES
+} Service;
+
+typedef struct
+{
+  const gchar *label_username_example;
+  gboolean show_advanced;
+} ServiceInfo;
+
+static ServiceInfo services_infos[N_SERVICES] = {
+    { "label_username_example", TRUE },
+    { "label_username_g_example", FALSE },
+    { "label_username_f_example", FALSE },
+};
+
+struct _TpawAccountWidgetPriv {
+  EmpathyAccountSettings *settings;
+
+  GtkWidget *grid_common_settings;
+  GtkWidget *apply_button;
+  GtkWidget *cancel_button;
+  GtkWidget *entry_password;
+  GtkWidget *spinbutton_port;
+  GtkWidget *radiobutton_reuse;
+  GtkWidget *hbox_buttons;
+
+  gboolean simple;
+
+  gboolean contains_pending_changes;
+
+  /* An TpawAccountWidget can be used to either create an account or
+   * modify it. When we are creating an account, this member is set to TRUE */
+  gboolean creating_account;
+
+  /* whether there are any other real accounts. Necessary so we know whether
+   * it's safe to dismiss this widget in some cases (eg, whether the Cancel
+   * button should be sensitive) */
+  gboolean other_accounts_exist;
+
+  /* if TRUE, the GTK+ destroy signal has been fired and so the widgets
+   * embedded in this account widget can't be used any more
+   * workaround because some async callbacks can be called after the
+   * widget has been destroyed */
+  gboolean destroyed;
+
+  TpAccountManager *account_manager;
+
+  GtkWidget *param_account_widget;
+  GtkWidget *param_password_widget;
+
+  gboolean automatic_change;
+  GtkWidget *remember_password_widget;
+
+  /* Used only for IRC accounts */
+  TpawIrcNetworkChooser *irc_network_chooser;
+
+  /* Used for 'special' XMPP account having a service associated ensuring that
+   * JIDs have a specific suffix; such as Facebook for example */
+  gchar *jid_suffix;
+};
+
+enum {
+  PROP_PROTOCOL = 1,
+  PROP_SETTINGS,
+  PROP_SIMPLE,
+  PROP_CREATING_ACCOUNT,
+  PROP_OTHER_ACCOUNTS_EXIST,
+};
+
+enum {
+  HANDLE_APPLY,
+  ACCOUNT_CREATED,
+  CANCELLED,
+  CLOSE,
+  LAST_SIGNAL
+};
+
+enum {
+  RESPONSE_LAUNCH
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+#define CHANGED_TIMEOUT 300
+
+#define DIGIT             "0-9"
+#define DIGITS            "(["DIGIT"]+)"
+#define ALPHA             "a-zA-Z"
+#define ALPHAS            "(["ALPHA"]+)"
+#define ALPHADIGIT        ALPHA DIGIT
+#define ALPHADIGITS       "(["ALPHADIGIT"]+)"
+#define ALPHADIGITDASH    ALPHA DIGIT "-"
+#define ALPHADIGITDASHS   "(["ALPHADIGITDASH"]*)"
+
+#define HOSTNUMBER        "("DIGITS"\\."DIGITS"\\."DIGITS"\\."DIGITS")"
+#define TOPLABEL          "("ALPHAS \
+                            "| (["ALPHA"]"ALPHADIGITDASHS "["ALPHADIGIT"]))"
+#define DOMAINLABEL       "("ALPHADIGITS"|(["ALPHADIGIT"]" ALPHADIGITDASHS \
+                                       "["ALPHADIGIT"]))"
+#define HOSTNAME          "((" DOMAINLABEL "\\.)+" TOPLABEL ")"
+/* Based on http://www.ietf.org/rfc/rfc1738.txt (section 5) */
+#define HOST              "("HOSTNAME "|" HOSTNUMBER")"
+/* Based on http://www.ietf.org/rfc/rfc0822.txt (appendix D) */
+#define EMAIL_LOCALPART   "([^\\(\\)<>@,;:\\\\\"\\[\\]\\s]+)"
+
+/* UIN is digital according to the unofficial specification:
+ * http://iserverd.khstu.ru/docum_ext/icqv5.html#CTS
+ * 5 digits minimum according to http://en.wikipedia.org/wiki/ICQ#UIN
+ * According to an user, we can also provide an email address instead of the
+ * ICQ UIN. */
+#define ICQ_USER_NAME     "((["DIGIT"]{5,})|"EMAIL_LOCALPART"@"HOST")"
+
+/* Based on http://www.ietf.org/rfc/rfc2812.txt (section 2.3.1) */
+#define IRC_SPECIAL       "_\\[\\]{}\\\\|`^"
+#define IRC_NICK_NAME     "(["ALPHA IRC_SPECIAL"]["ALPHADIGITDASH IRC_SPECIAL"]*)"
+
+/* Based on http://www.ietf.org/rfc/rfc4622.txt (section 2.2)
+ * We just exclude invalid characters to avoid ucschars and other redundant
+ * complexity */
+#define JABBER_USER_NAME  "([^@:'\"<>&\\s]+)"
+/* ID is an email according to the unofficial specification:
+ * http://www.hypothetic.org/docs/msn/general/names.php */
+#define MSN_USER_NAME     EMAIL_LOCALPART
+/* Based on the official help:
+ * http://help.yahoo.com/l/us/yahoo/edit/registration/edit-01.html
+ * Looks like an email address can be used as well (bgo #655959)
+ * */
+#define YAHOO_USER_NAME   "(["ALPHA"]["ALPHADIGIT"_\\.]{3,31})|("EMAIL_LOCALPART"@"HOST")"
+
+#define ACCOUNT_REGEX_ICQ      "^"ICQ_USER_NAME"$"
+#define ACCOUNT_REGEX_IRC      "^"IRC_NICK_NAME"$"
+#define ACCOUNT_REGEX_JABBER   "^"JABBER_USER_NAME"@[^@/]+"
+#define ACCOUNT_REGEX_MSN      "^"MSN_USER_NAME"@"HOST"$"
+#define ACCOUNT_REGEX_YAHOO    "^"YAHOO_USER_NAME"$"
+
+static void
+account_widget_set_control_buttons_sensitivity (TpawAccountWidget *self,
+    gboolean sensitive)
+{
+  /* we hit this case because of the 'other-accounts-exist' property handler
+   * being called during init (before constructed()) */
+  if (self->priv->apply_button == NULL || self->priv->cancel_button == NULL)
+    return;
+
+  gtk_widget_set_sensitive (self->priv->apply_button, sensitive);
+
+  if (sensitive)
+    {
+      /* We can't grab default if the widget hasn't be packed in a
+       * window */
+      GtkWidget *window;
+
+      window = gtk_widget_get_toplevel (self->priv->apply_button);
+      if (window != NULL &&
+          gtk_widget_is_toplevel (window))
+        {
+          gtk_widget_set_can_default (self->priv->apply_button, TRUE);
+          gtk_widget_grab_default (self->priv->apply_button);
+        }
+    }
+}
+
+static void
+account_widget_set_entry_highlighting (GtkEntry *entry,
+    gboolean highlight)
+{
+  g_return_if_fail (GTK_IS_ENTRY (entry));
+
+  if (highlight)
+    {
+      GtkStyleContext *style;
+      GdkRGBA color;
+
+      style = gtk_widget_get_style_context (GTK_WIDGET (entry));
+      gtk_style_context_get_background_color (style, GTK_STATE_FLAG_SELECTED,
+          &color);
+
+      /* Here we take the current theme colour and add it to
+       * the colour for white and average the two. This
+       * gives a colour which is inline with the theme but
+       * slightly whiter.
+       */
+      empathy_make_color_whiter (&color);
+
+      gtk_widget_override_background_color (GTK_WIDGET (entry), 0, &color);
+    }
+  else
+    {
+      gtk_widget_override_background_color (GTK_WIDGET (entry), 0, NULL);
+    }
+}
+
+static void
+account_widget_handle_control_buttons_sensitivity (TpawAccountWidget *self)
+{
+  gboolean is_valid;
+
+  is_valid = empathy_account_settings_is_valid (self->priv->settings);
+
+  account_widget_set_control_buttons_sensitivity (self, is_valid);
+
+  g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid);
+}
+
+static void
+account_widget_entry_changed_common (TpawAccountWidget *self,
+    GtkEntry *entry, gboolean focus)
+{
+  const gchar *str;
+  const gchar *param_name;
+  gboolean prev_status;
+  gboolean curr_status;
+
+  str = gtk_entry_get_text (entry);
+  param_name = g_object_get_data (G_OBJECT (entry), "param_name");
+  prev_status = empathy_account_settings_parameter_is_valid (
+      self->priv->settings, param_name);
+
+  if (EMP_STR_EMPTY (str))
+    {
+      empathy_account_settings_unset (self->priv->settings, param_name);
+
+      if (focus)
+        {
+          gchar *value;
+
+          value = empathy_account_settings_dup_string (self->priv->settings,
+              param_name);
+
+          DEBUG ("Unset %s and restore to %s", param_name, value);
+          gtk_entry_set_text (entry, value ? value : "");
+          g_free (value);
+        }
+    }
+  else
+    {
+      DEBUG ("Setting %s to %s", param_name,
+          tp_strdiff (param_name, "password") ? str : "***");
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_string (str));
+    }
+
+  curr_status = empathy_account_settings_parameter_is_valid (
+      self->priv->settings, param_name);
+
+  if (curr_status != prev_status)
+    account_widget_set_entry_highlighting (entry, !curr_status);
+}
+
+static void
+account_widget_entry_changed_cb (GtkEditable *entry,
+    TpawAccountWidget *self)
+{
+  if (self->priv->automatic_change)
+    return;
+
+  account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
+  tpaw_account_widget_changed (self);
+}
+
+static void
+account_widget_entry_map_cb (GtkEntry *entry,
+    TpawAccountWidget *self)
+{
+  const gchar *param_name;
+  gboolean is_valid;
+
+  /* need to initialize input highlighting */
+  param_name = g_object_get_data (G_OBJECT (entry), "param_name");
+  is_valid = empathy_account_settings_parameter_is_valid (self->priv->settings,
+      param_name);
+  account_widget_set_entry_highlighting (entry, !is_valid);
+}
+
+static void
+account_widget_int_changed_cb (GtkWidget *widget,
+    TpawAccountWidget *self)
+{
+  const gchar *param_name;
+  gint value;
+  const gchar *signature;
+
+  value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+  param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+
+  signature = empathy_account_settings_get_dbus_signature (self->priv->settings,
+    param_name);
+  g_return_if_fail (signature != NULL);
+
+  DEBUG ("Setting %s to %d", param_name, value);
+
+  switch ((int)*signature)
+    {
+    case DBUS_TYPE_INT16:
+    case DBUS_TYPE_INT32:
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_int32 (value));
+      break;
+    case DBUS_TYPE_INT64:
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_int64 (value));
+      break;
+    case DBUS_TYPE_UINT16:
+    case DBUS_TYPE_UINT32:
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_uint32 (value));
+      break;
+    case DBUS_TYPE_UINT64:
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_uint64 (value));
+      break;
+    default:
+      g_return_if_reached ();
+    }
+
+  tpaw_account_widget_changed (self);
+}
+
+static void
+account_widget_checkbutton_toggled_cb (GtkWidget *widget,
+    TpawAccountWidget *self)
+{
+  gboolean     value;
+  gboolean     default_value;
+  const gchar *param_name;
+
+  value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+  param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+
+  /* FIXME: This is ugly! checkbox don't have a "not-set" value so we
+   * always unset the param and set the value if different from the
+   * default value. */
+  empathy_account_settings_unset (self->priv->settings, param_name);
+  default_value = empathy_account_settings_get_boolean (self->priv->settings,
+      param_name);
+
+  if (default_value == value)
+    {
+      DEBUG ("Unset %s and restore to %d", param_name, default_value);
+    }
+  else
+    {
+      DEBUG ("Setting %s to %d", param_name, value);
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_boolean (value));
+    }
+
+  tpaw_account_widget_changed (self);
+}
+
+static void
+account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
+    TpawAccountWidget *self)
+{
+  gboolean   value;
+  gint32       port = 0;
+
+  value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
+  port = empathy_account_settings_get_uint32 (self->priv->settings, "port");
+
+  if (value)
+    {
+      if (port == 5222 || port == 0)
+        port = 5223;
+    }
+  else
+    {
+      if (port == 5223 || port == 0)
+        port = 5222;
+    }
+
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->priv->spinbutton_port),
+      port);
+
+  self->priv->contains_pending_changes = TRUE;
+}
+
+static void
+account_widget_combobox_changed_cb (GtkWidget *widget,
+    TpawAccountWidget *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  const gchar *value;
+  GVariant *v;
+  const gchar *default_value = NULL;
+  const gchar *param_name;
+
+  if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter))
+    return;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+  /* the param value is stored in the first column */
+  gtk_tree_model_get (model, &iter, 0, &value, -1);
+
+  param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+
+  v = empathy_account_settings_dup_default (self->priv->settings, param_name);
+  if (v != NULL && g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
+    default_value = g_variant_get_string (v, NULL);
+
+  if (!tp_strdiff (value, default_value))
+    {
+      DEBUG ("Unset %s and restore to %s", param_name, default_value);
+      empathy_account_settings_unset (self->priv->settings, param_name);
+    }
+  else
+    {
+      DEBUG ("Setting %s to %s", param_name, value);
+      empathy_account_settings_set (self->priv->settings, param_name,
+          g_variant_new_string (value));
+    }
+
+  tpaw_account_widget_changed (self);
+
+  tp_clear_pointer (&v, g_variant_unref);
+}
+
+static void
+clear_icon_released_cb (GtkEntry *entry,
+    GtkEntryIconPosition icon_pos,
+    GdkEvent *event,
+    TpawAccountWidget *self)
+{
+  const gchar *param_name;
+
+  param_name = g_object_get_data (G_OBJECT (entry), "param_name");
+
+  DEBUG ("Unset %s", param_name);
+  empathy_account_settings_unset (self->priv->settings, param_name);
+  gtk_entry_set_text (entry, "");
+
+  tpaw_account_widget_changed (self);
+}
+
+static void
+password_entry_changed_cb (GtkEditable *entry,
+    TpawAccountWidget *self)
+{
+  const gchar *str;
+
+  str = gtk_entry_get_text (GTK_ENTRY (entry));
+
+  gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
+      GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+}
+
+static void
+password_entry_activated_cb (GtkEntry *entry,
+    TpawAccountWidget *self)
+{
+    if (gtk_widget_get_sensitive (self->priv->apply_button))
+        tpaw_account_widget_apply_and_log_in (self);
+}
+
+static void
+account_entry_activated_cb (GtkEntry *entry,
+    TpawAccountWidget *self)
+{
+    if (gtk_widget_get_sensitive (self->priv->apply_button))
+        tpaw_account_widget_apply_and_log_in (self);
+}
+
+void
+tpaw_account_widget_setup_widget (TpawAccountWidget *self,
+    GtkWidget *widget,
+    const gchar *param_name)
+{
+  g_object_set_data_full (G_OBJECT (widget), "param_name",
+      g_strdup (param_name), g_free);
+
+  if (GTK_IS_SPIN_BUTTON (widget))
+    {
+      gint value = 0;
+      const gchar *signature;
+
+      signature = empathy_account_settings_get_dbus_signature (
+          self->priv->settings, param_name);
+      g_return_if_fail (signature != NULL);
+
+      switch ((int)*signature)
+        {
+          case DBUS_TYPE_INT16:
+          case DBUS_TYPE_INT32:
+            value = empathy_account_settings_get_int32 (self->priv->settings,
+              param_name);
+            break;
+          case DBUS_TYPE_INT64:
+            value = empathy_account_settings_get_int64 (self->priv->settings,
+              param_name);
+            break;
+          case DBUS_TYPE_UINT16:
+          case DBUS_TYPE_UINT32:
+            value = empathy_account_settings_get_uint32 (self->priv->settings,
+              param_name);
+            break;
+          case DBUS_TYPE_UINT64:
+            value = empathy_account_settings_get_uint64 (self->priv->settings,
+                param_name);
+            break;
+          default:
+            g_return_if_reached ();
+        }
+
+      gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
+
+      g_signal_connect (widget, "value-changed",
+          G_CALLBACK (account_widget_int_changed_cb),
+          self);
+    }
+  else if (GTK_IS_ENTRY (widget))
+    {
+      gchar *str;
+
+      str = empathy_account_settings_dup_string (self->priv->settings,
+          param_name);
+      gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
+
+      if (!tp_strdiff (param_name, "account"))
+        self->priv->param_account_widget = widget;
+      else if (!tp_strdiff (param_name, "password"))
+        self->priv->param_password_widget = widget;
+
+      if (strstr (param_name, "password"))
+        {
+          gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
+
+          /* Add 'clear' icon */
+          gtk_entry_set_icon_from_stock (GTK_ENTRY (widget),
+              GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
+
+          gtk_entry_set_icon_sensitive (GTK_ENTRY (widget),
+              GTK_ENTRY_ICON_SECONDARY, !EMP_STR_EMPTY (str));
+
+          g_signal_connect (widget, "icon-release",
+              G_CALLBACK (clear_icon_released_cb), self);
+          g_signal_connect (widget, "changed",
+              G_CALLBACK (password_entry_changed_cb), self);
+          g_signal_connect (widget, "activate",
+              G_CALLBACK (password_entry_activated_cb), self);
+        }
+      else if (strstr (param_name, "account"))
+        g_signal_connect (widget, "activate",
+            G_CALLBACK (account_entry_activated_cb), self);
+
+      g_signal_connect (widget, "changed",
+          G_CALLBACK (account_widget_entry_changed_cb), self);
+      g_signal_connect (widget, "map",
+          G_CALLBACK (account_widget_entry_map_cb), self);
+
+      g_free (str);
+    }
+  else if (GTK_IS_TOGGLE_BUTTON (widget))
+    {
+      gboolean value = FALSE;
+
+      value = empathy_account_settings_get_boolean (self->priv->settings,
+          param_name);
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
+
+      g_signal_connect (widget, "toggled",
+          G_CALLBACK (account_widget_checkbutton_toggled_cb),
+          self);
+    }
+  else if (GTK_IS_COMBO_BOX (widget))
+    {
+      /* The combo box's model has to contain the param value in its first
+       * column (as a string) */
+      gchar *str;
+      GtkTreeModel *model;
+      GtkTreeIter iter;
+      gboolean valid;
+
+      str = empathy_account_settings_dup_string (self->priv->settings,
+          param_name);
+      model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+
+      valid = gtk_tree_model_get_iter_first (model, &iter);
+      while (valid)
+        {
+          gchar *name;
+
+          gtk_tree_model_get (model, &iter, 0, &name, -1);
+          if (!tp_strdiff (name, str))
+            {
+              gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);
+              valid = FALSE;
+            }
+          else
+            {
+              valid = gtk_tree_model_iter_next (model, &iter);
+            }
+
+          g_free (name);
+        }
+
+      g_free (str);
+
+      g_signal_connect (widget, "changed",
+          G_CALLBACK (account_widget_combobox_changed_cb),
+          self);
+    }
+  else
+    {
+      DEBUG ("Unknown type of widget for param %s", param_name);
+    }
+
+  gtk_widget_set_sensitive (widget,
+      empathy_account_settings_param_is_supported (self->priv->settings,
+        param_name));
+}
+
+static GHashTable *
+build_translated_params (void)
+{
+  GHashTable *hash;
+
+  hash = g_hash_table_new (g_str_hash, g_str_equal);
+  g_hash_table_insert (hash, "account", _("Account"));
+  g_hash_table_insert (hash, "password", _("Password"));
+  g_hash_table_insert (hash, "server", _("Server"));
+  g_hash_table_insert (hash, "port", _("Port"));
+
+  return hash;
+}
+
+static gchar *
+account_widget_generic_format_param_name (const gchar *param_name)
+{
+  gchar *str;
+  gchar *p;
+  static GHashTable *translated_params = NULL;
+
+  g_return_val_if_fail (param_name != NULL, NULL);
+
+  if (G_UNLIKELY (translated_params == NULL))
+    translated_params = build_translated_params ();
+
+  /* Translate most common parameters */
+  str = g_hash_table_lookup (translated_params, param_name);
+  if (str != NULL)
+    return g_strdup (str);
+
+  str = g_strdup (param_name);
+
+  if (str && g_ascii_isalpha (str[0]))
+    str[0] = g_ascii_toupper (str[0]);
+
+  while ((p = strchr (str, '-')) != NULL)
+    {
+      if (p[1] != '\0' && g_ascii_isalpha (p[1]))
+        {
+          p[0] = ' ';
+          p[1] = g_ascii_toupper (p[1]);
+        }
+
+      p++;
+    }
+
+  return str;
+}
+
+static void
+accounts_widget_generic_setup (TpawAccountWidget *self,
+    GtkWidget *grid_common_settings,
+    GtkWidget *grid_advanced_settings)
+{
+  GList *params, *l;
+  guint row_common = 0, row_advanced = 0;
+
+  params = empathy_account_settings_dup_tp_params (self->priv->settings);
+
+  for (l = params; l != NULL; l = g_list_next (l))
+    {
+      TpConnectionManagerParam *param = l->data;
+      GtkWidget       *grid_settings;
+      guint           row;
+      GtkWidget       *widget = NULL;
+      gchar           *param_name_formatted;
+      const gchar *dbus_signature;
+
+      if (tp_connection_manager_param_is_required (param))
+        {
+          grid_settings = grid_common_settings;
+          row = row_common++;
+        }
+      else if (self->priv->simple)
+        {
+          continue;
+        }
+      else
+        {
+          grid_settings = grid_advanced_settings;
+          row = row_advanced++;
+        }
+
+      param_name_formatted = account_widget_generic_format_param_name (
+          tp_connection_manager_param_get_name (param));
+
+      dbus_signature = tp_connection_manager_param_get_dbus_signature (param);
+
+      if (dbus_signature[0] == 's')
+        {
+          gchar *str;
+
+          str = g_strdup_printf (_("%s"), param_name_formatted);
+          widget = gtk_label_new (str);
+          gtk_misc_set_alignment (GTK_MISC (widget), 1., 0.5);
+          gtk_style_context_add_class (gtk_widget_get_style_context (widget),
+              GTK_STYLE_CLASS_DIM_LABEL);
+          g_free (str);
+
+          gtk_grid_attach (GTK_GRID (grid_settings),
+              widget, 0, row, 1, 1);
+
+          gtk_widget_show (widget);
+
+          widget = gtk_entry_new ();
+          if (strcmp (tp_connection_manager_param_get_name (param),
+                "account") == 0)
+            {
+              g_signal_connect (widget, "realize",
+                  G_CALLBACK (gtk_widget_grab_focus),
+                  NULL);
+            }
+
+          gtk_grid_attach (GTK_GRID (grid_settings),
+              widget, 1, row, 1, 1);
+
+          gtk_widget_show (widget);
+        }
+      /* int types: ynqiuxt. double type is 'd' */
+      else if (dbus_signature[0] == 'y' ||
+          dbus_signature[0] == 'n' ||
+          dbus_signature[0] == 'q' ||
+          dbus_signature[0] == 'i' ||
+          dbus_signature[0] == 'u' ||
+          dbus_signature[0] == 'x' ||
+          dbus_signature[0] == 't' ||
+          dbus_signature[0] == 'd')
+        {
+          gchar   *str = NULL;
+          gdouble  minint = 0;
+          gdouble  maxint = 0;
+          gdouble  step = 1;
+
+          switch (dbus_signature[0])
+            {
+            case 'y': minint = G_MININT8;  maxint = G_MAXINT8;   break;
+            case 'n': minint = G_MININT16; maxint = G_MAXINT16;  break;
+            case 'q': minint = 0;          maxint = G_MAXUINT16; break;
+            case 'i': minint = G_MININT32; maxint = G_MAXINT32;  break;
+            case 'u': minint = 0;          maxint = G_MAXUINT32; break;
+            case 'x': minint = G_MININT64; maxint = G_MAXINT64;  break;
+            case 't': minint = 0;          maxint = G_MAXUINT64; break;
+            case 'd': minint = G_MININT32; maxint = G_MAXINT32;
+              step = 0.1; break;
+            default: g_assert_not_reached ();
+            }
+
+          str = g_strdup_printf (_("%s:"), param_name_formatted);
+          widget = gtk_label_new (str);
+          gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
+          g_free (str);
+
+          gtk_grid_attach (GTK_GRID (grid_settings),
+              widget, 0, row, 1, 1);
+          gtk_widget_show (widget);
+
+          widget = gtk_spin_button_new_with_range (minint, maxint, step);
+          gtk_grid_attach (GTK_GRID (grid_settings),
+              widget, 1, row, 1, 1);
+          gtk_widget_show (widget);
+        }
+      else if (dbus_signature[0] == 'b')
+        {
+          widget = gtk_check_button_new_with_label (param_name_formatted);
+          gtk_grid_attach (GTK_GRID (grid_settings),
+              widget, 0, row, 2, 1);
+          gtk_widget_show (widget);
+        }
+      else
+        {
+          DEBUG ("Unknown signature for param %s: %s",
+              param_name_formatted, dbus_signature);
+        }
+
+      if (widget)
+        tpaw_account_widget_setup_widget (self, widget,
+            tp_connection_manager_param_get_name (param));
+
+      g_free (param_name_formatted);
+    }
+
+  g_list_free_full (params, (GDestroyNotify) tp_connection_manager_param_free);
+}
+
+static void
+account_widget_handle_params_valist (TpawAccountWidget *self,
+    const gchar *first_widget,
+    va_list args)
+{
+  GObject *object;
+  const gchar *name;
+
+  for (name = first_widget; name; name = va_arg (args, const gchar *))
+    {
+      const gchar *param_name;
+
+      param_name = va_arg (args, const gchar *);
+      object = gtk_builder_get_object (self->ui_details->gui, name);
+
+      if (!object)
+        {
+          g_warning ("Builder is missing object '%s'.", name);
+          continue;
+        }
+
+      tpaw_account_widget_setup_widget (self, GTK_WIDGET (object),
+          param_name);
+    }
+}
+
+static void
+account_widget_cancel_clicked_cb (GtkWidget *button,
+    TpawAccountWidget *self)
+{
+  g_signal_emit (self, signals[CANCELLED], 0);
+  g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_CANCEL);
+}
+
+static void
+account_widget_account_enabled_cb (GObject *source_object,
+    GAsyncResult *res,
+    gpointer user_data)
+{
+  GError *error = NULL;
+  TpAccount *account = TP_ACCOUNT (source_object);
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data);
+
+  tp_account_set_enabled_finish (account, res, &error);
+
+  if (error != NULL)
+    {
+      DEBUG ("Could not enable the account: %s", error->message);
+      g_error_free (error);
+    }
+  else
+    {
+      empathy_connect_new_account (account, self->priv->account_manager);
+    }
+
+  g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_APPLY);
+
+  /* unref self - part of the workaround */
+  g_object_unref (self);
+}
+
+static void
+account_widget_applied_cb (GObject *source_object,
+    GAsyncResult *res,
+    gpointer user_data)
+{
+  GError *error = NULL;
+  TpAccount *account;
+  EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source_object);
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data);
+  gboolean reconnect_required;
+  gboolean fire_close = TRUE;
+
+  empathy_account_settings_apply_finish (settings, res, &reconnect_required,
+      &error);
+
+  if (error != NULL)
+    {
+      DEBUG ("Could not apply changes to account: %s", error->message);
+      g_error_free (error);
+      return;
+    }
+
+  account = empathy_account_settings_get_account (self->priv->settings);
+
+  if (account != NULL)
+    {
+      if (self->priv->creating_account)
+        {
+          /* By default, when an account is created, we enable it. */
+
+          /* workaround to keep self alive during async call */
+          g_object_ref (self);
+
+          tp_account_set_enabled_async (account, TRUE,
+              account_widget_account_enabled_cb, self);
+          g_signal_emit (self, signals[ACCOUNT_CREATED], 0, account);
+
+          /* Will be fired in account_widget_account_enabled_cb */
+          fire_close = FALSE;
+        }
+      else
+        {
+          /* If the account was offline, we always want to try reconnecting,
+           * to give it a chance to connect if the previous params were wrong.
+           * tp_account_reconnect_async() won't do anything if the requested
+           * presence is offline anyway. */
+          if (tp_account_get_connection_status (account, NULL) ==
+              TP_CONNECTION_STATUS_DISCONNECTED)
+            reconnect_required = TRUE;
+
+          if (reconnect_required && tp_account_is_enabled (account)
+              && tp_account_is_enabled (account))
+            {
+              /* After having applied changes to a user account, we
+               * reconnect it if needed. This is done so the new
+               * information entered by the user is validated on the server. */
+              tp_account_reconnect_async (account, NULL, NULL);
+            }
+        }
+    }
+
+  if (!self->priv->destroyed)
+    account_widget_set_control_buttons_sensitivity (self, FALSE);
+
+  self->priv->contains_pending_changes = FALSE;
+
+  if (fire_close)
+    {
+      /* announce the widget can be closed */
+      g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_APPLY);
+    }
+
+  /* unref the widget - part of the workaround */
+  g_object_unref (self);
+}
+
+void
+tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self)
+{
+  gboolean display_name_overridden;
+
+  if (self->priv->radiobutton_reuse != NULL)
+    {
+      gboolean reuse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+            self->priv->radiobutton_reuse));
+
+      DEBUG ("Set register param: %d", !reuse);
+      empathy_account_settings_set (self->priv->settings, "register",
+          g_variant_new_boolean (!reuse));
+    }
+
+  g_object_get (self->priv->settings,
+      "display-name-overridden", &display_name_overridden, NULL);
+
+  if (self->priv->creating_account || !display_name_overridden)
+    {
+      gchar *display_name;
+
+      /* set default display name for new accounts or update if user didn't
+       * manually override it. */
+      display_name = tpaw_account_widget_get_default_display_name (self);
+
+      empathy_account_settings_set_display_name_async (self->priv->settings,
+          display_name, NULL, NULL);
+
+      g_free (display_name);
+    }
+
+  /* workaround to keep widget alive during async call */
+  g_object_ref (self);
+  empathy_account_settings_apply_async (self->priv->settings,
+      account_widget_applied_cb, self);
+}
+
+static void
+account_widget_apply_clicked_cb (GtkWidget *button,
+    TpawAccountWidget *self)
+{
+    tpaw_account_widget_apply_and_log_in (self);
+}
+
+static void
+account_widget_setup_generic (TpawAccountWidget *self)
+{
+  GtkWidget *grid_common_settings;
+  GtkWidget *grid_advanced_settings;
+
+  grid_common_settings = GTK_WIDGET (gtk_builder_get_object
+      (self->ui_details->gui, "grid_common_settings"));
+  grid_advanced_settings = GTK_WIDGET (gtk_builder_get_object
+      (self->ui_details->gui, "grid_advanced_settings"));
+
+  accounts_widget_generic_setup (self, grid_common_settings,
+      grid_advanced_settings);
+
+  g_object_unref (self->ui_details->gui);
+}
+
+static void
+account_widget_settings_ready_cb (EmpathyAccountSettings *settings,
+    GParamSpec *pspec,
+    gpointer user_data)
+{
+  TpawAccountWidget *self = user_data;
+
+  if (empathy_account_settings_is_ready (self->priv->settings))
+    account_widget_setup_generic (self);
+}
+
+static GtkWidget *
+account_widget_build_generic (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *expander_advanced, *box;
+
+  self->ui_details->gui = empathy_builder_get_resource (filename,
+      "grid_common_settings", &self->priv->grid_common_settings,
+      "vbox_generic_settings", &box,
+      "expander_advanced_settings", &expander_advanced,
+      NULL);
+
+  if (self->priv->simple)
+    gtk_widget_hide (expander_advanced);
+
+  g_object_ref (self->ui_details->gui);
+
+  if (empathy_account_settings_is_ready (self->priv->settings))
+    account_widget_setup_generic (self);
+  else
+    g_signal_connect (self->priv->settings, "notify::ready",
+        G_CALLBACK (account_widget_settings_ready_cb), self);
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_salut (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *expander_advanced, *box;
+
+  self->ui_details->gui = empathy_builder_get_resource (filename,
+      "grid_common_settings", &self->priv->grid_common_settings,
+      "vbox_salut_settings", &box,
+      "expander_advanced_settings", &expander_advanced,
+      NULL);
+
+  tpaw_account_widget_handle_params (self,
+      "entry_published", "published-name",
+      "entry_nickname", "nickname",
+      "entry_first_name", "first-name",
+      "entry_last_name", "last-name",
+      "entry_email", "email",
+      "entry_jid", "jid",
+      NULL);
+
+  if (self->priv->simple)
+    gtk_widget_hide (expander_advanced);
+
+  self->ui_details->default_focus = g_strdup ("entry_first_name");
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_irc (TpawAccountWidget *self,
+  const char *filename)
+{
+  GtkWidget *box;
+
+  empathy_account_settings_set_regex (self->priv->settings, "account",
+      ACCOUNT_REGEX_IRC);
+
+  if (self->priv->simple)
+    {
+      self->priv->irc_network_chooser = tpaw_account_widget_irc_build_simple
+        (self, filename, &box);
+    }
+  else
+    {
+      self->priv->irc_network_chooser = tpaw_account_widget_irc_build (self,
+          filename, &self->priv->grid_common_settings, &box);
+    }
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_sip (TpawAccountWidget *self,
+  const char *filename)
+{
+  GtkWidget *box;
+
+  box = tpaw_account_widget_sip_build (self, filename,
+    &self->priv->grid_common_settings);
+
+  if (self->priv->simple)
+    {
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else
+    {
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+    }
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_msn (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *box;
+
+  empathy_account_settings_set_regex (self->priv->settings, "account",
+      ACCOUNT_REGEX_MSN);
+
+  if (self->priv->simple)
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_msn_simple", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_msn_settings", &self->priv->grid_common_settings,
+          "vbox_msn_settings", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id", "account",
+          "entry_password", "password",
+          "entry_server", "server",
+          "spinbutton_port", "port",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+    }
+
+  return box;
+}
+
+static void
+suffix_id_widget_changed_cb (GtkWidget *entry,
+    TpawAccountWidget *self)
+{
+  gchar *account;
+
+  g_assert (self->priv->jid_suffix != NULL);
+
+  account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
+
+  account = empathy_account_settings_dup_string (self->priv->settings,
+      "account");
+
+  if (!EMP_STR_EMPTY (account) &&
+      !g_str_has_suffix (account, self->priv->jid_suffix))
+    {
+      gchar *tmp;
+
+      tmp = g_strdup_printf ("%s%s", account, self->priv->jid_suffix);
+
+      DEBUG ("Change account from '%s' to '%s'", account, tmp);
+
+      empathy_account_settings_set (self->priv->settings, "account",
+          g_variant_new_string (tmp));
+      g_free (tmp);
+    }
+
+  tpaw_account_widget_changed (self);
+
+  g_free (account);
+}
+
+static gchar *
+remove_jid_suffix (TpawAccountWidget *self,
+    const gchar *str)
+{
+  g_assert (self->priv->jid_suffix != NULL);
+
+  if (!g_str_has_suffix (str, self->priv->jid_suffix))
+    return g_strdup (str);
+
+  return g_strndup (str, strlen (str) - strlen (self->priv->jid_suffix));
+}
+
+static void
+setup_id_widget_with_suffix (TpawAccountWidget *self,
+    GtkWidget *widget,
+    const gchar *suffix)
+{
+  gchar *str = NULL;
+
+  g_object_set_data_full (G_OBJECT (widget), "param_name",
+      g_strdup ("account"), g_free);
+
+  g_assert (self->priv->jid_suffix == NULL);
+  self->priv->jid_suffix = g_strdup (suffix);
+
+  str = empathy_account_settings_dup_string (self->priv->settings, "account");
+  if (str != NULL)
+    {
+      gchar *tmp;
+
+      tmp = remove_jid_suffix (self, str);
+      gtk_entry_set_text (GTK_ENTRY (widget), tmp);
+      g_free (tmp);
+      g_free (str);
+    }
+
+  self->priv->param_account_widget = widget;
+
+  g_signal_connect (widget, "changed",
+      G_CALLBACK (suffix_id_widget_changed_cb), self);
+}
+
+static Service
+account_widget_get_service (TpawAccountWidget *self)
+{
+  const gchar *icon_name, *service;
+
+  icon_name = empathy_account_settings_get_icon_name (self->priv->settings);
+  service = empathy_account_settings_get_service (self->priv->settings);
+
+  /* Previous versions of Tpaw didn't set the Service property on Facebook
+   * and gtalk accounts, so we check using the icon name as well. */
+  if (!tp_strdiff (icon_name, "im-google-talk") ||
+      !tp_strdiff (service, "google-talk"))
+    return GTALK_SERVICE;
+
+  if (!tp_strdiff (icon_name, "im-facebook") ||
+      !tp_strdiff (service, "facebook"))
+    return FACEBOOK_SERVICE;
+
+  return NO_SERVICE;
+}
+
+static GtkWidget *
+account_widget_build_jabber (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *spinbutton_port;
+  GtkWidget *checkbutton_ssl;
+  GtkWidget *label_id, *label_password;
+  GtkWidget *label_id_create, *label_password_create;
+  GtkWidget *label_example_fb;
+  GtkWidget *label_example;
+  GtkWidget *expander_advanced;
+  GtkWidget *entry_id;
+  GtkWidget *box;
+  Service service;
+
+  service = account_widget_get_service (self);
+
+  empathy_account_settings_set_regex (self->priv->settings, "account",
+      ACCOUNT_REGEX_JABBER);
+
+  if (self->priv->simple && service == NO_SERVICE)
+    {
+      /* Simple widget for XMPP */
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_jabber_simple", &box,
+          "label_id_simple", &label_id,
+          "label_id_create", &label_id_create,
+          "label_password_simple", &label_password,
+          "label_password_create", &label_password_create,
+          NULL);
+
+      if (empathy_account_settings_get_boolean (self->priv->settings,
+            "register"))
+        {
+          gtk_widget_hide (label_id);
+          gtk_widget_hide (label_password);
+          gtk_widget_show (label_id_create);
+          gtk_widget_show (label_password_create);
+        }
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else if (self->priv->simple && service == GTALK_SERVICE)
+    {
+      /* Simple widget for Google Talk */
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_gtalk_simple", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id_g_simple", "account",
+          "entry_password_g_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id_g_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_g_simple"));
+    }
+  else if (self->priv->simple && service == FACEBOOK_SERVICE)
+    {
+      /* Simple widget for Facebook */
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_fb_simple", &box,
+          "entry_id_fb_simple", &entry_id,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_password_fb_simple", "password",
+          NULL);
+
+      setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
+
+      self->ui_details->default_focus = g_strdup ("entry_id_fb_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_fb_simple"));
+    }
+  else
+    {
+      ServiceInfo info = services_infos[service];
+
+      /* Full widget for XMPP, Google Talk and Facebook*/
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_settings", &self->priv->grid_common_settings,
+          "vbox_jabber_settings", &box,
+          "spinbutton_port", &spinbutton_port,
+          "checkbutton_ssl", &checkbutton_ssl,
+          "label_username_f_example", &label_example_fb,
+          info.label_username_example, &label_example,
+          "expander_advanced", &expander_advanced,
+          "entry_id", &entry_id,
+          "label_id", &label_id,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_password", "password",
+          "entry_resource", "resource",
+          "entry_server", "server",
+          "spinbutton_port", "port",
+          "spinbutton_priority", "priority",
+          "checkbutton_ssl", "old-ssl",
+          "checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
+          "checkbutton_encryption", "require-encryption",
+          NULL);
+
+      if (service == FACEBOOK_SERVICE)
+        {
+          gtk_label_set_label (GTK_LABEL (label_id), _("Username:"));
+
+          /* Facebook special case the entry ID widget to hide the
+           * "@chat.facebook.com" part */
+          setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com");
+        }
+      else
+        {
+          tpaw_account_widget_setup_widget (self, entry_id, "account");
+        }
+
+      self->ui_details->default_focus = g_strdup ("entry_id");
+      self->priv->spinbutton_port = spinbutton_port;
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+
+      g_signal_connect (checkbutton_ssl, "toggled",
+          G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
+          self);
+
+      if (service == FACEBOOK_SERVICE)
+        {
+          GtkContainer *parent;
+          GList *children;
+
+          /* Removing the label from list of focusable widgets */
+          parent = GTK_CONTAINER (gtk_widget_get_parent (label_example_fb));
+          children = gtk_container_get_children (parent);
+          children = g_list_remove (children, label_example_fb);
+          gtk_container_set_focus_chain (parent, children);
+          g_list_free (children);
+        }
+
+      gtk_widget_show (label_example);
+
+      if (!info.show_advanced)
+        gtk_widget_hide (expander_advanced);
+    }
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_icq (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *spinbutton_port;
+  GtkWidget *box;
+
+  empathy_account_settings_set_regex (self->priv->settings, "account",
+      ACCOUNT_REGEX_ICQ);
+
+  if (self->priv->simple)
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_icq_simple", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_uin_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_uin_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_settings", &self->priv->grid_common_settings,
+          "vbox_icq_settings", &box,
+          "spinbutton_port", &spinbutton_port,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_uin", "account",
+          "entry_password", "password",
+          "entry_server", "server",
+          "spinbutton_port", "port",
+          "entry_charset", "charset",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_uin");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+    }
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_aim (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *spinbutton_port, *box;
+
+  if (self->priv->simple)
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_aim_simple", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_screenname_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_screenname_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_settings", &self->priv->grid_common_settings,
+          "vbox_aim_settings", &box,
+          "spinbutton_port", &spinbutton_port,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_screenname", "account",
+          "entry_password", "password",
+          "entry_server", "server",
+          "spinbutton_port", "port",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_screenname");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+    }
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_yahoo (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *box;
+
+  empathy_account_settings_set_regex (self->priv->settings, "account",
+      ACCOUNT_REGEX_YAHOO);
+
+  if (self->priv->simple)
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_yahoo_simple", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_settings", &self->priv->grid_common_settings,
+          "vbox_yahoo_settings", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id", "account",
+          "entry_password", "password",
+          "entry_locale", "room-list-locale",
+          "entry_charset", "charset",
+          "spinbutton_port", "port",
+          "checkbutton_ignore_invites", "ignore-invites",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+    }
+
+  return box;
+}
+
+static GtkWidget *
+account_widget_build_groupwise (TpawAccountWidget *self,
+    const char *filename)
+{
+  GtkWidget *box;
+
+  if (self->priv->simple)
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "vbox_groupwise_simple", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id_simple", "account",
+          "entry_password_simple", "password",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id_simple");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui,
+            "remember_password_simple"));
+    }
+  else
+    {
+      self->ui_details->gui = empathy_builder_get_resource (filename,
+          "grid_common_groupwise_settings", &self->priv->grid_common_settings,
+          "vbox_groupwise_settings", &box,
+          NULL);
+
+      tpaw_account_widget_handle_params (self,
+          "entry_id", "account",
+          "entry_password", "password",
+          "entry_server", "server",
+          "spinbutton_port", "port",
+          NULL);
+
+      self->ui_details->default_focus = g_strdup ("entry_id");
+
+      self->priv->remember_password_widget = GTK_WIDGET (
+          gtk_builder_get_object (self->ui_details->gui, "remember_password"));
+    }
+
+  return box;
+}
+
+void
+tpaw_account_widget_set_other_accounts_exist (TpawAccountWidget *self,
+    gboolean others_exist)
+{
+  self->priv->other_accounts_exist = others_exist;
+
+  if (self->priv->creating_account)
+    account_widget_handle_control_buttons_sensitivity (self);
+}
+
+static void
+do_set_property (GObject *object,
+    guint prop_id,
+    const GValue *value,
+    GParamSpec *pspec)
+{
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (object);
+
+  switch (prop_id)
+    {
+    case PROP_SETTINGS:
+      self->priv->settings = g_value_dup_object (value);
+      break;
+    case PROP_SIMPLE:
+      self->priv->simple = g_value_get_boolean (value);
+      break;
+    case PROP_CREATING_ACCOUNT:
+      self->priv->creating_account = g_value_get_boolean (value);
+      break;
+    case PROP_OTHER_ACCOUNTS_EXIST:
+      tpaw_account_widget_set_other_accounts_exist (
+          TPAW_ACCOUNT_WIDGET (object), g_value_get_boolean (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+do_get_property (GObject *object,
+    guint prop_id,
+    GValue *value,
+    GParamSpec *pspec)
+{
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (object);
+
+  switch (prop_id)
+    {
+    case PROP_PROTOCOL:
+      g_value_set_string (value,
+        empathy_account_settings_get_protocol (self->priv->settings));
+      break;
+    case PROP_SETTINGS:
+      g_value_set_object (value, self->priv->settings);
+      break;
+    case PROP_SIMPLE:
+      g_value_set_boolean (value, self->priv->simple);
+      break;
+    case PROP_CREATING_ACCOUNT:
+      g_value_set_boolean (value, self->priv->creating_account);
+      break;
+    case PROP_OTHER_ACCOUNTS_EXIST:
+      g_value_set_boolean (value, self->priv->other_accounts_exist);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+set_apply_button (TpawAccountWidget *self)
+{
+  GtkWidget *image;
+
+  /* We can't use the stock button as its accelerator ('A') clashes with the
+   * Add button. */
+  gtk_button_set_use_stock (GTK_BUTTON (self->priv->apply_button), FALSE);
+
+  gtk_button_set_label (GTK_BUTTON (self->priv->apply_button), _("A_pply"));
+  gtk_button_set_use_underline (GTK_BUTTON (self->priv->apply_button), TRUE);
+
+  image = gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
+  gtk_button_set_image (GTK_BUTTON (self->priv->apply_button), image);
+}
+
+static void
+presence_changed_cb (TpAccountManager *manager,
+    TpConnectionPresenceType state,
+    const gchar *status,
+    const gchar *message,
+    TpawAccountWidget *self)
+{
+  if (self->priv->destroyed)
+    return;
+
+  if (self->priv->apply_button == NULL)
+    /* This button doesn't exist in 'simple' mode */
+    return;
+
+  if (state > TP_CONNECTION_PRESENCE_TYPE_OFFLINE &&
+      self->priv->creating_account)
+    {
+      /* We are online and creating a new account, display a Login button */
+      GtkWidget *image;
+
+      gtk_button_set_use_stock (GTK_BUTTON (self->priv->apply_button), FALSE);
+      gtk_button_set_label (GTK_BUTTON (self->priv->apply_button),
+          _("L_og in"));
+
+      image = gtk_image_new_from_stock (GTK_STOCK_CONNECT,
+          GTK_ICON_SIZE_BUTTON);
+      gtk_button_set_image (GTK_BUTTON (self->priv->apply_button), image);
+    }
+  else
+    {
+      /* We are offline or modifying an existing account, display
+       * a Save button */
+      set_apply_button (self);
+    }
+}
+
+static void
+account_manager_ready_cb (GObject *source_object,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data);
+  TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
+  GError *error = NULL;
+  TpConnectionPresenceType state;
+
+  if (!tp_proxy_prepare_finish (account_manager, result, &error))
+    {
+      DEBUG ("Failed to prepare account manager: %s", error->message);
+      g_error_free (error);
+      goto out;
+    }
+
+  state = tp_account_manager_get_most_available_presence (account_manager, NULL,
+      NULL);
+
+  /* simulate a presence change so the apply button will be changed
+   * if needed */
+  presence_changed_cb (account_manager, state, NULL, NULL, self);
+
+out:
+  g_object_unref (self);
+}
+
+#define WIDGET(cm, proto) \
+  { #cm, #proto, ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-"#proto".ui", \
+    account_widget_build_##proto }
+
+static void
+add_register_buttons (TpawAccountWidget *self,
+    TpAccount *account)
+{
+  TpProtocol *protocol;
+  GtkWidget *radiobutton_register;
+
+  if (!self->priv->creating_account)
+    return;
+
+  protocol = empathy_account_settings_get_tp_protocol (self->priv->settings);
+  if (protocol == NULL)
+    return;
+
+  if (!tp_protocol_can_register (protocol))
+    return;
+
+  if (account_widget_get_service (self) != NO_SERVICE)
+    return;
+
+  if (self->priv->simple)
+    return;
+
+  self->priv->radiobutton_reuse = gtk_radio_button_new_with_label (NULL,
+      _("This account already exists on the server"));
+  radiobutton_register = gtk_radio_button_new_with_label (
+      gtk_radio_button_get_group (
+        GTK_RADIO_BUTTON (self->priv->radiobutton_reuse)),
+      _("Create a new account on the server"));
+
+  gtk_box_pack_start (GTK_BOX (self), self->priv->radiobutton_reuse, FALSE,
+      FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (self), radiobutton_register, FALSE, FALSE, 0);
+  gtk_box_reorder_child (GTK_BOX (self), self->priv->radiobutton_reuse, 0);
+  gtk_box_reorder_child (GTK_BOX (self), radiobutton_register, 1);
+  gtk_widget_show (self->priv->radiobutton_reuse);
+  gtk_widget_show (radiobutton_register);
+}
+
+static void
+remember_password_toggled_cb (GtkToggleButton *button,
+    TpawAccountWidget *self)
+{
+  empathy_account_settings_set_remember_password (self->priv->settings,
+      gtk_toggle_button_get_active (button));
+
+  if (!self->priv->automatic_change)
+    tpaw_account_widget_changed (self);
+}
+
+static void
+account_settings_password_retrieved_cb (GObject *object,
+    gpointer user_data)
+{
+  TpawAccountWidget *self = user_data;
+  gchar *password;
+
+  password = empathy_account_settings_dup_string (
+      self->priv->settings, "password");
+
+  /* We have to do this so that when we call gtk_entry_set_text,
+   * the ::changed callback doesn't think the user made the
+   * change. This is also used in remember_password_toggled_cb. */
+  self->priv->automatic_change = TRUE;
+
+  if (password != NULL)
+    {
+      gtk_entry_set_text (GTK_ENTRY (self->priv->param_password_widget),
+          password);
+    }
+
+  gtk_toggle_button_set_active (
+      GTK_TOGGLE_BUTTON (self->priv->remember_password_widget),
+      !EMP_STR_EMPTY (password));
+
+  self->priv->automatic_change = FALSE;
+
+  g_free (password);
+}
+
+static void
+do_constructed (GObject *obj)
+{
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (obj);
+  TpAccount *account;
+  const gchar *display_name, *default_display_name;
+  guint i = 0;
+  struct {
+    const gchar *cm_name;
+    const gchar *protocol;
+    const char *file;
+    GtkWidget * (*func)(TpawAccountWidget *self, const gchar *filename);
+  } widgets [] = {
+    { "salut", "local-xmpp", ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-local-xmpp.ui",
+        account_widget_build_salut },
+    WIDGET (gabble, jabber),
+    WIDGET (haze, msn),
+    WIDGET (haze, icq),
+    WIDGET (haze, aim),
+    WIDGET (haze, yahoo),
+    WIDGET (haze, groupwise),
+    WIDGET (idle, irc),
+    WIDGET (sofiasip, sip),
+  };
+  const gchar *protocol, *cm_name;
+  GtkWidget *box;
+
+  account = empathy_account_settings_get_account (self->priv->settings);
+
+  cm_name = empathy_account_settings_get_cm (self->priv->settings);
+  protocol = empathy_account_settings_get_protocol (self->priv->settings);
+
+  for (i = 0 ; i < G_N_ELEMENTS (widgets); i++)
+    {
+      if (!tp_strdiff (widgets[i].cm_name, cm_name) &&
+          !tp_strdiff (widgets[i].protocol, protocol))
+        {
+          box = widgets[i].func (self, widgets[i].file);
+          break;
+        }
+    }
+
+  if (i == G_N_ELEMENTS (widgets))
+    {
+      gchar *filename = ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-generic.ui";
+      box = account_widget_build_generic (self, filename);
+    }
+
+  gtk_container_add (GTK_CONTAINER (self), box);
+
+  /* handle default focus */
+  if (self->ui_details->default_focus != NULL)
+    {
+      GObject *default_focus_entry;
+
+      default_focus_entry = gtk_builder_get_object
+        (self->ui_details->gui, self->ui_details->default_focus);
+      g_signal_connect (default_focus_entry, "realize",
+          G_CALLBACK (gtk_widget_grab_focus),
+          NULL);
+    }
+
+  /* remember password */
+  if (self->priv->param_password_widget != NULL
+      && self->priv->remember_password_widget != NULL
+      && empathy_account_settings_supports_sasl (self->priv->settings))
+    {
+      if (self->priv->simple)
+        {
+          gtk_toggle_button_set_active (
+              GTK_TOGGLE_BUTTON (self->priv->remember_password_widget), TRUE);
+        }
+      else
+        {
+          gchar *password;
+
+          password = empathy_account_settings_dup_string (self->priv->settings,
+              "password");
+
+          /* FIXME: we should enable this checkbox only if the password is
+           * stored for good in the password storage, not only for the session
+           * (bgo #683571) */
+          gtk_toggle_button_set_active (
+              GTK_TOGGLE_BUTTON (self->priv->remember_password_widget),
+              !EMP_STR_EMPTY (password));
+
+          /* The password might not have been retrieved from the
+           * keyring yet. We should update the remember password
+           * toggle button and the password entry when/if it is. */
+          tp_g_signal_connect_object (self->priv->settings,
+              "password-retrieved",
+              G_CALLBACK (account_settings_password_retrieved_cb), self, 0);
+
+          g_free (password);
+        }
+
+      g_signal_connect (self->priv->remember_password_widget, "toggled",
+          G_CALLBACK (remember_password_toggled_cb), self);
+
+      self->priv->automatic_change = TRUE;
+      remember_password_toggled_cb (
+          GTK_TOGGLE_BUTTON (self->priv->remember_password_widget), self);
+      self->priv->automatic_change = FALSE;
+    }
+  else if (self->priv->remember_password_widget != NULL
+      && !empathy_account_settings_supports_sasl (self->priv->settings))
+    {
+      gtk_widget_set_visible (self->priv->remember_password_widget, FALSE);
+      empathy_account_settings_set_remember_password (self->priv->settings,
+          TRUE);
+    }
+
+  /* dup and init the account-manager */
+  self->priv->account_manager = tp_account_manager_dup ();
+
+  g_object_ref (self);
+  tp_proxy_prepare_async (self->priv->account_manager, NULL,
+      account_manager_ready_cb, self);
+
+  /* handle apply and cancel button */
+  self->priv->hbox_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
+
+  gtk_box_set_homogeneous (GTK_BOX (self->priv->hbox_buttons), TRUE);
+
+  self->priv->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+
+  self->priv->apply_button = gtk_button_new ();
+  set_apply_button (self);
+
+  /* We'll change this button to a "Log in" one if we are creating a new
+   * account and are connected. */
+  tp_g_signal_connect_object (self->priv->account_manager,
+      "most-available-presence-changed",
+      G_CALLBACK (presence_changed_cb), obj, 0);
+
+  gtk_box_pack_end (GTK_BOX (self->priv->hbox_buttons),
+      self->priv->apply_button, TRUE, TRUE, 3);
+  gtk_box_pack_end (GTK_BOX (self->priv->hbox_buttons),
+      self->priv->cancel_button, TRUE, TRUE, 3);
+
+  gtk_box_pack_end (GTK_BOX (self), self->priv->hbox_buttons, FALSE,
+      FALSE, 3);
+
+  g_signal_connect (self->priv->cancel_button, "clicked",
+      G_CALLBACK (account_widget_cancel_clicked_cb),
+      self);
+  g_signal_connect (self->priv->apply_button, "clicked",
+      G_CALLBACK (account_widget_apply_clicked_cb),
+      self);
+  gtk_widget_show_all (self->priv->hbox_buttons);
+
+  if (self->priv->creating_account)
+    /* When creating an account, the user might have nothing to enter.
+     * That means that no control interaction might occur,
+     * so we update the control button sensitivity manually.
+     */
+    account_widget_handle_control_buttons_sensitivity (self);
+  else
+    account_widget_set_control_buttons_sensitivity (self, FALSE);
+
+  add_register_buttons (self, account);
+
+  g_clear_object (&self->ui_details->gui);
+
+  display_name = empathy_account_settings_get_display_name (
+      self->priv->settings);
+  default_display_name = tpaw_account_widget_get_default_display_name (self);
+
+  if (tp_strdiff (display_name, default_display_name) &&
+      !self->priv->creating_account)
+    {
+      /* The display name of the account is not the one that we'd assign by
+       * default; assume that the user changed it manually */
+      g_object_set (self->priv->settings, "display-name-overridden", TRUE,
+          NULL);
+    }
+}
+
+static void
+do_dispose (GObject *obj)
+{
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (obj);
+
+  g_clear_object (&self->priv->settings);
+  g_clear_object (&self->priv->account_manager);
+
+  if (G_OBJECT_CLASS (tpaw_account_widget_parent_class)->dispose != NULL)
+    G_OBJECT_CLASS (tpaw_account_widget_parent_class)->dispose (obj);
+}
+
+static void
+do_finalize (GObject *obj)
+{
+  TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (obj);
+
+  g_free (self->ui_details->default_focus);
+  g_slice_free (TpawAccountWidgetUIDetails, self->ui_details);
+
+  g_free (self->priv->jid_suffix);
+
+  if (G_OBJECT_CLASS (tpaw_account_widget_parent_class)->finalize != NULL)
+    G_OBJECT_CLASS (tpaw_account_widget_parent_class)->finalize (obj);
+}
+
+static void
+tpaw_account_widget_class_init (TpawAccountWidgetClass *klass)
+{
+  GObjectClass *oclass = G_OBJECT_CLASS (klass);
+  GParamSpec *param_spec;
+
+  oclass->get_property = do_get_property;
+  oclass->set_property = do_set_property;
+  oclass->constructed = do_constructed;
+  oclass->dispose = do_dispose;
+  oclass->finalize = do_finalize;
+
+  param_spec = g_param_spec_string ("protocol",
+      "protocol", "The protocol of the account",
+      NULL,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (oclass, PROP_PROTOCOL, param_spec);
+
+  param_spec = g_param_spec_object ("settings",
+      "settings", "The settings of the account",
+      EMPATHY_TYPE_ACCOUNT_SETTINGS,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+  g_object_class_install_property (oclass, PROP_SETTINGS, param_spec);
+
+  param_spec = g_param_spec_boolean ("simple",
+      "simple", "Whether the account widget is a simple or an advanced one",
+      FALSE,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+  g_object_class_install_property (oclass, PROP_SIMPLE, param_spec);
+
+  param_spec = g_param_spec_boolean ("creating-account",
+      "creating-account",
+      "TRUE if we're creating an account, FALSE if we're modifying it",
+      FALSE,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+  g_object_class_install_property (oclass, PROP_CREATING_ACCOUNT, param_spec);
+
+  param_spec = g_param_spec_boolean ("other-accounts-exist",
+      "other-accounts-exist",
+      "TRUE if there are any other accounts (even if this isn't yet saved)",
+      FALSE,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+  g_object_class_install_property (oclass, PROP_OTHER_ACCOUNTS_EXIST,
+                  param_spec);
+
+  signals[HANDLE_APPLY] =
+    g_signal_new ("handle-apply", G_TYPE_FROM_CLASS (klass),
+        G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+        g_cclosure_marshal_generic,
+        G_TYPE_NONE,
+        1, G_TYPE_BOOLEAN);
+
+  /* This signal is emitted when an account has been created and enabled. */
+  signals[ACCOUNT_CREATED] =
+      g_signal_new ("account-created", G_TYPE_FROM_CLASS (klass),
+          G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+          g_cclosure_marshal_generic,
+          G_TYPE_NONE,
+          1, G_TYPE_OBJECT);
+
+  signals[CANCELLED] =
+      g_signal_new ("cancelled", G_TYPE_FROM_CLASS (klass),
+          G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+          g_cclosure_marshal_generic,
+          G_TYPE_NONE,
+          0);
+
+  signals[CLOSE] =
+    g_signal_new ("close", G_TYPE_FROM_CLASS (klass),
+        G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+        g_cclosure_marshal_VOID__INT,
+        G_TYPE_NONE,
+        1, G_TYPE_INT);
+
+  g_type_class_add_private (klass, sizeof (TpawAccountWidgetPriv));
+}
+
+static void
+tpaw_account_widget_init (TpawAccountWidget *self)
+{
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), TPAW_TYPE_ACCOUNT_WIDGET,
+        TpawAccountWidgetPriv);
+
+  self->ui_details = g_slice_new0 (TpawAccountWidgetUIDetails);
+}
+
+/* public methods */
+
+void
+tpaw_account_widget_discard_pending_changes (TpawAccountWidget *self)
+{
+  empathy_account_settings_discard_changes (self->priv->settings);
+  self->priv->contains_pending_changes = FALSE;
+}
+
+gboolean
+tpaw_account_widget_contains_pending_changes (TpawAccountWidget *self)
+{
+  return self->priv->contains_pending_changes;
+}
+
+void
+tpaw_account_widget_handle_params (TpawAccountWidget *self,
+    const gchar *first_widget,
+    ...)
+{
+  va_list args;
+
+  va_start (args, first_widget);
+  account_widget_handle_params_valist (self, first_widget, args);
+  va_end (args);
+}
+
+TpawAccountWidget *
+tpaw_account_widget_new_for_protocol (EmpathyAccountSettings *settings,
+    gboolean simple)
+{
+  g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL);
+
+  return g_object_new (TPAW_TYPE_ACCOUNT_WIDGET,
+        "orientation", GTK_ORIENTATION_VERTICAL,
+        "settings", settings,
+        "simple", simple,
+        "creating-account",
+          empathy_account_settings_get_account (settings) == NULL,
+        NULL);
+}
+
+gchar *
+tpaw_account_widget_get_default_display_name (TpawAccountWidget *self)
+{
+  gchar *login_id;
+  const gchar *protocol, *p;
+  gchar *default_display_name;
+  Service service;
+
+  login_id = empathy_account_settings_dup_string (self->priv->settings,
+      "account");
+  protocol = empathy_account_settings_get_protocol (self->priv->settings);
+  service = account_widget_get_service (self);
+
+  if (login_id != NULL)
+    {
+      /* TODO: this should be done in empathy-account-widget-irc */
+      if (!tp_strdiff (protocol, "irc"))
+        {
+          TpawIrcNetwork *network;
+
+          network = tpaw_irc_network_chooser_get_network (
+              self->priv->irc_network_chooser);
+          g_assert (network != NULL);
+
+          /* To translators: The first parameter is the login id and the
+           * second one is the network. The resulting string will be something
+           * like: "MyUserName on freenode".
+           * You should reverse the order of these arguments if the
+           * server should come before the login id in your locale.*/
+          default_display_name = g_strdup_printf (_("%1$s on %2$s"),
+              login_id, tpaw_irc_network_get_name (network));
+        }
+      else if (service == FACEBOOK_SERVICE && self->priv->jid_suffix != NULL)
+        {
+          gchar *tmp;
+
+          tmp = remove_jid_suffix (self, login_id);
+          default_display_name = g_strdup_printf ("Facebook (%s)", tmp);
+          g_free (tmp);
+        }
+      else
+        {
+          default_display_name = g_strdup (login_id);
+        }
+
+      return default_display_name;
+    }
+
+  if ((p = empathy_protocol_name_to_display_name (protocol)) != NULL)
+    protocol = p;
+
+  if (protocol != NULL)
+    {
+      /* To translators: The parameter is the protocol name. The resulting
+       * string will be something like: "Jabber Account" */
+      default_display_name = g_strdup_printf (_("%s Account"), protocol);
+    }
+  else
+    {
+      default_display_name = g_strdup (_("New account"));
+    }
+
+  g_free (login_id);
+
+  return default_display_name;
+}
+
+/* Used by subclass to indicate that widget contains pending changes */
+void
+tpaw_account_widget_changed (TpawAccountWidget *self)
+{
+  account_widget_handle_control_buttons_sensitivity (self);
+  self->priv->contains_pending_changes = TRUE;
+}
+
+void
+tpaw_account_widget_set_account_param (TpawAccountWidget *self,
+    const gchar *account)
+{
+  if (self->priv->param_account_widget == NULL)
+    return;
+
+  gtk_entry_set_text (GTK_ENTRY (self->priv->param_account_widget), account);
+}
+
+void
+tpaw_account_widget_set_password_param (TpawAccountWidget *self,
+    const gchar *account)
+{
+  if (self->priv->param_password_widget == NULL)
+    return;
+
+  gtk_entry_set_text (GTK_ENTRY (self->priv->param_password_widget), account);
+}
+
+EmpathyAccountSettings *
+tpaw_account_widget_get_settings (TpawAccountWidget *self)
+{
+  return self->priv->settings;
+}
+
+void
+tpaw_account_widget_hide_buttons (TpawAccountWidget *self)
+{
+  gtk_widget_hide (self->priv->hbox_buttons);
+}
diff --git a/tp-account-widgets/tpaw-account-widget.h b/tp-account-widgets/tpaw-account-widget.h
new file mode 100644 (file)
index 0000000..261901f
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2006-2007 Imendio AB
+ * Copyright (C) 2007-2008 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
+ *
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ *          Martyn Russell <martyn@imendio.com>
+ */
+
+#ifndef __TPAW_ACCOUNT_WIDGET_H__
+#define __TPAW_ACCOUNT_WIDGET_H__
+
+#include <gtk/gtk.h>
+
+#include "empathy-account-settings.h"
+
+G_BEGIN_DECLS
+
+#define TPAW_TYPE_ACCOUNT_WIDGET tpaw_account_widget_get_type()
+#define TPAW_ACCOUNT_WIDGET(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPAW_TYPE_ACCOUNT_WIDGET, TpawAccountWidget))
+#define TPAW_ACCOUNT_WIDGET_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), TPAW_TYPE_ACCOUNT_WIDGET, TpawAccountWidgetClass))
+#define TPAW_IS_ACCOUNT_WIDGET(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPAW_TYPE_ACCOUNT_WIDGET))
+#define TPAW_IS_ACCOUNT_WIDGET_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), TPAW_TYPE_ACCOUNT_WIDGET))
+#define TPAW_ACCOUNT_WIDGET_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), TPAW_TYPE_ACCOUNT_WIDGET, TpawAccountWidgetClass))
+
+typedef struct _TpawAccountWidgetPriv TpawAccountWidgetPriv;
+typedef struct _TpawAccountWidgetUIDetails TpawAccountWidgetUIDetails;
+
+typedef struct {
+  GtkBox parent;
+
+  TpawAccountWidgetUIDetails *ui_details;
+
+  TpawAccountWidgetPriv *priv;
+} TpawAccountWidget;
+
+typedef struct {
+  GtkBoxClass parent_class;
+} TpawAccountWidgetClass;
+
+GType tpaw_account_widget_get_type (void);
+
+TpawAccountWidget * tpaw_account_widget_new_for_protocol (
+    EmpathyAccountSettings *settings,
+    gboolean simple);
+
+gboolean tpaw_account_widget_contains_pending_changes
+    (TpawAccountWidget *widget);
+void tpaw_account_widget_discard_pending_changes
+    (TpawAccountWidget *widget);
+
+gchar * tpaw_account_widget_get_default_display_name (
+    TpawAccountWidget *widget);
+
+void tpaw_account_widget_set_account_param (TpawAccountWidget *widget,
+    const gchar *account);
+
+void tpaw_account_widget_set_password_param (TpawAccountWidget *self,
+    const gchar *password);
+
+void tpaw_account_widget_set_other_accounts_exist (
+    TpawAccountWidget *self, gboolean others_exist);
+
+void tpaw_account_widget_hide_buttons (TpawAccountWidget *self);
+
+void tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self);
+
+/* protected methods */
+void tpaw_account_widget_changed (TpawAccountWidget *widget);
+
+EmpathyAccountSettings * tpaw_account_widget_get_settings (
+    TpawAccountWidget *self);
+
+G_END_DECLS
+
+#endif /* __TPAW_ACCOUNT_WIDGET_H__ */
diff --git a/tp-account-widgets/tpaw-account-widgets.gresource.xml b/tp-account-widgets/tpaw-account-widgets.gresource.xml
new file mode 100644 (file)
index 0000000..6645041
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/AccountWidgets">
+    <file>tpaw-irc-networks.dtd</file>
+    <file compressed="true">tpaw-account-widget-generic.ui</file>
+    <file compressed="true">tpaw-account-widget-jabber.ui</file>
+    <file compressed="true">tpaw-account-widget-msn.ui</file>
+    <file compressed="true">tpaw-account-widget-sip.ui</file>
+    <file compressed="true">tpaw-account-widget-local-xmpp.ui</file>
+    <file compressed="true">tpaw-account-widget-irc.ui</file>
+    <file compressed="true">tpaw-account-widget-icq.ui</file>
+    <file compressed="true">tpaw-account-widget-yahoo.ui</file>
+    <file compressed="true">tpaw-account-widget-groupwise.ui</file>
+    <file compressed="true">tpaw-account-widget-aim.ui</file>
+  </gresource>
+</gresources>
+
diff --git a/tp-account-widgets/tpaw-irc-network-chooser-dialog.c b/tp-account-widgets/tpaw-irc-network-chooser-dialog.c
new file mode 100644 (file)
index 0000000..2d50b8a
--- /dev/null
@@ -0,0 +1,740 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-irc-network-chooser-dialog.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "tpaw-irc-network-dialog.h"
+#include "tpaw-irc-network-manager.h"
+#include "empathy-live-search.h"
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
+#include "empathy-debug.h"
+
+#include "tpaw-irc-network-chooser-dialog.h"
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetworkChooserDialog)
+
+enum {
+    PROP_SETTINGS = 1,
+    PROP_NETWORK
+};
+
+enum {
+       RESPONSE_RESET = 0
+};
+
+typedef struct {
+    EmpathyAccountSettings *settings;
+    TpawIrcNetwork *network;
+
+    TpawIrcNetworkManager *network_manager;
+    gboolean changed;
+
+    GtkWidget *treeview;
+    GtkListStore *store;
+    GtkTreeModelFilter *filter;
+    GtkWidget *search;
+    GtkWidget *select_button;
+
+    gulong search_sig;
+    gulong activate_sig;
+} TpawIrcNetworkChooserDialogPriv;
+
+enum {
+  COL_NETWORK_OBJ,
+  COL_NETWORK_NAME,
+};
+
+G_DEFINE_TYPE (TpawIrcNetworkChooserDialog, tpaw_irc_network_chooser_dialog,
+    GTK_TYPE_DIALOG);
+
+static void
+tpaw_irc_network_chooser_dialog_set_property (GObject *object,
+    guint prop_id,
+    const GValue *value,
+    GParamSpec *pspec)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_SETTINGS:
+        priv->settings = g_value_dup_object (value);
+        break;
+      case PROP_NETWORK:
+        priv->network = g_value_dup_object (value);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_network_chooser_dialog_get_property (GObject *object,
+    guint prop_id,
+    GValue *value,
+    GParamSpec *pspec)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_SETTINGS:
+        g_value_set_object (value, priv->settings);
+        break;
+      case PROP_NETWORK:
+        g_value_set_object (value, priv->network);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+/* The iter returned by *it is a priv->store iter (not a filter one) */
+static TpawIrcNetwork *
+dup_selected_network (TpawIrcNetworkChooserDialog *self,
+    GtkTreeIter *it)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork *network;
+  GtkTreeSelection *selection;
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+  if (selection == NULL)
+    return NULL;
+
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+    return NULL;
+
+  gtk_tree_model_get (model, &iter, COL_NETWORK_OBJ, &network, -1);
+  g_assert (network != NULL);
+
+  if (it != NULL)
+    {
+      gtk_tree_model_filter_convert_iter_to_child_iter (priv->filter, it,
+          &iter);
+    }
+
+  return network;
+}
+
+static void
+treeview_changed_cb (GtkTreeView *treeview,
+    TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork *network;
+
+  network = dup_selected_network (self, NULL);
+  if (network == priv->network)
+    {
+      g_clear_object (&network);
+      return;
+    }
+
+  tp_clear_object (&priv->network);
+  /* Transfer the reference */
+  priv->network = network;
+
+  priv->changed = TRUE;
+}
+
+/* Take a filter iterator as argument */
+static void
+scroll_to_iter (TpawIrcNetworkChooserDialog *self,
+    GtkTreeIter *filter_iter)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GtkTreePath *path;
+
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->filter), filter_iter);
+
+  if (path != NULL)
+    {
+      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->treeview),
+          path, NULL, FALSE, 0, 0);
+
+      gtk_tree_path_free (path);
+    }
+}
+
+/* Take a filter iterator as argument */
+static void
+select_iter (TpawIrcNetworkChooserDialog *self,
+    GtkTreeIter *filter_iter,
+    gboolean emulate_changed)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GtkTreeSelection *selection;
+  GtkTreePath *path;
+
+  /* Select the network */
+  selection = gtk_tree_view_get_selection (
+      GTK_TREE_VIEW (priv->treeview));
+
+  gtk_tree_selection_select_iter (selection, filter_iter);
+
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->filter), filter_iter);
+  if (path != NULL)
+    {
+      gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->treeview), path,
+          NULL, FALSE);
+
+      gtk_tree_path_free (path);
+    }
+
+  /* Scroll to the selected network */
+  scroll_to_iter (self, filter_iter);
+
+  if (emulate_changed)
+    {
+      /* gtk_tree_selection_select_iter doesn't fire the 'cursor-changed' signal
+       * so we call the callback manually. */
+      treeview_changed_cb (GTK_TREE_VIEW (priv->treeview), self);
+    }
+}
+
+static GtkTreeIter
+iter_to_filter_iter (TpawIrcNetworkChooserDialog *self,
+    GtkTreeIter *iter)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GtkTreeIter filter_iter;
+
+  g_assert (gtk_tree_model_filter_convert_child_iter_to_iter (priv->filter,
+        &filter_iter, iter));
+
+  return filter_iter;
+}
+
+static void
+fill_store (TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GSList *networks, *l;
+
+  networks = tpaw_irc_network_manager_get_networks (
+      priv->network_manager);
+
+  for (l = networks; l != NULL; l = g_slist_next (l))
+    {
+      TpawIrcNetwork *network = l->data;
+      GtkTreeIter iter;
+
+      gtk_list_store_insert_with_values (priv->store, &iter, -1,
+          COL_NETWORK_OBJ, network,
+          COL_NETWORK_NAME, tpaw_irc_network_get_name (network),
+          -1);
+
+      if (network == priv->network)
+        {
+          GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter);
+
+          select_iter (self, &filter_iter, FALSE);
+        }
+
+      g_object_unref (network);
+    }
+
+  g_slist_free (networks);
+}
+
+static void
+irc_network_dialog_destroy_cb (GtkWidget *widget,
+    TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork *network;
+  GtkTreeIter iter, filter_iter;
+
+  priv->changed = TRUE;
+
+  network = dup_selected_network (self, &iter);
+  if (network == NULL)
+    return;
+
+  /* name could be changed */
+  gtk_list_store_set (GTK_LIST_STORE (priv->store), &iter,
+      COL_NETWORK_NAME, tpaw_irc_network_get_name (network), -1);
+
+  filter_iter = iter_to_filter_iter (self, &iter);
+  scroll_to_iter (self, &filter_iter);
+
+  gtk_widget_grab_focus (priv->treeview);
+
+  g_object_unref (network);
+}
+
+static void
+display_irc_network_dialog (TpawIrcNetworkChooserDialog *self,
+    TpawIrcNetwork *network)
+{
+  GtkWidget *dialog;
+
+  dialog = tpaw_irc_network_dialog_show (network, GTK_WIDGET (self));
+
+  g_signal_connect (dialog, "destroy",
+      G_CALLBACK (irc_network_dialog_destroy_cb), self);
+}
+
+static void
+edit_network (TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetwork *network;
+
+  network = dup_selected_network (self, NULL);
+  if (network == NULL)
+    return;
+
+  display_irc_network_dialog (self, network);
+
+  g_object_unref (network);
+}
+
+static void
+add_network (TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork *network;
+  GtkTreeIter iter, filter_iter;
+
+  gtk_widget_hide (priv->search);
+
+  network = tpaw_irc_network_new (_("New Network"));
+  tpaw_irc_network_manager_add (priv->network_manager, network);
+
+  gtk_list_store_insert_with_values (priv->store, &iter, -1,
+      COL_NETWORK_OBJ, network,
+      COL_NETWORK_NAME, tpaw_irc_network_get_name (network),
+      -1);
+
+  filter_iter = iter_to_filter_iter (self, &iter);
+  select_iter (self, &filter_iter, TRUE);
+
+  display_irc_network_dialog (self, network);
+
+  g_object_unref (network);
+}
+
+static void
+remove_network (TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork *network;
+  GtkTreeIter iter;
+
+  network = dup_selected_network (self, &iter);
+  if (network == NULL)
+    return;
+
+  /* Hide the search after picking the network to get the right one */
+  gtk_widget_hide (priv->search);
+
+  DEBUG ("Remove network %s", tpaw_irc_network_get_name (network));
+
+  /* Delete network and select next network */
+  if (gtk_list_store_remove (priv->store, &iter))
+    {
+      GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter);
+
+      select_iter (self, &filter_iter, TRUE);
+    }
+  else
+    {
+      /* this should only happen if the last network was deleted */
+      GtkTreeIter last, filter_iter;
+      gint n_elements;
+
+      n_elements = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store),
+          NULL);
+
+      if (n_elements > 0)
+        {
+          gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->store), &last,
+              NULL, (n_elements-1));
+          filter_iter = iter_to_filter_iter (self, &last);
+
+          select_iter (self, &filter_iter, TRUE);
+        }
+    }
+
+  tpaw_irc_network_manager_remove (priv->network_manager, network);
+  gtk_widget_grab_focus (priv->treeview);
+
+  g_object_unref (network);
+}
+
+static void
+reset_networks (TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GSList *networks, *l;
+
+  networks = tpaw_irc_network_manager_get_dropped_networks (
+      priv->network_manager);
+
+  for (l = networks; l != NULL; l = g_slist_next (l))
+    {
+      TpawIrcNetwork *network;
+      GtkTreeIter iter;
+
+      network = TPAW_IRC_NETWORK (l->data);
+      tpaw_irc_network_activate (network);
+
+      gtk_list_store_insert_with_values (priv->store, &iter, -1,
+          COL_NETWORK_OBJ, network,
+          COL_NETWORK_NAME, tpaw_irc_network_get_name (network),
+          -1);
+    }
+
+  g_slist_foreach (networks, (GFunc) g_object_unref, NULL);
+}
+
+static void
+dialog_response_cb (GtkDialog *dialog,
+    gint response,
+    TpawIrcNetworkChooserDialog *self)
+{
+  if (response == RESPONSE_RESET)
+    reset_networks (self);
+}
+
+static gboolean
+filter_visible_func (GtkTreeModel *model,
+    GtkTreeIter *iter,
+    gpointer user_data)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (user_data);
+  TpawIrcNetwork *network;
+  gboolean visible;
+
+  gtk_tree_model_get (model, iter, COL_NETWORK_OBJ, &network, -1);
+
+  visible = empathy_live_search_match (EMPATHY_LIVE_SEARCH (priv->search),
+      tpaw_irc_network_get_name (network));
+
+  g_object_unref (network);
+  return visible;
+}
+
+static void
+search_activate_cb (GtkWidget *search,
+  TpawIrcNetworkChooserDialog *self)
+{
+  gtk_widget_hide (search);
+  gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
+}
+
+static void
+search_text_notify_cb (EmpathyLiveSearch *search,
+    GParamSpec *pspec,
+    TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GtkTreeIter filter_iter;
+  gboolean sensitive = FALSE;
+
+  gtk_tree_model_filter_refilter (priv->filter);
+
+  /* Is there at least one network in the view ? */
+  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->filter),
+        &filter_iter))
+    {
+      const gchar *text;
+
+      text = empathy_live_search_get_text (EMPATHY_LIVE_SEARCH (priv->search));
+      if (!EMP_STR_EMPTY (text))
+        {
+          /* We are doing a search, select the first matching network */
+          select_iter (self, &filter_iter, TRUE);
+        }
+      else
+        {
+          /* Search has been cancelled. Scroll to the selected network */
+          GtkTreeSelection *selection;
+
+          selection = gtk_tree_view_get_selection (
+              GTK_TREE_VIEW (priv->treeview));
+
+          if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter))
+            scroll_to_iter (self, &filter_iter);
+        }
+
+      sensitive = TRUE;
+    }
+
+  gtk_widget_set_sensitive (priv->select_button, sensitive);
+}
+
+static void
+add_clicked_cb (GtkToolButton *button,
+    TpawIrcNetworkChooserDialog *self)
+{
+  add_network (self);
+}
+
+static void
+remove_clicked_cb (GtkToolButton *button,
+    TpawIrcNetworkChooserDialog *self)
+{
+  remove_network (self);
+}
+
+static void
+edit_clicked_cb (GtkToolButton *button,
+    TpawIrcNetworkChooserDialog *self)
+{
+  edit_network (self);
+}
+
+static void
+tpaw_irc_network_chooser_dialog_constructed (GObject *object)
+{
+  TpawIrcNetworkChooserDialog *self = (TpawIrcNetworkChooserDialog *) object;
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+  GtkDialog *dialog = GTK_DIALOG (self);
+  GtkCellRenderer *renderer;
+  GtkWidget *vbox;
+  GtkTreeViewColumn *column;
+  GtkWidget *scroll;
+  GtkWidget *toolbar;
+  GtkToolItem *item;
+  GtkStyleContext *context;
+
+  g_assert (priv->settings != NULL);
+
+  gtk_window_set_title (GTK_WINDOW (self), _("Choose an IRC network"));
+
+  /* Create store and treeview */
+  priv->store = gtk_list_store_new (2, G_TYPE_OBJECT, G_TYPE_STRING);
+
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
+      COL_NETWORK_NAME,
+      GTK_SORT_ASCENDING);
+
+  priv->treeview = gtk_tree_view_new ();
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE);
+  gtk_tree_view_set_enable_search (GTK_TREE_VIEW (priv->treeview), FALSE);
+
+  column = gtk_tree_view_column_new ();
+  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->treeview), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (column), renderer, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (column),
+      renderer,
+      "text", COL_NETWORK_NAME,
+      NULL);
+
+  /* add the treeview in a GtkScrolledWindow */
+  vbox = gtk_dialog_get_content_area (dialog);
+
+  scroll = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+  gtk_container_add (GTK_CONTAINER (scroll), priv->treeview);
+  gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 6);
+
+  /* Treeview toolbar */
+  toolbar = gtk_toolbar_new ();
+  gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
+  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
+
+  item = gtk_tool_button_new (NULL, "");
+  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "list-add-symbolic");
+  g_signal_connect (item, "clicked", G_CALLBACK (add_clicked_cb), self);
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
+  item = gtk_tool_button_new (NULL, "");
+  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
+      "list-remove-symbolic");
+  g_signal_connect (item, "clicked", G_CALLBACK (remove_clicked_cb), self);
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
+  item = gtk_tool_button_new (NULL, "");
+  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
+      "preferences-system-symbolic");
+  g_signal_connect (item, "clicked", G_CALLBACK (edit_clicked_cb), self);
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
+  context = gtk_widget_get_style_context (scroll);
+  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
+  context = gtk_widget_get_style_context (toolbar);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
+  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
+  /* Live search */
+  priv->search = empathy_live_search_new (priv->treeview);
+
+  gtk_box_pack_start (GTK_BOX (vbox), priv->search, FALSE, TRUE, 0);
+
+  priv->filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (
+          GTK_TREE_MODEL (priv->store), NULL));
+  gtk_tree_model_filter_set_visible_func (priv->filter,
+          filter_visible_func, self, NULL);
+
+  gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview),
+          GTK_TREE_MODEL (priv->filter));
+
+  priv->search_sig = g_signal_connect (priv->search, "notify::text",
+      G_CALLBACK (search_text_notify_cb), self);
+
+  priv->activate_sig = g_signal_connect (priv->search, "activate",
+      G_CALLBACK (search_activate_cb), self);
+
+  /* Add buttons */
+  gtk_dialog_add_buttons (dialog,
+      _("Reset _Networks List"), RESPONSE_RESET,
+      NULL);
+
+  priv->select_button = gtk_dialog_add_button (dialog,
+      C_("verb displayed on a button to select an IRC network", "Select"),
+      GTK_RESPONSE_CLOSE);
+
+  fill_store (self);
+
+  g_signal_connect (priv->treeview, "cursor-changed",
+      G_CALLBACK (treeview_changed_cb), self);
+
+  g_signal_connect (self, "response",
+      G_CALLBACK (dialog_response_cb), self);
+
+  /* Request a side ensuring to display at least some networks */
+  gtk_widget_set_size_request (GTK_WIDGET (self), -1, 300);
+
+  gtk_window_set_modal (GTK_WINDOW (self), TRUE);
+}
+
+static void
+tpaw_irc_network_chooser_dialog_dispose (GObject *object)
+{
+  TpawIrcNetworkManager *self = (TpawIrcNetworkManager *) object;
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+
+  if (priv->search_sig != 0)
+    {
+      g_signal_handler_disconnect (priv->search, priv->search_sig);
+      priv->search_sig = 0;
+    }
+
+  if (priv->activate_sig != 0)
+    {
+      g_signal_handler_disconnect (priv->search, priv->activate_sig);
+      priv->activate_sig = 0;
+    }
+
+  if (priv->search != NULL)
+    {
+      empathy_live_search_set_hook_widget (EMPATHY_LIVE_SEARCH (priv->search),
+          NULL);
+
+      priv->search = NULL;
+    }
+
+  tp_clear_object (&priv->settings);
+  tp_clear_object (&priv->network);
+  tp_clear_object (&priv->network_manager);
+  tp_clear_object (&priv->store);
+  tp_clear_object (&priv->filter);
+
+  if (G_OBJECT_CLASS (tpaw_irc_network_chooser_dialog_parent_class)->dispose)
+    G_OBJECT_CLASS (tpaw_irc_network_chooser_dialog_parent_class)->dispose (object);
+}
+
+static void
+tpaw_irc_network_chooser_dialog_class_init (TpawIrcNetworkChooserDialogClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = tpaw_irc_network_chooser_dialog_get_property;
+  object_class->set_property = tpaw_irc_network_chooser_dialog_set_property;
+  object_class->constructed = tpaw_irc_network_chooser_dialog_constructed;
+  object_class->dispose = tpaw_irc_network_chooser_dialog_dispose;
+
+  g_object_class_install_property (object_class, PROP_SETTINGS,
+    g_param_spec_object ("settings",
+      "Settings",
+      "The EmpathyAccountSettings to show and edit",
+      EMPATHY_TYPE_ACCOUNT_SETTINGS,
+      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  g_object_class_install_property (object_class, PROP_NETWORK,
+    g_param_spec_object ("network",
+      "Network",
+      "The TpawIrcNetwork selected in the treeview",
+      TPAW_TYPE_IRC_NETWORK,
+      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  g_type_class_add_private (object_class,
+      sizeof (TpawIrcNetworkChooserDialogPriv));
+}
+
+static void
+tpaw_irc_network_chooser_dialog_init (TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv;
+
+  priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, TpawIrcNetworkChooserDialogPriv);
+  self->priv = priv;
+
+  priv->network_manager = tpaw_irc_network_manager_dup_default ();
+}
+
+GtkWidget *
+tpaw_irc_network_chooser_dialog_new (EmpathyAccountSettings *settings,
+    TpawIrcNetwork *network,
+    GtkWindow *parent)
+{
+  return g_object_new (TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG,
+      "settings", settings,
+      "network", network,
+      "transient-for", parent,
+      NULL);
+}
+
+TpawIrcNetwork *
+tpaw_irc_network_chooser_dialog_get_network (
+    TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+
+  return priv->network;
+}
+
+gboolean
+tpaw_irc_network_chooser_dialog_get_changed (
+    TpawIrcNetworkChooserDialog *self)
+{
+  TpawIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+
+  return priv->changed;
+}
diff --git a/tp-account-widgets/tpaw-irc-network-chooser-dialog.h b/tp-account-widgets/tpaw-irc-network-chooser-dialog.h
new file mode 100644 (file)
index 0000000..e208029
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_IRC_NETWORK_CHOOSER_DIALOG_H__
+#define __TPAW_IRC_NETWORK_CHOOSER_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+#include "empathy-account-settings.h"
+#include "tpaw-irc-network.h"
+
+G_BEGIN_DECLS
+
+#define TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG (tpaw_irc_network_chooser_dialog_get_type ())
+#define TPAW_IRC_NETWORK_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, TpawIrcNetworkChooserDialog))
+#define TPAW_IRC_NETWORK_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, TpawIrcNetworkChooserDialogClass))
+#define TPAW_IS_IRC_NETWORK_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG))
+#define TPAW_IS_IRC_NETWORK_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG))
+#define TPAW_IRC_NETWORK_CHOOSER_DIALOG_GET_CLASS(o) ( \
+    G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK_CHOOSER_DIALOG, \
+        TpawIrcNetworkChooserDialogClass))
+
+typedef struct {
+  GtkDialog parent;
+
+  /*<private>*/
+  gpointer priv;
+} TpawIrcNetworkChooserDialog;
+
+typedef struct {
+  GtkDialogClass parent_class;
+} TpawIrcNetworkChooserDialogClass;
+
+GType tpaw_irc_network_chooser_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget * tpaw_irc_network_chooser_dialog_new (
+    EmpathyAccountSettings *settings,
+    TpawIrcNetwork *network,
+    GtkWindow *parent);
+
+TpawIrcNetwork * tpaw_irc_network_chooser_dialog_get_network (
+    TpawIrcNetworkChooserDialog *self);
+
+gboolean tpaw_irc_network_chooser_dialog_get_changed (
+    TpawIrcNetworkChooserDialog *self);
+
+G_END_DECLS
+
+#endif /* __TPAW_IRC_NETWORK_CHOOSER_DIALOG_H__ */
diff --git a/tp-account-widgets/tpaw-irc-network-chooser.c b/tp-account-widgets/tpaw-irc-network-chooser.c
new file mode 100644 (file)
index 0000000..9d0ac01
--- /dev/null
@@ -0,0 +1,421 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-irc-network-chooser.h"
+
+#include "tpaw-irc-network-chooser-dialog.h"
+#include "tpaw-irc-network-manager.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT | EMPATHY_DEBUG_IRC
+#include "empathy-debug.h"
+
+#define DEFAULT_IRC_NETWORK "irc.gimp.org"
+#define DEFAULT_IRC_PORT 6667
+#define DEFAULT_IRC_SSL FALSE
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetworkChooser)
+
+enum {
+    PROP_SETTINGS = 1
+};
+
+enum {
+    SIG_CHANGED,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+typedef struct {
+    EmpathyAccountSettings *settings;
+
+    TpawIrcNetworkManager *network_manager;
+    GtkWidget *dialog;
+    /* Displayed network */
+    TpawIrcNetwork *network;
+} TpawIrcNetworkChooserPriv;
+
+G_DEFINE_TYPE (TpawIrcNetworkChooser, tpaw_irc_network_chooser,
+    GTK_TYPE_BUTTON);
+
+static void
+tpaw_irc_network_chooser_set_property (GObject *object,
+    guint prop_id,
+    const GValue *value,
+    GParamSpec *pspec)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_SETTINGS:
+        priv->settings = g_value_dup_object (value);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_network_chooser_get_property (GObject *object,
+    guint prop_id,
+    GValue *value,
+    GParamSpec *pspec)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (object);
+
+  switch (prop_id)
+    {
+      case PROP_SETTINGS:
+        g_value_set_object (value, priv->settings);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+        break;
+    }
+}
+
+static void
+unset_server_params (TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+
+  DEBUG ("Unset server, port and use-ssl");
+  empathy_account_settings_unset (priv->settings, "server");
+  empathy_account_settings_unset (priv->settings, "port");
+  empathy_account_settings_unset (priv->settings, "use-ssl");
+}
+
+static gchar *
+dup_network_service (TpawIrcNetwork *network)
+{
+  /* Account.Service has to be a lower case alphanumeric string which may
+   * also contain '-' but not start with it. */
+#define VALID G_CSET_a_2_z G_CSET_DIGITS "-"
+  gchar *service, *tmp;
+
+  service = g_strdup (tpaw_irc_network_get_name (network));
+  service = g_strstrip (service);
+
+  if (tp_str_empty (service))
+    {
+      g_free (service);
+      return NULL;
+    }
+
+  tmp = service;
+  service = g_ascii_strdown (service, -1);
+  g_free (tmp);
+
+  service = g_strcanon (service, VALID, '-');
+
+  if (service[0] == '-')
+    {
+      tmp = service;
+      service = g_strdup (service + 1);
+
+      g_free (tmp);
+    }
+
+  return service;
+}
+
+static void
+update_server_params (TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+  GSList *servers;
+  const gchar *charset;
+
+  g_assert (priv->network != NULL);
+
+  charset = tpaw_irc_network_get_charset (priv->network);
+  DEBUG ("Setting charset to %s", charset);
+  empathy_account_settings_set (priv->settings, "charset",
+      g_variant_new_string (charset));
+
+  servers = tpaw_irc_network_get_servers (priv->network);
+  if (g_slist_length (servers) > 0)
+    {
+      /* set the first server as CM server */
+      TpawIrcServer *server = servers->data;
+      gchar *address;
+      guint port;
+      gboolean ssl;
+      gchar *service;
+
+      g_object_get (server,
+          "address", &address,
+          "port", &port,
+          "ssl", &ssl,
+          NULL);
+
+      DEBUG ("Setting server to %s", address);
+      empathy_account_settings_set (priv->settings, "server",
+          g_variant_new_string (address));
+      DEBUG ("Setting port to %u", port);
+      empathy_account_settings_set (priv->settings, "port",
+          g_variant_new_uint32 (port));
+      DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" );
+      empathy_account_settings_set (priv->settings, "use-ssl",
+          g_variant_new_boolean (ssl));
+
+      /* Set Account.Service */
+      service = dup_network_service (priv->network);
+      DEBUG ("Setting Service to %s", service);
+      empathy_account_settings_set_service (priv->settings, service);
+
+      g_free (address);
+      g_free (service);
+    }
+  else
+    {
+      /* No server. Unset values */
+      unset_server_params (self);
+    }
+
+  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
+  g_slist_free (servers);
+}
+
+static void
+set_label (TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+
+  g_assert (priv->network != NULL);
+
+  gtk_button_set_label (GTK_BUTTON (self),
+      tpaw_irc_network_get_name (priv->network));
+}
+
+static void
+set_label_from_settings (TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+  gchar *server;
+
+  tp_clear_object (&priv->network);
+
+  server = empathy_account_settings_dup_string (priv->settings, "server");
+
+  if (server != NULL)
+    {
+      TpawIrcServer *srv;
+      gint port;
+      gboolean ssl;
+
+      priv->network = tpaw_irc_network_manager_find_network_by_address (
+          priv->network_manager, server);
+
+      if (priv->network != NULL)
+        {
+          /* The network is known */
+          g_object_ref (priv->network);
+          set_label (self);
+          return;
+        }
+
+      /* We don't have this network. Let's create it */
+      port = empathy_account_settings_get_uint32 (priv->settings, "port");
+      ssl = empathy_account_settings_get_boolean (priv->settings,
+          "use-ssl");
+
+      DEBUG ("Create a network %s", server);
+      priv->network = tpaw_irc_network_new (server);
+      srv = tpaw_irc_server_new (server, port, ssl);
+
+      tpaw_irc_network_append_server (priv->network, srv);
+      tpaw_irc_network_manager_add (priv->network_manager, priv->network);
+
+      set_label (self);
+
+      g_object_unref (srv);
+      g_free (server);
+      return;
+    }
+
+  /* Set default network */
+  priv->network = tpaw_irc_network_manager_find_network_by_address (
+          priv->network_manager, DEFAULT_IRC_NETWORK);
+
+  if (priv->network == NULL)
+    {
+      /* Default network is not known, recreate it */
+      TpawIrcServer *srv;
+
+      priv->network = tpaw_irc_network_new (DEFAULT_IRC_NETWORK);
+
+      srv = tpaw_irc_server_new (DEFAULT_IRC_NETWORK, DEFAULT_IRC_PORT,
+          DEFAULT_IRC_SSL);
+
+      tpaw_irc_network_append_server (priv->network, srv);
+      tpaw_irc_network_manager_add (priv->network_manager, priv->network);
+
+      g_object_unref (srv);
+    }
+
+  set_label (self);
+  update_server_params (self);
+  g_object_ref (priv->network);
+}
+
+static void
+dialog_response_cb (GtkDialog *dialog,
+    gint response,
+    TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+  TpawIrcNetworkChooserDialog *chooser =
+    TPAW_IRC_NETWORK_CHOOSER_DIALOG (priv->dialog);
+
+  if (response != GTK_RESPONSE_CLOSE &&
+      response != GTK_RESPONSE_DELETE_EVENT)
+    return;
+
+  if (tpaw_irc_network_chooser_dialog_get_changed (chooser))
+    {
+      tp_clear_object (&priv->network);
+
+      priv->network = g_object_ref (
+          tpaw_irc_network_chooser_dialog_get_network (chooser));
+
+      update_server_params (self);
+      set_label (self);
+
+      g_signal_emit (self, signals[SIG_CHANGED], 0);
+    }
+
+  gtk_widget_destroy (priv->dialog);
+  priv->dialog = NULL;
+}
+
+static void
+clicked_cb (GtkButton *button,
+    gpointer user_data)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (button);
+  GtkWindow *window;
+
+  if (priv->dialog != NULL)
+    goto out;
+
+  window = empathy_get_toplevel_window (GTK_WIDGET (button));
+
+  priv->dialog = tpaw_irc_network_chooser_dialog_new (priv->settings,
+      priv->network, window);
+  gtk_widget_show_all (priv->dialog);
+
+  tp_g_signal_connect_object (priv->dialog, "response",
+      G_CALLBACK (dialog_response_cb), button, 0);
+
+out:
+  empathy_window_present (GTK_WINDOW (priv->dialog));
+}
+
+static void
+tpaw_irc_network_chooser_constructed (GObject *object)
+{
+  TpawIrcNetworkChooser *self = (TpawIrcNetworkChooser *) object;
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+
+  g_assert (priv->settings != NULL);
+
+  set_label_from_settings (self);
+
+  g_signal_connect (self, "clicked", G_CALLBACK (clicked_cb), self);
+}
+
+static void
+tpaw_irc_network_chooser_dispose (GObject *object)
+{
+  TpawIrcNetworkManager *self = (TpawIrcNetworkManager *) object;
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+
+  tp_clear_object (&priv->settings);
+  tp_clear_object (&priv->network_manager);
+  tp_clear_object (&priv->network);
+
+  if (G_OBJECT_CLASS (tpaw_irc_network_chooser_parent_class)->dispose)
+    G_OBJECT_CLASS (tpaw_irc_network_chooser_parent_class)->dispose (object);
+}
+
+static void
+tpaw_irc_network_chooser_class_init (TpawIrcNetworkChooserClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->get_property = tpaw_irc_network_chooser_get_property;
+  object_class->set_property = tpaw_irc_network_chooser_set_property;
+  object_class->constructed = tpaw_irc_network_chooser_constructed;
+  object_class->dispose = tpaw_irc_network_chooser_dispose;
+
+  g_object_class_install_property (object_class, PROP_SETTINGS,
+    g_param_spec_object ("settings",
+      "Settings",
+      "The EmpathyAccountSettings to show and edit",
+      EMPATHY_TYPE_ACCOUNT_SETTINGS,
+      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+  signals[SIG_CHANGED] = g_signal_new ("changed",
+      G_OBJECT_CLASS_TYPE (object_class),
+      G_SIGNAL_RUN_LAST,
+      0,
+      NULL, NULL,
+      g_cclosure_marshal_generic,
+      G_TYPE_NONE,
+      0);
+
+  g_type_class_add_private (object_class,
+      sizeof (TpawIrcNetworkChooserPriv));
+}
+
+static void
+tpaw_irc_network_chooser_init (TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv;
+
+  priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      TPAW_TYPE_IRC_NETWORK_CHOOSER, TpawIrcNetworkChooserPriv);
+  self->priv = priv;
+
+  priv->network_manager = tpaw_irc_network_manager_dup_default ();
+}
+
+GtkWidget *
+tpaw_irc_network_chooser_new (EmpathyAccountSettings *settings)
+{
+  return g_object_new (TPAW_TYPE_IRC_NETWORK_CHOOSER,
+      "settings", settings,
+      NULL);
+}
+
+TpawIrcNetwork *
+tpaw_irc_network_chooser_get_network (TpawIrcNetworkChooser *self)
+{
+  TpawIrcNetworkChooserPriv *priv = GET_PRIV (self);
+
+  return priv->network;
+}
diff --git a/tp-account-widgets/tpaw-irc-network-chooser.h b/tp-account-widgets/tpaw-irc-network-chooser.h
new file mode 100644 (file)
index 0000000..fcba21a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ * Copyright (C) 2010 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_IRC_NETWORK_CHOOSER_H__
+#define __TPAW_IRC_NETWORK_CHOOSER_H__
+
+#include <gtk/gtk.h>
+
+#include "empathy-account-settings.h"
+#include "tpaw-irc-network.h"
+
+G_BEGIN_DECLS
+
+#define TPAW_TYPE_IRC_NETWORK_CHOOSER (tpaw_irc_network_chooser_get_type ())
+#define TPAW_IRC_NETWORK_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER, TpawIrcNetworkChooser))
+#define TPAW_IRC_NETWORK_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER, TpawIrcNetworkChooserClass))
+#define TPAW_IS_IRC_NETWORK_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER))
+#define TPAW_IS_IRC_NETWORK_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+    TPAW_TYPE_IRC_NETWORK_CHOOSER))
+#define TPAW_IRC_NETWORK_CHOOSER_GET_CLASS(o) ( \
+    G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK_CHOOSER, \
+        TpawIrcNetworkChooserClass))
+
+typedef struct {
+  GtkButton parent;
+
+  /*<private>*/
+  gpointer priv;
+} TpawIrcNetworkChooser;
+
+typedef struct {
+  GtkButtonClass parent_class;
+} TpawIrcNetworkChooserClass;
+
+GType tpaw_irc_network_chooser_get_type (void) G_GNUC_CONST;
+
+GtkWidget * tpaw_irc_network_chooser_new (EmpathyAccountSettings *settings);
+
+TpawIrcNetwork * tpaw_irc_network_chooser_get_network (
+    TpawIrcNetworkChooser *self);
+
+G_END_DECLS
+
+#endif /* __TPAW_IRC_NETWORK_CHOOSER_H__ */
diff --git a/tp-account-widgets/tpaw-irc-network-dialog.c b/tp-account-widgets/tpaw-irc-network-dialog.c
new file mode 100644 (file)
index 0000000..502d2ca
--- /dev/null
@@ -0,0 +1,588 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-irc-network-dialog.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "empathy-ui-utils.h"
+#include "totem-subtitle-encoding.h"
+
+typedef struct {
+  TpawIrcNetwork *network;
+
+  GtkWidget *dialog;
+  GtkWidget *button_close;
+
+  GtkWidget *entry_network;
+  GtkWidget *combobox_charset;
+
+  GtkWidget *treeview_servers;
+  GtkWidget *button_add;
+  GtkWidget *button_remove;
+  GtkWidget *button_up;
+  GtkWidget *button_down;
+} TpawIrcNetworkDialog;
+
+static void
+irc_network_dialog_destroy_cb (GtkWidget *widget,
+                               TpawIrcNetworkDialog *dialog)
+{
+  g_object_unref (dialog->network);
+
+  g_slice_free (TpawIrcNetworkDialog, dialog);
+}
+
+static void
+irc_network_dialog_close_clicked_cb (GtkWidget *widget,
+                                     TpawIrcNetworkDialog *dialog)
+{
+  gtk_widget_destroy (dialog->dialog);
+}
+
+enum {
+  COL_SRV_OBJ,
+  COL_ADR,
+  COL_PORT,
+  COL_SSL
+};
+
+static void
+add_server_to_store (GtkListStore *store,
+                     TpawIrcServer *server,
+                     GtkTreeIter *iter)
+{
+  gchar *address;
+  guint port;
+  gboolean ssl;
+
+  g_object_get (server,
+      "address", &address,
+      "port", &port,
+      "ssl", &ssl,
+      NULL);
+
+  gtk_list_store_insert_with_values (store, iter, -1,
+      COL_SRV_OBJ, server,
+      COL_ADR, address,
+      COL_PORT, port,
+      COL_SSL, ssl,
+      -1);
+
+  g_free (address);
+}
+
+static void
+irc_network_dialog_setup (TpawIrcNetworkDialog *dialog)
+{
+  gchar *name, *charset;
+  GSList *servers, *l;
+  GtkListStore *store;
+
+  g_object_get (dialog->network,
+      "name", &name,
+      "charset", &charset,
+      NULL);
+  gtk_entry_set_text (GTK_ENTRY (dialog->entry_network), name);
+
+  store = GTK_LIST_STORE (gtk_tree_view_get_model (
+        GTK_TREE_VIEW (dialog->treeview_servers)));
+
+  servers = tpaw_irc_network_get_servers (dialog->network);
+  for (l = servers; l != NULL; l = g_slist_next (l))
+    {
+      TpawIrcServer *server = l->data;
+      GtkTreeIter iter;
+
+      add_server_to_store (store, server, &iter);
+    }
+
+  totem_subtitle_encoding_set (GTK_COMBO_BOX (dialog->combobox_charset),
+      charset);
+
+  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
+  g_slist_free (servers);
+  g_free (name);
+  g_free (charset);
+}
+
+static void
+irc_network_dialog_address_edited_cb (GtkCellRendererText *renderer,
+                                      gchar *path,
+                                      gchar *new_text,
+                                      TpawIrcNetworkDialog *dialog)
+{
+  TpawIrcServer *server;
+  GtkTreeModel *model;
+  GtkTreePath  *treepath;
+  GtkTreeIter iter;
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_servers));
+  treepath = gtk_tree_path_new_from_string (path);
+  gtk_tree_model_get_iter (model, &iter, treepath);
+  gtk_tree_model_get (model, &iter,
+      COL_SRV_OBJ, &server,
+      -1);
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+      COL_ADR, new_text,
+      -1);
+
+  g_object_set (server, "address", new_text, NULL);
+
+  gtk_tree_path_free (treepath);
+  g_object_unref (server);
+}
+
+static void
+irc_network_dialog_port_edited_cb (GtkCellRendererText *renderer,
+                                   gchar *path,
+                                   gchar *new_text,
+                                   TpawIrcNetworkDialog *dialog)
+{
+  TpawIrcServer *server;
+  GtkTreeModel *model;
+  GtkTreePath  *treepath;
+  GtkTreeIter iter;
+  guint port;
+
+  port = strtoul (new_text, NULL, 10);
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_servers));
+  treepath = gtk_tree_path_new_from_string (path);
+  gtk_tree_model_get_iter (model, &iter, treepath);
+  gtk_tree_model_get (model, &iter,
+      COL_SRV_OBJ, &server,
+      -1);
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+      COL_PORT, port,
+      -1);
+
+  g_object_set (server, "port", port, NULL);
+
+  gtk_tree_path_free (treepath);
+  g_object_unref (server);
+}
+
+static void
+irc_network_dialog_ssl_toggled_cb (GtkCellRendererText *renderer,
+                                   gchar *path,
+                                   TpawIrcNetworkDialog *dialog)
+{
+  TpawIrcServer *server;
+  GtkTreeModel *model;
+  GtkTreePath  *treepath;
+  GtkTreeIter iter;
+  gboolean ssl;
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_servers));
+  treepath = gtk_tree_path_new_from_string (path);
+  gtk_tree_model_get_iter (model, &iter, treepath);
+  gtk_tree_model_get (model, &iter,
+      COL_SRV_OBJ, &server,
+      COL_SSL, &ssl,
+      -1);
+  ssl = !ssl;
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+      COL_SSL, ssl,
+      -1);
+
+  g_object_set (server, "ssl", ssl, NULL);
+
+  gtk_tree_path_free (treepath);
+  g_object_unref (server);
+}
+
+static gboolean
+irc_network_dialog_network_focus_cb (GtkWidget *widget,
+                                     GdkEventFocus *event,
+                                     TpawIrcNetworkDialog *dialog)
+{
+  const gchar *str;
+
+  str = gtk_entry_get_text (GTK_ENTRY (widget));
+
+  g_object_set (dialog->network, "name", str, NULL);
+
+  return FALSE;
+}
+
+static void
+irc_network_dialog_network_update_buttons (TpawIrcNetworkDialog *dialog)
+{
+  GtkTreeSelection *selection;
+  GtkTreeModel *model;
+  GtkTreePath *path;
+  GtkTreeIter iter;
+  gboolean can_remove = FALSE, can_move_up = FALSE, can_move_down = FALSE;
+  int selected;
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (
+        dialog->treeview_servers));
+
+  if (gtk_tree_selection_get_selected (selection, &model, &iter))
+  {
+    path = gtk_tree_model_get_path (model, &iter);
+
+    selected = gtk_tree_path_get_indices (path)[0];
+
+    can_remove = TRUE;
+    can_move_up = selected > 0;
+    can_move_down =
+      selected < gtk_tree_model_iter_n_children (model, NULL) - 1;
+
+    gtk_tree_path_free (path);
+  }
+
+  gtk_widget_set_sensitive (dialog->button_remove, can_remove);
+  gtk_widget_set_sensitive (dialog->button_up, can_move_up);
+  gtk_widget_set_sensitive (dialog->button_down, can_move_down);
+}
+
+static void
+irc_network_dialog_button_add_clicked_cb (GtkWidget *widget,
+                                          TpawIrcNetworkDialog *dialog)
+{
+  TpawIrcServer *server;
+  GtkListStore *store;
+  GtkTreeIter iter;
+  GtkTreePath *path;
+  GtkTreeViewColumn *column;
+
+  store = GTK_LIST_STORE (gtk_tree_view_get_model (
+        GTK_TREE_VIEW (dialog->treeview_servers)));
+
+  server = tpaw_irc_server_new (_("new server"), 6667, FALSE);
+  tpaw_irc_network_append_server (dialog->network, server);
+  add_server_to_store (store, server, &iter);
+
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
+  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
+      0);
+  gtk_tree_view_set_cursor (GTK_TREE_VIEW (dialog->treeview_servers), path,
+      column, TRUE);
+
+  irc_network_dialog_network_update_buttons (dialog);
+
+  gtk_tree_path_free (path);
+  g_object_unref (server);
+}
+
+static void
+irc_network_dialog_button_remove_clicked_cb (GtkWidget *widget,
+                                             TpawIrcNetworkDialog *dialog)
+{
+  GtkTreeSelection *selection;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  TpawIrcServer *server;
+
+  selection = gtk_tree_view_get_selection (
+      GTK_TREE_VIEW (dialog->treeview_servers));
+
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+    return;
+
+  gtk_tree_model_get (model, &iter, COL_SRV_OBJ, &server, -1);
+
+  gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+  tpaw_irc_network_remove_server (dialog->network, server);
+
+  irc_network_dialog_network_update_buttons (dialog);
+
+  g_object_unref (server);
+}
+
+static void
+irc_network_dialog_button_up_clicked_cb (GtkWidget *widget,
+                                         TpawIrcNetworkDialog *dialog)
+{
+  GtkTreeSelection *selection;
+  GtkTreeModel *model;
+  GtkTreeIter iter, iter_prev;
+  GtkTreePath *path;
+  gint *pos;
+  TpawIrcServer *server;
+
+  selection = gtk_tree_view_get_selection (
+      GTK_TREE_VIEW (dialog->treeview_servers));
+
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+    return;
+
+  path = gtk_tree_model_get_path (model, &iter);
+
+  if (!gtk_tree_path_prev (path))
+  {
+    gtk_tree_path_free (path);
+    return;
+  }
+
+  gtk_tree_model_get (model, &iter, COL_SRV_OBJ, &server, -1);
+
+  gtk_tree_model_get_iter (model, &iter_prev, path);
+  gtk_list_store_swap (GTK_LIST_STORE (model), &iter_prev, &iter);
+
+  pos = gtk_tree_path_get_indices (path);
+  tpaw_irc_network_set_server_position (dialog->network, server, *pos);
+
+  irc_network_dialog_network_update_buttons (dialog);
+
+  g_object_unref (server);
+  gtk_tree_path_free (path);
+}
+
+static void
+irc_network_dialog_button_down_clicked_cb (GtkWidget *widget,
+                                           TpawIrcNetworkDialog *dialog)
+{
+  GtkTreeSelection *selection;
+  GtkTreeModel *model;
+  GtkTreeIter iter, iter_prev;
+  GtkTreePath *path;
+  TpawIrcServer *server;
+  gint *pos;
+
+  selection = gtk_tree_view_get_selection (
+      GTK_TREE_VIEW (dialog->treeview_servers));
+
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+    return;
+
+  path = gtk_tree_model_get_path (model, &iter);
+
+  gtk_tree_path_next (path);
+  if (!gtk_tree_model_get_iter (model, &iter_prev, path))
+    {
+      gtk_tree_path_free (path);
+      return;
+    }
+
+  gtk_tree_model_get (model, &iter, COL_SRV_OBJ, &server, -1);
+
+  gtk_list_store_swap (GTK_LIST_STORE (model), &iter_prev, &iter);
+
+  pos = gtk_tree_path_get_indices (path);
+  tpaw_irc_network_set_server_position (dialog->network, server, *pos);
+
+  irc_network_dialog_network_update_buttons (dialog);
+
+  gtk_tree_path_free (path);
+}
+
+static void
+irc_network_dialog_selection_changed_cb (GtkTreeSelection  *treeselection,
+                                         TpawIrcNetworkDialog *dialog)
+{
+  irc_network_dialog_network_update_buttons (dialog);
+}
+
+static void
+irc_network_dialog_combobox_charset_changed_cb (GtkWidget *combobox,
+                                                TpawIrcNetworkDialog *dialog)
+{
+  const gchar *charset;
+
+  charset = totem_subtitle_encoding_get_selected (GTK_COMBO_BOX (combobox));
+  g_object_set (dialog->network, "charset", charset, NULL);
+}
+
+static void
+change_network (TpawIrcNetworkDialog *dialog,
+                TpawIrcNetwork *network)
+{
+  GtkListStore *store;
+
+  if (dialog->network == network)
+    /* No need to change */
+    return;
+
+  if (dialog->network != NULL)
+    {
+      g_object_unref (dialog->network);
+    }
+
+  dialog->network = network;
+  g_object_ref (network);
+
+  store = GTK_LIST_STORE (gtk_tree_view_get_model (
+        GTK_TREE_VIEW (dialog->treeview_servers)));
+  gtk_list_store_clear (store);
+
+  irc_network_dialog_setup (dialog);
+}
+
+/**
+ * tpaw_irc_network_dialog_show:
+ * @network: the #TpawIrcNetwork to configure
+ * @parent: the parent of this dialog
+ *
+ * Display a dialog to configure a given #TpawIrcNetwork.
+ * This function is a singleton so if a configuration dialog already
+ * exists we use this one to edit the network.
+ *
+ * Returns: The displayed #GtkDialog
+ */
+GtkWidget *
+tpaw_irc_network_dialog_show (TpawIrcNetwork *network,
+                                 GtkWidget *parent)
+{
+  static TpawIrcNetworkDialog *dialog = NULL;
+  GtkBuilder *gui;
+  GtkListStore *store;
+  GtkCellRenderer *renderer;
+  GtkAdjustment *adjustment;
+  GtkTreeSelection *selection;
+  GtkTreeViewColumn *column;
+  GtkWidget *sw, *toolbar;
+  GtkStyleContext *context;
+
+  g_return_val_if_fail (network != NULL, NULL);
+
+  if (dialog != NULL)
+    {
+      change_network (dialog, network);
+      gtk_window_present (GTK_WINDOW (dialog->dialog));
+
+      return dialog->dialog;
+    }
+
+  dialog = g_slice_new0 (TpawIrcNetworkDialog);
+
+  dialog->network = network;
+  g_object_ref (dialog->network);
+
+  gui = empathy_builder_get_resource (ACCOUNT_WIDGETS_RESOURCES_PREFIX "/empathy-account-widget-irc.ui",
+      "irc_network_dialog", &dialog->dialog,
+      "button_close", &dialog->button_close,
+      "entry_network", &dialog->entry_network,
+      "combobox_charset", &dialog->combobox_charset,
+      "treeview_servers", &dialog->treeview_servers,
+      "button_add", &dialog->button_add,
+      "button_remove", &dialog->button_remove,
+      "button_up", &dialog->button_up,
+      "button_down", &dialog->button_down,
+      "scrolledwindow_network_server", &sw,
+      "toolbar_network_server", &toolbar,
+      NULL);
+
+  store = gtk_list_store_new (4, G_TYPE_OBJECT, G_TYPE_STRING,
+      G_TYPE_UINT, G_TYPE_BOOLEAN);
+  gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview_servers),
+      GTK_TREE_MODEL (store));
+  g_object_unref (store);
+
+  /* address */
+  renderer = gtk_cell_renderer_text_new ();
+  g_object_set (renderer, "editable", TRUE, NULL);
+  g_signal_connect (renderer, "edited",
+      G_CALLBACK (irc_network_dialog_address_edited_cb), dialog);
+  gtk_tree_view_insert_column_with_attributes (
+      GTK_TREE_VIEW (dialog->treeview_servers),
+      -1, _("Server"), renderer, "text", COL_ADR,
+      NULL);
+  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
+      0);
+
+  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+  gtk_tree_view_column_set_expand (column, TRUE);
+
+  /* port */
+  adjustment = (GtkAdjustment *) gtk_adjustment_new (6667, 1, G_MAXUINT16,
+      1, 10, 0);
+  renderer = gtk_cell_renderer_spin_new ();
+  g_object_set (renderer,
+      "editable", TRUE,
+      "adjustment", adjustment,
+      NULL);
+  g_signal_connect (renderer, "edited",
+      G_CALLBACK (irc_network_dialog_port_edited_cb), dialog);
+
+  gtk_tree_view_insert_column_with_attributes (
+      GTK_TREE_VIEW (dialog->treeview_servers),
+      -1, _("Port"), renderer, "text", COL_PORT,
+      NULL);
+
+  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
+      1);
+  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+  gtk_tree_view_column_set_expand (column, TRUE);
+
+  /* SSL */
+  renderer = gtk_cell_renderer_toggle_new ();
+  g_object_set (renderer, "activatable", TRUE, NULL);
+  g_signal_connect (renderer, "toggled",
+      G_CALLBACK (irc_network_dialog_ssl_toggled_cb), dialog);
+  gtk_tree_view_insert_column_with_attributes (
+      GTK_TREE_VIEW (dialog->treeview_servers),
+      -1, _("SSL"), renderer, "active", COL_SSL,
+      NULL);
+
+  selection = gtk_tree_view_get_selection (
+      GTK_TREE_VIEW (dialog->treeview_servers));
+  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+
+  column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_servers),
+      2);
+  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+
+  gtk_tree_view_column_set_expand (column, TRUE);
+  /* charset */
+  totem_subtitle_encoding_init (GTK_COMBO_BOX (dialog->combobox_charset));
+
+  irc_network_dialog_setup (dialog);
+
+  empathy_builder_connect (gui, dialog,
+      "irc_network_dialog", "destroy", irc_network_dialog_destroy_cb,
+      "button_close", "clicked", irc_network_dialog_close_clicked_cb,
+      "entry_network", "focus-out-event", irc_network_dialog_network_focus_cb,
+      "button_add", "clicked", irc_network_dialog_button_add_clicked_cb,
+      "button_remove", "clicked", irc_network_dialog_button_remove_clicked_cb,
+      "button_up", "clicked", irc_network_dialog_button_up_clicked_cb,
+      "button_down", "clicked", irc_network_dialog_button_down_clicked_cb,
+      "combobox_charset", "changed", irc_network_dialog_combobox_charset_changed_cb,
+      NULL);
+
+  g_object_unref (gui);
+
+  g_object_add_weak_pointer (G_OBJECT (dialog->dialog),
+      (gpointer) &dialog);
+
+  g_signal_connect (selection, "changed",
+      G_CALLBACK (irc_network_dialog_selection_changed_cb),
+      dialog);
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
+      GTK_WINDOW (parent));
+  gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
+
+  /* join the add/remove toolbar to the treeview */
+  context = gtk_widget_get_style_context (sw);
+  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
+  context = gtk_widget_get_style_context (toolbar);
+  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
+  irc_network_dialog_network_update_buttons (dialog);
+  gtk_widget_show_all (dialog->dialog);
+
+  gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
+
+  return dialog->dialog;
+}
diff --git a/tp-account-widgets/tpaw-irc-network-dialog.h b/tp-account-widgets/tpaw-irc-network-dialog.h
new file mode 100644 (file)
index 0000000..a65754b
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_IRC_NETWORK_DIALOG_H__
+#define __TPAW_IRC_NETWORK_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+#include "tpaw-irc-network.h"
+
+G_BEGIN_DECLS
+
+GtkWidget * tpaw_irc_network_dialog_show (TpawIrcNetwork *network,
+    GtkWidget *parent);
+
+G_END_DECLS
+
+#endif /* __TPAW_IRC_NETWORK_DIALOG_H__ */
diff --git a/tp-account-widgets/tpaw-irc-network-manager.c b/tp-account-widgets/tpaw-irc-network-manager.c
new file mode 100644 (file)
index 0000000..e6fdeba
--- /dev/null
@@ -0,0 +1,852 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-irc-network-manager.h"
+
+#include <sys/stat.h>
+
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_IRC
+#include "empathy-debug.h"
+
+#define IRC_NETWORKS_DTD_RESOURCENAME "/org/gnome/AccountWidgets/tpaw-irc-networks.dtd"
+#define IRC_NETWORKS_FILENAME "irc-networks.xml"
+#define SAVE_TIMER 4
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetworkManager)
+typedef struct {
+  GHashTable *networks;
+
+  gchar *global_file;
+  gchar *user_file;
+  guint last_id;
+
+  /* Do we have to save modifications to the user file ? */
+  gboolean have_to_save;
+  /* Are we loading networks from XML files ? */
+  gboolean loading;
+  /* source id of the autosave timer */
+  gint save_timer_id;
+} TpawIrcNetworkManagerPriv;
+
+/* properties */
+enum
+{
+  PROP_GLOBAL_FILE = 1,
+  PROP_USER_FILE,
+  LAST_PROPERTY
+};
+
+G_DEFINE_TYPE (TpawIrcNetworkManager, tpaw_irc_network_manager,
+    G_TYPE_OBJECT);
+
+static void irc_network_manager_load_servers (
+    TpawIrcNetworkManager *manager);
+static gboolean irc_network_manager_file_parse (
+    TpawIrcNetworkManager *manager, const gchar *filename,
+    gboolean user_defined);
+static gboolean irc_network_manager_file_save (
+    TpawIrcNetworkManager *manager);
+
+static void
+tpaw_irc_network_manager_get_property (GObject *object,
+                                          guint property_id,
+                                          GValue *value,
+                                          GParamSpec *pspec)
+{
+  TpawIrcNetworkManager *self = TPAW_IRC_NETWORK_MANAGER (object);
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  switch (property_id)
+    {
+      case PROP_GLOBAL_FILE:
+        g_value_set_string (value, priv->global_file);
+        break;
+      case PROP_USER_FILE:
+        g_value_set_string (value, priv->user_file);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_network_manager_set_property (GObject *object,
+                                          guint property_id,
+                                          const GValue *value,
+                                          GParamSpec *pspec)
+{
+  TpawIrcNetworkManager *self = TPAW_IRC_NETWORK_MANAGER (object);
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  switch (property_id)
+    {
+      case PROP_GLOBAL_FILE:
+        g_free (priv->global_file);
+        priv->global_file = g_value_dup_string (value);
+        break;
+      case PROP_USER_FILE:
+        g_free (priv->user_file);
+        priv->user_file = g_value_dup_string (value);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static GObject *
+tpaw_irc_network_manager_constructor (GType type,
+                                         guint n_props,
+                                         GObjectConstructParam *props)
+{
+  GObject *obj;
+  TpawIrcNetworkManager *self;
+
+  /* Parent constructor chain */
+  obj = G_OBJECT_CLASS (tpaw_irc_network_manager_parent_class)->
+        constructor (type, n_props, props);
+
+  self = TPAW_IRC_NETWORK_MANAGER (obj);
+  irc_network_manager_load_servers (self);
+
+  return obj;
+}
+
+static void
+tpaw_irc_network_manager_finalize (GObject *object)
+{
+  TpawIrcNetworkManager *self = TPAW_IRC_NETWORK_MANAGER (object);
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  if (priv->save_timer_id > 0)
+    {
+      g_source_remove (priv->save_timer_id);
+    }
+
+  if (priv->have_to_save)
+    {
+      irc_network_manager_file_save (self);
+    }
+
+  g_free (priv->global_file);
+  g_free (priv->user_file);
+
+  g_hash_table_unref (priv->networks);
+
+  G_OBJECT_CLASS (tpaw_irc_network_manager_parent_class)->finalize (object);
+}
+
+static void
+tpaw_irc_network_manager_init (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      TPAW_TYPE_IRC_NETWORK_MANAGER, TpawIrcNetworkManagerPriv);
+
+  self->priv = priv;
+
+  priv->networks = g_hash_table_new_full (g_str_hash, g_str_equal,
+      (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref);
+
+  priv->last_id = 0;
+
+  priv->have_to_save = FALSE;
+  priv->loading = FALSE;
+  priv->save_timer_id = 0;
+}
+
+static void
+tpaw_irc_network_manager_class_init (TpawIrcNetworkManagerClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GParamSpec *param_spec;
+
+  object_class->constructor = tpaw_irc_network_manager_constructor;
+  object_class->get_property = tpaw_irc_network_manager_get_property;
+  object_class->set_property = tpaw_irc_network_manager_set_property;
+
+  g_type_class_add_private (object_class, sizeof (TpawIrcNetworkManagerPriv));
+
+  object_class->finalize = tpaw_irc_network_manager_finalize;
+
+  param_spec = g_param_spec_string (
+      "global-file",
+      "path of the global networks file",
+      "The path of the system-wide filename from which we have to load"
+      " the networks list",
+      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_GLOBAL_FILE, param_spec);
+
+  param_spec = g_param_spec_string (
+      "user-file",
+      "path of the user networks file",
+      "The path of user's  filename from which we have to load"
+      " the networks list and to which we'll save his modifications",
+      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_USER_FILE, param_spec);
+}
+
+/**
+ * tpaw_irc_network_manager_new:
+ * @global_file: the path of the global networks file, or %NULL
+ * @user_file: the path of the user networks file, or %NULL
+ *
+ * Creates a new #TpawIrcNetworkManager
+ *
+ * Returns: a new #TpawIrcNetworkManager
+ */
+TpawIrcNetworkManager *
+tpaw_irc_network_manager_new (const gchar *global_file,
+                                 const gchar *user_file)
+{
+  TpawIrcNetworkManager *manager;
+
+  manager = g_object_new (TPAW_TYPE_IRC_NETWORK_MANAGER,
+      "global-file", global_file,
+      "user-file", user_file,
+      NULL);
+
+  return manager;
+}
+
+static gboolean
+save_timeout (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  priv->save_timer_id = 0;
+  irc_network_manager_file_save (self);
+
+  return FALSE;
+}
+
+static void
+reset_save_timeout (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *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
+network_modified (TpawIrcNetwork *network,
+                  TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  network->user_defined = TRUE;
+
+  if (!priv->loading)
+    {
+      priv->have_to_save = TRUE;
+      reset_save_timeout (self);
+    }
+}
+
+static void
+add_network (TpawIrcNetworkManager *self,
+             TpawIrcNetwork *network,
+             const gchar *id)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  g_hash_table_insert (priv->networks, g_strdup (id), g_object_ref (network));
+
+  g_signal_connect (network, "modified", G_CALLBACK (network_modified), self);
+}
+
+/**
+ * tpaw_irc_network_manager_add:
+ * @manager: an #TpawIrcNetworkManager
+ * @network: the #TpawIrcNetwork to add
+ *
+ * Add an #TpawIrcNetwork to the given #TpawIrcNetworkManager.
+ *
+ */
+void
+tpaw_irc_network_manager_add (TpawIrcNetworkManager *self,
+                                 TpawIrcNetwork *network)
+{
+  TpawIrcNetworkManagerPriv *priv;
+  gchar *id = NULL;
+
+  g_return_if_fail (TPAW_IS_IRC_NETWORK_MANAGER (self));
+  g_return_if_fail (TPAW_IS_IRC_NETWORK (network));
+
+  priv = GET_PRIV (self);
+
+  /* generate an id for this network */
+  do
+    {
+      g_free (id);
+      id = g_strdup_printf ("id%u", ++priv->last_id);
+    } while (g_hash_table_lookup (priv->networks, id) != NULL &&
+        priv->last_id < G_MAXUINT);
+
+  if (priv->last_id == G_MAXUINT)
+    {
+      DEBUG ("Can't add network: too many networks using a similar ID");
+      return;
+    }
+
+  DEBUG ("add server with \"%s\" as ID", id);
+
+  network->user_defined = TRUE;
+  add_network (self, network, id);
+
+  priv->have_to_save = TRUE;
+  reset_save_timeout (self);
+
+  g_free (id);
+}
+
+/**
+ * tpaw_irc_network_manager_remove:
+ * @manager: an #TpawIrcNetworkManager
+ * @network: the #TpawIrcNetwork to remove
+ *
+ * Remove an #TpawIrcNetwork from the given #TpawIrcNetworkManager.
+ *
+ */
+void
+tpaw_irc_network_manager_remove (TpawIrcNetworkManager *self,
+                                    TpawIrcNetwork *network)
+{
+  TpawIrcNetworkManagerPriv *priv;
+
+  g_return_if_fail (TPAW_IS_IRC_NETWORK_MANAGER (self));
+  g_return_if_fail (TPAW_IS_IRC_NETWORK (network));
+
+  priv = GET_PRIV (self);
+
+  network->user_defined = TRUE;
+  network->dropped = TRUE;
+
+  priv->have_to_save = TRUE;
+  reset_save_timeout (self);
+}
+
+static void
+append_active_networks_to_list (const gchar *id,
+                        TpawIrcNetwork *network,
+                        GSList **list)
+{
+  if (network->dropped)
+    return;
+
+  *list = g_slist_prepend (*list, g_object_ref (network));
+}
+
+static void
+append_dropped_networks_to_list (const gchar *id,
+                        TpawIrcNetwork *network,
+                        GSList **list)
+{
+  if (!network->dropped)
+    return;
+
+  *list = g_slist_prepend (*list, g_object_ref (network));
+}
+
+static GSList *
+get_network_list (TpawIrcNetworkManager *self,
+    gboolean get_active)
+{
+  TpawIrcNetworkManagerPriv *priv;
+  GSList *irc_networks = NULL;
+
+  g_return_val_if_fail (TPAW_IS_IRC_NETWORK_MANAGER (self), NULL);
+
+  priv = GET_PRIV (self);
+
+  if (get_active)
+    {
+      g_hash_table_foreach (priv->networks,
+          (GHFunc) append_active_networks_to_list, &irc_networks);
+    }
+  else
+    {
+      g_hash_table_foreach (priv->networks,
+          (GHFunc) append_dropped_networks_to_list, &irc_networks);
+    }
+
+  return irc_networks;
+}
+
+/**
+ * tpaw_irc_network_manager_get_networks:
+ * @manager: an #TpawIrcNetworkManager
+ *
+ * Get the list of #TpawIrcNetwork associated with the given
+ * manager.
+ *
+ * Returns: a new #GSList of refed #TpawIrcNetwork
+ */
+GSList *
+tpaw_irc_network_manager_get_networks (TpawIrcNetworkManager *self)
+{
+  return get_network_list (self, TRUE);
+}
+
+/**
+ * tpaw_irc_network_manager_get_dropped_networks:
+ * @manager: an #TpawIrcNetworkManager
+ *
+ * Get the list of dropped #TpawIrcNetworks associated with the given
+ * manager.
+ *
+ * Returns: a new #GSList of refed dropped #TpawIrcNetworks
+ */
+GSList *
+tpaw_irc_network_manager_get_dropped_networks (TpawIrcNetworkManager *self)
+{
+  return get_network_list (self, FALSE);
+}
+
+/*
+ * API to save/load and parse the irc_networks file.
+ */
+
+static void
+load_global_file (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  if (priv->global_file == NULL)
+    return;
+
+  if (!g_file_test (priv->global_file, G_FILE_TEST_EXISTS))
+    {
+      DEBUG ("Global networks file %s doesn't exist", priv->global_file);
+      return;
+    }
+
+  irc_network_manager_file_parse (self, priv->global_file, FALSE);
+}
+
+static void
+load_user_file (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  if (priv->user_file == NULL)
+    return;
+
+  if (!g_file_test (priv->user_file, G_FILE_TEST_EXISTS))
+    {
+      DEBUG ("User networks file %s doesn't exist", priv->global_file);
+      return;
+    }
+
+  irc_network_manager_file_parse (self, priv->user_file, TRUE);
+}
+
+static void
+irc_network_manager_load_servers (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+
+  priv->loading = TRUE;
+
+  load_global_file (self);
+  load_user_file (self);
+
+  priv->loading = FALSE;
+  priv->have_to_save = FALSE;
+}
+
+static void
+irc_network_manager_parse_irc_server (TpawIrcNetwork *network,
+                                      xmlNodePtr node)
+{
+  xmlNodePtr server_node;
+
+  for (server_node = node->children; server_node;
+      server_node = server_node->next)
+    {
+      gchar *address = NULL, *port = NULL, *ssl = NULL;
+
+      if (strcmp ((const gchar *) server_node->name, "server") != 0)
+        continue;
+
+      address = (gchar *) xmlGetProp (server_node, (const xmlChar *) "address");
+      port = (gchar *) xmlGetProp (server_node, (const xmlChar *) "port");
+      ssl = (gchar *) xmlGetProp (server_node, (const xmlChar *) "ssl");
+
+      if (address != NULL)
+        {
+          gint port_nb = 0;
+          gboolean have_ssl = FALSE;
+          TpawIrcServer *server;
+
+          if (port != NULL)
+            port_nb = strtol (port, NULL, 10);
+
+          if (port_nb <= 0 || port_nb > G_MAXUINT16)
+            port_nb = 6667;
+
+          if (ssl == NULL || strcmp (ssl, "TRUE") == 0)
+            have_ssl = TRUE;
+
+          DEBUG ("parsed server %s port %d ssl %d", address, port_nb, have_ssl);
+
+          server = tpaw_irc_server_new (address, port_nb, have_ssl);
+          tpaw_irc_network_append_server (network, server);
+        }
+
+      if (address)
+        xmlFree (address);
+      if (port)
+        xmlFree (port);
+      if (ssl)
+        xmlFree (ssl);
+    }
+}
+
+static void
+irc_network_manager_parse_irc_network (TpawIrcNetworkManager *self,
+                                       xmlNodePtr node,
+                                       gboolean user_defined)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork  *network;
+  xmlNodePtr child;
+  gchar *str;
+  gchar *id, *name;
+
+  id = (gchar *) xmlGetProp (node, (const xmlChar *) "id");
+  if (xmlHasProp (node, (const xmlChar *) "dropped"))
+    {
+      if (!user_defined)
+        {
+          DEBUG ("the 'dropped' attribute shouldn't be used in the global file");
+        }
+
+      network = g_hash_table_lookup (priv->networks, id);
+      if (network != NULL)
+        {
+          network->dropped = TRUE;
+          network->user_defined = TRUE;
+        }
+       xmlFree (id);
+      return;
+    }
+
+  if (!xmlHasProp (node, (const xmlChar *) "name"))
+    return;
+
+  name = (gchar *) xmlGetProp (node, (const xmlChar *) "name");
+  network = tpaw_irc_network_new (name);
+
+  if (xmlHasProp (node, (const xmlChar *) "network_charset"))
+    {
+      gchar *charset;
+      charset = (gchar *) xmlGetProp (node, (const xmlChar *) "network_charset");
+      g_object_set (network, "charset", charset, NULL);
+      xmlFree (charset);
+    }
+
+  add_network (self, network, id);
+  DEBUG ("add network %s (id %s)", name, id);
+
+  for (child = node->children; child; child = child->next)
+    {
+      gchar *tag;
+
+      tag = (gchar *) child->name;
+      str = (gchar *) xmlNodeGetContent (child);
+
+      if (!str)
+        continue;
+
+      if (strcmp (tag, "servers") == 0)
+        {
+          irc_network_manager_parse_irc_server (network, child);
+        }
+
+      xmlFree (str);
+    }
+
+  network->user_defined = user_defined;
+  g_object_unref (network);
+  xmlFree (name);
+  xmlFree (id);
+}
+
+static gboolean
+irc_network_manager_file_parse (TpawIrcNetworkManager *self,
+                                const gchar *filename,
+                                gboolean user_defined)
+{
+  xmlParserCtxtPtr ctxt;
+  xmlDocPtr doc;
+  xmlNodePtr networks;
+  xmlNodePtr node;
+
+  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_from_resource (doc, IRC_NETWORKS_DTD_RESOURCENAME)) {
+    g_warning ("Failed to validate file:'%s'", filename);
+    xmlFreeDoc (doc);
+    xmlFreeParserCtxt (ctxt);
+    return FALSE;
+  }
+
+  /* The root node, networks. */
+  networks = xmlDocGetRootElement (doc);
+
+  for (node = networks->children; node; node = node->next)
+    {
+      irc_network_manager_parse_irc_network (self, node, user_defined);
+    }
+
+  xmlFreeDoc (doc);
+  xmlFreeParserCtxt (ctxt);
+
+  return TRUE;
+}
+
+static void
+write_network_to_xml (const gchar *id,
+                      TpawIrcNetwork *network,
+                      xmlNodePtr root)
+{
+  xmlNodePtr network_node, servers_node;
+  GSList *servers, *l;
+  gchar *name, *charset;
+
+  if (!network->user_defined)
+    /* no need to write this network to the XML */
+    return;
+
+  network_node = xmlNewChild (root, NULL, (const xmlChar *) "network", NULL);
+  xmlNewProp (network_node, (const xmlChar *) "id", (const xmlChar *) id);
+
+  if (network->dropped)
+    {
+      xmlNewProp (network_node, (const xmlChar *) "dropped",
+          (const xmlChar *)  "1");
+      return;
+    }
+
+  g_object_get (network,
+      "name", &name,
+      "charset", &charset,
+      NULL);
+  xmlNewProp (network_node, (const xmlChar *) "name", (const xmlChar *) name);
+  xmlNewProp (network_node, (const xmlChar *) "network_charset",
+      (const xmlChar *) charset);
+  g_free (name);
+  g_free (charset);
+
+  servers = tpaw_irc_network_get_servers (network);
+
+  servers_node = xmlNewChild (network_node, NULL, (const xmlChar *) "servers",
+      NULL);
+  for (l = servers; l != NULL; l = g_slist_next (l))
+    {
+      TpawIrcServer *server;
+      xmlNodePtr server_node;
+      gchar *address, *tmp;
+      guint port;
+      gboolean ssl;
+
+      server = l->data;
+
+      server_node = xmlNewChild (servers_node, NULL, (const xmlChar *) "server",
+          NULL);
+
+      g_object_get (server,
+          "address", &address,
+          "port", &port,
+          "ssl", &ssl,
+          NULL);
+
+      xmlNewProp (server_node, (const xmlChar *) "address",
+          (const xmlChar *) address);
+
+      tmp = g_strdup_printf ("%u", port);
+      xmlNewProp (server_node, (const xmlChar *) "port",
+          (const xmlChar *) tmp);
+      g_free (tmp);
+
+      xmlNewProp (server_node, (const xmlChar *) "ssl",
+          ssl ? (const xmlChar *) "TRUE": (const xmlChar *) "FALSE");
+
+      g_free (address);
+    }
+
+  /* free the list */
+  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
+  g_slist_free (servers);
+}
+
+static gboolean
+irc_network_manager_file_save (TpawIrcNetworkManager *self)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+  xmlDocPtr doc;
+  xmlNodePtr root;
+
+  if (priv->user_file == NULL)
+    {
+      DEBUG ("can't save: no user file defined");
+      return FALSE;
+    }
+
+  DEBUG ("Saving IRC networks");
+
+  doc = xmlNewDoc ((const xmlChar *)  "1.0");
+  root = xmlNewNode (NULL, (const xmlChar *) "networks");
+  xmlDocSetRootElement (doc, root);
+
+  g_hash_table_foreach (priv->networks, (GHFunc) write_network_to_xml, root);
+
+  /* Make sure the XML is indented properly */
+  xmlIndentTreeOutput = 1;
+
+  xmlSaveFormatFileEnc (priv->user_file, doc, "utf-8", 1);
+  xmlFreeDoc (doc);
+
+  xmlMemoryDump ();
+
+  priv->have_to_save = FALSE;
+
+  return TRUE;
+}
+
+static gboolean
+find_network_by_address (const gchar *id,
+                         TpawIrcNetwork *network,
+                         const gchar *address)
+{
+  GSList *servers, *l;
+  gboolean found = FALSE;
+
+  if (network->dropped)
+    return FALSE;
+
+  servers = tpaw_irc_network_get_servers (network);
+
+  for (l = servers; l != NULL && !found; l = g_slist_next (l))
+    {
+      TpawIrcServer *server = l->data;
+      gchar *_address;
+
+      g_object_get (server, "address", &_address, NULL);
+      found = (_address != NULL && strcmp (address, _address) == 0);
+
+      g_free (_address);
+    }
+
+  g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
+  g_slist_free (servers);
+
+  return found;
+}
+
+/**
+ * tpaw_irc_network_manager_find_network_by_address:
+ * @manager: an #TpawIrcNetworkManager
+ * @address: the server address to look for
+ *
+ * Find the #TpawIrcNetwork which owns an #TpawIrcServer
+ * that has the given address.
+ *
+ * Returns: the found #TpawIrcNetwork, or %NULL if not found.
+ */
+TpawIrcNetwork *
+tpaw_irc_network_manager_find_network_by_address (
+    TpawIrcNetworkManager *self,
+    const gchar *address)
+{
+  TpawIrcNetworkManagerPriv *priv = GET_PRIV (self);
+  TpawIrcNetwork *network;
+
+  g_return_val_if_fail (address != NULL, NULL);
+
+  network = g_hash_table_find (priv->networks,
+      (GHRFunc) find_network_by_address, (gchar *) address);
+
+  return network;
+}
+
+TpawIrcNetworkManager *
+tpaw_irc_network_manager_dup_default (void)
+{
+  static TpawIrcNetworkManager *default_mgr = NULL;
+  gchar *dir, *user_file_with_path, *global_file_with_path;
+
+  if (default_mgr != NULL)
+    return g_object_ref (default_mgr);
+
+  dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
+  g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
+  user_file_with_path = g_build_filename (dir, IRC_NETWORKS_FILENAME, NULL);
+  g_free (dir);
+
+  global_file_with_path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"),
+      "tp-account-widgets", IRC_NETWORKS_FILENAME, NULL);
+  if (!g_file_test (global_file_with_path, G_FILE_TEST_EXISTS))
+    {
+      g_free (global_file_with_path);
+      global_file_with_path = g_build_filename (DATADIR, "empathy",
+          IRC_NETWORKS_FILENAME, NULL);
+    }
+
+  default_mgr = tpaw_irc_network_manager_new (
+      global_file_with_path, user_file_with_path);
+
+  g_object_add_weak_pointer (G_OBJECT (default_mgr), (gpointer *) &default_mgr);
+
+  g_free (global_file_with_path);
+  g_free (user_file_with_path);
+  return default_mgr;
+}
diff --git a/tp-account-widgets/tpaw-irc-network-manager.h b/tp-account-widgets/tpaw-irc-network-manager.h
new file mode 100644 (file)
index 0000000..feb6e28
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_IRC_NETWORK_MANAGER_H__
+#define __TPAW_IRC_NETWORK_MANAGER_H__
+
+#include <glib-object.h>
+
+#include "tpaw-irc-network.h"
+
+G_BEGIN_DECLS
+
+typedef struct _TpawIrcNetworkManager      TpawIrcNetworkManager;
+typedef struct _TpawIrcNetworkManagerClass TpawIrcNetworkManagerClass;
+
+struct _TpawIrcNetworkManager
+{
+  GObject parent;
+  gpointer priv;
+};
+
+struct _TpawIrcNetworkManagerClass
+{
+  GObjectClass parent_class;
+};
+
+GType tpaw_irc_network_manager_get_type (void);
+
+/* TYPE MACROS */
+#define TPAW_TYPE_IRC_NETWORK_MANAGER \
+  (tpaw_irc_network_manager_get_type ())
+#define TPAW_IRC_NETWORK_MANAGER(o) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_IRC_NETWORK_MANAGER, \
+                               TpawIrcNetworkManager))
+#define TPAW_IRC_NETWORK_MANAGER_CLASS(k) \
+  (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_IRC_NETWORK_MANAGER, \
+                            TpawIrcNetworkManagerClass))
+#define TPAW_IS_IRC_NETWORK_MANAGER(o) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_IRC_NETWORK_MANAGER))
+#define TPAW_IS_IRC_NETWORK_MANAGER_CLASS(k) \
+  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_IRC_NETWORK_MANAGER))
+#define TPAW_IRC_NETWORK_MANAGER_GET_CLASS(o) \
+  (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK_MANAGER, \
+                              TpawIrcNetworkManagerClass))
+
+TpawIrcNetworkManager * tpaw_irc_network_manager_new (
+    const gchar *global_file, const gchar *user_file);
+
+TpawIrcNetworkManager * tpaw_irc_network_manager_dup_default (void);
+
+void tpaw_irc_network_manager_add (TpawIrcNetworkManager *manager,
+    TpawIrcNetwork *network);
+
+void tpaw_irc_network_manager_remove (TpawIrcNetworkManager *manager,
+    TpawIrcNetwork *network);
+
+GSList * tpaw_irc_network_manager_get_networks (
+    TpawIrcNetworkManager *manager);
+
+GSList * tpaw_irc_network_manager_get_dropped_networks (
+    TpawIrcNetworkManager *manager);
+
+TpawIrcNetwork * tpaw_irc_network_manager_find_network_by_address (
+    TpawIrcNetworkManager *manager, const gchar *address);
+
+G_END_DECLS
+
+#endif /* __TPAW_IRC_NETWORK_MANAGER_H__ */
diff --git a/tp-account-widgets/tpaw-irc-network.c b/tp-account-widgets/tpaw-irc-network.c
new file mode 100644 (file)
index 0000000..8d45eb3
--- /dev/null
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2007 Guillaume Desmottes
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
+ *
+ * Authors: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-irc-network.h"
+
+#include "empathy-utils.h"
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcNetwork)
+typedef struct
+{
+  gchar *name;
+  gchar *charset;
+  GSList *servers;
+} TpawIrcNetworkPriv;
+
+/* properties */
+enum
+{
+  PROP_NAME = 1,
+  PROP_CHARSET,
+  LAST_PROPERTY
+};
+
+/* signals */
+enum
+{
+  MODIFIED,
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = {0};
+
+G_DEFINE_TYPE (TpawIrcNetwork, tpaw_irc_network, G_TYPE_OBJECT);
+
+static void
+server_modified_cb (TpawIrcServer *server,
+                    TpawIrcNetwork *self)
+{
+  g_signal_emit (self, signals[MODIFIED], 0);
+}
+
+static void
+tpaw_irc_network_get_property (GObject *object,
+                                  guint property_id,
+                                  GValue *value,
+                                  GParamSpec *pspec)
+{
+  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
+  TpawIrcNetworkPriv *priv = GET_PRIV (self);
+
+  switch (property_id)
+    {
+      case PROP_NAME:
+        g_value_set_string (value, priv->name);
+        break;
+      case PROP_CHARSET:
+        g_value_set_string (value, priv->charset);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_network_set_property (GObject *object,
+                                  guint property_id,
+                                  const GValue *value,
+                                  GParamSpec *pspec)
+{
+  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
+  TpawIrcNetworkPriv *priv = GET_PRIV (self);
+
+  switch (property_id)
+    {
+      case PROP_NAME:
+        if (tp_strdiff (priv->name, g_value_get_string (value)))
+          {
+            g_free (priv->name);
+            priv->name = g_value_dup_string (value);
+            g_signal_emit (object, signals[MODIFIED], 0);
+          }
+        break;
+      case PROP_CHARSET:
+        if (tp_strdiff (priv->charset, g_value_get_string (value)))
+          {
+            g_free (priv->charset);
+            priv->charset = g_value_dup_string (value);
+            g_signal_emit (object, signals[MODIFIED], 0);
+          }
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_network_dispose (GObject *object)
+{
+  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
+  TpawIrcNetworkPriv *priv = GET_PRIV (self);
+  GSList *l;
+
+  for (l = priv->servers; l != NULL; l = g_slist_next (l))
+    {
+      g_signal_handlers_disconnect_by_func (l->data,
+          G_CALLBACK (server_modified_cb), self);
+      g_object_unref (l->data);
+    }
+
+  G_OBJECT_CLASS (tpaw_irc_network_parent_class)->dispose (object);
+}
+
+static void
+tpaw_irc_network_finalize (GObject *object)
+{
+  TpawIrcNetwork *self = TPAW_IRC_NETWORK (object);
+  TpawIrcNetworkPriv *priv = GET_PRIV (self);
+
+  g_slist_free (priv->servers);
+  g_free (priv->name);
+  g_free (priv->charset);
+
+  G_OBJECT_CLASS (tpaw_irc_network_parent_class)->finalize (object);
+}
+
+static void
+tpaw_irc_network_init (TpawIrcNetwork *self)
+{
+  TpawIrcNetworkPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      TPAW_TYPE_IRC_NETWORK, TpawIrcNetworkPriv);
+
+  self->priv = priv;
+
+  priv->servers = NULL;
+
+  self->user_defined = TRUE;
+  self->dropped = FALSE;
+}
+
+static void
+tpaw_irc_network_class_init (TpawIrcNetworkClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GParamSpec *param_spec;
+
+  object_class->get_property = tpaw_irc_network_get_property;
+  object_class->set_property = tpaw_irc_network_set_property;
+
+  g_type_class_add_private (object_class, sizeof (TpawIrcNetworkPriv));
+
+  object_class->dispose = tpaw_irc_network_dispose;
+  object_class->finalize = tpaw_irc_network_finalize;
+
+  param_spec = g_param_spec_string (
+      "name",
+      "Network name",
+      "The displayed name of this network",
+      NULL,
+      G_PARAM_READWRITE |
+      G_PARAM_STATIC_NAME |
+      G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_NAME, param_spec);
+
+  param_spec = g_param_spec_string (
+      "charset",
+      "Charset",
+      "The charset to use on this network",
+      "UTF-8",
+      G_PARAM_CONSTRUCT |
+      G_PARAM_READWRITE |
+      G_PARAM_STATIC_NAME |
+      G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_CHARSET, param_spec);
+
+  /**
+   * TpawIrcNetwork::modified:
+   * @network: the object that received the signal
+   *
+   * Emitted when either a property or a server of the network is modified or
+   * when a network is activated.
+   *
+   */
+  signals[MODIFIED] = g_signal_new (
+      "modified",
+      G_OBJECT_CLASS_TYPE (object_class),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+      0,
+      NULL, NULL,
+      g_cclosure_marshal_generic,
+      G_TYPE_NONE, 0);
+}
+
+/**
+ * tpaw_irc_network_activate:
+ * @self: the name of the network
+ *
+ * Activates a #TpawIrcNetwork.
+ *
+ */
+void
+tpaw_irc_network_activate (TpawIrcNetwork *self)
+{
+  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
+  g_return_if_fail (self->dropped);
+
+  self->dropped = FALSE;
+
+  g_signal_emit (self, signals[MODIFIED], 0);
+}
+
+/**
+ * tpaw_irc_network_new:
+ * @name: the name of the network
+ *
+ * Creates a new #TpawIrcNetwork.
+ *
+ * Returns: a new #TpawIrcNetwork
+ */
+TpawIrcNetwork *
+tpaw_irc_network_new (const gchar *name)
+{
+  return g_object_new (TPAW_TYPE_IRC_NETWORK,
+      "name", name,
+      NULL);
+}
+
+/**
+ * tpaw_irc_network_get_servers:
+ * @network: an #TpawIrcNetwork
+ *
+ * Get the list of #TpawIrcServer that belongs to this network.
+ * These servers are sorted according their priority.
+ * So the first one will be the first used when trying to connect to
+ * the network.
+ *
+ * Returns: a new #GSList of refed #TpawIrcServer.
+ */
+GSList *
+tpaw_irc_network_get_servers (TpawIrcNetwork *self)
+{
+  TpawIrcNetworkPriv *priv;
+  GSList *servers = NULL, *l;
+
+  g_return_val_if_fail (TPAW_IS_IRC_NETWORK (self), NULL);
+  priv = GET_PRIV (self);
+
+  for (l = priv->servers; l != NULL; l = g_slist_next (l))
+    {
+      servers = g_slist_prepend (servers, g_object_ref (l->data));
+    }
+
+  return g_slist_reverse (servers);
+}
+
+/**
+ * tpaw_irc_network_append_server:
+ * @network: an #TpawIrcNetwork
+ * @server: the #TpawIrcServer to add
+ *
+ * Add an #TpawIrcServer to the given #TpawIrcNetwork. The server
+ * is added at the last position in network's servers list.
+ *
+ */
+void
+tpaw_irc_network_append_server (TpawIrcNetwork *self,
+                                   TpawIrcServer *server)
+{
+  TpawIrcNetworkPriv *priv;
+
+  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
+  g_return_if_fail (server != NULL && TPAW_IS_IRC_SERVER (server));
+
+  priv = GET_PRIV (self);
+
+  g_return_if_fail (g_slist_find (priv->servers, server) == NULL);
+
+  priv->servers = g_slist_append (priv->servers, g_object_ref (server));
+
+  g_signal_connect (server, "modified", G_CALLBACK (server_modified_cb), self);
+
+  g_signal_emit (self, signals[MODIFIED], 0);
+}
+
+/**
+ * tpaw_irc_network_remove_server:
+ * @network: an #TpawIrcNetwork
+ * @server: the #TpawIrcServer to remove
+ *
+ * Remove an #TpawIrcServer from the servers list of the
+ * given #TpawIrcNetwork.
+ *
+ */
+void
+tpaw_irc_network_remove_server (TpawIrcNetwork *self,
+                                   TpawIrcServer *server)
+{
+  TpawIrcNetworkPriv *priv;
+  GSList *l;
+
+  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
+  g_return_if_fail (server != NULL && TPAW_IS_IRC_SERVER (server));
+
+  priv = GET_PRIV (self);
+
+  l = g_slist_find (priv->servers, server);
+  if (l == NULL)
+    return;
+
+  g_object_unref (l->data);
+  priv->servers = g_slist_delete_link (priv->servers, l);
+  g_signal_handlers_disconnect_by_func (server, G_CALLBACK (server_modified_cb),
+      self);
+
+  g_signal_emit (self, signals[MODIFIED], 0);
+}
+
+/**
+ * tpaw_irc_network_set_server_position:
+ * @network: an #TpawIrcNetwork
+ * @server: the #TpawIrcServer to move
+ * @pos: the position to move the server. If this is negative, or is larger than
+ * the number of servers in the list, the server is moved to the end of the
+ * list.
+ *
+ * Move an #TpawIrcServer in the servers list of the given
+ * #TpawIrcNetwork.
+ *
+ */
+void
+tpaw_irc_network_set_server_position (TpawIrcNetwork *self,
+                                         TpawIrcServer *server,
+                                         gint pos)
+{
+  TpawIrcNetworkPriv *priv;
+  GSList *l;
+
+  g_return_if_fail (TPAW_IS_IRC_NETWORK (self));
+  g_return_if_fail (server != NULL && TPAW_IS_IRC_SERVER (server));
+
+  priv = GET_PRIV (self);
+
+  l = g_slist_find (priv->servers, server);
+  if (l == NULL)
+    return;
+
+  priv->servers = g_slist_delete_link (priv->servers, l);
+  priv->servers = g_slist_insert (priv->servers, server, pos);
+
+  g_signal_emit (self, signals[MODIFIED], 0);
+}
+
+const gchar *
+tpaw_irc_network_get_name (TpawIrcNetwork *self)
+{
+  TpawIrcNetworkPriv *priv = GET_PRIV (self);
+
+  return priv->name;
+}
+
+const gchar *
+tpaw_irc_network_get_charset (TpawIrcNetwork *self)
+{
+  TpawIrcNetworkPriv *priv = GET_PRIV (self);
+
+  return priv->charset;
+}
diff --git a/tp-account-widgets/tpaw-irc-network.h b/tp-account-widgets/tpaw-irc-network.h
new file mode 100644 (file)
index 0000000..9fb414f
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_IRC_NETWORK_H__
+#define __TPAW_IRC_NETWORK_H__
+
+#include <glib-object.h>
+
+#include "tpaw-irc-server.h"
+
+G_BEGIN_DECLS
+
+typedef struct _TpawIrcNetwork TpawIrcNetwork;
+typedef struct _TpawIrcNetworkClass TpawIrcNetworkClass;
+
+struct _TpawIrcNetwork
+{
+  GObject parent;
+  gpointer priv;
+
+  gboolean user_defined;
+  gboolean dropped;
+};
+
+struct _TpawIrcNetworkClass
+{
+    GObjectClass parent_class;
+};
+
+GType tpaw_irc_network_get_type (void);
+
+/* TYPE MACROS */
+#define TPAW_TYPE_IRC_NETWORK (tpaw_irc_network_get_type ())
+#define TPAW_IRC_NETWORK(o) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_IRC_NETWORK, \
+                               TpawIrcNetwork))
+#define TPAW_IRC_NETWORK_CLASS(k) \
+  (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_IRC_NETWORK,\
+                            TpawIrcNetworkClass))
+#define TPAW_IS_IRC_NETWORK(o) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_IRC_NETWORK))
+#define TPAW_IS_IRC_NETWORK_CLASS(k) \
+  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_IRC_NETWORK))
+#define TPAW_IRC_NETWORK_GET_CLASS(o) \
+  (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_NETWORK, \
+                              TpawIrcNetworkClass))
+
+void tpaw_irc_network_activate (TpawIrcNetwork *self);
+
+TpawIrcNetwork * tpaw_irc_network_new (const gchar *name);
+
+GSList * tpaw_irc_network_get_servers (TpawIrcNetwork *network);
+
+void tpaw_irc_network_append_server (TpawIrcNetwork *network,
+    TpawIrcServer *server);
+
+void tpaw_irc_network_remove_server (TpawIrcNetwork *network,
+    TpawIrcServer *server);
+
+void tpaw_irc_network_set_server_position (TpawIrcNetwork *network,
+    TpawIrcServer *server, gint pos);
+
+const gchar * tpaw_irc_network_get_name (TpawIrcNetwork *network);
+
+const gchar * tpaw_irc_network_get_charset (TpawIrcNetwork *network);
+
+G_END_DECLS
+
+#endif /* __TPAW_IRC_NETWORK_H__ */
diff --git a/tp-account-widgets/tpaw-irc-networks.dtd b/tp-account-widgets/tpaw-irc-networks.dtd
new file mode 100644 (file)
index 0000000..599081f
--- /dev/null
@@ -0,0 +1,18 @@
+<!--
+  DTD for tp-account-widgets irc networks.
+  by Xavier Claessens <xclaesse@gmail.com>
+-->
+
+
+<!ELEMENT networks (network*)>
+<!ELEMENT network (servers*)>
+<!ATTLIST network id ID #REQUIRED>
+<!ATTLIST network name CDATA #IMPLIED>
+<!ATTLIST network network_charset CDATA #IMPLIED>
+<!ATTLIST network dropped CDATA #IMPLIED>
+
+<!ELEMENT servers (server*)>
+<!ELEMENT server EMPTY>
+<!ATTLIST server address CDATA #REQUIRED>
+<!ATTLIST server port CDATA #REQUIRED>
+<!ATTLIST server ssl CDATA #REQUIRED>
diff --git a/tp-account-widgets/tpaw-irc-server.c b/tp-account-widgets/tpaw-irc-server.c
new file mode 100644 (file)
index 0000000..aa9b533
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#include "config.h"
+#include "tpaw-irc-server.h"
+
+#include "empathy-utils.h"
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawIrcServer)
+typedef struct
+{
+  gchar *address;
+  guint port;
+  gboolean ssl;
+} TpawIrcServerPriv;
+
+/* properties */
+enum
+{
+  PROP_ADDRESS = 1,
+  PROP_PORT,
+  PROP_SSL,
+  LAST_PROPERTY
+};
+
+/* signals */
+enum
+{
+  MODIFIED,
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = {0};
+
+G_DEFINE_TYPE (TpawIrcServer, tpaw_irc_server, G_TYPE_OBJECT);
+
+static void
+tpaw_irc_server_get_property (GObject *object,
+                                 guint property_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+  TpawIrcServer *self = TPAW_IRC_SERVER (object);
+  TpawIrcServerPriv *priv = GET_PRIV (self);
+
+  switch (property_id)
+    {
+      case PROP_ADDRESS:
+        g_value_set_string (value, priv->address);
+        break;
+      case PROP_PORT:
+        g_value_set_uint (value, priv->port);
+        break;
+      case PROP_SSL:
+        g_value_set_boolean (value, priv->ssl);
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_server_set_property (GObject *object,
+                                 guint property_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+  TpawIrcServer *self = TPAW_IRC_SERVER (object);
+  TpawIrcServerPriv *priv = GET_PRIV (self);
+
+  switch (property_id)
+    {
+      case PROP_ADDRESS:
+        if (tp_strdiff (priv->address, g_value_get_string (value)))
+          {
+            g_free (priv->address);
+            priv->address = g_value_dup_string (value);
+            g_signal_emit (object, signals[MODIFIED], 0);
+          }
+        break;
+      case PROP_PORT:
+        if (priv->port != g_value_get_uint (value))
+          {
+            priv->port = g_value_get_uint (value);
+            g_signal_emit (object, signals[MODIFIED], 0);
+          }
+        break;
+      case PROP_SSL:
+        if (priv->ssl != g_value_get_boolean (value))
+          {
+            priv->ssl = g_value_get_boolean (value);
+            g_signal_emit (object, signals[MODIFIED], 0);
+          }
+        break;
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+tpaw_irc_server_finalize (GObject *object)
+{
+  TpawIrcServer *self = TPAW_IRC_SERVER (object);
+  TpawIrcServerPriv *priv = GET_PRIV (self);
+
+  g_free (priv->address);
+
+  G_OBJECT_CLASS (tpaw_irc_server_parent_class)->finalize (object);
+}
+
+static void
+tpaw_irc_server_init (TpawIrcServer *self)
+{
+  TpawIrcServerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+      TPAW_TYPE_IRC_SERVER, TpawIrcServerPriv);
+
+  self->priv = priv;
+}
+
+static void
+tpaw_irc_server_class_init (TpawIrcServerClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GParamSpec *param_spec;
+
+  object_class->get_property = tpaw_irc_server_get_property;
+  object_class->set_property = tpaw_irc_server_set_property;
+
+  g_type_class_add_private (object_class, sizeof (TpawIrcServerPriv));
+
+  object_class->finalize = tpaw_irc_server_finalize;
+
+  param_spec = g_param_spec_string (
+      "address",
+      "Server address",
+      "The address of this server",
+      NULL,
+      G_PARAM_READWRITE |
+      G_PARAM_STATIC_NAME |
+      G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_ADDRESS, param_spec);
+
+  param_spec = g_param_spec_uint (
+      "port",
+      "Server port",
+      "The port to use to connect on this server",
+      1, G_MAXUINT16, 6667,
+      G_PARAM_READWRITE |
+      G_PARAM_STATIC_NAME |
+      G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_PORT, param_spec);
+
+  param_spec = g_param_spec_boolean (
+      "ssl",
+      "SSL",
+      "If this server needs SSL connection",
+      FALSE,
+      G_PARAM_READWRITE |
+      G_PARAM_STATIC_NAME |
+      G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_SSL, param_spec);
+
+  /**
+   * TpawIrcServer::modified:
+   * @server: the object that received the signal
+   *
+   * Emitted when a property of the server is modified.
+   *
+   */
+  signals[MODIFIED] = g_signal_new (
+      "modified",
+      G_OBJECT_CLASS_TYPE (object_class),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+      0,
+      NULL, NULL,
+      g_cclosure_marshal_generic,
+      G_TYPE_NONE, 0);
+}
+
+/**
+ * tpaw_irc_server_new:
+ * @address: the address
+ * @port: the port
+ * @ssl: %TRUE if the server needs a SSL connection
+ *
+ * Creates a new #TpawIrcServer
+ *
+ * Returns: a new #TpawIrcServer
+ */
+TpawIrcServer *
+tpaw_irc_server_new (const gchar *address,
+                        guint port,
+                        gboolean ssl)
+{
+  return g_object_new (TPAW_TYPE_IRC_SERVER,
+      "address", address,
+      "port", port,
+      "ssl", ssl,
+      NULL);
+}
diff --git a/tp-account-widgets/tpaw-irc-server.h b/tp-account-widgets/tpaw-irc-server.h
new file mode 100644 (file)
index 0000000..ef9e0c8
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2007-2008 Guillaume Desmottes
+ *
+ * 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: Guillaume Desmottes <gdesmott@gnome.org>
+ */
+
+#ifndef __TPAW_IRC_SERVER_H__
+#define __TPAW_IRC_SERVER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpawIrcServer TpawIrcServer;
+typedef struct _TpawIrcServerClass TpawIrcServerClass;
+
+struct _TpawIrcServer
+{
+  GObject parent;
+  gpointer priv;
+};
+
+struct _TpawIrcServerClass
+{
+    GObjectClass parent_class;
+};
+
+GType tpaw_irc_server_get_type (void);
+
+/* TYPE MACROS */
+#define TPAW_TYPE_IRC_SERVER (tpaw_irc_server_get_type ())
+#define TPAW_IRC_SERVER(o)  \
+  (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_IRC_SERVER, TpawIrcServer))
+#define TPAW_IRC_SERVER_CLASS(k) \
+  (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_IRC_SERVER, \
+                            TpawIrcServerClass))
+#define TPAW_IS_IRC_SERVER(o) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_IRC_SERVER))
+#define TPAW_IS_IRC_SERVER_CLASS(k) \
+  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_IRC_SERVER))
+#define TPAW_IRC_SERVER_GET_CLASS(o) \
+  (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_IRC_SERVER,\
+                              TpawIrcServerClass))
+
+TpawIrcServer * tpaw_irc_server_new (const gchar *address, guint port,
+    gboolean ssl);
+
+G_END_DECLS
+
+#endif /* __TPAW_IRC_SERVER_H__ */
index 58074eecfa49d132e3ffc7cc6177d1749b55e595..c0f29e2c744824235523ef96dac93bf22f987ff5 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "config.h"
 
-#include "empathy-accounts-plugin-widget.h"
+#include "tpaw-accounts-plugin-widget.h"
 
 #include <glib/gi18n-lib.h>
 
@@ -30,7 +30,7 @@
 #include <libaccounts-glib/ag-service.h>
 #include <libaccounts-glib/ag-account-service.h>
 
-#include "empathy-account-widget.h"
+#include "tpaw-account-widget.h"
 
 G_DEFINE_TYPE (EmpathyAccountsPluginWidget, empathy_accounts_plugin_widget, GTK_TYPE_BOX)