1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-memo-shell-view-actions.c
*
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "e-memo-shell-view-private.h"
#include <e-util/gconf-bridge.h>
#include "print.h"
static void
action_memo_clipboard_copy_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
EMemoTable *memo_table;
memos = E_MEMOS (memo_shell_view->priv->memos);
memo_table = e_memos_get_calendar_table (memos);
e_memo_table_copy_clipboard (memo_table);
}
static void
action_memo_clipboard_cut_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
EMemoTable *memo_table;
memos = E_MEMOS (memo_shell_view->priv->memos);
memo_table = e_memos_get_calendar_table (memos);
e_memo_table_cut_clipboard (memo_table);
}
static void
action_memo_clipboard_paste_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
EMemoTable *memo_table;
memos = E_MEMOS (memo_shell_view->priv->memos);
memo_table = e_memos_get_calendar_table (memos);
e_memo_table_paste_clipboard (memo_table);
}
static void
action_memo_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
memos = E_MEMOS (memo_shell_view->priv->memos);
e_memos_delete_selected (memos);
}
static void
action_memo_list_copy_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
/* FIXME */
}
static void
action_memo_list_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
/* FIXME */
}
static void
action_memo_list_new_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EShellView *shell_view;
EShellWindow *shell_window;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
calendar_setup_new_memo_list (GTK_WINDOW (shell_window));
}
static void
action_memo_list_properties_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EShellView *shell_view;
EShellWindow *shell_window;
ESource *source;
ESourceSelector *selector;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
selector = E_SOURCE_SELECTOR (memo_shell_view->priv->selector);
source = e_source_selector_peek_primary_selection (selector);
g_return_if_fail (source != NULL);
calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
}
static void
action_memo_open_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
memos = E_MEMOS (memo_shell_view->priv->memos);
e_memos_open_memo (memos);
}
static void
action_memo_preview_cb (GtkToggleAction *action,
EMemoShellView *memo_shell_view)
{
/* FIXME */
}
static void
action_memo_print_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
ETable *table;
EMemoTable *memo_table;
memos = E_MEMOS (memo_shell_view->priv->memos);
memo_table = e_memos_get_calendar_table (memos);
table = e_memo_table_get_table (memo_table);
print_table (
table, _("Print Memos"), _("Memos"),
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
}
static void
action_memo_print_preview_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemos *memos;
ETable *table;
EMemoTable *memo_table;
memos = E_MEMOS (memo_shell_view->priv->memos);
memo_table = e_memos_get_calendar_table (memos);
table = e_memo_table_get_table (memo_table);
print_table (
table, _("Print Memos"), _("Memos"),
GTK_PRINT_OPERATION_ACTION_PREVIEW);
}
static GtkActionEntry memo_entries[] = {
{ "memo-clipboard-copy",
GTK_STOCK_COPY,
NULL,
NULL,
N_("Copy selected memo"),
G_CALLBACK (action_memo_clipboard_copy_cb) },
{ "memo-clipboard-cut",
GTK_STOCK_CUT,
NULL,
NULL,
N_("Cut selected memo"),
G_CALLBACK (action_memo_clipboard_cut_cb) },
{ "memo-clipboard-paste",
GTK_STOCK_PASTE,
NULL,
NULL,
N_("Paste memo from the clipboard"),
G_CALLBACK (action_memo_clipboard_paste_cb) },
{ "memo-delete",
GTK_STOCK_DELETE,
NULL,
NULL,
N_("Delete selected memos"),
G_CALLBACK (action_memo_delete_cb) },
{ "memo-list-copy",
GTK_STOCK_COPY,
N_("_Copy..."),
NULL,
NULL, /* XXX Add a tooltip! */
G_CALLBACK (action_memo_list_copy_cb) },
{ "memo-list-delete",
GTK_STOCK_DELETE,
N_("_Delete"),
NULL,
NULL, /* XXX Add a tooltip! */
G_CALLBACK (action_memo_list_delete_cb) },
{ "memo-list-new",
"stock_notes",
N_("_New Memo List"),
NULL,
N_("Create a new memo list"),
G_CALLBACK (action_memo_list_new_cb) },
{ "memo-list-properties",
GTK_STOCK_PROPERTIES,
NULL,
NULL,
NULL, /* XXX Add a tooltip! */
G_CALLBACK (action_memo_list_properties_cb) },
{ "memo-open",
NULL,
N_("Open Memo"),
"<Control>o",
N_("View the selected memo"),
G_CALLBACK (action_memo_open_cb) },
{ "memo-print",
GTK_STOCK_PRINT,
NULL,
NULL,
N_("Print the list of memos"),
G_CALLBACK (action_memo_print_cb) },
{ "memo-print-preview",
GTK_STOCK_PRINT_PREVIEW,
NULL,
NULL,
N_("Preview the list of memos to be printed"),
G_CALLBACK (action_memo_print_preview_cb) },
};
static GtkToggleActionEntry memo_toggle_entries[] = {
{ "memo-preview",
NULL,
N_("Memo _Preview"),
"<Control>m",
N_("Show memo preview pane"),
G_CALLBACK (action_memo_preview_cb),
TRUE }
};
void
e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
{
EShellView *shell_view;
EShellWindow *shell_window;
GtkActionGroup *action_group;
GtkUIManager *manager;
GConfBridge *bridge;
GObject *object;
const gchar *domain;
const gchar *key;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
manager = e_shell_window_get_ui_manager (shell_window);
domain = GETTEXT_PACKAGE;
e_load_ui_definition (manager, "evolution-memos.ui");
action_group = memo_shell_view->priv->memo_actions;
gtk_action_group_set_translation_domain (action_group, domain);
gtk_action_group_add_actions (
action_group, memo_entries,
G_N_ELEMENTS (memo_entries), memo_shell_view);
gtk_action_group_add_toggle_actions (
action_group, memo_toggle_entries,
G_N_ELEMENTS (memo_toggle_entries), memo_shell_view);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
/* Bind GObject properties to GConf keys. */
bridge = gconf_bridge_get ();
object = G_OBJECT (ACTION (MEMO_PREVIEW));
key = "/apps/evolution/calendar/display/show_memo_preview";
gconf_bridge_bind_property (bridge, key, object, "active");
}
void
e_memo_shell_view_actions_update (EMemoShellView *memo_shell_view)
{
ECal *cal;
EMemos *memos;
ETable *table;
ECalModel *model;
EMemoTable *memo_table;
EShellView *shell_view;
EShellWindow *shell_window;
GtkAction *action;
gboolean read_only = TRUE;
gboolean sensitive;
gint n_selected;
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
memos = E_MEMOS (memo_shell_view->priv->memos);
memo_table = e_memos_get_calendar_table (memos);
model = e_memo_table_get_model (memo_table);
cal = e_cal_model_get_default_client (model);
table = e_memo_table_get_table (memo_table);
n_selected = e_table_selected_count (table);
if (cal != NULL)
e_cal_is_read_only (cal, &read_only, NULL);
action = ACTION (MEMO_OPEN);
sensitive = (n_selected == 1);
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_CLIPBOARD_COPY);
sensitive = (n_selected > 0);
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_CLIPBOARD_CUT);
sensitive = (n_selected > 0);
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_CLIPBOARD_PASTE);
sensitive = !read_only;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_DELETE);
sensitive = (n_selected > 0) && !read_only;
gtk_action_set_sensitive (action, sensitive);
}
|