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.
This commit is contained in:
Techlive Zheng 2013-05-24 00:35:43 +08:00 committed by Ignacio Casal Quinteiro
parent ed3e11efc3
commit ad335d08b2
4 changed files with 22 additions and 0 deletions

View file

@ -509,6 +509,12 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
private void on_panel_activated(UIElements elements, private void on_panel_activated(UIElements elements,
GitgExt.UIElement element) GitgExt.UIElement element)
{ {
GitgExt.Panel? panel = (GitgExt.Panel?)element;
if (panel != null)
{
panel.on_panel_activated();
}
} }
private void activate_default_view() private void activate_default_view()

View file

@ -37,6 +37,14 @@ namespace GitgExt
*/ */
public interface Panel : Object, UIElement 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();
} }
} }

View file

@ -75,6 +75,10 @@ namespace GitgDiff
owned get { return "diff-symbolic"; } owned get { return "diff-symbolic"; }
} }
public void on_panel_activated()
{
}
private void on_selection_changed(GitgExt.ObjectSelection selection) private void on_selection_changed(GitgExt.ObjectSelection selection)
{ {
selection.foreach_selected((commit) => { selection.foreach_selected((commit) => {

View file

@ -82,6 +82,10 @@ namespace GitgFiles
owned get { return "system-file-manager-symbolic"; } owned get { return "system-file-manager-symbolic"; }
} }
public void on_panel_activated()
{
}
private void on_selection_changed(GitgExt.ObjectSelection selection) private void on_selection_changed(GitgExt.ObjectSelection selection)
{ {
selection.foreach_selected((commit) => { selection.foreach_selected((commit) => {