[latexila] MainWindow: connect_documents_panel() function
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] MainWindow: connect_documents_panel() function
- Date: Wed, 1 Aug 2012 23:31:16 +0000 (UTC)
commit 78b096027591b880474c064821e39ab4f5363139
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Thu Aug 2 01:11:56 2012 +0200
MainWindow: connect_documents_panel() function
src/main_window.vala | 88 ++++++++++++++++++++++++++------------------------
1 files changed, 46 insertions(+), 42 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 326fb17..b82bb15 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -217,6 +217,8 @@ public class MainWindow : Window
/* signal handlers */
+ connect_documents_panel ();
+
delete_event.connect (() =>
{
on_quit ();
@@ -225,48 +227,6 @@ public class MainWindow : Window
return true;
});
- _documents_panel.page_added.connect (() =>
- {
- int nb_pages = _documents_panel.get_n_pages ();
-
- // actions for which there must be 1 document minimum
- if (nb_pages == 1)
- set_file_actions_sensitivity (true);
- });
-
- _documents_panel.page_removed.connect (() =>
- {
- int nb_pages = _documents_panel.get_n_pages ();
-
- // actions for which there must be 1 document minimum
- if (nb_pages == 0)
- {
- _statusbar.set_cursor_position (-1, -1);
- set_file_actions_sensitivity (false);
- _goto_line.hide ();
- _search_and_replace.hide ();
-
- notify_property ("active-tab");
- notify_property ("active-document");
- notify_property ("active-view");
- }
-
- my_set_title ();
- });
-
- _documents_panel.switch_page.connect ((pg, page_num) =>
- {
- _main_window_edit.update_sensitivity ();
- _main_window_build_tools.update_sensitivity ();
- update_config_project_sensitivity ();
- my_set_title ();
- update_cursor_position_statusbar ();
-
- notify_property ("active-tab");
- notify_property ("active-document");
- notify_property ("active-view");
- });
-
// hide completion calltip
notify["active-tab"].connect (() =>
{
@@ -393,6 +353,50 @@ public class MainWindow : Window
_vpaned.set_position (settings.get_int ("vertical-paned-position"));
}
+ private void connect_documents_panel ()
+ {
+ _documents_panel.page_added.connect (() =>
+ {
+ int nb_pages = _documents_panel.get_n_pages ();
+
+ // actions for which there must be 1 document minimum
+ if (nb_pages == 1)
+ set_file_actions_sensitivity (true);
+ });
+
+ _documents_panel.page_removed.connect (() =>
+ {
+ int nb_pages = _documents_panel.get_n_pages ();
+
+ if (nb_pages == 0)
+ {
+ _statusbar.set_cursor_position (-1, -1);
+ set_file_actions_sensitivity (false);
+ _goto_line.hide ();
+ _search_and_replace.hide ();
+
+ notify_property ("active-tab");
+ notify_property ("active-document");
+ notify_property ("active-view");
+ }
+
+ my_set_title ();
+ });
+
+ _documents_panel.switch_page.connect ((pg, page_num) =>
+ {
+ _main_window_edit.update_sensitivity ();
+ _main_window_build_tools.update_sensitivity ();
+ update_config_project_sensitivity ();
+ my_set_title ();
+ update_cursor_position_statusbar ();
+
+ notify_property ("active-tab");
+ notify_property ("active-document");
+ notify_property ("active-view");
+ });
+ }
+
public Gee.List<Document> get_documents ()
{
Gee.List<Document> all_documents = new Gee.LinkedList<Document> ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]