From 26333fb20c304d1b4e5d6fbf81ad99542d4354f1 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sat, 11 Jan 2014 22:03:36 +0100 Subject: [PATCH] Run D-Bus service all the time Signed-off-by: Sebastian Ramacher --- config.c | 2 +- zathura.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config.c b/config.c index 1e61b88..0e9b0b0 100644 --- a/config.c +++ b/config.c @@ -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); diff --git a/zathura.c b/zathura.c index dcfca92..c473786 100644 --- a/zathura.c +++ b/zathura.c @@ -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) {