[glade/modern-ui: 30/32] GladeWindow: add main stack with logo



commit 378642da68e493852ad61b3943d405d6723b1ac0
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Sat Jul 8 21:48:20 2017 -0300

    GladeWindow: add main stack with logo

 src/glade-window.c   |   35 ++++--
 src/glade-window.css |   28 ++++
 src/glade.glade      |  352 ++++++++++++++++++++++++++++++--------------------
 3 files changed, 263 insertions(+), 152 deletions(-)
---
diff --git a/src/glade-window.c b/src/glade-window.c
index 731cc37..f68ae2d 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -71,13 +71,14 @@
 #define CONFIG_KEY_AUTOSAVE         "autosave"
 #define CONFIG_KEY_AUTOSAVE_SECONDS "autosave-seconds"
 
-#define GLADE_WINDOW_ACTIVE_VIEW(w) ((GladeDesignView *) gtk_stack_get_visible_child (w->priv->stack))
+#define GLADE_WINDOW_ACTIVE_VIEW(w) ((GladeDesignView *) gtk_stack_get_visible_child (w->priv->view_stack))
 
 struct _GladeWindowPrivate
 {
   GladeApp *app;
 
   GtkStack *stack;
+  GtkStack *view_stack;
 
   GtkHeaderBar *headerbar;
   GtkWindow *about_dialog;
@@ -87,6 +88,9 @@ struct _GladeWindowPrivate
   GtkLabel *subtitle;
   GtkWidget *project_button;
 
+  GtkWidget *start_page;
+  GtkLabel  *version_label;
+
   GladeAdaptorChooser *adaptor_chooser;
   GtkStack *inspectors_stack;           /* Cached per project inspectors */
 
@@ -536,7 +540,7 @@ refresh_stack_title_for_project (GladeWindow *window, GladeProject *project)
 {
   GList *children, *l;
 
-  children = gtk_container_get_children (GTK_CONTAINER (window->priv->stack));
+  children = gtk_container_get_children (GTK_CONTAINER (window->priv->view_stack));
   for (l = children; l; l = l->next)
     {
       GtkWidget *view = l->data;
@@ -546,7 +550,7 @@ refresh_stack_title_for_project (GladeWindow *window, GladeProject *project)
           gchar *str = get_formatted_project_name_for_display (project,
                                                                FORMAT_NAME_MARK_UNSAVED |
                                                                FORMAT_NAME_MIDDLE_TRUNCATE);
-          gtk_container_child_set (GTK_CONTAINER (window->priv->stack), view,
+          gtk_container_child_set (GTK_CONTAINER (window->priv->view_stack), view,
                                    "title", str, NULL);
           g_free (str);
 
@@ -901,7 +905,7 @@ switch_to_project (GladeWindow *window, GladeProject *project)
   GtkWidget *view;
 
   view = GTK_WIDGET (glade_design_view_get_from_project (project));
-  gtk_stack_set_visible_child (priv->stack, view);
+  gtk_stack_set_visible_child (priv->view_stack, view);
 
   check_reload_project (window, project);
 }
@@ -1374,7 +1378,7 @@ close_project (GladeWindow *window, GladeProject *project)
                         g_object_get_data (G_OBJECT (view), "glade-window-view-inspector"));
 
   /* then the main view */
-  gtk_container_remove (GTK_CONTAINER (priv->stack), GTK_WIDGET (view));
+  gtk_container_remove (GTK_CONTAINER (priv->view_stack), GTK_WIDGET (view));
 
   clean_actions (window);
 
@@ -1395,7 +1399,7 @@ close_project (GladeWindow *window, GladeProject *project)
     gtk_action_group_set_sensitive (priv->project_actiongroup, FALSE);
 
   if (!glade_app_get_projects ())
-    gtk_widget_hide (priv->center_paned);
+    gtk_stack_set_visible_child (priv->stack, priv->start_page);
 
   if (GLADE_WINDOW_ACTIVE_VIEW (window) == NULL)
     gtk_widget_hide (GTK_WIDGET (priv->editor));
@@ -1490,11 +1494,11 @@ stack_visible_child_next_prev (GladeWindow *window, gboolean next)
   if (!(view = GLADE_WINDOW_ACTIVE_VIEW (window)))
     return;
 
-  children = gtk_container_get_children (GTK_CONTAINER (window->priv->stack));
+  children = gtk_container_get_children (GTK_CONTAINER (window->priv->view_stack));
 
   if ((node = g_list_find (children, view)) && 
       ((next && node->next) || (!next && node->prev)))
-    gtk_stack_set_visible_child (window->priv->stack, 
+    gtk_stack_set_visible_child (window->priv->view_stack,
                                  (next) ? node->next->data : node->prev->data);
 
   g_list_free (children);
@@ -1865,7 +1869,7 @@ add_project (GladeWindow *window, GladeProject *project, gboolean for_file)
   /* Create a new view for project */
   view = glade_design_view_new (project);
 
-  gtk_widget_show (priv->center_paned);
+  gtk_stack_set_visible_child (priv->stack, priv->center_paned);
   gtk_widget_show (GTK_WIDGET (priv->editor));
 
   g_signal_connect (G_OBJECT (project), "notify::modified",
@@ -1905,9 +1909,9 @@ add_project (GladeWindow *window, GladeProject *project, gboolean for_file)
 
 
   /* Add view to stack */
-  gtk_container_add (GTK_CONTAINER (priv->stack), view);
+  gtk_container_add (GTK_CONTAINER (priv->view_stack), view);
   gtk_widget_show (view);
-  gtk_stack_set_visible_child (priv->stack, view);
+  gtk_stack_set_visible_child (priv->view_stack, view);
 
   refresh_stack_title_for_project (window, project);
 }
@@ -2382,10 +2386,16 @@ glade_window_constructed (GObject *object)
 {
   GladeWindow *window = GLADE_WINDOW (object);
   GladeWindowPrivate *priv = window->priv;
+  gchar *version;
 
   /* Chain up... */
   G_OBJECT_CLASS (glade_window_parent_class)->constructed (object);
 
+  /* Init Glade version */
+  version = g_strdup_printf ("Version %d.%d.%d", GLADE_MAJOR_VERSION, GLADE_MINOR_VERSION, 
GLADE_MICRO_VERSION);
+  gtk_label_set_text (priv->version_label, version);
+  g_free (version);
+
   /* recent files */
   priv->recent_manager = gtk_recent_manager_get_default ();
   
@@ -2487,10 +2497,13 @@ glade_window_class_init (GladeWindowClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, subtitle);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, project_button);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, about_dialog);
+  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, start_page);
+  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, version_label);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, center_paned);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, left_paned);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, open_button_box);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, stack);
+  gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, view_stack);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, inspectors_stack);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, editor);
   gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, statusbar);
diff --git a/src/glade-window.css b/src/glade-window.css
index 0f49943..feae384 100644
--- a/src/glade-window.css
+++ b/src/glade-window.css
@@ -60,3 +60,31 @@ GladeDesignView * {
   margin: 0;
   padding: 0;
 }
+
+@keyframes brand-highlight {
+  from { -gtk-icon-shadow: 2px -1px 4px alpha(@warning_color, 0); }
+  to   { -gtk-icon-shadow: 2px -1px 4px alpha(@warning_color, 0.8); }
+}
+
+#glade-brand-image {
+  padding-top: 40px;
+  animation: brand-highlight 2s infinite alternate;
+}
+
+#glade-brand-image:backdrop {
+  animation: none;
+}
+
+#glade-label {
+  font-size: 64px;
+  font-weight: bold;
+  text-shadow: 2px 2px 2px gray;
+}
+
+#version-label {
+  font-size: 18px;
+  font-weight: bold;
+  text-shadow: 1px 1px 2px gray;
+  padding-bottom: 120px;
+}
+
diff --git a/src/glade.glade b/src/glade.glade
index 40fb9fd..d9772dd 100644
--- a/src/glade.glade
+++ b/src/glade.glade
@@ -97,6 +97,7 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
   </object>
   <object class="GtkAccelGroup" id="accelgroup"/>
   <object class="GtkActionGroup" id="pointer_mode_actiongroup">
+    <property name="sensitive">False</property>
     <property name="accel_group">accelgroup</property>
     <child>
       <object class="GtkRadioAction" id="selector_radioaction">
@@ -144,6 +145,7 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
   </object>
   <object class="GtkActionGroup" id="project_actiongroup">
     <property name="name">project_actiongroup</property>
+    <property name="sensitive">False</property>
     <property name="accel_group">accelgroup</property>
     <signal name="connect-proxy" handler="on_actiongroup_connect_proxy" swapped="no"/>
     <signal name="disconnect-proxy" handler="on_actiongroup_disconnect_proxy" swapped="no"/>
@@ -271,6 +273,7 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
     <signal name="disconnect-proxy" handler="on_actiongroup_disconnect_proxy" swapped="no"/>
     <child>
       <object class="GtkAction" id="new_action">
+        <property name="label" translatable="yes">New</property>
         <property name="tooltip" translatable="yes">Create a new project</property>
         <property name="icon_name">document-new</property>
         <signal name="activate" handler="glade_window_new_project" swapped="yes"/>
@@ -416,109 +419,245 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
   <template class="GladeWindow" parent="GtkWindow">
     <property name="can_focus">False</property>
     <child>
-      <object class="GtkPaned" id="center_paned">
-        <property name="height_request">380</property>
+      <object class="GtkStack" id="stack">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="position_set">True</property>
-        <property name="wide_handle">True</property>
+        <property name="can_focus">False</property>
         <child>
-          <object class="GtkPaned" id="left_paned">
+          <object class="GtkBox" id="start_page">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">center</property>
+            <property name="valign">center</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkImage">
+                <property name="name">glade-brand-image</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="pixel_size">250</property>
+                <property name="icon_name">glade-brand-symbolic</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="name">glade-label</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Glade</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="version_label">
+                <property name="name">version-label</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="width_chars">32</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="name">page0</property>
+            <property name="title" translatable="yes">page0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkPaned" id="center_paned">
+            <property name="height_request">380</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="position">150</property>
             <property name="position_set">True</property>
             <property name="wide_handle">True</property>
             <child>
-              <object class="GtkBox">
+              <object class="GtkPaned" id="left_paned">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <object class="GtkStack" id="inspectors_stack">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="margin_left">3</property>
-                    <property name="margin_right">3</property>
-                    <property name="margin_bottom">3</property>
-                    <property name="transition_duration">128</property>
-                    <property name="transition_type">crossfade</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="position">150</property>
+                <property name="position_set">True</property>
+                <property name="wide_handle">True</property>
                 <child>
-                  <object class="GtkToolbar" id="toolbar">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkToggleToolButton" id="selector_button">
-                        <property name="use_action_appearance">True</property>
-                        <property name="related_action">selector_radioaction</property>
+                      <object class="GtkStack" id="inspectors_stack">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label">radiotoolbutton1</property>
-                        <property name="use_underline">True</property>
-                        <property name="active">True</property>
+                        <property name="margin_left">3</property>
+                        <property name="margin_right">3</property>
+                        <property name="margin_bottom">3</property>
+                        <property name="transition_duration">128</property>
+                        <property name="transition_type">crossfade</property>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleToolButton" id="drag_resize_button">
-                        <property name="use_action_appearance">True</property>
-                        <property name="related_action">drag_resize_radioaction</property>
+                      <object class="GtkToolbar" id="toolbar">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label">radiotoolbutton2</property>
-                        <property name="use_underline">True</property>
+                        <child>
+                          <object class="GtkToggleToolButton" id="selector_button">
+                            <property name="use_action_appearance">True</property>
+                            <property name="related_action">selector_radioaction</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">radiotoolbutton1</property>
+                            <property name="use_underline">True</property>
+                            <property name="active">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkToggleToolButton" id="drag_resize_button">
+                            <property name="use_action_appearance">True</property>
+                            <property name="related_action">drag_resize_radioaction</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">radiotoolbutton2</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkToggleToolButton" id="margin_edit_button">
+                            <property name="use_action_appearance">True</property>
+                            <property name="related_action">margin_edit_radioaction</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">radiotoolbutton3</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkToggleToolButton" id="align_edit_button">
+                            <property name="use_action_appearance">True</property>
+                            <property name="related_action">align_edit_radioaction</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">radiotoolbutton4</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">True</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="resize">False</property>
+                    <property name="shrink">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkOverlay">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkToggleToolButton" id="margin_edit_button">
-                        <property name="use_action_appearance">True</property>
-                        <property name="related_action">margin_edit_radioaction</property>
+                      <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label">radiotoolbutton3</property>
-                        <property name="use_underline">True</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GladeAdaptorChooser" id="adaptor_chooser">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="border_width">2</property>
+                            <property name="spacing">4</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSeparator">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkStack" id="view_stack">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="transition_duration">128</property>
+                            <property name="transition_type">crossfade</property>
+                            <signal name="notify::visible-child" handler="on_stack_visible_child_notify" 
swapped="no"/>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
+                        <property name="index">-1</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkToggleToolButton" id="align_edit_button">
-                        <property name="use_action_appearance">True</property>
-                        <property name="related_action">align_edit_radioaction</property>
+                    <child type="overlay">
+                      <object class="GtkStatusbar" id="statusbar">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label">radiotoolbutton4</property>
-                        <property name="use_underline">True</property>
+                        <property name="valign">end</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">2</property>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="homogeneous">True</property>
+                        <property name="pass_through">True</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="resize">True</property>
+                    <property name="shrink">False</property>
                   </packing>
                 </child>
               </object>
@@ -528,95 +667,26 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
               </packing>
             </child>
             <child>
-              <object class="GtkOverlay">
+              <object class="GladeEditor" id="editor">
+                <property name="width_request">256</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="show_class_field">False</property>
+                <property name="show_boder">False</property>
                 <child>
-                  <object class="GtkBox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <object class="GladeAdaptorChooser" id="adaptor_chooser">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="border_width">2</property>
-                        <property name="spacing">4</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkSeparator">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkStack" id="stack">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="transition_duration">128</property>
-                        <property name="transition_type">crossfade</property>
-                        <signal name="notify::visible-child" handler="on_stack_visible_child_notify" 
swapped="no"/>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="index">-1</property>
-                  </packing>
-                </child>
-                <child type="overlay">
-                  <object class="GtkStatusbar" id="statusbar">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="valign">end</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">2</property>
-                  </object>
-                  <packing>
-                    <property name="pass_through">True</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
-                <property name="resize">True</property>
+                <property name="resize">False</property>
                 <property name="shrink">False</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="resize">False</property>
-            <property name="shrink">False</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GladeEditor" id="editor">
-            <property name="width_request">256</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="show_class_field">False</property>
-            <property name="show_boder">False</property>
-          </object>
-          <packing>
-            <property name="resize">False</property>
-            <property name="shrink">False</property>
+            <property name="name">page1</property>
+            <property name="title" translatable="yes">page1</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
@@ -996,7 +1066,7 @@ Andreas Nilsson &lt;andreas andreasn se&gt;</property>
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
-            <property name="stack">stack</property>
+            <property name="stack">view_stack</property>
           </object>
           <packing>
             <property name="expand">False</property>


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