[meld] vcview: Update the console-box UI to a View menu item and little else



commit f9a5bf5d84946d110879861650057754341bfe05
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Feb 8 07:40:28 2014 +1000

    vcview: Update the console-box UI to a View menu item and little else

 data/meld.css                   |    6 +++
 data/org.gnome.meld.gschema.xml |    5 ++
 data/ui/meldapp-ui.xml          |    1 +
 data/ui/vcview-ui.xml           |    3 +
 data/ui/vcview.ui               |   82 +++++++-------------------------------
 meld/vcview.py                  |   23 ++++-------
 6 files changed, 38 insertions(+), 82 deletions(-)
---
diff --git a/data/meld.css b/data/meld.css
index 5bbcbb7..401b886 100644
--- a/data/meld.css
+++ b/data/meld.css
@@ -36,3 +36,9 @@ LinkMap {
     border-style: solid;
     border-color: @borders;
 }
+
+.meld-vc-console-pane {
+    border-width: 1px 0 1px 0;
+    border-style: solid;
+    border-color: @borders;
+}
diff --git a/data/org.gnome.meld.gschema.xml b/data/org.gnome.meld.gschema.xml
index 517cb5e..ae4a415 100644
--- a/data/org.gnome.meld.gschema.xml
+++ b/data/org.gnome.meld.gschema.xml
@@ -153,6 +153,11 @@
           <summary>Show the version control console output</summary>
           <description>If true, a console output section will be shown in version control views, showing the 
commands run for version control operations.</description>
       </key>
+      <key name="vc-console-pane-position" type="i">
+          <default>300</default>
+          <summary>Version control pane position</summary>
+          <description>This is the height of the main version control tree when the console pane is 
shown.</description>
+      </key>
       <key name="vc-left-is-local" type="b">
           <default>false</default>
           <summary>Present version comparisons as left-local/right-remote</summary>
diff --git a/data/ui/meldapp-ui.xml b/data/ui/meldapp-ui.xml
index 436745d..43e8041 100644
--- a/data/ui/meldapp-ui.xml
+++ b/data/ui/meldapp-ui.xml
@@ -34,6 +34,7 @@
     </menu>
     <menu action="ViewMenu">
       <menuitem action="ToolbarVisible" />
+      <placeholder name="ViewBarPlaceholder" />
       <menuitem action="Fullscreen" />
       <separator/>
       <placeholder name="ViewUtilityPlaceholder" />
diff --git a/data/ui/vcview-ui.xml b/data/ui/vcview-ui.xml
index 3a860eb..3f86bc4 100644
--- a/data/ui/vcview-ui.xml
+++ b/data/ui/vcview-ui.xml
@@ -19,6 +19,9 @@
       </placeholder>
     </menu>
     <menu action="ViewMenu">
+      <placeholder name="ViewBarPlaceholder">
+        <menuitem action="VcConsoleVisible" />
+      </placeholder>
       <placeholder name="ViewPlaceholder">
         <menuitem action="VcFlatten" />
       </placeholder>
diff --git a/data/ui/vcview.ui b/data/ui/vcview.ui
index 161712b..e0cf5d3 100644
--- a/data/ui/vcview.ui
+++ b/data/ui/vcview.ui
@@ -77,6 +77,13 @@
       </object>
     </child>
     <child>
+      <object class="GtkToggleAction" id="VcConsoleVisible">
+        <property name="label" translatable="yes">Console</property>
+        <property name="tooltip" translatable="yes">Show or hide the version control console output 
pane</property>
+      </object>
+      <accelerator key="F9"/>
+    </child>
+    <child>
       <object class="GtkToggleAction" id="VcFlatten">
         <property name="label" translatable="yes">_Flatten</property>
         <property name="tooltip" translatable="yes">Flatten directories</property>
@@ -462,48 +469,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkEventBox" id="console_show_box">
-            <property name="can_focus">False</property>
-            <signal name="button-press-event" handler="on_console_view_toggle" swapped="no"/>
-            <child>
-              <object class="GtkHBox" id="hbox3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <object class="GtkArrow" id="console_arrow_right">
-                    <property name="width_request">14</property>
-                    <property name="height_request">14</property>
-                    <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">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkHSeparator" id="hseparator1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
           <object class="MsgAreaController" id="msgarea_mgr">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -515,10 +480,13 @@
           </packing>
         </child>
         <child>
-          <object class="GtkVPaned" id="vpaned">
+          <object class="GtkVPaned" id="vc_console_vpaned">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="position">250</property>
+            <style>
+              <class name="meld-vc-console-pane"/>
+            </style>
             <child>
               <object class="GtkScrolledWindow" id="scrolledwindow">
                 <property name="visible">True</property>
@@ -543,37 +511,17 @@
               </packing>
             </child>
             <child>
-              <object class="GtkHBox" id="console_hbox">
-                <property name="height_request">70</property>
+              <object class="GtkBox" id="console_vbox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkEventBox" id="console_hide_box">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <signal name="button-press-event" handler="on_console_view_toggle" swapped="no"/>
-                    <child>
-                      <object class="GtkArrow" id="console_arrow_down">
-                        <property name="width_request">14</property>
-                        <property name="height_request">14</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="yalign">0</property>
-                        <property name="arrow_type">down</property>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
+                  <placeholder/>
                 </child>
                 <child>
                   <object class="GtkScrolledWindow" id="console_scrolledwindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="shadow_type">in</property>
                     <child>
                       <object class="GtkTextView" id="consoleview">
                         <property name="visible">True</property>
@@ -601,7 +549,7 @@
             <property name="expand">True</property>
             <property name="fill">True</property>
             <property name="pack_type">end</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
       </object>
diff --git a/meld/vcview.py b/meld/vcview.py
index 2923ed1..35eba60 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -139,7 +139,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         nick="File status filters",
         blurb="Files with these statuses will be shown by the comparison.",
     )
-    console_visible = GObject.property(type=bool, default=False)
     left_is_local = GObject.property(type=bool, default=False)
 
     # Map action names to VC commands and required arguments list
@@ -232,18 +231,15 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
 
         settings.bind('vc-status-filters', self, 'status-filters',
                       Gio.SettingsBindFlags.DEFAULT)
-        settings.bind('vc-console-visible', self, 'console-visible',
-                      Gio.SettingsBindFlags.DEFAULT)
         settings.bind('vc-left-is-local', self, 'left-is-local',
                       Gio.SettingsBindFlags.DEFAULT)
-
-        self.bind_property(
-            'console-visible', self.console_hbox, 'visible',
-            GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.DEFAULT)
-        self.bind_property(
-            'console-visible', self.console_show_box, 'visible',
-            GObject.BindingFlags.SYNC_CREATE |
-            GObject.BindingFlags.INVERT_BOOLEAN)
+        settings.bind('vc-console-visible',
+                      self.actiongroup.get_action('VcConsoleVisible'),
+                      'active', Gio.SettingsBindFlags.DEFAULT)
+        settings.bind('vc-console-visible', self.console_vbox, 'visible',
+                      Gio.SettingsBindFlags.DEFAULT)
+        settings.bind('vc-console-pane-position', self.vc_console_vpaned,
+                      'position', Gio.SettingsBindFlags.DEFAULT)
 
         self.state_filters = []
         for s in self.state_actions:
@@ -624,7 +620,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
 
         returncode = next(readiter)
         if returncode:
-            self.props.console_visible = True
+            self.console_vbox.show()
 
         if refresh:
             self.refresh_partial(workdir)
@@ -780,9 +776,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                 break
         return None
 
-    def on_console_view_toggle(self, box, event=None):
-        self.props.console_visible = box != self.console_hide_box
-
     def on_consoleview_populate_popup(self, textview, menu):
         buf = textview.get_buffer()
         clear_cb = lambda *args: buf.delete(*buf.get_bounds())


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