diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/exchange-operations/ChangeLog | 13 | ||||
-rw-r--r-- | plugins/exchange-operations/Makefile.am | 6 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-account-setup.c | 15 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-delegates-user.c | 8 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-delegates.c | 2 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-permissions-dialog.c | 3 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-user-dialog.c | 257 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-user-dialog.h | 37 |
8 files changed, 324 insertions, 17 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index 3ff61f47fb..be613cf169 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,3 +1,16 @@ +2005-07-08 Praveen Kumar <kpraveen@novell.com> + + * Makefile.am : Added entries for the files providing the delegation + assistant feature + * exchange-user-dialog.c : Added new + * exchange-user-dialog.h : Added new + * exchange-account-setup.c (btn_dass_clicked) : Enabled the code for + for invoking the delegation assistant window + * exchange-delegates-user.c : Modified to include the header files + from include path instead of the local directory + * exchange-permissions-dialog.c : Modified an occurence to include + the file exchange-user-dialog.c instead of e2k-folder-dialog.c + 2005-07-08 Shakti Sen <shprasad@novell.com> * Makefile.am: Included files exchange-permissions-dialog.c, diff --git a/plugins/exchange-operations/Makefile.am b/plugins/exchange-operations/Makefile.am index 62224c70fc..554436ad17 100644 --- a/plugins/exchange-operations/Makefile.am +++ b/plugins/exchange-operations/Makefile.am @@ -24,6 +24,12 @@ liborg_gnome_exchange_operations_la_SOURCES = \ exchange-contacts.c \ exchange-change-password.c \ exchange-change-password.h \ + exchange-delegates-user.c \ + exchange-delegates-user.h \ + exchange-delegates.c \ + exchange-delegates.h \ + exchange-user-dialog.c \ + exchange-user-dialog.h \ exchange-folder-size-display.c \ exchange-folder-size-display.h \ exchange-account-setup.c \ diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index 34a527ee39..aeb0e2ea5f 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -46,6 +46,7 @@ #include "exchange-folder-size-display.h" #include "mail/em-account-editor.h" #include "mail/em-config.h" +#include "exchange-delegates.h" GtkWidget* org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data); @@ -135,16 +136,8 @@ static void btn_dass_clicked (GtkButton *button, gpointer data) { ExchangeAccount *account; - GSList *acclist; - - acclist = exchange_config_listener_get_accounts (exchange_global_config_listener); - - /* FIXME: For now, we have only one account in the list. - Find a way to handle multiple accounts. - */ - account = acclist->data; - - /* TODO: Put delegate assistant display code here */ + account = exchange_operations_get_exchange_account (); + exchange_delegates (account, gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW)); } static void @@ -330,8 +323,8 @@ org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data) lbl_dass = (GtkLabel*) gtk_object_new (GTK_TYPE_LABEL, "label", _("Manage the delegate settings for Exchange account"), NULL); gtk_misc_set_alignment (GTK_MISC (lbl_dass), 0, 0.5); btn_dass = (GtkButton*) gtk_object_new (GTK_TYPE_BUTTON, "label", _("Delegation Assitant")); + gtk_signal_connect (GTK_OBJECT (btn_chpass), "clicked", G_CALLBACK (btn_chpass_clicked), NULL); gtk_signal_connect (GTK_OBJECT (btn_dass), "clicked", G_CALLBACK (btn_dass_clicked), NULL); - /* Add items to the table */ gtk_table_attach_defaults (tbl_auth, GTK_WIDGET (lbl_chpass), 0, 1, 0, 1); gtk_table_attach (tbl_auth, GTK_WIDGET (btn_chpass), 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); diff --git a/plugins/exchange-operations/exchange-delegates-user.c b/plugins/exchange-operations/exchange-delegates-user.c index 38166747f4..38f82563e5 100644 --- a/plugins/exchange-operations/exchange-delegates-user.c +++ b/plugins/exchange-operations/exchange-delegates-user.c @@ -25,10 +25,10 @@ #include "exchange-delegates-user.h" -#include "e2k-global-catalog.h" -#include "e2k-marshal.h" -#include "e2k-sid.h" -#include "e2k-utils.h" +#include <e2k-global-catalog.h> +#include <e2k-marshal.h> +#include <e2k-sid.h> +#include <e2k-utils.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-dialog-widgets.h> diff --git a/plugins/exchange-operations/exchange-delegates.c b/plugins/exchange-operations/exchange-delegates.c index 0721e523ac..e706c55f36 100644 --- a/plugins/exchange-operations/exchange-delegates.c +++ b/plugins/exchange-operations/exchange-delegates.c @@ -30,13 +30,13 @@ #include "exchange-delegates.h" #include "exchange-delegates-user.h" +#include "exchange-user-dialog.h" #include <exchange-account.h> #include <e2k-propnames.h> #include <e2k-security-descriptor.h> #include <e2k-sid.h> #include <e2k-uri.h> -#include <e2k-user-dialog.h> #include <e2k-utils.h> #include <e-util/e-dialog-utils.h> diff --git a/plugins/exchange-operations/exchange-permissions-dialog.c b/plugins/exchange-operations/exchange-permissions-dialog.c index 7274061e6f..f707f30382 100644 --- a/plugins/exchange-operations/exchange-permissions-dialog.c +++ b/plugins/exchange-operations/exchange-permissions-dialog.c @@ -23,13 +23,14 @@ #include "exchange-permissions-dialog.h" #include "exchange-hierarchy.h" +#include "exchange-user-dialog.h" #include "e2k-context.h" #include "e2k-global-catalog.h" #include "e2k-propnames.h" #include "e2k-sid.h" #include "e2k-security-descriptor.h" -#include "e2k-user-dialog.h" + #include "e2k-uri.h" #include "e2k-utils.h" #include "e-folder-exchange.h" diff --git a/plugins/exchange-operations/exchange-user-dialog.c b/plugins/exchange-operations/exchange-user-dialog.c new file mode 100644 index 0000000000..a9c78cc493 --- /dev/null +++ b/plugins/exchange-operations/exchange-user-dialog.c @@ -0,0 +1,257 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* Copyright (C) 2001-2004 Novell, Inc. + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "exchange-user-dialog.h" +#include "e2k-types.h" + +#include <bonobo-activation/bonobo-activation.h> +#include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-widget.h> +#include <e-util/e-gtk-utils.h> +#include <e-util/e-dialog-utils.h> +#include <gtk/gtkbutton.h> +#include <gtk/gtkhbox.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkstock.h> +#include <gtk/gtkvbox.h> +#include <libedataserverui/e-name-selector.h> +#include "e2k-xml-utils.h" + +struct _E2kUserDialogPrivate { + char *section_name; + ENameSelector *name_selector; + GtkWidget *entry, *parent_window; +}; + +#define PARENT_TYPE GTK_TYPE_DIALOG +static GtkDialogClass *parent_class; + +static void parent_window_destroyed (gpointer dialog, GObject *where_parent_window_was); + +static void +finalize (GObject *object) +{ + E2kUserDialog *dialog = E2K_USER_DIALOG (object); + + g_free (dialog->priv->section_name); + g_free (dialog->priv); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +dispose (GObject *object) +{ + E2kUserDialog *dialog = E2K_USER_DIALOG (object); + + if (dialog->priv->name_selector != NULL) { + g_object_unref (dialog->priv->name_selector); + dialog->priv->name_selector = NULL; + } + + if (dialog->priv->parent_window) { + g_object_weak_unref (G_OBJECT (dialog->priv->parent_window), + parent_window_destroyed, dialog); + dialog->priv->parent_window = NULL; + } + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +class_init (E2kUserDialogClass *class) +{ + GObjectClass *object_class = (GObjectClass *) class; + + parent_class = g_type_class_ref (GTK_TYPE_DIALOG); + + object_class->dispose = dispose; + object_class->finalize = finalize; +} + +static void +init (E2kUserDialog *dialog) +{ + dialog->priv = g_new0 (E2kUserDialogPrivate, 1); + + gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 6); +} + +E2K_MAKE_TYPE (e2k_user_dialog, E2kUserDialog, class_init, init, PARENT_TYPE) + + + +static void +parent_window_destroyed (gpointer user_data, GObject *where_parent_window_was) +{ + E2kUserDialog *dialog = user_data; + + dialog->priv->parent_window = NULL; + gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); +} + +static void +addressbook_dialog_response (ENameSelectorDialog *name_selector_dialog, gint response, gpointer data) +{ + gtk_widget_hide (GTK_WIDGET (name_selector_dialog)); +} + +static void +addressbook_clicked_cb (GtkWidget *widget, gpointer data) +{ + E2kUserDialog *dialog = data; + E2kUserDialogPrivate *priv; + ENameSelectorDialog *name_selector_dialog; + + priv = dialog->priv; + + name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector); + gtk_window_set_modal (GTK_WINDOW (dialog), FALSE); + gtk_widget_show (GTK_WIDGET (name_selector_dialog)); +} + +static gboolean +e2k_user_dialog_construct (E2kUserDialog *dialog, + GtkWidget *parent_window, + const char *label_text, + const char *section_name) +{ + E2kUserDialogPrivate *priv; + GtkWidget *hbox, *vbox, *label, *button; + ENameSelectorModel *name_selector_model; + ENameSelectorDialog *name_selector_dialog; + + gtk_window_set_title (GTK_WINDOW (dialog), _("Select User")); + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + e_dialog_set_transient_for (GTK_WINDOW (dialog), parent_window); + + priv = dialog->priv; + priv->section_name = g_strdup (section_name); + + priv->parent_window = parent_window; + g_object_weak_ref (G_OBJECT (parent_window), + parent_window_destroyed, dialog); + + /* Set up the actual select names bits */ + priv->name_selector = e_name_selector_new (); + + /* Listen for responses whenever the dialog is shown */ + name_selector_dialog = e_name_selector_peek_dialog (priv->name_selector); + g_signal_connect (name_selector_dialog, "response", + G_CALLBACK (addressbook_dialog_response), dialog); + + name_selector_model = e_name_selector_peek_model (priv->name_selector); + /* FIXME Limit to one user */ + e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL); + + hbox = gtk_hbox_new (FALSE, 6); + + label = gtk_label_new (label_text); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); + + /* The vbox is a workaround for bug 43315 */ + vbox = gtk_vbox_new (FALSE, 0); + priv->entry = GTK_WIDGET (e_name_selector_peek_section_entry (priv->name_selector, section_name)); + gtk_box_pack_start (GTK_BOX (vbox), priv->entry, TRUE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 6); + + button = gtk_button_new_with_label (_("Addressbook...")); + g_signal_connect (button, "clicked", + G_CALLBACK (addressbook_clicked_cb), + dialog); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 6); + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, + TRUE, TRUE, 6); + gtk_widget_show_all (hbox); + + return TRUE; +} + +/** + * e2k_user_dialog_new: + * @parent_window: The window invoking the dialog. + * @label_text: Text to label the entry in the initial dialog with + * @section_name: The section name for the select-names dialog + * + * Creates a new user selection dialog. + * + * Return value: A newly-created user selection dialog, or %NULL if + * the dialog could not be created. + **/ +GtkWidget * +e2k_user_dialog_new (GtkWidget *parent_window, + const char *label_text, const char *section_name) +{ + E2kUserDialog *dialog; + + g_return_val_if_fail (GTK_IS_WINDOW (parent_window), NULL); + g_return_val_if_fail (label_text != NULL, NULL); + g_return_val_if_fail (section_name != NULL, NULL); + + dialog = g_object_new (E2K_TYPE_USER_DIALOG, NULL); + if (!e2k_user_dialog_construct (dialog, parent_window, + label_text, section_name)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + return NULL; + } + + return GTK_WIDGET (dialog); +} + +/** + * e2k_user_dialog_get_user: + * @dialog: the dialog + * + * Gets the email address of the selected user from the dialog. + * + * Return value: the email address, which must be freed with g_free(). + **/ +char * +e2k_user_dialog_get_user (E2kUserDialog *dialog) +{ + E2kUserDialogPrivate *priv; + EDestinationStore *destination_store; + GList *destinations; + EDestination *destination; + gchar *result = NULL; + + g_return_val_if_fail (E2K_IS_USER_DIALOG (dialog), NULL); + + priv = dialog->priv; + + destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (priv->entry)); + destinations = e_destination_store_list_destinations (destination_store); + if (!destinations) + return NULL; + + destination = destinations->data; + result = g_strdup (e_destination_get_email (destination)); + g_list_free (destinations); + + return result; +} diff --git a/plugins/exchange-operations/exchange-user-dialog.h b/plugins/exchange-operations/exchange-user-dialog.h new file mode 100644 index 0000000000..b212172b85 --- /dev/null +++ b/plugins/exchange-operations/exchange-user-dialog.h @@ -0,0 +1,37 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* Copyright (C) 2001-2004 Novell, Inc. */ + +#ifndef __E2K_USER_DIALOG_H__ +#define __E2K_USER_DIALOG_H__ + +#include <gtk/gtkdialog.h> + +#define E2K_TYPE_USER_DIALOG (e2k_user_dialog_get_type ()) +#define E2K_USER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_USER_DIALOG, E2kUserDialog)) +#define E2K_USER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_USER_DIALOG, \ + E2kUserDialogClass)) +#define E2K_IS_USER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_USER_DIALOG)) +#define E2K_IS_USER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E2K_TYPE_USER_DIALOG)) + +typedef struct _E2kUserDialog E2kUserDialog; +typedef struct _E2kUserDialogClass E2kUserDialogClass; +typedef struct _E2kUserDialogPrivate E2kUserDialogPrivate; + +struct _E2kUserDialog { + GtkDialog parent; + + /* Private data */ + E2kUserDialogPrivate *priv; +}; + +struct _E2kUserDialogClass { + GtkDialogClass parent_class; +}; + +GType e2k_user_dialog_get_type (void); +GtkWidget *e2k_user_dialog_new (GtkWidget *parent_window, + const char *label_text, + const char *section_name); +char *e2k_user_dialog_get_user (E2kUserDialog *dialog); + +#endif /* __E2K_USER_DIALOG_H__ */ |