]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-local-xmpp-assistant-widget.c
use the 48x48 version of the local-xmpp icon
[empathy.git] / libempathy-gtk / empathy-local-xmpp-assistant-widget.c
index 5cf8ce976bf72005f5d1e243e5ded3c3775e379e..74f8339bc28bfcdbb4101edad7a265e388b1a940 100644 (file)
@@ -36,7 +36,7 @@
 #include <libempathy/empathy-debug.h>
 
 G_DEFINE_TYPE (EmpathyLocalXmppAssistantWidget,
-    empathy_local_xmpp_assistant_widget, GTK_TYPE_BOX)
+    empathy_local_xmpp_assistant_widget, GTK_TYPE_GRID)
 
 enum {
   SIG_VALID = 1,
@@ -135,7 +135,7 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
 {
   EmpathyLocalXmppAssistantWidget *self = (EmpathyLocalXmppAssistantWidget *)
     object;
-  GtkWidget *hbox, *w;
+  GtkWidget *w;
   GdkPixbuf *pix;
   GtkWidget *account_widget;
   EmpathyAccountWidget *widget_object;
@@ -146,29 +146,19 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
 
   gtk_container_set_border_width (GTK_CONTAINER (self), 12);
 
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-  gtk_box_pack_start (GTK_BOX (self), hbox, TRUE, TRUE, 0);
-  gtk_widget_show (hbox);
-
-  w = gtk_label_new (NULL);
-  markup = g_strdup_printf ("%s (<span style=\"italic\">%s</span>).",
+  w = gtk_label_new (
       _("Empathy can automatically discover and chat with the people "
         "connected on the same network as you. "
         "If you want to use this feature, please check that the "
-        "details below are correct. "
-        "You can easily change these details later or disable this feature "
-        "by using the 'Accounts' dialog"),
-      _("Edit->Accounts"));
-  gtk_label_set_markup (GTK_LABEL (w), markup);
-  g_free (markup);
+        "details below are correct."));
   gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
   gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
-  gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+  gtk_grid_attach (GTK_GRID (self), w, 0, 0, 1, 1);
   gtk_widget_show (w);
 
-  pix = empathy_pixbuf_from_icon_name_sized ("im-local-xmpp", 80);
+  pix = empathy_pixbuf_from_icon_name_sized ("im-local-xmpp", 48);
   w = gtk_image_new_from_pixbuf (pix);
-  gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 6);
+  gtk_grid_attach (GTK_GRID (self), w, 1, 0, 1, 1);
   gtk_widget_show (w);
 
   g_object_unref (pix);
@@ -184,9 +174,21 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
   g_signal_connect (widget_object, "handle-apply",
       G_CALLBACK (handle_apply_cb), self);
 
-  gtk_box_pack_start (GTK_BOX (self), account_widget,
-      FALSE, FALSE, 0);
+  gtk_grid_attach (GTK_GRID (self), account_widget, 0, 1, 2, 1);
   gtk_widget_show (account_widget);
+
+  w = gtk_label_new (NULL);
+  markup = g_strdup_printf (
+      "<span size=\"small\">%s</span>",
+      _("You can change these details later or disable this feature "
+        "by choosing <span style=\"italic\">Edit → Accounts</span> "
+        "in the Contact List."));
+  gtk_label_set_markup (GTK_LABEL (w), markup);
+  g_free (markup);
+  gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
+  gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
+  gtk_grid_attach (GTK_GRID (self), w, 0, 2, 2, 1);
+  gtk_widget_show (w);
 }
 
 static void
@@ -225,7 +227,7 @@ GtkWidget *
 empathy_local_xmpp_assistant_widget_new ()
 {
   return g_object_new (EMPATHY_TYPE_LOCAL_XMPP_ASSISTANT_WIDGET,
-      "orientation", GTK_ORIENTATION_VERTICAL,
+      "row-spacing", 6,
       NULL);
 }
 
@@ -280,3 +282,28 @@ empathy_local_xmpp_assistant_widget_create_account (
   empathy_account_settings_apply_async (self->priv->settings,
       apply_account_cb, NULL);
 }
+
+gboolean
+empathy_local_xmpp_assistant_widget_should_create_account (
+    TpAccountManager *manager)
+{
+  gboolean salut_created = FALSE;
+  GList *accounts, *l;
+
+  accounts = tp_account_manager_get_valid_accounts (manager);
+
+  for (l = accounts; l != NULL;  l = g_list_next (l))
+    {
+      TpAccount *account = TP_ACCOUNT (l->data);
+
+      if (!tp_strdiff (tp_account_get_protocol (account), "local-xmpp"))
+        {
+          salut_created = TRUE;
+          break;
+        }
+    }
+
+  g_list_free (accounts);
+
+  return !salut_created;
+}