[meld] Add push confirmation dialog (bgo#699689)



commit 6e3dfa6cf25897d5b78c20bebfea96f3c38113b2
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Thu May 16 07:40:44 2013 +1000

    Add push confirmation dialog (bgo#699689)
    
    This should eventually include details of what commits are to be
    pushed in the secondary text, but for now exists purely to make the
    button less scary

 data/ui/vcview.ui |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 meld/vcview.py    |   21 ++++++++++++++++-
 2 files changed, 83 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/vcview.ui b/data/ui/vcview.ui
index 579daa2..3448050 100644
--- a/data/ui/vcview.ui
+++ b/data/ui/vcview.ui
@@ -506,4 +506,67 @@
       <action-widget response="-5">okbutton1</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkMessageDialog" id="pushdialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">question</property>
+    <property name="text" translatable="yes">Push local commits to remote?</property>
+    <property name="secondary_text" translatable="yes">The commits to be pushed are determined by your 
version control system.</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="pushbutton">
+                <property name="label" translatable="yes">_Push commits</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton</action-widget>
+      <action-widget response="-5">pushbutton</action-widget>
+    </action-widgets>
+  </object>
 </interface>
diff --git a/meld/vcview.py b/meld/vcview.py
index bed9625..63e1b3f 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -137,6 +137,25 @@ class CommitDialog(gnomeglade.Component):
             buf.set_text(model[idx][1])
 
 
+class PushDialog(gnomeglade.Component):
+
+    def __init__(self, parent):
+        gnomeglade.Component.__init__(self, paths.ui_dir("vcview.ui"),
+                                      "pushdialog")
+        self.parent = parent
+        self.widget.set_transient_for(parent.widget.get_toplevel())
+        self.widget.show_all()
+
+    def run(self):
+        # TODO: Ask the VC for a more informative label for what will happen.
+        # In git, this is probably the parsed output of push --dry-run.
+
+        response = self.widget.run()
+        if response == gtk.RESPONSE_OK:
+            self.parent.vc.push(self.parent._command)
+        self.widget.destroy()
+
+
 class ConsoleStream(object):
 
     def __init__(self, textview):
@@ -718,7 +737,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             self._command_on_selected(self.vc.update_command())
 
     def on_button_push_clicked(self, obj):
-        self.vc.push(self._command)
+        PushDialog(self).run()
 
     def on_button_commit_clicked(self, obj):
         CommitDialog(self).run()


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