Run D-Bus service all the time

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-01-11 22:03:36 +01:00
parent 7e2c0f2e1e
commit 26333fb20c
2 changed files with 14 additions and 14 deletions

View File

@ -213,7 +213,7 @@ config_load_default(zathura_t* zathura)
bool_value = false;
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "synctex-dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service for synctex forward synchronization support"), NULL, NULL);
girara_setting_add(gsession, "dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service"), NULL, NULL);
string_value = "primary";
girara_setting_add(gsession, "selection-clipboard", string_value, STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);

View File

@ -229,6 +229,13 @@ zathura_init(zathura_t* zathura)
zathura->jumplist.size = 0;
zathura->jumplist.cur = NULL;
/* Start D-Bus service */
bool synctex_dbus = true;
girara_setting_get(zathura->ui.session, "dbus-service", &synctex_dbus);
if (synctex_dbus == true) {
zathura->synctex.dbus = zathura_synctex_dbus_new(zathura);
}
return true;
error_free:
@ -253,6 +260,12 @@ zathura_free(zathura_t* zathura)
document_close(zathura, false);
/* stop D-Bus */
if (zathura->synctex.dbus != NULL) {
g_object_unref(zathura->synctex.dbus);
zathura->synctex.dbus = NULL;
}
if (zathura->ui.session != NULL) {
girara_session_destroy(zathura->ui.session);
}
@ -786,13 +799,6 @@ document_open(zathura_t* zathura, const char* path, const char* password,
position_set(zathura, file_info.position_x, file_info.position_y);
}
/* Start D-Bus service for synctex forward synchronization */
bool synctex_dbus = true;
girara_setting_get(zathura->ui.session, "synctex-dbus-service", &synctex_dbus);
if (synctex_dbus == true) {
zathura->synctex.dbus = zathura_synctex_dbus_new(zathura);
}
return true;
error_free:
@ -875,12 +881,6 @@ document_close(zathura_t* zathura, bool keep_monitor)
/* stop rendering */
zathura_renderer_stop(zathura->sync.render_thread);
/* stop D-Bus */
if (zathura->synctex.dbus != NULL) {
g_object_unref(zathura->synctex.dbus);
zathura->synctex.dbus = NULL;
}
/* remove monitor */
if (keep_monitor == false) {
if (zathura->file_monitor.monitor != NULL) {