No issues found
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) version 3.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with the program; if not, see <http://www.gnu.org/licenses/>
14 *
15 */
16
17 #ifdef HAVE_CONFIG_H
18 #include <config.h>
19 #endif
20
21 #include <gtk/gtk.h>
22 #include <glib/gi18n.h>
23
24 #include <mail/em-config.h>
25
26 #include <shell/e-shell.h>
27 #include <libedataserver/libedataserver.h>
28 #include <libecal/libecal.h>
29 #include <modules/itip-formatter/e-conflict-search-selector.h>
30 #include <modules/itip-formatter/e-source-conflict-search.h>
31
32 #define CONF_KEY_DELETE "delete-processed"
33
34 GtkWidget *itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data);
35 gint e_plugin_lib_enable (EPlugin *ep, gint enable);
36
37 gint
38 e_plugin_lib_enable (EPlugin *ep,
39 gint enable)
40 {
41 return 0;
42 }
43
44 static void
45 delete_toggled_cb (GtkWidget *widget)
46 {
47 GSettings *settings;
48 gboolean active;
49
50 settings = g_settings_new ("org.gnome.evolution.plugin.itip");
51 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
52 g_settings_set_boolean (settings, CONF_KEY_DELETE, active);
53 g_object_unref (settings);
54 }
55
56 GtkWidget *
57 itip_formatter_page_factory (EPlugin *ep,
58 EConfigHookItemFactoryData *hook_data)
59 {
60 EShell *shell;
61 ESourceRegistry *registry;
62 GtkWidget *page;
63 GtkWidget *tab_label;
64 GtkWidget *frame;
65 GtkWidget *frame_label;
66 GtkWidget *padding_label;
67 GtkWidget *hbox;
68 GtkWidget *inner_vbox;
69 GtkWidget *check;
70 GtkWidget *label;
71 GtkWidget *ess;
72 GtkWidget *scrolledwin;
73 gchar *str;
74 GSettings *settings;
75
76 shell = e_shell_get_default ();
77 registry = e_shell_get_registry (shell);
78
79 /* Create a new notebook page */
80 page = gtk_vbox_new (FALSE, 0);
81 gtk_container_set_border_width (GTK_CONTAINER (page), 12);
82 tab_label = gtk_label_new (_("Meeting Invitations"));
83 gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label);
84
85 /* Frame */
86 frame = gtk_vbox_new (FALSE, 6);
87 gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
88
89 /* "General" */
90 frame_label = gtk_label_new ("");
91 str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("General"));
92 gtk_label_set_markup (GTK_LABEL (frame_label), str);
93 g_free (str);
94 gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
95 gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0);
96
97 /* Indent/padding */
98 hbox = gtk_hbox_new (FALSE, 12);
99 gtk_box_pack_start (GTK_BOX (frame), hbox, FALSE, TRUE, 0);
100 padding_label = gtk_label_new ("");
101 gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0);
102 inner_vbox = gtk_vbox_new (FALSE, 6);
103 gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0);
104
105 /* Delete message after acting */
106 settings = g_settings_new ("org.gnome.evolution.plugin.itip");
107
108 check = gtk_check_button_new_with_mnemonic (_("_Delete message after acting"));
109 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), g_settings_get_boolean (settings, CONF_KEY_DELETE));
110 g_signal_connect (
111 check, "toggled",
112 G_CALLBACK (delete_toggled_cb), NULL);
113 gtk_box_pack_start (GTK_BOX (inner_vbox), check, FALSE, FALSE, 0);
114
115 g_object_unref (settings);
116
117 /* "Conflict searching" */
118 frame = gtk_vbox_new (FALSE, 6);
119 gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 24);
120
121 frame_label = gtk_label_new ("");
122 str = g_strdup_printf ("<span weight=\"bold\">%s</span>", _("Conflict Search"));
123 gtk_label_set_markup (GTK_LABEL (frame_label), str);
124 g_free (str);
125 gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
126 gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0);
127
128 /* Indent/padding */
129 hbox = gtk_hbox_new (FALSE, 12);
130 gtk_box_pack_start (GTK_BOX (frame), hbox, TRUE, TRUE, 0);
131 padding_label = gtk_label_new ("");
132 gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0);
133 inner_vbox = gtk_vbox_new (FALSE, 6);
134 gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, TRUE, TRUE, 0);
135
136 /* Source selector */
137 label = gtk_label_new (_("Select the calendars to search for meeting conflicts"));
138 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
139 gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0);
140
141 scrolledwin = gtk_scrolled_window_new (NULL, NULL);
142
143 gtk_scrolled_window_set_policy (
144 GTK_SCROLLED_WINDOW (scrolledwin),
145 GTK_POLICY_AUTOMATIC,
146 GTK_POLICY_AUTOMATIC);
147 gtk_scrolled_window_set_shadow_type (
148 GTK_SCROLLED_WINDOW (scrolledwin),
149 GTK_SHADOW_IN);
150 gtk_box_pack_start (GTK_BOX (inner_vbox), scrolledwin, TRUE, TRUE, 0);
151
152 ess = e_conflict_search_selector_new (registry);
153 atk_object_set_name (gtk_widget_get_accessible (ess), _("Conflict Search"));
154 gtk_container_add (GTK_CONTAINER (scrolledwin), ess);
155
156 gtk_widget_show_all (page);
157
158 return page;
159 }