[valencia/wip/gedit-3.12] GeditPanel -> GtkStack



commit 7429f71abbb145224a33476ab51344c708924cb6
Author: Jim Nelson <jim yorba org>
Date:   Tue Feb 18 12:14:49 2014 -0800

    GeditPanel -> GtkStack

 browser.vala  |   20 ++++++++++----------
 valencia.vala |   29 +++++++++++++----------------
 2 files changed, 23 insertions(+), 26 deletions(-)
---
diff --git a/browser.vala b/browser.vala
index b3efd9e..cd169d9 100644
--- a/browser.vala
+++ b/browser.vala
@@ -35,28 +35,28 @@ class SymbolBrowser : Object {
     }
     
     public void activate() {
-        weak Gedit.Panel panel = instance.window.get_side_panel();
-        panel.add_item_with_stock_icon(symbol_vbox, "symbols", "Symbols", Gtk.Stock.FIND);
+        unowned Gtk.Stack stack = (Gtk.Stack) instance.window.get_side_panel();
+        stack.add_titled(symbol_vbox, "symbols", "Symbols");
         symbol_vbox.show_all();
         
-        panel.show.connect(on_panel_open);
-        panel.hide.connect(on_panel_hide);
+        stack.show.connect(on_stack_open);
+        stack.hide.connect(on_stack_hide);
     }
     
     public void deactivate() {
-        instance.window.get_side_panel().remove_item(symbol_vbox);
+        ((Gtk.Stack) instance.window.get_side_panel()).remove(symbol_vbox);
     }
     
     void on_text_changed() {
         on_update_symbols();
     }
 
-    void on_panel_open() {
+    void on_stack_open() {
         visible = true;
         on_receive_focus();
     }
     
-    void on_panel_hide() {
+    void on_stack_hide() {
         visible = false;
     }
 
@@ -165,10 +165,10 @@ class SymbolBrowser : Object {
     }
 
     public void set_parent_instance_focus() {
-        Gedit.Panel panel = instance.window.get_side_panel();
-        panel.show();
+        Gtk.Stack stack = (Gtk.Stack) instance.window.get_side_panel();
+        stack.show();
         
-        panel.activate_item(symbol_vbox);
+        stack.set_visible_child(symbol_vbox);
         instance.window.set_focus(find_entry);
     }
 
diff --git a/valencia.vala b/valencia.vala
index 18c8c96..8bb8240 100644
--- a/valencia.vala
+++ b/valencia.vala
@@ -267,8 +267,8 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
         output_pane.add(output_view);
         output_pane.show_all();
 
-        Gedit.Panel panel = window.get_bottom_panel();
-        panel.add_item_with_stock_icon(output_pane, "build", "Build", Gtk.Stock.CONVERT);
+        Gtk.Stack stack = (Gtk.Stack) window.get_bottom_panel();
+        stack.add_titled(output_pane, "build", "Build");
 
         // Run pane
         run_terminal = new Vte.Terminal();
@@ -280,7 +280,7 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
         run_pane.add(run_terminal);
         run_pane.show_all();
         
-        panel.add_item_with_stock_icon(run_pane, "run", "Run", Gtk.Stock.EXECUTE);     
+        stack.add_titled(run_pane, "run", "Run");
 
         // Symbol pane
         symbol_browser = new SymbolBrowser(this);
@@ -642,9 +642,9 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
     
     void show_output_pane() {
         output_pane.show();
-        Gedit.Panel panel = window.get_bottom_panel();
-        panel.activate_item(output_pane);
-        panel.show();
+        Gtk.Stack stack = (Gtk.Stack) window.get_bottom_panel();
+        stack.set_visible_child(output_pane);
+        stack.show();
     }
     
     void spawn_process(string command, string working_directory, ProcessFinished callback) {
@@ -663,10 +663,7 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
         on_process_finshed = callback;
         output_buffer.set_text("", 0);
         
-        output_pane.show();
-        Gedit.Panel panel = window.get_bottom_panel();
-        panel.activate_item(output_pane);
-        panel.show();
+        show_output_pane();
         
         Pid child_pid;
         int input_fd;
@@ -1273,9 +1270,9 @@ public class Instance : Peas.ExtensionBase, Gedit.WindowActivatable {
 
         run_terminal.reset(true, true);
         run_pane.show();
-        Gedit.Panel panel = window.get_bottom_panel();
-        panel.activate_item(run_pane);
-        panel.show();
+        Gtk.Stack stack = (Gtk.Stack) window.get_bottom_panel();
+        stack.set_visible_child(run_pane);
+        stack.show();
         
         child_process_running = true;
     }
@@ -1579,9 +1576,9 @@ void on_clean() {
         manager.remove_ui(ui_id);
         manager.remove_action_group(action_group);
 
-        Gedit.Panel panel = window.get_bottom_panel();
-        panel.remove_item(output_pane);
-        panel.remove_item(run_pane);
+        Gtk.Stack stack = (Gtk.Stack) window.get_bottom_panel();
+        stack.remove(output_pane);
+        stack.remove(run_pane);
         
         symbol_browser.deactivate();
         


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