[gnome-builder] greeter: move genesis addins into greeter perspective



commit ed8121017a7d10cf1206dc09a1dd6e85baed1bd5
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 30 02:25:02 2016 -0700

    greeter: move genesis addins into greeter perspective
    
    This removes the necessary for the genesis perspective. That makes things
    a bit easier for stuff that cannot fit into a "GenesisAddin" easliy like
    the file chooser dialog.
    
    We can drop the genesis perspective as part of this.

 libide/greeter/ide-greeter-perspective.c  |  430 +++++++++++++++++++++++++++-
 libide/greeter/ide-greeter-perspective.ui |  449 ++++++++++++++++++-----------
 2 files changed, 714 insertions(+), 165 deletions(-)
---
diff --git a/libide/greeter/ide-greeter-perspective.c b/libide/greeter/ide-greeter-perspective.c
index 69191ed..e86a9cf 100644
--- a/libide/greeter/ide-greeter-perspective.c
+++ b/libide/greeter/ide-greeter-perspective.c
@@ -18,15 +18,19 @@
 
 #define G_LOG_DOMAIN "ide-greeter-perspective"
 
+#include <egg-priority-box.h>
 #include <egg-search-bar.h>
 #include <egg-signal-group.h>
 #include <egg-state-machine.h>
 #include <glib/gi18n.h>
+#include <libpeas/peas.h>
+
+#include "ide-macros.h"
 
 #include "application/ide-application.h"
+#include "genesis/ide-genesis-addin.h"
 #include "greeter/ide-greeter-perspective.h"
 #include "greeter/ide-greeter-project-row.h"
-#include "ide-macros.h"
 #include "search/ide-pattern-spec.h"
 #include "util/ide-gtk.h"
 #include "workbench/ide-perspective.h"
@@ -41,18 +45,30 @@ struct _IdeGreeterPerspective
   IdeRecentProjects    *recent_projects;
   IdePatternSpec       *pattern_spec;
   GActionMap           *actions;
+  PeasExtensionSet     *genesis_set;
+
+  GBinding             *ready_binding;
 
   GtkStack             *stack;
+  GtkStack             *top_stack;
+  GtkButton            *genesis_continue_button;
+  GtkLabel             *genesis_title;
+  GtkStack             *genesis_stack;
+  GtkInfoBar           *info_bar;
+  GtkLabel             *info_bar_label;
+  GtkRevealer          *info_bar_revealer;
   GtkViewport          *viewport;
   GtkWidget            *titlebar;
   GtkBox               *my_projects_container;
   GtkListBox           *my_projects_list_box;
+  GtkButton            *open_button;
   GtkBox               *other_projects_container;
   GtkListBox           *other_projects_list_box;
   GtkButton            *remove_button;
   GtkSearchEntry       *search_entry;
   EggStateMachine      *state_machine;
   GtkScrolledWindow    *scrolled_window;
+  EggPriorityBox       *genesis_buttons;
 
   gint                  selected_count;
 };
@@ -575,6 +591,378 @@ delete_selected_rows (GSimpleAction *action,
 }
 
 static void
+ide_greeter_perspective_dialog_response (IdeGreeterPerspective *self,
+                                         gint                   response_id,
+                                         GtkFileChooserDialog  *dialog)
+{
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+  g_assert (GTK_IS_FILE_CHOOSER_DIALOG (dialog));
+
+  if (response_id == GTK_RESPONSE_OK)
+    {
+      IdeWorkbench *workbench;
+
+      if (NULL != (workbench = ide_widget_get_workbench (GTK_WIDGET (self))))
+        {
+          g_autoptr(GFile) project_file = NULL;
+
+          gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE);
+          gtk_widget_set_sensitive (GTK_WIDGET (self->titlebar), FALSE);
+
+          project_file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+          ide_workbench_open_project_async (workbench, project_file, NULL, NULL, NULL);
+        }
+    }
+
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+ide_greeter_perspective_open_clicked (IdeGreeterPerspective *self,
+                                      GtkButton             *open_button)
+{
+  GtkFileChooserDialog *dialog;
+  GtkWidget *toplevel;
+  PeasEngine *engine;
+  const GList *list;
+
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+  g_assert (GTK_IS_BUTTON (open_button));
+
+  engine = peas_engine_get_default ();
+  list = peas_engine_get_plugin_list (engine);
+
+  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG,
+                         "action", GTK_FILE_CHOOSER_ACTION_OPEN,
+                         "transient-for", toplevel,
+                         "modal", TRUE,
+                         "title", _("Open Project"),
+                         "visible", TRUE,
+                         NULL);
+  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                          _("Cancel"), GTK_RESPONSE_CANCEL,
+                          _("Open"), GTK_RESPONSE_OK,
+                          NULL);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+  for (; list != NULL; list = list->next)
+    {
+      PeasPluginInfo *plugin_info = list->data;
+      GtkFileFilter *filter;
+      const gchar *pattern;
+      const gchar *content_type;
+      const gchar *name;
+      gchar **patterns;
+      gchar **content_types;
+      gint i;
+
+      if (!peas_plugin_info_is_loaded (plugin_info))
+        continue;
+
+      name = peas_plugin_info_get_external_data (plugin_info, "X-Project-File-Filter-Name");
+      if (name == NULL)
+        continue;
+
+      pattern = peas_plugin_info_get_external_data (plugin_info, "X-Project-File-Filter-Pattern");
+      content_type = peas_plugin_info_get_external_data (plugin_info, "X-Project-File-Filter-Content-Type");
+
+      if (pattern == NULL && content_type == NULL)
+        continue;
+
+      patterns = g_strsplit (pattern ?: "", ",", 0);
+      content_types = g_strsplit (content_type ?: "", ",", 0);
+
+      filter = gtk_file_filter_new ();
+
+      gtk_file_filter_set_name (filter, name);
+
+      for (i = 0; patterns [i] != NULL; i++)
+        {
+          if (*patterns [i])
+            gtk_file_filter_add_pattern (filter, patterns [i]);
+        }
+
+      for (i = 0; content_types [i] != NULL; i++)
+        {
+          if (*content_types [i])
+            gtk_file_filter_add_mime_type (filter, content_types [i]);
+        }
+
+      gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+      g_strfreev (patterns);
+      g_strfreev (content_types);
+    }
+
+  g_signal_connect_object (dialog,
+                           "response",
+                           G_CALLBACK (ide_greeter_perspective_dialog_response),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
+genesis_button_clicked (IdeGreeterPerspective *self,
+                        GtkButton             *button)
+{
+  const gchar *name;
+
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+  g_assert (GTK_IS_BUTTON (button));
+
+  name = gtk_widget_get_name (GTK_WIDGET (button));
+  gtk_stack_set_visible_child_name (self->genesis_stack, name);
+  egg_state_machine_set_state (self->state_machine, "genesis");
+}
+
+static void
+ide_greeter_perspective_genesis_added (PeasExtensionSet *set,
+                                       PeasPluginInfo   *plugin_info,
+                                       PeasExtension    *exten,
+                                       gpointer          user_data)
+{
+  IdeGreeterPerspective *self = user_data;
+  IdeGenesisAddin *addin = (IdeGenesisAddin *)exten;
+  g_autofree gchar *title = NULL;
+  GtkWidget *button;
+  GtkWidget *child;
+  gint priority;
+
+  g_assert (PEAS_IS_EXTENSION_SET (set));
+  g_assert (plugin_info != NULL);
+  g_assert (IDE_IS_GENESIS_ADDIN (addin));
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+
+  priority = ide_genesis_addin_get_priority (addin);
+  title = ide_genesis_addin_get_label (addin);
+
+  button = g_object_new (GTK_TYPE_BUTTON,
+                         "name", G_OBJECT_TYPE_NAME (addin),
+                         "label", title,
+                         "visible", TRUE,
+                         NULL);
+  g_signal_connect_object (button,
+                           "clicked",
+                           G_CALLBACK (genesis_button_clicked),
+                           self,
+                           G_CONNECT_SWAPPED);
+  gtk_container_add_with_properties (GTK_CONTAINER (self->genesis_buttons), GTK_WIDGET (button),
+                                     "pack-type", GTK_PACK_START,
+                                     "priority", priority,
+                                     NULL);
+
+  child = ide_genesis_addin_get_widget (addin);
+  gtk_container_add_with_properties (GTK_CONTAINER (self->genesis_stack), child,
+                                     "name", G_OBJECT_TYPE_NAME (addin),
+                                     NULL);
+}
+
+static void
+ide_greeter_perspective_genesis_removed (PeasExtensionSet *set,
+                                         PeasPluginInfo   *plugin_info,
+                                         PeasExtension    *exten,
+                                         gpointer          user_data)
+{
+  IdeGreeterPerspective *self = user_data;
+  IdeGenesisAddin *addin = (IdeGenesisAddin *)exten;
+  const gchar *type_name;
+  GList *list;
+  GList *iter;
+
+  g_assert (PEAS_IS_EXTENSION_SET (set));
+  g_assert (plugin_info != NULL);
+  g_assert (IDE_IS_GENESIS_ADDIN (addin));
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+
+  type_name = G_OBJECT_TYPE_NAME (addin);
+  list = gtk_container_get_children (GTK_CONTAINER (self->genesis_buttons));
+
+  for (iter = list; iter != NULL; iter = iter->next)
+    {
+      GtkWidget *widget = iter->data;
+      const gchar *name = gtk_widget_get_name (widget);
+
+      if (g_strcmp0 (name, type_name) == 0)
+        gtk_widget_destroy (widget);
+    }
+
+  g_list_free (list);
+}
+
+static void
+ide_greeter_perspective_load_genesis_addins (IdeGreeterPerspective *self)
+{
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+
+  self->genesis_set = peas_extension_set_new (peas_engine_get_default (),
+                                              IDE_TYPE_GENESIS_ADDIN,
+                                              NULL);
+
+  g_signal_connect_object (self->genesis_set,
+                           "extension-added",
+                           G_CALLBACK (ide_greeter_perspective_genesis_added),
+                           self,
+                           0);
+
+  g_signal_connect_object (self->genesis_set,
+                           "extension-removed",
+                           G_CALLBACK (ide_greeter_perspective_genesis_removed),
+                           self,
+                           0);
+
+  peas_extension_set_foreach (self->genesis_set,
+                              ide_greeter_perspective_genesis_added,
+                              self);
+}
+
+static void
+ide_greeter_perspective_run_cb (GObject      *object,
+                                GAsyncResult *result,
+                                gpointer      user_data)
+{
+  g_autoptr(IdeGreeterPerspective) self = user_data;
+  IdeGenesisAddin *addin = (IdeGenesisAddin *)object;
+  g_autoptr(GError) error = NULL;
+
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+  g_assert (G_IS_ASYNC_RESULT (result));
+  g_assert (IDE_IS_GENESIS_ADDIN (addin));
+
+  if (!ide_genesis_addin_run_finish (addin, result, &error))
+    {
+      g_strstrip (error->message);
+      gtk_label_set_label (self->info_bar_label, error->message);
+      gtk_revealer_set_reveal_child (self->info_bar_revealer, TRUE);
+    }
+
+  /* Update continue button sensitivity */
+  g_object_notify (G_OBJECT (addin), "is-ready");
+}
+
+static void
+run_genesis_addin (PeasExtensionSet *set,
+                   PeasPluginInfo   *plugin_info,
+                   PeasExtension    *exten,
+                   gpointer          user_data)
+{
+  IdeGenesisAddin *addin = (IdeGenesisAddin *)exten;
+  struct {
+    IdeGreeterPerspective *self;
+    const gchar *name;
+  } *state = user_data;
+
+  g_assert (PEAS_IS_EXTENSION_SET (set));
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (state->self));
+  g_assert (state->name != NULL);
+  g_assert (IDE_IS_GENESIS_ADDIN (addin));
+
+  if (g_strcmp0 (state->name, G_OBJECT_TYPE_NAME (addin)) == 0)
+    {
+      ide_genesis_addin_run_async (addin,
+                                   NULL,
+                                   ide_greeter_perspective_run_cb,
+                                   g_object_ref (state->self));
+    }
+}
+
+static void
+ide_greeter_perspective_genesis_continue_clicked (IdeGreeterPerspective *self,
+                                                  GtkButton             *button)
+{
+  struct {
+    IdeGreeterPerspective *self;
+    const gchar *name;
+  } state = { 0 };
+
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+  g_assert (GTK_IS_BUTTON (button));
+
+  state.self = self;
+  state.name = gtk_stack_get_visible_child_name (self->genesis_stack);
+
+  peas_extension_set_foreach (self->genesis_set, run_genesis_addin, &state);
+}
+
+static void
+update_title_for_matching_addin (PeasExtensionSet *set,
+                                 PeasPluginInfo   *plugin_info,
+                                 PeasExtension    *exten,
+                                 gpointer          user_data)
+{
+  struct {
+    IdeGreeterPerspective *self;
+    const gchar *name;
+  } *state = user_data;
+  IdeGenesisAddin *addin = (IdeGenesisAddin *)exten;
+
+  g_assert (PEAS_IS_EXTENSION_SET (set));
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (state->self));
+  g_assert (state->name != NULL);
+  g_assert (IDE_IS_GENESIS_ADDIN (addin));
+
+  if (g_strcmp0 (state->name, G_OBJECT_TYPE_NAME (addin)) == 0)
+    {
+      g_autofree gchar *title = ide_genesis_addin_get_title (addin);
+      g_autofree gchar *next = ide_genesis_addin_get_next_label (addin);
+      GBinding *binding = state->self->ready_binding;
+
+      if (binding != NULL)
+        {
+          ide_clear_weak_pointer (&state->self->ready_binding);
+          g_binding_unbind (binding);
+        }
+
+      binding = g_object_bind_property (addin,
+                                        "is-ready",
+                                        state->self->genesis_continue_button,
+                                        "sensitive",
+                                        G_BINDING_SYNC_CREATE);
+      ide_set_weak_pointer (&state->self->ready_binding, binding);
+
+      gtk_label_set_label (state->self->genesis_title, title);
+      gtk_button_set_label (state->self->genesis_continue_button, next);
+    }
+}
+
+static void
+ide_greeter_perspective_genesis_changed (IdeGreeterPerspective *self,
+                                         GParamSpec            *pspec,
+                                         GtkStack              *stack)
+{
+  struct {
+    IdeGreeterPerspective *self;
+    const gchar *name;
+  } state = { 0 };
+
+  g_assert (GTK_IS_STACK (stack));
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+
+  state.self = self;
+  state.name = gtk_stack_get_visible_child_name (self->genesis_stack);
+
+  peas_extension_set_foreach (self->genesis_set,
+                              update_title_for_matching_addin,
+                              &state);
+}
+
+static void
+ide_greeter_perspective_info_bar_response (IdeGreeterPerspective *self,
+                                           gint                   response_id,
+                                           GtkInfoBar            *info_bar)
+{
+  g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
+  g_assert (GTK_IS_INFO_BAR (info_bar));
+
+  gtk_revealer_set_reveal_child (self->info_bar_revealer, FALSE);
+}
+
+static void
 ide_greeter_perspective_constructed (GObject *object)
 {
   IdeGreeterPerspective *self = (IdeGreeterPerspective *)object;
@@ -584,6 +972,8 @@ ide_greeter_perspective_constructed (GObject *object)
 
   recent_projects = ide_application_get_recent_projects (IDE_APPLICATION_DEFAULT);
   ide_greeter_perspective_set_recent_projects (self, recent_projects);
+
+  ide_greeter_perspective_load_genesis_addins (self);
 }
 
 static void
@@ -591,6 +981,7 @@ ide_greeter_perspective_finalize (GObject *object)
 {
   IdeGreeterPerspective *self = (IdeGreeterPerspective *)object;
 
+  ide_clear_weak_pointer (&self->ready_binding);
   g_clear_pointer (&self->pattern_spec, ide_pattern_spec_unref);
   g_clear_object (&self->signal_group);
   g_clear_object (&self->recent_projects);
@@ -658,16 +1049,25 @@ ide_greeter_perspective_class_init (IdeGreeterPerspectiveClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/ide-greeter-perspective.ui");
   gtk_widget_class_set_css_name (widget_class, "greeter");
-  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, titlebar);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, genesis_buttons);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, genesis_continue_button);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, genesis_stack);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, genesis_title);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, info_bar);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, info_bar_label);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, info_bar_revealer);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, my_projects_container);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, my_projects_list_box);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, open_button);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, other_projects_container);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, other_projects_list_box);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, remove_button);
-  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, search_entry);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, scrolled_window);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, search_entry);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, stack);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, state_machine);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, titlebar);
+  gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, top_stack);
   gtk_widget_class_bind_template_child (widget_class, IdeGreeterPerspective, viewport);
 }
 
@@ -724,6 +1124,30 @@ ide_greeter_perspective_init (IdeGreeterPerspective *self)
                            self,
                            G_CONNECT_SWAPPED);
 
+  g_signal_connect_object (self->top_stack,
+                           "notify::visible-child",
+                           G_CALLBACK (ide_greeter_perspective_genesis_changed),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  g_signal_connect_object (self->genesis_continue_button,
+                           "clicked",
+                           G_CALLBACK (ide_greeter_perspective_genesis_continue_clicked),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  g_signal_connect_object (self->open_button,
+                           "clicked",
+                           G_CALLBACK (ide_greeter_perspective_open_clicked),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  g_signal_connect_object (self->info_bar,
+                           "response",
+                           G_CALLBACK (ide_greeter_perspective_info_bar_response),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   gtk_list_box_set_sort_func (self->my_projects_list_box,
                               ide_greeter_perspective_sort_rows,
                               NULL, NULL);
diff --git a/libide/greeter/ide-greeter-perspective.ui b/libide/greeter/ide-greeter-perspective.ui
index 94fc131..ce91685 100644
--- a/libide/greeter/ide-greeter-perspective.ui
+++ b/libide/greeter/ide-greeter-perspective.ui
@@ -5,146 +5,245 @@
     <child>
       <object class="GtkBox">
         <property name="orientation">vertical</property>
-        <property name="expand">true</property>
         <property name="visible">true</property>
         <child>
-          <object class="GtkStack" id="stack">
-            <property name="expand">true</property>
+          <object class="GtkRevealer" id="info_bar_revealer">
+            <property name="reveal-child">false</property>
+            <property name="transition-type">slide-down</property>
             <property name="visible">true</property>
             <child>
-              <object class="EggEmptyState">
-                <property name="icon-name">builder-symbolic</property>
-                <property name="subtitle" translatable="yes" comments="the action:// link is used to jump to 
the new-project view">Why not &lt;a href="action://app.new-project"&gt;create a new 
project&lt;/a&gt;?</property>
-                <property name="title" translatable="yes">No projects found</property>
+              <object class="GtkInfoBar" id="info_bar">
+                <property name="message-type">error</property>
+                <property name="show-close-button">true</property>
                 <property name="visible">true</property>
+                <child internal-child="content_area">
+                  <object class="GtkBox">
+                    <child>
+                      <object class="GtkLabel" id="info_bar_label">
+                        <property name="hexpand">true</property>
+                        <property name="label">Failure</property>
+                        <property name="visible">true</property>
+                        <property name="wrap">true</property>
+                        <property name="xalign">0</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
-              <packing>
-                <property name="name">empty-state</property>
-              </packing>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkStack" id="top_stack">
+            <property name="visible">true</property>
+            <property name="transition-type">crossfade</property>
             <child>
               <object class="GtkBox">
                 <property name="orientation">vertical</property>
+                <property name="expand">true</property>
                 <property name="visible">true</property>
                 <child>
-                  <object class="GtkScrolledWindow" id="scrolled_window">
+                  <object class="GtkStack" id="stack">
+                    <property name="expand">true</property>
                     <property name="visible">true</property>
                     <child>
-                      <object class="GtkViewport" id="viewport">
-                        <property name="expand">true</property>
+                      <object class="EggEmptyState">
+                        <property name="icon-name">builder-symbolic</property>
+                        <property name="subtitle" translatable="yes" comments="the action:// link is used to 
jump to the new-project view">Why not &lt;a href="action://app.new-project"&gt;create a new 
project&lt;/a&gt;?</property>
+                        <property name="title" translatable="yes">No projects found</property>
+                        <property name="visible">true</property>
+                      </object>
+                      <packing>
+                        <property name="name">empty-state</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="orientation">vertical</property>
                         <property name="visible">true</property>
                         <child>
-                          <object class="EggBox">
-                            <property name="halign">center</property>
-                            <property name="hexpand">false</property>
-                            <property name="margin-bottom">32</property>
-                            <property name="margin-top">32</property>
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">32</property>
+                          <object class="GtkScrolledWindow" id="scrolled_window">
                             <property name="visible">true</property>
-                            <property name="max-width-request">550</property>
-                            <child>
-                              <object class="GtkSearchEntry" id="search_entry">
-                                <property name="width-chars">45</property>
-                                <property name="halign">center</property>
-                                <property name="visible">true</property>
-                              </object>
-                            </child>
                             <child>
-                              <object class="GtkBox" id="my_projects_container">
-                                <property name="orientation">vertical</property>
-                                <property name="spacing">6</property>
+                              <object class="GtkViewport" id="viewport">
+                                <property name="expand">true</property>
                                 <property name="visible">true</property>
                                 <child>
-                                  <object class="GtkBox">
+                                  <object class="EggBox">
+                                    <property name="halign">center</property>
+                                    <property name="hexpand">false</property>
+                                    <property name="margin-bottom">32</property>
+                                    <property name="margin-top">32</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="spacing">32</property>
                                     <property name="visible">true</property>
+                                    <property name="max-width-request">550</property>
                                     <child>
-                                      <object class="GtkLabel" id="my_projects_label">
-                                        <property name="label" translatable="yes">Recent Projects</property>
+                                      <object class="GtkSearchEntry" id="search_entry">
+                                        <property name="width-chars">45</property>
+                                        <property name="halign">center</property>
                                         <property name="visible">true</property>
-                                        <property name="xalign">0.0</property>
-                                        <property name="hexpand">true</property>
-                                        <style>
-                                          <class name="dim-label"/>
-                                        </style>
-                                        <attributes>
-                                          <attribute name="weight" value="bold"/>
-                                        </attributes>
                                       </object>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel">
+                                      <object class="GtkBox" id="my_projects_container">
+                                        <property name="orientation">vertical</property>
+                                        <property name="spacing">6</property>
                                         <property name="visible">true</property>
-                                        <property name="label" translatable="yes">Updated</property>
-                                        <property name="margin-end">10</property>
-                                        <property name="halign">end</property>
-                                        <style>
-                                          <class name="dim-label"/>
-                                        </style>
+                                        <child>
+                                          <object class="GtkBox">
+                                            <property name="visible">true</property>
+                                            <child>
+                                              <object class="GtkLabel" id="my_projects_label">
+                                                <property name="label" translatable="yes">Recent 
Projects</property>
+                                                <property name="visible">true</property>
+                                                <property name="xalign">0.0</property>
+                                                <property name="hexpand">true</property>
+                                                <style>
+                                                  <class name="dim-label"/>
+                                                </style>
+                                                <attributes>
+                                                  <attribute name="weight" value="bold"/>
+                                                </attributes>
+                                              </object>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel">
+                                                <property name="visible">true</property>
+                                                <property name="label" translatable="yes">Updated</property>
+                                                <property name="margin-end">10</property>
+                                                <property name="halign">end</property>
+                                                <style>
+                                                  <class name="dim-label"/>
+                                                </style>
+                                              </object>
+                                            </child>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkFrame">
+                                            <property name="halign">center</property>
+                                            <property name="visible">true</property>
+                                            <property name="width-request">550</property>
+                                            <child>
+                                              <object class="GtkListBox" id="my_projects_list_box">
+                                                <property name="visible">true</property>
+                                                <property name="selection-mode">none</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                        </child>
                                       </object>
                                     </child>
-                                  </object>
-                                </child>
-                                <child>
-                                  <object class="GtkFrame">
-                                    <property name="halign">center</property>
-                                    <property name="visible">true</property>
-                                    <property name="width-request">550</property>
                                     <child>
-                                      <object class="GtkListBox" id="my_projects_list_box">
+                                      <object class="GtkBox" id="other_projects_container">
+                                        <property name="orientation">vertical</property>
+                                        <property name="spacing">6</property>
                                         <property name="visible">true</property>
-                                        <property name="selection-mode">none</property>
+                                        <child>
+                                          <object class="GtkBox">
+                                            <property name="visible">true</property>
+                                            <child>
+                                              <object class="GtkLabel" id="other_projects_label">
+                                                <property name="label" translatable="yes">Other 
Projects</property>
+                                                <property name="visible">true</property>
+                                                <property name="xalign">0.0</property>
+                                                <property name="hexpand">true</property>
+                                                <style>
+                                                  <class name="dim-label"/>
+                                                </style>
+                                                <attributes>
+                                                  <attribute name="weight" value="bold"/>
+                                                </attributes>
+                                              </object>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel">
+                                                <property name="visible">true</property>
+                                                <property name="label" translatable="yes">Updated</property>
+                                                <property name="margin-end">10</property>
+                                                <property name="halign">end</property>
+                                                <style>
+                                                  <class name="dim-label"/>
+                                                </style>
+                                              </object>
+                                            </child>
+                                          </object>
+                                        </child>
+                                        <child>
+                                          <object class="GtkFrame">
+                                            <property name="halign">center</property>
+                                            <property name="visible">true</property>
+                                            <child>
+                                              <object class="GtkListBox" id="other_projects_list_box">
+                                                <property name="visible">true</property>
+                                                <property name="selection-mode">none</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                        </child>
                                       </object>
                                     </child>
                                   </object>
                                 </child>
                               </object>
                             </child>
+                          </object>
+                          <packing>
+                            <property name="expand">true</property>
+                            <property name="fill">true</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkActionBar" id="action_bar">
+                            <property name="visible">false</property>
+                            <child>
+                              <object class="GtkButton" id="remove_button">
+                                <property name="action-name">perspective.delete-selected-rows</property>
+                                <property name="label" translatable="yes">_Remove</property>
+                                <property name="use-underline">true</property>
+                                <property name="visible">true</property>
+                                <property name="sensitive">false</property>
+                                <style>
+                                  <class name="destructive-action"/>
+                                </style>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="name">projects</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkFrame">
+                        <property name="visible">true</property>
+                        <child>
+                          <object class="GtkListBox">
+                            <property name="halign">center</property>
+                            <property name="valign">center</property>
+                            <property name="visible">true</property>
                             <child>
-                              <object class="GtkBox" id="other_projects_container">
-                                <property name="orientation">vertical</property>
-                                <property name="spacing">6</property>
+                              <object class="GtkListBoxRow">
                                 <property name="visible">true</property>
                                 <child>
-                                  <object class="GtkBox">
+                                  <object class="GtkLabel">
+                                    <property name="label">Create from existing project</property>
                                     <property name="visible">true</property>
-                                    <child>
-                                      <object class="GtkLabel" id="other_projects_label">
-                                        <property name="label" translatable="yes">Other Projects</property>
-                                        <property name="visible">true</property>
-                                        <property name="xalign">0.0</property>
-                                        <property name="hexpand">true</property>
-                                        <style>
-                                          <class name="dim-label"/>
-                                        </style>
-                                        <attributes>
-                                          <attribute name="weight" value="bold"/>
-                                        </attributes>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkLabel">
-                                        <property name="visible">true</property>
-                                        <property name="label" translatable="yes">Updated</property>
-                                        <property name="margin-end">10</property>
-                                        <property name="halign">end</property>
-                                        <style>
-                                          <class name="dim-label"/>
-                                        </style>
-                                      </object>
-                                    </child>
+                                    <property name="xalign">0.0</property>
                                   </object>
                                 </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkListBoxRow">
+                                <property name="visible">true</property>
                                 <child>
-                                  <object class="GtkFrame">
-                                    <property name="halign">center</property>
+                                  <object class="GtkLabel">
+                                    <property name="label">Create a new project</property>
                                     <property name="visible">true</property>
-                                    <child>
-                                      <object class="GtkListBox" id="other_projects_list_box">
-                                        <property name="visible">true</property>
-                                        <property name="selection-mode">none</property>
-                                      </object>
-                                    </child>
+                                    <property name="xalign">0.0</property>
                                   </object>
                                 </child>
                               </object>
@@ -152,72 +251,23 @@
                           </object>
                         </child>
                       </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">true</property>
-                    <property name="fill">true</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkActionBar" id="action_bar">
-                    <property name="visible">false</property>
-                    <child>
-                      <object class="GtkButton" id="remove_button">
-                        <property name="action-name">perspective.delete-selected-rows</property>
-                        <property name="label" translatable="yes">_Remove</property>
-                        <property name="use-underline">true</property>
-                        <property name="visible">true</property>
-                        <property name="sensitive">false</property>
-                        <style>
-                          <class name="destructive-action"/>
-                        </style>
-                      </object>
+                      <packing>
+                        <property name="name">assistants</property>
+                      </packing>
                     </child>
                   </object>
                 </child>
               </object>
               <packing>
-                <property name="name">projects</property>
+                <property name="name">greeter</property>
               </packing>
             </child>
             <child>
-              <object class="GtkFrame">
+              <object class="GtkStack" id="genesis_stack">
                 <property name="visible">true</property>
-                <child>
-                  <object class="GtkListBox">
-                    <property name="halign">center</property>
-                    <property name="valign">center</property>
-                    <property name="visible">true</property>
-                    <child>
-                      <object class="GtkListBoxRow">
-                        <property name="visible">true</property>
-                        <child>
-                          <object class="GtkLabel">
-                            <property name="label">Create from existing project</property>
-                            <property name="visible">true</property>
-                            <property name="xalign">0.0</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkListBoxRow">
-                        <property name="visible">true</property>
-                        <child>
-                          <object class="GtkLabel">
-                            <property name="label">Create a new project</property>
-                            <property name="visible">true</property>
-                            <property name="xalign">0.0</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
               </object>
               <packing>
-                <property name="name">assistants</property>
+                <property name="name">genesis</property>
               </packing>
             </child>
           </object>
@@ -243,23 +293,40 @@
             <property name="label" translatable="yes">Click an item to select</property>
           </object>
         </child>
+        <child>
+          <object class="GtkLabel" id="genesis_title">
+            <property name="visible">true</property>
+          </object>
+        </child>
       </object>
     </child>
     <child>
-      <object class="GtkButton" id="new_button">
-        <property name="tooltip-text" translatable="yes">Create a new project</property>
-        <property name="action-name">win.perspective</property>
-        <property name="action-target">'genesis'</property>
-        <property name="visible">true</property>
-        <property name="label" translatable="yes">_New</property>
+      <object class="GtkButton" id="genesis_cancel_button">
+        <property name="action-name">perspective.state</property>
+        <property name="action-target">'browse'</property>
+        <property name="label" translatable="yes">_Cancel</property>
         <property name="use-underline">true</property>
-        <style>
-          <class name="text-button"/>
-        </style>
+        <property name="visible">true</property>
+      </object>
+    </child>
+    <child>
+      <object class="EggPriorityBox" id="genesis_buttons">
+        <property name="homogeneous">true</property>
+        <property name="spacing">6</property>
+        <property name="visible">true</property>
+        <child>
+          <object class="GtkButton" id="open_button">
+            <property name="label" translatable="yes">Open…</property>
+            <property name="visible">true</property>
+          </object>
+          <packing>
+            <property name="priority">0</property>
+          </packing>
+        </child>
       </object>
       <packing>
-        <property name="position">0</property>
         <property name="pack-type">start</property>
+        <property name="position">0</property>
       </packing>
     </child>
     <child>
@@ -298,6 +365,17 @@
         <property name="pack-type">end</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkButton" id="genesis_continue_button">
+        <style>
+          <class name="suggested-action"/>
+        </style>
+      </object>
+      <packing>
+        <property name="position">0</property>
+        <property name="pack-type">end</property>
+      </packing>
+    </child>
   </object>
   <object class="EggStateMachine" id="state_machine">
     <property name="state">browse</property>
@@ -315,7 +393,7 @@
         <object id="selection_button">
           <property name="visible">true</property>
         </object>
-        <object id="new_button">
+        <object id="genesis_buttons">
           <property name="visible">true</property>
         </object>
         <object id="action_bar">
@@ -327,6 +405,15 @@
         <object id="search_entry">
           <property name="visible">true</property>
         </object>
+        <object id="genesis_cancel_button">
+          <property name="visible">false</property>
+        </object>
+        <object id="genesis_continue_button">
+          <property name="visible">false</property>
+        </object>
+        <object id="top_stack">
+          <property name="visible-child-name">greeter</property>
+        </object>
       </state>
       <state name="selection">
         <object id="titlebar">
@@ -347,7 +434,7 @@
         <object id="selection_button">
           <property name="visible">false</property>
         </object>
-        <object id="new_button">
+        <object id="genesis_buttons">
           <property name="visible">false</property>
         </object>
         <object id="other_projects_container">
@@ -356,6 +443,44 @@
         <object id="search_entry">
           <property name="visible">false</property>
         </object>
+        <object id="genesis_cancel_button">
+          <property name="visible">false</property>
+        </object>
+        <object id="genesis_continue_button">
+          <property name="visible">false</property>
+        </object>
+        <object id="top_stack">
+          <property name="visible-child-name">greeter</property>
+        </object>
+      </state>
+      <state name="genesis">
+        <object id="titlebar">
+          <property name="show-close-button">false</property>
+        </object>
+        <object id="action_bar">
+          <property name="visible">false</property>
+        </object>
+        <object id="title_stack">
+          <property name="visible-child">genesis_title</property>
+        </object>
+        <object id="cancel_button">
+          <property name="visible">false</property>
+        </object>
+        <object id="selection_button">
+          <property name="visible">false</property>
+        </object>
+        <object id="genesis_buttons">
+          <property name="visible">false</property>
+        </object>
+        <object id="genesis_cancel_button">
+          <property name="visible">true</property>
+        </object>
+        <object id="genesis_continue_button">
+          <property name="visible">true</property>
+        </object>
+        <object id="top_stack">
+          <property name="visible-child-name">genesis</property>
+        </object>
       </state>
     </states>
   </object>


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