[gitg] Let GitgExtView decide where should GitgExtPanels be placed
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Let GitgExtView decide where should GitgExtPanels be placed
- Date: Mon, 27 May 2013 07:24:54 +0000 (UTC)
commit ed7abdb90cc93baf266f59e66a9cb78c61e24cc2
Author: Techlive Zheng <techlivezheng gmail com>
Date: Tue May 21 15:41:49 2013 +0800
Let GitgExtView decide where should GitgExtPanels be placed
configure.ac | 6 +-
data/org.gnome.gitg.gschema.xml.in.in | 3 -
gitg/gitg-window.vala | 50 ++++-----
gitg/resources/ui/gitg-window.ui | 32 +-----
libgitg-ext/Makefile.am | 6 +-
libgitg-ext/gitg-ext-view.vala | 2 +
plugins/history/Makefile.am | 1 -
plugins/history/gitg-history.vala | 22 ++++
.../org.gnome.gitg.history.gschema.xml.in.in | 3 +
plugins/history/resources/view-history.ui | 112 ++++++++++++--------
10 files changed, 127 insertions(+), 110 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 47a29c9..e6681f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/data/org.gnome.gitg.gschema.xml.in.in b/data/org.gnome.gitg.gschema.xml.in.in
index 999e19c..1b2c3a8 100644
--- a/data/org.gnome.gitg.gschema.xml.in.in
+++ b/data/org.gnome.gitg.gschema.xml.in.in
@@ -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>
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 5af22c1..af7d1b0 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -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)
{
+ if (view.stack_panel != null)
+ {
+ d_commit_view_switcher.stack = view.stack_panel; //todo
+
+ // 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();
- }
- // Update panels
- d_panels.update();
+ 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;
}
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index afb2b29..aa3a64b 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -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>
diff --git a/libgitg-ext/Makefile.am b/libgitg-ext/Makefile.am
index 264e280..e6d1849 100644
--- a/libgitg-ext/Makefile.am
+++ b/libgitg-ext/Makefile.am
@@ -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)
diff --git a/libgitg-ext/gitg-ext-view.vala b/libgitg-ext/gitg-ext-view.vala
index dbef416..d0ed254 100644
--- a/libgitg-ext/gitg-ext-view.vala
+++ b/libgitg-ext/gitg-ext-view.vala
@@ -81,6 +81,8 @@ public interface View : Object, UIElement
*
*/
public abstract bool is_default_for(string action);
+
+ public abstract Gd.Stack stack_panel { get; }
}
}
diff --git a/plugins/history/Makefile.am b/plugins/history/Makefile.am
index c1f4793..7b5cd38 100644
--- a/plugins/history/Makefile.am
+++ b/plugins/history/Makefile.am
@@ -1,7 +1,6 @@
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
- -I$(top_srcdir)/libgd \
$(GITG_PLUGIN_CFLAGS) \
$(WARN_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
diff --git a/plugins/history/gitg-history.vala b/plugins/history/gitg-history.vala
index a1e69df..f5905e6 100644
--- a/plugins/history/gitg-history.vala
+++ b/plugins/history/gitg-history.vala
@@ -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)
diff --git a/plugins/history/org.gnome.gitg.history.gschema.xml.in.in
b/plugins/history/org.gnome.gitg.history.gschema.xml.in.in
index a876091..4ae05a0 100644
--- a/plugins/history/org.gnome.gitg.history.gschema.xml.in.in
+++ b/plugins/history/org.gnome.gitg.history.gschema.xml.in.in
@@ -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">
diff --git a/plugins/history/resources/view-history.ui b/plugins/history/resources/view-history.ui
index e91b4d8..601442c 100644
--- a/plugins/history/resources/view-history.ui
+++ b/plugins/history/resources/view-history.ui
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]