From ffd9bc6151435337ee70f87496ef5d5def24d20c Mon Sep 17 00:00:00 2001 From: Ricardo Mones Date: Wed, 21 Oct 2015 22:54:47 +0200 Subject: [PATCH] =?utf8?q?Fix=20bug=20#3151=20=E2=80=98loaded=20vCalendar?= =?utf8?q?=20plugin=20"disables"=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit …gnome-shells calendar view entries’ --- src/plugins/vcalendar/plugin.c | 10 +++++++--- src/plugins/vcalendar/vcal_dbus.c | 2 ++ src/plugins/vcalendar/vcal_prefs.c | 26 ++++++++++++++++++++++++++ src/plugins/vcalendar/vcal_prefs.h | 1 + 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/plugins/vcalendar/plugin.c b/src/plugins/vcalendar/plugin.c index 023620bc7..90de1664a 100644 --- a/src/plugins/vcalendar/plugin.c +++ b/src/plugins/vcalendar/plugin.c @@ -36,6 +36,7 @@ #include "plugin.h" #include "vcal_dbus.h" +#include "vcal_prefs.h" gint plugin_init(gchar **error) { @@ -47,15 +48,18 @@ gint plugin_init(gchar **error) curl_global_init(CURL_GLOBAL_DEFAULT); vcalendar_init(); - connect_dbus(); + if (vcalprefs.calendar_server) + connect_dbus(); - return 0; + return 0; } gboolean plugin_done(void) { - disconnect_dbus(); + if (vcalprefs.calendar_server) + disconnect_dbus(); vcalendar_done(); + return TRUE; } diff --git a/src/plugins/vcalendar/vcal_dbus.c b/src/plugins/vcalendar/vcal_dbus.c index 8cb185454..38d86b32e 100644 --- a/src/plugins/vcalendar/vcal_dbus.c +++ b/src/plugins/vcalendar/vcal_dbus.c @@ -176,6 +176,7 @@ static void bus_acquired(GDBusConnection *connection, void connect_dbus(void) { + debug_print("connect_dbus() invoked\n"); introspection_data = g_dbus_node_info_new_for_xml( introspection_xml, NULL); if (introspection_data == NULL) { @@ -198,6 +199,7 @@ void connect_dbus(void) void disconnect_dbus(void) { + debug_print("disconnect_dbus() invoked\n"); g_bus_unown_name(dbus_own_id); } diff --git a/src/plugins/vcalendar/vcal_prefs.c b/src/plugins/vcalendar/vcal_prefs.c index 859b8932f..64ea6da56 100644 --- a/src/plugins/vcalendar/vcal_prefs.c +++ b/src/plugins/vcalendar/vcal_prefs.c @@ -38,6 +38,7 @@ #include "vcalendar.h" #include "vcal_prefs.h" #include "vcal_folder.h" +#include "vcal_dbus.h" #define PREFS_BLOCK_NAME "VCalendar" @@ -70,6 +71,7 @@ struct VcalendarPage GtkWidget *freebusy_get_url_entry; GtkWidget *ssl_verify_peer_checkbtn; + GtkWidget *calendar_server_checkbtn; }; VcalendarPrefs vcalprefs; @@ -115,6 +117,9 @@ static PrefParam param[] = { {"ssl_verify_peer", "TRUE", &vcalprefs.ssl_verify_peer, P_BOOL, NULL, NULL, NULL}, + {"calendar_server", "FALSE", &vcalprefs.calendar_server, P_BOOL, + NULL, NULL, NULL}, + {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL} }; @@ -208,6 +213,16 @@ void register_orage_checkbtn_toggled(GtkToggleButton *toggle_btn, vcalprefs.orage_registered = gtk_toggle_button_get_active(toggle_btn); } +void calendar_server_checkbtn_toggled(GtkToggleButton *toggle, GtkWidget *widget) +{ + gboolean active = gtk_toggle_button_get_active(toggle); + if (active) + connect_dbus(); + else + disconnect_dbus(); + vcalprefs.calendar_server = active; +} + static void vcal_prefs_create_widget_func(PrefsPage * _page, GtkWindow * window, gpointer data) @@ -230,6 +245,7 @@ static void vcal_prefs_create_widget_func(PrefsPage * _page, GtkWidget *export_command_label; GtkWidget *export_command_entry; GtkWidget *register_orage_checkbtn; + GtkWidget *calendar_server_checkbtn; GtkWidget *export_user_label; GtkWidget *export_user_entry; @@ -399,6 +415,16 @@ static void vcal_prefs_create_widget_func(PrefsPage * _page, gtk_widget_show (register_orage_checkbtn); gtk_box_pack_start(GTK_BOX (hbox3), register_orage_checkbtn, TRUE, TRUE, 0); + calendar_server_checkbtn = gtk_check_button_new_with_label(_("Export as GNOME shell calendar server")); + CLAWS_SET_TIP(calendar_server_checkbtn, + _("Register D-Bus calendar server interface to export Claws Mail's calendar")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(calendar_server_checkbtn), + vcalprefs.calendar_server); + g_signal_connect(G_OBJECT(calendar_server_checkbtn), "toggled", + G_CALLBACK(calendar_server_checkbtn_toggled), NULL); + gtk_widget_show(calendar_server_checkbtn); + gtk_box_pack_start(GTK_BOX(hbox3), calendar_server_checkbtn, TRUE, TRUE, 0); + /* freebusy export */ /* export enable + path stuff */ PACK_FRAME(vbox2, frame_freebusy_export, _("Free/Busy information")); diff --git a/src/plugins/vcalendar/vcal_prefs.h b/src/plugins/vcalendar/vcal_prefs.h index fd4637a2e..11475fa04 100644 --- a/src/plugins/vcalendar/vcal_prefs.h +++ b/src/plugins/vcalendar/vcal_prefs.h @@ -43,6 +43,7 @@ struct _VcalendarPrefs gchar *export_freebusy_pass; gboolean orage_registered; gboolean ssl_verify_peer; + gboolean calendar_server; }; extern VcalendarPrefs vcalprefs; -- 2.25.1