[gitg/wip/sindhus/interactive-rebase] Show rebase result



commit 2f90c2c8aa63ada7d1ad083cfbdc5046cb53dda6
Author: Sindhu S <sindhus live in>
Date:   Wed Sep 11 20:49:29 2013 +0530

    Show rebase result

 gitg/gitg-rebase-controller.vala    |   48 ++++++++++++++++++++++++-----------
 gitg/gitg-rebase-result-dialog.vala |    2 +-
 2 files changed, 34 insertions(+), 16 deletions(-)
---
diff --git a/gitg/gitg-rebase-controller.vala b/gitg/gitg-rebase-controller.vala
index c13c00e..13016b8 100644
--- a/gitg/gitg-rebase-controller.vala
+++ b/gitg/gitg-rebase-controller.vala
@@ -21,28 +21,32 @@ namespace Gitg
 {
        public class RebaseController
        {
+               private string output;
                public RebaseController()
-               {}
+               {
+                       output = "";
+               }
 
-               private static bool process_line (IOChannel channel, IOCondition condition, string 
stream_name) {
+               private static string process_line (IOChannel channel, IOCondition condition, string 
stream_name)
+               {
+                       string output = "";
                        if (condition == IOCondition.HUP) {
-                               stdout.printf ("%s: The fd has been closed.\n", stream_name);
-                               return false;
+                               output += "%s: The fd has been closed.\n".printf(stream_name);
+                               return output;
                        }
 
                        try {
                                string line;
                                channel.read_line (out line, null, null);
-                               stdout.printf ("%s: %s", stream_name, line);
+                               output += "%s: %s".printf(stream_name, line);
                        } catch (IOChannelError e) {
-                               stdout.printf ("%s: IOChannelError: %s\n", stream_name, e.message);
-                               return false;
+                               output += "%s: IOChannelError: %s\n".printf(stream_name, e.message);
+                               return output;
                        } catch (ConvertError e) {
-                               stdout.printf ("%s: ConvertError: %s\n", stream_name, e.message);
-                               return false;
+                               output += "%s: ConvertError: %s\n".printf(stream_name, e.message);
+                               return output;
                        }
-
-                       return true;
+                       return output;
                }
 
                public void start_rebase(Gtk.Window parent, Gitg.Repository repository)
@@ -80,15 +84,29 @@ namespace Gitg
                        );
 
 // stdout:
-               IOChannel output = new IOChannel.unix_new (standard_output);
-               output.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
-                       return process_line (channel, condition, "stdout");
+               IOChannel iooutput = new IOChannel.unix_new (standard_output);
+               iooutput.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
+                       string line = "";
+                       line = process_line (channel, condition, "stdout");
+                       output += line;
+                       return line != ""; 
                });
 
                // stderr:
                IOChannel error = new IOChannel.unix_new (standard_error);
                error.add_watch (IOCondition.IN | IOCondition.HUP, (channel, condition) => {
-                       return process_line (channel, condition, "stderr");
+                       string line = "";
+                       line = process_line (channel, condition, "stderr");
+                       output +=line;
+                       return line != "";
+               });
+
+               ChildWatch.add (child_pid, (pid, status) => {
+                       // Triggered when the child indicated by child_pid exits
+                       Process.close_pid (pid);
+                       var rebase_result_dialog = new RebaseResultDialog();
+                       rebase_result_dialog.set_rebase_output(output);
+                       rebase_result_dialog.show();
                });
 
                }
diff --git a/gitg/gitg-rebase-result-dialog.vala b/gitg/gitg-rebase-result-dialog.vala
index 510a679..7abd501 100644
--- a/gitg/gitg-rebase-result-dialog.vala
+++ b/gitg/gitg-rebase-result-dialog.vala
@@ -34,7 +34,7 @@ namespace Gitg
                        ok_button.label = "Return to gitg";
                        ok_button.clicked.connect(return_to_gitg);
                        hbox.add(ok_button);
-                       add (hbox)
+                       add (hbox);
                }
 
                public void set_rebase_output(string output)


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