empathy r576 - trunk/libempathy-gtk
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r576 - trunk/libempathy-gtk
- Date: Fri, 18 Jan 2008 23:14:40 +0000 (GMT)
Author: xclaesse
Date: Fri Jan 18 23:14:40 2008
New Revision: 576
URL: http://svn.gnome.org/viewvc/empathy?rev=576&view=rev
Log:
New UI for Jabber accounts, gabble >= 0.7.2 is required. Fixes bug #507840.
Modified:
trunk/libempathy-gtk/empathy-account-widget-jabber.c
trunk/libempathy-gtk/empathy-account-widget-jabber.glade
Modified: trunk/libempathy-gtk/empathy-account-widget-jabber.c
==============================================================================
--- trunk/libempathy-gtk/empathy-account-widget-jabber.c (original)
+++ trunk/libempathy-gtk/empathy-account-widget-jabber.c Fri Jan 18 23:14:40 2008
@@ -32,10 +32,13 @@
#include <libmissioncontrol/mc-profile.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-debug.h>
#include "empathy-account-widget-jabber.h"
#include "empathy-ui-utils.h"
+#define DEBUG_DOMAIN "AccountWidgetJabber"
+
#define PORT_WITHOUT_SSL 5222
#define PORT_WITH_SSL 5223
@@ -51,6 +54,8 @@
GtkWidget *spinbutton_port;
GtkWidget *spinbutton_priority;
GtkWidget *checkbutton_ssl;
+ GtkWidget *checkbutton_ignore_ssl_errors;
+ GtkWidget *checkbutton_encryption;
} EmpathyAccountWidgetJabber;
static gboolean account_widget_jabber_entry_focus_cb (GtkWidget *widget,
@@ -95,10 +100,13 @@
if (G_STR_EMPTY (str)) {
gchar *value = NULL;
+ mc_account_unset_param (settings->account, param);
mc_account_get_param_string (settings->account, param, &value);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %s", param, value);
gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
g_free (value);
} else {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %s", param, str);
mc_account_set_param_string (settings->account, param, str);
}
@@ -121,26 +129,50 @@
account_widget_jabber_checkbutton_toggled_cb (GtkWidget *widget,
EmpathyAccountWidgetJabber *settings)
{
+ gboolean value;
+ gboolean default_value;
+ const gchar *param;
+
+ value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+
if (widget == settings->checkbutton_ssl) {
- gint port = 0;
- gboolean old_ssl;
+ gint port = 0;
mc_account_get_param_int (settings->account, "port", &port);
- old_ssl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- if (old_ssl) {
- if (port == PORT_WITHOUT_SSL) {
+ if (value) {
+ if (port == PORT_WITHOUT_SSL || port == 0) {
port = PORT_WITH_SSL;
}
} else {
- if (port == PORT_WITH_SSL) {
+ if (port == PORT_WITH_SSL || port == 0) {
port = PORT_WITHOUT_SSL;
}
}
-
- mc_account_set_param_int (settings->account, "port", port);
- mc_account_set_param_boolean (settings->account, "old-ssl", old_ssl);
+
gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_port), port);
+ param = "old-ssl";
+ }
+ else if (widget == settings->checkbutton_ignore_ssl_errors) {
+ param = "ignore-ssl-errors";
+ }
+ else if (widget == settings->checkbutton_encryption) {
+ param = "require-encryption";
+ } else {
+ return;
+ }
+
+ /* 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. */
+ mc_account_unset_param (settings->account, param);
+ mc_account_get_param_boolean (settings->account, param, &default_value);
+
+ if (default_value != value) {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param, value);
+ mc_account_set_param_boolean (settings->account, param, value);
+ } else {
+ empathy_debug (DEBUG_DOMAIN, "Unset %s", param, value);
}
}
@@ -148,15 +180,30 @@
account_widget_jabber_value_changed_cb (GtkWidget *spinbutton,
EmpathyAccountWidgetJabber *settings)
{
- gdouble value;
+ gdouble value;
+ const gchar *param;
value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinbutton));
if (spinbutton == settings->spinbutton_port) {
- mc_account_set_param_int (settings->account, "port", (gint) value);
+ param = "port";
}
else if (spinbutton == settings->spinbutton_priority) {
- mc_account_set_param_int (settings->account, "priority", (gint) value);
+ param = "priority";
+ } else {
+ return;
+ }
+
+ if (value != 0) {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param, (gint) value);
+ mc_account_set_param_int (settings->account, param, (gint) value);
+ } else {
+ gint val;
+
+ mc_account_unset_param (settings->account, param);
+ mc_account_get_param_int (settings->account, param, &val);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %d", param, val);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton), val);
}
}
@@ -164,7 +211,8 @@
account_widget_jabber_button_forget_clicked_cb (GtkWidget *button,
EmpathyAccountWidgetJabber *settings)
{
- mc_account_set_param_string (settings->account, "password", "");
+ empathy_debug (DEBUG_DOMAIN, "Unset password");
+ mc_account_unset_param (settings->account, "password");
gtk_entry_set_text (GTK_ENTRY (settings->entry_password), "");
}
@@ -186,6 +234,8 @@
gchar *server = NULL;
gchar *password = NULL;
gboolean old_ssl = FALSE;
+ gboolean ignore_ssl_errors = FALSE;
+ gboolean encryption = FALSE;
mc_account_get_param_int (settings->account, "port", &port);
mc_account_get_param_int (settings->account, "priority", &priority);
@@ -194,6 +244,8 @@
mc_account_get_param_string (settings->account, "server", &server);
mc_account_get_param_string (settings->account, "password", &password);
mc_account_get_param_boolean (settings->account, "old-ssl", &old_ssl);
+ mc_account_get_param_boolean (settings->account, "ignore-ssl-errors", &ignore_ssl_errors);
+ mc_account_get_param_boolean (settings->account, "require-encryption", &encryption);
if (!id) {
McProfile *profile;
@@ -207,13 +259,15 @@
g_object_unref (profile);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (settings->checkbutton_ssl), old_ssl);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_port), port);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_priority), priority);
gtk_entry_set_text (GTK_ENTRY (settings->entry_id), id ? id : "");
- gtk_entry_set_text (GTK_ENTRY (settings->entry_password), password ? password : "");
gtk_entry_set_text (GTK_ENTRY (settings->entry_resource), resource ? resource : "");
gtk_entry_set_text (GTK_ENTRY (settings->entry_server), server ? server : "");
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_port), port);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_priority), priority);
+ gtk_entry_set_text (GTK_ENTRY (settings->entry_password), password ? password : "");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (settings->checkbutton_ssl), old_ssl);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (settings->checkbutton_ignore_ssl_errors), ignore_ssl_errors);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (settings->checkbutton_encryption), encryption);
gtk_widget_set_sensitive (settings->button_forget, !G_STR_EMPTY (password));
@@ -254,6 +308,8 @@
"spinbutton_port", &settings->spinbutton_port,
"spinbutton_priority", &settings->spinbutton_priority,
"checkbutton_ssl", &settings->checkbutton_ssl,
+ "checkbutton_ignore_ssl_errors", &settings->checkbutton_ignore_ssl_errors,
+ "checkbutton_encryption", &settings->checkbutton_encryption,
NULL);
account_widget_jabber_setup (settings);
@@ -270,6 +326,8 @@
"entry_resource", "focus-out-event", account_widget_jabber_entry_focus_cb,
"entry_server", "focus-out-event", account_widget_jabber_entry_focus_cb,
"checkbutton_ssl", "toggled", account_widget_jabber_checkbutton_toggled_cb,
+ "checkbutton_ignore_ssl_errors", "toggled", account_widget_jabber_checkbutton_toggled_cb,
+ "checkbutton_encryption", "toggled", account_widget_jabber_checkbutton_toggled_cb,
NULL);
g_object_unref (glade);
Modified: trunk/libempathy-gtk/empathy-account-widget-jabber.glade
==============================================================================
--- trunk/libempathy-gtk/empathy-account-widget-jabber.glade (original)
+++ trunk/libempathy-gtk/empathy-account-widget-jabber.glade Fri Jan 18 23:14:40 2008
@@ -209,8 +209,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@@ -231,39 +231,17 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton_ssl">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Use encryption (SS_L)</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">3</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">fill</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label_port">
+ <widget class="GtkLabel" id="label_priority">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Port:</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Priority:</property>
+ <property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@@ -272,7 +250,6 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">spinbutton_port</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -289,16 +266,16 @@
</child>
<child>
- <widget class="GtkSpinButton" id="spinbutton_port">
+ <widget class="GtkSpinButton" id="spinbutton_priority">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
- <property name="numeric">True</property>
+ <property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">5222 0 65556 1 10 10</property>
+ <property name="adjustment">0 -128 127 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -310,100 +287,231 @@
</child>
<child>
- <widget class="GtkLabel" id="label_server">
+ <widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Server:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry_server</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label_server">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Server:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">entry_server</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label_port">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Port:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">spinbutton_port</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="entry_server">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_port">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">5222 0 65556 1 10 10</property>
+ </widget>
+ <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>
+ <widget class="GtkCheckButton" id="checkbutton_ssl">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use old SSL</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Override server settings</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">fill</property>
- <property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkEntry" id="entry_server">
+ <widget class="GtkCheckButton" id="checkbutton_encryption">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label_priority">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Priority:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="label" translatable="yes">Encryption required (TLS/SSL)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="spinbutton_priority">
+ <widget class="GtkCheckButton" id="checkbutton_ignore_ssl_errors">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
- <property name="update_policy">GTK_UPDATE_ALWAYS</property>
- <property name="snap_to_ticks">False</property>
- <property name="wrap">False</property>
- <property name="adjustment">0 -128 127 1 10 10</property>
+ <property name="label" translatable="yes">Ignore SSL certificate errors</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]