Initialize girara after parsing the configuration

This commit is contained in:
Moritz Lipp 2011-04-25 17:41:45 +02:00
parent 9f5430e449
commit 68bda8550f

View file

@ -94,11 +94,6 @@ zathura_init(int argc, char* argv[])
goto error_out;
}
zathura->ui.session->gtk.embed = embed;
if (girara_session_init(zathura->ui.session) == false) {
goto error_out;
}
zathura->ui.session->global.data = zathura;
zathura->ui.statusbar.file = NULL;
zathura->ui.statusbar.buffer = NULL;
@ -106,6 +101,29 @@ zathura_init(int argc, char* argv[])
zathura->ui.page_view = NULL;
zathura->ui.index = NULL;
/* load plugins */
zathura_document_plugins_load(zathura);
/* configuration */
config_load_default(zathura);
/* load global configuration files */
config_load_file(zathura, GLOBAL_RC);
/* load local configuration files */
char* configuration_file = g_build_filename(zathura->config.config_dir, ZATHURA_RC, NULL);
config_load_file(zathura, configuration_file);
free(configuration_file);
/* initialize girara */
zathura->ui.session->gtk.embed = embed;
if (girara_session_init(zathura->ui.session) == false) {
goto error_out;
}
/* girara events */
zathura->ui.session->events.buffer_changed = buffer_changed;
/* page view */
zathura->ui.page_view = gtk_table_new(0, 0, TRUE);
if (!zathura->ui.page_view) {
@ -120,9 +138,6 @@ zathura_init(int argc, char* argv[])
gtk_widget_show(zathura->ui.page_view);
/* Put the table in the main window */
// gtk_container_add(GTK_CONTAINER (zathura->ui.page_view), table);
/* statusbar */
zathura->ui.statusbar.file = girara_statusbar_item_add(zathura->ui.session, TRUE, TRUE, TRUE, NULL);
if (zathura->ui.statusbar.file == NULL) {
@ -144,23 +159,6 @@ zathura_init(int argc, char* argv[])
/* signals */
g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL);
/* girara events */
zathura->ui.session->events.buffer_changed = buffer_changed;
/* load plugins */
zathura_document_plugins_load(zathura);
/* configuration */
config_load_default(zathura);
/* load global configuration files */
config_load_file(zathura, GLOBAL_RC);
/* load local configuration files */
char* configuration_file = g_build_filename(zathura->config.config_dir, ZATHURA_RC, NULL);
config_load_file(zathura, configuration_file);
free(configuration_file);
/* save page padding */
int* page_padding = girara_setting_get(zathura->ui.session, "page-padding");
zathura->global.page_padding = (page_padding) ? *page_padding : 1;