[gitg/wip/sindhus/interactive-rebase] Add GtkSource.View widget to rebase commit editor window



commit c9e2e37e3f9165c5b343677a11a3e08d1b6f665d
Author: Sindhu S <sindhus live in>
Date:   Wed Sep 11 17:56:27 2013 +0530

    Add GtkSource.View widget to rebase commit editor window

 gitg/gitg-application.vala                 |    2 +-
 gitg/gitg-rebase-commit-editor-window.vala |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index a154a74..8bd2a80 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -180,7 +180,7 @@ public class Application : Gtk.Application
                {
 
                        var rebase_commit_editor_window = new RebaseCommitEditorWindow();
-//                     rebase_window.load_rebase_todo(Options.rebase);
+                       rebase_commit_editor_window.load_commit_file(Options.rebase_commit_editor);
                        rebase_commit_editor_window.show_all();
                        Gtk.main();
                        return 0;
diff --git a/gitg/gitg-rebase-commit-editor-window.vala b/gitg/gitg-rebase-commit-editor-window.vala
index f6d1d2f..ae0e586 100644
--- a/gitg/gitg-rebase-commit-editor-window.vala
+++ b/gitg/gitg-rebase-commit-editor-window.vala
@@ -21,9 +21,28 @@ namespace Gitg
 {
        public class RebaseCommitEditorWindow : Gtk.Window
        {
+               private GtkSource.View r_commit_editor;
+
                public RebaseCommitEditorWindow()
                {
                        this.title = "Rebase Commit Editor";
+                       destroy.connect (Gtk.main_quit);
+                       r_commit_editor = new GtkSource.View();
+                       var hbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 1);
+                       hbox.homogeneous = true;
+                       hbox.add (r_commit_editor);
+                       add (hbox);
+               }
+
+               public void load_commit_file(string filename)
+               {
+                       string contents = "";
+                       try
+                       {
+                               FileUtils.get_contents(filename, out contents);
+                       }
+                       catch {}
+                       r_commit_editor.buffer.set_text(contents);
                }
        }
 


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