[gitg] Add a 'on_panel_activated()' method into the panel interface



commit ad335d08b28ec8e96d7ceec337ed7f4b89c4071d
Author: Techlive Zheng <techlivezheng gmail com>
Date:   Fri May 24 00:35:43 2013 +0800

    Add a 'on_panel_activated()' method into the panel interface
    
    We have added 'on_view_activated()' method into view interface
    previously, so for consistency, we do the same for panel. Let
    the panel have a chance to do some work after activated.

 gitg/gitg-window.vala           |    6 ++++++
 libgitg-ext/gitg-ext-panel.vala |    8 ++++++++
 plugins/diff/gitg-diff.vala     |    4 ++++
 plugins/files/gitg-files.vala   |    4 ++++
 4 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index e798c8d..5af22c1 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -509,6 +509,12 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
        private void on_panel_activated(UIElements elements,
                                        GitgExt.UIElement element)
        {
+               GitgExt.Panel? panel = (GitgExt.Panel?)element;
+
+               if (panel != null)
+               {
+                       panel.on_panel_activated();
+               }
        }
 
        private void activate_default_view()
diff --git a/libgitg-ext/gitg-ext-panel.vala b/libgitg-ext/gitg-ext-panel.vala
index 8d3f312..23e857d 100644
--- a/libgitg-ext/gitg-ext-panel.vala
+++ b/libgitg-ext/gitg-ext-panel.vala
@@ -37,6 +37,14 @@ namespace GitgExt
  */
 public interface Panel : Object, UIElement
 {
+       /**
+        * Give the panel itself a chance to perform some actions after being
+        * activated.
+        *
+        * @return void
+        *
+        */
+       public abstract void on_panel_activated();
 }
 
 }
diff --git a/plugins/diff/gitg-diff.vala b/plugins/diff/gitg-diff.vala
index 88d5614..4ff19ed 100644
--- a/plugins/diff/gitg-diff.vala
+++ b/plugins/diff/gitg-diff.vala
@@ -75,6 +75,10 @@ namespace GitgDiff
                        owned get { return "diff-symbolic"; }
                }
 
+               public void on_panel_activated()
+               {
+               }
+
                private void on_selection_changed(GitgExt.ObjectSelection selection)
                {
                        selection.foreach_selected((commit) => {
diff --git a/plugins/files/gitg-files.vala b/plugins/files/gitg-files.vala
index 0505891..b787022 100644
--- a/plugins/files/gitg-files.vala
+++ b/plugins/files/gitg-files.vala
@@ -82,6 +82,10 @@ namespace GitgFiles
                        owned get { return "system-file-manager-symbolic"; }
                }
 
+               public void on_panel_activated()
+               {
+               }
+
                private void on_selection_changed(GitgExt.ObjectSelection selection)
                {
                        selection.foreach_selected((commit) => {


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