]> git.0d.be Git - empathy.git/commitdiff
contact-widget: don't display the account when editing our info
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 14 Mar 2012 10:57:12 +0000 (11:57 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 16 Mar 2012 09:29:39 +0000 (10:29 +0100)
All these flags are making this code pretty messy. Hopefully we'll move and
clean it when implementing the new design next cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=672036

libempathy-gtk/empathy-contact-widget.c
libempathy-gtk/empathy-contact-widget.h
libempathy-gtk/empathy-contact-widget.ui
src/empathy-accounts-dialog.c

index edeec31f4237b0a55c100ab8f1b0955ae00d5c20..e44772a72c090a22a22f5753640bd93e6dd6c672 100644 (file)
@@ -103,6 +103,7 @@ typedef struct
   GtkWidget *vbox_avatar;
   GtkWidget *favourite_checkbox;
   GtkWidget *label_details;
+  GtkWidget *label_left_account;
 
   /* Location */
   GtkWidget *vbox_location;
@@ -1403,7 +1404,7 @@ contact_widget_contact_update (EmpathyContactWidget *information)
               contact_widget_change_contact, information);
         }
     }
-  else
+  else if ((information->flags & EMPATHY_CONTACT_WIDGET_NO_ACCOUNT) == 0)
     {
       if (account)
         {
@@ -1585,6 +1586,11 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
             G_CALLBACK (contact_widget_change_contact),
             information);
     }
+  else if (information->flags & EMPATHY_CONTACT_WIDGET_NO_ACCOUNT)
+    {
+      /* Don't display the account */
+      gtk_widget_hide (information->label_left_account);
+    }
   else
     {
       /* Pack the protocol icon with the account name in an hbox */
@@ -1606,11 +1612,14 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
           information->label_account, FALSE, TRUE, 0);
     }
 
-  gtk_grid_attach (GTK_GRID (information->grid_contact),
-      information->widget_account,
-      1, 0, 1, 1);
+  if (information->widget_account != NULL)
+    {
+      gtk_grid_attach (GTK_GRID (information->grid_contact),
+          information->widget_account,
+          1, 0, 1, 1);
 
-  gtk_widget_show (information->widget_account);
+      gtk_widget_show (information->widget_account);
+    }
 
   /* Set up avatar chooser/display */
   if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR)
@@ -1761,6 +1770,7 @@ empathy_contact_widget_new (EmpathyContact *contact,
        "grid_client", &information->grid_client,
        "hbox_client_requested", &information->hbox_client_requested,
        "label_details", &information->label_details,
+       "label_left_account", &information->label_left_account,
        NULL);
   g_free (filename);
 
index 2533248b5b676b81f7a05a4f39721a5a26b5c1e8..a50f9fa3ecd31a77e6ef0e3c0b444a9fd2df1a4c 100644 (file)
@@ -64,6 +64,7 @@ typedef enum
   EMPATHY_CONTACT_WIDGET_SHOW_DETAILS = 1 << 8,
   EMPATHY_CONTACT_WIDGET_EDIT_DETAILS = 1 << 9,
   EMPATHY_CONTACT_WIDGET_NO_STATUS    = 1 << 10,
+  EMPATHY_CONTACT_WIDGET_NO_ACCOUNT   = 1 << 11,
 } EmpathyContactWidgetFlags;
 
 GtkWidget * empathy_contact_widget_new (EmpathyContact *contact,
index a8d9fbe7abd27a911b2497f4eeb165e426cd4e33..c6cb7a5ca9111e9e08a1bb56e786b8c30593881a 100644 (file)
@@ -10,7 +10,7 @@
         <property name="column_spacing">6</property>
         <property name="row_spacing">6</property>
         <child>
-          <object class="GtkLabel" id="label680">
+          <object class="GtkLabel" id="label_left_account">
             <property name="visible">True</property>
             <property name="xalign">0</property>
             <property name="label" translatable="yes">Account:</property>
index 2cc2482511395cca219346df5fac001725c0293a..ec40ef3cb5088711c30d423229e04e675d5e3d52 100644 (file)
@@ -788,7 +788,8 @@ account_dialog_got_self_contact (TpConnection *conn,
       EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
       EMPATHY_CONTACT_WIDGET_EDIT_AVATAR |
       EMPATHY_CONTACT_WIDGET_NO_STATUS |
-      EMPATHY_CONTACT_WIDGET_EDIT_DETAILS);
+      EMPATHY_CONTACT_WIDGET_EDIT_DETAILS |
+      EMPATHY_CONTACT_WIDGET_NO_ACCOUNT);
 
   gtk_box_pack_start (GTK_BOX (priv->dialog_content), alig, TRUE, TRUE, 0);
   gtk_container_add (GTK_CONTAINER (alig), editor);