Fixed style_init() related errors
authorMarijn van Vliet <marijn.vanvliet@med.kuleuven.be>
Sun, 22 Nov 2009 14:28:51 +0000 (14:28 +0000)
committerMarijn van Vliet <marijn.vanvliet@med.kuleuven.be>
Sun, 22 Nov 2009 14:28:51 +0000 (14:28 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@175 ddfedd41-794f-dd11-ae45-00112f111e67

libchimara/style.c
libchimara/window.c

index 24e9833dfff1bb2a4c7f842b9e0d86dfe3122cb2..e4169d6a6aa5ade98c58a7ec43dc04e8057c7eed 100644 (file)
@@ -826,6 +826,10 @@ get_current_font(guint32 wintype)
        ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
        GtkTextTag *normal;
 
+       if( G_UNLIKELY(!glk_data->style_initialized) ) {
+               style_init();
+       }
+
        switch(wintype) {
        case wintype_TextGrid:
                normal = g_hash_table_lookup(glk_data->current_styles->text_grid, "normal");
index 574069043e77238960dfe7b252626988a7ff1b0f..edb241f88a4c34fdf34369409c3da24ecccbae3d 100644 (file)
@@ -474,7 +474,8 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
                    gtk_text_view_set_editable( GTK_TEXT_VIEW(textview), FALSE );
                        gtk_widget_show(textview);
                                
-                       /* Set the window's font */
+                       /* Create the styles available to the window stream */
+                       style_init_textgrid(textbuffer);
                        gtk_widget_modify_font( textview, get_current_font(wintype) );
                    
                    win->widget = textview;
@@ -496,9 +497,6 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
                        gtk_widget_add_events( textview, GDK_BUTTON_RELEASE_MASK );
                        win->mouse_click_handler = g_signal_connect_after( G_OBJECT(textview), "button-release-event", G_CALLBACK(on_window_button_release_event), win );
                        g_signal_handler_block( textview, win->mouse_click_handler );
-
-                       /* Create the styles available to the window stream */
-                       style_init_textgrid(textbuffer);
                }
                    break;
                
@@ -519,7 +517,8 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
                        gtk_container_add( GTK_CONTAINER(scrolledwindow), textview );
                        gtk_widget_show_all(scrolledwindow);
 
-                       /* Set the window's font */
+                       /* Create the styles available to the window stream */
+                       style_init_textbuffer(textbuffer);
                        gtk_widget_modify_font( textview, get_current_font(wintype) );
                        
                        win->widget = textview;
@@ -548,9 +547,6 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype,
                        (for line input) */
                        gtk_text_buffer_create_tag(textbuffer, "uneditable", "editable", FALSE, "editable-set", TRUE, NULL);
 
-                       /* Create the styles available to the window stream */
-                       style_init_textbuffer(textbuffer);
-
                        /* Mark the position where the user will input text */
                        GtkTextIter end;
                        gtk_text_buffer_get_end_iter(textbuffer, &end);