[latexila] Structure: fix sensitivity
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Structure: fix sensitivity
- Date: Tue, 24 Jul 2012 00:57:02 +0000 (UTC)
commit 3485e5aead83db86eb3dc2d599ac58963f093a66
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Tue Jul 24 02:56:11 2012 +0200
Structure: fix sensitivity
There were critical messages about this.
src/main_window.vala | 10 +++++-----
src/main_window_structure.vala | 21 +++++++++++++++------
src/structure.vala | 4 ++++
3 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 6a6391f..a99a98c 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -155,7 +155,6 @@ public class MainWindow : Window
private Toolbar _edit_toolbar;
private SidePanel _side_panel;
private SymbolsView _symbols;
- private Structure _structure;
private Paned main_hpaned;
private Paned vpaned;
@@ -166,6 +165,7 @@ public class MainWindow : Window
private uint documents_list_menu_ui_id;
private MainWindowBuildTools _main_window_build_tools;
+ private MainWindowStructure _main_window_structure;
// context id for the statusbar
private uint tip_message_cid;
@@ -251,8 +251,8 @@ public class MainWindow : Window
_symbols = new SymbolsView (this);
// Structure
- _structure = new Structure (this);
- new MainWindowStructure (ui_manager, _structure);
+ Structure structure = new Structure (this);
+ _main_window_structure = new MainWindowStructure (ui_manager, structure);
// Bottom panel
BuildView build_view = new BuildView (this);
@@ -277,7 +277,7 @@ public class MainWindow : Window
_side_panel = new SidePanel ();
_side_panel.add_component (_("Symbols"), "symbol_greek", _symbols);
_side_panel.add_component (_("File Browser"), Stock.OPEN, file_browser);
- _side_panel.add_component (_("Structure"), Stock.INDEX, _structure);
+ _side_panel.add_component (_("Structure"), Stock.INDEX, structure);
_side_panel.restore_state ();
// menu and toolbars
@@ -1053,7 +1053,7 @@ 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 ();
+ _main_window_structure.save_state ();
/* ui preferences */
GLib.Settings settings_ui =
diff --git a/src/main_window_structure.vala b/src/main_window_structure.vala
index fe00d61..ed92e04 100644
--- a/src/main_window_structure.vala
+++ b/src/main_window_structure.vala
@@ -71,16 +71,17 @@ public class MainWindowStructure
ui_manager.insert_action_group (action_group, 0);
- structure.hide.connect (() =>
- {
- Gtk.Action menu = ui_manager.get_action ("/MainMenu/Structure");
- menu.sensitive = false;
- });
-
structure.show_popup_menu.connect (show_popup_menu);
+ structure.hide.connect (set_menu_insensitive);
+ structure.no_items_selected.connect (set_menu_insensitive);
structure.item_selected.connect (set_actions_sensitivity);
}
+ public void save_state ()
+ {
+ _structure.save_state ();
+ }
+
private void show_popup_menu (Gdk.EventButton? event)
{
Gtk.Menu popup_menu = _ui_manager.get_widget ("/StructurePopup") as Gtk.Menu;
@@ -91,6 +92,14 @@ public class MainWindowStructure
popup_menu.popup (null, null, null, 0, get_current_event_time ());
}
+ private void set_menu_insensitive ()
+ {
+ return_if_fail (_ui_manager != null);
+
+ Gtk.Action menu = _ui_manager.get_action ("/MainMenu/Structure");
+ menu.sensitive = false;
+ }
+
private void set_actions_sensitivity (StructType type)
{
Gtk.Action menu = _ui_manager.get_action ("/MainMenu/Structure");
diff --git a/src/structure.vala b/src/structure.vala
index 97d8a66..f50544b 100644
--- a/src/structure.vala
+++ b/src/structure.vala
@@ -114,6 +114,7 @@ public class Structure : Grid
private static string[] _names = null;
private static string[] _action_names = null;
+ public signal void no_items_selected ();
public signal void item_selected (StructType type);
public signal void show_popup_menu (Gdk.EventButton? event);
@@ -309,7 +310,10 @@ public class Structure : Grid
{
// always allow deselect
if (path_currently_selected)
+ {
+ no_items_selected ();
return true;
+ }
return select_tree_row (path);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]