[latexila] MainWindowDocuments: add the documents panel later
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] MainWindowDocuments: add the documents panel later
- Date: Thu, 2 Aug 2012 00:01:09 +0000 (UTC)
commit e69d9244a85c8cac2ea482c9cc24fe54774dc95d
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Thu Aug 2 01:56:25 2012 +0200
MainWindowDocuments: add the documents panel later
src/main_window.vala | 12 ++++++------
src/main_window_documents.vala | 20 +++++++++++++++++---
2 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 3905a73..0339e7d 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -147,8 +147,14 @@ public class MainWindow : Window
/* components */
initialize_menubar_and_toolbar ();
+ _main_window_edit = new MainWindowEdit (this, _ui_manager);
+ _main_window_file = new MainWindowFile (this, _ui_manager);
+ _main_window_build_tools = new MainWindowBuildTools (this, _ui_manager);
+ _main_window_documents = new MainWindowDocuments (this, _ui_manager);
_documents_panel = new DocumentsPanel (this);
+ _main_window_documents.set_documents_panel (_documents_panel);
+
_documents_panel.right_click.connect ((event) =>
{
Gtk.Menu popup_menu = _ui_manager.get_widget ("/NotebookPopup") as Gtk.Menu;
@@ -160,12 +166,6 @@ public class MainWindow : Window
_goto_line = new GotoLine (this);
_search_and_replace = new SearchAndReplace (this);
- _main_window_edit = new MainWindowEdit (this, _ui_manager);
- _main_window_file = new MainWindowFile (this, _ui_manager);
- _main_window_build_tools = new MainWindowBuildTools (this, _ui_manager);
- _main_window_documents = new MainWindowDocuments (this, _ui_manager,
- _documents_panel);
-
// File browser
FileBrowser file_browser = new FileBrowser (this);
_main_window_build_tools.set_file_browser (file_browser);
diff --git a/src/main_window_documents.vala b/src/main_window_documents.vala
index cdf5f92..9642f10 100644
--- a/src/main_window_documents.vala
+++ b/src/main_window_documents.vala
@@ -55,12 +55,10 @@ public class MainWindowDocuments
private Gtk.ActionGroup _list_action_group;
private uint _list_id;
- public MainWindowDocuments (MainWindow main_window, UIManager ui_manager,
- DocumentsPanel documents_panel)
+ public MainWindowDocuments (MainWindow main_window, UIManager ui_manager)
{
_main_window = main_window;
_ui_manager = ui_manager;
- _documents_panel = documents_panel;
_static_action_group = new Gtk.ActionGroup ("DocumentsMenuActionGroup");
_static_action_group.set_translation_domain (Config.GETTEXT_PACKAGE);
@@ -69,13 +67,19 @@ public class MainWindowDocuments
_list_action_group = new Gtk.ActionGroup ("DocumentsListActionGroup");
ui_manager.insert_action_group (_list_action_group, 0);
+ }
+ public void set_documents_panel (DocumentsPanel documents_panel)
+ {
+ _documents_panel = documents_panel;
connect_signals ();
update_sensitivity ();
}
private void connect_signals ()
{
+ return_if_fail (_documents_panel != null);
+
_documents_panel.page_reordered.connect (() =>
{
update_sensitivity ();
@@ -104,6 +108,7 @@ public class MainWindowDocuments
private void update_documents_list ()
{
return_if_fail (_list_action_group != null);
+ return_if_fail (_documents_panel != null);
if (_list_id != 0)
_ui_manager.remove_ui (_list_id);
@@ -171,6 +176,8 @@ public class MainWindowDocuments
public void update_document_name (DocumentTab tab)
{
+ return_if_fail (_documents_panel != null);
+
int doc_num = _documents_panel.page_num (tab);
string action_name = get_list_action_name (doc_num);
@@ -183,6 +190,8 @@ public class MainWindowDocuments
private void list_action_activate (Gtk.Action action)
{
+ return_if_fail (_documents_panel != null);
+
RadioAction radio_action = action as RadioAction;
if (! radio_action.get_active ())
return;
@@ -222,6 +231,8 @@ public class MainWindowDocuments
private void update_next_prev_doc_sensitivity ()
{
+ return_if_fail (_documents_panel != null);
+
if (_main_window.active_tab == null)
return;
@@ -254,12 +265,14 @@ public class MainWindowDocuments
public void on_previous ()
{
return_if_fail (_main_window.active_tab != null);
+ return_if_fail (_documents_panel != null);
_documents_panel.prev_page ();
}
public void on_next ()
{
return_if_fail (_main_window.active_tab != null);
+ return_if_fail (_documents_panel != null);
_documents_panel.next_page ();
}
@@ -267,6 +280,7 @@ public class MainWindowDocuments
{
DocumentTab tab = _main_window.active_tab;
return_if_fail (tab != null);
+ return_if_fail (_documents_panel != null);
MainWindow new_window = Latexila.get_instance ().create_window ();
DocumentView view = tab.view;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]