Let GitgExtView decide where should GitgExtPanels be placed

This commit is contained in:
Techlive Zheng 2013-05-21 15:41:49 +08:00 committed by Ignacio Casal Quinteiro
parent ad335d08b2
commit ed7abdb90c
10 changed files with 128 additions and 111 deletions

View file

@ -221,12 +221,12 @@ AC_SUBST(GITG_PLUGIN_DATADIR)
GITG_PLUGIN_LIBDIR="$libdir/gitg/plugins"
AC_SUBST(GITG_PLUGIN_LIBDIR)
GITG_PLUGIN_CFLAGS="$GITG_CFLAGS"
GITG_PLUGIN_CFLAGS="-I\$(top_srcdir)/libgd $GITG_CFLAGS"
GITG_PLUGIN_LIBS="$GITG_LIBS \
\$(top_builddir)/libgd/libgd.la \
\$(top_builddir)/libgitg/libgitg-1.0.la \
\$(top_builddir)/libgitg-ext/libgitg-ext-1.0.la \
\$(top_builddir)/libgitg-gtk/libgitg-gtk-1.0.la"
\$(top_builddir)/libgitg-gtk/libgitg-gtk-1.0.la \
\$(top_builddir)/libgd/libgd.la"
AC_SUBST(GITG_PLUGIN_CFLAGS)
AC_SUBST(GITG_PLUGIN_LIBS)

View file

@ -117,9 +117,6 @@
<key name="size" type="(ii)">
<default>(650, 500)</default>
</key>
<key name="paned-panels-position" type="i">
<default>150</default>
</key>
<key name="hpaned-commit1-position" type="i">
<default>200</default>
</key>

View file

@ -49,10 +49,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
private Gtk.ScrolledWindow d_dash_scrolled_window;
private GitgGtk.DashView d_dash_view;
private Gtk.Paned d_paned_panels;
private Gd.Stack d_stack_view;
private Gd.Stack d_stack_panel;
private static const ActionEntry[] win_entries = {
{"search", on_search_activated, null, "false", null},
@ -143,7 +140,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
d_header_bar.set_subtitle(Markup.escape_text(head_name));
d_main_stack.transition_type = Gd.StackTransitionType.SLIDE_LEFT;
d_main_stack.set_visible_child(d_paned_panels);
d_main_stack.set_visible_child(d_stack_view);
d_commit_view_switcher.show();
d_button_dash.show();
d_dash_view.add_repository(d_repository);
@ -435,12 +432,9 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
repository = r;
});
d_paned_panels = builder.get_object("paned_panels") as Gtk.Paned;
d_stack_view = builder.get_object("stack_view") as Gd.Stack;
d_stack_panel = builder.get_object("stack_panel") as Gd.Stack;
d_commit_view_switcher = builder.get_object("commit-view-switcher") as Gd.StackSwitcher;
d_commit_view_switcher.stack = d_stack_panel;
d_gear_menu = builder.get_object("gear-menubutton") as Gtk.MenuButton;
@ -482,11 +476,6 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
}
});
d_interface_settings.bind("orientation",
d_paned_panels,
"orientation",
SettingsBindFlags.GET);
base.parser_finished(builder);
}
@ -497,11 +486,27 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
if (view != null)
{
view.on_view_activated();
}
if (view.stack_panel != null)
{
d_commit_view_switcher.stack = view.stack_panel; //todo
// Update panels
d_panels.update();
// Initialize peas extensions set for this view
var engine = PluginsEngine.get_default();
d_panels = new UIElements<GitgExt.Panel>(new Peas.ExtensionSet(engine,
typeof(GitgExt.Panel),
"application",
this),
view.stack_panel);
d_panels.activated.connect(on_panel_activated);
}
view.on_view_activated();
d_panels.update();
}
notify_property("current_view");
}
@ -568,14 +573,6 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
d_views.activated.connect(on_view_activated);
d_panels = new UIElements<GitgExt.Panel>(new Peas.ExtensionSet(engine,
typeof(GitgExt.Panel),
"application",
this),
d_stack_panel);
d_panels.activated.connect(on_panel_activated);
// Setup window geometry saving
Gdk.WindowState window_state = (Gdk.WindowState)d_state_settings.get_int("state");
if (Gdk.WindowState.MAXIMIZED in window_state) {
@ -586,11 +583,6 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
d_state_settings.get ("size", "(ii)", out width, out height);
resize (width, height);
d_state_settings.bind("paned-panels-position",
d_paned_panels,
"position",
SettingsBindFlags.GET | SettingsBindFlags.SET);
return true;
}

View file

@ -145,37 +145,9 @@
</object>
</child>
<child>
<object class="GtkPaned" id="paned_panels">
<object class="GdStack" id="stack_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">300</property>
<property name="orientation">vertical</property>
<style>
<class name="panels-paned"/>
</style>
<child>
<object class="GdStack" id="stack_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<object class="GdStack" id="stack_panel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<property name="can_focus">False</property>
</object>
</child>
</object>

View file

@ -3,6 +3,7 @@ lib_LTLIBRARIES = libgitg-ext-1.0.la
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(top_srcdir)/libgd \
$(LIBGITG_EXT_CFLAGS) \
$(WARN_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
@ -14,12 +15,15 @@ COMMON_VALA_FLAGS = \
--pkg gio-2.0 \
--pkg gtk+-3.0 \
--pkg gee-1.0 \
--pkg gd-1.0 \
--basedir $(top_srcdir) \
--vapidir $(top_builddir)/libgd \
--vapidir $(top_builddir)/libgitg
AM_VALAFLAGS = \
$(COMMON_VALA_FLAGS) \
--gir GitgExt-1.0.gir \
--girdir $(top_builddir)/libgd \
--girdir $(top_builddir)/libgitg \
--includedir libgitg-ext \
--header libgitg-ext.h \
@ -79,7 +83,7 @@ typelibdir = $(INTROSPECTION_TYPELIBDIR)
typelib_DATA = GitgExt-1.0.typelib
%.typelib: %.gir
$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=. --includedir=$(top_builddir)/libgitg -o $@ $<
$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=. --includedir=$(top_builddir)/libgd --includedir=$(top_builddir)/libgitg -o $@ $<
if ENABLE_PYTHON
overridesdir = $(pyoverridesdir)

View file

@ -81,6 +81,8 @@ public interface View : Object, UIElement
*
*/
public abstract bool is_default_for(string action);
public abstract Gd.Stack stack_panel { get; }
}
}

View file

@ -1,7 +1,6 @@
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(top_srcdir)/libgd \
$(GITG_PLUGIN_CFLAGS) \
$(WARN_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \

View file

@ -36,6 +36,8 @@ namespace GitgHistory
private Gtk.Paned d_main;
private GitgHistory.NavigationView d_navigation;
private Gtk.Paned d_paned_panels;
private Gd.Stack d_stack_panel;
private Gtk.TreeView d_commit_list;
public string id
@ -43,6 +45,11 @@ namespace GitgHistory
owned get { return "/org/gnome/gitg/Views/History"; }
}
public Gd.Stack stack_panel
{
get { return d_stack_panel; }
}
public void foreach_selected(GitgExt.ForeachObjectSelectionFunc func)
{
bool breakit = false;
@ -181,6 +188,8 @@ namespace GitgHistory
{
var ret = GitgExt.UI.from_builder("history/view-history.ui",
"paned_views",
"paned_panels",
"stack_panel",
"navigation_view",
"commit_list_view",
"renderer_commit_list_author",
@ -206,6 +215,9 @@ namespace GitgHistory
d_navigation.set_level_indentation(12);
}
d_paned_panels = ret["paned_panels"] as Gtk.Paned;
d_stack_panel = ret["stack_panel"] as Gd.Stack;
d_commit_list = ret["commit_list_view"] as Gtk.TreeView;
d_commit_list.model = d_model;
d_commit_list.get_selection().changed.connect((sel) => {
@ -220,6 +232,16 @@ namespace GitgHistory
d_main,
"position",
SettingsBindFlags.GET | SettingsBindFlags.SET);
state_settings.bind("paned-panels-position",
d_paned_panels,
"position",
SettingsBindFlags.GET | SettingsBindFlags.SET);
var interface_settings = new Settings("org.gnome.gitg.preferences.interface");
interface_settings.bind("orientation",
d_paned_panels,
"orientation",
SettingsBindFlags.GET);
}
private void update_walker(Navigation n, Gitg.Ref? head)

View file

@ -7,6 +7,9 @@
<key name="paned-views-position" type="i">
<default>200</default>
</key>
<key name="paned-panels-position" type="i">
<default>450</default>
</key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gitg.history.preferences" path="/org/gnome/gitg/history/preferences/">
<key name="collapse-inactive-lanes" type="i">

View file

@ -37,70 +37,96 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_commit_list">
<object class="GtkPaned" id="paned_panels">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="can_focus">True</property>
<property name="shadow-type">none</property>
<property name="orientation">vertical</property>
<property name="position">300</property>
<style>
<class name="panels-paned"/>
</style>
<child>
<object class="GitgGtkCommitListView" id="commit_list_view">
<object class="GtkScrolledWindow" id="scrolled_window_commit_list">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="can_focus">True</property>
<property name="rules_hint">True</property>
<property name="fixed-height-mode">True</property>
<property name="headers-visible">False</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkTreeViewColumn" id="column_commit_list_subject">
<property name="title" translatable="yes">Subject</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="expand">True</property>
<property name="fixed-width">600</property>
<object class="GitgGtkCommitListView" id="commit_list_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="rules_hint">True</property>
<property name="fixed-height-mode">True</property>
<property name="headers-visible">False</property>
<child>
<object class="GitgGtkCellRendererLanes" id="renderer_commit_list_subject">
<property name="ellipsize">end</property>
<object class="GtkTreeViewColumn" id="column_commit_list_subject">
<property name="title" translatable="yes">Subject</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="expand">True</property>
<property name="fixed-width">600</property>
<child>
<object class="GitgGtkCellRendererLanes" id="renderer_commit_list_subject">
<property name="ellipsize">end</property>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_commit_list_author">
<property name="title" translatable="yes">Author</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="fixed-width">200</property>
<child>
<object class="GdStyledTextRenderer" id="renderer_commit_list_author">
<property name="ellipsize">end</property>
<object class="GtkTreeViewColumn" id="column_commit_list_author">
<property name="title" translatable="yes">Author</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="fixed-width">200</property>
<child>
<object class="GdStyledTextRenderer" id="renderer_commit_list_author">
<property name="ellipsize">end</property>
</object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column_commit_list_author_date">
<property name="title" translatable="yes">Date</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="fixed-width">250</property>
<child>
<object class="GdStyledTextRenderer" id="renderer_commit_list_author_date">
<property name="ellipsize">end</property>
<object class="GtkTreeViewColumn" id="column_commit_list_author_date">
<property name="title" translatable="yes">Date</property>
<property name="sizing">fixed</property>
<property name="resizable">True</property>
<property name="fixed-width">250</property>
<child>
<object class="GdStyledTextRenderer" id="renderer_commit_list_author_date">
<property name="ellipsize">end</property>
</object>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GdStack" id="stack_panel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
</child>
</object>