[gnome-initial-setup] Move the goa page closer to the designs



commit 2327ce9cf8d6a1d6aca1f84f9e71edaf489c7c88
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 9 19:34:27 2013 -0500

    Move the goa page closer to the designs
    
    Make the list appear more like it does in the design. I took
    the freedom to replace the - with a trashcan, and I made up
    some empty list state.

 gnome-initial-setup/pages/goa/gis-goa-page.c  |   26 +++++++++++-
 gnome-initial-setup/pages/goa/gis-goa-page.ui |   58 +++++++++++++++++++------
 2 files changed, 70 insertions(+), 14 deletions(-)
---
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.c b/gnome-initial-setup/pages/goa/gis-goa-page.c
index 27f7842..b8f0fd9 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.c
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.c
@@ -33,6 +33,8 @@
 #define GOA_BACKEND_API_IS_SUBJECT_TO_CHANGE
 #include <goabackend/goabackend.h>
 
+#include <egg-list-box.h>
+
 #include "cc-online-accounts-add-account-dialog.h"
 
 #include <glib/gi18n.h>
@@ -174,6 +176,17 @@ confirm_remove_account (GtkButton *button, gpointer user_data)
     }
 }
 
+static void
+update_visibility (GisGoaPage *page)
+{
+  GisGoaPagePrivate *priv = page->priv;
+  GList *accounts;
+
+  accounts = goa_client_get_accounts (priv->goa_client);
+  gtk_widget_set_visible (WID ("online-accounts-label"), accounts == NULL);
+  gtk_widget_set_visible (WID ("online-accounts-frame"), accounts != NULL);
+  g_list_free_full (accounts, (GDestroyNotify) g_object_unref);
+}
 
 static void
 add_account_to_list (GisGoaPage *page, GoaObject *object)
@@ -196,6 +209,7 @@ add_account_to_list (GisGoaPage *page, GoaObject *object)
                             goa_account_get_presentation_identity (account));
 
   list = WID ("online-accounts-list");
+  egg_list_box_set_selection_mode (EGG_LIST_BOX (list), GTK_SELECTION_NONE);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
   gtk_widget_set_hexpand (box, TRUE);
@@ -206,7 +220,10 @@ add_account_to_list (GisGoaPage *page, GoaObject *object)
   image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
   label = gtk_label_new (markup);
   gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
-  button = gtk_button_new_with_label (_("Remove"));
+
+  button = gtk_button_new ();
+  gtk_button_set_image (GTK_BUTTON (button),
+                        gtk_image_new_from_icon_name ("user-trash-symbolic", GTK_ICON_SIZE_MENU));
   gtk_widget_set_halign (button, GTK_ALIGN_END);
   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
 
@@ -223,6 +240,8 @@ add_account_to_list (GisGoaPage *page, GoaObject *object)
   gtk_widget_show_all (box);
 
   gtk_container_add (GTK_CONTAINER (list), box);
+
+  update_visibility (page);
 }
 
 static void
@@ -254,6 +273,8 @@ remove_account_from_list (GisGoaPage *page, GoaObject *object)
         }
     }
   g_list_free (children);
+
+  update_visibility (page);
 }
 
 static void
@@ -264,6 +285,7 @@ populate_account_list (GisGoaPage *page)
   GoaObject *object;
 
   accounts = goa_client_get_accounts (priv->goa_client);
+
   for (l = accounts; l; l = l->next)
     {
       object = GOA_OBJECT (l->data);
@@ -271,6 +293,8 @@ populate_account_list (GisGoaPage *page)
     }
 
   g_list_free_full (accounts, (GDestroyNotify) g_object_unref);
+
+  update_visibility (page);
 }
 
 static void
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.ui b/gnome-initial-setup/pages/goa/gis-goa-page.ui
index 35c4199..adc35d5 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.ui
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.ui
@@ -1,18 +1,20 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="3.0"/>
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkGrid" id="goa-page">
-    <property name="name">online-page</property>
     <property name="visible">True</property>
-    <property name="halign">center</property>
+    <property name="can_focus">False</property>
+    <property name="halign">fill</property>
+    <property name="margin_left">80</property>
+    <property name="margin_right">80</property>
     <child>
       <object class="GtkLabel" id="online-title">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">Link other accounts</property>
-        <property name="hexpand">False</property>
+        <property name="can_focus">False</property>
         <property name="halign">start</property>
         <property name="valign">start</property>
-        <property name="margin-bottom">18</property>
+        <property name="margin_bottom">18</property>
+        <property name="label" translatable="yes">Link other accounts</property>
         <attributes>
           <attribute name="weight" value="bold"/>
           <attribute name="scale" value="1.2"/>
@@ -26,9 +28,13 @@
       </packing>
     </child>
     <child>
-      <object class="GtkBox" id="online-accounts-list">
-        <property name="orientation">vertical</property>
+      <object class="GtkLabel" id="online-accounts-label">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">fill</property>
+        <property name="valign">start</property>
+        <property name="wrap">True</property>
+        <property name="label" translatable="yes">Adding an account allows your application to access it for documents, mail, contacts, calendar, char and more.</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
@@ -38,17 +44,43 @@
       </packing>
     </child>
     <child>
-      <object class="GtkButton" id="online-add-button">
+      <object class="GtkFrame" id="online-accounts-frame">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">in</property>
+        <property name="margin-left">0</property>
+        <property name="margin-right">0</property>
+        <property name="hexpand">True</property>
+        <child>
+          <object class="EggListBox" id="online-accounts-list">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">3</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButton" id="online-add-button">
         <property name="label">_Add Account</property>
-        <property name="use_underline">True</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="receives_default">False</property>
         <property name="halign">start</property>
         <property name="valign">start</property>
-        <property name="margin-top">24</property>
+        <property name="margin_top">24</property>
+        <property name="use_underline">True</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
+        <property name="top_attach">4</property>
         <property name="width">1</property>
         <property name="height">1</property>
       </packing>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]