[gnome-latex: 80/205] Bug correction: changing preferences if no document opened



commit f7a149d53852e53a44462caae2a457b99b7fe36d
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Thu Sep 24 16:06:12 2009 +0200

    Bug correction: changing preferences if no document opened

 TODO            | 1 +
 src/callbacks.c | 8 ++++++++
 src/prefs.c     | 3 +++
 3 files changed, 12 insertions(+)
---
diff --git a/TODO b/TODO
index 8a8f07d..ee4c408 100644
--- a/TODO
+++ b/TODO
@@ -36,5 +36,6 @@ Fri Sep 18, 2009 to Fri Sep 25, 2009
                * view_document ()
 
 [x] bugs correction
+       x segfault when changing preferences if no document opened (line numbers and font)
 
 [-] update French translation
diff --git a/src/callbacks.c b/src/callbacks.c
index 035677d..26fa725 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -711,6 +711,10 @@ cb_page_change (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num,
        latexila.active_doc = g_list_nth_data (latexila.all_docs, page_num);
        set_undo_redo_sensitivity ();
        update_cursor_position_statusbar ();
+       /*
+       print_info ("page_num: %d", page_num);
+       print_info ("doc: %s", latexila.active_doc->path);
+       */
 }
 
 void
@@ -855,6 +859,9 @@ open_new_document (const gchar *filename, const gchar *uri)
 void
 change_font_source_view (void)
 {
+       if (latexila.active_doc == NULL)
+               return;
+
        // traverse the list
        // an other solution is to call g_list_foreach ()
        GList *current = latexila.all_docs;
@@ -970,6 +977,7 @@ create_document_in_new_tab (const gchar *path, const gchar *text, const gchar *t
        gtk_widget_show_all (hbox);
 
        gint index = gtk_notebook_append_page (latexila.notebook, sw, hbox);
+       //gtk_notebook_set_tab_reorderable (latexila.notebook, sw, TRUE);
        gtk_notebook_set_current_page (latexila.notebook, index);
        
        set_undo_redo_sensitivity ();
diff --git a/src/prefs.c b/src/prefs.c
index 424aa57..f5ebff7 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -403,6 +403,9 @@ cb_pref_line_numbers (GtkToggleButton *toggle_button, gpointer user_data)
        gboolean show_line_numbers = gtk_toggle_button_get_active (toggle_button);
        latexila.prefs->show_line_numbers = show_line_numbers;
 
+       if (latexila.active_doc == NULL)
+               return;
+
        // traverse the list
        // an other solution is to call g_list_foreach ()
        GList *current = latexila.all_docs;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]