aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-25 18:18:05 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-25 18:35:05 +0800
commit2e6d8132394680ea42a3ebdc1daad33ff5e07b86 (patch)
tree0bf9179a649dad69089a44270fcf49514a9c80e4 /libempathy-gtk
parent7cfb268c7d96f929646c5eb093e6f07aa8b1abea (diff)
parentd7f82b00ea09c62be272ed2d0c98e9120a722ca9 (diff)
downloadgsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.tar
gsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.tar.gz
gsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.tar.bz2
gsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.tar.lz
gsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.tar.xz
gsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.tar.zst
gsoc2013-empathy-2e6d8132394680ea42a3ebdc1daad33ff5e07b86.zip
Merge branch 'mc5', fixes bug #590165
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/Makefile.am7
-rw-r--r--libempathy-gtk/empathy-account-chooser.c14
-rw-r--r--libempathy-gtk/empathy-account-widget-aim.ui121
-rw-r--r--libempathy-gtk/empathy-account-widget-generic.ui2
-rw-r--r--libempathy-gtk/empathy-account-widget-groupwise.ui116
-rw-r--r--libempathy-gtk/empathy-account-widget-icq.ui121
-rw-r--r--libempathy-gtk/empathy-account-widget-irc.c110
-rw-r--r--libempathy-gtk/empathy-account-widget-irc.h6
-rw-r--r--libempathy-gtk/empathy-account-widget-irc.ui339
-rw-r--r--libempathy-gtk/empathy-account-widget-jabber.ui148
-rw-r--r--libempathy-gtk/empathy-account-widget-local-xmpp.ui (renamed from libempathy-gtk/empathy-account-widget-salut.ui)0
-rw-r--r--libempathy-gtk/empathy-account-widget-msn.ui116
-rw-r--r--libempathy-gtk/empathy-account-widget-private.h47
-rw-r--r--libempathy-gtk/empathy-account-widget-sip.c115
-rw-r--r--libempathy-gtk/empathy-account-widget-sip.h6
-rw-r--r--libempathy-gtk/empathy-account-widget-sip.ui118
-rw-r--r--libempathy-gtk/empathy-account-widget-yahoo.ui121
-rw-r--r--libempathy-gtk/empathy-account-widget.c1834
-rw-r--r--libempathy-gtk/empathy-account-widget.h62
-rw-r--r--libempathy-gtk/empathy-chat.c8
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c2
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c2
-rw-r--r--libempathy-gtk/empathy-irc-network-dialog.c2
-rw-r--r--libempathy-gtk/empathy-log-window.c4
-rw-r--r--libempathy-gtk/empathy-new-message-dialog.c2
-rw-r--r--libempathy-gtk/empathy-profile-chooser.c324
-rw-r--r--libempathy-gtk/empathy-profile-chooser.h69
-rw-r--r--libempathy-gtk/empathy-protocol-chooser.c425
-rw-r--r--libempathy-gtk/empathy-protocol-chooser.h77
-rw-r--r--libempathy-gtk/empathy-share-my-desktop.c2
-rw-r--r--libempathy-gtk/empathy-theme-adium.c6
-rw-r--r--libempathy-gtk/empathy-ui-utils.c12
-rw-r--r--libempathy-gtk/empathy-ui-utils.h3
33 files changed, 2983 insertions, 1358 deletions
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 4c80e9f98..70e11e412 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -53,7 +53,7 @@ libempathy_gtk_handwritten_source = \
empathy-log-window.c \
empathy-new-message-dialog.c \
empathy-presence-chooser.c \
- empathy-profile-chooser.c \
+ empathy-protocol-chooser.c \
empathy-smiley-manager.c \
empathy-sound.c \
empathy-spell.c \
@@ -70,6 +70,7 @@ libempathy_gtk_la_SOURCES = \
# do not distribute generated files
nodist_libempathy_gtk_la_SOURCES =\
+ empathy-account-widget-private.h \
$(BUILT_SOURCES)
libempathy_gtk_la_LIBADD = \
@@ -115,7 +116,7 @@ libempathy_gtk_headers = \
empathy-log-window.h \
empathy-new-message-dialog.h \
empathy-presence-chooser.h \
- empathy-profile-chooser.h \
+ empathy-protocol-chooser.h \
empathy-smiley-manager.h \
empathy-sound.h \
empathy-spell.h \
@@ -145,7 +146,7 @@ ui_DATA = \
empathy-account-widget-jabber.ui \
empathy-account-widget-msn.ui \
empathy-account-widget-sip.ui \
- empathy-account-widget-salut.ui \
+ empathy-account-widget-local-xmpp.ui \
empathy-account-widget-irc.ui \
empathy-account-widget-icq.ui \
empathy-account-widget-yahoo.ui \
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c
index 34ebc7eac..a91b0eb29 100644
--- a/libempathy-gtk/empathy-account-chooser.c
+++ b/libempathy-gtk/empathy-account-chooser.c
@@ -29,8 +29,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mission-control.h>
-
#include <libempathy/empathy-account-manager.h>
#include <libempathy/empathy-utils.h>
@@ -547,7 +545,7 @@ account_chooser_find_account_foreach (GtkTreeModel *model,
gtk_tree_model_get (model, iter, COL_ACCOUNT_POINTER, &account, -1);
- if (empathy_account_equal (account, data->account)) {
+ if (account == data->account) {
data->found = TRUE;
*(data->iter) = *iter;
g_object_unref (account);
@@ -617,7 +615,7 @@ account_chooser_update_iter (EmpathyAccountChooser *chooser,
COL_ACCOUNT_POINTER, &account,
-1);
- icon_name = empathy_icon_name_from_account (account);
+ icon_name = empathy_account_get_icon_name (account);
if (priv->filter) {
is_enabled = priv->filter (account, priv->filter_data);
}
@@ -690,10 +688,8 @@ account_chooser_set_account_foreach (GtkTreeModel *model,
if ((data->account == NULL) != (account == NULL)) {
equal = FALSE;
}
- else if (data->account == account) {
- equal = TRUE;
- } else {
- equal = empathy_account_equal (data->account, account);
+ else {
+ equal = (data->account == account);
}
if (account) {
@@ -779,7 +775,7 @@ empathy_account_chooser_filter_is_connected (EmpathyAccount *account,
{
TpConnectionStatus status;
- g_object_get (account, "status", &status, NULL);
+ g_object_get (account, "connection-status", &status, NULL);
return status == TP_CONNECTION_STATUS_CONNECTED;
}
diff --git a/libempathy-gtk/empathy-account-widget-aim.ui b/libempathy-gtk/empathy-account-widget-aim.ui
index 7f7ac3a60..2dfdde216 100644
--- a/libempathy-gtk/empathy-account-widget-aim.ui
+++ b/libempathy-gtk/empathy-account-widget-aim.ui
@@ -15,7 +15,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -28,8 +28,8 @@
<property name="mnemonic_widget">entry_password</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -63,8 +63,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@@ -91,9 +91,30 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; MyScreenName&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
</packing>
</child>
</object>
@@ -190,4 +211,92 @@
</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>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; MyScreenName&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-generic.ui b/libempathy-gtk/empathy-account-widget-generic.ui
index 649307e06..ae97f3c98 100644
--- a/libempathy-gtk/empathy-account-widget-generic.ui
+++ b/libempathy-gtk/empathy-account-widget-generic.ui
@@ -29,7 +29,7 @@
</packing>
</child>
<child>
- <object class="GtkExpander" id="expander1">
+ <object class="GtkExpander" id="expander_advanced_settings">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
diff --git a/libempathy-gtk/empathy-account-widget-groupwise.ui b/libempathy-gtk/empathy-account-widget-groupwise.ui
index 84157527d..d8ce768f9 100644
--- a/libempathy-gtk/empathy-account-widget-groupwise.ui
+++ b/libempathy-gtk/empathy-account-widget-groupwise.ui
@@ -14,7 +14,7 @@
<child>
<object class="GtkTable" id="table_common_groupwise_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
@@ -56,8 +56,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
@@ -69,8 +69,8 @@
<property name="use_underline">True</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -100,6 +100,24 @@
<property name="y_options"></property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; username&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -194,4 +212,92 @@
</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>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; username&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-icq.ui b/libempathy-gtk/empathy-account-widget-icq.ui
index 5eab0b75b..a36698a09 100644
--- a/libempathy-gtk/empathy-account-widget-icq.ui
+++ b/libempathy-gtk/empathy-account-widget-icq.ui
@@ -15,7 +15,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -28,8 +28,8 @@
<property name="mnemonic_widget">entry_password</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -63,8 +63,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@@ -91,9 +91,30 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; 123456789&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
</packing>
</child>
</object>
@@ -219,4 +240,92 @@
</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>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; 123456789&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c
index c0699b23a..e462aa611 100644
--- a/libempathy-gtk/empathy-account-widget-irc.c
+++ b/libempathy-gtk/empathy-account-widget-irc.c
@@ -27,13 +27,12 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-protocol.h>
-
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-irc-network-manager.h>
#include "empathy-irc-network-dialog.h"
#include "empathy-account-widget.h"
+#include "empathy-account-widget-private.h"
#include "empathy-account-widget-irc.h"
#include "empathy-ui-utils.h"
@@ -43,7 +42,7 @@
#define IRC_NETWORKS_FILENAME "irc-networks.xml"
typedef struct {
- EmpathyAccount *account;
+ EmpathyAccountWidget *self;
EmpathyIrcNetworkManager *network_manager;
GtkWidget *vbox_settings;
@@ -61,17 +60,19 @@ account_widget_irc_destroy_cb (GtkWidget *widget,
EmpathyAccountWidgetIrc *settings)
{
g_object_unref (settings->network_manager);
- g_object_unref (settings->account);
g_slice_free (EmpathyAccountWidgetIrc, settings);
}
static void
unset_server_params (EmpathyAccountWidgetIrc *settings)
{
+ EmpathyAccountSettings *ac_settings;
+
+ g_object_get (settings->self, "settings", &ac_settings, NULL);
DEBUG ("Unset server, port and use-ssl");
- empathy_account_unset_param (settings->account, "server");
- empathy_account_unset_param (settings->account, "port");
- empathy_account_unset_param (settings->account, "use-ssl");
+ empathy_account_settings_unset (ac_settings, "server");
+ empathy_account_settings_unset (ac_settings, "port");
+ empathy_account_settings_unset (ac_settings, "use-ssl");
}
static void
@@ -82,6 +83,9 @@ update_server_params (EmpathyAccountWidgetIrc *settings)
EmpathyIrcNetwork *network;
GSList *servers;
gchar *charset;
+ EmpathyAccountSettings *ac_settings;
+
+ g_object_get (settings->self, "settings", &ac_settings, NULL);
if (!gtk_combo_box_get_active_iter (
GTK_COMBO_BOX (settings->combobox_network), &iter))
@@ -97,7 +101,7 @@ update_server_params (EmpathyAccountWidgetIrc *settings)
g_object_get (network, "charset", &charset, NULL);
DEBUG ("Setting charset to %s", charset);
- empathy_account_set_param_string (settings->account, "charset", charset);
+ empathy_account_settings_set_string (ac_settings, "charset", charset);
g_free (charset);
servers = empathy_irc_network_get_servers (network);
@@ -116,11 +120,11 @@ update_server_params (EmpathyAccountWidgetIrc *settings)
NULL);
DEBUG ("Setting server to %s", address);
- empathy_account_set_param_string (settings->account, "server", address);
+ empathy_account_settings_set_string (ac_settings, "server", address);
DEBUG ("Setting port to %u", port);
- empathy_account_set_param_int (settings->account, "port", port);
+ empathy_account_settings_set_uint32 (ac_settings, "port", port);
DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" );
- empathy_account_set_param_boolean (settings->account, "use-ssl", ssl);
+ empathy_account_settings_set_boolean (ac_settings, "use-ssl", ssl);
g_free (address);
}
@@ -323,25 +327,30 @@ fill_networks_model (EmpathyAccountWidgetIrc *settings,
static void
account_widget_irc_setup (EmpathyAccountWidgetIrc *settings)
{
- gchar *nick = NULL;
- gchar *fullname = NULL;
- gchar *server = NULL;
+ const gchar *nick = NULL;
+ const gchar *fullname = NULL;
+ const gchar *server = NULL;
gint port = 6667;
- gchar *charset;
+ const gchar *charset;
gboolean ssl = FALSE;
EmpathyIrcNetwork *network = NULL;
+ EmpathyAccountSettings *ac_settings;
+
+ g_object_get (settings->self, "settings", &ac_settings, NULL);
- nick = empathy_account_get_param_string (settings->account, "account");
- fullname = empathy_account_get_param_string (settings->account, "fullname");
- server = empathy_account_get_param_string (settings->account, "server");
- charset = empathy_account_get_param_string (settings->account, "charset");
- port = empathy_account_get_param_int (settings->account, "port");
- ssl = empathy_account_get_param_boolean (settings->account, "use-ssl");
+ nick = empathy_account_settings_get_string (ac_settings, "account");
+ fullname = empathy_account_settings_get_string (ac_settings,
+ "fullname");
+ server = empathy_account_settings_get_string (ac_settings, "server");
+ charset = empathy_account_settings_get_string (ac_settings, "charset");
+ port = empathy_account_settings_get_uint32 (ac_settings, "port");
+ ssl = empathy_account_settings_get_boolean (ac_settings, "use-ssl");
if (!nick)
{
nick = g_strdup (g_get_user_name ());
- empathy_account_set_param_string (settings->account, "account", nick);
+ empathy_account_settings_set_string (ac_settings,
+ "account", nick);
}
if (!fullname)
@@ -351,7 +360,8 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings)
{
fullname = g_strdup (nick);
}
- empathy_account_set_param_string (settings->account, "fullname", fullname);
+ empathy_account_settings_set_string (ac_settings,
+ "fullname", fullname);
}
if (server != NULL)
@@ -404,33 +414,20 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings)
fill_networks_model (settings, network);
-
- g_free (nick);
- g_free (fullname);
- g_free (server);
- g_free (charset);
}
-/**
- * empathy_account_widget_irc_new:
- * @account: the #EmpathyAccount to configure
- *
- * Creates a new IRC account widget to configure a given #EmpathyAccount
- *
- * Returns: The toplevel container of the configuration widget
- */
-GtkWidget *
-empathy_account_widget_irc_new (EmpathyAccount *account)
+void
+empathy_account_widget_irc_build (EmpathyAccountWidget *self,
+ const char *filename,
+ GtkWidget **table_common_settings)
{
EmpathyAccountWidgetIrc *settings;
gchar *dir, *user_file_with_path, *global_file_with_path;
- GtkBuilder *gui;
GtkListStore *store;
GtkCellRenderer *renderer;
- gchar *filename;
settings = g_slice_new0 (EmpathyAccountWidgetIrc);
- settings->account = g_object_ref (account);
+ settings->self = self;
dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
@@ -453,13 +450,12 @@ empathy_account_widget_irc_new (EmpathyAccount *account)
g_free (global_file_with_path);
g_free (user_file_with_path);
- filename = empathy_file_lookup ("empathy-account-widget-irc.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_irc_settings", &settings->vbox_settings,
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_irc_settings", table_common_settings,
+ "vbox_irc", &self->ui_details->widget,
+ "table_irc_settings", &settings->vbox_settings,
"combobox_network", &settings->combobox_network,
NULL);
- g_free (filename);
/* Fill the networks combobox */
store = gtk_list_store_new (2, G_TYPE_OBJECT, G_TYPE_STRING);
@@ -483,22 +479,24 @@ empathy_account_widget_irc_new (EmpathyAccount *account)
account_widget_irc_setup (settings);
- empathy_account_widget_handle_params (account, gui,
+ empathy_account_widget_handle_params (self,
"entry_nick", "account",
"entry_fullname", "fullname",
"entry_password", "password",
"entry_quit_message", "quit-message",
NULL);
- empathy_builder_connect (gui, settings,
- "vbox_irc_settings", "destroy", account_widget_irc_destroy_cb,
- "button_network", "clicked", account_widget_irc_button_edit_network_clicked_cb,
- "button_add_network", "clicked", account_widget_irc_button_add_network_clicked_cb,
- "button_remove_network", "clicked", account_widget_irc_button_remove_clicked_cb,
- "combobox_network", "changed", account_widget_irc_combobox_network_changed_cb,
+ empathy_builder_connect (self->ui_details->gui, settings,
+ "table_irc_settings", "destroy", account_widget_irc_destroy_cb,
+ "button_network", "clicked",
+ account_widget_irc_button_edit_network_clicked_cb,
+ "button_add_network", "clicked",
+ account_widget_irc_button_add_network_clicked_cb,
+ "button_remove_network", "clicked",
+ account_widget_irc_button_remove_clicked_cb,
+ "combobox_network", "changed",
+ account_widget_irc_combobox_network_changed_cb,
NULL);
- empathy_account_widget_set_default_focus (gui, "entry_nick");
-
- return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);
+ self->ui_details->default_focus = g_strdup ("entry_nick");
}
diff --git a/libempathy-gtk/empathy-account-widget-irc.h b/libempathy-gtk/empathy-account-widget-irc.h
index 40e58bbc3..022158529 100644
--- a/libempathy-gtk/empathy-account-widget-irc.h
+++ b/libempathy-gtk/empathy-account-widget-irc.h
@@ -22,11 +22,13 @@
#define __EMPATHY_ACCOUNT_WIDGET_IRC_H__
#include <gtk/gtk.h>
-#include <libempathy/empathy-account.h>
+#include <libempathy-gtk/empathy-account-widget.h>
G_BEGIN_DECLS
-GtkWidget * empathy_account_widget_irc_new (EmpathyAccount *account);
+void empathy_account_widget_irc_build (EmpathyAccountWidget *self,
+ const char *filename,
+ GtkWidget **table_common_settings);
G_END_DECLS
diff --git a/libempathy-gtk/empathy-account-widget-irc.ui b/libempathy-gtk/empathy-account-widget-irc.ui
index abb1c9362..a4f7faa7f 100644
--- a/libempathy-gtk/empathy-account-widget-irc.ui
+++ b/libempathy-gtk/empathy-account-widget-irc.ui
@@ -255,207 +255,216 @@
<action-widget response="-7">button_close</action-widget>
</action-widgets>
</object>
- <object class="GtkTable" id="vbox_irc_settings">
+ <object class="GtkVBox" id="vbox_irc">
<property name="visible">True</property>
- <property name="n_rows">5</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkEntry" id="entry_quit_message">
+ <object class="GtkTable" id="table_irc_settings">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_quit_message">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Quit message:</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_fullname">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></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>
- <property name="invisible_char">&#x25CF;</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_password">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Password:</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_fullname">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Real name:</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_nick">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_nick">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Nickname:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">entry_nick</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox174">
- <property name="visible">True</property>
- <property name="spacing">2</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
<child>
- <object class="GtkComboBox" id="combobox_network">
+ <object class="GtkEntry" id="entry_quit_message">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
</object>
<packing>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkButton" id="button_add_network">
+ <object class="GtkLabel" id="label_quit_message">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Quit message:</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_fullname">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-add</property>
- </object>
- </child>
+ <property name="invisible_char">&#x25CF;</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkButton" id="button_network">
+ <object class="GtkEntry" id="entry_password">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="image834">
- <property name="visible">True</property>
- <property name="stock">gtk-edit</property>
- </object>
- </child>
+ <property name="visibility">False</property>
+ <property name="invisible_char">&#x25CF;</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_password">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Password:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_fullname">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Real name:</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkButton" id="button_remove_network">
+ <object class="GtkEntry" id="entry_nick">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_nick">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Nickname:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry_nick</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox174">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkComboBox" id="combobox_network">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_add_network">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
- <object class="GtkImage" id="image835">
+ <object class="GtkButton" id="button_network">
<property name="visible">True</property>
- <property name="stock">gtk-remove</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="image834">
+ <property name="visible">True</property>
+ <property name="stock">gtk-edit</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_remove_network">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="image835">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_network2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Network:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_network2">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Network:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="position">0</property>
</packing>
</child>
</object>
diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui
index 4b0aa15ad..d32182257 100644
--- a/libempathy-gtk/empathy-account-widget-jabber.ui
+++ b/libempathy-gtk/empathy-account-widget-jabber.ui
@@ -21,7 +21,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -35,8 +35,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
@@ -81,8 +81,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -93,15 +93,37 @@
<property name="xalign">0</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>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; user@jabber.org&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -114,7 +136,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkVBox" id="vbox_advanced">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
@@ -227,7 +249,7 @@
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment" id="alignment_server_settings">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
@@ -348,4 +370,112 @@
</packing>
</child>
</object>
+ <object class="GtkVBox" id="vbox_jabber_simple">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</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 Jabber ID?</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_id_create">
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">What is your desired Jabber ID?</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment_simple_jabber_id">
+ <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="top_padding">6</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>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; user@jabber.org&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_password_simple">
+ <property name="visible">True</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="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_password_create">
+ <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="position">4</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.5</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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-salut.ui b/libempathy-gtk/empathy-account-widget-local-xmpp.ui
index ca633309d..ca633309d 100644
--- a/libempathy-gtk/empathy-account-widget-salut.ui
+++ b/libempathy-gtk/empathy-account-widget-local-xmpp.ui
diff --git a/libempathy-gtk/empathy-account-widget-msn.ui b/libempathy-gtk/empathy-account-widget-msn.ui
index 1d7bde038..27de65a2a 100644
--- a/libempathy-gtk/empathy-account-widget-msn.ui
+++ b/libempathy-gtk/empathy-account-widget-msn.ui
@@ -14,7 +14,7 @@
<child>
<object class="GtkTable" id="table_common_msn_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
@@ -56,8 +56,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
@@ -69,8 +69,8 @@
<property name="use_underline">True</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -100,6 +100,24 @@
<property name="y_options"></property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; user@hotmail.com&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -194,4 +212,92 @@
</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 user 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_id_simple">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; user@hotmail.com&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-private.h b/libempathy-gtk/empathy-account-widget-private.h
new file mode 100644
index 000000000..aaa24e58f
--- /dev/null
+++ b/libempathy-gtk/empathy-account-widget-private.h
@@ -0,0 +1,47 @@
+/*
+ * 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 __EMPATHY_ACCOUNT_WIDGET_PRIVATE_H__
+#define __EMPATHY_ACCOUNT_WIDGET_PRIVATE_H__
+
+#include <libempathy-gtk/empathy-account-widget.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+struct _EmpathyAccountWidgetUIDetails {
+ GtkWidget *widget;
+
+ GtkBuilder *gui;
+
+ char *default_focus;
+ gboolean add_forget;
+};
+
+
+void empathy_account_widget_handle_params (EmpathyAccountWidget *self,
+ const gchar *first_widget,
+ ...);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_ACCOUNT_WIDGET_PRIVATE_H__ */ \ No newline at end of file
diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c
index 05e917e53..db39ddae4 100644
--- a/libempathy-gtk/empathy-account-widget-sip.c
+++ b/libempathy-gtk/empathy-account-widget-sip.c
@@ -28,17 +28,15 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-protocol.h>
-
#include <libempathy/empathy-utils.h>
#include "empathy-account-widget.h"
+#include "empathy-account-widget-private.h"
#include "empathy-account-widget-sip.h"
#include "empathy-ui-utils.h"
typedef struct {
- EmpathyAccount *account;
-
+ EmpathyAccountWidget *self;
GtkWidget *vbox_settings;
GtkWidget *entry_stun_server;
@@ -50,7 +48,6 @@ static void
account_widget_sip_destroy_cb (GtkWidget *widget,
EmpathyAccountWidgetSip *settings)
{
- g_object_unref (settings->account);
g_slice_free (EmpathyAccountWidgetSip, settings);
}
@@ -66,55 +63,65 @@ account_widget_sip_discover_stun_toggled_cb (
gtk_widget_set_sensitive (settings->spinbutton_stun_part, !active);
}
-/**
- * empathy_account_widget_sip_new:
- * @account: the #EmpathyAccount to configure
- *
- * Creates a new SIP account widget to configure a given #EmpathyAccount
- *
- * Returns: The toplevel container of the configuration widget
- */
-GtkWidget *
-empathy_account_widget_sip_new (EmpathyAccount *account)
+void
+empathy_account_widget_sip_build (EmpathyAccountWidget *self,
+ const char *filename,
+ GtkWidget **table_common_settings)
{
EmpathyAccountWidgetSip *settings;
- GtkBuilder *gui;
- gchar *filename;
-
- settings = g_slice_new0 (EmpathyAccountWidgetSip);
- settings->account = g_object_ref (account);
-
- filename = empathy_file_lookup ("empathy-account-widget-sip.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_sip_settings", &settings->vbox_settings,
- "entry_stun-server", &settings->entry_stun_server,
- "spinbutton_stun-port", &settings->spinbutton_stun_part,
- "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
- NULL);
- g_free (filename);
-
- empathy_account_widget_handle_params (account, gui,
- "entry_userid", "account",
- "entry_password", "password",
- "checkbutton_discover-stun", "discover-stun",
- "entry_stun-server", "stun-server",
- "spinbutton_stun-port", "stun-port",
- NULL);
-
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
-
- account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
- settings);
-
- empathy_builder_connect (gui, settings,
- "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
- "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
- NULL);
-
- empathy_account_widget_set_default_focus (gui, "entry_userid");
-
- return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);
+ GtkWidget *vbox_settings;
+ gboolean is_simple;
+
+ g_object_get (self, "simple", &is_simple, NULL);
+
+ if (is_simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_sip_simple", &vbox_settings,
+ NULL);
+
+ empathy_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
+ {
+ settings = g_slice_new0 (EmpathyAccountWidgetSip);
+ settings->self = self;
+
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", table_common_settings,
+ "vbox_sip_settings", &vbox_settings,
+ "entry_stun-server", &settings->entry_stun_server,
+ "spinbutton_stun-port", &settings->spinbutton_stun_part,
+ "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
+ NULL);
+ settings->vbox_settings = vbox_settings;
+
+ empathy_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",
+ 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,
+ NULL);
+
+ self->ui_details->add_forget = TRUE;
+ self->ui_details->default_focus = g_strdup ("entry_userid");
+ }
+
+ self->ui_details->widget = vbox_settings;
}
diff --git a/libempathy-gtk/empathy-account-widget-sip.h b/libempathy-gtk/empathy-account-widget-sip.h
index 69f60aacc..6334a745b 100644
--- a/libempathy-gtk/empathy-account-widget-sip.h
+++ b/libempathy-gtk/empathy-account-widget-sip.h
@@ -22,11 +22,13 @@
#define __EMPATHY_ACCOUNT_WIDGET_SIP_H__
#include <gtk/gtk.h>
-#include <libempathy/empathy-account.h>
+#include <libempathy-gtk/empathy-account-widget.h>
G_BEGIN_DECLS
-GtkWidget * empathy_account_widget_sip_new (EmpathyAccount *account);
+void empathy_account_widget_sip_build (EmpathyAccountWidget *self,
+ const char *filename,
+ GtkWidget **table_common_settings);
G_END_DECLS
diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui
index 406f22c94..e8491a6a5 100644
--- a/libempathy-gtk/empathy-account-widget-sip.ui
+++ b/libempathy-gtk/empathy-account-widget-sip.ui
@@ -11,9 +11,9 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -26,8 +26,8 @@
<property name="mnemonic_widget">entry_password</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -92,9 +92,27 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; user@my.sip.server&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
</packing>
</child>
</object>
@@ -109,7 +127,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="left_padding">12</property>
@@ -212,4 +230,92 @@
</packing>
</child>
</object>
+ <object class="GtkVBox" id="vbox_sip_simple">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label_userid_simple">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">What is your SIP login 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_userid_simple">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; user@my.sip.server&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </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 SIP account 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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget-yahoo.ui b/libempathy-gtk/empathy-account-widget-yahoo.ui
index 31e932674..554e0dbec 100644
--- a/libempathy-gtk/empathy-account-widget-yahoo.ui
+++ b/libempathy-gtk/empathy-account-widget-yahoo.ui
@@ -16,7 +16,7 @@
<child>
<object class="GtkTable" id="table_common_settings">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -29,8 +29,8 @@
<property name="mnemonic_widget">entry_password</property>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -51,8 +51,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@@ -92,9 +92,30 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; username&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
</packing>
</child>
</object>
@@ -294,4 +315,92 @@
</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="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>
+ <property name="invisible_char">&#x2022;</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;span size="small"&gt;&lt;b&gt;Example:&lt;/b&gt; username&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </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>
+ <property name="invisible_char">&#x2022;</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
</interface>
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 0c2c35177..0927d109c 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -1,7 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2006-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2009 Collabora Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -20,6 +19,8 @@
*
* Authors: Xavier Claessens <xclaesse@gmail.com>
* Martyn Russell <martyn@imendio.com>
+ * Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
+ * Jonathan Tellier <jonathan.tellier@gmail.com>
*/
#include <config.h>
@@ -29,702 +30,1385 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
-#include <libmissioncontrol/mc-protocol.h>
-
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-account.h>
+#include <telepathy-glib/connection-manager.h>
+#include <telepathy-glib/util.h>
+#include <dbus/dbus-protocol.h>
+
#include "empathy-account-widget.h"
+#include "empathy-account-widget-private.h"
+#include "empathy-account-widget-sip.h"
+#include "empathy-account-widget-irc.h"
#include "empathy-ui-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
#include <libempathy/empathy-debug.h>
-static gboolean
-account_widget_entry_focus_cb (GtkWidget *widget,
- GdkEventFocus *event,
- EmpathyAccount *account)
-{
- const gchar *str;
- const gchar *param_name;
-
- str = gtk_entry_get_text (GTK_ENTRY (widget));
- param_name = g_object_get_data (G_OBJECT (widget), "param_name");
-
- if (EMP_STR_EMPTY (str)) {
- gchar *value = NULL;
-
- empathy_account_unset_param (account, param_name);
- value = empathy_account_get_param_string (account, param_name);
- DEBUG ("Unset %s and restore to %s", param_name, value);
- gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
- g_free (value);
- } else {
- McProfile *profile;
- const gchar *domain = NULL;
- gchar *dup_str = NULL;
-
- profile = empathy_account_get_profile (account);
- if (mc_profile_get_capabilities (profile) &
- MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT) {
- domain = mc_profile_get_default_account_domain (profile);
- }
-
- if (domain && !strstr (str, "@") &&
- strcmp (param_name, "account") == 0) {
- DEBUG ("Adding @%s suffix to account", domain);
- str = dup_str = g_strconcat (str, "@", domain, NULL);
- gtk_entry_set_text (GTK_ENTRY (widget), str);
- }
- DEBUG ("Setting %s to %s", param_name,
- strstr (param_name, "password") ? "***" : str);
- empathy_account_set_param_string (account, param_name, str);
- g_free (dup_str);
- g_object_unref (profile);
- }
-
- return FALSE;
+G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT)
+
+typedef struct {
+ char *protocol;
+ EmpathyAccountSettings *settings;
+
+ GtkWidget *table_common_settings;
+ GtkWidget *apply_button;
+ GtkWidget *cancel_button;
+ GtkWidget *entry_password;
+ GtkWidget *button_forget;
+ GtkWidget *spinbutton_port;
+ GtkWidget *enabled_checkbox;
+
+ gboolean simple;
+
+ /* An EmpathyAccountWidget 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;
+
+ /* After having applied changes to a user account, we automatically
+ * disconnect him. Once he's disconnected, he will be reconnected,
+ * depending on the value of this member which should be set to the checked
+ * state of the "Enabled" checkbox. This is done so the new information
+ * entered by the user is validated on the server. */
+ gboolean re_enable_accound;
+
+ gboolean dispose_run;
+} EmpathyAccountWidgetPriv;
+
+enum {
+ PROP_PROTOCOL = 1,
+ PROP_SETTINGS,
+ PROP_SIMPLE,
+ PROP_CREATING_ACCOUNT
+};
+
+enum {
+ HANDLE_APPLY,
+ ACCOUNT_CREATED,
+ CANCELLED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget)
+#define CHANGED_TIMEOUT 300
+
+static void
+account_widget_set_control_buttons_sensitivity (EmpathyAccountWidget *self,
+ gboolean sensitive)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (!priv->simple)
+ {
+ gtk_widget_set_sensitive (priv->apply_button, sensitive);
+ gtk_widget_set_sensitive (priv->cancel_button, sensitive);
+ }
}
static void
-account_widget_int_changed_cb (GtkWidget *widget,
- EmpathyAccount *account)
+account_widget_handle_control_buttons_sensitivity (EmpathyAccountWidget *self)
{
- const gchar *param_name;
- gint value;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ gboolean is_valid;
- value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
- param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+ is_valid = empathy_account_settings_is_valid (priv->settings);
- if (value == 0) {
- empathy_account_unset_param (account, param_name);
- value = empathy_account_get_param_int (account, param_name);
- DEBUG ("Unset %s and restore to %d", param_name, value);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
- } else {
- DEBUG ("Setting %s to %d", param_name, value);
- empathy_account_set_param_int (account, param_name, value);
- }
+ if (!priv->simple)
+ {
+ gtk_widget_set_sensitive (priv->apply_button, is_valid);
+ gtk_widget_set_sensitive (priv->cancel_button, is_valid);
+ }
+
+ g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid);
}
static void
-account_widget_checkbutton_toggled_cb (GtkWidget *widget,
- EmpathyAccount *account)
+account_widget_entry_changed_common (EmpathyAccountWidget *self,
+ GtkEntry *entry, gboolean focus)
+{
+ const gchar *str;
+ const gchar *param_name;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ str = gtk_entry_get_text (entry);
+ param_name = g_object_get_data (G_OBJECT (entry), "param_name");
+
+ if (EMP_STR_EMPTY (str))
+ {
+ const gchar *value = NULL;
+
+ empathy_account_settings_unset (priv->settings, param_name);
+
+ if (focus)
+ {
+ value = empathy_account_settings_get_string (priv->settings,
+ param_name);
+ DEBUG ("Unset %s and restore to %s", param_name, value);
+ gtk_entry_set_text (entry, value ? value : "");
+ }
+ }
+ else
+ {
+ DEBUG ("Setting %s to %s", param_name,
+ tp_strdiff (param_name, "password") ? str : "***");
+ empathy_account_settings_set_string (priv->settings, param_name, str);
+ }
+}
+
+static gboolean
+account_widget_entry_focus_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ EmpathyAccountWidget *self)
{
- gboolean value;
- gboolean default_value;
- const gchar *param_name;
+ account_widget_entry_changed_common (self, GTK_ENTRY (widget), TRUE);
- value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+ return FALSE;
+}
+
+static void
+account_widget_entry_changed_cb (GtkEditable *entry,
+ EmpathyAccountWidget *self)
+{
+ account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE);
+ account_widget_handle_control_buttons_sensitivity (self);
+}
- /* 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_unset_param (account, param_name);
- default_value = empathy_account_get_param_boolean (account, param_name);
+static void
+account_widget_int_changed_cb (GtkWidget *widget,
+ EmpathyAccountWidget *self)
+{
+ const gchar *param_name;
+ gint value;
+ const gchar *signature;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ 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 (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_int32 (priv->settings, param_name, value);
+ break;
+ case DBUS_TYPE_INT64:
+ empathy_account_settings_set_int64 (priv->settings, param_name, value);
+ break;
+ case DBUS_TYPE_UINT16:
+ case DBUS_TYPE_UINT32:
+ empathy_account_settings_set_uint32 (priv->settings, param_name, value);
+ break;
+ case DBUS_TYPE_UINT64:
+ empathy_account_settings_set_uint64 (priv->settings, param_name, value);
+ break;
+ default:
+ g_return_if_reached ();
+ }
+
+ account_widget_handle_control_buttons_sensitivity (self);
+}
- 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_set_param_boolean (account, param_name, value);
- }
+static void
+account_widget_checkbutton_toggled_cb (GtkWidget *widget,
+ EmpathyAccountWidget *self)
+{
+ gboolean value;
+ gboolean default_value;
+ const gchar *param_name;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ 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 (priv->settings, param_name);
+ default_value = empathy_account_settings_get_boolean (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_boolean (priv->settings, param_name, value);
+ }
+
+ account_widget_handle_control_buttons_sensitivity (self);
}
static void
account_widget_forget_clicked_cb (GtkWidget *button,
- GtkWidget *entry)
+ EmpathyAccountWidget *self)
{
- EmpathyAccount *account;
- const gchar *param_name;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ const gchar *param_name;
- param_name = g_object_get_data (G_OBJECT (entry), "param_name");
- account = g_object_get_data (G_OBJECT (entry), "account");
+ param_name = g_object_get_data (G_OBJECT (priv->entry_password),
+ "param_name");
- DEBUG ("Unset %s", param_name);
- empathy_account_unset_param (account, param_name);
- gtk_entry_set_text (GTK_ENTRY (entry), "");
+ DEBUG ("Unset %s", param_name);
+ empathy_account_settings_unset (priv->settings, param_name);
+ gtk_entry_set_text (GTK_ENTRY (priv->entry_password), "");
+
+ account_widget_handle_control_buttons_sensitivity (self);
}
static void
account_widget_password_changed_cb (GtkWidget *entry,
- GtkWidget *button)
+ EmpathyAccountWidget *self)
{
- const gchar *str;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ const gchar *str;
- str = gtk_entry_get_text (GTK_ENTRY (entry));
- gtk_widget_set_sensitive (button, !EMP_STR_EMPTY (str));
+ str = gtk_entry_get_text (GTK_ENTRY (entry));
+ gtk_widget_set_sensitive (priv->button_forget, !EMP_STR_EMPTY (str));
}
static void
account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
- GtkWidget *spinbutton_port)
+ EmpathyAccountWidget *self)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ gboolean value;
+ gint32 port = 0;
+
+ value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
+ port = empathy_account_settings_get_uint32 (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 (priv->spinbutton_port), port);
+}
+
+static void
+account_widget_setup_widget (EmpathyAccountWidget *self,
+ GtkWidget *widget,
+ const gchar *param_name)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ 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 (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 (priv->settings,
+ param_name);
+ break;
+ case DBUS_TYPE_INT64:
+ value = empathy_account_settings_get_int64 (priv->settings,
+ param_name);
+ break;
+ case DBUS_TYPE_UINT16:
+ case DBUS_TYPE_UINT32:
+ value = empathy_account_settings_get_uint32 (priv->settings,
+ param_name);
+ break;
+ case DBUS_TYPE_UINT64:
+ value = empathy_account_settings_get_uint64 (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))
+ {
+ const gchar *str = NULL;
+
+ str = empathy_account_settings_get_string (priv->settings, param_name);
+ gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
+
+ if (strstr (param_name, "password"))
+ {
+ gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
+ }
+
+ g_signal_connect (widget, "focus-out-event",
+ G_CALLBACK (account_widget_entry_focus_cb),
+ self);
+ g_signal_connect (widget, "changed",
+ G_CALLBACK (account_widget_entry_changed_cb), self);
+ }
+ else if (GTK_IS_TOGGLE_BUTTON (widget))
+ {
+ gboolean value = FALSE;
+
+ value = empathy_account_settings_get_boolean (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
+ {
+ DEBUG ("Unknown type of widget for param %s", param_name);
+ }
+}
+
+static gchar *
+account_widget_generic_format_param_name (const gchar *param_name)
{
- EmpathyAccount *account;
- gboolean value;
- gint port = 0;
+ gchar *str;
+ gchar *p;
+
+ str = g_strdup (param_name);
+
+ if (str && g_ascii_isalpha (str[0]))
+ str[0] = g_ascii_toupper (str[0]);
- value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
- account = g_object_get_data (G_OBJECT (spinbutton_port), "account");
- port = empathy_account_get_param_int (account, "port");
+ while ((p = strchr (str, '-')) != NULL)
+ {
+ if (p[1] != '\0' && g_ascii_isalpha (p[1]))
+ {
+ p[0] = ' ';
+ p[1] = g_ascii_toupper (p[1]);
+ }
- if (value) {
- if (port == 5222 || port == 0) {
- port = 5223;
- }
- } else {
- if (port == 5223 || port == 0) {
- port = 5222;
- }
- }
+ p++;
+ }
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton_port), port);
+ return str;
}
static void
-account_widget_setup_widget (GtkWidget *widget,
- EmpathyAccount *account,
- const gchar *param_name)
+accounts_widget_generic_setup (EmpathyAccountWidget *self,
+ GtkWidget *table_common_settings,
+ GtkWidget *table_advanced_settings)
{
- g_object_set_data_full (G_OBJECT (widget), "param_name",
- g_strdup (param_name), g_free);
- g_object_set_data_full (G_OBJECT (widget), "account",
- g_object_ref (account), g_object_unref);
-
- if (GTK_IS_SPIN_BUTTON (widget)) {
- gint value = 0;
-
- value = empathy_account_get_param_int (account, param_name);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
+ TpConnectionManagerParam *params, *param;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ params = empathy_account_settings_get_tp_params (priv->settings);
+
+ for (param = params; param != NULL && param->name != NULL; param++)
+ {
+ GtkWidget *table_settings;
+ guint n_rows = 0;
+ GtkWidget *widget = NULL;
+ gchar *param_name_formatted;
+
+ if (param->flags & TP_CONN_MGR_PARAM_FLAG_REQUIRED)
+ table_settings = table_common_settings;
+ else if (priv->simple)
+ return;
+ else
+ table_settings = table_advanced_settings;
+
+ param_name_formatted = account_widget_generic_format_param_name
+ (param->name);
+ g_object_get (table_settings, "n-rows", &n_rows, NULL);
+ gtk_table_resize (GTK_TABLE (table_settings), ++n_rows, 2);
+
+ if (param->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), 0, 0.5);
+ g_free (str);
+
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 0, 1,
+ n_rows - 1, n_rows,
+ GTK_FILL, 0,
+ 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_entry_new ();
+ if (strcmp (param->name, "account") == 0)
+ {
+ g_signal_connect (widget, "realize",
+ G_CALLBACK (gtk_widget_grab_focus),
+ NULL);
+ }
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 1, 2,
+ n_rows - 1, n_rows,
+ GTK_FILL | GTK_EXPAND, 0,
+ 0, 0);
+ gtk_widget_show (widget);
+ }
+ /* int types: ynqiuxt. double type is 'd' */
+ else if (param->dbus_signature[0] == 'y' ||
+ param->dbus_signature[0] == 'n' ||
+ param->dbus_signature[0] == 'q' ||
+ param->dbus_signature[0] == 'i' ||
+ param->dbus_signature[0] == 'u' ||
+ param->dbus_signature[0] == 'x' ||
+ param->dbus_signature[0] == 't' ||
+ param->dbus_signature[0] == 'd')
+ {
+ gchar *str = NULL;
+ gdouble minint = 0;
+ gdouble maxint = 0;
+ gdouble step = 1;
+
+ switch (param->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;
+ }
+
+ 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_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 0, 1,
+ n_rows - 1, n_rows,
+ GTK_FILL, 0,
+ 0, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_spin_button_new_with_range (minint, maxint, step);
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 1, 2,
+ n_rows - 1, n_rows,
+ GTK_FILL | GTK_EXPAND, 0,
+ 0, 0);
+ gtk_widget_show (widget);
+ }
+ else if (param->dbus_signature[0] == 'b')
+ {
+ widget = gtk_check_button_new_with_label (param_name_formatted);
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 0, 2,
+ n_rows - 1, n_rows,
+ GTK_FILL | GTK_EXPAND, 0,
+ 0, 0);
+ gtk_widget_show (widget);
+ }
+ else
+ {
+ DEBUG ("Unknown signature for param %s: %s",
+ param_name_formatted, param->dbus_signature);
+ }
+
+ if (widget)
+ account_widget_setup_widget (self, widget, param->name);
+
+ g_free (param_name_formatted);
+ }
+}
- g_signal_connect (widget, "value-changed",
- G_CALLBACK (account_widget_int_changed_cb),
- account);
- }
- else if (GTK_IS_ENTRY (widget)) {
- gchar *str = NULL;
+static void
+account_widget_handle_params_valist (EmpathyAccountWidget *self,
+ const gchar *first_widget,
+ va_list args)
+{
+ GObject *object;
+ const gchar *name;
- str = empathy_account_get_param_string (account, param_name);
- gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
- g_free (str);
+ for (name = first_widget; name; name = va_arg (args, const gchar *))
+ {
+ const gchar *param_name;
- if (strstr (param_name, "password")) {
- gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
- }
+ param_name = va_arg (args, const gchar *);
+ object = gtk_builder_get_object (self->ui_details->gui, name);
- g_signal_connect (widget, "focus-out-event",
- G_CALLBACK (account_widget_entry_focus_cb),
- account);
- }
- else if (GTK_IS_TOGGLE_BUTTON (widget)) {
- gboolean value = FALSE;
+ if (!object)
+ {
+ g_warning ("Builder is missing object '%s'.", name);
+ continue;
+ }
- value = empathy_account_get_param_boolean (account, param_name);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
+ account_widget_setup_widget (self, GTK_WIDGET (object), param_name);
+ }
+}
- g_signal_connect (widget, "toggled",
- G_CALLBACK (account_widget_checkbutton_toggled_cb),
- account);
- } else {
- DEBUG ("Unknown type of widget for param %s", param_name);
- }
+static void
+account_widget_cancel_clicked_cb (GtkWidget *button,
+ EmpathyAccountWidget *self)
+{
+ g_signal_emit (self, signals[CANCELLED], 0);
}
-static gchar *
-account_widget_generic_format_param_name (const gchar *param_name)
+static void
+account_widget_account_enabled_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- gchar *str;
- gchar *p;
-
- 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 (EmpathyAccount *account,
- GtkWidget *table_common_settings,
- GtkWidget *table_advanced_settings)
-{
- McProtocol *protocol;
- McProfile *profile;
- GSList *params, *l;
-
- profile = empathy_account_get_profile (account);
- protocol = mc_profile_get_protocol (profile);
-
- if (!protocol) {
- /* The CM is not installed, MC shouldn't list them
- * see SF bug #1688779
- * FIXME: We should display something asking the user to
- * install the CM
- */
- g_object_unref (profile);
- return;
- }
-
- params = mc_protocol_get_params (protocol);
-
- for (l = params; l; l = l->next) {
- McProtocolParam *param;
- GtkWidget *table_settings;
- guint n_rows = 0;
- GtkWidget *widget = NULL;
- gchar *param_name_formatted;
-
- param = l->data;
- if (param->flags & MC_PROTOCOL_PARAM_REQUIRED) {
- table_settings = table_common_settings;
- } else {
- table_settings = table_advanced_settings;
- }
- param_name_formatted = account_widget_generic_format_param_name (param->name);
- g_object_get (table_settings, "n-rows", &n_rows, NULL);
- gtk_table_resize (GTK_TABLE (table_settings), ++n_rows, 2);
-
- if (param->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), 0, 0.5);
- g_free (str);
-
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 0, 1,
- n_rows - 1, n_rows,
- GTK_FILL, 0,
- 0, 0);
- gtk_widget_show (widget);
-
- widget = gtk_entry_new ();
- if (strcmp (param->name, "account") == 0) {
- g_signal_connect (widget, "realize",
- G_CALLBACK (gtk_widget_grab_focus),
- NULL);
- }
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 1, 2,
- n_rows - 1, n_rows,
- GTK_FILL | GTK_EXPAND, 0,
- 0, 0);
- gtk_widget_show (widget);
- }
- /* int types: ynqiuxt. double type is 'd' */
- else if (param->signature[0] == 'y' ||
- param->signature[0] == 'n' ||
- param->signature[0] == 'q' ||
- param->signature[0] == 'i' ||
- param->signature[0] == 'u' ||
- param->signature[0] == 'x' ||
- param->signature[0] == 't' ||
- param->signature[0] == 'd') {
- gchar *str = NULL;
- gdouble minint = 0;
- gdouble maxint = 0;
- gdouble step = 1;
-
- switch (param->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;
- }
-
- 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_table_attach (GTK_TABLE (table_settings),
- widget,
- 0, 1,
- n_rows - 1, n_rows,
- GTK_FILL, 0,
- 0, 0);
- gtk_widget_show (widget);
-
- widget = gtk_spin_button_new_with_range (minint, maxint, step);
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 1, 2,
- n_rows - 1, n_rows,
- GTK_FILL | GTK_EXPAND, 0,
- 0, 0);
- gtk_widget_show (widget);
- }
- else if (param->signature[0] == 'b') {
- widget = gtk_check_button_new_with_label (param_name_formatted);
- gtk_table_attach (GTK_TABLE (table_settings),
- widget,
- 0, 2,
- n_rows - 1, n_rows,
- GTK_FILL | GTK_EXPAND, 0,
- 0, 0);
- gtk_widget_show (widget);
- } else {
- DEBUG ("Unknown signature for param %s: %s",
- param_name_formatted, param->signature);
- }
-
- if (widget) {
- account_widget_setup_widget (widget, account, param->name);
- }
-
- g_free (param_name_formatted);
- }
-
- mc_protocol_free_params_list (params);
- g_object_unref (profile);
- g_object_unref (protocol);
-}
-
-static void
-account_widget_handle_params_valist (EmpathyAccount *account,
- GtkBuilder *gui,
- 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 (gui, name);
-
- if (!object) {
- g_warning ("Builder is missing object '%s'.", name);
- continue;
- }
-
- account_widget_setup_widget (GTK_WIDGET (object), account, param_name);
- }
+ GError *error = NULL;
+ EmpathyAccount *account = EMPATHY_ACCOUNT (source_object);
+ EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
+
+ empathy_account_set_enabled_finish (account, res, &error);
+
+ if (error != NULL)
+ {
+ DEBUG ("Could not automatically enable new account: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ g_signal_emit (widget, signals[ACCOUNT_CREATED], 0);
+ }
}
-void
-empathy_account_widget_handle_params (EmpathyAccount *account,
- GtkBuilder *gui,
- const gchar *first_widget,
- ...)
+static void
+account_widget_applied_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- va_list args;
+ GError *error = NULL;
+ EmpathyAccount *account;
+ EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source_object);
+ EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);
+
+ empathy_account_settings_apply_finish (settings, res, &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 (priv->settings);
+
+ if (priv->creating_account)
+ {
+ /* By default, when an account is created, we enable it. */
+ empathy_account_set_enabled_async (account, TRUE,
+ account_widget_account_enabled_cb, widget);
+ }
+ else if (account != NULL && priv->enabled_checkbox != NULL)
+ {
+ gboolean enabled_checked;
+
+ enabled_checked = gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (priv->enabled_checkbox));
+
+ if (empathy_account_is_enabled (account))
+ {
+ /* We want to disable the account (and possibly re-enable it) to make
+ * sure that the new settings are effective */
+ priv->re_enable_accound = enabled_checked;
+ empathy_account_set_enabled_async (account, FALSE, NULL, NULL);
+ }
+ else
+ {
+ /* The account is already disable so we just enable it according
+ * to the value of the "Enabled" checkbox */
+ empathy_account_set_enabled_async (account, enabled_checked,
+ NULL, NULL);
+ }
+ }
+
+ account_widget_set_control_buttons_sensitivity (widget, FALSE);
+}
- g_return_if_fail (GTK_IS_BUILDER (gui));
+static void
+account_widget_apply_clicked_cb (GtkWidget *button,
+ EmpathyAccountWidget *self)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
- va_start (args, first_widget);
- account_widget_handle_params_valist (account, gui, first_widget, args);
- va_end (args);
+ empathy_account_settings_apply_async (priv->settings,
+ account_widget_applied_cb, self);
}
-void
-empathy_account_widget_add_forget_button (EmpathyAccount *account,
- GtkBuilder *gui,
- const gchar *button,
- const gchar *entry)
+static void
+account_widget_setup_generic (EmpathyAccountWidget *self)
{
- GtkWidget *button_forget;
- GtkWidget *entry_password;
- gchar *password = NULL;
+ GtkWidget *table_common_settings;
+ GtkWidget *table_advanced_settings;
- button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button));
- entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry));
+ table_common_settings = GTK_WIDGET (gtk_builder_get_object
+ (self->ui_details->gui, "table_common_settings"));
+ table_advanced_settings = GTK_WIDGET (gtk_builder_get_object
+ (self->ui_details->gui, "table_advanced_settings"));
- password = empathy_account_get_param_string (account, "password");
- gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password));
- g_free (password);
+ accounts_widget_generic_setup (self, table_common_settings,
+ table_advanced_settings);
- g_signal_connect (button_forget, "clicked",
- G_CALLBACK (account_widget_forget_clicked_cb),
- entry_password);
- g_signal_connect (entry_password, "changed",
- G_CALLBACK (account_widget_password_changed_cb),
- button_forget);
+ g_object_unref (self->ui_details->gui);
}
-void
-empathy_account_widget_set_default_focus (GtkBuilder *gui,
- const gchar *entry)
+static void
+account_widget_settings_ready_cb (EmpathyAccountSettings *settings,
+ GParamSpec *pspec,
+ gpointer user_data)
{
- GObject *default_focus_entry;
+ EmpathyAccountWidget *self = user_data;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
- default_focus_entry = gtk_builder_get_object (gui, entry);
- g_signal_connect (default_focus_entry, "realize",
- G_CALLBACK (gtk_widget_grab_focus),
- NULL);
+ if (empathy_account_settings_is_ready (priv->settings))
+ account_widget_setup_generic (self);
}
-GtkWidget *
-empathy_account_widget_generic_new (EmpathyAccount *account)
+static void
+account_widget_build_generic (EmpathyAccountWidget *self,
+ const char *filename)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- GtkWidget *table_common_settings;
- GtkWidget *table_advanced_settings;
- gchar *filename;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ GtkWidget *expander_advanced;
- filename = empathy_file_lookup ("empathy-account-widget-generic.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_generic_settings", &widget,
- "table_common_settings", &table_common_settings,
- "table_advanced_settings", &table_advanced_settings,
- NULL);
- g_free (filename);
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", &priv->table_common_settings,
+ "vbox_generic_settings", &self->ui_details->widget,
+ "expander_advanced_settings", &expander_advanced,
+ NULL);
- accounts_widget_generic_setup (account, table_common_settings, table_advanced_settings);
+ if (priv->simple)
+ gtk_widget_hide (expander_advanced);
- return empathy_builder_unref_and_keep_widget (gui, widget);
+ g_object_ref (self->ui_details->gui);
+
+ if (empathy_account_settings_is_ready (priv->settings))
+ account_widget_setup_generic (self);
+ else
+ g_signal_connect (priv->settings, "notify::ready",
+ G_CALLBACK (account_widget_settings_ready_cb), self);
}
-GtkWidget *
-empathy_account_widget_salut_new (EmpathyAccount *account)
+static void
+account_widget_build_salut (EmpathyAccountWidget *self,
+ const char *filename)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", &priv->table_common_settings,
+ "vbox_salut_settings", &self->ui_details->widget,
+ NULL);
+
+ empathy_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);
+
+ self->ui_details->default_focus = g_strdup ("entry_nickname");
+}
+
+static void
+account_widget_build_msn (EmpathyAccountWidget *self,
+ const char *filename)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- gchar *filename;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (priv->simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_msn_simple", &self->ui_details->widget,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_id_simple", "account",
+ "entry_password_simple", "password",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_id_simple");
+ }
+ else
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_msn_settings", &priv->table_common_settings,
+ "vbox_msn_settings", &self->ui_details->widget,
+ NULL);
+
+ empathy_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->ui_details->add_forget = TRUE;
+ }
+}
- filename = empathy_file_lookup ("empathy-account-widget-salut.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_salut_settings", &widget,
- NULL);
- g_free (filename);
+static void
+account_widget_build_jabber (EmpathyAccountWidget *self,
+ const char *filename)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ GtkWidget *spinbutton_port;
+ GtkWidget *checkbutton_ssl;
+ GtkWidget *label_id, *label_password;
+ GtkWidget *label_id_create, *label_password_create;
+
+ if (priv->simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_jabber_simple", &self->ui_details->widget,
+ "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 (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);
+ }
+
+ empathy_account_widget_handle_params (self,
+ "entry_id_simple", "account",
+ "entry_password_simple", "password",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_id_simple");
+ }
+ else
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", &priv->table_common_settings,
+ "vbox_jabber_settings", &self->ui_details->widget,
+ "spinbutton_port", &spinbutton_port,
+ "checkbutton_ssl", &checkbutton_ssl,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_id", "account",
+ "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);
+
+ self->ui_details->default_focus = g_strdup ("entry_id");
+ self->ui_details->add_forget = TRUE;
+ priv->spinbutton_port = spinbutton_port;
+
+ g_signal_connect (checkbutton_ssl, "toggled",
+ G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
+ self);
+ }
+}
- empathy_account_widget_handle_params (account, gui,
- "entry_published", "published-name",
- "entry_nickname", "nickname",
- "entry_first_name", "first-name",
- "entry_last_name", "last-name",
- "entry_email", "email",
- "entry_jid", "jid",
- NULL);
+static void
+account_widget_build_icq (EmpathyAccountWidget *self,
+ const char *filename)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ GtkWidget *spinbutton_port;
+
+ if (priv->simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_icq_simple", &self->ui_details->widget,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_uin_simple", "account",
+ "entry_password_simple", "password",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_uin_simple");
+ }
+ else
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", &priv->table_common_settings,
+ "vbox_icq_settings", &self->ui_details->widget,
+ "spinbutton_port", &spinbutton_port,
+ NULL);
+
+ empathy_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->ui_details->add_forget = TRUE;
+ }
+}
- empathy_account_widget_set_default_focus (gui, "entry_nickname");
+static void
+account_widget_build_aim (EmpathyAccountWidget *self,
+ const char *filename)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ GtkWidget *spinbutton_port;
+
+ if (priv->simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_aim_simple", &self->ui_details->widget,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_screenname_simple", "account",
+ "entry_password_simple", "password",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_screenname_simple");
+ }
+ else
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", &priv->table_common_settings,
+ "vbox_aim_settings", &self->ui_details->widget,
+ "spinbutton_port", &spinbutton_port,
+ NULL);
+
+ empathy_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->ui_details->add_forget = TRUE;
+ }
+}
- return empathy_builder_unref_and_keep_widget (gui, widget);
+static void
+account_widget_build_yahoo (EmpathyAccountWidget *self,
+ const char *filename)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (priv->simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_yahoo_simple", &self->ui_details->widget,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_id_simple", "account",
+ "entry_password_simple", "password",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_id_simple");
+ }
+ else
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_settings", &priv->table_common_settings,
+ "vbox_yahoo_settings", &self->ui_details->widget,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_id", "account",
+ "entry_password", "password",
+ "entry_server", "server",
+ "entry_locale", "room-list-locale",
+ "entry_charset", "charset",
+ "spinbutton_port", "port",
+ "checkbutton_yahoojp", "yahoojp",
+ "checkbutton_ignore_invites", "ignore-invites",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_id");
+ self->ui_details->add_forget = TRUE;
+ }
}
-GtkWidget *
-empathy_account_widget_msn_new (EmpathyAccount *account)
+static void
+account_widget_build_groupwise (EmpathyAccountWidget *self,
+ const char *filename)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- gchar *filename;
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (priv->simple)
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "vbox_groupwise_simple", &self->ui_details->widget,
+ NULL);
+
+ empathy_account_widget_handle_params (self,
+ "entry_id_simple", "account",
+ "entry_password_simple", "password",
+ NULL);
+
+ self->ui_details->default_focus = g_strdup ("entry_id_simple");
+ }
+ else
+ {
+ self->ui_details->gui = empathy_builder_get_file (filename,
+ "table_common_groupwise_settings", &priv->table_common_settings,
+ "vbox_groupwise_settings", &self->ui_details->widget,
+ NULL);
+
+ empathy_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->ui_details->add_forget = TRUE;
+ }
+}
- filename = empathy_file_lookup ("empathy-account-widget-msn.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_msn_settings", &widget,
- NULL);
- g_free (filename);
+static void
+account_widget_destroy_cb (GtkWidget *widget,
+ EmpathyAccountWidget *self)
+{
+ g_object_unref (self);
+}
- empathy_account_widget_handle_params (account, gui,
- "entry_id", "account",
- "entry_password", "password",
- "entry_server", "server",
- "spinbutton_port", "port",
- NULL);
+static void
+empathy_account_widget_enabled_cb (EmpathyAccount *account,
+ GParamSpec *spec,
+ gpointer user_data)
+{
+ EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);
+ gboolean enabled = empathy_account_is_enabled (account);
+
+ if (!enabled && priv->re_enable_accound)
+ {
+ /* The account has been disabled because we were applying changes.
+ * However, the user wants the account to be enabled so let's re-enable
+ * it */
+ empathy_account_set_enabled_async (account, TRUE, NULL, NULL);
+ }
+ else if (priv->enabled_checkbox != NULL)
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->enabled_checkbox),
+ enabled);
+ }
+}
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
+static void
+account_widget_enabled_toggled_cb (GtkToggleButton *toggle_button,
+ gpointer user_data)
+{
+ account_widget_handle_control_buttons_sensitivity (
+ EMPATHY_ACCOUNT_WIDGET (user_data));
+}
- empathy_account_widget_set_default_focus (gui, "entry_id");
+static void
+do_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (object);
+
+ switch (prop_id)
+ {
+ case PROP_PROTOCOL:
+ priv->protocol = g_value_dup_string (value);
+ break;
+ case PROP_SETTINGS:
+ priv->settings = g_value_dup_object (value);
+ break;
+ case PROP_SIMPLE:
+ priv->simple = g_value_get_boolean (value);
+ break;
+ case PROP_CREATING_ACCOUNT:
+ priv->creating_account = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
- return empathy_builder_unref_and_keep_widget (gui, widget);
+static void
+do_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (object);
+
+ switch (prop_id)
+ {
+ case PROP_PROTOCOL:
+ g_value_set_string (value, priv->protocol);
+ break;
+ case PROP_SETTINGS:
+ g_value_set_object (value, priv->settings);
+ break;
+ case PROP_SIMPLE:
+ g_value_set_boolean (value, priv->simple);
+ break;
+ case PROP_CREATING_ACCOUNT:
+ g_value_set_boolean (value, priv->creating_account);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
-GtkWidget *
-empathy_account_widget_jabber_new (EmpathyAccount *account)
-{
- GtkBuilder *gui;
- GtkWidget *widget;
- GtkWidget *spinbutton_port;
- GtkWidget *checkbutton_ssl;
- gchar *filename;
-
- filename = empathy_file_lookup ("empathy-account-widget-jabber.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_jabber_settings", &widget,
- "spinbutton_port", &spinbutton_port,
- "checkbutton_ssl", &checkbutton_ssl,
- NULL);
- g_free (filename);
-
- empathy_account_widget_handle_params (account, gui,
- "entry_id", "account",
- "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);
-
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
-
- empathy_account_widget_set_default_focus (gui, "entry_id");
-
- g_signal_connect (checkbutton_ssl, "toggled",
- G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
- spinbutton_port);
-
- return empathy_builder_unref_and_keep_widget (gui, widget);
+static void
+do_constructed (GObject *obj)
+{
+ EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj);
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ EmpathyAccount *account;
+ char *uiname, *filename;
+
+ uiname = g_strconcat ("empathy-account-widget-", priv->protocol,
+ ".ui", NULL);
+ filename = empathy_file_lookup (uiname, "libempathy-gtk");
+
+ if (!tp_strdiff (priv->protocol, "local-xmpp"))
+ account_widget_build_salut (self, filename);
+ else if (!tp_strdiff (priv->protocol, "msn"))
+ account_widget_build_msn (self, filename);
+ else if (!tp_strdiff (priv->protocol, "jabber"))
+ account_widget_build_jabber (self, filename);
+ else if (!tp_strdiff (priv->protocol, "icq"))
+ account_widget_build_icq (self, filename);
+ else if (!tp_strdiff (priv->protocol, "aim"))
+ account_widget_build_aim (self, filename);
+ else if (!tp_strdiff (priv->protocol, "yahoo"))
+ account_widget_build_yahoo (self, filename);
+ else if (!tp_strdiff (priv->protocol, "groupwise"))
+ account_widget_build_groupwise (self, filename);
+ else if (!tp_strdiff (priv->protocol, "irc"))
+ empathy_account_widget_irc_build (self, filename,
+ &priv->table_common_settings);
+ else if (!tp_strdiff (priv->protocol, "sip"))
+ empathy_account_widget_sip_build (self, filename,
+ &priv->table_common_settings);
+ else if (!tp_strdiff (priv->protocol, "generic"))
+ account_widget_build_generic (self, filename);
+ else
+ {
+ g_free (filename);
+
+ filename = empathy_file_lookup (
+ "empathy-account-widget-generic.ui", "libempathy-gtk");
+ account_widget_build_generic (self, filename);
+ }
+
+ g_free (uiname);
+ g_free (filename);
+
+ /* 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);
+ }
+
+ /* handle forget button */
+ if (self->ui_details->add_forget)
+ {
+ const gchar *password = NULL;
+
+ priv->button_forget = GTK_WIDGET (gtk_builder_get_object
+ (self->ui_details->gui, "button_forget"));
+ priv->entry_password = GTK_WIDGET (gtk_builder_get_object
+ (self->ui_details->gui, "entry_password"));
+
+ password = empathy_account_settings_get_string (priv->settings,
+ "password");
+ gtk_widget_set_sensitive (priv->button_forget,
+ !EMP_STR_EMPTY (password));
+
+ g_signal_connect (priv->button_forget, "clicked",
+ G_CALLBACK (account_widget_forget_clicked_cb),
+ self);
+ g_signal_connect (priv->entry_password, "changed",
+ G_CALLBACK (account_widget_password_changed_cb),
+ self);
+ }
+
+ /* handle apply and cancel button */
+ if (!priv->simple)
+ {
+ GtkWidget *hbox = gtk_hbox_new (TRUE, 3);
+
+ priv->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+ priv->apply_button = gtk_button_new_from_stock (
+ priv->creating_account ? GTK_STOCK_CONNECT : GTK_STOCK_APPLY);
+
+ gtk_box_pack_end (GTK_BOX (hbox), priv->apply_button, TRUE,
+ TRUE, 3);
+ gtk_box_pack_end (GTK_BOX (hbox), priv->cancel_button, TRUE,
+ TRUE, 3);
+
+ gtk_box_pack_end (GTK_BOX (self->ui_details->widget), hbox, FALSE,
+ FALSE, 3);
+
+ g_signal_connect (priv->cancel_button, "clicked",
+ G_CALLBACK (account_widget_cancel_clicked_cb),
+ self);
+ g_signal_connect (priv->apply_button, "clicked",
+ G_CALLBACK (account_widget_apply_clicked_cb),
+ self);
+ gtk_widget_show_all (hbox);
+ account_widget_set_control_buttons_sensitivity (self, FALSE);
+ }
+
+ account = empathy_account_settings_get_account (priv->settings);
+
+ if (account != NULL)
+ {
+ g_signal_connect (account, "notify::enabled",
+ G_CALLBACK (empathy_account_widget_enabled_cb), self);
+ }
+
+ /* handle the "Enabled" checkbox. We only add it when modifying an account */
+ if (!priv->creating_account && priv->table_common_settings != NULL)
+ {
+ guint nb_rows, nb_columns;
+
+ priv->enabled_checkbox =
+ gtk_check_button_new_with_label (_("Enabled"));
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (priv->enabled_checkbox),
+ empathy_account_is_enabled (account));
+
+ g_object_get (priv->table_common_settings, "n-rows", &nb_rows,
+ "n-columns", &nb_columns, NULL);
+
+ gtk_table_resize (GTK_TABLE (priv->table_common_settings), ++nb_rows,
+ nb_columns);
+
+ gtk_table_attach (GTK_TABLE (priv->table_common_settings),
+ priv->enabled_checkbox, 0, nb_columns, nb_rows - 1, nb_rows,
+ GTK_EXPAND | GTK_FILL, 0, 0, 0);
+
+ gtk_widget_show (priv->enabled_checkbox);
+
+ g_signal_connect (G_OBJECT (priv->enabled_checkbox), "toggled",
+ G_CALLBACK (account_widget_enabled_toggled_cb), self);
+ }
+
+ /* hook up to widget destruction to unref ourselves */
+ g_signal_connect (self->ui_details->widget, "destroy",
+ G_CALLBACK (account_widget_destroy_cb), self);
+
+ empathy_builder_unref_and_keep_widget (self->ui_details->gui,
+ self->ui_details->widget);
+ self->ui_details->gui = NULL;
}
-GtkWidget *
-empathy_account_widget_icq_new (EmpathyAccount *account)
+static void
+do_dispose (GObject *obj)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- GtkWidget *spinbutton_port;
- gchar *filename;
+ EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj);
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+
+ if (priv->dispose_run)
+ return;
- filename = empathy_file_lookup ("empathy-account-widget-icq.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_icq_settings", &widget,
- "spinbutton_port", &spinbutton_port,
- NULL);
- g_free (filename);
+ priv->dispose_run = TRUE;
- empathy_account_widget_handle_params (account, gui,
- "entry_uin", "account",
- "entry_password", "password",
- "entry_server", "server",
- "spinbutton_port", "port",
- "entry_charset", "charset",
- NULL);
+ empathy_account_settings_is_ready (priv->settings);
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
+ if (priv->settings != NULL)
+ {
+ EmpathyAccount *account;
+ account = empathy_account_settings_get_account (priv->settings);
- empathy_account_widget_set_default_focus (gui, "entry_uin");
+ if (account != NULL)
+ {
+ g_signal_handlers_disconnect_by_func (account,
+ empathy_account_widget_enabled_cb, self);
+ }
- return empathy_builder_unref_and_keep_widget (gui, widget);
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
+ }
+
+ if (G_OBJECT_CLASS (empathy_account_widget_parent_class)->dispose != NULL)
+ G_OBJECT_CLASS (empathy_account_widget_parent_class)->dispose (obj);
}
-GtkWidget *
-empathy_account_widget_aim_new (EmpathyAccount *account)
+static void
+do_finalize (GObject *obj)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- GtkWidget *spinbutton_port;
- gchar *filename;
-
- filename = empathy_file_lookup ("empathy-account-widget-aim.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_aim_settings", &widget,
- "spinbutton_port", &spinbutton_port,
- NULL);
- g_free (filename);
+ EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj);
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
- empathy_account_widget_handle_params (account, gui,
- "entry_screenname", "account",
- "entry_password", "password",
- "entry_server", "server",
- "spinbutton_port", "port",
- NULL);
+ g_free (self->ui_details->default_focus);
+ g_slice_free (EmpathyAccountWidgetUIDetails, self->ui_details);
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
+ g_free (priv->protocol);
- empathy_account_widget_set_default_focus (gui, "entry_screenname");
+ if (G_OBJECT_CLASS (empathy_account_widget_parent_class)->finalize != NULL)
+ G_OBJECT_CLASS (empathy_account_widget_parent_class)->finalize (obj);
+}
- return empathy_builder_unref_and_keep_widget (gui, widget);
+static void
+empathy_account_widget_class_init (EmpathyAccountWidgetClass *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_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+ 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);
+
+ signals[HANDLE_APPLY] =
+ g_signal_new ("handle-apply", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__BOOLEAN,
+ 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_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ signals[CANCELLED] =
+ g_signal_new ("cancelled", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv));
}
-GtkWidget *
-empathy_account_widget_yahoo_new (EmpathyAccount *account)
+static void
+empathy_account_widget_init (EmpathyAccountWidget *self)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- gchar *filename;
+ EmpathyAccountWidgetPriv *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE ((self), EMPATHY_TYPE_ACCOUNT_WIDGET,
+ EmpathyAccountWidgetPriv);
- filename = empathy_file_lookup ("empathy-account-widget-yahoo.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_yahoo_settings", &widget,
- NULL);
- g_free (filename);
+ self->priv = priv;
+ priv->dispose_run = FALSE;
- empathy_account_widget_handle_params (account, gui,
- "entry_id", "account",
- "entry_password", "password",
- "entry_server", "server",
- "entry_locale", "room-list-locale",
- "entry_charset", "charset",
- "spinbutton_port", "port",
- "checkbutton_yahoojp", "yahoojp",
- "checkbutton_ignore_invites", "ignore-invites",
- NULL);
+ self->ui_details = g_slice_new0 (EmpathyAccountWidgetUIDetails);
+}
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
+/* public methods */
- empathy_account_widget_set_default_focus (gui, "entry_id");
+void
+empathy_account_widget_handle_params (EmpathyAccountWidget *self,
+ const gchar *first_widget,
+ ...)
+{
+ va_list args;
- return empathy_builder_unref_and_keep_widget (gui, widget);
+ va_start (args, first_widget);
+ account_widget_handle_params_valist (self, first_widget, args);
+ va_end (args);
}
GtkWidget *
-empathy_account_widget_groupwise_new (EmpathyAccount *account)
+empathy_account_widget_get_widget (EmpathyAccountWidget *widget)
{
- GtkBuilder *gui;
- GtkWidget *widget;
- gchar *filename;
-
- filename = empathy_file_lookup ("empathy-account-widget-groupwise.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "vbox_groupwise_settings", &widget,
- NULL);
- g_free (filename);
+ return widget->ui_details->widget;
+}
- empathy_account_widget_handle_params (account, gui,
- "entry_id", "account",
- "entry_password", "password",
- "entry_server", "server",
- "spinbutton_port", "port",
- NULL);
+EmpathyAccountWidget *
+empathy_account_widget_new_for_protocol (const char *protocol,
+ EmpathyAccountSettings *settings,
+ gboolean simple)
+{
+ EmpathyAccountWidget *self;
- empathy_account_widget_add_forget_button (account, gui,
- "button_forget",
- "entry_password");
+ g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL);
+ g_return_val_if_fail (protocol != NULL, NULL);
- empathy_account_widget_set_default_focus (gui, "entry_id");
+ self = g_object_new
+ (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol,
+ "settings", settings, "simple", simple,
+ "creating-account",
+ empathy_account_settings_get_account (settings) == NULL,
+ NULL);
- return empathy_builder_unref_and_keep_widget (gui, widget);
+ return self;
}
-
diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h
index 7a76db9e0..415934a2d 100644
--- a/libempathy-gtk/empathy-account-widget.h
+++ b/libempathy-gtk/empathy-account-widget.h
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2006-2007 Imendio AB
* Copyright (C) 2007-2008 Collabora Ltd.
@@ -22,34 +21,51 @@
* Martyn Russell <martyn@imendio.com>
*/
-#ifndef __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__
-#define __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__
+#ifndef __EMPATHY_ACCOUNT_WIDGET_H__
+#define __EMPATHY_ACCOUNT_WIDGET_H__
#include <gtk/gtk.h>
-#include <libempathy/empathy-account.h>
+#include <libempathy/empathy-account-settings.h>
G_BEGIN_DECLS
-void empathy_account_widget_handle_params (EmpathyAccount *account,
- GtkBuilder *gui,
- const gchar *first_widget,
- ...);
-void empathy_account_widget_add_forget_button (EmpathyAccount *account,
- GtkBuilder *gui,
- const gchar *button,
- const gchar *entry);
-void empathy_account_widget_set_default_focus (GtkBuilder *gui,
- const gchar *entry);
-GtkWidget *empathy_account_widget_generic_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_salut_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_msn_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_jabber_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_icq_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_aim_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_yahoo_new (EmpathyAccount *account);
-GtkWidget *empathy_account_widget_groupwise_new (EmpathyAccount *account);
+#define EMPATHY_TYPE_ACCOUNT_WIDGET empathy_account_widget_get_type()
+#define EMPATHY_ACCOUNT_WIDGET(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_ACCOUNT_WIDGET, EmpathyAccountWidget))
+#define EMPATHY_ACCOUNT_WIDGET_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), EMPATHY_TYPE_ACCOUNT_WIDGET, EmpathyAccountWidgetClass))
+#define EMPATHY_IS_ACCOUNT_WIDGET(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_ACCOUNT_WIDGET))
+#define EMPATHY_IS_ACCOUNT_WIDGET_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_ACCOUNT_WIDGET))
+#define EMPATHY_ACCOUNT_WIDGET_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_ACCOUNT_WIDGET, EmpathyAccountWidgetClass))
+
+typedef struct _EmpathyAccountWidgetUIDetails EmpathyAccountWidgetUIDetails;
+
+typedef struct {
+ GObject parent;
+
+ EmpathyAccountWidgetUIDetails *ui_details;
+
+ /* private */
+ gpointer priv;
+} EmpathyAccountWidget;
+
+typedef struct {
+ GObjectClass parent_class;
+} EmpathyAccountWidgetClass;
+
+GType empathy_account_widget_get_type (void);
+
+GtkWidget *empathy_account_widget_get_widget (EmpathyAccountWidget *widget);
+
+EmpathyAccountWidget * empathy_account_widget_new_for_protocol (
+ const char *protocol,
+ EmpathyAccountSettings *settings,
+ gboolean simple);
G_END_DECLS
-#endif /* __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__ */
+#endif /* __EMPATHY_ACCOUNT_WIDGET_H__ */
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 9fa51fb85..9096beeae 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -203,8 +203,9 @@ chat_new_connection_cb (EmpathyAccountManager *manager,
EmpathyChatPriv *priv = GET_PRIV (chat);
EmpathyAccount *account;
- account = empathy_account_manager_get_account (manager, connection);
- if (!priv->tp_chat && empathy_account_equal (account, priv->account) &&
+ account = empathy_account_manager_get_account_for_connection (manager,
+ connection);
+ if (!priv->tp_chat && account == priv->account &&
priv->handle_type != TP_HANDLE_TYPE_NONE &&
!EMP_STR_EMPTY (priv->id)) {
@@ -1781,7 +1782,8 @@ empathy_chat_set_tp_chat (EmpathyChat *chat,
priv->tp_chat = g_object_ref (tp_chat);
connection = empathy_tp_chat_get_connection (priv->tp_chat);
- priv->account = empathy_account_manager_get_account (priv->account_manager,
+ priv->account = empathy_account_manager_get_account_for_connection (
+ priv->account_manager,
connection);
g_object_ref (priv->account);
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 0ec8c8e3e..5c77a787e 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -27,8 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
-#include <libmissioncontrol/mission-control.h>
-
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-account-manager.h>
#include <libempathy/empathy-contact-list.h>
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index a4dfa0f59..dcbbb18bf 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -302,7 +302,7 @@ contact_list_view_drag_data_received (GtkWidget *view,
account_id = strv[0];
contact_id = strv[1];
account_manager = empathy_account_manager_dup_singleton ();
- account = empathy_account_manager_lookup (account_manager, account_id);
+ account = empathy_account_manager_get_account (account_manager, account_id);
if (account) {
TpConnection *connection;
diff --git a/libempathy-gtk/empathy-irc-network-dialog.c b/libempathy-gtk/empathy-irc-network-dialog.c
index e6b4a6f7f..8d4676417 100644
--- a/libempathy-gtk/empathy-irc-network-dialog.c
+++ b/libempathy-gtk/empathy-irc-network-dialog.c
@@ -27,8 +27,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-protocol.h>
-
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-account.h>
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index f05017c9c..11ddca74b 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -419,7 +419,7 @@ log_window_find_populate (EmpathyLogWindow *window,
date_readable = empathy_log_manager_get_date_readable (hit->date);
account_name = empathy_account_get_display_name (hit->account);
- account_icon = empathy_icon_name_from_account (hit->account);
+ account_icon = empathy_account_get_icon_name (hit->account);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
@@ -774,7 +774,7 @@ log_window_chats_set_selected (EmpathyLogWindow *window,
COL_CHAT_IS_CHATROOM, &this_is_chatroom,
-1);
- if (empathy_account_equal (this_account, account) &&
+ if (this_account == account &&
strcmp (this_chat_id, chat_id) == 0 &&
this_is_chatroom == is_chatroom) {
gtk_tree_selection_select_iter (selection, &iter);
diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c
index 77b368bd9..66b2adb2d 100644
--- a/libempathy-gtk/empathy-new-message-dialog.c
+++ b/libempathy-gtk/empathy-new-message-dialog.c
@@ -27,8 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
-#include <libmissioncontrol/mission-control.h>
-
#include <libempathy/empathy-call-factory.h>
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-contact-manager.h>
diff --git a/libempathy-gtk/empathy-profile-chooser.c b/libempathy-gtk/empathy-profile-chooser.c
deleted file mode 100644
index b3cbf90d0..000000000
--- a/libempathy-gtk/empathy-profile-chooser.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * Copyright (C) 2007-2009 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- * Jonny Lamb <jonny.lamb@collabora.co.uk>
- */
-
-#include <config.h>
-
-#include <string.h>
-
-#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-profile.h>
-#include <libmissioncontrol/mc-protocol.h>
-
-#include <libempathy/empathy-utils.h>
-
-#include "empathy-profile-chooser.h"
-#include "empathy-ui-utils.h"
-
-/**
- * SECTION:empathy-profile-chooser
- * @title: EmpathyProfileChooser
- * @short_description: A widget used to choose from a list of profiles
- * @include: libempathy-gtk/empathy-profile-chooser.h
- *
- * #EmpathyProfileChooser is a widget which extends #GtkComboBox to provides a
- * chooser of available profiles.
- */
-
-/**
- * EmpathyProfileChooser:
- * @parent: parent object
- *
- * Widget which extends #GtkComboBox to provide a chooser of available
- * profiles.
- */
-
-#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyProfileChooser)
-typedef struct
-{
- GtkListStore *store;
- gboolean dispose_run;
-} EmpathyProfileChooserPriv;
-
-enum
-{
- COL_ICON,
- COL_LABEL,
- COL_PROFILE,
- COL_COUNT
-};
-
-G_DEFINE_TYPE (EmpathyProfileChooser, empathy_profile_chooser,
- GTK_TYPE_COMBO_BOX);
-
-static gint
-profile_chooser_sort_profile_value (McProfile *profile)
-{
- guint i;
- const gchar *profile_name;
- const gchar *names[] = {
- "jabber",
- "salut",
- "gtalk",
- NULL
- };
-
- profile_name = mc_profile_get_unique_name (profile);
-
- for (i = 0 ; names[i]; i++)
- {
- if (strcmp (profile_name, names[i]) == 0)
- return i;
- }
-
- return i;
-}
-
-static gint
-profile_chooser_sort_func (GtkTreeModel *model,
- GtkTreeIter *iter_a,
- GtkTreeIter *iter_b,
- gpointer user_data)
-{
- McProfile *profile_a;
- McProfile *profile_b;
- gint cmp;
-
- gtk_tree_model_get (model, iter_a,
- COL_PROFILE, &profile_a,
- -1);
- gtk_tree_model_get (model, iter_b,
- COL_PROFILE, &profile_b,
- -1);
-
- cmp = profile_chooser_sort_profile_value (profile_a);
- cmp -= profile_chooser_sort_profile_value (profile_b);
- if (cmp == 0)
- {
- cmp = strcmp (mc_profile_get_display_name (profile_a),
- mc_profile_get_display_name (profile_b));
- }
-
- g_object_unref (profile_a);
- g_object_unref (profile_b);
-
- return cmp;
-}
-
-static void
-profile_chooser_constructed (GObject *object)
-{
- EmpathyProfileChooser *profile_chooser;
- EmpathyProfileChooserPriv *priv;
-
- GList *profiles, *l, *seen;
- GtkCellRenderer *renderer;
- GtkTreeIter iter;
- gboolean iter_set = FALSE;
- McManager *btf_cm;
-
- priv = GET_PRIV (object);
- profile_chooser = EMPATHY_PROFILE_CHOOSER (object);
-
- /* set up combo box with new store */
- priv->store = gtk_list_store_new (COL_COUNT,
- G_TYPE_STRING, /* Icon name */
- G_TYPE_STRING, /* Label */
- MC_TYPE_PROFILE); /* Profile */
-
- gtk_combo_box_set_model (GTK_COMBO_BOX (object),
- GTK_TREE_MODEL (priv->store));
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
- "icon-name", COL_ICON,
- NULL);
- g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
- "text", COL_LABEL,
- NULL);
-
- btf_cm = mc_manager_lookup ("butterfly");
- profiles = mc_profiles_list ();
- seen = NULL;
- for (l = profiles; l; l = g_list_next (l))
- {
- McProfile *profile;
- McProtocol *protocol;
- const gchar *unique_name;
-
- profile = l->data;
-
- /* Check if the CM is installed, otherwise skip that profile.
- * Workaround SF bug #1688779 */
- protocol = mc_profile_get_protocol (profile);
- if (!protocol)
- continue;
-
- g_object_unref (protocol);
-
- /* Skip MSN-Haze if we have butterfly */
- unique_name = mc_profile_get_unique_name (profile);
- if (btf_cm && strcmp (unique_name, "msn-haze") == 0)
- continue;
-
- if (g_list_find_custom (seen, unique_name, (GCompareFunc) strcmp))
- continue;
-
- seen = g_list_append (seen, (char *) unique_name);
-
- gtk_list_store_insert_with_values (priv->store, &iter, 0,
- COL_ICON, mc_profile_get_icon_name (profile),
- COL_LABEL, mc_profile_get_display_name (profile),
- COL_PROFILE, profile,
- -1);
- iter_set = TRUE;
- }
-
- g_list_free (seen);
-
- if (btf_cm)
- g_object_unref (btf_cm);
-
- /* Set the profile sort function */
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
- COL_PROFILE,
- profile_chooser_sort_func,
- NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
- COL_PROFILE,
- GTK_SORT_ASCENDING);
-
- if (iter_set)
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
-
- mc_profiles_free_list (profiles);
-
- if (G_OBJECT_CLASS (empathy_profile_chooser_parent_class)->constructed)
- G_OBJECT_CLASS (empathy_profile_chooser_parent_class)->constructed (object);
-}
-
-static void
-empathy_profile_chooser_init (EmpathyProfileChooser *profile_chooser)
-{
- EmpathyProfileChooserPriv *priv =
- G_TYPE_INSTANCE_GET_PRIVATE (profile_chooser,
- EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooserPriv);
-
- priv->dispose_run = FALSE;
-
- profile_chooser->priv = priv;
-}
-
-static void
-profile_chooser_dispose (GObject *object)
-{
- EmpathyProfileChooser *profile_chooser = EMPATHY_PROFILE_CHOOSER (object);
- EmpathyProfileChooserPriv *priv = GET_PRIV (profile_chooser);
-
- if (priv->dispose_run)
- return;
-
- priv->dispose_run = TRUE;
-
- if (priv->store)
- {
- g_object_unref (priv->store);
- priv->store = NULL;
- }
-
- (G_OBJECT_CLASS (empathy_profile_chooser_parent_class)->dispose) (object);
-}
-
-static void
-empathy_profile_chooser_class_init (EmpathyProfileChooserClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->constructed = profile_chooser_constructed;
- object_class->dispose = profile_chooser_dispose;
-
- g_type_class_add_private (object_class, sizeof (EmpathyProfileChooserPriv));
-}
-
-/**
- * empathy_profile_chooser_dup_selected:
- * @profile_chooser: an #EmpathyProfileChooser
- *
- * Returns a new reference to the selected #McProfile in @profile_chooser. The
- * returned #McProfile should be unrefed with g_object_unref() when finished
- * with.
- *
- * Return value: a new reference to the selected #McProfile
- */
-McProfile *
-empathy_profile_chooser_dup_selected (EmpathyProfileChooser *profile_chooser)
-{
- EmpathyProfileChooserPriv *priv = GET_PRIV (profile_chooser);
- GtkTreeIter iter;
- McProfile *profile = NULL;
-
- g_return_val_if_fail (EMPATHY_IS_PROFILE_CHOOSER (profile_chooser), NULL);
-
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (profile_chooser), &iter))
- {
- gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
- COL_PROFILE, &profile,
- -1);
- }
-
- return profile;
-}
-
-/**
- * empathy_profile_chooser_n_profiles:
- * @profile_chooser: an #EmpathyProfileChooser
- *
- * Returns the number of profiles in @profile_chooser.
- *
- * Return value: the number of profiles in @profile_chooser
- */
-gint
-empathy_profile_chooser_n_profiles (EmpathyProfileChooser *profile_chooser)
-{
- EmpathyProfileChooserPriv *priv = GET_PRIV (profile_chooser);
-
- g_return_val_if_fail (EMPATHY_IS_PROFILE_CHOOSER (profile_chooser), 0);
-
- return gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL);
-}
-
-/**
- * empathy_profile_chooser_new:
- *
- * Creates a new #EmpathyProfileChooser widget.
- *
- * Return value: a new #EmpathyProfileChooser widget
- */
-GtkWidget *
-empathy_profile_chooser_new (void)
-{
- return GTK_WIDGET (g_object_new (EMPATHY_TYPE_PROFILE_CHOOSER, NULL));
-}
diff --git a/libempathy-gtk/empathy-profile-chooser.h b/libempathy-gtk/empathy-profile-chooser.h
deleted file mode 100644
index 37d7241a9..000000000
--- a/libempathy-gtk/empathy-profile-chooser.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * Copyright (C) 2007-2009 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors: Xavier Claessens <xclaesse@gmail.com>
- * Jonny Lamb <jonny.lamb@collabora.co.uk
- */
-
-#ifndef __EMPATHY_PROFILE_CHOOSER_H__
-#define __EMPATHY_PROFILE_CHOOSER_H__
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include <libmissioncontrol/mc-profile.h>
-
-G_BEGIN_DECLS
-
-#define EMPATHY_TYPE_PROFILE_CHOOSER (empathy_profile_chooser_get_type ())
-#define EMPATHY_PROFILE_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
- EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooser))
-#define EMPATHY_PROFILE_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
- EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooserClass))
-#define EMPATHY_IS_PROFILE_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
- EMPATHY_TYPE_PROFILE_CHOOSER))
-#define EMPATHY_IS_PROFILE_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
- EMPATHY_TYPE_PROFILE_CHOOSER))
-#define EMPATHY_PROFILE_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
- EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooserClass))
-
-typedef struct _EmpathyProfileChooser EmpathyProfileChooser;
-typedef struct _EmpathyProfileChooserClass EmpathyProfileChooserClass;
-
-struct _EmpathyProfileChooser
-{
- GtkComboBox parent;
-
- /*<private>*/
- gpointer priv;
-};
-
-struct _EmpathyProfileChooserClass
-{
- GtkComboBoxClass parent_class;
-};
-
-GType empathy_profile_chooser_get_type (void) G_GNUC_CONST;
-GtkWidget * empathy_profile_chooser_new (void);
-McProfile * empathy_profile_chooser_dup_selected (
- EmpathyProfileChooser *profile_chooser);
-gint empathy_profile_chooser_n_profiles (
- EmpathyProfileChooser *profile_chooser);
-
-G_END_DECLS
-#endif /* __EMPATHY_PROFILE_CHOOSER_H__ */
diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c
new file mode 100644
index 000000000..f148edb99
--- /dev/null
+++ b/libempathy-gtk/empathy-protocol-chooser.c
@@ -0,0 +1,425 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/*
+ * Copyright (C) 2007-2009 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ * Jonny Lamb <jonny.lamb@collabora.co.uk>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <telepathy-glib/util.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-connection-managers.h>
+
+#include "empathy-protocol-chooser.h"
+#include "empathy-ui-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
+
+/**
+ * SECTION:empathy-protocol-chooser
+ * @title: EmpathyProtocolChooser
+ * @short_description: A widget used to choose from a list of protocols
+ * @include: libempathy-gtk/empathy-protocol-chooser.h
+ *
+ * #EmpathyProtocolChooser is a widget which extends #GtkComboBox to provides a
+ * chooser of available protocols.
+ */
+
+/**
+ * EmpathyProtocolChooser:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkComboBox to provide a chooser of available
+ * protocols.
+ */
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyProtocolChooser)
+typedef struct
+{
+ GtkListStore *store;
+
+ gboolean dispose_run;
+ EmpathyConnectionManagers *cms;
+
+ EmpathyProtocolChooserFilterFunc filter_func;
+ gpointer filter_user_data;
+} EmpathyProtocolChooserPriv;
+
+enum
+{
+ COL_ICON,
+ COL_LABEL,
+ COL_CM,
+ COL_PROTOCOL,
+ COL_COUNT
+};
+
+G_DEFINE_TYPE (EmpathyProtocolChooser, empathy_protocol_chooser,
+ GTK_TYPE_COMBO_BOX);
+
+static gint
+protocol_chooser_sort_protocol_value (TpConnectionManagerProtocol *protocol)
+{
+ guint i;
+ const gchar *names[] = {
+ "jabber",
+ "salut",
+ "gtalk",
+ NULL
+ };
+
+ for (i = 0 ; names[i]; i++)
+ {
+ if (strcmp (protocol->name, names[i]) == 0)
+ return i;
+ }
+
+ return i;
+}
+
+static gint
+protocol_chooser_sort_func (GtkTreeModel *model,
+ GtkTreeIter *iter_a,
+ GtkTreeIter *iter_b,
+ gpointer user_data)
+{
+ TpConnectionManagerProtocol *protocol_a;
+ TpConnectionManagerProtocol *protocol_b;
+ gint cmp;
+
+ gtk_tree_model_get (model, iter_a,
+ COL_PROTOCOL, &protocol_a,
+ -1);
+ gtk_tree_model_get (model, iter_b,
+ COL_PROTOCOL, &protocol_b,
+ -1);
+
+ cmp = protocol_chooser_sort_protocol_value (protocol_a);
+ cmp -= protocol_chooser_sort_protocol_value (protocol_b);
+ if (cmp == 0)
+ {
+ cmp = strcmp (protocol_a->name, protocol_b->name);
+ }
+
+ return cmp;
+}
+
+static const char *
+protocol_chooser_proto_name_to_display_name (const gchar *proto_name)
+{
+ int i;
+ static struct {
+ const gchar *proto;
+ const gchar *display;
+ } names[] = {
+ { "jabber", "XMPP" },
+ { "msn", "MSN" },
+ { "local-xmpp", "Salut" },
+ { "irc", "IRC" },
+ { "icq", "ICQ" },
+ { "aim", "AIM" },
+ { "yahoo", "Yahoo" },
+ { "groupwise", "GroupWise" },
+ { "sip", "SIP" },
+ { NULL, NULL }
+ };
+
+ for (i = 0; names[i].proto != NULL; i++)
+ {
+ if (!tp_strdiff (proto_name, names[i].proto))
+ return names[i].display;
+ }
+
+ return NULL;
+}
+
+static void
+protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
+ TpConnectionManager *cm)
+{
+ EmpathyProtocolChooserPriv *priv = GET_PRIV (chooser);
+ const TpConnectionManagerProtocol * const *iter;
+
+ for (iter = cm->protocols; iter != NULL && *iter != NULL; iter++)
+ {
+ const TpConnectionManagerProtocol *proto = *iter;
+ gchar *icon_name;
+ const gchar *display_name;
+ gchar *display_name_set;
+
+ icon_name = empathy_protocol_icon_name (proto->name);
+ display_name = protocol_chooser_proto_name_to_display_name (proto->name);
+
+ if (display_name == NULL)
+ display_name = proto->name;
+
+ if (!tp_strdiff (cm->name, "haze"))
+ display_name_set = g_strdup_printf ("%s (Haze)", display_name);
+ else
+ display_name_set = g_strdup (display_name);
+
+ gtk_list_store_insert_with_values (priv->store,
+ NULL, 0,
+ COL_ICON, icon_name,
+ COL_LABEL, display_name_set,
+ COL_CM, cm,
+ COL_PROTOCOL, proto,
+ -1);
+
+ g_free (display_name_set);
+ g_free (icon_name);
+ }
+}
+
+static void
+protocol_chooser_add_cms_list (EmpathyProtocolChooser *protocol_chooser,
+ GList *cms)
+{
+ GList *l;
+
+ for (l = cms; l != NULL; l = l->next)
+ protocol_choosers_add_cm (protocol_chooser, l->data);
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (protocol_chooser), 0);
+}
+
+static void
+protocol_chooser_cms_ready_cb (EmpathyConnectionManagers *cms,
+ GParamSpec *pspec,
+ EmpathyProtocolChooser *protocol_chooser)
+{
+ if (empathy_connection_managers_is_ready (cms))
+ protocol_chooser_add_cms_list
+ (protocol_chooser, empathy_connection_managers_get_cms (cms));
+}
+
+static void
+protocol_chooser_constructed (GObject *object)
+{
+ EmpathyProtocolChooser *protocol_chooser;
+ EmpathyProtocolChooserPriv *priv;
+ GtkCellRenderer *renderer;
+
+ priv = GET_PRIV (object);
+ protocol_chooser = EMPATHY_PROTOCOL_CHOOSER (object);
+
+ /* set up combo box with new store */
+ priv->store = gtk_list_store_new (COL_COUNT,
+ G_TYPE_STRING, /* Icon name */
+ G_TYPE_STRING, /* Label */
+ G_TYPE_OBJECT, /* CM */
+ G_TYPE_POINTER); /* protocol */
+
+ /* Set the protocol sort function */
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
+ COL_PROTOCOL,
+ protocol_chooser_sort_func,
+ NULL, NULL);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
+ COL_PROTOCOL,
+ GTK_SORT_ASCENDING);
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (object),
+ GTK_TREE_MODEL (priv->store));
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
+ "icon-name", COL_ICON,
+ NULL);
+ g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
+ "text", COL_LABEL,
+ NULL);
+
+ if (empathy_connection_managers_is_ready (priv->cms))
+ protocol_chooser_add_cms_list (protocol_chooser,
+ empathy_connection_managers_get_cms (priv->cms));
+ else
+ g_signal_connect (priv->cms, "notify::ready",
+ G_CALLBACK (protocol_chooser_cms_ready_cb), protocol_chooser);
+
+ if (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->constructed)
+ G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->constructed (object);
+}
+
+static void
+empathy_protocol_chooser_init (EmpathyProtocolChooser *protocol_chooser)
+{
+ EmpathyProtocolChooserPriv *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (protocol_chooser,
+ EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserPriv);
+
+ priv->dispose_run = FALSE;
+ priv->cms = empathy_connection_managers_dup_singleton ();
+
+ protocol_chooser->priv = priv;
+}
+
+static void
+protocol_chooser_dispose (GObject *object)
+{
+ EmpathyProtocolChooser *protocol_chooser = EMPATHY_PROTOCOL_CHOOSER (object);
+ EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
+
+ if (priv->dispose_run)
+ return;
+
+ priv->dispose_run = TRUE;
+
+ if (priv->store)
+ {
+ g_object_unref (priv->store);
+ priv->store = NULL;
+ }
+
+ if (priv->cms)
+ {
+ g_object_unref (priv->cms);
+ priv->cms = NULL;
+ }
+
+ (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->dispose) (object);
+}
+
+static void
+empathy_protocol_chooser_class_init (EmpathyProtocolChooserClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructed = protocol_chooser_constructed;
+ object_class->dispose = protocol_chooser_dispose;
+
+ g_type_class_add_private (object_class, sizeof (EmpathyProtocolChooserPriv));
+}
+
+static gboolean
+protocol_chooser_filter_visible_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ EmpathyProtocolChooser *protocol_chooser = user_data;
+ EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
+ TpConnectionManager *cm = NULL;
+ TpConnectionManagerProtocol *protocol = NULL;
+ gboolean visible = FALSE;
+
+ gtk_tree_model_get (model, iter, COL_CM, &cm, COL_PROTOCOL, &protocol, -1);
+
+ if (cm != NULL && protocol != NULL)
+ {
+ visible = priv->filter_func (cm, protocol, priv->filter_user_data);
+ g_object_unref (cm);
+ }
+
+ return visible;
+}
+
+/* public methods */
+
+/**
+ * empathy_protocol_chooser_get_selected_protocol:
+ * @protocol_chooser: an #EmpathyProtocolChooser
+ *
+ * Returns a pointer to the selected #TpConnectionManagerProtocol in
+ * @protocol_chooser.
+ *
+ * Return value: a pointer to the selected #TpConnectionManagerProtocol
+ */
+TpConnectionManager *
+empathy_protocol_chooser_dup_selected (
+ EmpathyProtocolChooser *protocol_chooser,
+ TpConnectionManagerProtocol **protocol)
+{
+ GtkTreeIter iter;
+ TpConnectionManager *cm = NULL;
+ GtkTreeModel *cur_model;
+
+ g_return_val_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser), NULL);
+
+ /* get the current model from the chooser, as we could either be filtering
+ * or not.
+ */
+ cur_model = gtk_combo_box_get_model (GTK_COMBO_BOX (protocol_chooser));
+
+ if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (protocol_chooser), &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
+ COL_CM, &cm,
+ -1);
+
+ if (protocol != NULL)
+ gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
+ COL_PROTOCOL, protocol,
+ -1);
+ }
+
+ return cm;
+}
+
+/**
+ * empathy_protocol_chooser_new:
+ *
+ * Triggers the creation of a new #EmpathyProtocolChooser.
+ *
+ * Return value: a new #EmpathyProtocolChooser widget
+ */
+
+GtkWidget *
+empathy_protocol_chooser_new (void)
+{
+ return GTK_WIDGET (g_object_new (EMPATHY_TYPE_PROTOCOL_CHOOSER, NULL));
+}
+
+void
+empathy_protocol_chooser_set_visible (EmpathyProtocolChooser *protocol_chooser,
+ EmpathyProtocolChooserFilterFunc func,
+ gpointer user_data)
+{
+ EmpathyProtocolChooserPriv *priv;
+ GtkTreeModel *filter_model;
+
+ g_return_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser));
+
+ priv = GET_PRIV (protocol_chooser);
+ priv->filter_func = func;
+ priv->filter_user_data = user_data;
+
+ filter_model = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store),
+ NULL);
+ gtk_combo_box_set_model (GTK_COMBO_BOX (protocol_chooser), filter_model);
+ g_object_unref (filter_model);
+
+ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER
+ (filter_model), protocol_chooser_filter_visible_func,
+ protocol_chooser, NULL);
+
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (protocol_chooser), 0);
+}
diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h
new file mode 100644
index 000000000..55e8e355e
--- /dev/null
+++ b/libempathy-gtk/empathy-protocol-chooser.h
@@ -0,0 +1,77 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/*
+ * Copyright (C) 2007-2009 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Xavier Claessens <xclaesse@gmail.com>
+ * Jonny Lamb <jonny.lamb@collabora.co.uk
+ */
+
+#ifndef __EMPATHY_PROTOCOL_CHOOSER_H__
+#define __EMPATHY_PROTOCOL_CHOOSER_H__
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include <telepathy-glib/connection-manager.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_PROTOCOL_CHOOSER (empathy_protocol_chooser_get_type ())
+#define EMPATHY_PROTOCOL_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooser))
+#define EMPATHY_PROTOCOL_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
+ EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserClass))
+#define EMPATHY_IS_PROTOCOL_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ EMPATHY_TYPE_PROTOCOL_CHOOSER))
+#define EMPATHY_IS_PROTOCOL_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+ EMPATHY_TYPE_PROTOCOL_CHOOSER))
+#define EMPATHY_PROTOCOL_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o),\
+ EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserClass))
+
+typedef struct _EmpathyProtocolChooser EmpathyProtocolChooser;
+typedef struct _EmpathyProtocolChooserClass EmpathyProtocolChooserClass;
+
+struct _EmpathyProtocolChooser
+{
+ GtkComboBox parent;
+
+ /*<private>*/
+ gpointer priv;
+};
+
+struct _EmpathyProtocolChooserClass
+{
+ GtkComboBoxClass parent_class;
+};
+
+typedef gboolean (*EmpathyProtocolChooserFilterFunc) (TpConnectionManager *cm,
+ TpConnectionManagerProtocol *protocol, gpointer user_data);
+
+GType empathy_protocol_chooser_get_type (void) G_GNUC_CONST;
+GtkWidget * empathy_protocol_chooser_new (void);
+TpConnectionManager *empathy_protocol_chooser_dup_selected (
+ EmpathyProtocolChooser *protocol_chooser,
+ TpConnectionManagerProtocol **protocol);
+
+void empathy_protocol_chooser_set_visible (
+ EmpathyProtocolChooser *protocol_chooser,
+ EmpathyProtocolChooserFilterFunc func,
+ gpointer user_data);
+
+
+G_END_DECLS
+#endif /* __EMPATHY_PROTOCOL_CHOOSER_H__ */
diff --git a/libempathy-gtk/empathy-share-my-desktop.c b/libempathy-gtk/empathy-share-my-desktop.c
index b981d5ade..01c2e183f 100644
--- a/libempathy-gtk/empathy-share-my-desktop.c
+++ b/libempathy-gtk/empathy-share-my-desktop.c
@@ -23,6 +23,8 @@
#include <dbus/dbus-glib.h>
#include <telepathy-glib/util.h>
#include <telepathy-glib/contact.h>
+#include <telepathy-glib/channel.h>
+#include <telepathy-glib/interfaces.h>
#define DEBUG_FLAG EMPATHY_DEBUG_SHARE_DESKTOP
#include <libempathy/empathy-debug.h>
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index b286464d2..e1094f1be 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -31,7 +31,6 @@
#include <libempathy/empathy-time.h>
#include <libempathy/empathy-utils.h>
-#include <libmissioncontrol/mc-profile.h>
#include "empathy-theme-adium.h"
#include "empathy-smiley-manager.h"
@@ -479,7 +478,6 @@ theme_adium_append_html (EmpathyThemeAdium *theme,
} else if (theme_adium_match (&cur, "%time")) {
gchar *format = NULL;
gchar *end;
-
/* Time can be in 2 formats:
* %time% or %time{strftime format}%
* Extract the time format if provided. */
@@ -524,7 +522,6 @@ theme_adium_append_message (EmpathyChatView *view,
EmpathyThemeAdiumPriv *priv = GET_PRIV (theme);
EmpathyContact *sender;
EmpathyAccount *account;
- McProfile *account_profile;
gchar *dup_body = NULL;
const gchar *body;
const gchar *name;
@@ -548,8 +545,7 @@ theme_adium_append_message (EmpathyChatView *view,
/* Get information */
sender = empathy_message_get_sender (msg);
account = empathy_contact_get_account (sender);
- account_profile = empathy_account_get_profile (account);
- service_name = mc_profile_get_display_name (account_profile);
+ service_name = empathy_account_get_protocol (account);
timestamp = empathy_message_get_timestamp (msg);
body = empathy_message_get_body (msg);
dup_body = theme_adium_parse_body (theme, body);
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 32abc5884..c12cbd1c9 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -38,8 +38,6 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
-#include <libmissioncontrol/mc-profile.h>
-
#include "empathy-ui-utils.h"
#include "empathy-images.h"
#include "empathy-conf.h"
@@ -183,16 +181,6 @@ empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
}
const gchar *
-empathy_icon_name_from_account (EmpathyAccount *account)
-{
- McProfile *profile;
-
- profile = empathy_account_get_profile (account);
-
- return mc_profile_get_icon_name (profile);
-}
-
-const gchar *
empathy_icon_name_for_presence (TpConnectionPresenceType presence)
{
switch (presence) {
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 3299a44e0..afb409af4 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -34,8 +34,6 @@
#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-profile.h>
-
#include <libempathy/empathy-contact.h>
#include <libempathy/empathy-account.h>
#include <libempathy/empathy-ft-handler.h>
@@ -59,7 +57,6 @@ GtkWidget *empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
GtkWidget *root);
/* Pixbufs */
-const gchar * empathy_icon_name_from_account (EmpathyAccount *account);
const gchar * empathy_icon_name_for_presence (TpConnectionPresenceType presence);
const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
GdkPixbuf * empathy_pixbuf_from_data (gchar *data,