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
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Shakti Sen <shprasad@novell.com>
* Copyright (C) 2005 Novell, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <gtk/gtkdialog.h>
#include <gconf/gconf-client.h>
#include <libedataserver/e-xml-hash-utils.h>
#include <exchange/exchange-account.h>
#include <e-util/e-dialog-utils.h>
#include "exchange-config-listener.h"
#include "exchange-operations.h"
#include <mail/em-popup.h>
#include <mail/em-menu.h>
static void org_folder_permissions_cb (EPopup *ep, EPopupItem *p, void *data);
void org_gnome_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t);
void org_gnome_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *target);
gchar *selected_exchange_folder_uri = NULL;
static EPopupItem popup_items[] = {
{ E_POPUP_ITEM, "40.emc.30", N_("Permissions..."), org_folder_permissions_cb, NULL, "stock_new-dir", 0, EM_POPUP_FOLDER_INFERIORS }
};
static void
popup_free (EPopup *ep, GSList *items, void *data)
{
g_slist_free (items);
}
void
org_gnome_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t)
{
GSList *menus = NULL;
int i = 0;
static int first =1;
GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
for (acc = accounts; acc; acc = acc->next) {
account = acc->data;
}
folder = exchange_account_get_folder (account, t->uri);
if (!folder)
return;
if (! g_strrstr (t->uri, "exchange://") && !folder)
return ;
selected_exchange_folder_uri = t->uri;
/* for translation*/
if (first) {
popup_items[0].label = _(popup_items[0].label);
}
first++;
for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++)
menus = g_slist_prepend (menus, &popup_items[i]);
e_popup_add_items (t->target.popup, menus, NULL, popup_free, NULL);
}
static void
org_folder_permissions_cb (EPopup *ep, EPopupItem *p, void *data)
{
GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
for (acc = accounts; acc; acc = acc->next) {
account = acc->data;
}
folder = exchange_account_get_folder (account, selected_exchange_folder_uri);
if (folder)
exchange_permissions_dialog_new (account, folder, NULL);
}
void
org_gnome_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *target)
{
GSList *accounts, *acc;
ExchangeAccount *account = NULL;
EFolder *folder = NULL;
if (target == NULL)
return;
accounts = exchange_config_listener_get_accounts (exchange_global_config_listener);
for (acc = accounts; acc; acc = acc->next) {
account = acc->data;
}
folder = exchange_account_get_folder (account, target->uri);
if (folder)
exchange_permissions_dialog_new (account, folder, NULL);
}
|