[gitg] Use a revealer for the infobar



commit b8fa527842bb7c53b0140577a33281a5b9ed3d30
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jul 5 09:01:30 2013 +0200

    Use a revealer for the infobar

 gitg/gitg-window.vala            |   24 ++++----
 gitg/resources/ui/gitg-window.ui |  117 ++++++++++++++++++++------------------
 2 files changed, 74 insertions(+), 67 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index f764099..eb18d6a 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -64,13 +64,15 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
        private Gtk.Stack d_stack_activities;
 
        [GtkChild]
-       private Gtk.InfoBar infobar;
+       private Gtk.Revealer d_infobar_revealer;
        [GtkChild]
-       private Gtk.Label infobar_primary_label;
+       private Gtk.InfoBar d_infobar;
        [GtkChild]
-       private Gtk.Label infobar_secondary_label;
+       private Gtk.Label d_infobar_primary_label;
        [GtkChild]
-       private Gtk.Button infobar_close_button;
+       private Gtk.Label d_infobar_secondary_label;
+       [GtkChild]
+       private Gtk.Button d_infobar_close_button;
 
        private static const ActionEntry[] win_entries = {
                {"search", on_search_activated, null, "false", null},
@@ -212,7 +214,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                                }
 
                                title = @"$(d_repository.name) ($parent_path) - gitg";
-                               infobar.hide();
+                               d_infobar_revealer.set_reveal_child(false);
                        }
 
                        d_header_bar.set_title(d_repository.name);
@@ -670,13 +672,13 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
 
        private void show_infobar(string primary_msg, string secondary_msg, Gtk.MessageType type)
        {
-               infobar.message_type = type;
-               infobar_primary_label.set_label("<b>%s</b>".printf(Markup.escape_text(primary_msg)));
-               
infobar_secondary_label.set_label("<small>%s</small>".printf(Markup.escape_text(secondary_msg)));
-               infobar.show();
+               d_infobar.message_type = type;
+               d_infobar_primary_label.set_label("<b>%s</b>".printf(Markup.escape_text(primary_msg)));
+               
d_infobar_secondary_label.set_label("<small>%s</small>".printf(Markup.escape_text(secondary_msg)));
+               d_infobar_revealer.set_reveal_child(true);
 
-               infobar_close_button.clicked.connect(() => {
-                       infobar.hide();
+               d_infobar_close_button.clicked.connect(() => {
+                       d_infobar_revealer.set_reveal_child(false);
                });
        }
 }
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index 1bd789e..bad83c9 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -122,64 +122,69 @@
       <object class="GtkGrid" id="grid1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-         <child>
-          <object class="GtkInfoBar" id="infobar">
-             <property name="visible">False</property>
-             <child internal-child="content_area">
-               <object class="GtkBox" id="infobar_content_area">
-                 <property name="visible">True</property>
-                 <property name="can_focus">False</property>
-                 <property name="border_width">8</property>
-                 <property name="orientation">vertical</property>
-                 <property name="spacing">16</property>
-                 <child>
-                   <object class="GtkLabel" id="infobar_primary_label">
-                     <property name="visible">True</property>
-                     <property name="can_focus">True</property>
-                     <property name="selectable">True</property>
-                     <property name="use-markup">True</property>
-                     <property name="halign">GTK_ALIGN_START</property>
-                   </object>
-                   <packing>
-                     <property name="expand">False</property>
-                     <property name="fill">True</property>
-                     <property name="position">0</property>
-                   </packing>
-                 </child>
-                 <child>
-                   <object class="GtkLabel" id="infobar_secondary_label">
-                     <property name="visible">True</property>
-                     <property name="can_focus">True</property>
-                     <property name="selectable">True</property>
-                     <property name="use-markup">True</property>
-                     <property name="halign">GTK_ALIGN_START</property>
-                   </object>
-                   <packing>
-                     <property name="expand">False</property>
-                     <property name="fill">True</property>
-                     <property name="position">1</property>
-                   </packing>
-                 </child>
-                 <child internal-child="action_area">
-                   <object class="GtkButtonBox" id="infobar_action_area">
-                     <property name="visible">True</property>
-                     <property name="can_focus">False</property>
-                     <property name="border_width">5</property>
-                     <property name="orientation">vertical</property>
-                     <property name="spacing">6</property>
-                     <property name="layout_style">end</property>
-                 <child>
-                   <object class="GtkButton" id="infobar_close_button">
-                     <property name="visible">True</property>
-                     <property name="label" translatable="yes">Close</property>
-                    </object>
-                 </child>
-                   </object>
-                 </child>
-               </object>
+        <child>
+          <object class="GtkRevealer" id="d_infobar_revealer">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkInfoBar" id="d_infobar">
+                <property name="visible">True</property>
+                <child internal-child="content_area">
+                  <object class="GtkBox" id="infobar_content_area">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">8</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">16</property>
+                    <child>
+                      <object class="GtkLabel" id="d_infobar_primary_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="selectable">True</property>
+                        <property name="use-markup">True</property>
+                        <property name="halign">GTK_ALIGN_START</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="d_infobar_secondary_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="selectable">True</property>
+                        <property name="use-markup">True</property>
+                        <property name="halign">GTK_ALIGN_START</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child internal-child="action_area">
+                      <object class="GtkButtonBox" id="infobar_action_area">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="border_width">5</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <property name="layout_style">end</property>
+                        <child>
+                          <object class="GtkButton" id="d_infobar_close_button">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Close</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
             </child>
           </object>
-         </child>
+        </child>
         <child>
           <object class="GtkSearchBar" id="d_search_bar">
             <property name="visible">True</property>


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