]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/gossip-account-widget-jabber.c
sv.po: Updated Swedish translation
[empathy.git] / libempathy-gtk / gossip-account-widget-jabber.c
index e9b393c3e652de8e2e5c27922a351d7f2e04f062..e7334b4b564f6d670d95622f5cf06046ebe8b813 100644 (file)
@@ -30,6 +30,8 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 
+#include <libmissioncontrol/mc-profile.h>
+
 #include <libempathy/gossip-utils.h>
 
 #include "gossip-account-widget-jabber.h"
@@ -91,7 +93,7 @@ account_widget_jabber_entry_focus_cb (GtkWidget                 *widget,
 
        str = gtk_entry_get_text (GTK_ENTRY (widget));
        if (G_STR_EMPTY (str)) {
-               gchar *value;
+               gchar *value = NULL;
 
                mc_account_get_param_string (settings->account, param, &value);
                gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
@@ -120,7 +122,7 @@ account_widget_jabber_checkbutton_toggled_cb (GtkWidget                 *widget,
                                              GossipAccountWidgetJabber *settings)
 {
        if (widget == settings->checkbutton_ssl) {
-               gint     port;
+               gint     port = 0;
                gboolean old_ssl;
 
                mc_account_get_param_int (settings->account, "port", &port);
@@ -173,12 +175,12 @@ account_widget_jabber_destroy_cb (GtkWidget                 *widget,
 static void
 account_widget_jabber_setup (GossipAccountWidgetJabber *settings)
 {
-       gint      port;
-       gchar    *id;
-       gchar    *resource;
-       gchar    *server;
-       gchar    *password;
-       gboolean  old_ssl;
+       gint      port = 0;
+       gchar    *id = NULL;
+       gchar    *resource = NULL;
+       gchar    *server = NULL;
+       gchar    *password = NULL;
+       gboolean  old_ssl = FALSE;
 
        mc_account_get_param_int (settings->account, "port", &port);
        mc_account_get_param_string (settings->account, "account", &id);
@@ -187,6 +189,18 @@ account_widget_jabber_setup (GossipAccountWidgetJabber *settings)
        mc_account_get_param_string (settings->account, "password", &password);
        mc_account_get_param_boolean (settings->account, "old-ssl", &old_ssl);
 
+       if (!id) {
+               McProfile   *profile;
+               const gchar *server;
+
+               profile = mc_account_get_profile (settings->account);
+               server = mc_profile_get_default_account_domain (profile);
+               if (server) {
+                       id = g_strconcat ("user@", server, NULL);
+               }
+               g_object_unref (profile);
+       }
+
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (settings->checkbutton_ssl), old_ssl);
        gtk_entry_set_text (GTK_ENTRY (settings->entry_id), id ? id : "");
        gtk_entry_set_text (GTK_ENTRY (settings->entry_password), password ? password : "");
@@ -260,6 +274,8 @@ gossip_account_widget_jabber_new (McAccount *account)
 
        g_object_unref (size_group);
 
+       gtk_widget_show (settings->vbox_settings);
+
        return settings->vbox_settings;
 }