From 6294f9870191ddc0f8a357907d17ac776ef511ca Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sun, 5 Jul 2009 10:31:15 +0100 Subject: Add missing newline --- libempathy-gtk/empathy-ui-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index baa6d21de..3c8c52746 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1539,4 +1539,4 @@ empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler) G_CALLBACK (file_manager_receive_file_response_cb), handler); gtk_widget_show (widget); -} \ No newline at end of file +} -- cgit v1.2.3 From ddcb104dfa874375ea17cac4de2f273af7327fc4 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sun, 5 Jul 2009 10:43:50 +0100 Subject: Get the icon name from the account object directly --- libempathy-gtk/empathy-account-chooser.c | 2 +- libempathy-gtk/empathy-log-window.c | 2 +- libempathy-gtk/empathy-ui-utils.c | 10 ---------- libempathy-gtk/empathy-ui-utils.h | 1 - 4 files changed, 2 insertions(+), 13 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index 7dccb2179..719cc76c2 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -610,7 +610,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); } diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index f05017c9c..7add30136 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, diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 3c8c52746..00e6a0cb2 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -182,16 +182,6 @@ empathy_builder_unref_and_keep_widget (GtkBuilder *gui, return widget; } -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) { diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index 10f889b0c..fe676b135 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -59,7 +59,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, -- cgit v1.2.3 From 2d517a8bf5f8048a83d753fb0977d4949cbdeb7a Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sun, 5 Jul 2009 13:08:11 +0100 Subject: Remove usage of McProfiles --- libempathy-gtk/empathy-account-widget.c | 140 +++++++++++++++++--------------- libempathy-gtk/empathy-theme-adium.c | 5 +- 2 files changed, 76 insertions(+), 69 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index f602cd8bd..8b71e3fff 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -29,11 +29,11 @@ #include #include -#include - #include #include +#include + #include "empathy-account-widget.h" #include "empathy-ui-utils.h" @@ -60,27 +60,9 @@ account_widget_entry_focus_cb (GtkWidget *widget, 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; @@ -257,37 +239,19 @@ account_widget_generic_format_param_name (const gchar *param_name) static void accounts_widget_generic_setup (EmpathyAccount *account, + TpConnectionManagerParam *params, 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; - } + TpConnectionManagerParam *param; - params = mc_protocol_get_params (protocol); - - for (l = params; l; l = l->next) { - McProtocolParam *param; + for (param = params; param != NULL; 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) { + if (param->flags & TP_CONN_MGR_PARAM_FLAG_REQUIRED) { table_settings = table_common_settings; } else { table_settings = table_advanced_settings; @@ -296,7 +260,7 @@ accounts_widget_generic_setup (EmpathyAccount *account, 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') { + if (param->dbus_signature[0] == 's') { gchar *str; str = g_strdup_printf (_("%s:"), param_name_formatted); @@ -327,20 +291,20 @@ accounts_widget_generic_setup (EmpathyAccount *account, 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') { + 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->signature[0]) { + 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; @@ -373,7 +337,7 @@ accounts_widget_generic_setup (EmpathyAccount *account, 0, 0); gtk_widget_show (widget); } - else if (param->signature[0] == 'b') { + 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, @@ -384,7 +348,7 @@ accounts_widget_generic_setup (EmpathyAccount *account, gtk_widget_show (widget); } else { DEBUG ("Unknown signature for param %s: %s", - param_name_formatted, param->signature); + param_name_formatted, param->dbus_signature); } if (widget) { @@ -393,10 +357,6 @@ accounts_widget_generic_setup (EmpathyAccount *account, g_free (param_name_formatted); } - - g_slist_free (params); - g_object_unref (profile); - g_object_unref (protocol); } static void @@ -475,27 +435,77 @@ empathy_account_widget_set_default_focus (GtkBuilder *gui, NULL); } +static void +account_widget_tp_cm_ready_cb (TpConnectionManager *cm, const GError *error, + gpointer user_data, GObject *weak_object) +{ + GtkBuilder *builder; + EmpathyAccount *account; + GtkWidget *table_common_settings; + GtkWidget *table_advanced_settings; + const TpConnectionManagerProtocol *protocol; + + if (error != NULL) { + DEBUG ("CM wasn't happy: %s", error->message); + return; + } + + account = EMPATHY_ACCOUNT (user_data); + builder = GTK_BUILDER (weak_object); + + table_common_settings = GTK_WIDGET (gtk_builder_get_object (builder, + "table_common_settings")); + table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (builder, + "table_advanced_settings")); + + protocol = tp_connection_manager_get_protocol (cm, + empathy_account_get_protocol (account)); + + accounts_widget_generic_setup (account, protocol->params, + table_common_settings, table_advanced_settings); +} + GtkWidget * empathy_account_widget_generic_new (EmpathyAccount *account) { GtkBuilder *gui; GtkWidget *widget; - GtkWidget *table_common_settings; - GtkWidget *table_advanced_settings; gchar *filename; 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); - accounts_widget_generic_setup (account, table_common_settings, table_advanced_settings); + /* If the profile isn't installed get_protocol will return NULL with MC4 */ + if (empathy_account_get_protocol (account) != NULL) { + TpDBusDaemon *dbus; + TpConnectionManager *cm; + GError *error; - return empathy_builder_unref_and_keep_widget (gui, widget); + dbus = tp_dbus_daemon_dup (NULL); + + cm = tp_connection_manager_new (dbus, + empathy_account_get_connection_manager (account), NULL, &error); + + if (cm == NULL) { + DEBUG ("failed to get the cm: %s", error->message); + g_error_free (error); + g_object_unref (gui); + return NULL; + } + + tp_connection_manager_call_when_ready (cm, account_widget_tp_cm_ready_cb, + account, g_object_unref, G_OBJECT (gui)); + + g_object_unref (dbus); + } else { + /* no protocol information available :(( */ + return empathy_builder_unref_and_keep_widget (gui, widget); + } + + return g_object_ref (widget); } GtkWidget * diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 1f1b3b06d..ca0599e0e 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -348,7 +348,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. */ @@ -393,7 +392,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; @@ -416,8 +414,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); -- cgit v1.2.3 From 0ddbfabe32f0d02a63a21fca5bfb015f4e56bf97 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 6 Jul 2009 11:29:55 +0100 Subject: Transform profile chooser into a protocol chooser --- libempathy-gtk/Makefile.am | 4 +- libempathy-gtk/empathy-profile-chooser.c | 324 ---------------------------- libempathy-gtk/empathy-profile-chooser.h | 69 ------ libempathy-gtk/empathy-protocol-chooser.c | 339 ++++++++++++++++++++++++++++++ libempathy-gtk/empathy-protocol-chooser.h | 70 ++++++ 5 files changed, 411 insertions(+), 395 deletions(-) delete mode 100644 libempathy-gtk/empathy-profile-chooser.c delete mode 100644 libempathy-gtk/empathy-profile-chooser.h create mode 100644 libempathy-gtk/empathy-protocol-chooser.c create mode 100644 libempathy-gtk/empathy-protocol-chooser.h (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index 10931012a..94cc4ee15 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -52,7 +52,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 \ @@ -112,7 +112,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 \ 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 - * Jonny Lamb - */ - -#include - -#include - -#include -#include -#include - -#include - -#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 - * Jonny Lamb -#include - -#include - -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; - - /**/ - 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..45442156e --- /dev/null +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -0,0 +1,339 @@ +/* -*- 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 + * Jonny Lamb + */ + +#include + +#include + +#include + +#include + +#include + +#include "empathy-protocol-chooser.h" +#include "empathy-ui-utils.h" + +#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT +#include + +/** + * 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; + +} 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 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; + gchar *display_name; + + + icon_name = g_strdup_printf ("im-%s", proto->name); + + if (!tp_strdiff (cm->name, "haze") && !tp_strdiff (proto->name, "msn")) + display_name = g_strdup_printf ("msn (Haze)"); + else + display_name = g_strdup (proto->name); + + gtk_list_store_insert_with_values (priv->store, NULL, 0, + COL_ICON, icon_name, + COL_LABEL, display_name, + COL_CM, cm, + COL_PROTOCOL, proto, + -1); + + g_free (display_name); + g_free (icon_name); + } +} + + +static void +protocol_choosers_cms_listed (TpConnectionManager * const *cms, + gsize n_cms, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + TpConnectionManager * const *iter; + + if (error !=NULL) + { + DEBUG ("Failed to get connection managers: %s", error->message); + return; + } + + for (iter = cms ; iter != NULL && *iter != NULL; iter++) + protocol_choosers_add_cm (EMPATHY_PROTOCOL_CHOOSER (weak_object), + *iter); + + gtk_combo_box_set_active (GTK_COMBO_BOX (weak_object), 0); +} + +static void +protocol_chooser_constructed (GObject *object) +{ + EmpathyProtocolChooser *protocol_chooser; + EmpathyProtocolChooserPriv *priv; + + GtkCellRenderer *renderer; + TpDBusDaemon *dbus; + + 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 */ + + 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); + + dbus = tp_dbus_daemon_dup (NULL); + tp_list_connection_managers (dbus, protocol_choosers_cms_listed, + NULL, NULL, object); + g_object_unref (dbus); + + /* 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); + + 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; + + 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; + } + + (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)); +} + +/** + * 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) +{ + EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser); + GtkTreeIter iter; + TpConnectionManager *cm = NULL; + + g_return_val_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser), NULL); + + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (protocol_chooser), &iter)) + { + gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, + COL_CM, &cm, + -1); + + if (protocol != NULL) + gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, + COL_PROTOCOL, protocol, + -1); + } + + return cm; +} + +/** + * empathy_protocol_chooser_n_protocols: + * @protocol_chooser: an #EmpathyProtocolChooser + * + * Returns the number of protocols in @protocol_chooser. + * + * Return value: the number of protocols in @protocol_chooser + */ +gint +empathy_protocol_chooser_n_protocols (EmpathyProtocolChooser *protocol_chooser) +{ + EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser); + + g_return_val_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser), 0); + + return gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL); +} + +/** + * empathy_protocol_chooser_new: + * + * Creates a new #EmpathyProtocolChooser widget. + * + * Return value: a new #EmpathyProtocolChooser widget + */ +GtkWidget * +empathy_protocol_chooser_new (void) +{ + return GTK_WIDGET (g_object_new (EMPATHY_TYPE_PROTOCOL_CHOOSER, NULL)); +} diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h new file mode 100644 index 000000000..75f9343cc --- /dev/null +++ b/libempathy-gtk/empathy-protocol-chooser.h @@ -0,0 +1,70 @@ +/* -*- 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 + * Jonny Lamb +#include + +#include + +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; + + /**/ + gpointer priv; +}; + +struct _EmpathyProtocolChooserClass +{ + GtkComboBoxClass parent_class; +}; + +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); +gint empathy_protocol_chooser_n_protocols ( + EmpathyProtocolChooser *protocol_chooser); + +G_END_DECLS +#endif /* __EMPATHY_PROTOCOL_CHOOSER_H__ */ -- cgit v1.2.3 From 13f92652db89b2c15c3302b4af7560a4e4ee22c9 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 6 Jul 2009 11:56:14 +0100 Subject: Remove useless mission-control includes --- libempathy-gtk/empathy-account-chooser.c | 2 -- libempathy-gtk/empathy-account-widget-irc.c | 2 -- libempathy-gtk/empathy-account-widget-sip.c | 2 -- libempathy-gtk/empathy-contact-dialogs.c | 2 -- libempathy-gtk/empathy-irc-network-dialog.c | 2 -- libempathy-gtk/empathy-new-message-dialog.c | 2 -- libempathy-gtk/empathy-theme-adium.c | 1 - libempathy-gtk/empathy-ui-utils.c | 2 -- libempathy-gtk/empathy-ui-utils.h | 2 -- 9 files changed, 17 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index 719cc76c2..ec2c2b18a 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -29,8 +29,6 @@ #include #include -#include - #include #include diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c index 688a3e0e6..7e0fb89ed 100644 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@ -27,8 +27,6 @@ #include #include -#include - #include #include diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c index 05e917e53..ad8cd7d8e 100644 --- a/libempathy-gtk/empathy-account-widget-sip.c +++ b/libempathy-gtk/empathy-account-widget-sip.c @@ -28,8 +28,6 @@ #include #include -#include - #include #include "empathy-account-widget.h" diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index c1cca3e2b..5b11ddc2e 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -27,8 +27,6 @@ #include #include -#include - #include #include #include 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 #include -#include - #include #include 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 #include -#include - #include #include #include diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index ca0599e0e..0cc2c034d 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -31,7 +31,6 @@ #include #include -#include #include "empathy-theme-adium.h" #include "empathy-smiley-manager.h" diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 00e6a0cb2..7b4cc1d43 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -38,8 +38,6 @@ #include #include -#include - #include "empathy-ui-utils.h" #include "empathy-images.h" #include "empathy-conf.h" diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index fe676b135..312835f0c 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -34,8 +34,6 @@ #include -#include - #include #include #include -- cgit v1.2.3 From 96fad6a1159582a3e8792dd3308ce1fbeb178234 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 8 Jul 2009 11:35:43 +0100 Subject: Initial port of Account and AccountManager to MC5 --- libempathy-gtk/empathy-account-widget-irc.c | 13 ++++--------- libempathy-gtk/empathy-account-widget.c | 9 +++------ 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c index 7e0fb89ed..b2383a02a 100644 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@ -321,11 +321,11 @@ 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; @@ -402,11 +402,6 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) fill_networks_model (settings, network); - - g_free (nick); - g_free (fullname); - g_free (server); - g_free (charset); } /** diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 8b71e3fff..783a48a0a 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -52,13 +52,12 @@ account_widget_entry_focus_cb (GtkWidget *widget, param_name = g_object_get_data (G_OBJECT (widget), "param_name"); if (EMP_STR_EMPTY (str)) { - gchar *value = NULL; + const 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 { DEBUG ("Setting %s to %s", param_name, strstr (param_name, "password") ? "***" : str); @@ -185,11 +184,10 @@ account_widget_setup_widget (GtkWidget *widget, account); } else if (GTK_IS_ENTRY (widget)) { - gchar *str = NULL; + const gchar *str = NULL; str = empathy_account_get_param_string (account, param_name); gtk_entry_set_text (GTK_ENTRY (widget), str ? str : ""); - g_free (str); if (strstr (param_name, "password")) { gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE); @@ -406,14 +404,13 @@ empathy_account_widget_add_forget_button (EmpathyAccount *account, { GtkWidget *button_forget; GtkWidget *entry_password; - gchar *password = NULL; + const gchar *password = NULL; button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button)); entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry)); password = empathy_account_get_param_string (account, "password"); gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password)); - g_free (password); g_signal_connect (button_forget, "clicked", G_CALLBACK (account_widget_forget_clicked_cb), -- cgit v1.2.3 From 96445f9768c9dee5e375522aa3bb3a9a01df7280 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 21 Jul 2009 16:32:44 +0100 Subject: Put (Haze) behind all protocols coming from haze --- libempathy-gtk/empathy-protocol-chooser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index 45442156e..ebb198455 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -137,8 +137,8 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, icon_name = g_strdup_printf ("im-%s", proto->name); - if (!tp_strdiff (cm->name, "haze") && !tp_strdiff (proto->name, "msn")) - display_name = g_strdup_printf ("msn (Haze)"); + if (!tp_strdiff (cm->name, "haze")) + display_name = g_strdup_printf ("%s (Haze)", proto->name); else display_name = g_strdup (proto->name); -- cgit v1.2.3 From 9c3db97dcf9bd237784d401ae3215326a1d77ae2 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 21 Jul 2009 16:56:22 +0100 Subject: Port to using EmpathyAccountSettings --- libempathy-gtk/empathy-account-widget-irc.c | 61 ++++--- libempathy-gtk/empathy-account-widget-irc.h | 4 +- libempathy-gtk/empathy-account-widget-sip.c | 22 ++- libempathy-gtk/empathy-account-widget-sip.h | 4 +- libempathy-gtk/empathy-account-widget.c | 264 ++++++++++++++++------------ libempathy-gtk/empathy-account-widget.h | 25 +-- 6 files changed, 223 insertions(+), 157 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c index b2383a02a..ae41f1e39 100644 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@ -41,7 +41,7 @@ #define IRC_NETWORKS_FILENAME "irc-networks.xml" typedef struct { - EmpathyAccount *account; + EmpathyAccountSettings *settings; EmpathyIrcNetworkManager *network_manager; GtkWidget *vbox_settings; @@ -59,7 +59,7 @@ account_widget_irc_destroy_cb (GtkWidget *widget, EmpathyAccountWidgetIrc *settings) { g_object_unref (settings->network_manager); - g_object_unref (settings->account); + g_object_unref (settings->settings); g_slice_free (EmpathyAccountWidgetIrc, settings); } @@ -67,9 +67,9 @@ static void unset_server_params (EmpathyAccountWidgetIrc *settings) { 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 (settings->settings, "server"); + empathy_account_settings_unset (settings->settings, "port"); + empathy_account_settings_unset (settings->settings, "use-ssl"); } static void @@ -95,7 +95,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 (settings->settings, "charset", charset); g_free (charset); servers = empathy_irc_network_get_servers (network); @@ -114,11 +114,13 @@ 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 (settings->settings, + "server", address); DEBUG ("Setting port to %u", port); - empathy_account_set_param_int (settings->account, "port", port); + empathy_account_settings_set_uint32 (settings->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 (settings->settings, + "use-ssl", ssl); g_free (address); } @@ -329,17 +331,19 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) gboolean ssl = FALSE; EmpathyIrcNetwork *network = 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 (settings->settings, "account"); + fullname = empathy_account_settings_get_string (settings->settings, + "fullname"); + server = empathy_account_settings_get_string (settings->settings, "server"); + charset = empathy_account_settings_get_string (settings->settings, "charset"); + port = empathy_account_settings_get_uint32 (settings->settings, "port"); + ssl = empathy_account_settings_get_boolean (settings->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 (settings->settings, + "account", nick); } if (!fullname) @@ -349,7 +353,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 (settings->settings, + "fullname", fullname); } if (server != NULL) @@ -406,14 +411,14 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) /** * empathy_account_widget_irc_new: - * @account: the #EmpathyAccount to configure + * @settings: the #EmpathyAccountSettings 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) +empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) { EmpathyAccountWidgetIrc *settings; gchar *dir, *user_file_with_path, *global_file_with_path; @@ -423,7 +428,7 @@ empathy_account_widget_irc_new (EmpathyAccount *account) gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetIrc); - settings->account = g_object_ref (account); + settings->settings = g_object_ref (settings); dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL); g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR); @@ -476,7 +481,7 @@ empathy_account_widget_irc_new (EmpathyAccount *account) account_widget_irc_setup (settings); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (account_settings, gui, "entry_nick", "account", "entry_fullname", "fullname", "entry_password", "password", @@ -485,13 +490,19 @@ empathy_account_widget_irc_new (EmpathyAccount *account) 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, + "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"); + empathy_account_widget_add_apply_button (account_settings, + settings->vbox_settings); return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings); } diff --git a/libempathy-gtk/empathy-account-widget-irc.h b/libempathy-gtk/empathy-account-widget-irc.h index 40e58bbc3..0373238ed 100644 --- a/libempathy-gtk/empathy-account-widget-irc.h +++ b/libempathy-gtk/empathy-account-widget-irc.h @@ -22,11 +22,11 @@ #define __EMPATHY_ACCOUNT_WIDGET_IRC_H__ #include -#include +#include G_BEGIN_DECLS -GtkWidget * empathy_account_widget_irc_new (EmpathyAccount *account); +GtkWidget * empathy_account_widget_irc_new (EmpathyAccountSettings *settings); G_END_DECLS diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c index ad8cd7d8e..9f08046b7 100644 --- a/libempathy-gtk/empathy-account-widget-sip.c +++ b/libempathy-gtk/empathy-account-widget-sip.c @@ -35,7 +35,7 @@ #include "empathy-ui-utils.h" typedef struct { - EmpathyAccount *account; + EmpathyAccountSettings *settings; GtkWidget *vbox_settings; @@ -48,7 +48,7 @@ static void account_widget_sip_destroy_cb (GtkWidget *widget, EmpathyAccountWidgetSip *settings) { - g_object_unref (settings->account); + g_object_unref (settings->settings); g_slice_free (EmpathyAccountWidgetSip, settings); } @@ -73,14 +73,14 @@ account_widget_sip_discover_stun_toggled_cb ( * Returns: The toplevel container of the configuration widget */ GtkWidget * -empathy_account_widget_sip_new (EmpathyAccount *account) +empathy_account_widget_sip_new (EmpathyAccountSettings *account_settings) { EmpathyAccountWidgetSip *settings; GtkBuilder *gui; gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetSip); - settings->account = g_object_ref (account); + settings->settings = g_object_ref (account_settings); filename = empathy_file_lookup ("empathy-account-widget-sip.ui", "libempathy-gtk"); @@ -92,7 +92,7 @@ empathy_account_widget_sip_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (account_settings, gui, "entry_userid", "account", "entry_password", "password", "checkbutton_discover-stun", "discover-stun", @@ -100,19 +100,23 @@ empathy_account_widget_sip_new (EmpathyAccount *account) "spinbutton_stun-port", "stun-port", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (account_settings, gui, "button_forget", "entry_password"); - account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun, - settings); + 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, + "checkbutton_discover-stun", "toggled", + account_widget_sip_discover_stun_toggled_cb, NULL); empathy_account_widget_set_default_focus (gui, "entry_userid"); + empathy_account_widget_add_apply_button (account_settings, + settings->vbox_settings); return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings); } diff --git a/libempathy-gtk/empathy-account-widget-sip.h b/libempathy-gtk/empathy-account-widget-sip.h index 69f60aacc..15dd7244a 100644 --- a/libempathy-gtk/empathy-account-widget-sip.h +++ b/libempathy-gtk/empathy-account-widget-sip.h @@ -22,11 +22,11 @@ #define __EMPATHY_ACCOUNT_WIDGET_SIP_H__ #include -#include +#include G_BEGIN_DECLS -GtkWidget * empathy_account_widget_sip_new (EmpathyAccount *account); +GtkWidget * empathy_account_widget_sip_new (EmpathyAccountSettings *settings); G_END_DECLS diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 783a48a0a..ea0a05b35 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -33,6 +33,7 @@ #include #include +#include #include "empathy-account-widget.h" #include "empathy-ui-utils.h" @@ -43,7 +44,7 @@ static gboolean account_widget_entry_focus_cb (GtkWidget *widget, GdkEventFocus *event, - EmpathyAccount *account) + EmpathyAccountSettings *settings) { const gchar *str; const gchar *param_name; @@ -54,14 +55,14 @@ account_widget_entry_focus_cb (GtkWidget *widget, if (EMP_STR_EMPTY (str)) { const gchar *value = NULL; - empathy_account_unset_param (account, param_name); - value = empathy_account_get_param_string (account, param_name); + empathy_account_settings_unset (settings, param_name); + value = empathy_account_settings_get_string (settings, param_name); DEBUG ("Unset %s and restore to %s", param_name, value); gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); } else { DEBUG ("Setting %s to %s", param_name, strstr (param_name, "password") ? "***" : str); - empathy_account_set_param_string (account, param_name, str); + empathy_account_settings_set_string (settings, param_name, str); } return FALSE; @@ -69,28 +70,44 @@ account_widget_entry_focus_cb (GtkWidget *widget, static void account_widget_int_changed_cb (GtkWidget *widget, - EmpathyAccount *account) + EmpathyAccountSettings *settings) { const gchar *param_name; gint value; + const gchar *signature; value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); param_name = g_object_get_data (G_OBJECT (widget), "param_name"); - 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); - } + signature = empathy_settings_get_dbus_signature (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 (settings, param_name, value); + break; + case DBUS_TYPE_INT64: + empathy_account_settings_set_int64 (settings, param_name, value); + break; + case DBUS_TYPE_UINT16: + case DBUS_TYPE_UINT32: + empathy_account_settings_set_uint32 (settings, param_name, value); + break; + case DBUS_TYPE_UINT64: + empathy_account_settings_set_uint64 (settings, param_name, value); + break; + default: + g_return_if_reached (); + } } static void account_widget_checkbutton_toggled_cb (GtkWidget *widget, - EmpathyAccount *account) + EmpathyAccountSettings *settings) { gboolean value; gboolean default_value; @@ -102,14 +119,14 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, /* 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); + empathy_account_settings_unset (settings, param_name); + default_value = empathy_account_settings_get_boolean (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_set_param_boolean (account, param_name, value); + empathy_account_settings_set_boolean (settings, param_name, value); } } @@ -117,14 +134,14 @@ static void account_widget_forget_clicked_cb (GtkWidget *button, GtkWidget *entry) { - EmpathyAccount *account; + EmpathyAccountSettings *settings; const gchar *param_name; param_name = g_object_get_data (G_OBJECT (entry), "param_name"); - account = g_object_get_data (G_OBJECT (entry), "account"); + settings = g_object_get_data (G_OBJECT (entry), "settings"); DEBUG ("Unset %s", param_name); - empathy_account_unset_param (account, param_name); + empathy_account_settings_unset (settings, param_name); gtk_entry_set_text (GTK_ENTRY (entry), ""); } @@ -142,13 +159,13 @@ static void account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl, GtkWidget *spinbutton_port) { - EmpathyAccount *account; + EmpathyAccountSettings *settings; gboolean value; - gint port = 0; + gint32 port = 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"); + settings = g_object_get_data (G_OBJECT (spinbutton_port), "settings"); + port = empathy_account_settings_get_uint32 (settings, "port"); if (value) { if (port == 5222 || port == 0) { @@ -165,28 +182,51 @@ account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl, static void account_widget_setup_widget (GtkWidget *widget, - EmpathyAccount *account, + EmpathyAccountSettings *settings, const gchar *param_name) { 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); + g_object_set_data_full (G_OBJECT (widget), "settings", + g_object_ref (settings), g_object_unref); if (GTK_IS_SPIN_BUTTON (widget)) { gint value = 0; + const gchar *signature; + + signature = empathy_settings_get_dbus_signature (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 (settings, param_name); + break; + case DBUS_TYPE_INT64: + value = empathy_account_settings_get_int64 (settings, param_name); + break; + case DBUS_TYPE_UINT16: + case DBUS_TYPE_UINT32: + value = empathy_account_settings_get_uint32 (settings, param_name); + break; + case DBUS_TYPE_UINT64: + value = empathy_account_settings_get_uint64 (settings, param_name); + break; + default: + g_return_if_reached (); + } - value = empathy_account_get_param_int (account, param_name); gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value); g_signal_connect (widget, "value-changed", G_CALLBACK (account_widget_int_changed_cb), - account); + settings); } else if (GTK_IS_ENTRY (widget)) { const gchar *str = NULL; - str = empathy_account_get_param_string (account, param_name); + str = empathy_account_settings_get_string (settings, param_name); gtk_entry_set_text (GTK_ENTRY (widget), str ? str : ""); if (strstr (param_name, "password")) { @@ -195,17 +235,17 @@ account_widget_setup_widget (GtkWidget *widget, g_signal_connect (widget, "focus-out-event", G_CALLBACK (account_widget_entry_focus_cb), - account); + settings); } else if (GTK_IS_TOGGLE_BUTTON (widget)) { gboolean value = FALSE; - value = empathy_account_get_param_boolean (account, param_name); + value = empathy_account_settings_get_boolean (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), - account); + settings); } else { DEBUG ("Unknown type of widget for param %s", param_name); } @@ -236,14 +276,15 @@ account_widget_generic_format_param_name (const gchar *param_name) } static void -accounts_widget_generic_setup (EmpathyAccount *account, - TpConnectionManagerParam *params, +accounts_widget_generic_setup (EmpathyAccountSettings *settings, GtkWidget *table_common_settings, GtkWidget *table_advanced_settings) { - TpConnectionManagerParam *param; + TpConnectionManagerParam *params, *param; + + params = empathy_account_settings_get_tp_params (settings); - for (param = params; param != NULL; param++) { + for (param = params; param != NULL && param->name != NULL; param++) { GtkWidget *table_settings; guint n_rows = 0; GtkWidget *widget = NULL; @@ -350,7 +391,7 @@ accounts_widget_generic_setup (EmpathyAccount *account, } if (widget) { - account_widget_setup_widget (widget, account, param->name); + account_widget_setup_widget (widget, settings, param->name); } g_free (param_name_formatted); @@ -358,7 +399,7 @@ accounts_widget_generic_setup (EmpathyAccount *account, } static void -account_widget_handle_params_valist (EmpathyAccount *account, +account_widget_handle_params_valist (EmpathyAccountSettings *settings, GtkBuilder *gui, const gchar *first_widget, va_list args) @@ -377,12 +418,12 @@ account_widget_handle_params_valist (EmpathyAccount *account, continue; } - account_widget_setup_widget (GTK_WIDGET (object), account, param_name); + account_widget_setup_widget (GTK_WIDGET (object), settings, param_name); } } void -empathy_account_widget_handle_params (EmpathyAccount *account, +empathy_account_widget_handle_params (EmpathyAccountSettings *settings, GtkBuilder *gui, const gchar *first_widget, ...) @@ -392,12 +433,35 @@ empathy_account_widget_handle_params (EmpathyAccount *account, g_return_if_fail (GTK_IS_BUILDER (gui)); va_start (args, first_widget); - account_widget_handle_params_valist (account, gui, first_widget, args); + account_widget_handle_params_valist (settings, gui, first_widget, args); va_end (args); } +static void +account_widget_apply_clicked_cb (GtkWidget *button, + EmpathyAccountSettings *settings) +{ + empathy_account_settings_apply_async (settings, NULL, NULL); +} + +void +empathy_account_widget_add_apply_button (EmpathyAccountSettings *settings, + GtkWidget *vbox) +{ + GtkWidget *button; + + button = gtk_button_new_from_stock (GTK_STOCK_APPLY); + + gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 3); + + g_signal_connect (button, "clicked", + G_CALLBACK (account_widget_apply_clicked_cb), + settings); + gtk_widget_show (button); +} + void -empathy_account_widget_add_forget_button (EmpathyAccount *account, +empathy_account_widget_add_forget_button (EmpathyAccountSettings *settings, GtkBuilder *gui, const gchar *button, const gchar *entry) @@ -409,7 +473,7 @@ empathy_account_widget_add_forget_button (EmpathyAccount *account, button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button)); entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry)); - password = empathy_account_get_param_string (account, "password"); + password = empathy_account_settings_get_string (settings, "password"); gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password)); g_signal_connect (button_forget, "clicked", @@ -433,37 +497,33 @@ empathy_account_widget_set_default_focus (GtkBuilder *gui, } static void -account_widget_tp_cm_ready_cb (TpConnectionManager *cm, const GError *error, - gpointer user_data, GObject *weak_object) +account_widget_setup_generic (EmpathyAccountSettings *settings, + GtkBuilder *builder) { - GtkBuilder *builder; - EmpathyAccount *account; GtkWidget *table_common_settings; GtkWidget *table_advanced_settings; - const TpConnectionManagerProtocol *protocol; - - if (error != NULL) { - DEBUG ("CM wasn't happy: %s", error->message); - return; - } - - account = EMPATHY_ACCOUNT (user_data); - builder = GTK_BUILDER (weak_object); table_common_settings = GTK_WIDGET (gtk_builder_get_object (builder, "table_common_settings")); table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (builder, "table_advanced_settings")); - protocol = tp_connection_manager_get_protocol (cm, - empathy_account_get_protocol (account)); + accounts_widget_generic_setup (settings, table_common_settings, + table_advanced_settings); +} - accounts_widget_generic_setup (account, protocol->params, - table_common_settings, table_advanced_settings); +static void +account_widget_settings_ready_cb (EmpathyAccountSettings *settings, + GParamSpec *pspec, gpointer user_data) +{ + GtkBuilder *builder = GTK_BUILDER (user_data); + + if (empathy_account_settings_is_ready (settings)) + account_widget_setup_generic (settings, builder); } GtkWidget * -empathy_account_widget_generic_new (EmpathyAccount *account) +empathy_account_widget_generic_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -475,38 +535,19 @@ empathy_account_widget_generic_new (EmpathyAccount *account) "vbox_generic_settings", &widget, NULL); - /* If the profile isn't installed get_protocol will return NULL with MC4 */ - if (empathy_account_get_protocol (account) != NULL) { - TpDBusDaemon *dbus; - TpConnectionManager *cm; - GError *error; - - dbus = tp_dbus_daemon_dup (NULL); + if (empathy_account_settings_is_ready (settings)) + account_widget_setup_generic (settings, gui); + else + g_signal_connect (settings, "notify::ready", + G_CALLBACK (account_widget_settings_ready_cb), gui); - cm = tp_connection_manager_new (dbus, - empathy_account_get_connection_manager (account), NULL, &error); - - if (cm == NULL) { - DEBUG ("failed to get the cm: %s", error->message); - g_error_free (error); - g_object_unref (gui); - return NULL; - } - - tp_connection_manager_call_when_ready (cm, account_widget_tp_cm_ready_cb, - account, g_object_unref, G_OBJECT (gui)); - - g_object_unref (dbus); - } else { - /* no protocol information available :(( */ - return empathy_builder_unref_and_keep_widget (gui, widget); - } + empathy_account_widget_add_apply_button (settings, widget); return g_object_ref (widget); } GtkWidget * -empathy_account_widget_salut_new (EmpathyAccount *account) +empathy_account_widget_salut_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -519,7 +560,7 @@ empathy_account_widget_salut_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_published", "published-name", "entry_nickname", "nickname", "entry_first_name", "first-name", @@ -534,7 +575,7 @@ empathy_account_widget_salut_new (EmpathyAccount *account) } GtkWidget * -empathy_account_widget_msn_new (EmpathyAccount *account) +empathy_account_widget_msn_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -547,14 +588,14 @@ empathy_account_widget_msn_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_id", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (settings, gui, "button_forget", "entry_password"); @@ -564,7 +605,7 @@ empathy_account_widget_msn_new (EmpathyAccount *account) } GtkWidget * -empathy_account_widget_jabber_new (EmpathyAccount *account) +empathy_account_widget_jabber_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -581,7 +622,7 @@ empathy_account_widget_jabber_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_id", "account", "entry_password", "password", "entry_resource", "resource", @@ -593,7 +634,7 @@ empathy_account_widget_jabber_new (EmpathyAccount *account) "checkbutton_encryption", "require-encryption", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (settings, gui, "button_forget", "entry_password"); @@ -603,11 +644,13 @@ empathy_account_widget_jabber_new (EmpathyAccount *account) G_CALLBACK (account_widget_jabber_ssl_toggled_cb), spinbutton_port); + empathy_account_widget_add_apply_button (settings, widget); + return empathy_builder_unref_and_keep_widget (gui, widget); } GtkWidget * -empathy_account_widget_icq_new (EmpathyAccount *account) +empathy_account_widget_icq_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -622,7 +665,7 @@ empathy_account_widget_icq_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_uin", "account", "entry_password", "password", "entry_server", "server", @@ -630,17 +673,19 @@ empathy_account_widget_icq_new (EmpathyAccount *account) "entry_charset", "charset", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (settings, gui, "button_forget", "entry_password"); empathy_account_widget_set_default_focus (gui, "entry_uin"); + empathy_account_widget_add_apply_button (settings, widget); + return empathy_builder_unref_and_keep_widget (gui, widget); } GtkWidget * -empathy_account_widget_aim_new (EmpathyAccount *account) +empathy_account_widget_aim_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -655,24 +700,25 @@ empathy_account_widget_aim_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_screenname", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (settings, gui, "button_forget", "entry_password"); empathy_account_widget_set_default_focus (gui, "entry_screenname"); + empathy_account_widget_add_apply_button (settings, widget); return empathy_builder_unref_and_keep_widget (gui, widget); } GtkWidget * -empathy_account_widget_yahoo_new (EmpathyAccount *account) +empathy_account_widget_yahoo_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -685,7 +731,7 @@ empathy_account_widget_yahoo_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_id", "account", "entry_password", "password", "entry_server", "server", @@ -696,17 +742,18 @@ empathy_account_widget_yahoo_new (EmpathyAccount *account) "checkbutton_ignore_invites", "ignore-invites", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (settings, gui, "button_forget", "entry_password"); empathy_account_widget_set_default_focus (gui, "entry_id"); + empathy_account_widget_add_apply_button (settings, widget); return empathy_builder_unref_and_keep_widget (gui, widget); } GtkWidget * -empathy_account_widget_groupwise_new (EmpathyAccount *account) +empathy_account_widget_groupwise_new (EmpathyAccountSettings *settings) { GtkBuilder *gui; GtkWidget *widget; @@ -719,18 +766,19 @@ empathy_account_widget_groupwise_new (EmpathyAccount *account) NULL); g_free (filename); - empathy_account_widget_handle_params (account, gui, + empathy_account_widget_handle_params (settings, gui, "entry_id", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); - empathy_account_widget_add_forget_button (account, gui, + empathy_account_widget_add_forget_button (settings, gui, "button_forget", "entry_password"); empathy_account_widget_set_default_focus (gui, "entry_id"); + empathy_account_widget_add_apply_button (settings, widget); return empathy_builder_unref_and_keep_widget (gui, widget); } diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index 7a76db9e0..f05c66012 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -27,28 +27,31 @@ #include -#include +#include G_BEGIN_DECLS -void empathy_account_widget_handle_params (EmpathyAccount *account, +void empathy_account_widget_handle_params (EmpathyAccountSettings *settings, GtkBuilder *gui, const gchar *first_widget, ...); -void empathy_account_widget_add_forget_button (EmpathyAccount *account, +void empathy_account_widget_add_forget_button (EmpathyAccountSettings *settings, GtkBuilder *gui, const gchar *button, const gchar *entry); +void empathy_account_widget_add_apply_button (EmpathyAccountSettings *settings, + GtkWidget *vbox); + 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); +GtkWidget *empathy_account_widget_generic_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_salut_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_msn_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_jabber_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_icq_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_aim_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_yahoo_new (EmpathyAccountSettings *settings); +GtkWidget *empathy_account_widget_groupwise_new (EmpathyAccountSettings *settings); G_END_DECLS -- cgit v1.2.3 From 80e9b255ca7f39d17034475f52479e5199ce5f93 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 21 Jul 2009 19:28:08 +0100 Subject: Add apply button for salut accounts --- libempathy-gtk/empathy-account-widget.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index ea0a05b35..21e3d3ee3 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -570,6 +570,7 @@ empathy_account_widget_salut_new (EmpathyAccountSettings *settings) NULL); empathy_account_widget_set_default_focus (gui, "entry_nickname"); + empathy_account_widget_add_apply_button (settings, widget); return empathy_builder_unref_and_keep_widget (gui, widget); } -- cgit v1.2.3 From 36bfa50660b97ad74678e3cde0f6195154135fef Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 21 Jul 2009 19:42:40 +0100 Subject: Add the Apply widget to the IRC account settings dialog --- libempathy-gtk/empathy-account-widget-irc.c | 13 +- libempathy-gtk/empathy-account-widget-irc.ui | 339 ++++++++++++++------------- 2 files changed, 181 insertions(+), 171 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c index ae41f1e39..4bca91073 100644 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@ -423,12 +423,13 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) EmpathyAccountWidgetIrc *settings; gchar *dir, *user_file_with_path, *global_file_with_path; GtkBuilder *gui; + GtkWidget *widget; GtkListStore *store; GtkCellRenderer *renderer; gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetIrc); - settings->settings = g_object_ref (settings); + settings->settings = g_object_ref (account_settings); dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL); g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR); @@ -454,7 +455,8 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) filename = empathy_file_lookup ("empathy-account-widget-irc.ui", "libempathy-gtk"); gui = empathy_builder_get_file (filename, - "vbox_irc_settings", &settings->vbox_settings, + "vbox_irc", &widget, + "table_irc_settings", &settings->vbox_settings, "combobox_network", &settings->combobox_network, NULL); g_free (filename); @@ -489,7 +491,7 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) NULL); empathy_builder_connect (gui, settings, - "vbox_irc_settings", "destroy", account_widget_irc_destroy_cb, + "table_irc_settings", "destroy", account_widget_irc_destroy_cb, "button_network", "clicked", account_widget_irc_button_edit_network_clicked_cb, "button_add_network", "clicked", @@ -501,8 +503,7 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) NULL); empathy_account_widget_set_default_focus (gui, "entry_nick"); - empathy_account_widget_add_apply_button (account_settings, - settings->vbox_settings); + empathy_account_widget_add_apply_button (account_settings, widget); - return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings); + return empathy_builder_unref_and_keep_widget (gui, widget); } 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 @@ button_close - + True - 5 - 2 - 12 - 6 + vertical - + True - True - - - - 1 - 2 - 4 - 5 - - - - - - True - 0 - Quit message: - - - 4 - 5 - GTK_FILL - - - - - - True - True - - - - 1 - 2 - 3 - 4 - - - - - - True - True - False - - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - Real name: - - - 3 - 4 - GTK_FILL - - - - - - True - True - - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - Nickname: - True - entry_nick - - - 1 - 2 - GTK_FILL - - - - - - True - 2 + 5 + 2 + 12 + 6 - + True + True + - 0 + 1 + 2 + 4 + 5 + - + + True + 0 + Quit message: + + + 4 + 5 + GTK_FILL + + + + + True True - True - - - True - gtk-add - - + - False - False - 1 + 1 + 2 + 3 + 4 + - + True True - True - - - True - gtk-edit - - + False + - False - False - 2 + 1 + 2 + 2 + 3 + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Real name: + + + 3 + 4 + GTK_FILL + - + True True - True + + + + 1 + 2 + 1 + 2 + + + + + + True + 0 + Nickname: + True + entry_nick + + + 1 + 2 + GTK_FILL + + + + + + True + 2 + + + True + + + 0 + + + + + True + True + True + + + True + gtk-add + + + + + False + False + 1 + + - + True - gtk-remove + True + True + + + True + gtk-edit + + + + False + False + 2 + + + + + True + True + True + + + True + gtk-remove + + + + + False + False + 3 + - False - False - 3 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 0 + Network: + True + + + GTK_FILL + - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - 0 - Network: - True - - - GTK_FILL - + 0 -- cgit v1.2.3 From 0b269dddf9534936735567c8f23519f0f88c949d Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 22 Jul 2009 00:06:14 +0100 Subject: Get the connection status, not the presence status string --- libempathy-gtk/empathy-account-chooser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index ec2c2b18a..fa05bbcc9 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -769,7 +769,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; } -- cgit v1.2.3 From a410e0a8e2d745a94ebb96c98d63651a3f06a6dc Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Jul 2009 14:34:44 +0200 Subject: Add missing includes in empathy-share-my-desktop.c --- libempathy-gtk/empathy-share-my-desktop.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-share-my-desktop.c b/libempathy-gtk/empathy-share-my-desktop.c index 4a5fce916..4c60e435f 100644 --- a/libempathy-gtk/empathy-share-my-desktop.c +++ b/libempathy-gtk/empathy-share-my-desktop.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #define DEBUG_FLAG EMPATHY_DEBUG_SHARE_DESKTOP #include -- cgit v1.2.3 From 1bcccdbc977cc35af2edccc9b222d53a63a8c0b6 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 29 Jul 2009 16:46:24 +0200 Subject: Add a utility function to may protocols to their icons --- libempathy-gtk/empathy-protocol-chooser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index ebb198455..c17dfc526 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -134,8 +134,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, gchar *icon_name; gchar *display_name; - - icon_name = g_strdup_printf ("im-%s", proto->name); + icon_name = empathy_protocol_icon_name (proto->name); if (!tp_strdiff (cm->name, "haze")) display_name = g_strdup_printf ("%s (Haze)", proto->name); -- cgit v1.2.3 From 4c97b5730fd6c27376c6e2079262038e87fdc6c9 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 29 Jul 2009 16:48:08 +0200 Subject: Fix some leaks --- libempathy-gtk/empathy-account-widget.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 21e3d3ee3..391125a5f 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -510,6 +510,8 @@ account_widget_setup_generic (EmpathyAccountSettings *settings, accounts_widget_generic_setup (settings, table_common_settings, table_advanced_settings); + + g_object_unref (builder); } static void @@ -543,7 +545,11 @@ empathy_account_widget_generic_new (EmpathyAccountSettings *settings) empathy_account_widget_add_apply_button (settings, widget); - return g_object_ref (widget); + g_free (filename); + + g_object_ref (widget); + g_object_force_floating (G_OBJECT (widget)); + return widget; } GtkWidget * -- cgit v1.2.3 From 68cf4c663ae37ef031adfbe4afaecc218df235e6 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 29 Jul 2009 16:50:17 +0200 Subject: Fix some coding style issues --- libempathy-gtk/empathy-protocol-chooser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index c17dfc526..65f778ac4 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -163,7 +163,7 @@ protocol_choosers_cms_listed (TpConnectionManager * const *cms, { TpConnectionManager * const *iter; - if (error !=NULL) + if (error != NULL) { DEBUG ("Failed to get connection managers: %s", error->message); return; @@ -181,7 +181,6 @@ protocol_chooser_constructed (GObject *object) { EmpathyProtocolChooser *protocol_chooser; EmpathyProtocolChooserPriv *priv; - GtkCellRenderer *renderer; TpDBusDaemon *dbus; @@ -281,7 +280,8 @@ empathy_protocol_chooser_class_init (EmpathyProtocolChooserClass *klass) * * Return value: a pointer to the selected #TpConnectionManagerProtocol */ -TpConnectionManager *empathy_protocol_chooser_dup_selected ( +TpConnectionManager * +empathy_protocol_chooser_dup_selected ( EmpathyProtocolChooser *protocol_chooser, TpConnectionManagerProtocol **protocol) { -- cgit v1.2.3 From 97d122d36a2e387ccdba9689052b0397bbe42a76 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 29 Jul 2009 20:38:13 +0200 Subject: remove usage of empathy_account_equal --- libempathy-gtk/empathy-account-chooser.c | 8 +++----- libempathy-gtk/empathy-chat.c | 2 +- libempathy-gtk/empathy-log-window.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index 7c6f52fa5..a91b0eb29 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -545,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); @@ -688,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) { diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index a8ca745e2..0358b0ada 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -204,7 +204,7 @@ chat_new_connection_cb (EmpathyAccountManager *manager, EmpathyAccount *account; account = empathy_account_manager_get_account (manager, connection); - if (!priv->tp_chat && empathy_account_equal (account, priv->account) && + if (!priv->tp_chat && account == priv->account && priv->handle_type != TP_HANDLE_TYPE_NONE && !EMP_STR_EMPTY (priv->id)) { diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 7add30136..11ddca74b 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -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); -- cgit v1.2.3 From 4b6db27ff05428dda571c5e60bc7229a4dd91d5f Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 22 Jul 2009 14:15:01 +0200 Subject: Synchronize EmpathyProtocolChooser and EmpathyAccountsDialog Synchronize the two objects with the help of EmpathyConnectionManagers, so that we can get a consistent list of the CMs when using the chooser. --- libempathy-gtk/empathy-protocol-chooser.c | 77 ++++++++++++++----------------- libempathy-gtk/empathy-protocol-chooser.h | 6 ++- 2 files changed, 39 insertions(+), 44 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index ebb198455..462979843 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -29,6 +29,7 @@ #include #include +#include #include "empathy-protocol-chooser.h" #include "empathy-ui-utils.h" @@ -59,6 +60,7 @@ typedef struct { GtkListStore *store; gboolean dispose_run; + EmpathyConnectionManagers *cms; } EmpathyProtocolChooserPriv; @@ -154,27 +156,26 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, } } - static void -protocol_choosers_cms_listed (TpConnectionManager * const *cms, - gsize n_cms, - const GError *error, - gpointer user_data, - GObject *weak_object) +protocol_chooser_add_cms_list (EmpathyProtocolChooser *protocol_chooser, + GList *cms) { - TpConnectionManager * const *iter; + GList *l; - if (error !=NULL) - { - DEBUG ("Failed to get connection managers: %s", error->message); - return; - } + for (l = cms; l != NULL; l = l->next) + protocol_choosers_add_cm (protocol_chooser, l->data); - for (iter = cms ; iter != NULL && *iter != NULL; iter++) - protocol_choosers_add_cm (EMPATHY_PROTOCOL_CHOOSER (weak_object), - *iter); + gtk_combo_box_set_active (GTK_COMBO_BOX (protocol_chooser), 0); +} - gtk_combo_box_set_active (GTK_COMBO_BOX (weak_object), 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 @@ -182,9 +183,7 @@ protocol_chooser_constructed (GObject *object) { EmpathyProtocolChooser *protocol_chooser; EmpathyProtocolChooserPriv *priv; - GtkCellRenderer *renderer; - TpDBusDaemon *dbus; priv = GET_PRIV (object); protocol_chooser = EMPATHY_PROTOCOL_CHOOSER (object); @@ -212,11 +211,6 @@ protocol_chooser_constructed (GObject *object) "text", COL_LABEL, NULL); - dbus = tp_dbus_daemon_dup (NULL); - tp_list_connection_managers (dbus, protocol_choosers_cms_listed, - NULL, NULL, object); - g_object_unref (dbus); - /* Set the protocol sort function */ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store), COL_PROTOCOL, @@ -226,6 +220,13 @@ protocol_chooser_constructed (GObject *object) COL_PROTOCOL, GTK_SORT_ASCENDING); + 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); } @@ -238,6 +239,7 @@ empathy_protocol_chooser_init (EmpathyProtocolChooser *protocol_chooser) EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserPriv); priv->dispose_run = FALSE; + priv->cms = empathy_connection_managers_dup_singleton (); protocol_chooser->priv = priv; } @@ -259,6 +261,12 @@ protocol_chooser_dispose (GObject *object) priv->store = NULL; } + if (priv->cms) + { + g_object_unref (priv->cms); + priv->cms = NULL; + } + (G_OBJECT_CLASS (empathy_protocol_chooser_parent_class)->dispose) (object); } @@ -273,6 +281,8 @@ empathy_protocol_chooser_class_init (EmpathyProtocolChooserClass *klass) g_type_class_add_private (object_class, sizeof (EmpathyProtocolChooserPriv)); } +/* public methods */ + /** * empathy_protocol_chooser_get_selected_protocol: * @protocol_chooser: an #EmpathyProtocolChooser @@ -307,31 +317,14 @@ TpConnectionManager *empathy_protocol_chooser_dup_selected ( return cm; } -/** - * empathy_protocol_chooser_n_protocols: - * @protocol_chooser: an #EmpathyProtocolChooser - * - * Returns the number of protocols in @protocol_chooser. - * - * Return value: the number of protocols in @protocol_chooser - */ -gint -empathy_protocol_chooser_n_protocols (EmpathyProtocolChooser *protocol_chooser) -{ - EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser); - - g_return_val_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser), 0); - - return gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL); -} - /** * empathy_protocol_chooser_new: * - * Creates a new #EmpathyProtocolChooser widget. + * Triggers the creation of a new #EmpathyProtocolChooser. * * Return value: a new #EmpathyProtocolChooser widget */ + GtkWidget * empathy_protocol_chooser_new (void) { diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h index 75f9343cc..9d881958d 100644 --- a/libempathy-gtk/empathy-protocol-chooser.h +++ b/libempathy-gtk/empathy-protocol-chooser.h @@ -58,13 +58,15 @@ struct _EmpathyProtocolChooserClass GtkComboBoxClass parent_class; }; +typedef void (* EmpathyProtocolChooserReadyCb) (GtkWidget *chooser, + GError *error, + 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); -gint empathy_protocol_chooser_n_protocols ( - EmpathyProtocolChooser *protocol_chooser); G_END_DECLS #endif /* __EMPATHY_PROTOCOL_CHOOSER_H__ */ -- cgit v1.2.3 From 72ae76e34c0c57b326be53f860bbc12cadf1ceb8 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sun, 26 Jul 2009 17:08:47 +0200 Subject: Fix a typo. --- libempathy-gtk/empathy-account-widget.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index f05c66012..d3bd171fc 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -22,8 +22,8 @@ * Martyn Russell */ -#ifndef __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__ -#define __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__ +#ifndef __EMPATHY_ACCOUNT_WIDGET_H__ +#define __EMPATHY_ACCOUNT_WIDGET_H__ #include @@ -55,4 +55,4 @@ GtkWidget *empathy_account_widget_groupwise_new (EmpathyAccountSettings *s G_END_DECLS -#endif /* __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__ */ +#endif /* __EMPATHY_ACCOUNT_WIDGET_H__ */ -- cgit v1.2.3 From 000a7c0ca4dc343b42e628323ddd1ca0f2a08e3f Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 27 Jul 2009 00:54:23 +0200 Subject: First cut at GObject-ifying EmpathyAccountWidget --- libempathy-gtk/Makefile.am | 3 +- libempathy-gtk/empathy-account-widget-irc.c | 79 ++- libempathy-gtk/empathy-account-widget-irc.h | 5 +- .../empathy-account-widget-local-xmpp.ui | 219 +++++++ libempathy-gtk/empathy-account-widget-private.h | 47 ++ libempathy-gtk/empathy-account-widget-salut.ui | 219 ------- libempathy-gtk/empathy-account-widget-sip.c | 42 +- libempathy-gtk/empathy-account-widget-sip.h | 5 +- libempathy-gtk/empathy-account-widget.c | 642 ++++++++++++--------- libempathy-gtk/empathy-account-widget.h | 52 +- 10 files changed, 718 insertions(+), 595 deletions(-) create mode 100644 libempathy-gtk/empathy-account-widget-local-xmpp.ui create mode 100644 libempathy-gtk/empathy-account-widget-private.h delete mode 100644 libempathy-gtk/empathy-account-widget-salut.ui (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index 94cc4ee15..4a97761b9 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -68,6 +68,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 = \ @@ -141,7 +142,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-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c index 4bca91073..425adbcb5 100644 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@ -32,6 +32,7 @@ #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" @@ -41,7 +42,7 @@ #define IRC_NETWORKS_FILENAME "irc-networks.xml" typedef struct { - EmpathyAccountSettings *settings; + EmpathyAccountWidget *self; EmpathyIrcNetworkManager *network_manager; GtkWidget *vbox_settings; @@ -59,17 +60,19 @@ account_widget_irc_destroy_cb (GtkWidget *widget, EmpathyAccountWidgetIrc *settings) { g_object_unref (settings->network_manager); - g_object_unref (settings->settings); 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_settings_unset (settings->settings, "server"); - empathy_account_settings_unset (settings->settings, "port"); - empathy_account_settings_unset (settings->settings, "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 @@ -80,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)) @@ -95,7 +101,7 @@ update_server_params (EmpathyAccountWidgetIrc *settings) g_object_get (network, "charset", &charset, NULL); DEBUG ("Setting charset to %s", charset); - empathy_account_settings_set_string (settings->settings, "charset", charset); + empathy_account_settings_set_string (ac_settings, "charset", charset); g_free (charset); servers = empathy_irc_network_get_servers (network); @@ -114,13 +120,11 @@ update_server_params (EmpathyAccountWidgetIrc *settings) NULL); DEBUG ("Setting server to %s", address); - empathy_account_settings_set_string (settings->settings, - "server", address); + empathy_account_settings_set_string (ac_settings, "server", address); DEBUG ("Setting port to %u", port); - empathy_account_settings_set_uint32 (settings->settings, "port", port); + empathy_account_settings_set_uint32 (ac_settings, "port", port); DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" ); - empathy_account_settings_set_boolean (settings->settings, - "use-ssl", ssl); + empathy_account_settings_set_boolean (ac_settings, "use-ssl", ssl); g_free (address); } @@ -330,19 +334,22 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) const gchar *charset; gboolean ssl = FALSE; EmpathyIrcNetwork *network = NULL; + EmpathyAccountSettings *ac_settings; - nick = empathy_account_settings_get_string (settings->settings, "account"); - fullname = empathy_account_settings_get_string (settings->settings, + g_object_get (settings->self, "settings", &ac_settings, NULL); + + nick = empathy_account_settings_get_string (ac_settings, "account"); + fullname = empathy_account_settings_get_string (ac_settings, "fullname"); - server = empathy_account_settings_get_string (settings->settings, "server"); - charset = empathy_account_settings_get_string (settings->settings, "charset"); - port = empathy_account_settings_get_uint32 (settings->settings, "port"); - ssl = empathy_account_settings_get_boolean (settings->settings, "use-ssl"); + 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_settings_set_string (settings->settings, + empathy_account_settings_set_string (ac_settings, "account", nick); } @@ -353,7 +360,7 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) { fullname = g_strdup (nick); } - empathy_account_settings_set_string (settings->settings, + empathy_account_settings_set_string (ac_settings, "fullname", fullname); } @@ -409,27 +416,17 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) fill_networks_model (settings, network); } -/** - * empathy_account_widget_irc_new: - * @settings: the #EmpathyAccountSettings 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 (EmpathyAccountSettings *account_settings) +void +empathy_account_widget_irc_build (EmpathyAccountWidget *self, + const char *filename) { EmpathyAccountWidgetIrc *settings; gchar *dir, *user_file_with_path, *global_file_with_path; - GtkBuilder *gui; - GtkWidget *widget; GtkListStore *store; GtkCellRenderer *renderer; - gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetIrc); - settings->settings = g_object_ref (account_settings); + settings->self = self; dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL); g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR); @@ -452,14 +449,11 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) 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", &widget, + self->ui_details->gui = empathy_builder_get_file (filename, + "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,14 +477,14 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) account_widget_irc_setup (settings); - empathy_account_widget_handle_params (account_settings, 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, + 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, @@ -502,8 +496,5 @@ empathy_account_widget_irc_new (EmpathyAccountSettings *account_settings) account_widget_irc_combobox_network_changed_cb, NULL); - empathy_account_widget_set_default_focus (gui, "entry_nick"); - empathy_account_widget_add_apply_button (account_settings, widget); - - return empathy_builder_unref_and_keep_widget (gui, widget); + 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 0373238ed..a76787120 100644 --- a/libempathy-gtk/empathy-account-widget-irc.h +++ b/libempathy-gtk/empathy-account-widget-irc.h @@ -22,11 +22,12 @@ #define __EMPATHY_ACCOUNT_WIDGET_IRC_H__ #include -#include +#include G_BEGIN_DECLS -GtkWidget * empathy_account_widget_irc_new (EmpathyAccountSettings *settings); +void empathy_account_widget_irc_build (EmpathyAccountWidget *self, + const char *filename); G_END_DECLS diff --git a/libempathy-gtk/empathy-account-widget-local-xmpp.ui b/libempathy-gtk/empathy-account-widget-local-xmpp.ui new file mode 100644 index 000000000..ca633309d --- /dev/null +++ b/libempathy-gtk/empathy-account-widget-local-xmpp.ui @@ -0,0 +1,219 @@ + + + + + + True + vertical + 6 + + + True + 3 + 3 + 12 + 6 + + + True + True + + + + 1 + 3 + 2 + 3 + + + + + + True + True + + + + 1 + 3 + 1 + 2 + + + + + + True + True + + + + 1 + 3 + + + + + + True + 0 + _Nickname: + True + entry_nickname + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + _Last Name: + True + entry_last_name + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + _First Name: + True + entry_first_name + + + GTK_FILL + + + + + + False + False + 0 + + + + + True + True + + + True + 3 + 3 + 12 + 6 + + + True + True + + + + 1 + 3 + + + + + + True + 0 + _Published Name: + True + entry_published + + + GTK_FILL + + + + + + True + True + + + + 1 + 3 + 2 + 3 + + + + + + True + True + + + + 1 + 3 + 1 + 2 + + + + + + True + 0 + _Jabber ID: + True + entry_jid + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + _Email: + True + entry_email + + + 1 + 2 + GTK_FILL + + + + + + + + True + Advanced + + + + + + + + False + False + 1 + + + + 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 + */ + +#ifndef __EMPATHY_ACCOUNT_WIDGET_PRIVATE_H__ +#define __EMPATHY_ACCOUNT_WIDGET_PRIVATE_H__ + +#include +#include +#include + +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-salut.ui b/libempathy-gtk/empathy-account-widget-salut.ui deleted file mode 100644 index ca633309d..000000000 --- a/libempathy-gtk/empathy-account-widget-salut.ui +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - True - vertical - 6 - - - True - 3 - 3 - 12 - 6 - - - True - True - - - - 1 - 3 - 2 - 3 - - - - - - True - True - - - - 1 - 3 - 1 - 2 - - - - - - True - True - - - - 1 - 3 - - - - - - True - 0 - _Nickname: - True - entry_nickname - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - _Last Name: - True - entry_last_name - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - _First Name: - True - entry_first_name - - - GTK_FILL - - - - - - False - False - 0 - - - - - True - True - - - True - 3 - 3 - 12 - 6 - - - True - True - - - - 1 - 3 - - - - - - True - 0 - _Published Name: - True - entry_published - - - GTK_FILL - - - - - - True - True - - - - 1 - 3 - 2 - 3 - - - - - - True - True - - - - 1 - 3 - 1 - 2 - - - - - - True - 0 - _Jabber ID: - True - entry_jid - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - _Email: - True - entry_email - - - 1 - 2 - GTK_FILL - - - - - - - - True - Advanced - - - - - - - - False - False - 1 - - - - diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c index 9f08046b7..fedbf2aa6 100644 --- a/libempathy-gtk/empathy-account-widget-sip.c +++ b/libempathy-gtk/empathy-account-widget-sip.c @@ -31,12 +31,12 @@ #include #include "empathy-account-widget.h" +#include "empathy-account-widget-private.h" #include "empathy-account-widget-sip.h" #include "empathy-ui-utils.h" typedef struct { - EmpathyAccountSettings *settings; - + EmpathyAccountWidget *self; GtkWidget *vbox_settings; GtkWidget *entry_stun_server; @@ -48,7 +48,6 @@ static void account_widget_sip_destroy_cb (GtkWidget *widget, EmpathyAccountWidgetSip *settings) { - g_object_unref (settings->settings); g_slice_free (EmpathyAccountWidgetSip, settings); } @@ -64,35 +63,23 @@ 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 (EmpathyAccountSettings *account_settings) +void +empathy_account_widget_sip_build (EmpathyAccountWidget *self, + const char *filename) { EmpathyAccountWidgetSip *settings; - GtkBuilder *gui; - gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetSip); - settings->settings = g_object_ref (account_settings); + settings->self = self; - filename = empathy_file_lookup ("empathy-account-widget-sip.ui", - "libempathy-gtk"); - gui = empathy_builder_get_file (filename, + self->ui_details->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_settings, gui, + empathy_account_widget_handle_params (self, "entry_userid", "account", "entry_password", "password", "checkbutton_discover-stun", "discover-stun", @@ -100,23 +87,18 @@ empathy_account_widget_sip_new (EmpathyAccountSettings *account_settings) "spinbutton_stun-port", "stun-port", NULL); - empathy_account_widget_add_forget_button (account_settings, gui, - "button_forget", - "entry_password"); - account_widget_sip_discover_stun_toggled_cb ( settings->checkbutton_discover_stun, settings); - empathy_builder_connect (gui, 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); - empathy_account_widget_set_default_focus (gui, "entry_userid"); - empathy_account_widget_add_apply_button (account_settings, - settings->vbox_settings); + self->ui_details->add_forget = TRUE; + self->ui_details->default_focus = g_strdup ("entry_userid"); - return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings); + self->ui_details->widget = settings->vbox_settings; } diff --git a/libempathy-gtk/empathy-account-widget-sip.h b/libempathy-gtk/empathy-account-widget-sip.h index 15dd7244a..435ad6ea1 100644 --- a/libempathy-gtk/empathy-account-widget-sip.h +++ b/libempathy-gtk/empathy-account-widget-sip.h @@ -22,11 +22,12 @@ #define __EMPATHY_ACCOUNT_WIDGET_SIP_H__ #include -#include +#include G_BEGIN_DECLS -GtkWidget * empathy_account_widget_sip_new (EmpathyAccountSettings *settings); +void empathy_account_widget_sip_build (EmpathyAccountWidget *self, + const char *filename); G_END_DECLS diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 21e3d3ee3..76145c483 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -33,21 +33,60 @@ #include #include +#include #include #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 +G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT) + +typedef struct { + GtkWidget *widget; + + char *protocol; + EmpathyAccountSettings *settings; + + GtkWidget *apply_button; + GtkWidget *entry_password; + GtkWidget *button_forget; + GtkWidget *spinbutton_port; + + GtkBuilder *gui; + char *default_focus; + gboolean add_forget; +} EmpathyAccountWidgetPriv; + +enum { + PROP_PROTOCOL = 1, + PROP_SETTINGS +}; + +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) + +static void +account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) +{ + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + gtk_widget_set_sensitive (priv->apply_button, + empathy_account_settings_is_valid (priv->settings)); +} + static gboolean account_widget_entry_focus_cb (GtkWidget *widget, GdkEventFocus *event, - EmpathyAccountSettings *settings) + EmpathyAccountWidget *self) { const gchar *str; const gchar *param_name; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); str = gtk_entry_get_text (GTK_ENTRY (widget)); param_name = g_object_get_data (G_OBJECT (widget), "param_name"); @@ -55,31 +94,34 @@ account_widget_entry_focus_cb (GtkWidget *widget, if (EMP_STR_EMPTY (str)) { const gchar *value = NULL; - empathy_account_settings_unset (settings, param_name); - value = empathy_account_settings_get_string (settings, param_name); + empathy_account_settings_unset (priv->settings, param_name); + value = empathy_account_settings_get_string (priv->settings, param_name); DEBUG ("Unset %s and restore to %s", param_name, value); gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); } else { DEBUG ("Setting %s to %s", param_name, strstr (param_name, "password") ? "***" : str); - empathy_account_settings_set_string (settings, param_name, str); + empathy_account_settings_set_string (priv->settings, param_name, str); } + account_widget_handle_apply_sensitivity (self); + return FALSE; } static void account_widget_int_changed_cb (GtkWidget *widget, - EmpathyAccountSettings *settings) + EmpathyAccountWidget *self) { const gchar *param_name; - gint value; + 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_settings_get_dbus_signature (settings, param_name); + signature = empathy_settings_get_dbus_signature (priv->settings, param_name); g_return_if_fail (signature != NULL); DEBUG ("Setting %s to %d", param_name, value); @@ -88,30 +130,33 @@ account_widget_int_changed_cb (GtkWidget *widget, { case DBUS_TYPE_INT16: case DBUS_TYPE_INT32: - empathy_account_settings_set_int32 (settings, param_name, value); + empathy_account_settings_set_int32 (priv->settings, param_name, value); break; case DBUS_TYPE_INT64: - empathy_account_settings_set_int64 (settings, param_name, value); + empathy_account_settings_set_int64 (priv->settings, param_name, value); break; case DBUS_TYPE_UINT16: case DBUS_TYPE_UINT32: - empathy_account_settings_set_uint32 (settings, param_name, value); + empathy_account_settings_set_uint32 (priv->settings, param_name, value); break; case DBUS_TYPE_UINT64: - empathy_account_settings_set_uint64 (settings, param_name, value); + empathy_account_settings_set_uint64 (priv->settings, param_name, value); break; default: g_return_if_reached (); - } + } + + account_widget_handle_apply_sensitivity (self); } static void account_widget_checkbutton_toggled_cb (GtkWidget *widget, - EmpathyAccountSettings *settings) + 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"); @@ -119,30 +164,33 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, /* 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 (settings, param_name); - default_value = empathy_account_settings_get_boolean (settings, param_name); + 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 (settings, param_name, value); + empathy_account_settings_set_boolean (priv->settings, param_name, value); } + + account_widget_handle_apply_sensitivity (self); } static void account_widget_forget_clicked_cb (GtkWidget *button, - GtkWidget *entry) + EmpathyAccountWidget *self) { - EmpathyAccountSettings *settings; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); const gchar *param_name; - param_name = g_object_get_data (G_OBJECT (entry), "param_name"); - settings = g_object_get_data (G_OBJECT (entry), "settings"); + param_name = g_object_get_data (G_OBJECT (priv->entry_password), "param_name"); DEBUG ("Unset %s", param_name); - empathy_account_settings_unset (settings, param_name); - gtk_entry_set_text (GTK_ENTRY (entry), ""); + empathy_account_settings_unset (priv->settings, param_name); + gtk_entry_set_text (GTK_ENTRY (priv->entry_password), ""); + + account_widget_handle_apply_sensitivity (self); } static void @@ -157,15 +205,14 @@ account_widget_password_changed_cb (GtkWidget *entry, static void account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl, - GtkWidget *spinbutton_port) + EmpathyAccountWidget *self) { - EmpathyAccountSettings *settings; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); gboolean value; gint32 port = 0; value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl)); - settings = g_object_get_data (G_OBJECT (spinbutton_port), "settings"); - port = empathy_account_settings_get_uint32 (settings, "port"); + port = empathy_account_settings_get_uint32 (priv->settings, "port"); if (value) { if (port == 5222 || port == 0) { @@ -177,41 +224,41 @@ account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl, } } - gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton_port), port); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spinbutton_port), port); } static void -account_widget_setup_widget (GtkWidget *widget, - EmpathyAccountSettings *settings, +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); - g_object_set_data_full (G_OBJECT (widget), "settings", - g_object_ref (settings), g_object_unref); if (GTK_IS_SPIN_BUTTON (widget)) { gint value = 0; const gchar *signature; - signature = empathy_settings_get_dbus_signature (settings, param_name); + signature = empathy_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 (settings, param_name); + value = empathy_account_settings_get_int32 (priv->settings, param_name); break; case DBUS_TYPE_INT64: - value = empathy_account_settings_get_int64 (settings, param_name); + 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 (settings, param_name); + value = empathy_account_settings_get_uint32 (priv->settings, param_name); break; case DBUS_TYPE_UINT64: - value = empathy_account_settings_get_uint64 (settings, param_name); + value = empathy_account_settings_get_uint64 (priv->settings, param_name); break; default: g_return_if_reached (); @@ -221,12 +268,12 @@ account_widget_setup_widget (GtkWidget *widget, g_signal_connect (widget, "value-changed", G_CALLBACK (account_widget_int_changed_cb), - settings); + self); } else if (GTK_IS_ENTRY (widget)) { const gchar *str = NULL; - str = empathy_account_settings_get_string (settings, param_name); + str = empathy_account_settings_get_string (priv->settings, param_name); gtk_entry_set_text (GTK_ENTRY (widget), str ? str : ""); if (strstr (param_name, "password")) { @@ -235,17 +282,17 @@ account_widget_setup_widget (GtkWidget *widget, g_signal_connect (widget, "focus-out-event", G_CALLBACK (account_widget_entry_focus_cb), - settings); + self); } else if (GTK_IS_TOGGLE_BUTTON (widget)) { gboolean value = FALSE; - value = empathy_account_settings_get_boolean (settings, param_name); + 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), - settings); + self); } else { DEBUG ("Unknown type of widget for param %s", param_name); } @@ -276,13 +323,14 @@ account_widget_generic_format_param_name (const gchar *param_name) } static void -accounts_widget_generic_setup (EmpathyAccountSettings *settings, +accounts_widget_generic_setup (EmpathyAccountWidget *self, GtkWidget *table_common_settings, GtkWidget *table_advanced_settings) { TpConnectionManagerParam *params, *param; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - params = empathy_account_settings_get_tp_params (settings); + params = empathy_account_settings_get_tp_params (priv->settings); for (param = params; param != NULL && param->name != NULL; param++) { GtkWidget *table_settings; @@ -391,7 +439,7 @@ accounts_widget_generic_setup (EmpathyAccountSettings *settings, } if (widget) { - account_widget_setup_widget (widget, settings, param->name); + account_widget_setup_widget (self, widget, param->name); } g_free (param_name_formatted); @@ -399,168 +447,93 @@ accounts_widget_generic_setup (EmpathyAccountSettings *settings, } static void -account_widget_handle_params_valist (EmpathyAccountSettings *settings, - GtkBuilder *gui, +account_widget_handle_params_valist (EmpathyAccountWidget *self, const gchar *first_widget, va_list args) { GObject *object; const gchar *name; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); 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); + object = gtk_builder_get_object (priv->gui, name); if (!object) { g_warning ("Builder is missing object '%s'.", name); continue; } - account_widget_setup_widget (GTK_WIDGET (object), settings, param_name); + account_widget_setup_widget (self, GTK_WIDGET (object), param_name); } } -void -empathy_account_widget_handle_params (EmpathyAccountSettings *settings, - GtkBuilder *gui, - const gchar *first_widget, - ...) -{ - va_list args; - - g_return_if_fail (GTK_IS_BUILDER (gui)); - - va_start (args, first_widget); - account_widget_handle_params_valist (settings, gui, first_widget, args); - va_end (args); -} - static void account_widget_apply_clicked_cb (GtkWidget *button, - EmpathyAccountSettings *settings) + EmpathyAccountWidget *self) { - empathy_account_settings_apply_async (settings, NULL, NULL); -} - -void -empathy_account_widget_add_apply_button (EmpathyAccountSettings *settings, - GtkWidget *vbox) -{ - GtkWidget *button; - - button = gtk_button_new_from_stock (GTK_STOCK_APPLY); - - gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 3); - - g_signal_connect (button, "clicked", - G_CALLBACK (account_widget_apply_clicked_cb), - settings); - gtk_widget_show (button); -} - -void -empathy_account_widget_add_forget_button (EmpathyAccountSettings *settings, - GtkBuilder *gui, - const gchar *button, - const gchar *entry) -{ - GtkWidget *button_forget; - GtkWidget *entry_password; - const gchar *password = NULL; - - button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button)); - entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry)); - - password = empathy_account_settings_get_string (settings, "password"); - gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password)); - - 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); -} - -void -empathy_account_widget_set_default_focus (GtkBuilder *gui, - const gchar *entry) -{ - GObject *default_focus_entry; - - default_focus_entry = gtk_builder_get_object (gui, entry); - g_signal_connect (default_focus_entry, "realize", - G_CALLBACK (gtk_widget_grab_focus), - NULL); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + empathy_account_settings_apply_async (priv->settings, NULL, NULL); } static void -account_widget_setup_generic (EmpathyAccountSettings *settings, - GtkBuilder *builder) +account_widget_setup_generic (EmpathyAccountWidget *self) { GtkWidget *table_common_settings; GtkWidget *table_advanced_settings; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - table_common_settings = GTK_WIDGET (gtk_builder_get_object (builder, + table_common_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, "table_common_settings")); - table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (builder, + table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, "table_advanced_settings")); - accounts_widget_generic_setup (settings, table_common_settings, + accounts_widget_generic_setup (self, table_common_settings, table_advanced_settings); } static void account_widget_settings_ready_cb (EmpathyAccountSettings *settings, - GParamSpec *pspec, gpointer user_data) + GParamSpec *pspec, + gpointer user_data) { - GtkBuilder *builder = GTK_BUILDER (user_data); + EmpathyAccountWidget *self = user_data; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - if (empathy_account_settings_is_ready (settings)) - account_widget_setup_generic (settings, builder); + if (empathy_account_settings_is_ready (priv->settings)) + account_widget_setup_generic (self); } -GtkWidget * -empathy_account_widget_generic_new (EmpathyAccountSettings *settings) +static void +account_widget_build_generic (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; - gchar *filename; - - filename = empathy_file_lookup ("empathy-account-widget-generic.ui", - "libempathy-gtk"); - gui = empathy_builder_get_file (filename, - "vbox_generic_settings", &widget, + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + priv->gui = empathy_builder_get_file (filename, + "vbox_generic_settings", &self->ui_details->widget, NULL); - if (empathy_account_settings_is_ready (settings)) - account_widget_setup_generic (settings, gui); + if (empathy_account_settings_is_ready (priv->settings)) + account_widget_setup_generic (self); else - g_signal_connect (settings, "notify::ready", - G_CALLBACK (account_widget_settings_ready_cb), gui); - - empathy_account_widget_add_apply_button (settings, widget); - - return g_object_ref (widget); + g_signal_connect (priv->settings, "notify::ready", + G_CALLBACK (account_widget_settings_ready_cb), self); } -GtkWidget * -empathy_account_widget_salut_new (EmpathyAccountSettings *settings) +static void +account_widget_build_salut (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; - gchar *filename; - - filename = empathy_file_lookup ("empathy-account-widget-salut.ui", - "libempathy-gtk"); - gui = empathy_builder_get_file (filename, - "vbox_salut_settings", &widget, + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + priv->gui = empathy_builder_get_file (filename, + "vbox_salut_settings", &self->ui_details->widget, NULL); - g_free (filename); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_published", "published-name", "entry_nickname", "nickname", "entry_first_name", "first-name", @@ -569,61 +542,44 @@ empathy_account_widget_salut_new (EmpathyAccountSettings *settings) "entry_jid", "jid", NULL); - empathy_account_widget_set_default_focus (gui, "entry_nickname"); - empathy_account_widget_add_apply_button (settings, widget); - - return empathy_builder_unref_and_keep_widget (gui, widget); + self->ui_details->default_focus = g_strdup ("entry_nickname"); } -GtkWidget * -empathy_account_widget_msn_new (EmpathyAccountSettings *settings) +static void +account_widget_build_msn (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; - gchar *filename; - - filename = empathy_file_lookup ("empathy-account-widget-msn.ui", - "libempathy-gtk"); - gui = empathy_builder_get_file (filename, - "vbox_msn_settings", &widget, + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + priv->gui = empathy_builder_get_file (filename, + "vbox_msn_settings", &self->ui_details->widget, NULL); - g_free (filename); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_id", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); - empathy_account_widget_add_forget_button (settings, gui, - "button_forget", - "entry_password"); - - empathy_account_widget_set_default_focus (gui, "entry_id"); - - return empathy_builder_unref_and_keep_widget (gui, widget); + self->ui_details->default_focus = g_strdup ("entry_id"); + self->ui_details->add_forget = TRUE; } -GtkWidget * -empathy_account_widget_jabber_new (EmpathyAccountSettings *settings) +static void +account_widget_build_jabber (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); 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, + priv->gui = empathy_builder_get_file (filename, + "vbox_jabber_settings", &self->ui_details->widget, "spinbutton_port", &spinbutton_port, "checkbutton_ssl", &checkbutton_ssl, NULL); - g_free (filename); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_id", "account", "entry_password", "password", "entry_resource", "resource", @@ -635,38 +591,28 @@ empathy_account_widget_jabber_new (EmpathyAccountSettings *settings) "checkbutton_encryption", "require-encryption", NULL); - empathy_account_widget_add_forget_button (settings, gui, - "button_forget", - "entry_password"); - - empathy_account_widget_set_default_focus (gui, "entry_id"); + 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), - spinbutton_port); - - empathy_account_widget_add_apply_button (settings, widget); - - return empathy_builder_unref_and_keep_widget (gui, widget); + self); } -GtkWidget * -empathy_account_widget_icq_new (EmpathyAccountSettings *settings) +static void +account_widget_build_icq (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); GtkWidget *spinbutton_port; - gchar *filename; - filename = empathy_file_lookup ("empathy-account-widget-icq.ui", - "libempathy-gtk"); - gui = empathy_builder_get_file (filename, - "vbox_icq_settings", &widget, + priv->gui = empathy_builder_get_file (filename, + "vbox_icq_settings", &self->ui_details->widget, "spinbutton_port", &spinbutton_port, NULL); - g_free (filename); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_uin", "account", "entry_password", "password", "entry_server", "server", @@ -674,65 +620,44 @@ empathy_account_widget_icq_new (EmpathyAccountSettings *settings) "entry_charset", "charset", NULL); - empathy_account_widget_add_forget_button (settings, gui, - "button_forget", - "entry_password"); - - empathy_account_widget_set_default_focus (gui, "entry_uin"); - - empathy_account_widget_add_apply_button (settings, widget); - - return empathy_builder_unref_and_keep_widget (gui, widget); + self->ui_details->default_focus = g_strdup ("entry_uin"); + self->ui_details->add_forget = TRUE; } -GtkWidget * -empathy_account_widget_aim_new (EmpathyAccountSettings *settings) +static void +account_widget_build_aim (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); 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, + priv->gui = empathy_builder_get_file (filename, + "vbox_aim_settings", &self->ui_details->widget, "spinbutton_port", &spinbutton_port, NULL); - g_free (filename); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_screenname", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); - empathy_account_widget_add_forget_button (settings, gui, - "button_forget", - "entry_password"); - - empathy_account_widget_set_default_focus (gui, "entry_screenname"); - empathy_account_widget_add_apply_button (settings, widget); - - return empathy_builder_unref_and_keep_widget (gui, widget); + self->ui_details->default_focus = g_strdup ("entry_screenname"); + self->ui_details->add_forget = TRUE; } -GtkWidget * -empathy_account_widget_yahoo_new (EmpathyAccountSettings *settings) +static void +account_widget_build_yahoo (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; - gchar *filename; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - filename = empathy_file_lookup ("empathy-account-widget-yahoo.ui", - "libempathy-gtk"); - gui = empathy_builder_get_file (filename, - "vbox_yahoo_settings", &widget, + priv->gui = empathy_builder_get_file (filename, + "vbox_yahoo_settings", &self->ui_details->widget, NULL); - g_free (filename); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_id", "account", "entry_password", "password", "entry_server", "server", @@ -743,44 +668,209 @@ empathy_account_widget_yahoo_new (EmpathyAccountSettings *settings) "checkbutton_ignore_invites", "ignore-invites", NULL); - empathy_account_widget_add_forget_button (settings, gui, - "button_forget", - "entry_password"); - - empathy_account_widget_set_default_focus (gui, "entry_id"); - empathy_account_widget_add_apply_button (settings, widget); - - return empathy_builder_unref_and_keep_widget (gui, widget); + self->ui_details->default_focus = g_strdup ("entry_id"); + self->ui_details->add_forget = TRUE; } -GtkWidget * -empathy_account_widget_groupwise_new (EmpathyAccountSettings *settings) +static void +account_widget_build_groupwise (EmpathyAccountWidget *self, + const char *filename) { - GtkBuilder *gui; - GtkWidget *widget; - gchar *filename; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - 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); + priv->gui = empathy_builder_get_file (filename, + "vbox_groupwise_settings", &self->ui_details->widget, + NULL); - empathy_account_widget_handle_params (settings, gui, + empathy_account_widget_handle_params (self, "entry_id", "account", "entry_password", "password", "entry_server", "server", "spinbutton_port", "port", NULL); - empathy_account_widget_add_forget_button (settings, gui, - "button_forget", - "entry_password"); + self->ui_details->default_focus = g_strdup ("entry_id"); + self->ui_details->add_forget = TRUE; +} - empathy_account_widget_set_default_focus (gui, "entry_id"); - empathy_account_widget_add_apply_button (settings, widget); +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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +do_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + 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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +do_constructed (GObject *obj) +{ + EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + 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); + else if (!tp_strdiff (priv->protocol, "sip")) + empathy_account_widget_sip_build (self, filename); + else + 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 + (priv->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 (priv->gui, "button_forget")); + priv->entry_password = GTK_WIDGET (gtk_builder_get_object (priv->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 button */ + priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); + gtk_box_pack_end (GTK_BOX (self->ui_details->widget), priv->apply_button, FALSE, FALSE, 3); + + g_signal_connect (priv->apply_button, "clicked", + G_CALLBACK (account_widget_apply_clicked_cb), + self); + gtk_widget_show (priv->apply_button); +} + +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; + + 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); + + g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); +} - return empathy_builder_unref_and_keep_widget (gui, widget); +static void +empathy_account_widget_init (EmpathyAccountWidget *self) +{ + EmpathyAccountWidgetPriv *priv = + G_TYPE_INSTANCE_GET_PRIVATE ((self), EMPATHY_TYPE_ACCOUNT_WIDGET, + EmpathyAccountWidgetPriv); + + self->priv = priv; + self->ui_details = g_slice_new0 (EmpathyAccountWidgetUIDetails); } +void +empathy_account_widget_handle_params (EmpathyAccountWidget *self, + const gchar *first_widget, + ...) +{ + va_list args; + + va_start (args, first_widget); + account_widget_handle_params_valist (self, first_widget, args); + va_end (args); +} + +GtkWidget * +empathy_account_widget_new_for_protocol (const char *protocol, + EmpathyAccountSettings *settings) +{ + EmpathyAccountWidget *self; + EmpathyAccountWidgetPriv *priv; + + g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL); + g_return_val_if_fail (settings != NULL, NULL); + + self = g_object_new + (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, + "settings", settings, NULL); + priv = GET_PRIV (self); + + return self->ui_details->widget; +} \ No newline at end of file diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index d3bd171fc..8a5f0f2c2 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -31,27 +31,37 @@ G_BEGIN_DECLS -void empathy_account_widget_handle_params (EmpathyAccountSettings *settings, - GtkBuilder *gui, - const gchar *first_widget, - ...); -void empathy_account_widget_add_forget_button (EmpathyAccountSettings *settings, - GtkBuilder *gui, - const gchar *button, - const gchar *entry); -void empathy_account_widget_add_apply_button (EmpathyAccountSettings *settings, - GtkWidget *vbox); - -void empathy_account_widget_set_default_focus (GtkBuilder *gui, - const gchar *entry); -GtkWidget *empathy_account_widget_generic_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_salut_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_msn_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_jabber_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_icq_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_aim_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_yahoo_new (EmpathyAccountSettings *settings); -GtkWidget *empathy_account_widget_groupwise_new (EmpathyAccountSettings *settings); +#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_new_for_protocol (const char *protocol, + EmpathyAccountSettings *settings); G_END_DECLS -- cgit v1.2.3 From 9e9bc5b2eebee732b8012cbcd649ebba1c320b65 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 27 Jul 2009 01:17:14 +0200 Subject: Update copyright and author --- libempathy-gtk/empathy-account-widget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 76145c483..901fc68d9 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1,7 +1,7 @@ /* -*- 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 +20,7 @@ * * Authors: Xavier Claessens * Martyn Russell + * Cosimo Cecchi */ #include -- cgit v1.2.3 From c6e40cfec95a7f0bef133a96b74220a9bd295c72 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 27 Jul 2009 01:17:25 +0200 Subject: Use telepathy style --- libempathy-gtk/empathy-account-widget.c | 1289 ++++++++++++++++--------------- 1 file changed, 657 insertions(+), 632 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 901fc68d9..1a5c4f643 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -49,24 +49,24 @@ G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT) typedef struct { - GtkWidget *widget; + GtkWidget *widget; - char *protocol; - EmpathyAccountSettings *settings; + char *protocol; + EmpathyAccountSettings *settings; - GtkWidget *apply_button; - GtkWidget *entry_password; - GtkWidget *button_forget; - GtkWidget *spinbutton_port; - - GtkBuilder *gui; - char *default_focus; - gboolean add_forget; + GtkWidget *apply_button; + GtkWidget *entry_password; + GtkWidget *button_forget; + GtkWidget *spinbutton_port; + + GtkBuilder *gui; + char *default_focus; + gboolean add_forget; } EmpathyAccountWidgetPriv; enum { - PROP_PROTOCOL = 1, - PROP_SETTINGS + PROP_PROTOCOL = 1, + PROP_SETTINGS }; #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) @@ -74,408 +74,431 @@ enum { static void account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - gtk_widget_set_sensitive (priv->apply_button, - empathy_account_settings_is_valid (priv->settings)); + gtk_widget_set_sensitive (priv->apply_button, + empathy_account_settings_is_valid (priv->settings)); } static gboolean -account_widget_entry_focus_cb (GtkWidget *widget, - GdkEventFocus *event, - EmpathyAccountWidget *self) +account_widget_entry_focus_cb (GtkWidget *widget, + GdkEventFocus *event, + EmpathyAccountWidget *self) { - const gchar *str; - const gchar *param_name; - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - - str = gtk_entry_get_text (GTK_ENTRY (widget)); - param_name = g_object_get_data (G_OBJECT (widget), "param_name"); - - if (EMP_STR_EMPTY (str)) { - const gchar *value = NULL; - - empathy_account_settings_unset (priv->settings, param_name); - value = empathy_account_settings_get_string (priv->settings, param_name); - DEBUG ("Unset %s and restore to %s", param_name, value); - gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); - } else { - DEBUG ("Setting %s to %s", param_name, - strstr (param_name, "password") ? "***" : str); - empathy_account_settings_set_string (priv->settings, param_name, str); - } - - account_widget_handle_apply_sensitivity (self); - - return FALSE; + const gchar *str; + const gchar *param_name; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + str = gtk_entry_get_text (GTK_ENTRY (widget)); + param_name = g_object_get_data (G_OBJECT (widget), "param_name"); + + if (EMP_STR_EMPTY (str)) + { + const gchar *value = NULL; + + empathy_account_settings_unset (priv->settings, param_name); + value = empathy_account_settings_get_string (priv->settings, param_name); + DEBUG ("Unset %s and restore to %s", param_name, value); + gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); + } + else + { + DEBUG ("Setting %s to %s", param_name, + strstr (param_name, "password") ? "***" : str); + empathy_account_settings_set_string (priv->settings, param_name, str); + } + + account_widget_handle_apply_sensitivity (self); + + return FALSE; } static void account_widget_int_changed_cb (GtkWidget *widget, - EmpathyAccountWidget *self) + 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_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 (); - } + 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_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_apply_sensitivity (self); + account_widget_handle_apply_sensitivity (self); } static void account_widget_checkbutton_toggled_cb (GtkWidget *widget, - EmpathyAccountWidget *self) + 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); - } + 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_apply_sensitivity (self); + account_widget_handle_apply_sensitivity (self); } static void account_widget_forget_clicked_cb (GtkWidget *button, - EmpathyAccountWidget *self) + EmpathyAccountWidget *self) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - const gchar *param_name; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + const gchar *param_name; - param_name = g_object_get_data (G_OBJECT (priv->entry_password), "param_name"); + param_name = g_object_get_data (G_OBJECT (priv->entry_password), "param_name"); - DEBUG ("Unset %s", param_name); - empathy_account_settings_unset (priv->settings, param_name); - gtk_entry_set_text (GTK_ENTRY (priv->entry_password), ""); + 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_apply_sensitivity (self); + account_widget_handle_apply_sensitivity (self); } static void account_widget_password_changed_cb (GtkWidget *entry, - GtkWidget *button) + GtkWidget *button) { - const gchar *str; + 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 (button, !EMP_STR_EMPTY (str)); } static void account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl, - EmpathyAccountWidget *self) + 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); + 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) + GtkWidget *widget, + const gchar *param_name) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + 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_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); - } - 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); - } + 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_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); + } + 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) { - gchar *str; - gchar *p; + gchar *str; + gchar *p; - str = g_strdup (param_name); + str = g_strdup (param_name); - if (str && g_ascii_isalpha (str[0])) { - str[0] = g_ascii_toupper (str[0]); - } + 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]); - } + while ((p = strchr (str, '-')) != NULL) + { + if (p[1] != '\0' && g_ascii_isalpha (p[1])) + { + p[0] = ' '; + p[1] = g_ascii_toupper (p[1]); + } - p++; - } + p++; + } - return str; + return str; } static void accounts_widget_generic_setup (EmpathyAccountWidget *self, - GtkWidget *table_common_settings, - GtkWidget *table_advanced_settings) + GtkWidget *table_common_settings, + GtkWidget *table_advanced_settings) { - 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 { - 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); - } + 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 + 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); + } } static void account_widget_handle_params_valist (EmpathyAccountWidget *self, - const gchar *first_widget, - va_list args) + const gchar *first_widget, + va_list args) { - GObject *object; - const gchar *name; - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + GObject *object; + const gchar *name; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - for (name = first_widget; name; name = va_arg (args, const gchar *)) { - const gchar *param_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 (priv->gui, name); + param_name = va_arg (args, const gchar *); + object = gtk_builder_get_object (priv->gui, name); - if (!object) { - g_warning ("Builder is missing object '%s'.", name); - continue; - } + if (!object) + { + g_warning ("Builder is missing object '%s'.", name); + continue; + } - account_widget_setup_widget (self, GTK_WIDGET (object), param_name); - } + account_widget_setup_widget (self, GTK_WIDGET (object), param_name); + } } static void account_widget_apply_clicked_cb (GtkWidget *button, - EmpathyAccountWidget *self) + EmpathyAccountWidget *self) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); empathy_account_settings_apply_async (priv->settings, NULL, NULL); } @@ -483,395 +506,397 @@ account_widget_apply_clicked_cb (GtkWidget *button, static void account_widget_setup_generic (EmpathyAccountWidget *self) { - GtkWidget *table_common_settings; - GtkWidget *table_advanced_settings; - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + GtkWidget *table_common_settings; + GtkWidget *table_advanced_settings; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - table_common_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, - "table_common_settings")); - table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, - "table_advanced_settings")); + table_common_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, + "table_common_settings")); + table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, + "table_advanced_settings")); - accounts_widget_generic_setup (self, table_common_settings, - table_advanced_settings); + accounts_widget_generic_setup (self, table_common_settings, + table_advanced_settings); } static void account_widget_settings_ready_cb (EmpathyAccountSettings *settings, - GParamSpec *pspec, - gpointer user_data) + GParamSpec *pspec, + gpointer user_data) { - EmpathyAccountWidget *self = user_data; - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + EmpathyAccountWidget *self = user_data; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - if (empathy_account_settings_is_ready (priv->settings)) - account_widget_setup_generic (self); + if (empathy_account_settings_is_ready (priv->settings)) + account_widget_setup_generic (self); } static void account_widget_build_generic (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - priv->gui = empathy_builder_get_file (filename, - "vbox_generic_settings", &self->ui_details->widget, - NULL); - - 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); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + priv->gui = empathy_builder_get_file (filename, + "vbox_generic_settings", &self->ui_details->widget, + NULL); + + 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); } static void account_widget_build_salut (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - priv->gui = empathy_builder_get_file (filename, - "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"); + priv->gui = empathy_builder_get_file (filename, + "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) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - priv->gui = empathy_builder_get_file (filename, - "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; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + priv->gui = empathy_builder_get_file (filename, + "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; } static void account_widget_build_jabber (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - GtkWidget *spinbutton_port; - GtkWidget *checkbutton_ssl; - - priv->gui = empathy_builder_get_file (filename, - "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); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + GtkWidget *spinbutton_port; + GtkWidget *checkbutton_ssl; + + priv->gui = empathy_builder_get_file (filename, + "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); } static void account_widget_build_icq (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - GtkWidget *spinbutton_port; - - priv->gui = empathy_builder_get_file (filename, - "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; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + GtkWidget *spinbutton_port; + + priv->gui = empathy_builder_get_file (filename, + "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; } static void account_widget_build_aim (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - GtkWidget *spinbutton_port; - - priv->gui = empathy_builder_get_file (filename, - "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; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + GtkWidget *spinbutton_port; + + priv->gui = empathy_builder_get_file (filename, + "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; } static void account_widget_build_yahoo (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - - priv->gui = empathy_builder_get_file (filename, - "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; + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + priv->gui = empathy_builder_get_file (filename, + "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; } static void account_widget_build_groupwise (EmpathyAccountWidget *self, - const char *filename) + const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - priv->gui = empathy_builder_get_file (filename, - "vbox_groupwise_settings", &self->ui_details->widget, - NULL); + priv->gui = empathy_builder_get_file (filename, + "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); + 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; + self->ui_details->default_focus = g_strdup ("entry_id"); + self->ui_details->add_forget = TRUE; } static void do_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + 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; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, 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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } } static void do_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + 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; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, 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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } } static void do_constructed (GObject *obj) { - EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - 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); - else if (!tp_strdiff (priv->protocol, "sip")) - empathy_account_widget_sip_build (self, filename); - else - 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 - (priv->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 (priv->gui, "button_forget")); - priv->entry_password = GTK_WIDGET (gtk_builder_get_object (priv->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 button */ - priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); - gtk_box_pack_end (GTK_BOX (self->ui_details->widget), priv->apply_button, FALSE, FALSE, 3); - - g_signal_connect (priv->apply_button, "clicked", - G_CALLBACK (account_widget_apply_clicked_cb), - self); - gtk_widget_show (priv->apply_button); + EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + 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); + else if (!tp_strdiff (priv->protocol, "sip")) + empathy_account_widget_sip_build (self, filename); + else + 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 + (priv->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 (priv->gui, "button_forget")); + priv->entry_password = GTK_WIDGET (gtk_builder_get_object (priv->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 button */ + priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); + gtk_box_pack_end (GTK_BOX (self->ui_details->widget), priv->apply_button, FALSE, FALSE, 3); + + g_signal_connect (priv->apply_button, "clicked", + G_CALLBACK (account_widget_apply_clicked_cb), + self); + gtk_widget_show (priv->apply_button); } static void empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) { - GObjectClass *oclass = G_OBJECT_CLASS (klass); - GParamSpec *param_spec; + 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->get_property = do_get_property; + oclass->set_property = do_set_property; + oclass->constructed = do_constructed; - param_spec = g_param_spec_string ("protocol", + 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", + 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); - g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); + g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); } static void empathy_account_widget_init (EmpathyAccountWidget *self) { - EmpathyAccountWidgetPriv *priv = - G_TYPE_INSTANCE_GET_PRIVATE ((self), EMPATHY_TYPE_ACCOUNT_WIDGET, - EmpathyAccountWidgetPriv); + EmpathyAccountWidgetPriv *priv = + G_TYPE_INSTANCE_GET_PRIVATE ((self), EMPATHY_TYPE_ACCOUNT_WIDGET, + EmpathyAccountWidgetPriv); - self->priv = priv; - self->ui_details = g_slice_new0 (EmpathyAccountWidgetUIDetails); + self->priv = priv; + self->ui_details = g_slice_new0 (EmpathyAccountWidgetUIDetails); } void empathy_account_widget_handle_params (EmpathyAccountWidget *self, - const gchar *first_widget, - ...) + const gchar *first_widget, + ...) { - va_list args; + va_list args; - va_start (args, first_widget); - account_widget_handle_params_valist (self, first_widget, args); - va_end (args); + va_start (args, first_widget); + account_widget_handle_params_valist (self, first_widget, args); + va_end (args); } GtkWidget * empathy_account_widget_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings) + EmpathyAccountSettings *settings) { - EmpathyAccountWidget *self; - EmpathyAccountWidgetPriv *priv; + EmpathyAccountWidget *self; + EmpathyAccountWidgetPriv *priv; - g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL); - g_return_val_if_fail (settings != NULL, NULL); + g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL); + g_return_val_if_fail (settings != NULL, NULL); - self = g_object_new - (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, - "settings", settings, NULL); - priv = GET_PRIV (self); + self = g_object_new + (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, + "settings", settings, NULL); + priv = GET_PRIV (self); - return self->ui_details->widget; -} \ No newline at end of file + return self->ui_details->widget; +} -- cgit v1.2.3 From 68f828614636f87c93af780960954c923cf2faf6 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 27 Jul 2009 01:18:31 +0200 Subject: Add a cosmetic comment to separate public and non-public methods. --- libempathy-gtk/empathy-account-widget.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 1a5c4f643..0695e95a6 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -871,6 +871,8 @@ empathy_account_widget_init (EmpathyAccountWidget *self) self->ui_details = g_slice_new0 (EmpathyAccountWidgetUIDetails); } +/* public methods */ + void empathy_account_widget_handle_params (EmpathyAccountWidget *self, const gchar *first_widget, -- cgit v1.2.3 From 7f58866b6d20c71e21af8d90dc714f32de077af5 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 27 Jul 2009 01:24:53 +0200 Subject: Set apply button sensitivity on creation --- libempathy-gtk/empathy-account-widget.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 0695e95a6..c171a6549 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -832,6 +832,7 @@ do_constructed (GObject *obj) g_signal_connect (priv->apply_button, "clicked", G_CALLBACK (account_widget_apply_clicked_cb), self); + account_widget_handle_apply_sensitivity (self); gtk_widget_show (priv->apply_button); } -- cgit v1.2.3 From 9980b694fec4e3d205555a88040571365416455b Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 27 Jul 2009 11:52:06 +0200 Subject: Implement dispose and finalize --- libempathy-gtk/empathy-account-widget.c | 106 ++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 31 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index c171a6549..0361b957c 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -49,8 +49,6 @@ G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT) typedef struct { - GtkWidget *widget; - char *protocol; EmpathyAccountSettings *settings; @@ -59,9 +57,7 @@ typedef struct { GtkWidget *button_forget; GtkWidget *spinbutton_port; - GtkBuilder *gui; - char *default_focus; - gboolean add_forget; + gboolean dispose_run; } EmpathyAccountWidgetPriv; enum { @@ -475,14 +471,13 @@ account_widget_handle_params_valist (EmpathyAccountWidget *self, { GObject *object; const gchar *name; - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); 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 (priv->gui, name); + object = gtk_builder_get_object (self->ui_details->gui, name); if (!object) { @@ -508,15 +503,16 @@ account_widget_setup_generic (EmpathyAccountWidget *self) { GtkWidget *table_common_settings; GtkWidget *table_advanced_settings; - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - table_common_settings = GTK_WIDGET (gtk_builder_get_object (priv->gui, + 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 (priv->gui, + table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (self->ui_details->gui, "table_advanced_settings")); accounts_widget_generic_setup (self, table_common_settings, table_advanced_settings); + + g_object_unref (self->ui_details->gui); } static void @@ -536,10 +532,12 @@ account_widget_build_generic (EmpathyAccountWidget *self, const char *filename) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_generic_settings", &self->ui_details->widget, NULL); + g_object_ref (self->ui_details->gui); + if (empathy_account_settings_is_ready (priv->settings)) account_widget_setup_generic (self); else @@ -551,9 +549,7 @@ static void account_widget_build_salut (EmpathyAccountWidget *self, const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_salut_settings", &self->ui_details->widget, NULL); @@ -573,8 +569,7 @@ static void account_widget_build_msn (EmpathyAccountWidget *self, const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_msn_settings", &self->ui_details->widget, NULL); @@ -597,7 +592,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self, GtkWidget *spinbutton_port; GtkWidget *checkbutton_ssl; - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_jabber_settings", &self->ui_details->widget, "spinbutton_port", &spinbutton_port, "checkbutton_ssl", &checkbutton_ssl, @@ -628,10 +623,9 @@ static void account_widget_build_icq (EmpathyAccountWidget *self, const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); GtkWidget *spinbutton_port; - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_icq_settings", &self->ui_details->widget, "spinbutton_port", &spinbutton_port, NULL); @@ -652,10 +646,9 @@ static void account_widget_build_aim (EmpathyAccountWidget *self, const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); GtkWidget *spinbutton_port; - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_aim_settings", &self->ui_details->widget, "spinbutton_port", &spinbutton_port, NULL); @@ -675,9 +668,7 @@ static void account_widget_build_yahoo (EmpathyAccountWidget *self, const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_yahoo_settings", &self->ui_details->widget, NULL); @@ -700,9 +691,7 @@ static void account_widget_build_groupwise (EmpathyAccountWidget *self, const char *filename) { - EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - - priv->gui = empathy_builder_get_file (filename, + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_groupwise_settings", &self->ui_details->widget, NULL); @@ -788,8 +777,15 @@ do_constructed (GObject *obj) empathy_account_widget_irc_build (self, filename); else if (!tp_strdiff (priv->protocol, "sip")) empathy_account_widget_sip_build (self, filename); - else + else if (!tp_strdiff (priv->protocol, "generic")) account_widget_build_generic (self, filename); + else + { + g_free (uiname); + g_free (filename); + g_critical ("Unknown protocol, can't build the account widget"); + return; + } g_free (uiname); g_free (filename); @@ -800,7 +796,7 @@ do_constructed (GObject *obj) GObject *default_focus_entry; default_focus_entry = gtk_builder_get_object - (priv->gui, self->ui_details->default_focus); + (self->ui_details->gui, self->ui_details->default_focus); g_signal_connect (default_focus_entry, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL); @@ -811,8 +807,8 @@ do_constructed (GObject *obj) { const gchar *password = NULL; - priv->button_forget = GTK_WIDGET (gtk_builder_get_object (priv->gui, "button_forget")); - priv->entry_password = GTK_WIDGET (gtk_builder_get_object (priv->gui, "entry_password")); + 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)); @@ -834,6 +830,50 @@ do_constructed (GObject *obj) self); account_widget_handle_apply_sensitivity (self); gtk_widget_show (priv->apply_button); + + empathy_builder_unref_and_keep_widget (self->ui_details->gui, self->ui_details->widget); +} + +static void +do_dispose (GObject *obj) +{ + EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + if (priv->dispose_run) + return; + + priv->dispose_run = TRUE; + + if (self->ui_details->gui != NULL) + { + g_object_unref (self->ui_details->gui); + self->ui_details->gui = NULL; + } + + if (priv->settings != NULL) + { + 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); +} + +static void +do_finalize (GObject *obj) +{ + EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + g_free (self->ui_details->default_focus); + g_slice_free (EmpathyAccountWidgetUIDetails, self->ui_details); + + g_free (priv->protocol); + + if (G_OBJECT_CLASS (empathy_account_widget_parent_class)->finalize != NULL) + G_OBJECT_CLASS (empathy_account_widget_parent_class)->finalize (obj); } static void @@ -845,6 +885,8 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) 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", @@ -869,6 +911,8 @@ empathy_account_widget_init (EmpathyAccountWidget *self) EmpathyAccountWidgetPriv); self->priv = priv; + priv->dispose_run = FALSE; + self->ui_details = g_slice_new0 (EmpathyAccountWidgetUIDetails); } -- cgit v1.2.3 From 25ee209b2d033ca91f23a818636926285030945d Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 29 Jul 2009 23:21:40 +0200 Subject: Set the sensitivity to the forget button --- libempathy-gtk/empathy-account-widget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 0361b957c..5cfff21d9 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -198,12 +198,13 @@ account_widget_forget_clicked_cb (GtkWidget *button, static void account_widget_password_changed_cb (GtkWidget *entry, - GtkWidget *button) + EmpathyAccountWidget *self) { + 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)); + gtk_widget_set_sensitive (priv->button_forget, !EMP_STR_EMPTY (str)); } static void -- cgit v1.2.3 From c8fc859d6d2bda4110e0dcb5fa4e213162d1c1c4 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 29 Jul 2009 23:38:00 +0200 Subject: Hook up to the destroy signal in EmpathyAccountWidget --- libempathy-gtk/empathy-account-widget.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 5cfff21d9..2b6439f1d 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -707,6 +707,13 @@ account_widget_build_groupwise (EmpathyAccountWidget *self, self->ui_details->add_forget = TRUE; } +static void +account_widget_destroy_cb (GtkWidget *widget, + EmpathyAccountWidget *self) +{ + g_object_unref (self); +} + static void do_set_property (GObject *object, guint prop_id, @@ -832,6 +839,10 @@ do_constructed (GObject *obj) account_widget_handle_apply_sensitivity (self); gtk_widget_show (priv->apply_button); + /* 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); } -- cgit v1.2.3 From 20438b5175f16e9b78b68a89b5da3fdd3aadad45 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 29 Jul 2009 23:38:19 +0200 Subject: Don't try to unref the GtkBuilder object in _dispose We take care of unreffing it before getting to dispose, as the object can have a variable lifecycle --- libempathy-gtk/empathy-account-widget.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 2b6439f1d..a9edc1b1c 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -857,12 +857,6 @@ do_dispose (GObject *obj) priv->dispose_run = TRUE; - if (self->ui_details->gui != NULL) - { - g_object_unref (self->ui_details->gui); - self->ui_details->gui = NULL; - } - if (priv->settings != NULL) { g_object_unref (priv->settings); -- cgit v1.2.3 From bf6b5979152190e78ca913c6cfd0b91e204c60fd Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 30 Jul 2009 00:44:36 +0200 Subject: Fix trailing whitespace --- libempathy-gtk/empathy-account-widget.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index a9edc1b1c..6d5b2b279 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -51,7 +51,7 @@ G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT) typedef struct { char *protocol; EmpathyAccountSettings *settings; - + GtkWidget *apply_button; GtkWidget *entry_password; GtkWidget *button_forget; @@ -145,7 +145,7 @@ account_widget_int_changed_cb (GtkWidget *widget, default: g_return_if_reached (); } - + account_widget_handle_apply_sensitivity (self); } @@ -176,7 +176,7 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, DEBUG ("Setting %s to %d", param_name, value); empathy_account_settings_set_boolean (priv->settings, param_name, value); } - + account_widget_handle_apply_sensitivity (self); } @@ -238,7 +238,7 @@ account_widget_setup_widget (EmpathyAccountWidget *self, 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); @@ -495,7 +495,7 @@ account_widget_apply_clicked_cb (GtkWidget *button, EmpathyAccountWidget *self) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - + empathy_account_settings_apply_async (priv->settings, NULL, NULL); } @@ -758,7 +758,7 @@ do_get_property (GObject *object, static void do_constructed (GObject *obj) -{ +{ EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); EmpathyAccountWidgetPriv *priv = GET_PRIV (self); char *uiname, *filename; @@ -826,7 +826,7 @@ do_constructed (GObject *obj) self); g_signal_connect (priv->entry_password, "changed", G_CALLBACK (account_widget_password_changed_cb), - self); + self); } /* handle apply button */ @@ -904,7 +904,7 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) "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); + g_object_class_install_property (oclass, PROP_SETTINGS, param_spec); g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); } @@ -912,7 +912,7 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) static void empathy_account_widget_init (EmpathyAccountWidget *self) { - EmpathyAccountWidgetPriv *priv = + EmpathyAccountWidgetPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), EMPATHY_TYPE_ACCOUNT_WIDGET, EmpathyAccountWidgetPriv); -- cgit v1.2.3 From c9ef23052d2e5007e6120dcc881d6c382fcf48d3 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Thu, 30 Jul 2009 17:35:38 +0200 Subject: Chang the API of AccountManager to have the get lookup the account by name EmpathyAccountManager used to have a _lookup function that looked up accounts by name and a _get function that lookup up accounts by connection. This is confusing, as looking up an account for a connection is less common rename have the _get_account be the same _lookup (but without returning a ref) and add a _get_account_for_connection function lookup by account --- libempathy-gtk/empathy-chat.c | 6 ++++-- libempathy-gtk/empathy-contact-list-view.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 0358b0ada..d52d7af93 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -203,7 +203,8 @@ chat_new_connection_cb (EmpathyAccountManager *manager, EmpathyChatPriv *priv = GET_PRIV (chat); EmpathyAccount *account; - account = empathy_account_manager_get_account (manager, connection); + 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)) { @@ -1766,7 +1767,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-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 783d986d0..2ff27b130 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; -- cgit v1.2.3 From 8d2d494e21dd76251ce3fff3301bf007eb514f53 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Fri, 31 Jul 2009 11:44:12 +0200 Subject: Don't try to lookup NULL connections --- libempathy-gtk/empathy-contact-dialogs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index 5b11ddc2e..4252ae019 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -335,6 +335,10 @@ can_add_contact_to_account (EmpathyAccount *account, connection = empathy_account_get_connection (account); + if (connection == NULL) { + return FALSE; + } + contact_manager = empathy_contact_manager_dup_singleton (); result = empathy_contact_manager_can_add (contact_manager, connection); g_object_unref (contact_manager); -- cgit v1.2.3 From 41e5b31c1918f40c3ba47bff2dc9ab682fe0391f Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Fri, 31 Jul 2009 12:11:58 +0200 Subject: Use proper display names in the chooser --- libempathy-gtk/empathy-protocol-chooser.c | 46 +++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index 462979843..79adbac9f 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -123,6 +123,36 @@ protocol_chooser_sort_func (GtkTreeModel *model, 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) @@ -134,24 +164,28 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, { const TpConnectionManagerProtocol *proto = *iter; gchar *icon_name; - gchar *display_name; - + const gchar *display_name; + gchar *display_name_set; icon_name = g_strdup_printf ("im-%s", 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 = g_strdup_printf ("%s (Haze)", proto->name); + display_name_set = g_strdup_printf ("%s (Haze)", display_name); else - display_name = g_strdup (proto->name); + 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, + COL_LABEL, display_name_set, COL_CM, cm, COL_PROTOCOL, proto, -1); - g_free (display_name); + g_free (display_name_set); g_free (icon_name); } } -- cgit v1.2.3 From 8b24044e2bdeec4e282339c78d4eff9050cf964c Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 17 Aug 2009 13:11:20 +0100 Subject: If there is a failure in recognizing the protocol name, fallback to the generic UI --- libempathy-gtk/empathy-account-widget.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 6d5b2b279..feb5b6d84 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -785,15 +785,8 @@ do_constructed (GObject *obj) empathy_account_widget_irc_build (self, filename); else if (!tp_strdiff (priv->protocol, "sip")) empathy_account_widget_sip_build (self, filename); - else if (!tp_strdiff (priv->protocol, "generic")) - account_widget_build_generic (self, filename); else - { - g_free (uiname); - g_free (filename); - g_critical ("Unknown protocol, can't build the account widget"); - return; - } + account_widget_build_generic (self, filename); g_free (uiname); g_free (filename); -- cgit v1.2.3 From 9b497ff832bbffab66eb193ebae190161db55757 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 17 Aug 2009 13:11:46 +0100 Subject: Remove double check for connection == NULL --- libempathy-gtk/empathy-contact-dialogs.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index ad466da50..5c77a787e 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -337,10 +337,6 @@ can_add_contact_to_account (EmpathyAccount *account, if (connection == NULL) return FALSE; - if (connection == NULL) { - return FALSE; - } - contact_manager = empathy_contact_manager_dup_singleton (); result = empathy_contact_manager_get_flags_for_connection ( contact_manager, connection) & EMPATHY_CONTACT_LIST_CAN_ADD; -- cgit v1.2.3 From 07a2794768ee8fbfb2d7b5a71ea22a9ea17d7b43 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 17 Aug 2009 17:56:53 +0100 Subject: Set gui to NULL after unreffing it --- libempathy-gtk/empathy-account-widget.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index feb5b6d84..2ba38d66b 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -837,6 +837,7 @@ do_constructed (GObject *obj) 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; } static void -- cgit v1.2.3 From 58da89ed39904ba96f085fbc18b3a7cdad54ac57 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 18 Aug 2009 16:32:27 +0100 Subject: Rename empathy_settings_get_dbus_signature to empathy_account_settings_get_dbus_signature --- libempathy-gtk/empathy-account-widget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 2ba38d66b..9d9d47dbd 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -121,7 +121,8 @@ account_widget_int_changed_cb (GtkWidget *widget, 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_settings_get_dbus_signature (priv->settings, 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); -- cgit v1.2.3 From ac3c718ca603a8261dfd02536e5a75bc60edfb4a Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 18 Aug 2009 16:32:38 +0100 Subject: Fix indentation --- libempathy-gtk/empathy-account-widget.c | 39 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 9d9d47dbd..5444ffda2 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -248,27 +248,32 @@ account_widget_setup_widget (EmpathyAccountWidget *self, gint value = 0; const gchar *signature; - signature = empathy_settings_get_dbus_signature (priv->settings, param_name); + 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 (); + 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); -- cgit v1.2.3 From fee38f8b6bb302fafb9e506cf7522c6071f76a55 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 21 Aug 2009 18:03:10 +0100 Subject: Fix trailing spaces --- libempathy-gtk/empathy-protocol-chooser.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index ecd26d8ff..d85997fb2 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -127,7 +127,6 @@ static const char * protocol_chooser_proto_name_to_display_name (const gchar *proto_name) { int i; - static struct { const gchar *proto; const gchar *display; -- cgit v1.2.3 From 73a995007e5a417b0e1e0ebf13bdcfdf4dae7c7c Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sat, 1 Aug 2009 19:02:52 +0200 Subject: Implement first page in the assistant --- libempathy-gtk/Makefile.am | 2 + libempathy-gtk/empathy-account-assistant.c | 116 +++++++++++++++++++++++++++++ libempathy-gtk/empathy-account-assistant.h | 60 +++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 libempathy-gtk/empathy-account-assistant.c create mode 100644 libempathy-gtk/empathy-account-assistant.h (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index 70e11e412..aeada220b 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -24,6 +24,7 @@ BUILT_SOURCES = \ lib_LTLIBRARIES = libempathy-gtk.la libempathy_gtk_handwritten_source = \ + empathy-account-assistant.c \ empathy-account-chooser.c \ empathy-account-widget.c \ empathy-account-widget-irc.c \ @@ -86,6 +87,7 @@ libempathy_gtk_la_LDFLAGS = \ -export-symbols-regex ^empathy_ libempathy_gtk_headers = \ + empathy-account-assistant.h \ empathy-account-chooser.h \ empathy-account-widget.h \ empathy-account-widget-irc.h \ diff --git a/libempathy-gtk/empathy-account-assistant.c b/libempathy-gtk/empathy-account-assistant.c new file mode 100644 index 000000000..2efe0f086 --- /dev/null +++ b/libempathy-gtk/empathy-account-assistant.c @@ -0,0 +1,116 @@ +/* + * Copyright (C) 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: Cosimo Cecchi + */ + +/* empathy-account-assistant.c */ + +#include + +#include "empathy-account-assistant.h" +#include "empathy-ui-utils.h" + +G_DEFINE_TYPE (EmpathyAccountAssistant, empathy_account_assistant, + GTK_TYPE_ASSISTANT) + +static GtkWidget * +account_assistant_build_introduction_page (void) +{ + GtkWidget *main_vbox, *hbox_1, *w, *radio, *vbox_1; + GdkPixbuf *pix; + + main_vbox = gtk_vbox_new (FALSE, 12); + gtk_widget_show (main_vbox); + gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); + + hbox_1 = gtk_hbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (main_vbox), hbox_1, TRUE, TRUE, 0); + gtk_widget_show (hbox_1); + + w = gtk_label_new (_("With Empathy you can chat with people \nonline nearby " + "and with friends and colleagues \nwho use Google Talk, AIM, " + "Windows Live \nand many other chat programs. With a microphone \n" + "or a webcam you can also have audio or video calls.")); + gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5); + gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 0); + gtk_widget_show (w); + + pix = empathy_pixbuf_from_icon_name_sized ("empathy", 96); + w = gtk_image_new_from_pixbuf (pix); + gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 6); + gtk_widget_show (w); + + g_object_unref (pix); + + w = gtk_label_new (_("Do you have an account you've been using with another " + "chat program?")); + gtk_misc_set_alignment (GTK_MISC (w), 0, 0); + gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0); + gtk_widget_show (w); + + w = gtk_alignment_new (0, 0, 0, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0); + gtk_box_pack_start (GTK_BOX (main_vbox), w, TRUE, TRUE, 0); + gtk_widget_show (w); + + vbox_1 = gtk_vbox_new (FALSE, 6); + gtk_container_add (GTK_CONTAINER (w), vbox_1); + gtk_widget_show (vbox_1); + + radio = gtk_radio_button_new_with_label (NULL, _("Yes, import my account details from ")); + gtk_box_pack_start (GTK_BOX (vbox_1), radio, TRUE, TRUE, 0); + gtk_widget_show (radio); + + w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("Yes, I'll enter my account details now")); + gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); + gtk_widget_show (w); + + w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I want a new account")); + gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); + gtk_widget_show (w); + + w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I just want to see people online nearby for now")); + gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); + gtk_widget_show (w); + + return main_vbox; +} + +static void +empathy_account_assistant_class_init (EmpathyAccountAssistantClass *klass) +{ + +} + +static void +empathy_account_assistant_init (EmpathyAccountAssistant *self) +{ + GtkWidget *page; + + page = account_assistant_build_introduction_page (); + gtk_assistant_append_page (GTK_ASSISTANT (self), page); + gtk_assistant_set_page_title (GTK_ASSISTANT (self), page, _("Welcome to Empathy")); + gtk_assistant_set_page_type (GTK_ASSISTANT (self), page, GTK_ASSISTANT_PAGE_INTRO); + gtk_assistant_set_page_complete (GTK_ASSISTANT (self), page, TRUE); +} + +GtkWidget * +empathy_account_assistant_new (void) +{ + return g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, NULL); +} diff --git a/libempathy-gtk/empathy-account-assistant.h b/libempathy-gtk/empathy-account-assistant.h new file mode 100644 index 000000000..38a96f8f0 --- /dev/null +++ b/libempathy-gtk/empathy-account-assistant.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 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: Cosimo Cecchi + */ + +/* empathy-account-assistant.h */ + +#ifndef __EMPATHY_ACCOUNT_ASSISTANT_H__ +#define __EMPATHY_ACCOUNT_ASSISTANT_H__ + +#include +#include + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_ACCOUNT_ASSISTANT empathy_account_assistant_get_type() +#define EMPATHY_ACCOUNT_ASSISTANT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_ACCOUNT_ASSISTANT, EmpathyAccountAssistant)) +#define EMPATHY_ACCOUNT_ASSISTANT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), EMPATHY_TYPE_ACCOUNT_ASSISTANT, EmpathyAccountAssistantClass)) +#define EMPATHY_IS_ACCOUNT_ASSISTANT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_ACCOUNT_ASSISTANT)) +#define EMPATHY_IS_ACCOUNT_ASSISTANT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_ACCOUNT_ASSISTANT)) +#define EMPATHY_ACCOUNT_ASSISTANT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_ACCOUNT_ASSISTANT, EmpathyAccountAssistantClass)) + +typedef struct { + GtkAssistant parent; + + /* private */ + gpointer priv; +} EmpathyAccountAssistant; + +typedef struct { + GtkAssistantClass parent_class; +} EmpathyAccountAssistantClass; + +GType empathy_account_assistant_get_type (void); + +GtkWidget *empathy_account_assistant_new (void); + +G_END_DECLS + +#endif /* __EMPATHY_ACCOUNT_ASSISTANT_H__ */ -- cgit v1.2.3 From 3ac8eb4e2f6909d6c54718d6910b156359e10b42 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sat, 1 Aug 2009 19:11:33 +0200 Subject: Move back the account assistant to src/ --- libempathy-gtk/Makefile.am | 2 - libempathy-gtk/empathy-account-assistant.c | 116 ----------------------------- libempathy-gtk/empathy-account-assistant.h | 60 --------------- 3 files changed, 178 deletions(-) delete mode 100644 libempathy-gtk/empathy-account-assistant.c delete mode 100644 libempathy-gtk/empathy-account-assistant.h (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index aeada220b..70e11e412 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -24,7 +24,6 @@ BUILT_SOURCES = \ lib_LTLIBRARIES = libempathy-gtk.la libempathy_gtk_handwritten_source = \ - empathy-account-assistant.c \ empathy-account-chooser.c \ empathy-account-widget.c \ empathy-account-widget-irc.c \ @@ -87,7 +86,6 @@ libempathy_gtk_la_LDFLAGS = \ -export-symbols-regex ^empathy_ libempathy_gtk_headers = \ - empathy-account-assistant.h \ empathy-account-chooser.h \ empathy-account-widget.h \ empathy-account-widget-irc.h \ diff --git a/libempathy-gtk/empathy-account-assistant.c b/libempathy-gtk/empathy-account-assistant.c deleted file mode 100644 index 2efe0f086..000000000 --- a/libempathy-gtk/empathy-account-assistant.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 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: Cosimo Cecchi - */ - -/* empathy-account-assistant.c */ - -#include - -#include "empathy-account-assistant.h" -#include "empathy-ui-utils.h" - -G_DEFINE_TYPE (EmpathyAccountAssistant, empathy_account_assistant, - GTK_TYPE_ASSISTANT) - -static GtkWidget * -account_assistant_build_introduction_page (void) -{ - GtkWidget *main_vbox, *hbox_1, *w, *radio, *vbox_1; - GdkPixbuf *pix; - - main_vbox = gtk_vbox_new (FALSE, 12); - gtk_widget_show (main_vbox); - gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12); - - hbox_1 = gtk_hbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (main_vbox), hbox_1, TRUE, TRUE, 0); - gtk_widget_show (hbox_1); - - w = gtk_label_new (_("With Empathy you can chat with people \nonline nearby " - "and with friends and colleagues \nwho use Google Talk, AIM, " - "Windows Live \nand many other chat programs. With a microphone \n" - "or a webcam you can also have audio or video calls.")); - gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5); - gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 0); - gtk_widget_show (w); - - pix = empathy_pixbuf_from_icon_name_sized ("empathy", 96); - w = gtk_image_new_from_pixbuf (pix); - gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 6); - gtk_widget_show (w); - - g_object_unref (pix); - - w = gtk_label_new (_("Do you have an account you've been using with another " - "chat program?")); - gtk_misc_set_alignment (GTK_MISC (w), 0, 0); - gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0); - gtk_widget_show (w); - - w = gtk_alignment_new (0, 0, 0, 0); - gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0); - gtk_box_pack_start (GTK_BOX (main_vbox), w, TRUE, TRUE, 0); - gtk_widget_show (w); - - vbox_1 = gtk_vbox_new (FALSE, 6); - gtk_container_add (GTK_CONTAINER (w), vbox_1); - gtk_widget_show (vbox_1); - - radio = gtk_radio_button_new_with_label (NULL, _("Yes, import my account details from ")); - gtk_box_pack_start (GTK_BOX (vbox_1), radio, TRUE, TRUE, 0); - gtk_widget_show (radio); - - w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("Yes, I'll enter my account details now")); - gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); - gtk_widget_show (w); - - w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I want a new account")); - gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); - gtk_widget_show (w); - - w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I just want to see people online nearby for now")); - gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); - gtk_widget_show (w); - - return main_vbox; -} - -static void -empathy_account_assistant_class_init (EmpathyAccountAssistantClass *klass) -{ - -} - -static void -empathy_account_assistant_init (EmpathyAccountAssistant *self) -{ - GtkWidget *page; - - page = account_assistant_build_introduction_page (); - gtk_assistant_append_page (GTK_ASSISTANT (self), page); - gtk_assistant_set_page_title (GTK_ASSISTANT (self), page, _("Welcome to Empathy")); - gtk_assistant_set_page_type (GTK_ASSISTANT (self), page, GTK_ASSISTANT_PAGE_INTRO); - gtk_assistant_set_page_complete (GTK_ASSISTANT (self), page, TRUE); -} - -GtkWidget * -empathy_account_assistant_new (void) -{ - return g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, NULL); -} diff --git a/libempathy-gtk/empathy-account-assistant.h b/libempathy-gtk/empathy-account-assistant.h deleted file mode 100644 index 38a96f8f0..000000000 --- a/libempathy-gtk/empathy-account-assistant.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 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: Cosimo Cecchi - */ - -/* empathy-account-assistant.h */ - -#ifndef __EMPATHY_ACCOUNT_ASSISTANT_H__ -#define __EMPATHY_ACCOUNT_ASSISTANT_H__ - -#include -#include - -G_BEGIN_DECLS - -#define EMPATHY_TYPE_ACCOUNT_ASSISTANT empathy_account_assistant_get_type() -#define EMPATHY_ACCOUNT_ASSISTANT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_ACCOUNT_ASSISTANT, EmpathyAccountAssistant)) -#define EMPATHY_ACCOUNT_ASSISTANT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), EMPATHY_TYPE_ACCOUNT_ASSISTANT, EmpathyAccountAssistantClass)) -#define EMPATHY_IS_ACCOUNT_ASSISTANT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_ACCOUNT_ASSISTANT)) -#define EMPATHY_IS_ACCOUNT_ASSISTANT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_ACCOUNT_ASSISTANT)) -#define EMPATHY_ACCOUNT_ASSISTANT_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_ACCOUNT_ASSISTANT, EmpathyAccountAssistantClass)) - -typedef struct { - GtkAssistant parent; - - /* private */ - gpointer priv; -} EmpathyAccountAssistant; - -typedef struct { - GtkAssistantClass parent_class; -} EmpathyAccountAssistantClass; - -GType empathy_account_assistant_get_type (void); - -GtkWidget *empathy_account_assistant_new (void); - -G_END_DECLS - -#endif /* __EMPATHY_ACCOUNT_ASSISTANT_H__ */ -- cgit v1.2.3 From 7ec689852cca3280e48f1d6cba3f5c358575844c Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 3 Aug 2009 18:00:41 +0200 Subject: Remove dead code --- libempathy-gtk/empathy-protocol-chooser.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h index 9d881958d..d6b944a2f 100644 --- a/libempathy-gtk/empathy-protocol-chooser.h +++ b/libempathy-gtk/empathy-protocol-chooser.h @@ -58,10 +58,6 @@ struct _EmpathyProtocolChooserClass GtkComboBoxClass parent_class; }; -typedef void (* EmpathyProtocolChooserReadyCb) (GtkWidget *chooser, - GError *error, - 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 ( -- cgit v1.2.3 From f36945737307c6de7d5c8c66fb117dbdc170a758 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 3 Aug 2009 18:01:48 +0200 Subject: Fix long lines --- libempathy-gtk/empathy-account-widget.c | 35 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 5444ffda2..76f4d72a3 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -166,7 +166,8 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, * 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); + default_value = empathy_account_settings_get_boolean (priv->settings, + param_name); if (default_value == value) { @@ -188,7 +189,8 @@ account_widget_forget_clicked_cb (GtkWidget *button, EmpathyAccountWidgetPriv *priv = GET_PRIV (self); const gchar *param_name; - param_name = g_object_get_data (G_OBJECT (priv->entry_password), "param_name"); + param_name = g_object_get_data (G_OBJECT (priv->entry_password), + "param_name"); DEBUG ("Unset %s", param_name); empathy_account_settings_unset (priv->settings, param_name); @@ -302,7 +304,8 @@ account_widget_setup_widget (EmpathyAccountWidget *self, { gboolean value = FALSE; - value = empathy_account_settings_get_boolean (priv->settings, param_name); + 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", @@ -362,7 +365,8 @@ accounts_widget_generic_setup (EmpathyAccountWidget *self, else table_settings = table_advanced_settings; - param_name_formatted = account_widget_generic_format_param_name (param->name); + 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); @@ -422,7 +426,8 @@ accounts_widget_generic_setup (EmpathyAccountWidget *self, 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; + case 'd': minint = G_MININT32; maxint = G_MAXINT32; + step = 0.1; break; } str = g_strdup_printf (_("%s:"), param_name_formatted); @@ -511,10 +516,10 @@ account_widget_setup_generic (EmpathyAccountWidget *self) GtkWidget *table_common_settings; GtkWidget *table_advanced_settings; - 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")); + 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")); accounts_widget_generic_setup (self, table_common_settings, table_advanced_settings); @@ -814,11 +819,15 @@ do_constructed (GObject *obj) { 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")); + 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)); + 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), -- cgit v1.2.3 From f6a4501ee0965a8353b9ed638d37367f7068b34a Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 02:39:25 +0200 Subject: Add the concept of simple account widget --- libempathy-gtk/empathy-account-widget.c | 113 +++++++++++++++++++++++--------- libempathy-gtk/empathy-account-widget.h | 3 + 2 files changed, 85 insertions(+), 31 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 76f4d72a3..99b450910 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -57,12 +57,15 @@ typedef struct { GtkWidget *button_forget; GtkWidget *spinbutton_port; + gboolean simple; + gboolean dispose_run; } EmpathyAccountWidgetPriv; enum { PROP_PROTOCOL = 1, - PROP_SETTINGS + PROP_SETTINGS, + PROP_SIMPLE }; #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) @@ -604,31 +607,47 @@ account_widget_build_jabber (EmpathyAccountWidget *self, GtkWidget *spinbutton_port; GtkWidget *checkbutton_ssl; - self->ui_details->gui = empathy_builder_get_file (filename, - "vbox_jabber_settings", &self->ui_details->widget, - "spinbutton_port", &spinbutton_port, - "checkbutton_ssl", &checkbutton_ssl, - NULL); + if (priv->simple) + { + self->ui_details->gui = empathy_builder_get_file (filename, + "vbox_jabber_simple", &self->ui_details->widget, + NULL); + + empathy_account_widget_handle_params (self, + "entry_simple_id", "account", + "entry_simple_password", "password", + 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_simple_id"); + } + else + { + self->ui_details->gui = empathy_builder_get_file (filename, + "vbox_jabber_settings", &self->ui_details->widget, + "spinbutton_port", &spinbutton_port, + "checkbutton_ssl", &checkbutton_ssl, + NULL); - self->ui_details->default_focus = g_strdup ("entry_id"); - self->ui_details->add_forget = TRUE; - priv->spinbutton_port = spinbutton_port; + 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); - g_signal_connect (checkbutton_ssl, "toggled", - G_CALLBACK (account_widget_jabber_ssl_toggled_cb), - self); + 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); + } } static void @@ -741,6 +760,9 @@ do_set_property (GObject *object, case PROP_SETTINGS: priv->settings = g_value_dup_object (value); break; + case PROP_SIMPLE: + priv->simple = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -762,6 +784,8 @@ do_get_property (GObject *object, case PROP_SETTINGS: g_value_set_object (value, priv->settings); break; + case PROP_SIMPLE: + g_value_set_boolean (value, priv->simple); default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -838,20 +862,25 @@ do_constructed (GObject *obj) } /* handle apply button */ - priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); - gtk_box_pack_end (GTK_BOX (self->ui_details->widget), priv->apply_button, FALSE, FALSE, 3); + if (!priv->simple) + { + priv->apply_button = gtk_button_new_from_stock (GTK_STOCK_APPLY); + gtk_box_pack_end (GTK_BOX (self->ui_details->widget), priv->apply_button, + FALSE, FALSE, 3); - g_signal_connect (priv->apply_button, "clicked", - G_CALLBACK (account_widget_apply_clicked_cb), - self); - account_widget_handle_apply_sensitivity (self); - gtk_widget_show (priv->apply_button); + g_signal_connect (priv->apply_button, "clicked", + G_CALLBACK (account_widget_apply_clicked_cb), + self); + account_widget_handle_apply_sensitivity (self); + gtk_widget_show (priv->apply_button); + } /* 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); + empathy_builder_unref_and_keep_widget (self->ui_details->gui, + self->ui_details->widget); self->ui_details->gui = NULL; } @@ -915,6 +944,12 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) 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); + g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); } @@ -962,3 +997,19 @@ empathy_account_widget_new_for_protocol (const char *protocol, return self->ui_details->widget; } + +GtkWidget * +empathy_account_widget_simple_new_for_protocol (const char *protocol, + EmpathyAccountSettings *settings) +{ + EmpathyAccountWidget *self; + + g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL); + g_return_val_if_fail (protocol != NULL, NULL); + + self = g_object_new + (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, + "settings", settings, "simple", TRUE, NULL); + + return self->ui_details->widget; +} diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index 8a5f0f2c2..7e6c331d1 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -62,6 +62,9 @@ GType empathy_account_widget_get_type (void); GtkWidget *empathy_account_widget_new_for_protocol (const char *protocol, EmpathyAccountSettings *settings); +GtkWidget * empathy_account_widget_simple_new_for_protocol + (const char *protocol, + EmpathyAccountSettings *settings); G_END_DECLS -- cgit v1.2.3 From 008fe6aa33bcc251a83b4670ead7eff5f552c268 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 02:39:47 +0200 Subject: Add an API to filter protocols --- libempathy-gtk/empathy-protocol-chooser.c | 81 ++++++++++++++++++++++++++----- libempathy-gtk/empathy-protocol-chooser.h | 11 ++++- 2 files changed, 78 insertions(+), 14 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index d85997fb2..9ba28baf6 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -59,9 +59,12 @@ typedef struct { GtkListStore *store; + GtkTreeModel *filter_model; gboolean dispose_run; EmpathyConnectionManagers *cms; + EmpathyProtocolChooserFilterFunc filter_func; + gpointer filter_user_data; } EmpathyProtocolChooserPriv; enum @@ -177,7 +180,8 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, else display_name_set = g_strdup (display_name); - gtk_list_store_insert_with_values (priv->store, NULL, 0, + gtk_list_store_insert_with_values (priv->store, + NULL, 0, COL_ICON, icon_name, COL_LABEL, display_name_set, COL_CM, cm, @@ -228,8 +232,20 @@ protocol_chooser_constructed (GObject *object) G_TYPE_OBJECT, /* CM */ G_TYPE_POINTER); /* protocol */ + priv->filter_model = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store), + NULL); + + /* 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)); + GTK_TREE_MODEL (priv->filter_model)); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE); @@ -244,15 +260,6 @@ protocol_chooser_constructed (GObject *object) "text", COL_LABEL, NULL); - /* 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); - if (empathy_connection_managers_is_ready (priv->cms)) protocol_chooser_add_cms_list (protocol_chooser, empathy_connection_managers_get_cms (priv->cms)); @@ -288,6 +295,12 @@ protocol_chooser_dispose (GObject *object) priv->dispose_run = TRUE; + if (priv->filter_model) + { + g_object_unref (priv->filter_model); + priv->filter_model = NULL; + } + if (priv->store) { g_object_unref (priv->store); @@ -314,6 +327,28 @@ empathy_protocol_chooser_class_init (EmpathyProtocolChooserClass *klass) 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 */ /** @@ -338,12 +373,12 @@ empathy_protocol_chooser_dup_selected ( if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (protocol_chooser), &iter)) { - gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, + gtk_tree_model_get (GTK_TREE_MODEL (priv->filter_model), &iter, COL_CM, &cm, -1); if (protocol != NULL) - gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, + gtk_tree_model_get (GTK_TREE_MODEL (priv->filter_model), &iter, COL_PROTOCOL, protocol, -1); } @@ -364,3 +399,23 @@ 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; + + 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; + + gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER + (priv->filter_model), protocol_chooser_filter_visible_func, + protocol_chooser, NULL); + + gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter_model)); +} diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h index d6b944a2f..55e8e355e 100644 --- a/libempathy-gtk/empathy-protocol-chooser.h +++ b/libempathy-gtk/empathy-protocol-chooser.h @@ -39,7 +39,7 @@ G_BEGIN_DECLS 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), \ +#define EMPATHY_PROTOCOL_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o),\ EMPATHY_TYPE_PROTOCOL_CHOOSER, EmpathyProtocolChooserClass)) typedef struct _EmpathyProtocolChooser EmpathyProtocolChooser; @@ -58,11 +58,20 @@ 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__ */ -- cgit v1.2.3 From f274e990d552235090b689071f5d464007948d52 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 11:45:42 +0200 Subject: Add a way to hook up to the apply sensitivity --- libempathy-gtk/empathy-account-widget.c | 27 ++++++++++++++++++++++++--- libempathy-gtk/empathy-account-widget.h | 3 ++- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 99b450910..4a6b8f21d 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -68,15 +68,27 @@ enum { PROP_SIMPLE }; +enum { + HANDLE_APPLY, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) static void account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + gboolean is_valid; + + is_valid = empathy_account_settings_is_valid (priv->settings); - gtk_widget_set_sensitive (priv->apply_button, - empathy_account_settings_is_valid (priv->settings)); + if (!priv->simple) + gtk_widget_set_sensitive (priv->apply_button, is_valid); + + g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid); } static gboolean @@ -950,6 +962,13 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (oclass, PROP_SIMPLE, 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); + g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); } @@ -1000,7 +1019,7 @@ empathy_account_widget_new_for_protocol (const char *protocol, GtkWidget * empathy_account_widget_simple_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings) + EmpathyAccountSettings *settings, EmpathyAccountWidget **object) { EmpathyAccountWidget *self; @@ -1011,5 +1030,7 @@ empathy_account_widget_simple_new_for_protocol (const char *protocol, (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, "settings", settings, "simple", TRUE, NULL); + *object = self; + return self->ui_details->widget; } diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index 7e6c331d1..ab4e62b45 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -64,7 +64,8 @@ GtkWidget *empathy_account_widget_new_for_protocol (const char *protocol, EmpathyAccountSettings *settings); GtkWidget * empathy_account_widget_simple_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings); + EmpathyAccountSettings *settings, + EmpathyAccountWidget **object); G_END_DECLS -- cgit v1.2.3 From 712f5f9f45105ce66f0f8d4fff40857924943ae8 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 13:20:52 +0200 Subject: Add simple implementations for many widgets --- libempathy-gtk/empathy-account-widget-aim.ui | 66 +++++++ libempathy-gtk/empathy-account-widget-groupwise.ui | 66 +++++++ libempathy-gtk/empathy-account-widget-icq.ui | 66 +++++++ libempathy-gtk/empathy-account-widget-jabber.ui | 66 +++++++ libempathy-gtk/empathy-account-widget-msn.ui | 66 +++++++ libempathy-gtk/empathy-account-widget-sip.ui | 66 +++++++ libempathy-gtk/empathy-account-widget-yahoo.ui | 66 +++++++ libempathy-gtk/empathy-account-widget.c | 218 +++++++++++++++------ 8 files changed, 615 insertions(+), 65 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-aim.ui b/libempathy-gtk/empathy-account-widget-aim.ui index 7f7ac3a60..d6696f583 100644 --- a/libempathy-gtk/empathy-account-widget-aim.ui +++ b/libempathy-gtk/empathy-account-widget-aim.ui @@ -190,4 +190,70 @@ + + True + vertical + 6 + + + True + 0 + What is your AIM screen name? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your AIM password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget-groupwise.ui b/libempathy-gtk/empathy-account-widget-groupwise.ui index 84157527d..f5ddf8d9f 100644 --- a/libempathy-gtk/empathy-account-widget-groupwise.ui +++ b/libempathy-gtk/empathy-account-widget-groupwise.ui @@ -194,4 +194,70 @@ + + True + vertical + 6 + + + True + 0 + What is your GroupWise User ID? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your GroupWise password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget-icq.ui b/libempathy-gtk/empathy-account-widget-icq.ui index 5eab0b75b..b2a62c215 100644 --- a/libempathy-gtk/empathy-account-widget-icq.ui +++ b/libempathy-gtk/empathy-account-widget-icq.ui @@ -219,4 +219,70 @@ + + True + vertical + 6 + + + True + 0 + What is your ICQ UIN? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your ICQ password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index 4b0aa15ad..a2165393c 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -348,4 +348,70 @@ + + True + vertical + 6 + + + True + 0 + What is your Jabber ID? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your Jabber password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.5 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget-msn.ui b/libempathy-gtk/empathy-account-widget-msn.ui index 1d7bde038..2f06d88e7 100644 --- a/libempathy-gtk/empathy-account-widget-msn.ui +++ b/libempathy-gtk/empathy-account-widget-msn.ui @@ -194,4 +194,70 @@ + + True + vertical + 6 + + + True + 0 + What is your Windows Live user name? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your Windows Live password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui index 406f22c94..edb70e426 100644 --- a/libempathy-gtk/empathy-account-widget-sip.ui +++ b/libempathy-gtk/empathy-account-widget-sip.ui @@ -212,4 +212,70 @@ + + True + vertical + 6 + + + True + 0 + What is your SIP login ID? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your SIP account password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget-yahoo.ui b/libempathy-gtk/empathy-account-widget-yahoo.ui index 31e932674..75c27f15c 100644 --- a/libempathy-gtk/empathy-account-widget-yahoo.ui +++ b/libempathy-gtk/empathy-account-widget-yahoo.ui @@ -294,4 +294,70 @@ + + True + vertical + 6 + + + True + 0 + What is your Yahoo! ID? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + + + + + + 1 + + + + + True + 0 + What is your Yahoo! password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 12 + + + True + True + False + + + + + + 3 + + + diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 4a6b8f21d..3bd8309fa 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -596,19 +596,37 @@ static void account_widget_build_msn (EmpathyAccountWidget *self, const char *filename) { - self->ui_details->gui = empathy_builder_get_file (filename, - "vbox_msn_settings", &self->ui_details->widget, - NULL); + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - empathy_account_widget_handle_params (self, - "entry_id", "account", - "entry_password", "password", - "entry_server", "server", - "spinbutton_port", "port", - NULL); + 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, + "vbox_msn_settings", &self->ui_details->widget, + NULL); - self->ui_details->default_focus = g_strdup ("entry_id"); - self->ui_details->add_forget = TRUE; + 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; + } } static void @@ -626,11 +644,11 @@ account_widget_build_jabber (EmpathyAccountWidget *self, NULL); empathy_account_widget_handle_params (self, - "entry_simple_id", "account", - "entry_simple_password", "password", + "entry_id_simple", "account", + "entry_password_simple", "password", NULL); - self->ui_details->default_focus = g_strdup ("entry_simple_id"); + self->ui_details->default_focus = g_strdup ("entry_id_simple"); } else { @@ -666,87 +684,157 @@ static void account_widget_build_icq (EmpathyAccountWidget *self, const char *filename) { + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); GtkWidget *spinbutton_port; - self->ui_details->gui = empathy_builder_get_file (filename, - "vbox_icq_settings", &self->ui_details->widget, - "spinbutton_port", &spinbutton_port, - NULL); + 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", "account", - "entry_password", "password", - "entry_server", "server", - "spinbutton_port", "port", - "entry_charset", "charset", - 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"); - self->ui_details->add_forget = TRUE; + self->ui_details->default_focus = g_strdup ("entry_uin_simple"); + } + else + { + self->ui_details->gui = empathy_builder_get_file (filename, + "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; + } } static void account_widget_build_aim (EmpathyAccountWidget *self, const char *filename) { + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); GtkWidget *spinbutton_port; - self->ui_details->gui = empathy_builder_get_file (filename, - "vbox_aim_settings", &self->ui_details->widget, - "spinbutton_port", &spinbutton_port, - NULL); + 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", "account", - "entry_password", "password", - "entry_server", "server", - "spinbutton_port", "port", - 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, + "vbox_aim_settings", &self->ui_details->widget, + "spinbutton_port", &spinbutton_port, + NULL); - self->ui_details->default_focus = g_strdup ("entry_screenname"); - self->ui_details->add_forget = TRUE; + 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; + } } static void account_widget_build_yahoo (EmpathyAccountWidget *self, const char *filename) { - self->ui_details->gui = empathy_builder_get_file (filename, - "vbox_yahoo_settings", &self->ui_details->widget, - NULL); + 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", "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); + empathy_account_widget_handle_params (self, + "entry_id_simple", "account", + "entry_password_simple", "password", + NULL); - self->ui_details->default_focus = g_strdup ("entry_id"); - self->ui_details->add_forget = TRUE; + self->ui_details->default_focus = g_strdup ("entry_id_simple"); + } + else + { + self->ui_details->gui = empathy_builder_get_file (filename, + "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; + } } static void account_widget_build_groupwise (EmpathyAccountWidget *self, const char *filename) { - self->ui_details->gui = empathy_builder_get_file (filename, - "vbox_groupwise_settings", &self->ui_details->widget, - NULL); + 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", "account", - "entry_password", "password", - "entry_server", "server", - "spinbutton_port", "port", - 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"); - self->ui_details->add_forget = TRUE; + self->ui_details->default_focus = g_strdup ("entry_id_simple"); + } + else + { + self->ui_details->gui = empathy_builder_get_file (filename, + "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; + } } static void -- cgit v1.2.3 From f75d35f22aa745688f9fd932a5de6a6903b3db04 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 15:21:46 +0200 Subject: Implement a simple SIP widget --- libempathy-gtk/empathy-account-widget-sip.c | 81 ++++++++++++++++++----------- 1 file changed, 51 insertions(+), 30 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c index fedbf2aa6..afc20fecb 100644 --- a/libempathy-gtk/empathy-account-widget-sip.c +++ b/libempathy-gtk/empathy-account-widget-sip.c @@ -68,37 +68,58 @@ empathy_account_widget_sip_build (EmpathyAccountWidget *self, const char *filename) { EmpathyAccountWidgetSip *settings; - - settings = g_slice_new0 (EmpathyAccountWidgetSip); - settings->self = self; - - self->ui_details->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); - - 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", + 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, + "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); + NULL); - self->ui_details->add_forget = TRUE; - self->ui_details->default_focus = g_strdup ("entry_userid"); + self->ui_details->add_forget = TRUE; + self->ui_details->default_focus = g_strdup ("entry_userid"); + } - self->ui_details->widget = settings->vbox_settings; + self->ui_details->widget = vbox_settings; } -- cgit v1.2.3 From 3f21eaf356b78cd1e0a8c7d43818e85c7bc12e4a Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 15:22:29 +0200 Subject: Implement a generic simple widget --- libempathy-gtk/empathy-account-widget-generic.ui | 2 +- libempathy-gtk/empathy-account-widget.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'libempathy-gtk') 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 @@ - + True True diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 3bd8309fa..916de9502 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -377,6 +377,8 @@ accounts_widget_generic_setup (EmpathyAccountWidget *self, 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; @@ -559,10 +561,16 @@ account_widget_build_generic (EmpathyAccountWidget *self, const char *filename) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + GtkWidget *expander_advanced; + self->ui_details->gui = empathy_builder_get_file (filename, "vbox_generic_settings", &self->ui_details->widget, + "expander_advanced_settings", &expander_advanced, NULL); + if (priv->simple) + gtk_widget_hide (expander_advanced); + g_object_ref (self->ui_details->gui); if (empathy_account_settings_is_ready (priv->settings)) @@ -805,7 +813,7 @@ account_widget_build_groupwise (EmpathyAccountWidget *self, const char *filename) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - + if (priv->simple) { self->ui_details->gui = empathy_builder_get_file (filename, @@ -886,6 +894,7 @@ do_get_property (GObject *object, break; case PROP_SIMPLE: g_value_set_boolean (value, priv->simple); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -921,7 +930,13 @@ do_constructed (GObject *obj) else if (!tp_strdiff (priv->protocol, "sip")) empathy_account_widget_sip_build (self, filename); else - account_widget_build_generic (self, filename); + { + 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); -- cgit v1.2.3 From caa57e8e5e3fbbad790e3825597a5b3ddd2f3175 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 18:22:32 +0200 Subject: React to entry changes immediately --- libempathy-gtk/empathy-account-widget.c | 40 +++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 916de9502..27120c51a 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -76,6 +76,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountWidget) +#define CHANGED_TIMEOUT 300 static void account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) @@ -91,26 +92,30 @@ account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) g_signal_emit (self, signals[HANDLE_APPLY], 0, is_valid); } -static gboolean -account_widget_entry_focus_cb (GtkWidget *widget, - GdkEventFocus *event, - EmpathyAccountWidget *self) +static void +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 (GTK_ENTRY (widget)); - param_name = g_object_get_data (G_OBJECT (widget), "param_name"); + 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); - value = empathy_account_settings_get_string (priv->settings, param_name); - DEBUG ("Unset %s and restore to %s", param_name, value); - gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); + + 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 { @@ -120,10 +125,25 @@ account_widget_entry_focus_cb (GtkWidget *widget, } account_widget_handle_apply_sensitivity (self); +} + +static gboolean +account_widget_entry_focus_cb (GtkWidget *widget, + GdkEventFocus *event, + EmpathyAccountWidget *self) +{ + account_widget_entry_changed_common (self, GTK_ENTRY (widget), TRUE); return FALSE; } +static void +account_widget_entry_changed_cb (GtkEditable *entry, + EmpathyAccountWidget *self) +{ + account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE); +} + static void account_widget_int_changed_cb (GtkWidget *widget, EmpathyAccountWidget *self) @@ -314,6 +334,8 @@ account_widget_setup_widget (EmpathyAccountWidget *self, 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)) { -- cgit v1.2.3 From bc7cb0959c31644d271fc9945d17cd961dece03d Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 4 Aug 2009 20:00:54 +0200 Subject: Support changing the filter func on the fly --- libempathy-gtk/empathy-protocol-chooser.c | 36 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index 9ba28baf6..70ba60b06 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -59,7 +59,7 @@ typedef struct { GtkListStore *store; - GtkTreeModel *filter_model; + gboolean dispose_run; EmpathyConnectionManagers *cms; @@ -232,9 +232,6 @@ protocol_chooser_constructed (GObject *object) G_TYPE_OBJECT, /* CM */ G_TYPE_POINTER); /* protocol */ - priv->filter_model = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store), - NULL); - /* Set the protocol sort function */ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store), COL_PROTOCOL, @@ -245,7 +242,7 @@ protocol_chooser_constructed (GObject *object) GTK_SORT_ASCENDING); gtk_combo_box_set_model (GTK_COMBO_BOX (object), - GTK_TREE_MODEL (priv->filter_model)); + GTK_TREE_MODEL (priv->store)); renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE); @@ -295,12 +292,6 @@ protocol_chooser_dispose (GObject *object) priv->dispose_run = TRUE; - if (priv->filter_model) - { - g_object_unref (priv->filter_model); - priv->filter_model = NULL; - } - if (priv->store) { g_object_unref (priv->store); @@ -365,20 +356,25 @@ empathy_protocol_chooser_dup_selected ( EmpathyProtocolChooser *protocol_chooser, TpConnectionManagerProtocol **protocol) { - EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser); 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 (priv->filter_model), &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 (priv->filter_model), &iter, + gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter, COL_PROTOCOL, protocol, -1); } @@ -406,6 +402,7 @@ empathy_protocol_chooser_set_visible (EmpathyProtocolChooser *protocol_chooser, gpointer user_data) { EmpathyProtocolChooserPriv *priv; + GtkTreeModel *filter_model; g_return_if_fail (EMPATHY_IS_PROTOCOL_CHOOSER (protocol_chooser)); @@ -413,9 +410,16 @@ empathy_protocol_chooser_set_visible (EmpathyProtocolChooser *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 - (priv->filter_model), protocol_chooser_filter_visible_func, + (filter_model), protocol_chooser_filter_visible_func, protocol_chooser, NULL); - gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter_model)); + gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model)); + + gtk_combo_box_set_active (GTK_COMBO_BOX (protocol_chooser), 0); } -- cgit v1.2.3 From 3962f6f8d1680b6a304577dbc1ed366c33f6b206 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 5 Aug 2009 12:02:39 +0200 Subject: Change labels when creating an account --- libempathy-gtk/empathy-account-widget-jabber.ui | 28 +++++++++++++++++++++---- libempathy-gtk/empathy-account-widget.c | 14 +++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index a2165393c..164bbcdf9 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -351,7 +351,6 @@ True vertical - 6 True @@ -362,6 +361,15 @@ 0 + + + 0 + What is your desired Jabber ID? + + + 1 + + True @@ -369,6 +377,7 @@ 0 0.34999999403953552 0.34999999403953552 + 6 12 @@ -379,17 +388,28 @@ - 1 + 2 True 0 + 6 What is your Jabber password? - 2 + 3 + + + + + 0 + 6 + What is your desired Jabber password? + + + 4 @@ -410,7 +430,7 @@ - 3 + 5 diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 27120c51a..713f50048 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -666,12 +666,26 @@ account_widget_build_jabber (EmpathyAccountWidget *self, 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", -- cgit v1.2.3 From f77948f72bf1863ed85d903c9a6f28353f36b175 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 10 Aug 2009 17:20:17 +0200 Subject: Add example labels to the simple widgets --- libempathy-gtk/empathy-account-widget-aim.ui | 28 +++++++++++++++++++--- libempathy-gtk/empathy-account-widget-groupwise.ui | 28 +++++++++++++++++++--- libempathy-gtk/empathy-account-widget-icq.ui | 28 +++++++++++++++++++--- libempathy-gtk/empathy-account-widget-jabber.ui | 28 +++++++++++++++++++--- libempathy-gtk/empathy-account-widget-msn.ui | 28 +++++++++++++++++++--- libempathy-gtk/empathy-account-widget-sip.ui | 28 +++++++++++++++++++--- libempathy-gtk/empathy-account-widget-yahoo.ui | 28 +++++++++++++++++++--- 7 files changed, 175 insertions(+), 21 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-aim.ui b/libempathy-gtk/empathy-account-widget-aim.ui index d6696f583..05c942d9c 100644 --- a/libempathy-gtk/empathy-account-widget-aim.ui +++ b/libempathy-gtk/empathy-account-widget-aim.ui @@ -211,12 +211,34 @@ 0 0.34999999403953552 0.34999999403953552 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> MyScreenName</span> + True + + + 1 + + diff --git a/libempathy-gtk/empathy-account-widget-groupwise.ui b/libempathy-gtk/empathy-account-widget-groupwise.ui index f5ddf8d9f..c0a717e5e 100644 --- a/libempathy-gtk/empathy-account-widget-groupwise.ui +++ b/libempathy-gtk/empathy-account-widget-groupwise.ui @@ -215,12 +215,34 @@ 0 0.34999999403953552 0.34999999403953552 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> username</span> + True + + + 1 + + diff --git a/libempathy-gtk/empathy-account-widget-icq.ui b/libempathy-gtk/empathy-account-widget-icq.ui index b2a62c215..1a19500b5 100644 --- a/libempathy-gtk/empathy-account-widget-icq.ui +++ b/libempathy-gtk/empathy-account-widget-icq.ui @@ -240,12 +240,34 @@ 0 0.34999999403953552 0.34999999403953552 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> 123456789</span> + True + + + 1 + + diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index 164bbcdf9..d1c28774b 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -378,12 +378,34 @@ 0.34999999403953552 0.34999999403953552 6 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> user@jabber.org</span> + True + + + 1 + + diff --git a/libempathy-gtk/empathy-account-widget-msn.ui b/libempathy-gtk/empathy-account-widget-msn.ui index 2f06d88e7..dbca5fc7e 100644 --- a/libempathy-gtk/empathy-account-widget-msn.ui +++ b/libempathy-gtk/empathy-account-widget-msn.ui @@ -215,12 +215,34 @@ 0 0.34999999403953552 0.34999999403953552 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> user@hotmail.com</span> + True + + + 1 + + diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui index edb70e426..84e68b01f 100644 --- a/libempathy-gtk/empathy-account-widget-sip.ui +++ b/libempathy-gtk/empathy-account-widget-sip.ui @@ -233,12 +233,34 @@ 0 0.34999999403953552 0.34999999403953552 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> user@my.sip.server</span> + True + + + 1 + + diff --git a/libempathy-gtk/empathy-account-widget-yahoo.ui b/libempathy-gtk/empathy-account-widget-yahoo.ui index 75c27f15c..0800ac1dc 100644 --- a/libempathy-gtk/empathy-account-widget-yahoo.ui +++ b/libempathy-gtk/empathy-account-widget-yahoo.ui @@ -315,12 +315,34 @@ 0 0.34999999403953552 0.34999999403953552 + 3 12 - + True - True - + vertical + 4 + + + True + True + + + + 0 + + + + + True + 0.10000000149011612 + <span size="small"><b>Example:</b> username</span> + True + + + 1 + + -- cgit v1.2.3 From adc79c5d0574f548cfe2b89cb0e04d74a5d1e40e Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Thu, 13 Aug 2009 08:56:02 -0400 Subject: First part of an overhaul of the accounts dialog --- libempathy-gtk/empathy-account-widget-jabber.ui | 53 ++++- libempathy-gtk/empathy-account-widget.c | 302 +++++++++++++++++++++--- libempathy-gtk/empathy-account-widget.h | 16 +- 3 files changed, 313 insertions(+), 58 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index d1c28774b..5fddcb7b8 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -21,7 +21,7 @@ True - 2 + 3 3 12 6 @@ -35,8 +35,8 @@ 1 2 - 1 - 2 + 2 + 3 @@ -55,7 +55,7 @@ True - 0 + 1 Login I_D: True entry_id @@ -81,8 +81,8 @@ 2 3 - 1 - 2 + 2 + 3 GTK_FILL @@ -90,18 +90,47 @@ True - 0 + 1 Pass_word: True entry_password - 1 - 2 + 2 + 3 GTK_FILL + + + True + 1 + <span size="small">Example:</span> + True + + + 1 + 2 + + + + + True + 0 + <span size="small">test@jabber.org</span> + True + + + 1 + 2 + 1 + 2 + + + + + False @@ -114,7 +143,7 @@ True True - + True vertical @@ -227,7 +256,7 @@ 0 none - + True 12 @@ -371,7 +400,7 @@ - + True 0 0 diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 713f50048..2f6537aeb 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -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-2009 Collabora Ltd. @@ -21,6 +20,7 @@ * Authors: Xavier Claessens * Martyn Russell * Cosimo Cecchi + * Jonathan Tellier */ #include @@ -52,24 +52,41 @@ 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_SIMPLE, + PROP_CREATING_ACCOUNT }; enum { HANDLE_APPLY, + ACCOUNT_CREATED, + CANCELLED, LAST_SIGNAL }; @@ -79,7 +96,20 @@ static guint signals[LAST_SIGNAL] = { 0 }; #define CHANGED_TIMEOUT 300 static void -account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) +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_handle_control_buttons_sensitivity (EmpathyAccountWidget *self) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); gboolean is_valid; @@ -87,7 +117,10 @@ account_widget_handle_apply_sensitivity (EmpathyAccountWidget *self) is_valid = empathy_account_settings_is_valid (priv->settings); if (!priv->simple) - gtk_widget_set_sensitive (priv->apply_button, is_valid); + { + 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); } @@ -120,11 +153,9 @@ account_widget_entry_changed_common (EmpathyAccountWidget *self, else { DEBUG ("Setting %s to %s", param_name, - strstr (param_name, "password") ? "***" : str); + tp_strdiff (param_name, "password") ? str : "***"); empathy_account_settings_set_string (priv->settings, param_name, str); } - - account_widget_handle_apply_sensitivity (self); } static gboolean @@ -142,6 +173,7 @@ 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); } static void @@ -182,7 +214,7 @@ account_widget_int_changed_cb (GtkWidget *widget, g_return_if_reached (); } - account_widget_handle_apply_sensitivity (self); + account_widget_handle_control_buttons_sensitivity (self); } static void @@ -214,7 +246,7 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, empathy_account_settings_set_boolean (priv->settings, param_name, value); } - account_widget_handle_apply_sensitivity (self); + account_widget_handle_control_buttons_sensitivity (self); } static void @@ -231,7 +263,7 @@ account_widget_forget_clicked_cb (GtkWidget *button, empathy_account_settings_unset (priv->settings, param_name); gtk_entry_set_text (GTK_ENTRY (priv->entry_password), ""); - account_widget_handle_apply_sensitivity (self); + account_widget_handle_control_buttons_sensitivity (self); } static void @@ -540,13 +572,97 @@ account_widget_handle_params_valist (EmpathyAccountWidget *self, } } +static void +account_widget_cancel_clicked_cb (GtkWidget *button, + EmpathyAccountWidget *self) +{ + g_signal_emit (self, signals[CANCELLED], 0); +} + +static void +account_widget_account_enabled_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + 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); + } +} + +static void +account_widget_applied_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + 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); +} + static void account_widget_apply_clicked_cb (GtkWidget *button, EmpathyAccountWidget *self) { EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - empathy_account_settings_apply_async (priv->settings, NULL, NULL); + empathy_account_settings_apply_async (priv->settings, + account_widget_applied_cb, self); } static void @@ -686,7 +802,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self, 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", @@ -697,6 +813,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self, 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, @@ -808,7 +925,7 @@ 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, @@ -888,6 +1005,37 @@ account_widget_destroy_cb (GtkWidget *widget, g_object_unref (self); } +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); + } +} + +static void +account_widget_enabled_toggled_cb (GtkToggleButton *toggle_button, + gpointer user_data) +{ + account_widget_handle_control_buttons_sensitivity ( + EMPATHY_ACCOUNT_WIDGET (user_data)); +} + static void do_set_property (GObject *object, guint prop_id, @@ -907,6 +1055,9 @@ do_set_property (GObject *object, 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); } @@ -931,6 +1082,9 @@ do_get_property (GObject *object, 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); } @@ -941,6 +1095,7 @@ 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, @@ -1012,18 +1167,64 @@ do_constructed (GObject *obj) self); } - /* handle apply button */ + /* 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 (GTK_STOCK_APPLY); - gtk_box_pack_end (GTK_BOX (self->ui_details->widget), priv->apply_button, - FALSE, FALSE, 3); + 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); - account_widget_handle_apply_sensitivity (self); - gtk_widget_show (priv->apply_button); + 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_defaults (GTK_TABLE (priv->table_common_settings), + priv->enabled_checkbox, 0, nb_columns, nb_rows - 1, nb_rows); + + 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 */ @@ -1046,8 +1247,19 @@ do_dispose (GObject *obj) priv->dispose_run = TRUE; + empathy_account_settings_is_ready (priv->settings); + if (priv->settings != NULL) { + EmpathyAccount *account; + account = empathy_account_settings_get_account (priv->settings); + + if (account != NULL) + { + g_signal_handlers_disconnect_by_func (account, + empathy_account_widget_enabled_cb, self); + } + g_object_unref (priv->settings); priv->settings = NULL; } @@ -1101,6 +1313,13 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) 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, @@ -1108,6 +1327,21 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) 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)); } @@ -1139,26 +1373,15 @@ empathy_account_widget_handle_params (EmpathyAccountWidget *self, } GtkWidget * -empathy_account_widget_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings) +empathy_account_widget_get_widget (EmpathyAccountWidget *widget) { - EmpathyAccountWidget *self; - EmpathyAccountWidgetPriv *priv; - - g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL); - g_return_val_if_fail (settings != NULL, NULL); - - self = g_object_new - (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, - "settings", settings, NULL); - priv = GET_PRIV (self); - - return self->ui_details->widget; + return widget->ui_details->widget; } -GtkWidget * -empathy_account_widget_simple_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings, EmpathyAccountWidget **object) +EmpathyAccountWidget * +empathy_account_widget_new_for_protocol (const char *protocol, + EmpathyAccountSettings *settings, + gboolean simple) { EmpathyAccountWidget *self; @@ -1167,9 +1390,10 @@ empathy_account_widget_simple_new_for_protocol (const char *protocol, self = g_object_new (EMPATHY_TYPE_ACCOUNT_WIDGET, "protocol", protocol, - "settings", settings, "simple", TRUE, NULL); - - *object = self; + "settings", settings, "simple", simple, + "creating-account", + empathy_account_settings_get_account (settings) == NULL, + NULL); - return self->ui_details->widget; + return self; } diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index ab4e62b45..f44edcc6a 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. @@ -60,12 +59,15 @@ typedef struct { GType empathy_account_widget_get_type (void); -GtkWidget *empathy_account_widget_new_for_protocol (const char *protocol, - EmpathyAccountSettings *settings); -GtkWidget * empathy_account_widget_simple_new_for_protocol - (const char *protocol, - EmpathyAccountSettings *settings, - EmpathyAccountWidget **object); +GtkWidget *empathy_account_widget_get_widget (EmpathyAccountWidget *widget); + +//EmpathyAccountWidget *empathy_account_widget_new_for_protocol ( +// const char *protocol, +// EmpathyAccountSettings *settings); +EmpathyAccountWidget * empathy_account_widget_new_for_protocol ( + const char *protocol, + EmpathyAccountSettings *settings, + gboolean simple); G_END_DECLS -- cgit v1.2.3 From 17ae7af66b0baa2b898445dee8e79a670e588891 Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 21 Aug 2009 15:11:32 -0400 Subject: Fix errors revealed by make check - Added missing files in po/POTFILES.in - Fixed style --- libempathy-gtk/empathy-account-widget.c | 2 +- libempathy-gtk/empathy-protocol-chooser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 2f6537aeb..7a72deb36 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1190,7 +1190,7 @@ do_constructed (GObject *obj) G_CALLBACK (account_widget_apply_clicked_cb), self); gtk_widget_show_all (hbox); - account_widget_set_control_buttons_sensitivity(self, FALSE); + account_widget_set_control_buttons_sensitivity (self, FALSE); } account = empathy_account_settings_get_account (priv->settings); diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index 70ba60b06..f148edb99 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -59,7 +59,7 @@ typedef struct { GtkListStore *store; - + gboolean dispose_run; EmpathyConnectionManagers *cms; -- cgit v1.2.3 From d047670385b7dcc65ccdb89969f0e43deea7c93e Mon Sep 17 00:00:00 2001 From: Jonathan Tellier Date: Fri, 21 Aug 2009 16:08:29 -0400 Subject: Every protocols should now have an "Enabled" checkbox in "edit" mode. --- libempathy-gtk/empathy-account-widget-irc.c | 4 +++- libempathy-gtk/empathy-account-widget-irc.h | 3 ++- libempathy-gtk/empathy-account-widget-sip.c | 4 +++- libempathy-gtk/empathy-account-widget-sip.h | 3 ++- libempathy-gtk/empathy-account-widget-sip.ui | 2 +- libempathy-gtk/empathy-account-widget.c | 17 +++++++++++++++-- 6 files changed, 26 insertions(+), 7 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c index 932e2f81d..e462aa611 100644 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@ -418,7 +418,8 @@ account_widget_irc_setup (EmpathyAccountWidgetIrc *settings) void empathy_account_widget_irc_build (EmpathyAccountWidget *self, - const char *filename) + const char *filename, + GtkWidget **table_common_settings) { EmpathyAccountWidgetIrc *settings; gchar *dir, *user_file_with_path, *global_file_with_path; @@ -450,6 +451,7 @@ empathy_account_widget_irc_build (EmpathyAccountWidget *self, g_free (user_file_with_path); 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, diff --git a/libempathy-gtk/empathy-account-widget-irc.h b/libempathy-gtk/empathy-account-widget-irc.h index a76787120..022158529 100644 --- a/libempathy-gtk/empathy-account-widget-irc.h +++ b/libempathy-gtk/empathy-account-widget-irc.h @@ -27,7 +27,8 @@ G_BEGIN_DECLS void empathy_account_widget_irc_build (EmpathyAccountWidget *self, - const char *filename); + const char *filename, + GtkWidget **table_common_settings); G_END_DECLS diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c index afc20fecb..db39ddae4 100644 --- a/libempathy-gtk/empathy-account-widget-sip.c +++ b/libempathy-gtk/empathy-account-widget-sip.c @@ -65,7 +65,8 @@ account_widget_sip_discover_stun_toggled_cb ( void empathy_account_widget_sip_build (EmpathyAccountWidget *self, - const char *filename) + const char *filename, + GtkWidget **table_common_settings) { EmpathyAccountWidgetSip *settings; GtkWidget *vbox_settings; @@ -92,6 +93,7 @@ empathy_account_widget_sip_build (EmpathyAccountWidget *self, 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, diff --git a/libempathy-gtk/empathy-account-widget-sip.h b/libempathy-gtk/empathy-account-widget-sip.h index 435ad6ea1..6334a745b 100644 --- a/libempathy-gtk/empathy-account-widget-sip.h +++ b/libempathy-gtk/empathy-account-widget-sip.h @@ -27,7 +27,8 @@ G_BEGIN_DECLS void empathy_account_widget_sip_build (EmpathyAccountWidget *self, - const char *filename); + 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 84e68b01f..65e16473d 100644 --- a/libempathy-gtk/empathy-account-widget-sip.ui +++ b/libempathy-gtk/empathy-account-widget-sip.ui @@ -11,7 +11,7 @@ True vertical - + True 2 2 diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 7a72deb36..aa1c6724e 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -702,6 +702,7 @@ account_widget_build_generic (EmpathyAccountWidget *self, GtkWidget *expander_advanced; 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); @@ -722,7 +723,10 @@ 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); @@ -760,6 +764,7 @@ account_widget_build_msn (EmpathyAccountWidget *self, 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); @@ -864,6 +869,7 @@ account_widget_build_icq (EmpathyAccountWidget *self, 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); @@ -904,6 +910,7 @@ account_widget_build_aim (EmpathyAccountWidget *self, 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); @@ -942,6 +949,7 @@ account_widget_build_yahoo (EmpathyAccountWidget *self, 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); @@ -983,6 +991,7 @@ account_widget_build_groupwise (EmpathyAccountWidget *self, 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); @@ -1117,9 +1126,13 @@ do_constructed (GObject *obj) 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); + 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); + 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); -- cgit v1.2.3 From 0888975ccb8c6ead5761659677d18991c53fe23a Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 22 Aug 2009 16:14:20 +0100 Subject: Make the alignment names in the sip.ui file unique --- libempathy-gtk/empathy-account-widget-sip.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui index 65e16473d..45e0f7d31 100644 --- a/libempathy-gtk/empathy-account-widget-sip.ui +++ b/libempathy-gtk/empathy-account-widget-sip.ui @@ -109,7 +109,7 @@ True True - + True 0 12 -- cgit v1.2.3 From b72ead7076cd2ba308d32f0ae42fc50efc82bd51 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 22 Aug 2009 17:22:23 +0100 Subject: Remove dead code and fix some coding style issues --- libempathy-gtk/empathy-account-widget.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h index f44edcc6a..415934a2d 100644 --- a/libempathy-gtk/empathy-account-widget.h +++ b/libempathy-gtk/empathy-account-widget.h @@ -61,9 +61,6 @@ 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); EmpathyAccountWidget * empathy_account_widget_new_for_protocol ( const char *protocol, EmpathyAccountSettings *settings, -- cgit v1.2.3 From 1eda75c91abf01bc7fe25d4eb41465a21f042596 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 22 Aug 2009 18:20:32 +0100 Subject: Make the layout more consistent with the other widgets --- libempathy-gtk/empathy-account-widget-jabber.ui | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index 5fddcb7b8..2d602cb7f 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -55,7 +55,7 @@ True - 1 + 0 Login I_D: True entry_id @@ -90,9 +90,10 @@ True - 1 + 0 Pass_word: True + right entry_password @@ -102,23 +103,11 @@ - - - True - 1 - <span size="small">Example:</span> - True - - - 1 - 2 - - True 0 - <span size="small">test@jabber.org</span> + Example: <span size="small">test@jabber.org</span> True @@ -131,6 +120,9 @@ + + + False -- cgit v1.2.3 From f984475cb967427790466d21b42b6e703fa55a26 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Sat, 22 Aug 2009 18:33:58 +0100 Subject: When creating an account use a connect button instead of an apply button --- libempathy-gtk/empathy-account-widget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index aa1c6724e..9712ae984 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1186,7 +1186,8 @@ do_constructed (GObject *obj) 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 (GTK_STOCK_APPLY); + 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); -- cgit v1.2.3 From 532d0bd9055bdc5ff75eba8568953022ffa6e6df Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 24 Aug 2009 12:00:23 +0100 Subject: empathy-account-widget: don't expand and fill vertically the 'Activate' checkbox --- libempathy-gtk/empathy-account-widget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 9712ae984..0927d109c 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1232,8 +1232,9 @@ do_constructed (GObject *obj) gtk_table_resize (GTK_TABLE (priv->table_common_settings), ++nb_rows, nb_columns); - gtk_table_attach_defaults (GTK_TABLE (priv->table_common_settings), - priv->enabled_checkbox, 0, nb_columns, nb_rows - 1, nb_rows); + 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); -- cgit v1.2.3 From 2b0b994dca5c7fe90f26befab4fd01d92908edef Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 24 Aug 2009 14:08:50 +0200 Subject: Add example labels to all protocols Also, fix padding and make the label prettier. --- libempathy-gtk/empathy-account-widget-aim.ui | 33 ++++++++++++++++++---- libempathy-gtk/empathy-account-widget-groupwise.ui | 28 ++++++++++++++---- libempathy-gtk/empathy-account-widget-icq.ui | 33 ++++++++++++++++++---- libempathy-gtk/empathy-account-widget-jabber.ui | 3 +- libempathy-gtk/empathy-account-widget-msn.ui | 28 ++++++++++++++---- libempathy-gtk/empathy-account-widget-sip.ui | 26 ++++++++++++++--- libempathy-gtk/empathy-account-widget-yahoo.ui | 33 ++++++++++++++++++---- 7 files changed, 151 insertions(+), 33 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget-aim.ui b/libempathy-gtk/empathy-account-widget-aim.ui index 05c942d9c..2dfdde216 100644 --- a/libempathy-gtk/empathy-account-widget-aim.ui +++ b/libempathy-gtk/empathy-account-widget-aim.ui @@ -15,7 +15,7 @@ True - 2 + 3 3 12 6 @@ -28,8 +28,8 @@ entry_password - 1 - 2 + 2 + 3 GTK_FILL @@ -63,8 +63,8 @@ 2 3 - 1 - 2 + 2 + 3 @@ -88,12 +88,33 @@ False + + 1 + 2 + 2 + 3 + + + + + + + + + + + + True + 0 + 3 + <span size="small"><b>Example:</b> MyScreenName</span> + True + 1 2 1 2 - diff --git a/libempathy-gtk/empathy-account-widget-groupwise.ui b/libempathy-gtk/empathy-account-widget-groupwise.ui index c0a717e5e..d8ce768f9 100644 --- a/libempathy-gtk/empathy-account-widget-groupwise.ui +++ b/libempathy-gtk/empathy-account-widget-groupwise.ui @@ -14,7 +14,7 @@ True - 2 + 3 2 6 6 @@ -56,8 +56,8 @@ 1 2 - 1 - 2 + 2 + 3 @@ -69,8 +69,8 @@ True - 1 - 2 + 2 + 3 GTK_FILL @@ -100,6 +100,24 @@ + + + + + + True + 0 + 3 + <span size="small"><b>Example:</b> username</span> + True + + + 1 + 2 + 1 + 2 + + False diff --git a/libempathy-gtk/empathy-account-widget-icq.ui b/libempathy-gtk/empathy-account-widget-icq.ui index 1a19500b5..a36698a09 100644 --- a/libempathy-gtk/empathy-account-widget-icq.ui +++ b/libempathy-gtk/empathy-account-widget-icq.ui @@ -15,7 +15,7 @@ True - 2 + 3 3 12 6 @@ -28,8 +28,8 @@ entry_password - 1 - 2 + 2 + 3 GTK_FILL @@ -63,8 +63,8 @@ 2 3 - 1 - 2 + 2 + 3 @@ -88,12 +88,33 @@ False + + 1 + 2 + 2 + 3 + + + + + + + + + + + + True + 0 + 3 + <span size="small"><b>Example:</b> 123456789</span> + True + 1 2 1 2 - diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index 2d602cb7f..d32182257 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -107,7 +107,8 @@ True 0 - Example: <span size="small">test@jabber.org</span> + 3 + <span size="small"><b>Example:</b> user@jabber.org</span> True diff --git a/libempathy-gtk/empathy-account-widget-msn.ui b/libempathy-gtk/empathy-account-widget-msn.ui index dbca5fc7e..27de65a2a 100644 --- a/libempathy-gtk/empathy-account-widget-msn.ui +++ b/libempathy-gtk/empathy-account-widget-msn.ui @@ -14,7 +14,7 @@ True - 2 + 3 2 6 6 @@ -56,8 +56,8 @@ 1 2 - 1 - 2 + 2 + 3 @@ -69,8 +69,8 @@ True - 1 - 2 + 2 + 3 GTK_FILL @@ -100,6 +100,24 @@ + + + + + + True + 0 + 3 + <span size="small"><b>Example:</b> user@hotmail.com</span> + True + + + 1 + 2 + 1 + 2 + + False diff --git a/libempathy-gtk/empathy-account-widget-sip.ui b/libempathy-gtk/empathy-account-widget-sip.ui index 45e0f7d31..e8491a6a5 100644 --- a/libempathy-gtk/empathy-account-widget-sip.ui +++ b/libempathy-gtk/empathy-account-widget-sip.ui @@ -13,7 +13,7 @@ True - 2 + 3 2 12 6 @@ -26,8 +26,8 @@ entry_password - 1 - 2 + 2 + 3 GTK_FILL @@ -89,12 +89,30 @@ + + 1 + 2 + 2 + 3 + + + + + + + + + True + 0 + 3 + <span size="small"><b>Example:</b> user@my.sip.server</span> + True + 1 2 1 2 - diff --git a/libempathy-gtk/empathy-account-widget-yahoo.ui b/libempathy-gtk/empathy-account-widget-yahoo.ui index 0800ac1dc..554e0dbec 100644 --- a/libempathy-gtk/empathy-account-widget-yahoo.ui +++ b/libempathy-gtk/empathy-account-widget-yahoo.ui @@ -16,7 +16,7 @@ True - 2 + 3 3 12 6 @@ -29,8 +29,8 @@ entry_password - 1 - 2 + 2 + 3 GTK_FILL @@ -51,8 +51,8 @@ 2 3 - 1 - 2 + 2 + 3 GTK_FILL @@ -89,12 +89,33 @@ False + + 1 + 2 + 2 + 3 + + + + + + + + + + + + True + 0 + 3 + <span size="small"><b>Example:</b> username</span> + True + 1 2 1 2 - -- cgit v1.2.3