[latexila] Structure: simple list: some UI stuff
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Structure: simple list: some UI stuff
- Date: Fri, 10 Jun 2011 19:44:11 +0000 (UTC)
commit c7ecc43204a809d7a538cb47192b1466a12dfe27
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Wed Jun 8 17:12:10 2011 +0200
Structure: simple list: some UI stuff
data/org.gnome.latexila.gschema.xml | 3 ++
src/main_window.vala | 7 +++-
src/structure.vala | 53 +++++++++++++++++++++++++++++++++-
3 files changed, 59 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.latexila.gschema.xml b/data/org.gnome.latexila.gschema.xml
index 9b86c26..7564a81 100644
--- a/data/org.gnome.latexila.gschema.xml
+++ b/data/org.gnome.latexila.gschema.xml
@@ -219,5 +219,8 @@
<key name="new-file-dialog-paned-position" type="i">
<default>170</default>
</key>
+ <key name="structure-paned-position" type="i">
+ <default>100</default>
+ </key>
</schema>
</schemalist>
diff --git a/src/main_window.vala b/src/main_window.vala
index 150ab10..a68b79d 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -168,6 +168,7 @@ public class MainWindow : Window
private SidePanel side_panel;
private Symbols symbols;
private FileBrowser file_browser;
+ private Structure _structure;
private HPaned main_hpaned;
private VPaned vpaned;
@@ -289,8 +290,8 @@ public class MainWindow : Window
file_browser = new FileBrowser (this);
side_panel.add_component (_("File Browser"), Stock.OPEN, file_browser);
- Structure structure = new Structure (this);
- side_panel.add_component (_("Structure"), Stock.INDEX, structure);
+ _structure = new Structure (this);
+ side_panel.add_component (_("Structure"), Stock.INDEX, _structure);
side_panel.restore_state ();
/* signal handlers */
@@ -1084,6 +1085,8 @@ public class MainWindow : Window
settings_window.set_int ("side-panel-size", main_hpaned.get_position ());
settings_window.set_int ("vertical-paned-position", vpaned.get_position ());
+ _structure.save_state ();
+
/* ui preferences */
GLib.Settings settings_ui =
new GLib.Settings ("org.gnome.latexila.preferences.ui");
diff --git a/src/structure.vala b/src/structure.vala
index 3aea701..4e45488 100644
--- a/src/structure.vala
+++ b/src/structure.vala
@@ -40,6 +40,10 @@ public enum StructType
public class Structure : VBox
{
private unowned MainWindow _main_window;
+
+ private ToggleButton[] _simple_list_buttons = {};
+ private VPaned _vpaned;
+ private Label _simple_list;
private TreeView _tree_view;
private static string[] _icons = null;
@@ -51,8 +55,11 @@ public class Structure : VBox
_main_window = main_window;
init_toolbar ();
+ init_vpaned ();
+ init_simple_list ();
init_tree_view ();
show_all ();
+ _simple_list.hide ();
show.connect (connect_parsing);
hide.connect (disconnect_parsing);
@@ -121,9 +128,51 @@ public class Structure : VBox
button.tooltip_text = tooltip;
+ _simple_list_buttons += button;
+
+ button.clicked.connect (() =>
+ {
+ if (! button.get_active ())
+ {
+ _simple_list.hide ();
+ return;
+ }
+
+ foreach (ToggleButton simple_list_button in _simple_list_buttons)
+ {
+ if (simple_list_button == button)
+ continue;
+
+ simple_list_button.set_active (false);
+ }
+
+ _simple_list.show_all ();
+ });
+
return button;
}
+ private void init_vpaned ()
+ {
+ _vpaned = new VPaned ();
+ pack_start (_vpaned);
+
+ GLib.Settings settings = new GLib.Settings ("org.gnome.latexila.state.window");
+ _vpaned.set_position (settings.get_int ("structure-paned-position"));
+ }
+
+ public void save_state ()
+ {
+ GLib.Settings settings = new GLib.Settings ("org.gnome.latexila.state.window");
+ settings.set_int ("structure-paned-position", _vpaned.get_position ());
+ }
+
+ private void init_simple_list ()
+ {
+ _simple_list = new Label ("Simple list");
+ _vpaned.add1 (_simple_list);
+ }
+
private void init_tree_view ()
{
_tree_view = new TreeView ();
@@ -151,8 +200,8 @@ public class Structure : VBox
select.set_select_function (on_row_selection);
// with a scrollbar
- var sw = Utils.add_scrollbar (_tree_view);
- pack_start (sw);
+ Widget sw = Utils.add_scrollbar (_tree_view);
+ _vpaned.add2 (sw);
}
private bool on_row_selection (TreeSelection selection, TreeModel model,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]