[gnome-latex: 92/205] Use less pointers to structures in latexila_t



commit ab3edd2e9a87df070da00e57f270a626fdb67ded
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Sat Oct 10 13:34:27 2009 +0200

    Use less pointers to structures in latexila_t
    
    The action_log, symbols and prefs variables in latexila_t are not
    pointers.
    active_doc is an exception.

 TODO                    | 15 ++++--------
 src/callbacks.c         | 65 +++++++++++++++++++++++--------------------------
 src/external_commands.c | 44 ++++++++++++++++-----------------
 src/main.c              | 43 +++++++++++++++-----------------
 src/main.h              |  6 ++---
 src/prefs.c             | 42 ++++++++++++++++----------------
 src/symbols.c           | 44 ++++++++++++++++-----------------
 src/ui.c                |  4 +--
 8 files changed, 124 insertions(+), 139 deletions(-)
---
diff --git a/TODO b/TODO
index 7c6a554..40c1829 100644
--- a/TODO
+++ b/TODO
@@ -1,14 +1,8 @@
 TODO LaTeXila
 
-Fri Oct 2, 2009 to Fri Oct 9, 2009
-
-[-] undo/redo and the "saved" document property
-       - detect when the buffer is the same as in the file currently saved
+Sat Oct 10, 2009 to Fri Oct 16, 2009
 
 [-] execution of the actions
-       ~ verify that the method used for compile_document () is correct
-       x same behavior than compile_document () for:
-               * convert_document ()
        - sensitivity of the actions when an action is running
 
 [-] log zone
@@ -16,10 +10,11 @@ Fri Oct 2, 2009 to Fri Oct 9, 2009
 
 [-] symbol tables
        - mathematical sets (N, Z, Q, R, C) in misc math
-       x add a space after the symbols
-       x set the focus on the text after inserting a symbol
 
 [x] bugs correction
-       x external commands: the commands must run even if the path of the file contains spaces
 
 [-] update French translation
+
+[-] undo/redo and the "saved" document property
+       - detect when the buffer is the same as in the file currently saved
+
diff --git a/src/callbacks.c b/src/callbacks.c
index c7d32b1..bd04ae3 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -177,7 +177,7 @@ cb_quit (void)
 {
        if (close_all ())
        {
-               save_preferences (latexila.prefs);
+               save_preferences (&latexila.prefs);
                free_latexila ();
                print_info ("Bye bye");
                gtk_main_quit ();
@@ -278,25 +278,25 @@ cb_select_all (void)
 void
 cb_zoom_in (void)
 {
-       latexila.prefs->font_size += PANGO_SCALE;
-       pango_font_description_set_size (latexila.prefs->font_desc,
-                       latexila.prefs->font_size);
+       latexila.prefs.font_size += PANGO_SCALE;
+       pango_font_description_set_size (latexila.prefs.font_desc,
+                       latexila.prefs.font_size);
        change_font_source_view ();
 }
 
 void
 cb_zoom_out (void)
 {
-       latexila.prefs->font_size -= PANGO_SCALE;
-       pango_font_description_set_size (latexila.prefs->font_desc,
-                       latexila.prefs->font_size);
+       latexila.prefs.font_size -= PANGO_SCALE;
+       pango_font_description_set_size (latexila.prefs.font_desc,
+                       latexila.prefs.font_size);
        change_font_source_view ();
 }
 
 void
 cb_zoom_reset (void)
 {
-       set_current_font_prefs (latexila.prefs);
+       set_current_font_prefs (&latexila.prefs);
        change_font_source_view ();
 }
 
@@ -535,7 +535,7 @@ cb_latex (void)
 
        gchar *title = _("Compile (latex)");
        gchar *command[] = {
-        g_strdup (latexila.prefs->command_latex),
+        g_strdup (latexila.prefs.command_latex),
         "-interaction=nonstopmode",
         g_strdup (latexila.active_doc->path),
         NULL
@@ -557,7 +557,7 @@ cb_pdflatex (void)
 
        gchar *title = _("Compile (pdflatex)");
        gchar *command[] = {
-        g_strdup (latexila.prefs->command_pdflatex),
+        g_strdup (latexila.prefs.command_pdflatex),
         "-interaction=nonstopmode",
         g_strdup (latexila.active_doc->path),
         NULL
@@ -602,8 +602,7 @@ cb_dvi_to_pdf (void)
        if (latexila.active_doc == NULL)
                return;
 
-       // TODO delete ".dvi"
-       convert_document (_("DVI to PDF"), ".dvi", latexila.prefs->command_dvipdf);
+       convert_document (_("DVI to PDF"), ".dvi", latexila.prefs.command_dvipdf);
 }
 
 void
@@ -612,7 +611,7 @@ cb_dvi_to_ps (void)
        if (latexila.active_doc == NULL)
                return;
 
-       convert_document (_("DVI to PS"), ".dvi", latexila.prefs->command_dvips);
+       convert_document (_("DVI to PS"), ".dvi", latexila.prefs.command_dvips);
 }
 
 void
@@ -627,7 +626,7 @@ cb_action_list_changed (GtkTreeSelection *selection, gpointer user_data)
                                COLUMN_ACTION_TEXTBUFFER, &text_buffer,
                                -1);
 
-               gtk_text_view_set_buffer (latexila.action_log->text_view, text_buffer);
+               gtk_text_view_set_buffer (latexila.action_log.text_view, text_buffer);
        }
 }
 
@@ -738,16 +737,16 @@ cb_recent_item_activated (GtkRecentAction *action, gpointer user_data)
 void
 cb_show_symbol_tables (GtkToggleAction *toggle_action, gpointer user_data)
 {
-       if (latexila.symbols == NULL || latexila.symbols->vbox == NULL)
+       if (latexila.symbols.vbox == NULL)
                return;
 
-       latexila.prefs->show_side_pane =
+       latexila.prefs.show_side_pane =
                gtk_toggle_action_get_active (toggle_action);
 
-       if (latexila.prefs->show_side_pane)
-               gtk_widget_show_all (latexila.symbols->vbox);
+       if (latexila.prefs.show_side_pane)
+               gtk_widget_show_all (latexila.symbols.vbox);
        else
-               gtk_widget_hide (latexila.symbols->vbox);
+               gtk_widget_hide (latexila.symbols.vbox);
 }
 
 void
@@ -756,10 +755,10 @@ cb_show_edit_toolbar (GtkToggleAction *toggle_action, gpointer user_data)
        if (latexila.edit_toolbar == NULL)
                return;
 
-       latexila.prefs->show_edit_toolbar =
+       latexila.prefs.show_edit_toolbar =
                gtk_toggle_action_get_active (toggle_action);
 
-       if (latexila.prefs->show_edit_toolbar)
+       if (latexila.prefs.show_edit_toolbar)
                gtk_widget_show_all (latexila.edit_toolbar);
        else
                gtk_widget_hide (latexila.edit_toolbar);
@@ -801,7 +800,7 @@ change_font_source_view (void)
        do
        {
                document_t *doc = g_list_nth_data (current, 0);
-               gtk_widget_modify_font (doc->source_view, latexila.prefs->font_desc);
+               gtk_widget_modify_font (doc->source_view, latexila.prefs.font_desc);
        }
        while ((current = g_list_next (current)) != NULL);
 }
@@ -851,7 +850,7 @@ create_document_in_new_tab (const gchar *path, const gchar *text, const gchar *t
        gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (new_doc->source_view), TRUE);
 
        // set the font
-       gtk_widget_modify_font (new_doc->source_view, latexila.prefs->font_desc);
+       gtk_widget_modify_font (new_doc->source_view, latexila.prefs.font_desc);
 
        // enable text wrapping (between words only)
        gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (new_doc->source_view),
@@ -860,7 +859,7 @@ create_document_in_new_tab (const gchar *path, const gchar *text, const gchar *t
        // show line numbers?
        gtk_source_view_set_show_line_numbers (
                        GTK_SOURCE_VIEW (new_doc->source_view),
-                       latexila.prefs->show_line_numbers);
+                       latexila.prefs.show_line_numbers);
 
        // put the text into the buffer
        gtk_source_buffer_begin_not_undoable_action (new_doc->source_buffer);
@@ -1235,17 +1234,13 @@ find_next_match (const gchar *what, GtkSourceSearchFlags flags,
 static void
 free_latexila (void)
 {
-       g_free (latexila.prefs->font_str);
-       g_free (latexila.prefs->command_view);
-       g_free (latexila.prefs->command_latex);
-       g_free (latexila.prefs->command_pdflatex);
-       g_free (latexila.prefs->command_dvipdf);
-       g_free (latexila.prefs->command_dvips);
-       g_free (latexila.prefs);
-       g_free (latexila.action_log);
+       g_free (latexila.prefs.font_str);
+       g_free (latexila.prefs.command_view);
+       g_free (latexila.prefs.command_latex);
+       g_free (latexila.prefs.command_pdflatex);
+       g_free (latexila.prefs.command_dvipdf);
+       g_free (latexila.prefs.command_dvips);
 
        for (int i = 0 ; i < 7 ; i++)
-               g_object_unref (latexila.symbols->list_stores[i]);
-
-       g_free (latexila.symbols);
+               g_object_unref (latexila.symbols.list_stores[i]);
 }
diff --git a/src/external_commands.c b/src/external_commands.c
index 8a22442..b0c8ea1 100644
--- a/src/external_commands.c
+++ b/src/external_commands.c
@@ -67,7 +67,7 @@ command_running_finished (void)
                gtk_main_iteration ();
 
        // unlock the action list
-       gtk_widget_set_sensitive (GTK_WIDGET (latexila.action_log->list_view), TRUE);
+       gtk_widget_set_sensitive (GTK_WIDGET (latexila.action_log.list_view), TRUE);
 
        // pop the message from the statusbar
        guint context_id = gtk_statusbar_get_context_id (latexila.statusbar,
@@ -103,7 +103,7 @@ cb_watch_output_command (GIOChannel *channel, GIOCondition condition,
        if (line != NULL)
        {
                // print the command output line to the log zone
-               print_log_add (latexila.action_log->text_view, line, FALSE);
+               print_log_add (latexila.action_log.text_view, line, FALSE);
        }
        
        /* Apply the magic formula for the 200 first lines and then every 20 lines.
@@ -143,7 +143,7 @@ compile_document (gchar *title, gchar **command)
        {
                command_output = g_strdup_printf (_("compilation failed: %s is not a *.tex file"),
                                g_path_get_basename (latexila.active_doc->path));
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
                g_free (command_output);
                return;
        }
@@ -173,7 +173,7 @@ compile_document (gchar *title, gchar **command)
        {
                command_output = g_strdup_printf (_("execution failed: %s"),
                                error->message);
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
 
                g_free (command_output);
                g_error_free (error);
@@ -193,7 +193,7 @@ compile_document (gchar *title, gchar **command)
        {
                command_output = g_strdup_printf (
                                "conversion of the command output failed: %s", error->message);
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
 
                g_free (command_output);
                g_error_free (error);
@@ -203,7 +203,7 @@ compile_document (gchar *title, gchar **command)
        // Lock the action list so the user can not view an other action while the
        // compilation is running.
        // It will be unlock when the compilation is finished.
-       gtk_widget_set_sensitive (GTK_WIDGET (latexila.action_log->list_view),
+       gtk_widget_set_sensitive (GTK_WIDGET (latexila.action_log.list_view),
                        FALSE);
 
        // add watches to channels
@@ -227,7 +227,7 @@ view_document (gchar *title, gchar *doc_extension)
        gchar *doc_path = g_regex_replace_literal (regex, latexila.active_doc->path,
                        -1, 0, doc_extension, 0, NULL);
 
-       gchar *command_line = g_strdup_printf ("%s %s", latexila.prefs->command_view,
+       gchar *command_line = g_strdup_printf ("%s %s", latexila.prefs.command_view,
                        doc_path);
        add_action (title, command_line);
        print_info ("execution of the command: %s", command_line);
@@ -241,7 +241,7 @@ view_document (gchar *title, gchar *doc_extension)
        {
                command_output = g_strdup_printf (_("failed: %s is not a *.tex file"),
                                g_path_get_basename (latexila.active_doc->path));
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
 
                g_free (command_output);
                g_free (doc_path);
@@ -254,7 +254,7 @@ view_document (gchar *title, gchar *doc_extension)
                command_output = g_strdup_printf (
                                _("%s does not exist. If this is not already made, compile the document with 
the right command."),
                                g_path_get_basename (doc_path));
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
 
                g_free (command_output);
                g_free (doc_path);
@@ -267,7 +267,7 @@ view_document (gchar *title, gchar *doc_extension)
        // it doesn't work fine...
        
        GError *error = NULL;
-       gchar *argv[] = {latexila.prefs->command_view, doc_path, NULL};
+       gchar *argv[] = {latexila.prefs.command_view, doc_path, NULL};
        g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
 
        gboolean is_error = TRUE;
@@ -285,7 +285,7 @@ view_document (gchar *title, gchar *doc_extension)
                is_error = FALSE;
        }
 
-       print_log_add (latexila.action_log->text_view, command_output, is_error);
+       print_log_add (latexila.action_log.text_view, command_output, is_error);
 
        g_free (command_output);
        g_free (doc_path);
@@ -317,7 +317,7 @@ convert_document (gchar *title, gchar *doc_extension, gchar *command)
                command_output = g_strdup_printf (
                                _("%s does not exist. If this is not already made, compile the document with 
the right command."),
                                g_path_get_basename (doc_path));
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
 
                g_free (command_output);
                g_free (doc_path);
@@ -352,7 +352,7 @@ convert_document (gchar *title, gchar *doc_extension, gchar *command)
        {
                command_output = g_strdup_printf (_("execution failed: %s"),
                                error->message);
-               print_log_add (latexila.action_log->text_view, command_output, TRUE);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
 
                g_free (command_output);
                g_error_free (error);
@@ -366,7 +366,7 @@ convert_document (gchar *title, gchar *doc_extension, gchar *command)
        // Lock the action list so the user can not view an other action while the
        // compilation is running.
        // It will be unlock when the compilation is finished.
-       gtk_widget_set_sensitive (GTK_WIDGET (latexila.action_log->list_view),
+       gtk_widget_set_sensitive (GTK_WIDGET (latexila.action_log.list_view),
                        FALSE);
 
        // add watches to channels
@@ -384,9 +384,9 @@ add_action (gchar *title, gchar *command)
 
        // create a new text buffer
        GtkTextBuffer *new_text_buffer = gtk_text_buffer_new (
-                       latexila.action_log->tag_table);
-       latexila.action_log->text_buffer = new_text_buffer;
-       gtk_text_view_set_buffer (latexila.action_log->text_view, new_text_buffer);
+                       latexila.action_log.tag_table);
+       latexila.action_log.text_buffer = new_text_buffer;
+       gtk_text_view_set_buffer (latexila.action_log.text_view, new_text_buffer);
 
        // title
        GtkTextIter end;
@@ -402,19 +402,19 @@ add_action (gchar *title, gchar *command)
 
        // append an new entry to the action list
        GtkTreeIter iter;
-       gtk_list_store_append (latexila.action_log->list_store, &iter);
-       gtk_list_store_set (latexila.action_log->list_store, &iter,
+       gtk_list_store_append (latexila.action_log.list_store, &iter);
+       gtk_list_store_set (latexila.action_log.list_store, &iter,
                        COLUMN_ACTION_TITLE, title2,
                        COLUMN_ACTION_TEXTBUFFER, new_text_buffer,
                        -1);
 
        // select the new entry
-       gtk_tree_selection_select_iter (latexila.action_log->list_selection, &iter);
+       gtk_tree_selection_select_iter (latexila.action_log.list_selection, &iter);
 
        // scroll to the end
        GtkTreePath *path = gtk_tree_model_get_path (
-                       GTK_TREE_MODEL (latexila.action_log->list_store), &iter);
-       gtk_tree_view_scroll_to_cell (latexila.action_log->list_view, path, NULL,
+                       GTK_TREE_MODEL (latexila.action_log.list_store), &iter);
+       gtk_tree_view_scroll_to_cell (latexila.action_log.list_view, path, NULL,
                        FALSE, 0, 0);
 
        num++;
diff --git a/src/main.c b/src/main.c
index eed6c4f..fa6ae7a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,8 +37,7 @@
 static gboolean option_version (const gchar *option_name, const gchar *value,
                gpointer data, GError **error);
 
-latexila_t latexila = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL}; 
+latexila_t latexila = {NULL};
 
 static gboolean
 option_version (const gchar *option_name, const gchar *value, gpointer data,
@@ -121,8 +120,7 @@ main (int argc, char *argv[])
 #endif
 
        /* preferences */
-       latexila.prefs = g_malloc (sizeof (preferences_t));
-       load_preferences (latexila.prefs);
+       load_preferences (&latexila.prefs);
 
        /* personal style */
        // make the close buttons in tabs smaller
@@ -146,9 +144,9 @@ main (int argc, char *argv[])
        gtk_window_set_title (GTK_WINDOW (window), PROGRAM_NAME);
        gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
        gtk_window_set_default_size (GTK_WINDOW (window),
-                       latexila.prefs->window_width, latexila.prefs->window_height);
+                       latexila.prefs.window_width, latexila.prefs.window_height);
 
-       if (latexila.prefs->window_maximised)
+       if (latexila.prefs.window_maximised)
                gtk_window_maximize (GTK_WINDOW (window));
 
 
@@ -165,13 +163,12 @@ main (int argc, char *argv[])
        GtkWidget *main_hpaned = gtk_hpaned_new ();
        latexila.main_hpaned = GTK_PANED (main_hpaned);
        gtk_paned_set_position (GTK_PANED (main_hpaned),
-                       latexila.prefs->main_hpaned_pos);
+                       latexila.prefs.main_hpaned_pos);
        gtk_box_pack_start (GTK_BOX (main_vbox), main_hpaned, TRUE, TRUE, 0);
 
        /* symbol tables */
-       latexila.symbols = g_malloc (sizeof (symbols_t));
        GtkWidget *vbox_symbols = gtk_vbox_new (FALSE, 0);
-       latexila.symbols->vbox = vbox_symbols;
+       latexila.symbols.vbox = vbox_symbols;
        gtk_paned_add1 (GTK_PANED (main_hpaned), vbox_symbols);
 
        init_symbols ();
@@ -182,7 +179,7 @@ main (int argc, char *argv[])
         */
        GtkWidget *vpaned = gtk_vpaned_new ();
        latexila.vpaned = GTK_PANED (vpaned);
-       gtk_paned_set_position (GTK_PANED (vpaned), latexila.prefs->vpaned_pos);
+       gtk_paned_set_position (GTK_PANED (vpaned), latexila.prefs.vpaned_pos);
        gtk_paned_add2 (GTK_PANED (main_hpaned), vpaned);
 
        /* source view with tabs */
@@ -196,35 +193,33 @@ main (int argc, char *argv[])
        gtk_paned_add1 (GTK_PANED (vpaned), notebook);
 
        /* log zone */
-       latexila.action_log = g_malloc (sizeof (action_log_t));
-
        // horizontal pane:
        // left: action history
        // right: details
        GtkWidget *hpaned = gtk_hpaned_new ();
        latexila.log_hpaned = GTK_PANED (hpaned);
-       gtk_paned_set_position (GTK_PANED (hpaned), latexila.prefs->log_hpaned_pos);
+       gtk_paned_set_position (GTK_PANED (hpaned), latexila.prefs.log_hpaned_pos);
        gtk_paned_add2 (GTK_PANED (vpaned), hpaned);
 
        // action history
        GtkListStore *list_store = gtk_list_store_new (N_COLUMNS_ACTION,
                        G_TYPE_STRING, G_TYPE_POINTER);
-       latexila.action_log->list_store = list_store;
+       latexila.action_log.list_store = list_store;
        
        GtkWidget *list_view = gtk_tree_view_new_with_model (
                        GTK_TREE_MODEL (list_store));
-       latexila.action_log->list_view = GTK_TREE_VIEW (list_view);
+       latexila.action_log.list_view = GTK_TREE_VIEW (list_view);
        renderer = gtk_cell_renderer_text_new ();
        column = gtk_tree_view_column_new_with_attributes (
                        _("Action history"), renderer, "text", COLUMN_ACTION_TITLE, NULL);      
-       gtk_tree_view_append_column (latexila.action_log->list_view, column);
+       gtk_tree_view_append_column (latexila.action_log.list_view, column);
        
        // hide "Action history"
        //gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (list_view), FALSE);
 
        GtkTreeSelection *select =
-               gtk_tree_view_get_selection (latexila.action_log->list_view);
-       latexila.action_log->list_selection = select;
+               gtk_tree_view_get_selection (latexila.action_log.list_view);
+       latexila.action_log.list_selection = select;
        gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
        g_signal_connect (G_OBJECT (select), "changed",
                        G_CALLBACK (cb_action_list_changed), NULL);
@@ -241,8 +236,8 @@ main (int argc, char *argv[])
        GtkTextBuffer *log_buffer = gtk_text_view_get_buffer (
                        GTK_TEXT_VIEW (log_view));
 
-       latexila.action_log->text_view = GTK_TEXT_VIEW (log_view);
-       latexila.action_log->text_buffer = log_buffer;
+       latexila.action_log.text_view = GTK_TEXT_VIEW (log_view);
+       latexila.action_log.text_buffer = log_buffer;
 
        gtk_text_buffer_set_text (log_buffer, _("Welcome to LaTeXila!"), -1);
        gtk_text_view_set_editable (GTK_TEXT_VIEW (log_view), FALSE);
@@ -261,7 +256,7 @@ main (int argc, char *argv[])
        gtk_text_buffer_create_tag (log_buffer, "error",
                        "foreground", "red",
                        NULL);
-       latexila.action_log->tag_table = gtk_text_buffer_get_tag_table (log_buffer);
+       latexila.action_log.tag_table = gtk_text_buffer_get_tag_table (log_buffer);
 
        /* statusbar */
        GtkWidget *statusbar = gtk_statusbar_new ();
@@ -280,10 +275,10 @@ main (int argc, char *argv[])
        /* show the window */
        gtk_widget_show_all (window);
 
-       if (! latexila.prefs->show_side_pane)
-               gtk_widget_hide (latexila.symbols->vbox);
+       if (! latexila.prefs.show_side_pane)
+               gtk_widget_hide (latexila.symbols.vbox);
 
-       if (! latexila.prefs->show_edit_toolbar)
+       if (! latexila.prefs.show_edit_toolbar)
                gtk_widget_hide (latexila.edit_toolbar);
 
        /* if --new-document option is used */
diff --git a/src/main.h b/src/main.h
index 78f4824..cc3dd3a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -88,9 +88,9 @@ typedef struct
 {
        GList                   *all_docs;
        document_t              *active_doc;
-       action_log_t    *action_log;
-       symbols_t               *symbols;
-       preferences_t   *prefs;
+       action_log_t    action_log;
+       symbols_t               symbols;
+       preferences_t   prefs;
        GtkWindow               *main_window;
        GtkNotebook             *notebook;
        GtkStatusbar    *statusbar;
diff --git a/src/prefs.c b/src/prefs.c
index f5ebff7..7160489 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -401,7 +401,7 @@ static void
 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;
+       latexila.prefs.show_line_numbers = show_line_numbers;
 
        if (latexila.active_doc == NULL)
                return;
@@ -422,9 +422,9 @@ static void
 cb_pref_font_set (GtkFontButton *font_button, gpointer user_data)
 {
        const gchar *font_string = gtk_font_button_get_font_name (font_button);
-       g_free (latexila.prefs->font_str);
-       latexila.prefs->font_str = g_strdup (font_string);
-       set_current_font_prefs (latexila.prefs);
+       g_free (latexila.prefs.font_str);
+       latexila.prefs.font_str = g_strdup (font_string);
+       set_current_font_prefs (&latexila.prefs);
        change_font_source_view ();
 }
 
@@ -433,8 +433,8 @@ cb_pref_command_view (GtkEditable *editable, gpointer user_data)
 {
        GtkEntry *entry = GTK_ENTRY (editable);
        const gchar *new_command_view = gtk_entry_get_text (entry);
-       g_free (latexila.prefs->command_view);
-       latexila.prefs->command_view = g_strdup (new_command_view);
+       g_free (latexila.prefs.command_view);
+       latexila.prefs.command_view = g_strdup (new_command_view);
 }
 
 static void
@@ -442,8 +442,8 @@ cb_pref_command_latex (GtkEditable *editable, gpointer user_data)
 {
        GtkEntry *entry = GTK_ENTRY (editable);
        const gchar *new_command = gtk_entry_get_text (entry);
-       g_free (latexila.prefs->command_latex);
-       latexila.prefs->command_latex = g_strdup (new_command);
+       g_free (latexila.prefs.command_latex);
+       latexila.prefs.command_latex = g_strdup (new_command);
 }
 
 static void
@@ -451,8 +451,8 @@ cb_pref_command_pdflatex (GtkEditable *editable, gpointer user_data)
 {
        GtkEntry *entry = GTK_ENTRY (editable);
        const gchar *new_command = gtk_entry_get_text (entry);
-       g_free (latexila.prefs->command_pdflatex);
-       latexila.prefs->command_pdflatex = g_strdup (new_command);
+       g_free (latexila.prefs.command_pdflatex);
+       latexila.prefs.command_pdflatex = g_strdup (new_command);
 }
 
 static void
@@ -460,8 +460,8 @@ cb_pref_command_dvipdf (GtkEditable *editable, gpointer user_data)
 {
        GtkEntry *entry = GTK_ENTRY (editable);
        const gchar *new_command = gtk_entry_get_text (entry);
-       g_free (latexila.prefs->command_dvipdf);
-       latexila.prefs->command_dvipdf = g_strdup (new_command);
+       g_free (latexila.prefs.command_dvipdf);
+       latexila.prefs.command_dvipdf = g_strdup (new_command);
 }
 
 static void
@@ -469,8 +469,8 @@ cb_pref_command_dvips (GtkEditable *editable, gpointer user_data)
 {
        GtkEntry *entry = GTK_ENTRY (editable);
        const gchar *new_command = gtk_entry_get_text (entry);
-       g_free (latexila.prefs->command_dvips);
-       latexila.prefs->command_dvips = g_strdup (new_command);
+       g_free (latexila.prefs.command_dvips);
+       latexila.prefs.command_dvips = g_strdup (new_command);
 }
 
 static void
@@ -494,7 +494,7 @@ create_preferences (void)
        GtkWidget *line_numbers = gtk_check_button_new_with_label (
                        _("Display line numbers"));
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (line_numbers),
-                       latexila.prefs->show_line_numbers);
+                       latexila.prefs.show_line_numbers);
        g_signal_connect (G_OBJECT (line_numbers), "toggled",
                        G_CALLBACK (cb_pref_line_numbers), NULL);
        gtk_box_pack_start (GTK_BOX (content_area), line_numbers, FALSE, FALSE, 0);
@@ -503,7 +503,7 @@ create_preferences (void)
        GtkWidget *hbox = gtk_hbox_new (FALSE, 5);
        GtkWidget *label = gtk_label_new (_("Font:"));
        GtkWidget *font_button = gtk_font_button_new_with_font (
-                       latexila.prefs->font_str);
+                       latexila.prefs.font_str);
        g_signal_connect (G_OBJECT (font_button), "font-set",
                        G_CALLBACK (cb_pref_font_set), NULL);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -515,7 +515,7 @@ create_preferences (void)
        label = gtk_label_new (_("Program for viewing documents:"));
        GtkWidget *command_view_entry = gtk_entry_new ();
        gtk_entry_set_text (GTK_ENTRY (command_view_entry),
-                       latexila.prefs->command_view);
+                       latexila.prefs.command_view);
        g_signal_connect (G_OBJECT (command_view_entry), "changed",
                        G_CALLBACK (cb_pref_command_view), NULL);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -529,7 +529,7 @@ create_preferences (void)
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
        GtkWidget *command_latex = gtk_entry_new ();
        gtk_entry_set_text (GTK_ENTRY (command_latex),
-                       latexila.prefs->command_latex);
+                       latexila.prefs.command_latex);
        g_signal_connect (G_OBJECT (command_latex), "changed",
                        G_CALLBACK (cb_pref_command_latex), NULL);
        gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
@@ -539,7 +539,7 @@ create_preferences (void)
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
        GtkWidget *command_pdflatex = gtk_entry_new ();
        gtk_entry_set_text (GTK_ENTRY (command_pdflatex),
-                       latexila.prefs->command_pdflatex);
+                       latexila.prefs.command_pdflatex);
        g_signal_connect (G_OBJECT (command_pdflatex), "changed",
                        G_CALLBACK (cb_pref_command_pdflatex), NULL);
        gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
@@ -549,7 +549,7 @@ create_preferences (void)
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
        GtkWidget *command_dvipdf = gtk_entry_new ();
        gtk_entry_set_text (GTK_ENTRY (command_dvipdf),
-                       latexila.prefs->command_dvipdf);
+                       latexila.prefs.command_dvipdf);
        g_signal_connect (G_OBJECT (command_dvipdf), "changed",
                        G_CALLBACK (cb_pref_command_dvipdf), NULL);
        gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
@@ -559,7 +559,7 @@ create_preferences (void)
        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
        GtkWidget *command_dvips = gtk_entry_new ();
        gtk_entry_set_text (GTK_ENTRY (command_dvips),
-                       latexila.prefs->command_dvips);
+                       latexila.prefs.command_dvips);
        g_signal_connect (G_OBJECT (command_dvips), "changed",
                        G_CALLBACK (cb_pref_command_dvips), NULL);
        gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
diff --git a/src/symbols.c b/src/symbols.c
index 94317c8..c73a27c 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -835,32 +835,32 @@ init_symbols (void)
        g_signal_connect (G_OBJECT (categories_view), "selection-changed",
                        G_CALLBACK (cb_category_symbols_selected), NULL);
 
-       gtk_box_pack_start (GTK_BOX (latexila.symbols->vbox), categories_view, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (latexila.symbols.vbox), categories_view, FALSE, FALSE, 0);
 
        // store all the symbols
-       // Attention, we must save the GtkListStore in latexila.symbols->list_stores
+       // Attention, we must save the GtkListStore in latexila.symbols.list_stores
        // in the same order than the structure "categories" above
-       latexila.symbols->list_stores[0] = get_symbol_store (symbols_greek);
-       latexila.symbols->list_stores[1] = get_symbol_store (symbols_arrows);
-       latexila.symbols->list_stores[2] = get_symbol_store (symbols_relations);
-       latexila.symbols->list_stores[3] = get_symbol_store (symbols_operators);
-       latexila.symbols->list_stores[4] = get_symbol_store (symbols_delimiters);
-       latexila.symbols->list_stores[5] = get_symbol_store (symbols_misc_math);
-       latexila.symbols->list_stores[6] = get_symbol_store (symbols_misc_text);
+       latexila.symbols.list_stores[0] = get_symbol_store (symbols_greek);
+       latexila.symbols.list_stores[1] = get_symbol_store (symbols_arrows);
+       latexila.symbols.list_stores[2] = get_symbol_store (symbols_relations);
+       latexila.symbols.list_stores[3] = get_symbol_store (symbols_operators);
+       latexila.symbols.list_stores[4] = get_symbol_store (symbols_delimiters);
+       latexila.symbols.list_stores[5] = get_symbol_store (symbols_misc_math);
+       latexila.symbols.list_stores[6] = get_symbol_store (symbols_misc_text);
 
        // show the symbols
        GtkWidget *symbol_view = gtk_icon_view_new_with_model (
-                       GTK_TREE_MODEL (latexila.symbols->list_stores[0]));
-       latexila.symbols->icon_view = GTK_ICON_VIEW (symbol_view);
-       gtk_icon_view_set_pixbuf_column (latexila.symbols->icon_view,
+                       GTK_TREE_MODEL (latexila.symbols.list_stores[0]));
+       latexila.symbols.icon_view = GTK_ICON_VIEW (symbol_view);
+       gtk_icon_view_set_pixbuf_column (latexila.symbols.icon_view,
                        COLUMN_SYMBOL_PIXBUF);
-       gtk_icon_view_set_tooltip_column (latexila.symbols->icon_view,
+       gtk_icon_view_set_tooltip_column (latexila.symbols.icon_view,
                        COLUMN_SYMBOL_TOOLTIP);
-       gtk_icon_view_set_selection_mode (latexila.symbols->icon_view,
+       gtk_icon_view_set_selection_mode (latexila.symbols.icon_view,
                        GTK_SELECTION_SINGLE);
-       gtk_icon_view_set_spacing (latexila.symbols->icon_view, 0);
-       gtk_icon_view_set_row_spacing (latexila.symbols->icon_view, 0);
-       gtk_icon_view_set_column_spacing (latexila.symbols->icon_view, 0);
+       gtk_icon_view_set_spacing (latexila.symbols.icon_view, 0);
+       gtk_icon_view_set_row_spacing (latexila.symbols.icon_view, 0);
+       gtk_icon_view_set_column_spacing (latexila.symbols.icon_view, 0);
 
        g_signal_connect (G_OBJECT (symbol_view), "selection-changed",
                        G_CALLBACK (cb_symbol_selected), NULL);
@@ -870,7 +870,7 @@ init_symbols (void)
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollbar),
                        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
        gtk_container_add (GTK_CONTAINER (scrollbar), symbol_view);
-       gtk_box_pack_start (GTK_BOX (latexila.symbols->vbox), scrollbar, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (latexila.symbols.vbox), scrollbar, TRUE, TRUE, 0);
 }
 
 void
@@ -887,16 +887,16 @@ cb_category_symbols_selected (GtkIconView *icon_view, gpointer user_data)
                gtk_tree_model_get (model, &iter, COLUMN_CAT_NUM, &num, -1);
 
                // change the model
-               gtk_icon_view_set_model (latexila.symbols->icon_view,
-                               GTK_TREE_MODEL (latexila.symbols->list_stores[num]));
+               gtk_icon_view_set_model (latexila.symbols.icon_view,
+                               GTK_TREE_MODEL (latexila.symbols.list_stores[num]));
 
                // TODO scroll to the start
                /* this doesn't work...
                GtkTreePath *first_path = gtk_icon_view_get_path_at_pos (
-                               latexila.symbols->icon_view, 0, 0);
+                               latexila.symbols.icon_view, 0, 0);
                if (first_path != NULL)
                {
-                       gtk_icon_view_scroll_to_path (latexila.symbols->icon_view, first_path,
+                       gtk_icon_view_scroll_to_path (latexila.symbols.icon_view, first_path,
                                        TRUE, 0.0, 0.0);
                }
                */
diff --git a/src/ui.c b/src/ui.c
index c17c70f..6ce7c53 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -375,10 +375,10 @@ init_ui (GtkWidget *box)
        GtkToggleAction *show_symbol_tables = GTK_TOGGLE_ACTION (
                        gtk_action_group_get_action (action_group, "ViewSymbols"));
        gtk_toggle_action_set_active (show_symbol_tables,
-                       latexila.prefs->show_side_pane);
+                       latexila.prefs.show_side_pane);
 
        GtkToggleAction *show_edit_toolbar = GTK_TOGGLE_ACTION (
                        gtk_action_group_get_action (action_group, "ViewEditToolbar"));
        gtk_toggle_action_set_active (show_edit_toolbar,
-                       latexila.prefs->show_edit_toolbar);
+                       latexila.prefs.show_edit_toolbar);
 }


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