[gnome-builder/wip/greeter] greeter: add row to proper list box based on recency



commit f6c5b670bf80fac78c64f3ed0a59afc1f80d7f0a
Author: Christian Hergert <christian hergert me>
Date:   Sun May 10 12:54:21 2015 -0700

    greeter: add row to proper list box based on recency

 data/ui/gb-greeter-window.ui    |  140 +--------------------------------------
 src/greeter/gb-greeter-window.c |   14 +++-
 2 files changed, 12 insertions(+), 142 deletions(-)
---
diff --git a/data/ui/gb-greeter-window.ui b/data/ui/gb-greeter-window.ui
index e66b5d0..4a640e9 100644
--- a/data/ui/gb-greeter-window.ui
+++ b/data/ui/gb-greeter-window.ui
@@ -7,6 +7,7 @@
     <child type="titlebar">
       <object class="GtkHeaderBar" id="header_bar">
         <property name="show-close-button">true</property>
+        <property name="title" translatable="yes">Select a Project</property>
         <property name="visible">true</property>
         <child>
           <object class="GtkButton">
@@ -154,145 +155,6 @@
                               <object class="GtkListBox" id="other_projects_list_box">
                                 <property name="visible">true</property>
                                 <property name="selection-mode">none</property>
-                                <child>
-                                  <object class="GtkListBoxRow">
-                                    <property name="visible">true</property>
-                                    <child>
-                                      <object class="GtkBox">
-                                        <property name="orientation">vertical</property>
-                                        <property name="margin">12</property>
-                                        <property name="visible">true</property>
-                                        <child>
-                                          <object class="GtkBox">
-                                            <property name="orientation">horizontal</property>
-                                            <property name="visible">true</property>
-                                            <child>
-                                              <object class="GtkLabel">
-                                                <property name="visible">true</property>
-                                                <property name="hexpand">true</property>
-                                                <property name="valign">baseline</property>
-                                                <property name="label">libpeas</property>
-                                                <property name="xalign">0.0</property>
-                                                <attributes>
-                                                  <attribute name="scale" value="1.2"/>
-                                                  <attribute name="weight" value="bold"/>
-                                                </attributes>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkLabel">
-                                                <property name="visible">true</property>
-                                                <property name="hexpand">true</property>
-                                                <property name="valign">baseline</property>
-                                                <property name="label">2 days ago</property>
-                                                <property name="xalign">1.0</property>
-                                                <attributes>
-                                                  <attribute name="scale" value="0.833333"/>
-                                                </attributes>
-                                                <style>
-                                                  <class name="dim-label"/>
-                                                </style>
-                                              </object>
-                                            </child>
-                                          </object>
-                                        </child>
-                                        <child>
-                                          <object class="GtkLabel">
-                                            <property name="label">A GObject plugins library.</property>
-                                            <property name="valign">baseline</property>
-                                            <property name="visible">true</property>
-                                            <property name="xalign">0.0</property>
-                                          </object>
-                                        </child>
-                                        <child>
-                                          <object class="GtkBox">
-                                            <property name="orientation">horizontal</property>
-                                            <property name="visible">true</property>
-                                            <property name="spacing">6</property>
-                                            <child>
-                                              <object class="GtkLabel">
-                                                <property name="label">Projects/libpeas</property>
-                                                <property name="hexpand">true</property>
-                                                <property name="visible">true</property>
-                                                <property name="valign">baseline</property>
-                                                <property name="xalign">0.0</property>
-                                                <style>
-                                                  <class name="dim-label"/>
-                                                </style>
-                                                <attributes>
-                                                  <attribute name="scale" value="0.833333"/>
-                                                </attributes>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkEventBox">
-                                                <property name="visible">true</property>
-                                                <style>
-                                                  <class name="pill-box"/>
-                                                </style>
-                                                <child>
-                                                  <object class="GtkLabel">
-                                                    <property name="label">C</property>
-                                                    <property name="xpad">6</property>
-                                                    <property name="ypad">3</property>
-                                                    <property name="hexpand">false</property>
-                                                    <property name="valign">baseline</property>
-                                                    <property name="visible">true</property>
-                                                    <attributes>
-                                                      <attribute name="scale" value="0.833333"/>
-                                                    </attributes>
-                                                  </object>
-                                                </child>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkEventBox">
-                                                <property name="visible">true</property>
-                                                <style>
-                                                  <class name="pill-box"/>
-                                                </style>
-                                                <child>
-                                                  <object class="GtkLabel">
-                                                    <property name="label">Python</property>
-                                                    <property name="xpad">6</property>
-                                                    <property name="ypad">3</property>
-                                                    <property name="hexpand">false</property>
-                                                    <property name="valign">baseline</property>
-                                                    <property name="visible">true</property>
-                                                    <attributes>
-                                                      <attribute name="scale" value="0.833333"/>
-                                                    </attributes>
-                                                  </object>
-                                                </child>
-                                              </object>
-                                            </child>
-                                            <child>
-                                              <object class="GtkEventBox">
-                                                <property name="visible">true</property>
-                                                <style>
-                                                  <class name="pill-box"/>
-                                                </style>
-                                                <child>
-                                                  <object class="GtkLabel">
-                                                    <property name="label">JavaScript</property>
-                                                    <property name="xpad">6</property>
-                                                    <property name="ypad">3</property>
-                                                    <property name="hexpand">false</property>
-                                                    <property name="valign">baseline</property>
-                                                    <property name="visible">true</property>
-                                                    <attributes>
-                                                      <attribute name="scale" value="0.833333"/>
-                                                    </attributes>
-                                                  </object>
-                                                </child>
-                                              </object>
-                                            </child>
-                                          </object>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
                               </object>
                             </child>
                           </object>
diff --git a/src/greeter/gb-greeter-window.c b/src/greeter/gb-greeter-window.c
index 6f4e76d..37e0d19 100644
--- a/src/greeter/gb-greeter-window.c
+++ b/src/greeter/gb-greeter-window.c
@@ -69,6 +69,11 @@ gb_greeter_window__recent_projects_items_changed (GbGreeterWindow *self,
   GbGreeterProjectRow *row;
   gsize i;
 
+  /*
+   * TODO: We ignore removed out of simplicity for now.
+   *       But IdeRecentProjects doesn't currently remove anything anyway.
+   */
+
   g_assert (GB_IS_GREETER_WINDOW (self));
   g_assert (G_IS_LIST_MODEL (list_model));
   g_assert (IDE_IS_RECENT_PROJECTS (recent_projects));
@@ -76,17 +81,20 @@ gb_greeter_window__recent_projects_items_changed (GbGreeterWindow *self,
   for (i = 0; i < added; i++)
     {
       IdeProjectInfo *project_info;
+      GtkListBox *list_box;
 
       project_info = g_list_model_get_item (list_model, position + i);
 
-      if (!ide_project_info_get_is_recent (project_info))
-        continue;
+      if (ide_project_info_get_is_recent (project_info))
+        list_box = self->my_projects_list_box;
+      else
+        list_box = self->other_projects_list_box;
 
       row = g_object_new (GB_TYPE_GREETER_PROJECT_ROW,
                           "visible", TRUE,
                           "project-info", project_info,
                           NULL);
-      gtk_list_box_insert (self->my_projects_list_box, GTK_WIDGET (row), position + i);
+      gtk_container_add (GTK_CONTAINER (list_box), GTK_WIDGET (row));
     }
 }
 


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