diff --git a/src/ui/itemview.c b/src/ui/itemview.c index 9568266a5..976c878cb 100644 --- a/src/ui/itemview.c +++ b/src/ui/itemview.c @@ -400,17 +400,8 @@ itemview_set_layout (nodeViewType newMode) itemlist_unload (); /* Prepare widgets for layout */ - if (!itemview->htmlview) { - debug0 (DEBUG_GUI, "Creating HTML widget"); - itemview->htmlview = liferea_browser_new (FALSE); - g_signal_connect (itemview->htmlview, "statusbar-changed", - G_CALLBACK (on_important_status_message), NULL); - - /* Set initial zoom */ - liferea_browser_set_zoom (itemview->htmlview, itemview->zoom/100.); - } else { - liferea_browser_clear (itemview->htmlview); - } + g_assert (itemview->htmlview); + liferea_browser_clear (itemview->htmlview); debug2 (DEBUG_GUI, "Setting item list layout mode: %d (auto=%d)", effectiveMode, itemview->autoLayout); @@ -507,6 +498,14 @@ itemview_create (GtkWidget *window) itemview->zoom = zoom; itemview->currentLayoutMode = 1000; // something invalid + debug0 (DEBUG_GUI, "Creating HTML widget"); + itemview->htmlview = liferea_browser_new (FALSE); + g_signal_connect (itemview->htmlview, "statusbar-changed", + G_CALLBACK (on_important_status_message), NULL); + + /* Set initial zoom */ + liferea_browser_set_zoom (itemview->htmlview, itemview->zoom/100.); + return itemview; } diff --git a/src/ui/liferea_shell.c b/src/ui/liferea_shell.c index 7acf99894..0501eba1f 100644 --- a/src/ui/liferea_shell.c +++ b/src/ui/liferea_shell.c @@ -1318,20 +1318,7 @@ liferea_shell_create (GtkApplication *app, const gchar *overrideWindowState, gin gtk_grid_attach_next_to (GTK_GRID (liferea_shell_lookup ("vbox1")), shell->toolbar, NULL, GTK_POS_TOP, 1,1); gtk_widget_show_all(GTK_WIDGET(shell->toolbar)); - - g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "key_press_event", - G_CALLBACK (on_key_press_event_null_cb), NULL); - - g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "key_release_event", - G_CALLBACK (on_key_press_event_null_cb), NULL); - - g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "scroll_event", - G_CALLBACK (on_notebook_scroll_event_null_cb), NULL); - - g_signal_connect (G_OBJECT (shell->window), "delete_event", G_CALLBACK(on_close), NULL); - g_signal_connect (G_OBJECT (shell->window), "window_state_event", G_CALLBACK(on_window_state_event), shell); - g_signal_connect (G_OBJECT (shell->window), "configure_event", G_CALLBACK(on_configure_event), shell); - g_signal_connect (G_OBJECT (shell->window), "key_press_event", G_CALLBACK(on_key_press_event), shell); + render_init_theme_colors (GTK_WIDGET (shell->window)); g_signal_connect (G_OBJECT (shell->window), "style-updated", G_CALLBACK(liferea_shell_rebuild_css), NULL); /* 3.) setup status bar */ @@ -1383,7 +1370,6 @@ liferea_shell_create (GtkApplication *app, const gchar *overrideWindowState, gin icons_load (); /* 9.) update and restore all menu elements */ - liferea_shell_update_toolbar (); liferea_shell_update_history_actions (); liferea_shell_setup_URL_receiver (); @@ -1391,20 +1377,8 @@ liferea_shell_create (GtkApplication *app, const gchar *overrideWindowState, gin gtk_widget_set_sensitive (GTK_WIDGET (shell->feedlistViewWidget), TRUE); - /* 10.) After main window is realized get theme colors and set up feed list */ - // FIXME: this should not be necessary, but style-updated does not - // always fire before we get here - render_init_theme_colors (GTK_WIDGET (shell->window)); - + /* 10.) Set up feed list */ shell->feedlist = feedlist_create (feedListView); - g_signal_connect (shell->feedlist, "new-items", - G_CALLBACK (liferea_shell_update_unread_stats), shell->feedlist); - g_signal_connect (shell->feedlist, "items-updated", - G_CALLBACK (liferea_shell_update_node_actions), NULL); - g_signal_connect (shell->itemlist, "item-updated", - G_CALLBACK (liferea_shell_update_node_actions), NULL); - g_signal_connect (feedListView, "selection-changed", - G_CALLBACK (liferea_shell_update_node_actions), NULL); /* 11.) Restore latest layout and selection */ conf_get_int_value (DEFAULT_VIEW_MODE, &mode); @@ -1416,7 +1390,31 @@ liferea_shell_create (GtkApplication *app, const gchar *overrideWindowState, gin g_free (id); } - /* 12. Setup shell plugins */ + /* 12. Setup shell window signals, only after all widgets are ready */ + g_signal_connect (shell->feedlist, "new-items", + G_CALLBACK (liferea_shell_update_unread_stats), shell->feedlist); + g_signal_connect (shell->feedlist, "items-updated", + G_CALLBACK (liferea_shell_update_node_actions), NULL); + g_signal_connect (shell->itemlist, "item-updated", + G_CALLBACK (liferea_shell_update_node_actions), NULL); + g_signal_connect (feedListView, "selection-changed", + G_CALLBACK (liferea_shell_update_node_actions), NULL); + + g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "key_press_event", + G_CALLBACK (on_key_press_event_null_cb), NULL); + + g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "key_release_event", + G_CALLBACK (on_key_press_event_null_cb), NULL); + + g_signal_connect ((gpointer) liferea_shell_lookup ("itemtabs"), "scroll_event", + G_CALLBACK (on_notebook_scroll_event_null_cb), NULL); + + g_signal_connect (G_OBJECT (shell->window), "delete_event", G_CALLBACK(on_close), NULL); + g_signal_connect (G_OBJECT (shell->window), "window_state_event", G_CALLBACK(on_window_state_event), shell); + g_signal_connect (G_OBJECT (shell->window), "configure_event", G_CALLBACK(on_configure_event), shell); + g_signal_connect (G_OBJECT (shell->window), "key_press_event", G_CALLBACK(on_key_press_event), shell); + + /* 13. Setup shell plugins */ if(0 == pluginsDisabled) { shell->extensions = peas_extension_set_new (PEAS_ENGINE (liferea_plugins_engine_get_default ()), LIFEREA_TYPE_SHELL_ACTIVATABLE, "shell", shell, NULL);