aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-account-widget.c53
-rw-r--r--libempathy-gtk/empathy-account-widget.h2
-rw-r--r--src/empathy-accounts-dialog.c21
3 files changed, 76 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 03fe0e29e..38353ef4d 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -1438,6 +1438,59 @@ account_widget_build_groupwise (EmpathyAccountWidget *self,
}
}
+gboolean
+account_widget_skype_show_eula (GtkWindow *parent)
+{
+ GtkWidget *dialog, *textview, *vbox, *scrolledwindow;
+ GtkTextBuffer *buffer;
+ gchar *filename = empathy_file_lookup ("skype-eula.txt", "data");
+ gchar *eula;
+ gint result;
+ gsize len;
+ GError *error = NULL;
+
+ g_file_get_contents (filename, &eula, &len, &error);
+ g_free (filename);
+
+ if (error != NULL)
+ {
+ g_warning ("Could not open Skype EULA: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+
+ dialog = gtk_dialog_new_with_buttons (_("End User License Agreement"),
+ parent, GTK_DIALOG_MODAL,
+ _("Decline"), GTK_RESPONSE_CANCEL,
+ _("Accept"), GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ buffer = gtk_text_buffer_new (NULL);
+ gtk_text_buffer_set_text (buffer, eula, len);
+ g_free (eula);
+ textview = gtk_text_view_new_with_buffer (buffer);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD_CHAR);
+
+ vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+ scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_add_with_viewport (
+ GTK_SCROLLED_WINDOW (scrolledwindow), textview);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+ gtk_box_pack_start (GTK_BOX (vbox), scrolledwindow, TRUE, TRUE, 0);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 250);
+ gtk_widget_show_all (dialog);
+
+ result = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+
+ return (result == GTK_RESPONSE_ACCEPT);
+}
+
static void
account_widget_build_skype (EmpathyAccountWidget *self,
const char *filename)
diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h
index ecc52e6c6..149334b03 100644
--- a/libempathy-gtk/empathy-account-widget.h
+++ b/libempathy-gtk/empathy-account-widget.h
@@ -82,6 +82,8 @@ void empathy_account_widget_set_password_param (EmpathyAccountWidget *self,
void empathy_account_widget_set_other_accounts_exist (
EmpathyAccountWidget *self, gboolean others_exist);
+gboolean account_widget_skype_show_eula (GtkWindow *parent);
+
/* protected methods */
void empathy_account_widget_changed (EmpathyAccountWidget *widget);
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 3c690c071..3d9ebb48b 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -740,6 +740,8 @@ accounts_dialog_protocol_changed_cb (GtkWidget *widget,
GtkTreeIter iter;
gboolean creating;
EmpathyAccountSettings *settings;
+ TpConnectionManager *cm;
+ TpConnectionManagerProtocol *proto;
gchar *account = NULL, *password = NULL;
/* The "changed" signal is fired during the initiation of the
@@ -758,6 +760,25 @@ accounts_dialog_protocol_changed_cb (GtkWidget *widget,
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return;
+ cm = empathy_protocol_chooser_dup_selected (
+ EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, NULL, NULL);
+
+ if (cm == NULL)
+ return;
+
+ g_object_unref (cm);
+
+ if (!tp_strdiff (proto->name, "skype"))
+ {
+ if (!account_widget_skype_show_eula (GTK_WINDOW (dialog)))
+ {
+ gtk_combo_box_set_active (
+ GTK_COMBO_BOX (priv->combobox_protocol), 0);
+ empathy_account_dialog_cancel (dialog);
+ return;
+ }
+ }
+
/* Save "account" and "password" parameters */
g_object_get (priv->setting_widget_object, "settings", &settings, NULL);