diff options
-rw-r--r-- | libempathy-gtk/empathy-account-widget-skype.c | 76 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget-skype.h | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 74 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget.h | 2 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.c | 3 |
5 files changed, 81 insertions, 77 deletions
diff --git a/libempathy-gtk/empathy-account-widget-skype.c b/libempathy-gtk/empathy-account-widget-skype.c index 993190a30..b5d9a4d65 100644 --- a/libempathy-gtk/empathy-account-widget-skype.c +++ b/libempathy-gtk/empathy-account-widget-skype.c @@ -17,6 +17,7 @@ * Boston, MA 02110-1301 USA * * Authors: Danielle Madeley <danielle.madeley@collabora.co.uk> + * Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> */ #include <config.h> @@ -489,3 +490,78 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self, self->ui_details->default_focus = g_strdup ("entry_id"); } } + +gboolean +empathy_account_widget_skype_show_eula (GtkWindow *parent) +{ + GtkWidget *dialog, *textview, *vbox, *scrolledwindow; + GtkTextBuffer *buffer; + gchar *filename, *l10n_filename; + const gchar * const * langs; + GError *error = NULL; + gchar *eula; + gint result; + gsize len; + gint i; + + filename = empathy_file_lookup ("skype-eula.txt", "data"); + + langs = g_get_language_names (); + + for (i = 0; langs[i] != NULL; i++) + { + l10n_filename = g_strconcat (filename, ".", langs[i], NULL); + g_file_get_contents (l10n_filename, &eula, &len, NULL); + g_free (l10n_filename); + + if (eula != NULL) + break; + } + + if (eula == NULL) + { + DEBUG ("Could not open translated Skype EULA"); + 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); +} + diff --git a/libempathy-gtk/empathy-account-widget-skype.h b/libempathy-gtk/empathy-account-widget-skype.h index 46f70d04e..3ca1e76bc 100644 --- a/libempathy-gtk/empathy-account-widget-skype.h +++ b/libempathy-gtk/empathy-account-widget-skype.h @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: Danielle Madeley <danielle.madeley@collabora.co.uk> + * Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> */ #ifndef __EMPATHY_ACCOUNT_WIDGET_SKYPE_H__ @@ -28,6 +29,8 @@ G_BEGIN_DECLS void empathy_account_widget_build_skype (EmpathyAccountWidget *self, const char *filename); +gboolean empathy_account_widget_skype_show_eula (GtkWindow *parent); + G_END_DECLS diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index b9adeca24..03fe0e29e 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1438,80 +1438,6 @@ account_widget_build_groupwise (EmpathyAccountWidget *self, } } -gboolean -account_widget_skype_show_eula (GtkWindow *parent) -{ - GtkWidget *dialog, *textview, *vbox, *scrolledwindow; - GtkTextBuffer *buffer; - gchar *filename, *l10n_filename; - const gchar * const * langs; - GError *error = NULL; - gchar *eula; - gint result; - gsize len; - gint i; - - filename = empathy_file_lookup ("skype-eula.txt", "data"); - - langs = g_get_language_names (); - - for (i = 0; langs[i] != NULL; i++) - { - l10n_filename = g_strconcat (filename, ".", langs[i], NULL); - g_file_get_contents (l10n_filename, &eula, &len, NULL); - g_free (l10n_filename); - - if (eula != NULL) - break; - } - - if (eula == NULL) - { - DEBUG ("Could not open translated Skype EULA"); - 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 149334b03..ecc52e6c6 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -82,8 +82,6 @@ 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 3d9ebb48b..215102eb1 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -46,6 +46,7 @@ #include <libempathy-gtk/empathy-account-widget.h> #include <libempathy-gtk/empathy-account-widget-irc.h> #include <libempathy-gtk/empathy-account-widget-sip.h> +#include <libempathy-gtk/empathy-account-widget-skype.h> #include <libempathy-gtk/empathy-cell-renderer-activatable.h> #include <libempathy-gtk/empathy-images.h> #include <libempathy-gtk/mx-gtk-light-switch.h> @@ -770,7 +771,7 @@ accounts_dialog_protocol_changed_cb (GtkWidget *widget, if (!tp_strdiff (proto->name, "skype")) { - if (!account_widget_skype_show_eula (GTK_WINDOW (dialog))) + if (!empathy_account_widget_skype_show_eula (GTK_WINDOW (dialog))) { gtk_combo_box_set_active ( GTK_COMBO_BOX (priv->combobox_protocol), 0); |