[cheese/wip/tidying] Convert some GtkGrid widgets to GtkBox



commit 3d7c8d0a55f2e2e46f4ecfaba9ae2ccd3b1804ee
Author: David King <amigadave amigadave com>
Date:   Fri Nov 8 21:36:57 2013 +0000

    Convert some GtkGrid widgets to GtkBox

 data/cheese-main-window.ui |   45 +++++++++--------------------------------
 src/cheese-window.vala     |   47 ++++++++++++++++++++++---------------------
 2 files changed, 34 insertions(+), 58 deletions(-)
---
diff --git a/data/cheese-main-window.ui b/data/cheese-main-window.ui
index 443e068..7796a5d 100644
--- a/data/cheese-main-window.ui
+++ b/data/cheese-main-window.ui
@@ -1,16 +1,17 @@
 <?xml version="1.0"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
-  <object class="GtkGrid" id="mainbox_normal">
+  <requires lib="gtk+" version="3.6"/>
+  <object class="GtkBox" id="mainbox_normal">
     <property name="orientation">vertical</property>
     <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
     <child>
-      <object class="GtkGrid" id="content_area">
+      <object class="GtkBox" id="content_area">
         <property name="vexpand">True</property>
         <property name="hexpand">True</property>
         <property name="orientation">horizontal</property>
         <child>
-          <object class="GtkGrid" id="view_area">
+          <object class="GtkBox" id="view_area">
+            <property name="orientation">vertical</property>
             <child>
               <object class="GtkClutterEmbed" id="viewport">
                 <property name="vexpand">True</property>
@@ -19,12 +20,6 @@
                 <property name="height_request">450</property>
                 <property name="width_request">600</property>
               </object>
-              <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkAlignment" id="action_area_alignment">
@@ -34,7 +29,7 @@
                 <property name="margin-bottom">6</property>
                 <property name="margin-top">6</property>
                 <child>
-                  <object class="GtkGrid" id="buttons_area">
+                  <object class="GtkBox" id="buttons_area">
                     <property name="orientation">horizontal</property>
                     <child>
                       <object class="GtkBox" id="mode_toggle_buttons">
@@ -90,9 +85,8 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkGrid" id="effects_actions_pack">
+                      <object class="GtkBox" id="effects_actions_pack">
                         <property name="orientation">horizontal</property>
-                        <property name="column-spacing">0</property>
                         <child>
                           <object class="GtkButton" id="effects_prev_page_button">
                             <property name="action-name">win.effects-previous</property>
@@ -113,10 +107,10 @@
                             <property name="action-name">app.effects</property>
                             <property name="tooltip_text" translatable="yes">Effects</property>
                             <child>
-                              <object class="GtkGrid" id="effects_toggle_button_internal_hbox">
+                              <object class="GtkBox" id="effects_toggle_button_internal_hbox">
                                 <property name="orientation">horizontal</property>
+                                <property name="spacing">2</property>
                                 <property name="visible">True</property>
-                                <property name="column-spacing">2</property>
                                 <child>
                                   <object class="GtkLabel" id="effects_toggle_button_internal_label">
                                     <property name="label" translatable="yes">_Effects</property>
@@ -144,7 +138,7 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkGrid" id="leave_fullscreen_button_bin">
+                      <object class="GtkBox" id="leave_fullscreen_button_bin">
                         <property name="orientation">horizontal</property>
                         <property name="visible">False</property>
                         <property name="no-show-all">True</property>
@@ -166,12 +160,6 @@
                   </object>
                 </child>
               </object>
-      <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-      </packing>
             </child>
           </object>
         </child>
@@ -185,13 +173,6 @@
           </object>
         </child>
       </object>
-
-      <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-      </packing>
     </child>
     <child>
       <object class="GtkAlignment" id="thumbnails_bottom">
@@ -201,12 +182,6 @@
           <placeholder/>
         </child>
       </object>
-      <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
-      </packing>
     </child>
   </object>
   <object class="GtkSizeGroup" id="button_sizegroup">
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 8b528a5..319ac54 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -51,12 +51,12 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
 
   private Gtk.Widget       thumbnails;
   private GtkClutter.Embed viewport_widget;
-  private Gtk.Grid          main_vbox;
+  private Gtk.Widget main_vbox;
   private Eog.ThumbNav     thumb_nav;
   private Cheese.ThumbView thumb_view;
   private Gtk.Alignment    thumbnails_right;
   private Gtk.Alignment    thumbnails_bottom;
-  private Gtk.Grid leave_fullscreen_button_container;
+    private Gtk.Widget leave_fullscreen_button_container;
   private Gtk.ToggleButton photo_toggle_button;
   private Gtk.ToggleButton video_toggle_button;
   private Gtk.ToggleButton burst_toggle_button;
@@ -65,7 +65,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
   private Gtk.Image        take_action_button_image;
   private Gtk.ToggleButton effects_toggle_button;
   private Gtk.Button       leave_fullscreen_button;
-  private Gtk.Grid buttons_area;
+    private Gtk.Widget buttons_area;
   private Gtk.Menu         thumbnail_popup;
 
   private Clutter.Stage     viewport;
@@ -476,23 +476,24 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
                                             return true; });
   }
 
-  /**
-   * Show the UI in fullscreen if there is any mouse activity.
-   *
-   * Start a new timeout at the end of every mouse pointer movement. All
-   * timeouts will be cancelled, except one created during the last movement
-   * event. Show() is called even if the button is not hidden.
-   *
-   * @param viewport the widget to check for mouse activity on
-   * @param e the (unused) event
-   */
-  private bool fullscreen_motion_notify_callback (Gtk.Widget viewport, EventMotion e)
-  {
-    clear_fullscreen_timeout ();
-    buttons_area.show ();
-    set_fullscreen_timeout ();
-    return true;
-  }
+    /**
+     * Show the UI in fullscreen if there is any mouse activity.
+     *
+     * Start a new timeout at the end of every mouse pointer movement. All
+     * timeouts will be cancelled, except one created during the last movement
+     * event. Show() is called even if the button is not hidden.
+     *
+     * @param viewport the widget to check for mouse activity on
+     * @param e the (unused) event
+     */
+    private bool fullscreen_motion_notify_callback (Gtk.Widget viewport,
+                                                    EventMotion e)
+    {
+        clear_fullscreen_timeout ();
+        buttons_area.show ();
+        set_fullscreen_timeout ();
+        return true;
+    }
 
   /**
    * Enable or disable fullscreen mode to the requested state.
@@ -1193,13 +1194,13 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
       error ("Error: %s", err.message);
     }
 
-    main_vbox                         = gtk_builder.get_object ("mainbox_normal") as Gtk.Grid;
+        main_vbox = gtk_builder.get_object ("mainbox_normal") as Gtk.Widget;
     thumbnails                        = gtk_builder.get_object ("thumbnails") as Gtk.Widget;
     viewport_widget                   = gtk_builder.get_object ("viewport") as GtkClutter.Embed;
     viewport                          = viewport_widget.get_stage () as Clutter.Stage;
     thumbnails_right                  = gtk_builder.get_object ("thumbnails_right") as Gtk.Alignment;
     thumbnails_bottom                 = gtk_builder.get_object ("thumbnails_bottom") as Gtk.Alignment;
-    leave_fullscreen_button_container = gtk_builder.get_object ("leave_fullscreen_button_bin") as Gtk.Grid;
+    leave_fullscreen_button_container = gtk_builder.get_object ("leave_fullscreen_button_bin") as Gtk.Widget;
     photo_toggle_button               = gtk_builder.get_object ("photo_toggle_button") as Gtk.ToggleButton;
     video_toggle_button               = gtk_builder.get_object ("video_toggle_button") as Gtk.ToggleButton;
     burst_toggle_button               = gtk_builder.get_object ("burst_toggle_button") as Gtk.ToggleButton;
@@ -1208,7 +1209,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     take_action_button_image          = gtk_builder.get_object ("take_action_button_internal_image") as 
Gtk.Image;
     effects_toggle_button             = gtk_builder.get_object ("effects_toggle_button") as Gtk.ToggleButton;
     leave_fullscreen_button           = gtk_builder.get_object ("leave_fullscreen_button") as Gtk.Button;
-    buttons_area = gtk_builder.get_object ("buttons_area") as Gtk.Grid;
+        buttons_area = gtk_builder.get_object ("buttons_area") as Gtk.Widget;
 
     countdown_action         = gtk_builder.get_object ("countdown") as Gtk.Action;
 


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