From 17ccb42efb09717a26d7bfceee7a18ad67d71411 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 25 Sep 2009 10:25:40 +0200 Subject: Bug #593609 - Have buildable exchange-operations plugin again --- plugins/exchange-operations/Makefile.am | 31 +- .../e-foreign-folder-dialog.glade | 220 -------- .../exchange-operations/exchange-account-setup.c | 1 - .../exchange-operations/exchange-change-password.c | 142 +++-- .../exchange-change-password.glade | 243 -------- .../exchange-operations/exchange-config-listener.c | 189 +++++-- .../exchange-operations/exchange-delegates-user.c | 195 +++++-- plugins/exchange-operations/exchange-delegates.c | 94 +++- .../exchange-operations/exchange-delegates.glade | 542 ------------------ .../exchange-folder-permission.c | 616 ++++++++++++++------- .../exchange-folder-size-display.c | 52 +- .../exchange-folder-subscription.c | 100 +++- .../exchange-folder-subscription.h | 7 + .../exchange-operations/exchange-folder-tree.glade | 92 --- plugins/exchange-operations/exchange-folder.c | 371 ++++--------- plugins/exchange-operations/exchange-oof.glade | 530 ------------------ plugins/exchange-operations/exchange-operations.h | 2 +- .../exchange-passwd-expiry.glade | 91 --- .../exchange-permissions-dialog.c | 292 ++++++++-- .../exchange-permissions-dialog.glade | 578 ------------------- .../exchange-operations/exchange-send-options.c | 210 ++++--- .../exchange-send-options.glade | 405 -------------- plugins/exchange-operations/exchange-user-dialog.c | 3 +- .../org-gnome-exchange-ab-subscription.xml | 15 - .../org-gnome-exchange-cal-subscription.xml | 15 - .../org-gnome-exchange-operations.eplug.xml | 298 ++++------ .../org-gnome-exchange-tasks-subscription.xml | 15 - .../org-gnome-folder-permissions.xml | 14 - .../org-gnome-folder-subscription.xml | 16 - 29 files changed, 1574 insertions(+), 3805 deletions(-) delete mode 100644 plugins/exchange-operations/e-foreign-folder-dialog.glade delete mode 100644 plugins/exchange-operations/exchange-change-password.glade delete mode 100644 plugins/exchange-operations/exchange-delegates.glade delete mode 100644 plugins/exchange-operations/exchange-folder-tree.glade delete mode 100644 plugins/exchange-operations/exchange-oof.glade delete mode 100644 plugins/exchange-operations/exchange-passwd-expiry.glade delete mode 100644 plugins/exchange-operations/exchange-permissions-dialog.glade delete mode 100644 plugins/exchange-operations/exchange-send-options.glade delete mode 100644 plugins/exchange-operations/org-gnome-exchange-ab-subscription.xml delete mode 100644 plugins/exchange-operations/org-gnome-exchange-cal-subscription.xml delete mode 100644 plugins/exchange-operations/org-gnome-exchange-tasks-subscription.xml delete mode 100644 plugins/exchange-operations/org-gnome-folder-permissions.xml delete mode 100644 plugins/exchange-operations/org-gnome-folder-subscription.xml (limited to 'plugins') diff --git a/plugins/exchange-operations/Makefile.am b/plugins/exchange-operations/Makefile.am index 933da521a1..1e7cdd1deb 100644 --- a/plugins/exchange-operations/Makefile.am +++ b/plugins/exchange-operations/Makefile.am @@ -5,19 +5,12 @@ AM_CPPFLAGS = -I . \ -I$(top_builddir)/composer \ -I$(top_builddir)/mail \ $(CAMEL_EXCHANGE_CFLAGS) \ - $(EVOLUTION_MAIL_CFLAGS) \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DCONNECTOR_GLADEDIR=\""$(gladedir)"\" + $(EVOLUTION_MAIL_CFLAGS) @EVO_PLUGIN_RULE@ -plugin_DATA = org-gnome-exchange-operations.eplug \ - org-gnome-folder-permissions.xml \ - org-gnome-folder-subscription.xml \ - org-gnome-exchange-tasks-subscription.xml \ - org-gnome-exchange-cal-subscription.xml \ - org-gnome-exchange-ab-subscription.xml +plugin_DATA = org-gnome-exchange-operations.eplug plugin_LTLIBRARIES = liborg-gnome-exchange-operations.la @@ -52,36 +45,20 @@ liborg_gnome_exchange_operations_la_SOURCES = \ liborg_gnome_exchange_operations_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ + $(top_builddir)/shell/libeshell.la \ $(top_builddir)/calendar/gui/libevolution-calendar.la \ $(top_builddir)/mail/libevolution-mail.la \ - $(top_builddir)/addressbook/gui/component/libevolution-addressbook.la \ $(CAMEL_EXCHANGE_LIBS) \ $(EVOLUTION_MAIL_LIBS) liborg_gnome_exchange_operations_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -glade_DATA = \ - exchange-change-password.glade \ - exchange-delegates.glade \ - exchange-folder-tree.glade \ - exchange-permissions-dialog.glade \ - e-foreign-folder-dialog.glade \ - exchange-passwd-expiry.glade \ - exchange-oof.glade \ - exchange-send-options.glade - error_DATA = org-gnome-exchange-operations.error errordir = $(privdatadir)/errors EXTRA_DIST = \ org-gnome-exchange-operations.eplug.xml \ - org-gnome-exchange-operations.error.xml \ - org-gnome-folder-permissions.xml \ - org-gnome-folder-subscription.xml \ - org-gnome-exchange-tasks-subscription.xml \ - org-gnome-exchange-cal-subscription.xml \ - org-gnome-exchange-ab-subscription.xml \ - $(glade_DATA) + org-gnome-exchange-operations.error.xml BUILT_SOURCES = $(error_DATA) org-gnome-exchange-operations.eplug diff --git a/plugins/exchange-operations/e-foreign-folder-dialog.glade b/plugins/exchange-operations/e-foreign-folder-dialog.glade deleted file mode 100644 index 7390e561ce..0000000000 --- a/plugins/exchange-operations/e-foreign-folder-dialog.glade +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - True - Open Other User's Folder - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 3 - 2 - False - 3 - 3 - - - - True - _Account: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Folder Name: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - False - 0 - - - - - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - True - _User: - True - GTK_RELIEF_NORMAL - True - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - a -b - False - True - True - - - 1 - 2 - 2 - 3 - fill - fill - - - - - - True - a -b - False - True - - - 1 - 2 - 0 - 1 - fill - fill - - - - - 2 - True - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index 5943d5f3df..f1b64d3afc 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/plugins/exchange-operations/exchange-change-password.c b/plugins/exchange-operations/exchange-change-password.c index 82382f6f9f..68e93ab9e5 100644 --- a/plugins/exchange-operations/exchange-change-password.c +++ b/plugins/exchange-operations/exchange-change-password.c @@ -29,38 +29,32 @@ #include #include -#include #include -#define FILENAME EVOLUTION_GLADEDIR "/exchange-change-password.glade" -#define ROOTNODE "pass_dialog" -#define STARTNODE "pass_vbox" - static void entry_changed (GtkEntry *entry, gpointer user_data) { - GladeXML *xml = user_data; GtkEntry *new_entry, *confirm_entry; - GtkWidget *ok_button; + GtkDialog *pass_dialog; const gchar *text; - new_entry = GTK_ENTRY (glade_xml_get_widget (xml, "new_pass_entry")); - confirm_entry = GTK_ENTRY (glade_xml_get_widget (xml, "confirm_pass_entry")); - ok_button = glade_xml_get_widget (xml, "okbutton1"); + new_entry = GTK_ENTRY (entry); + confirm_entry = GTK_ENTRY (user_data); + pass_dialog = GTK_DIALOG (g_object_get_data (G_OBJECT (new_entry), "pass_dialog")); text = gtk_entry_get_text (new_entry); if (!text || !*text) { - gtk_widget_set_sensitive (ok_button, FALSE); + gtk_dialog_set_response_sensitive (pass_dialog, GTK_RESPONSE_OK, FALSE); return; } text = gtk_entry_get_text (confirm_entry); if (!text || !*text) { - gtk_widget_set_sensitive (ok_button, FALSE); + gtk_dialog_set_response_sensitive (pass_dialog, GTK_RESPONSE_OK, FALSE); return; } - gtk_widget_set_sensitive (ok_button, TRUE); + gtk_dialog_set_response_sensitive (pass_dialog, GTK_RESPONSE_OK, TRUE); } /** @@ -74,52 +68,119 @@ entry_changed (GtkEntry *entry, gpointer user_data) gchar * exchange_get_new_password (const gchar *existing_password, gboolean voluntary) { - GladeXML *xml; - GtkWidget *top_widget; - GtkEntry *cur_entry, *new_entry, *confirm_entry; GtkResponseType response; - GtkLabel *top_label; gchar *new_pass; + GtkWidget *pass_dialog; + GtkWidget *dialog_vbox1; + GtkWidget *pass_label; + GtkWidget *table1; + GtkWidget *current_pass_label; + GtkWidget *new_pass_label; + GtkWidget *confirm_pass_label; + GtkWidget *current_pass_entry; + GtkWidget *new_pass_entry; + GtkWidget *confirm_pass_entry; + + pass_dialog = gtk_dialog_new_with_buttons ( + _("Change Password"), + NULL, + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (pass_dialog)); + gtk_widget_show (dialog_vbox1); + + pass_label = gtk_label_new (_("Your current password has expired. Please change your password now.")); + gtk_widget_show (pass_label); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), pass_label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (pass_label), GTK_JUSTIFY_CENTER); + gtk_label_set_line_wrap (GTK_LABEL (pass_label), TRUE); + gtk_misc_set_alignment (GTK_MISC (pass_label), 0.52, 0.5); + gtk_misc_set_padding (GTK_MISC (pass_label), 0, 6); + + table1 = gtk_table_new (3, 2, FALSE); + gtk_widget_show (table1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (table1), 6); + gtk_table_set_row_spacings (GTK_TABLE (table1), 6); + gtk_table_set_col_spacings (GTK_TABLE (table1), 6); + + current_pass_label = gtk_label_new_with_mnemonic (_("Current _Password:")); + gtk_widget_show (current_pass_label); + gtk_table_attach (GTK_TABLE (table1), current_pass_label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (current_pass_label), 0, 0.5); + + new_pass_label = gtk_label_new_with_mnemonic (_("_New Password:")); + gtk_widget_show (new_pass_label); + gtk_table_attach (GTK_TABLE (table1), new_pass_label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (new_pass_label), 0, 0.5); + + confirm_pass_label = gtk_label_new_with_mnemonic (_("_Confirm Password:")); + gtk_widget_show (confirm_pass_label); + gtk_table_attach (GTK_TABLE (table1), confirm_pass_label, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (confirm_pass_label), 0, 0.5); + + new_pass_entry = gtk_entry_new (); + gtk_widget_show (new_pass_entry); + gtk_table_attach (GTK_TABLE (table1), new_pass_entry, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_visibility (GTK_ENTRY (new_pass_entry), FALSE); + + confirm_pass_entry = gtk_entry_new (); + gtk_widget_show (confirm_pass_entry); + gtk_table_attach (GTK_TABLE (table1), confirm_pass_entry, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_visibility (GTK_ENTRY (confirm_pass_entry), FALSE); + + current_pass_entry = gtk_entry_new (); + gtk_widget_show (current_pass_entry); + gtk_table_attach (GTK_TABLE (table1), current_pass_entry, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 12); + gtk_entry_set_visibility (GTK_ENTRY (current_pass_entry), FALSE); + + g_object_set_data (G_OBJECT (new_pass_entry), "pass_dialog", pass_dialog); + g_object_set_data (G_OBJECT (confirm_pass_entry), "pass_dialog", pass_dialog); + g_signal_connect (new_pass_entry, "changed", G_CALLBACK (entry_changed), confirm_pass_entry); + g_signal_connect (confirm_pass_entry, "changed", G_CALLBACK (entry_changed), new_pass_entry); + entry_changed (GTK_ENTRY (new_pass_entry), confirm_pass_entry); - xml = glade_xml_new (FILENAME, ROOTNODE, NULL); - top_widget = glade_xml_get_widget (xml, ROOTNODE); - - cur_entry = GTK_ENTRY (glade_xml_get_widget (xml, "current_pass_entry")); - new_entry = GTK_ENTRY (glade_xml_get_widget (xml, "new_pass_entry")); - g_signal_connect (new_entry, "changed", - G_CALLBACK (entry_changed), xml); - confirm_entry = GTK_ENTRY (glade_xml_get_widget (xml, "confirm_pass_entry")); - g_signal_connect (confirm_entry, "changed", - G_CALLBACK (entry_changed), xml); - entry_changed (NULL, xml); - - top_label = GTK_LABEL (glade_xml_get_widget (xml, "pass_label")); if (voluntary) - gtk_widget_hide (GTK_WIDGET (top_label)); + gtk_widget_hide (GTK_WIDGET (pass_label)); run_dialog_again: - response = gtk_dialog_run (GTK_DIALOG (top_widget)); + response = gtk_dialog_run (GTK_DIALOG (pass_dialog)); if (response == GTK_RESPONSE_OK) { const gchar *cur_pass, *new_pass1, *new_pass2; - cur_pass = gtk_entry_get_text (cur_entry); - new_pass1 = gtk_entry_get_text (new_entry); - new_pass2 = gtk_entry_get_text (confirm_entry); + cur_pass = gtk_entry_get_text (GTK_ENTRY (current_pass_entry)); + new_pass1 = gtk_entry_get_text (GTK_ENTRY (new_pass_entry)); + new_pass2 = gtk_entry_get_text (GTK_ENTRY (confirm_pass_entry)); if (existing_password) { if (strcmp (cur_pass, existing_password) != 0) { /* User entered a wrong existing * password. Prompt him again. */ - gtk_label_set_text (top_label, _("The current password does not match the existing password for your account. Please enter the correct password")); - gtk_widget_show (GTK_WIDGET (top_label)); + gtk_label_set_text (GTK_LABEL (pass_label), _("The current password does not match the existing password for your account. Please enter the correct password")); + gtk_widget_show (pass_label); goto run_dialog_again; } } if (strcmp (new_pass1, new_pass2) != 0) { - gtk_label_set_text (top_label, _("The two passwords do not match. Please re-enter the passwords.")); - gtk_widget_show (GTK_WIDGET (top_label)); + gtk_label_set_text (GTK_LABEL (pass_label), _("The two passwords do not match. Please re-enter the passwords.")); + gtk_widget_show (pass_label); goto run_dialog_again; } @@ -127,8 +188,7 @@ run_dialog_again: } else new_pass = NULL; - gtk_widget_destroy (top_widget); - g_object_unref (xml); + gtk_widget_destroy (pass_dialog); return new_pass; } diff --git a/plugins/exchange-operations/exchange-change-password.glade b/plugins/exchange-operations/exchange-change-password.glade deleted file mode 100644 index ecff9028a4..0000000000 --- a/plugins/exchange-operations/exchange-change-password.glade +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - True - Change Password - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - True - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_SPREAD - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - Your current password has expired. Please change your password now. - False - False - GTK_JUSTIFY_CENTER - True - False - 0.52 - 0.5 - 0 - 6 - - - 0 - False - False - - - - - - 6 - True - 3 - 2 - False - 6 - 6 - - - - True - Current Password: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - New Password: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Confirm Password: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - True - True - False - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - True - True - True - False - 0 - - True - * - False - - - 1 - 2 - 2 - 3 - - - - - - - True - True - True - False - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - 12 - - - - - - 0 - True - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c index 2c16d2f9ab..dc6582ba71 100644 --- a/plugins/exchange-operations/exchange-config-listener.c +++ b/plugins/exchange-operations/exchange-config-listener.c @@ -23,6 +23,9 @@ #include #endif +#include +#include + #include "exchange-config-listener.h" #include "exchange-operations.h" #include "exchange-change-password.h" @@ -41,14 +44,10 @@ #include #include #include -#include #include #include -#define FILENAME CONNECTOR_GLADEDIR "/exchange-passwd-expiry.glade" -#define ROOTNODE "passwd_exp_dialog" - struct _ExchangeConfigListenerPrivate { GConfClient *gconf; guint idle_id; @@ -649,23 +648,52 @@ change_passwd_cb (GtkWidget *button, ExchangeAccount *account) static void display_passwd_expiry_message (gint max_passwd_age, ExchangeAccount *account) { - GladeXML *xml; - GtkWidget *top_widget, *change_passwd_button; GtkResponseType response; - GtkLabel *warning_msg_label; + GtkWidget *passwd_exp_dialog; + GtkWidget *dialog_vbox1; + GtkWidget *dialog_action_area1; + GtkWidget *change_passwd_button; + GtkWidget *warning_msg_label; + GtkWidget *ok_button; + AtkObject *atko; gchar *passwd_expiry_msg = g_strdup_printf (_("Your password will expire in the next %d days"), max_passwd_age); - xml = glade_xml_new (FILENAME, ROOTNODE, NULL); - g_return_if_fail (xml != NULL); - top_widget = glade_xml_get_widget (xml, ROOTNODE); - g_return_if_fail (top_widget != NULL); - warning_msg_label = GTK_LABEL (glade_xml_get_widget (xml, - "passwd_exp_label")); - gtk_label_set_text (warning_msg_label, passwd_expiry_msg); - change_passwd_button = glade_xml_get_widget (xml, - "change_passwd_button"); + passwd_exp_dialog = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (passwd_exp_dialog), _("Password Expiry Warning...")); + gtk_window_set_position (GTK_WINDOW (passwd_exp_dialog), GTK_WIN_POS_CENTER_ON_PARENT); + gtk_window_set_type_hint (GTK_WINDOW (passwd_exp_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (passwd_exp_dialog)); + gtk_widget_show (dialog_vbox1); + + warning_msg_label = gtk_label_new (passwd_expiry_msg); + gtk_widget_show (warning_msg_label); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), warning_msg_label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (warning_msg_label), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (warning_msg_label), 0, 20); + + dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (passwd_exp_dialog)); + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + change_passwd_button = gtk_button_new_with_mnemonic (_("_Change Password")); + gtk_widget_show (change_passwd_button); + gtk_dialog_add_action_widget (GTK_DIALOG (passwd_exp_dialog), change_passwd_button, 0); + GTK_WIDGET_SET_FLAGS (change_passwd_button, GTK_CAN_DEFAULT); + + ok_button = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_show (ok_button); + gtk_dialog_add_action_widget (GTK_DIALOG (passwd_exp_dialog), ok_button, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT); + + atko = gtk_widget_get_accessible (ok_button); + atk_object_set_name (atko, "ok_button"); + + gtk_widget_grab_focus (change_passwd_button); + gtk_widget_grab_default (change_passwd_button); + gtk_widget_set_sensitive (change_passwd_button, TRUE); #ifdef HAVE_KRB5 g_signal_connect (change_passwd_button, @@ -673,13 +701,113 @@ display_passwd_expiry_message (gint max_passwd_age, ExchangeAccount *account) G_CALLBACK (change_passwd_cb), account); #endif - response = gtk_dialog_run (GTK_DIALOG (top_widget)); + response = gtk_dialog_run (GTK_DIALOG (passwd_exp_dialog)); - gtk_widget_destroy (top_widget); - g_object_unref (xml); + gtk_widget_destroy (passwd_exp_dialog); g_free (passwd_expiry_msg); } +static gint +run_oof_dialog (void) +{ + GtkWidget *oof_dialog; + GtkWidget *dialog_vbox1; + GtkWidget *hbox9; + GtkWidget *image3; + GtkWidget *label7; + GtkWidget *dialog_action_area1; + GtkWidget *button3; + GtkWidget *alignment3; + GtkWidget *hbox6; + GtkWidget *image7; + GtkWidget *label10; + GtkWidget *button4; + GtkWidget *alignment4; + GtkWidget *hbox7; + GtkWidget *image8; + GtkWidget *label11; + gchar *tmp_str; + gint res; + + oof_dialog = gtk_dialog_new (); + gtk_container_set_border_width (GTK_CONTAINER (oof_dialog), 6); + gtk_window_set_title (GTK_WINDOW (oof_dialog), _("Out of Office Assistant")); + gtk_window_set_position (GTK_WINDOW (oof_dialog), GTK_WIN_POS_CENTER_ON_PARENT); + gtk_window_set_resizable (GTK_WINDOW (oof_dialog), FALSE); + gtk_window_set_type_hint (GTK_WINDOW (oof_dialog), GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (oof_dialog)); + gtk_widget_show (dialog_vbox1); + + hbox9 = gtk_hbox_new (FALSE, 6); + gtk_widget_show (hbox9); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox9, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox9), 6); + + image3 = gtk_image_new_from_stock ("gtk-dialog-question", GTK_ICON_SIZE_DIALOG); + gtk_widget_show (image3); + gtk_box_pack_start (GTK_BOX (hbox9), image3, FALSE, TRUE, 0); + + tmp_str = g_strconcat ("", _("Currently, your status is \"Out of the Office\"."), "\n\n", _("Would you like to change your status to \"In the Office\"?"), NULL); + label7 = gtk_label_new (tmp_str); + g_free (tmp_str); + gtk_widget_show (label7); + gtk_box_pack_start (GTK_BOX (hbox9), label7, TRUE, TRUE, 0); + gtk_label_set_use_markup (GTK_LABEL (label7), TRUE); + gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); + + dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (oof_dialog)); + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + button3 = gtk_button_new (); + gtk_widget_show (button3); + gtk_dialog_add_action_widget (GTK_DIALOG (oof_dialog), button3, GTK_RESPONSE_NO); + GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT); + + alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_widget_show (alignment3); + gtk_container_add (GTK_CONTAINER (button3), alignment3); + + hbox6 = gtk_hbox_new (FALSE, 2); + gtk_widget_show (hbox6); + gtk_container_add (GTK_CONTAINER (alignment3), hbox6); + + image7 = gtk_image_new_from_stock ("gtk-no", GTK_ICON_SIZE_BUTTON); + gtk_widget_show (image7); + gtk_box_pack_start (GTK_BOX (hbox6), image7, FALSE, FALSE, 0); + + label10 = gtk_label_new_with_mnemonic (_("_No, Don't Change Status")); + gtk_widget_show (label10); + gtk_box_pack_start (GTK_BOX (hbox6), label10, FALSE, FALSE, 0); + + button4 = gtk_button_new (); + gtk_widget_show (button4); + gtk_dialog_add_action_widget (GTK_DIALOG (oof_dialog), button4, GTK_RESPONSE_YES); + GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT); + + alignment4 = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_widget_show (alignment4); + gtk_container_add (GTK_CONTAINER (button4), alignment4); + + hbox7 = gtk_hbox_new (FALSE, 2); + gtk_widget_show (hbox7); + gtk_container_add (GTK_CONTAINER (alignment4), hbox7); + + image8 = gtk_image_new_from_stock ("gtk-yes", GTK_ICON_SIZE_BUTTON); + gtk_widget_show (image8); + gtk_box_pack_start (GTK_BOX (hbox7), image8, FALSE, FALSE, 0); + + label11 = gtk_label_new_with_mnemonic (_("_Yes, Change Status")); + gtk_widget_show (label11); + gtk_box_pack_start (GTK_BOX (hbox7), label11, FALSE, FALSE, 0); + + res = gtk_dialog_run (GTK_DIALOG (oof_dialog)); + gtk_widget_destroy (oof_dialog); + + return res; +} + ExchangeAccountResult exchange_config_listener_authenticate (ExchangeConfigListener *ex_conf_listener, ExchangeAccount *account) { @@ -787,9 +915,6 @@ exchange_config_listener_authenticate (ExchangeConfigListener *ex_conf_listener, } if (result == EXCHANGE_ACCOUNT_CONNECT_SUCCESS) { gint max_pwd_age_days; - GladeXML *xml; - GtkWidget *dialog; - GtkResponseType response; gboolean oof; /* check for password expiry warning */ @@ -802,25 +927,7 @@ exchange_config_listener_authenticate (ExchangeConfigListener *ex_conf_listener, if (exchange_oof_get (account, &oof, NULL)) { if (oof) { /* OOF state is set, check if user wants to set it back to in-office */ - xml = glade_xml_new (CONNECTOR_GLADEDIR "/exchange-oof.glade", - "oof_dialog", NULL); - if (!xml) { - e_error_run (NULL, "org-gnome-exchange-operations:state-update-error", NULL); - return result; - } - - dialog = glade_xml_get_widget (xml, "oof_dialog"); - if (!dialog) { - e_error_run (NULL, "org-gnome-exchange-operations:state-update-error", NULL); - g_object_unref (xml); - return result; - } - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - g_object_unref (xml); - - if (response == GTK_RESPONSE_YES) + if (run_oof_dialog () == GTK_RESPONSE_YES) if (!exchange_oof_set (account, FALSE, NULL)) e_error_run (NULL, "org-gnome-exchange-operations:state-update-error", NULL); } diff --git a/plugins/exchange-operations/exchange-delegates-user.c b/plugins/exchange-operations/exchange-delegates-user.c index 555b0ee73b..faf80619cb 100644 --- a/plugins/exchange-operations/exchange-delegates-user.c +++ b/plugins/exchange-operations/exchange-delegates-user.c @@ -29,8 +29,8 @@ #include "exchange-delegates-user.h" #include -#include #include +#include #include #include #include @@ -44,7 +44,6 @@ #include #include -#include #include @@ -75,10 +74,6 @@ static const gchar *folder_names_for_display[] = { N_("Calendar"), N_("Tasks"), N_("Inbox"), N_("Contacts") }; -static const gchar *widget_names[] = { - "calendar_perms_combobox", "task_perms_combobox", "inbox_perms_combobox", "contact_perms_combobox", -}; - enum { EDITED, LAST_SIGNAL @@ -206,69 +201,186 @@ exchange_delegates_user_edit (ExchangeAccount *account, ExchangeDelegatesUser *user, GtkWidget *parent_window) { - GladeXML *xml; - GtkWidget *dialog, *table, *label, *combobox, *check, *check_delegate; gchar *title; gint button, i; E2kPermissionsRole role; gboolean modified; + GtkWidget *delegate_permissions; + GtkWidget *dialog_vbox1; + GtkWidget *vbox3; + GtkWidget *delegate_label; + GtkWidget *folders_table; + GtkWidget *calendar_label; + GtkWidget *task_label; + GtkWidget *inbox_label; + GtkWidget *contact_label; + GtkWidget *calendar_perms_combobox; + GtkWidget *task_perms_combobox; + GtkWidget *inbox_perms_combobox; + GtkWidget *contact_perms_combobox; + GtkWidget *delegate_mail; + GtkWidget *see_private_checkbox; + GtkWidget *combobox, *comboboxes[EXCHANGE_DELEGATES_LAST]; g_return_val_if_fail (EXCHANGE_IS_DELEGATES_USER (user), FALSE); g_return_val_if_fail (E2K_IS_SID (user->sid), FALSE); - /* Grab the Glade widgets */ - xml = glade_xml_new ( - CONNECTOR_GLADEDIR "/exchange-delegates.glade", - "delegate_permissions", PACKAGE); - g_return_val_if_fail (xml, FALSE); - - title = g_strdup (_("Delegate Permissions")); - - dialog = glade_xml_get_widget (xml, "delegate_permissions"); - gtk_window_set_title (GTK_WINDOW (dialog), title); - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); - g_free (title); - - table = glade_xml_get_widget (xml, "toplevel_table"); - gtk_widget_reparent (table, GTK_DIALOG (dialog)->vbox); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 6); + delegate_permissions = gtk_dialog_new_with_buttons ( + _("Delegate Permissions"), + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + if (parent_window) + gtk_window_set_transient_for (GTK_WINDOW (delegate_permissions), parent_window); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (delegate_permissions)); + gtk_widget_show (dialog_vbox1); + + vbox3 = gtk_vbox_new (FALSE, 12); + gtk_widget_show (vbox3); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox3, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox3), 12); + + delegate_label = gtk_label_new (_("Permissions for")); + gtk_widget_show (delegate_label); + gtk_box_pack_start (GTK_BOX (vbox3), delegate_label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (delegate_label), GTK_JUSTIFY_CENTER); + + folders_table = gtk_table_new (4, 2, FALSE); + gtk_widget_show (folders_table); + gtk_box_pack_start (GTK_BOX (vbox3), folders_table, FALSE, FALSE, 0); + gtk_table_set_row_spacings (GTK_TABLE (folders_table), 6); + gtk_table_set_col_spacings (GTK_TABLE (folders_table), 6); + + /* Translators: This is used for permissions for for the folder Calendar. */ + calendar_label = gtk_label_new_with_mnemonic (_("C_alendar:")); + gtk_widget_show (calendar_label); + gtk_table_attach (GTK_TABLE (folders_table), calendar_label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (calendar_label), GTK_JUSTIFY_CENTER); + gtk_misc_set_alignment (GTK_MISC (calendar_label), 0, 0.5); + + /* Translators: This is used for permissions for for the folder Tasks. */ + task_label = gtk_label_new_with_mnemonic (_("_Tasks:")); + gtk_widget_show (task_label); + gtk_table_attach (GTK_TABLE (folders_table), task_label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (task_label), GTK_JUSTIFY_CENTER); + gtk_misc_set_alignment (GTK_MISC (task_label), 0, 0.5); + + /* Translators: This is used for permissions for for the folder Inbox. */ + inbox_label = gtk_label_new_with_mnemonic (_("_Inbox:")); + gtk_widget_show (inbox_label); + gtk_table_attach (GTK_TABLE (folders_table), inbox_label, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (inbox_label), GTK_JUSTIFY_CENTER); + gtk_misc_set_alignment (GTK_MISC (inbox_label), 0, 0.5); + + /* Translators: This is used for permissions for for the folder Contacts. */ + contact_label = gtk_label_new_with_mnemonic (_("Co_ntacts:")); + gtk_widget_show (contact_label); + gtk_table_attach (GTK_TABLE (folders_table), contact_label, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (contact_label), GTK_JUSTIFY_CENTER); + gtk_misc_set_alignment (GTK_MISC (contact_label), 0, 0.5); + + calendar_perms_combobox = gtk_combo_box_new_text (); + gtk_widget_show (calendar_perms_combobox); + gtk_table_attach (GTK_TABLE (folders_table), calendar_perms_combobox, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("None")); + gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("Reviewer (read-only)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("Author (read, create)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("Editor (read, create, edit)")); + + task_perms_combobox = gtk_combo_box_new_text (); + gtk_widget_show (task_perms_combobox); + gtk_table_attach (GTK_TABLE (folders_table), task_perms_combobox, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("None")); + gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("Reviewer (read-only)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("Author (read, create)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("Editor (read, create, edit)")); + + inbox_perms_combobox = gtk_combo_box_new_text (); + gtk_widget_show (inbox_perms_combobox); + gtk_table_attach (GTK_TABLE (folders_table), inbox_perms_combobox, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("None")); + gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("Reviewer (read-only)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("Author (read, create)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("Editor (read, create, edit)")); + + contact_perms_combobox = gtk_combo_box_new_text (); + gtk_widget_show (contact_perms_combobox); + gtk_table_attach (GTK_TABLE (folders_table), contact_perms_combobox, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("None")); + gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("Reviewer (read-only)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("Author (read, create)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("Editor (read, create, edit)")); + + delegate_mail = gtk_check_button_new_with_mnemonic (_("_Summarize permissions")); + gtk_widget_show (delegate_mail); + gtk_box_pack_start (GTK_BOX (vbox3), delegate_mail, FALSE, FALSE, 0); + + see_private_checkbox = gtk_check_button_new_with_mnemonic (_("_Delegate can see private items")); + gtk_widget_show (see_private_checkbox); + gtk_box_pack_start (GTK_BOX (vbox3), see_private_checkbox, FALSE, FALSE, 0); + + gtk_box_set_spacing (GTK_BOX (dialog_vbox1), 6); title = g_strdup_printf (_("Permissions for %s"), user->display_name); - label = glade_xml_get_widget (xml, "delegate_label"); - gtk_label_set_text (GTK_LABEL (label), title); + gtk_label_set_text (GTK_LABEL (delegate_label), title); g_free (title); + comboboxes[0] = calendar_perms_combobox; + comboboxes[1] = task_perms_combobox; + comboboxes[2] = inbox_perms_combobox; + comboboxes[3] = contact_perms_combobox; + /* Set up the permissions */ for (i = 0; i < EXCHANGE_DELEGATES_LAST; i++) { - combobox = glade_xml_get_widget (xml, widget_names[i]); + combobox = comboboxes[i]; set_perms (combobox, user->role[i]); } - check = glade_xml_get_widget (xml, "see_private_checkbox"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (see_private_checkbox), user->see_private); /* Run the dialog, while watching its parent. */ g_object_weak_ref (G_OBJECT (parent_window), - parent_window_destroyed, dialog); + parent_window_destroyed, delegate_permissions); g_object_add_weak_pointer (G_OBJECT (parent_window), (gpointer*)&parent_window); - button = gtk_dialog_run (GTK_DIALOG (dialog)); + button = gtk_dialog_run (GTK_DIALOG (delegate_permissions)); if (parent_window) { g_object_remove_weak_pointer (G_OBJECT (parent_window), (gpointer *)&parent_window); g_object_weak_unref (G_OBJECT (parent_window), - parent_window_destroyed, dialog); + parent_window_destroyed, delegate_permissions); } if (button != GTK_RESPONSE_OK) { - gtk_widget_destroy (dialog); + gtk_widget_destroy (delegate_permissions); return FALSE; } /* And update */ modified = FALSE; for (i = 0; i < EXCHANGE_DELEGATES_LAST; i++) { - combobox = glade_xml_get_widget (xml, widget_names[i]); + combobox = comboboxes[i]; role = e_dialog_combo_box_get (combobox, exchange_perm_map); if (is_delegate_role (user->role[i]) && @@ -281,8 +393,7 @@ exchange_delegates_user_edit (ExchangeAccount *account, /* The following piece of code is used to construct a mail message to be sent to a Delegate summarizing all the permissions set for him on the user's various folders. */ - check_delegate = glade_xml_get_widget (xml, "delegate_mail"); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_delegate)) == TRUE) { + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (delegate_mail)) == TRUE) { if (button == GTK_RESPONSE_OK) { EAccount *eaccount; @@ -333,7 +444,7 @@ exchange_delegates_user_edit (ExchangeAccount *account, camel_stream_printf (stream, "

%s

%s

", msg_part1, msg_part2); for (i = 0; i < EXCHANGE_DELEGATES_LAST; i++) { - combobox = glade_xml_get_widget (xml, widget_names[i]); + combobox = comboboxes[i]; role = e_dialog_combo_box_get (combobox, exchange_perm_map); role_name = g_strdup (map_to_full_role_name(role)); g_string_append_printf ( @@ -344,7 +455,7 @@ exchange_delegates_user_edit (ExchangeAccount *account, camel_stream_printf (stream, "%s
", role_name_final->str); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)) == TRUE) { + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (see_private_checkbox)) == TRUE) { /* To translators: This message is included if the delegatee has been given access to the private items. */ @@ -419,7 +530,7 @@ exchange_delegates_user_edit (ExchangeAccount *account, } /* Send the permissions summarizing mail */ - out_folder = mail_component_get_folder (NULL, MAIL_COMPONENT_FOLDER_OUTBOX); + out_folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX); info = camel_message_info_new (NULL); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); mail_append_mail (out_folder, delegate_mail, info, em_utils_delegates_done, NULL); @@ -428,15 +539,13 @@ exchange_delegates_user_edit (ExchangeAccount *account, } - check = glade_xml_get_widget (xml, "see_private_checkbox"); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)) != + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (see_private_checkbox)) != user->see_private) { user->see_private = !user->see_private; modified = TRUE; } - g_object_unref (xml); - gtk_widget_destroy (dialog); + gtk_widget_destroy (delegate_permissions); if (modified) g_signal_emit (user, signals[EDITED], 0); diff --git a/plugins/exchange-operations/exchange-delegates.c b/plugins/exchange-operations/exchange-delegates.c index dda48dfeb2..89da03ef9c 100644 --- a/plugins/exchange-operations/exchange-delegates.c +++ b/plugins/exchange-operations/exchange-delegates.c @@ -44,7 +44,6 @@ #include #include -#include typedef struct { const gchar *uri; @@ -56,7 +55,6 @@ typedef struct { ExchangeAccount *account; gchar *self_dn; - GladeXML *xml; GtkWidget *dialog, *parent; GtkListStore *model; @@ -580,7 +578,7 @@ remove_button_clicked_cb (GtkWidget *widget, gpointer data) GTK_BUTTONS_YES_NO, _("Remove the delegate %s?"), user->display_name); - gtk_window_set_transient_for (GTK_WINDOW (dialog), widget); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_toplevel (widget))); btn = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -879,9 +877,6 @@ delegates_destroy (ExchangeDelegates *delegates) if (delegates->freebusy_folder.uri) g_free ((gchar *)delegates->freebusy_folder.uri); - if (delegates->xml) - g_object_unref (delegates->xml); - g_free (delegates); } @@ -907,8 +902,16 @@ parent_destroyed (gpointer user_data, GObject *ex_parent) void exchange_delegates (ExchangeAccount *account, GtkWidget *parent) { + GtkWidget *dialog_vbox1; + GtkWidget *vbox2; + GtkWidget *label3; + GtkWidget *delegate_hbox; + GtkWidget *delegates_table; + GtkWidget *vbuttonbox1; + GtkWidget *add_button; + GtkWidget *edit_button; + GtkWidget *remove_button; ExchangeDelegates *delegates; - GtkWidget *button; ExchangeDelegatesUser *user; GtkTreeViewColumn *column; GtkTreeIter iter; @@ -920,33 +923,75 @@ exchange_delegates (ExchangeAccount *account, GtkWidget *parent) delegates = g_new0 (ExchangeDelegates, 1); delegates->account = g_object_ref (account); - delegates->xml = glade_xml_new (CONNECTOR_GLADEDIR "/exchange-delegates.glade", NULL, NULL); - g_return_if_fail (delegates->xml != NULL); - - delegates->dialog = glade_xml_get_widget (delegates->xml, "delegates"); - g_return_if_fail (delegates->dialog != NULL); + delegates->dialog = gtk_dialog_new_with_buttons ( + _("Delegates"), + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (delegates->dialog)); + gtk_widget_show (dialog_vbox1); + + vbox2 = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox2, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6); + + label3 = gtk_label_new (_("These users will be able to send mail on your behalf\nand access your folders with the permissions you give them.")); + gtk_widget_show (label3); + gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0); + + delegate_hbox = gtk_hbox_new (FALSE, 6); + gtk_widget_show (delegate_hbox); + gtk_box_pack_start (GTK_BOX (vbox2), delegate_hbox, TRUE, TRUE, 0); + + delegates_table = gtk_tree_view_new (); + gtk_widget_show (delegates_table); + gtk_box_pack_start (GTK_BOX (delegate_hbox), delegates_table, TRUE, TRUE, 0); + gtk_tree_view_set_enable_search (GTK_TREE_VIEW (delegates_table), FALSE); + + vbuttonbox1 = gtk_vbutton_box_new (); + gtk_widget_show (vbuttonbox1); + gtk_box_pack_end (GTK_BOX (delegate_hbox), vbuttonbox1, FALSE, TRUE, 0); + gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_START); + gtk_box_set_spacing (GTK_BOX (vbuttonbox1), 6); + + add_button = gtk_button_new_from_stock ("gtk-add"); + gtk_widget_show (add_button); + gtk_container_add (GTK_CONTAINER (vbuttonbox1), add_button); + GTK_WIDGET_SET_FLAGS (add_button, GTK_CAN_DEFAULT); + + edit_button = gtk_button_new_with_mnemonic (_("_Edit")); + gtk_widget_show (edit_button); + gtk_container_add (GTK_CONTAINER (vbuttonbox1), edit_button); + GTK_WIDGET_SET_FLAGS (edit_button, GTK_CAN_DEFAULT); + + remove_button = gtk_button_new_from_stock ("gtk-remove"); + gtk_widget_show (remove_button); + gtk_container_add (GTK_CONTAINER (vbuttonbox1), remove_button); + GTK_WIDGET_SET_FLAGS (remove_button, GTK_CAN_DEFAULT); g_signal_connect (delegates->dialog, "response", G_CALLBACK (dialog_response), delegates); - gtk_window_set_transient_for (GTK_WINDOW (delegates->dialog), parent); + if (parent) + gtk_window_set_transient_for (GTK_WINDOW (delegates->dialog), GTK_WINDOW (parent)); delegates->parent = parent; g_object_weak_ref (G_OBJECT (parent), parent_destroyed, delegates); /* Set up the buttons */ - button = glade_xml_get_widget (delegates->xml, "add_button"); - g_signal_connect (button, "clicked", + g_signal_connect (add_button, "clicked", G_CALLBACK (add_button_clicked_cb), delegates); - button = glade_xml_get_widget (delegates->xml, "edit_button"); - g_signal_connect (button, "clicked", + g_signal_connect (edit_button, "clicked", G_CALLBACK (edit_button_clicked_cb), delegates); - button = glade_xml_get_widget (delegates->xml, "remove_button"); - g_signal_connect (button, "clicked", + g_signal_connect (remove_button, "clicked", G_CALLBACK (remove_button_clicked_cb), delegates); /* Set up the table */ delegates->model = gtk_list_store_new (1, G_TYPE_STRING); - delegates->table = glade_xml_get_widget (delegates->xml, "delegates_table"); + delegates->table = delegates_table; column = gtk_tree_view_column_new_with_attributes ( _("Name"), gtk_cell_renderer_text_new (), "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (delegates->table), @@ -968,12 +1013,9 @@ exchange_delegates (ExchangeAccount *account, GtkWidget *parent) "button_press_event", G_CALLBACK (table_click_cb), delegates); } else { - button = glade_xml_get_widget (delegates->xml, "add_button"); - gtk_widget_set_sensitive (button, FALSE); - button = glade_xml_get_widget (delegates->xml, "edit_button"); - gtk_widget_set_sensitive (button, FALSE); - button = glade_xml_get_widget (delegates->xml, "remove_button"); - gtk_widget_set_sensitive (button, FALSE); + gtk_widget_set_sensitive (add_button, FALSE); + gtk_widget_set_sensitive (edit_button, FALSE); + gtk_widget_set_sensitive (remove_button, FALSE); gtk_list_store_append (delegates->model, &iter); gtk_list_store_set (delegates->model, &iter, diff --git a/plugins/exchange-operations/exchange-delegates.glade b/plugins/exchange-operations/exchange-delegates.glade deleted file mode 100644 index 1e099e999a..0000000000 --- a/plugins/exchange-operations/exchange-delegates.glade +++ /dev/null @@ -1,542 +0,0 @@ - - - - - - - True - Delegates - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 6 - - - - True - These users will be able to send mail on your behalf -and access your folders with the permissions you give them. - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 6 - - - - True - True - True - False - False - False - False - False - False - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_START - 6 - - - - True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - _Edit - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - - 0 - False - True - GTK_PACK_END - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - Delegate Permissions - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 12 - True - False - 12 - - - - True - Permissions for - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 4 - 2 - False - 6 - 6 - - - - True - C_alendar: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Tasks: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - _Inbox: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - Co_ntacts: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - None -Reviewer (read-only) -Author (read, create) -Editor (read, create, edit) - False - True - - - 1 - 2 - 0 - 1 - fill - fill - - - - - - True - None -Reviewer (read-only) -Author (read, create) -Editor (read, create, edit) - False - True - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - None -Reviewer (read-only) -Author (read, create) -Editor (read, create, edit) - False - True - - - 1 - 2 - 2 - 3 - fill - fill - - - - - - True - None -Reviewer (read-only) -Author (read, create) -Editor (read, create, edit) - False - True - - - 1 - 2 - 3 - 4 - fill - fill - - - - - 0 - False - False - - - - - - True - True - _Summarize permissions - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - _Delegate can see private items - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - 0 - True - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-folder-permission.c b/plugins/exchange-operations/exchange-folder-permission.c index 7113ef8e64..200eea8cdb 100644 --- a/plugins/exchange-operations/exchange-folder-permission.c +++ b/plugins/exchange-operations/exchange-folder-permission.c @@ -26,316 +26,502 @@ #endif #include -#include #include #include -#include -#include -#include + #include -#include -#include -#include #include +#include + +#include + +#include +#include + +#include +#include + +#include +#include + #include "exchange-config-listener.h" +#include "exchange-folder-subscription.h" #include "exchange-operations.h" #include "exchange-permissions-dialog.h" -#include "addressbook/gui/widgets/eab-popup.h" -#include "calendar/gui/e-cal-menu.h" -#include "calendar/gui/e-cal-model.h" -#include "addressbook/gui/widgets/eab-menu.h" #define d(x) -static void org_folder_permissions_cb (EPopup *ep, EPopupItem *p, gpointer data); -void org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t); -void org_gnome_exchange_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *target); -void org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *target); -void org_gnome_exchange_addressbook_permissions (EPlugin *ep, EABPopupTargetSource *target); -void org_gnome_exchange_menu_ab_permissions (EPlugin *ep, EABMenuTargetSelect *target); -void org_gnome_exchange_menu_tasks_permissions (EPlugin *ep, ECalMenuTargetSelect *target); -void org_gnome_exchange_menu_cal_permissions (EPlugin *ep, ECalMenuTargetSelect *target); +gboolean eex_ui_mail_init (GtkUIManager *ui_manager, EShellView *shell_view); +gboolean eex_ui_calendar_permissions (GtkUIManager *ui_manager, EShellView *shell_view); +gboolean eex_ui_tasks_permissions (GtkUIManager *ui_manager, EShellView *shell_view); +gboolean eex_ui_addressbook_permissions (GtkUIManager *ui_manager, EShellView *shell_view); -gchar *selected_exchange_folder_uri = NULL; +static gboolean +is_subscribed_folder (const gchar *uri) +{ + const gchar *path; + ExchangeAccount *account; + gint offset; -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar *) "30.emc.10", (gchar *) N_("Permissions..."), org_folder_permissions_cb, NULL, (gchar *) "folder-new", 0, EM_POPUP_FOLDER_INFERIORS } -}; + g_return_val_if_fail (uri != NULL, FALSE); + + account = exchange_operations_get_exchange_account (); + g_return_val_if_fail (account != NULL, FALSE); + g_return_val_if_fail (account->account_filename != NULL, FALSE); + + offset = strlen ("exchange://") + strlen (account->account_filename) + strlen ("/;"); + g_return_val_if_fail (strlen (uri) >= offset, FALSE); + + path = uri + offset; + + return strchr (path, '@') != NULL; +} static void -popup_free (EPopup *ep, GSList *items, gpointer data) +call_folder_permissions (const gchar *uri) { - g_slist_free (items); + ExchangeAccount *account = NULL; + EFolder *folder = NULL; + + g_return_if_fail (uri != NULL); + + account = exchange_operations_get_exchange_account (); + if (!account) + return; + + folder = exchange_account_get_folder (account, uri); + if (folder) + exchange_permissions_dialog_new (account, folder, NULL); } -void -org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *target) +static gboolean +is_eex_folder_selected (EShellView *shell_view, gchar **puri) { - GSList *menus = NULL; - gint i = 0, mode; - static gint first =0; ExchangeAccount *account = NULL; - ESource *source = NULL; + gint mode; + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree = NULL; + GtkTreeSelection *selection; + GtkTreeModel *model = NULL; + GtkTreeIter iter; + gboolean is_store = FALSE, res; gchar *uri = NULL; - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); - uri = (gchar *) e_source_get_uri (source); - if (uri && ! g_strrstr (uri, "exchange://")) { - return; - } + g_return_val_if_fail (shell_view != NULL, FALSE); account = exchange_operations_get_exchange_account (); if (!account) - return; + return FALSE; + exchange_account_is_offline (account, &mode); if (mode == OFFLINE_MODE) - return; - if (!exchange_account_get_folder (account, uri)) - return; + return FALSE; + + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + g_return_val_if_fail (folder_tree != NULL, FALSE); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); + g_return_val_if_fail (selection != NULL, FALSE); + + if (!gtk_tree_selection_get_selected (selection, &model, &iter)) + return FALSE; + + gtk_tree_model_get (model, &iter, + COL_STRING_URI, &uri, + COL_BOOL_IS_STORE, &is_store, + -1); - selected_exchange_folder_uri = uri; + res = !is_store && uri && g_ascii_strncasecmp (uri, "exchange://", 11) == 0; - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - first++; + if (res) { + const gchar *path; + path = uri + strlen ("exchange://") + strlen (account->account_filename); + res = path && *path; + + if (res) { + if (puri) + *puri = g_strdup (uri); + } } - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); + g_free (uri); + + return res; +} + +static void +eex_mail_folder_permissions_cb (GtkAction *action, EShellView *shell_view) +{ + gchar *uri = NULL; + + if (is_eex_folder_selected (shell_view, &uri)) + call_folder_permissions (uri); + + g_free (uri); +} + +static void +eex_folder_subscribe_cb (GtkAction *action, EShellView *shell_view) +{ + const gchar *name; - e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); + name = gtk_action_get_name (action); + g_return_if_fail (name != NULL); + name = strrchr (name, '-'); + g_return_if_fail (name != NULL && *name == '-'); + + call_folder_subscribe (name + 1); } -void -org_gnome_exchange_addressbook_permissions (EPlugin *ep, EABPopupTargetSource *target) +static void +eex_mail_folder_inbox_unsubscribe_cb (GtkAction *action, EShellView *shell_view) { - GSList *menus = NULL; - gint i = 0, mode; - static gint first =0; - ExchangeAccount *account = NULL; - ESource *source = NULL; gchar *uri = NULL; - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); - uri = (gchar *) e_source_get_uri (source); - if (!g_strrstr (uri, "exchange://")) - return; + if (is_eex_folder_selected (shell_view, &uri)) + call_folder_unsubscribe ("Inbox", uri, NULL); - account = exchange_operations_get_exchange_account (); - if (!account) - return; - exchange_account_is_offline (account, &mode); - if (mode == OFFLINE_MODE) - return; + g_free (uri); +} - if (!exchange_account_get_folder (account, uri)) - return; +/* Beware, depends on the order */ +static GtkActionEntry mail_entries[] = { + { "eex-mail-folder-permissions", + "folder-new", + N_("Permissions..."), + NULL, + N_("Check folder permissions"), + G_CALLBACK (eex_mail_folder_permissions_cb) }, + + { "eex-folder-subscribe-Inbox", + NULL, + N_("Subscribe to Other User's Folder..."), + NULL, + N_("Subscribe to Other User's Folder"), + G_CALLBACK (eex_folder_subscribe_cb) }, + + { "eex-mail-folder-inbox-unsubscribe", + "folder-new", + N_("Unsubscribe Folder..."), + NULL, + NULL, + G_CALLBACK (eex_mail_folder_inbox_unsubscribe_cb) } +}; + +static void +update_mail_entries_cb (EShellView *shell_view, gpointer user_data) +{ + GtkActionGroup *action_group; + EShellWindow *shell_window; + GtkAction *action; + gboolean is_eex; + gchar *uri = NULL; + gint i; - selected_exchange_folder_uri = uri; + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - first++; + is_eex = is_eex_folder_selected (shell_view, &uri); + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = e_shell_window_get_action_group (shell_window, "mail"); + + for (i = 0; i < G_N_ELEMENTS (mail_entries); i++) { + gboolean visible = is_eex; + + action = gtk_action_group_get_action (action_group, mail_entries[i].name); + g_return_if_fail (action != NULL); + + if (visible && i == 2) { + /* it's an unsubscribe, check if this is public and show/hide based on that */ + visible = uri && is_subscribed_folder (uri); + } + + gtk_action_set_visible (action, visible); } - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); + g_free (uri); +} + +gboolean +eex_ui_mail_init (GtkUIManager *ui_manager, EShellView *shell_view) +{ + EShellWindow *shell_window; + + shell_window = e_shell_view_get_shell_window (shell_view); + + gtk_action_group_add_actions ( + e_shell_window_get_action_group (shell_window, "mail"), + mail_entries, G_N_ELEMENTS (mail_entries), shell_view); - e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); + g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_mail_entries_cb), NULL); + + return TRUE; } -void -org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *target) +static gboolean +is_eex_source_selected (EShellView *shell_view, gchar **puri) { - GSList *menus = NULL; - gint i = 0, mode; - static gint first =0; - gchar *path = NULL; - gchar *fixed_path = NULL; + gint mode; ExchangeAccount *account = NULL; + ESource *source = NULL; + gchar *uri = NULL; + EShellSidebar *shell_sidebar; + ESourceSelector *selector = NULL; - d(g_print ("exchange-folder-permission.c: entry\n")); + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_return_val_if_fail (shell_sidebar != NULL, FALSE); - if (!g_strrstr (target->uri, "exchange://")) - return; + g_object_get (shell_sidebar, "selector", &selector, NULL); + g_return_val_if_fail (selector != NULL, FALSE); + + source = e_source_selector_peek_primary_selection (selector); + uri = e_source_get_uri (source); + + g_object_unref (selector); + + if (uri && !g_strrstr (uri, "exchange://")) { + g_free (uri); + return FALSE; + } account = exchange_operations_get_exchange_account (); - if (!account ) - return; + if (!account) { + g_free (uri); + return FALSE; + } + exchange_account_is_offline (account, &mode); - if (mode == OFFLINE_MODE) - return; + if (mode == OFFLINE_MODE) { + g_free (uri); + return FALSE; + } - path = target->uri + strlen ("exchange://") + strlen (account->account_filename); + if (!exchange_account_get_folder (account, uri)) { + g_free (uri); + return FALSE; + } - if (!path || !*path) - return; + if (puri) + *puri = uri; + else + g_free (uri); - fixed_path = camel_url_decode_path (path); - d(g_print ("exchange-folder-permission.c: path=[%s], fixed_path=[%s]\n", path, fixed_path)); + return TRUE; +} - if (! g_strrstr (target->uri, "exchange://") || - !exchange_account_get_folder (account, fixed_path)) { - g_free (fixed_path); - return; - } +#define NUM_ENTRIES 3 - g_free (fixed_path); +static void +update_source_entries_cb (EShellView *shell_view, GtkActionEntry *entries) +{ + GtkActionGroup *action_group; + EShellWindow *shell_window; + GtkAction *action; + const gchar *group; + gchar *uri = NULL; + gboolean is_eex; + gint i; - selected_exchange_folder_uri = path; - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - first++; - } + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (entries != NULL); + + if (strstr (entries->name, "calendar")) + group = "calendar"; + else if (strstr (entries->name, "tasks")) + group = "tasks"; + else + group = "addressbook"; + + is_eex = is_eex_source_selected (shell_view, &uri); + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = e_shell_window_get_action_group (shell_window, group); - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); + for (i = 0; i < NUM_ENTRIES; i++) { + gboolean visible = is_eex; - e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); + action = gtk_action_group_get_action (action_group, entries->name); + g_return_if_fail (action != NULL); + if (visible && i == 2) { + /* it's an unsubscribe, check if this is public and show/hide based on that */ + visible = uri && is_subscribed_folder (uri); + } + + gtk_action_set_visible (action, visible); + + } + + g_free (uri); } static void -org_folder_permissions_cb (EPopup *ep, EPopupItem *p, gpointer data) +setup_source_actions (EShellView *shell_view, GtkActionEntry *entries) { - ExchangeAccount *account = NULL; - EFolder *folder = NULL; + EShellWindow *shell_window; + const gchar *group; - account = exchange_operations_get_exchange_account (); + g_return_if_fail (shell_view != NULL); + g_return_if_fail (entries != NULL); - if (!account) - return; + if (strstr (entries->name, "calendar")) + group = "calendar"; + else if (strstr (entries->name, "tasks")) + group = "tasks"; + else + group = "addressbook"; - folder = exchange_account_get_folder (account, selected_exchange_folder_uri); - if (folder) - exchange_permissions_dialog_new (account, folder, NULL); + shell_window = e_shell_view_get_shell_window (shell_view); + gtk_action_group_add_actions ( + e_shell_window_get_action_group (shell_window, group), + entries, NUM_ENTRIES, shell_view); + + g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_source_entries_cb), entries); } -void -org_gnome_exchange_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *target) +static void +source_permissions_cb (GtkAction *action, EShellView *shell_view) { - ExchangeAccount *account = NULL; - EFolder *folder = NULL; - gchar *path = NULL; - gint mode; + gchar *uri = NULL; - if (!g_str_has_prefix (target->uri, "exchange://")) - return; + g_return_if_fail (shell_view != NULL); - account = exchange_operations_get_exchange_account (); - if (!account) - return; - exchange_account_is_offline (account, &mode); - if (mode == OFFLINE_MODE) - return; + if (is_eex_source_selected (shell_view, &uri)) + call_folder_permissions (uri); - path = target->uri + strlen ("exchange://") + strlen (account->account_filename); - folder = exchange_account_get_folder (account, path); - if (folder) - exchange_permissions_dialog_new (account, folder, NULL); + g_free (uri); } -void -org_gnome_exchange_menu_cal_permissions (EPlugin *ep, ECalMenuTargetSelect *target) +static void +eex_folder_unsubscribe_cb (GtkAction *action, EShellView *shell_view) { - ExchangeAccount *account = NULL; - EFolder *folder = NULL; - ECalModel *model = NULL; - ECal *ecal = NULL; gchar *uri = NULL; - gint mode; + const gchar *name; - if (!target) - return; - if (target->model) - model = E_CAL_MODEL (target->model); + g_return_if_fail (shell_view != NULL); - ecal = e_cal_model_get_default_client (model); - uri = (gchar *) e_cal_get_uri (ecal); - if (!uri) - return; - else - if (!g_str_has_prefix (uri, "exchange://")) - return; + name = gtk_action_get_name (action); + g_return_if_fail (name != NULL); - account = exchange_operations_get_exchange_account (); - if (!account) - return; - exchange_account_is_offline (account, &mode); - if (mode == OFFLINE_MODE) - return; + name = strrchr (name, '-'); + g_return_if_fail (name != NULL && *name == '-'); - folder = exchange_account_get_folder (account, uri); - exchange_permissions_dialog_new (account, folder, NULL); + if (is_eex_source_selected (shell_view, &uri)) { + EShellSidebar *shell_sidebar; + ESourceSelector *selector = NULL; + + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_return_if_fail (shell_sidebar != NULL); + + g_object_get (shell_sidebar, "selector", &selector, NULL); + g_return_if_fail (selector != NULL); + + call_folder_unsubscribe (name + 1, uri, e_source_selector_peek_primary_selection (selector)); + } + + g_free (uri); } -void -org_gnome_exchange_menu_tasks_permissions (EPlugin *ep, ECalMenuTargetSelect *target) -{ - ExchangeAccount *account = NULL; - EFolder *folder = NULL; - ECalModel *model = NULL; - ECal *ecal = NULL; - gchar *uri = NULL; - gint mode; +/* Beware, depends on count and order */ +static GtkActionEntry calendar_entries[] = { + { "eex-calendar-permissions", + "folder-new", + N_("Permissions..."), + NULL, + N_("Check calendar permissions"), + G_CALLBACK (source_permissions_cb) }, + + { "eex-folder-subscribe-Calendar", + NULL, + N_("Subscribe to Other User's Folder..."), + NULL, + N_("Subscribe to Other User's Folder"), + G_CALLBACK (eex_folder_subscribe_cb) }, + + { "eex-folder-unsubscribe-Calendar", + "folder-new", + N_("Unsubscribe Folder..."), + NULL, + NULL, + G_CALLBACK (eex_folder_unsubscribe_cb) } +}; - if (!target) - return; - if (target->model) - model = E_CAL_MODEL (target->model); +gboolean +eex_ui_calendar_permissions (GtkUIManager *ui_manager, EShellView *shell_view) +{ + g_return_val_if_fail (G_N_ELEMENTS (calendar_entries) != NUM_ENTRIES, FALSE); - ecal = e_cal_model_get_default_client (model); - uri = (gchar *) e_cal_get_uri (ecal); - if (!uri) - return; - else - if (!g_str_has_prefix (uri, "exchange://")) - return; - account = exchange_operations_get_exchange_account (); - if (!account) - return; - exchange_account_is_offline (account, &mode); - if (mode == OFFLINE_MODE) - return; + setup_source_actions (shell_view, calendar_entries); - folder = exchange_account_get_folder (account, uri); - exchange_permissions_dialog_new (account, folder, NULL); + return TRUE; } -void -org_gnome_exchange_menu_ab_permissions (EPlugin *ep, EABMenuTargetSelect *target) +/* Beware, depends on count and order */ +static GtkActionEntry tasks_entries[] = { + { "eex-tasks-permissions", + "folder-new", + N_("Permissions..."), + NULL, + N_("Check tasks permissions"), + G_CALLBACK (source_permissions_cb) }, + + { "eex-folder-subscribe-Tasks", + NULL, + N_("Subscribe to Other User's Folder..."), + NULL, + N_("Subscribe to Other User's Folder"), + G_CALLBACK (eex_folder_subscribe_cb) }, + + { "eex-folder-unsubscribe-Tasks", + "folder-new", + N_("Unsubscribe Folder..."), + NULL, + NULL, + G_CALLBACK (eex_folder_unsubscribe_cb) } +}; + +gboolean +eex_ui_tasks_permissions (GtkUIManager *ui_manager, EShellView *shell_view) { - ExchangeAccount *account = NULL; - EFolder *folder = NULL; - EBook *ebook = NULL; - gchar *uri = NULL; - gint mode; + g_return_val_if_fail (G_N_ELEMENTS (tasks_entries) != NUM_ENTRIES, FALSE); - if (!target) - return; - if (target->book) - ebook = E_BOOK (target->book); + setup_source_actions (shell_view, tasks_entries); - uri = (gchar *) e_book_get_uri (ebook); - if (!uri) - return; - else - if (!g_str_has_prefix (uri, "exchange://")) - return; + return TRUE; +} - account = exchange_operations_get_exchange_account (); - if (!account) - return; - exchange_account_is_offline (account, &mode); - if (mode == OFFLINE_MODE) - return; +/* Beware, depends on count and order */ +static GtkActionEntry addressbook_entries[] = { + { "eex-addressbook-permissions", + "folder-new", + N_("Permissions..."), + NULL, + N_("Check addressbook permissions"), + G_CALLBACK (source_permissions_cb) }, + + { "eex-folder-subscribe-Contacts", + NULL, + N_("Subscribe to Other User's Folder..."), + NULL, + N_("Subscribe to Other User's Folder"), + G_CALLBACK (eex_folder_subscribe_cb) }, + + { "eex-folder-unsubscribe-Contacts", + "folder-new", + N_("Unsubscribe Folder..."), + NULL, + NULL, + G_CALLBACK (eex_folder_unsubscribe_cb) } +}; - folder = exchange_account_get_folder (account, uri); - exchange_permissions_dialog_new (account, folder, NULL); +gboolean +eex_ui_addressbook_permissions (GtkUIManager *ui_manager, EShellView *shell_view) +{ + g_return_val_if_fail (G_N_ELEMENTS (addressbook_entries) != NUM_ENTRIES, FALSE); + + setup_source_actions (shell_view, addressbook_entries); + + return TRUE; } diff --git a/plugins/exchange-operations/exchange-folder-size-display.c b/plugins/exchange-operations/exchange-folder-size-display.c index 8db56b80a2..7e1fc7ff89 100644 --- a/plugins/exchange-operations/exchange-folder-size-display.c +++ b/plugins/exchange-operations/exchange-folder-size-display.c @@ -29,7 +29,6 @@ #include #include -#include #include "exchange-folder-size-display.h" enum { @@ -105,21 +104,42 @@ exchange_folder_size_display (GtkListStore *model, GtkWidget *parent) GtkTreeViewColumn *column; GtkTreeSortable *sortable; GtkCellRenderer *cell; - GladeXML *xml; - GtkWidget *dialog, *table; + GtkWidget *folder_tree; + GtkWidget *dialog_vbox1; + GtkWidget *folder_tree_hbox; + GtkWidget *scrolledwindow1; + GtkWidget *folder_treeview; GList *l; gchar *col_name; - printf ("exchange_folder_size_display called\n"); g_return_if_fail (GTK_IS_WIDGET (parent)); - xml = glade_xml_new (CONNECTOR_GLADEDIR "/exchange-folder-tree.glade", NULL, NULL); - g_return_if_fail (xml != NULL); - dialog = glade_xml_get_widget (xml, "folder_tree"); - table = glade_xml_get_widget (xml, "folder_treeview"); - g_object_unref (xml); + folder_tree = gtk_dialog_new_with_buttons ( + _("Exchange Folder Tree"), + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + gtk_window_set_position (GTK_WINDOW (folder_tree), GTK_WIN_POS_CENTER_ON_PARENT); + gtk_window_set_default_size (GTK_WINDOW (folder_tree), 250, 300); + if (parent) + gtk_window_set_transient_for (GTK_WINDOW (folder_tree), parent); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (folder_tree)); + gtk_widget_show (dialog_vbox1); + + folder_tree_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_show (folder_tree_hbox); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), folder_tree_hbox, TRUE, TRUE, 0); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (folder_tree_hbox), scrolledwindow1, TRUE, TRUE, 0); + + folder_treeview = gtk_tree_view_new (); + gtk_widget_show (folder_treeview); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), folder_treeview); - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); /* fsize->parent = parent; */ /* Set up the table */ @@ -128,7 +148,7 @@ exchange_folder_size_display (GtkListStore *model, GtkWidget *parent) column = gtk_tree_view_column_new_with_attributes ( _("Folder Name"), gtk_cell_renderer_text_new (), "text", COLUMN_NAME, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (table), + gtk_tree_view_append_column (GTK_TREE_VIEW (folder_treeview), column); col_name = g_strdup_printf ("%s (KB)", _("Folder Size")); @@ -136,15 +156,15 @@ exchange_folder_size_display (GtkListStore *model, GtkWidget *parent) col_name, gtk_cell_renderer_text_new (), "text", COLUMN_SIZE, NULL); g_free (col_name); - l = gtk_tree_view_column_get_cell_renderers (column); + l = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); cell = (GtkCellRenderer *)l->data; gtk_tree_view_column_set_cell_data_func (column, cell, format_size_func, NULL, NULL ); g_list_free (l); - gtk_tree_view_append_column (GTK_TREE_VIEW (table), + gtk_tree_view_append_column (GTK_TREE_VIEW (folder_treeview), column); - gtk_tree_view_set_model (GTK_TREE_VIEW (table), + gtk_tree_view_set_model (GTK_TREE_VIEW (folder_treeview), GTK_TREE_MODEL (model)); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); + gtk_dialog_run (GTK_DIALOG (folder_tree)); + gtk_widget_destroy (folder_tree); } diff --git a/plugins/exchange-operations/exchange-folder-subscription.c b/plugins/exchange-operations/exchange-folder-subscription.c index 043d5797e4..63d2fb2937 100644 --- a/plugins/exchange-operations/exchange-folder-subscription.c +++ b/plugins/exchange-operations/exchange-folder-subscription.c @@ -25,7 +25,6 @@ #include "config.h" #endif -#include #include #include #include @@ -57,16 +56,13 @@ user_clicked (GtkWidget *button, ENameSelector *name_selector) } static GtkWidget * -setup_name_selector (GladeXML *glade_xml, ENameSelector **name_selector_ret) +setup_name_selector (GtkWidget *placeholder, GtkWidget *button_user, ENameSelector **name_selector_ret) { ENameSelector *name_selector; ENameSelectorModel *name_selector_model; ENameSelectorDialog *name_selector_dialog; - GtkWidget *placeholder; GtkWidget *widget; - GtkWidget *button; - placeholder = glade_xml_get_widget (glade_xml, "user-picker-placeholder"); g_assert (GTK_IS_CONTAINER (placeholder)); name_selector = e_name_selector_new (); @@ -83,8 +79,7 @@ setup_name_selector (GladeXML *glade_xml, ENameSelector **name_selector_ret) widget = GTK_WIDGET (e_name_selector_peek_section_entry (name_selector, "User")); gtk_widget_show (widget); - button = glade_xml_get_widget (glade_xml, "button-user"); - g_signal_connect (button, "clicked", G_CALLBACK (user_clicked), name_selector); + g_signal_connect (button_user, "clicked", G_CALLBACK (user_clicked), name_selector); gtk_box_pack_start (GTK_BOX (placeholder), widget, TRUE, TRUE, 6); *name_selector_ret = name_selector; @@ -92,7 +87,7 @@ setup_name_selector (GladeXML *glade_xml, ENameSelector **name_selector_ret) } static void -setup_folder_name_combo (GladeXML *glade_xml, const gchar *fname) +setup_folder_name_combo (GtkWidget *widget, const gchar *fname) { GtkComboBox *combo; const gchar *strings[] = { @@ -105,7 +100,7 @@ setup_folder_name_combo (GladeXML *glade_xml, const gchar *fname) }; gint i; - combo = GTK_COMBO_BOX (glade_xml_get_widget (glade_xml, "folder-name-combo")); + combo = GTK_COMBO_BOX (widget); g_assert (GTK_IS_COMBO_BOX_ENTRY (combo)); gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (combo))); @@ -142,11 +137,8 @@ user_name_entry_changed_callback (GtkEditable *editable, gpointer data) } static void -setup_server_combobox (GladeXML *glade_xml, gchar *mail_account) +setup_server_combobox (GtkWidget *widget, gchar *mail_account) { - GtkWidget *widget; - - widget = glade_xml_get_widget (glade_xml, "server-combobox"); g_return_if_fail (GTK_IS_COMBO_BOX (widget)); gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (widget)))); @@ -287,8 +279,15 @@ gboolean create_folder_subscription_dialog (ExchangeAccount *account, const gchar *fname) { ENameSelector *name_selector; - GladeXML *glade_xml; - GtkWidget *dialog, *ok_button; + GtkWidget *dialog; + GtkWidget *dialog_vbox1; + GtkWidget *table1; + GtkWidget *label1; + GtkWidget *label3; + GtkWidget *user_picker_placeholder; + GtkWidget *button_user; + GtkWidget *folder_name_combo; + GtkWidget *server_combobox; SubscriptionInfo *subscription_info; gint mode; @@ -299,27 +298,74 @@ create_folder_subscription_dialog (ExchangeAccount *account, const gchar *fname) subscription_info = g_new0 (SubscriptionInfo, 1); subscription_info->account = account; - glade_xml = glade_xml_new (CONNECTOR_GLADEDIR "/e-foreign-folder-dialog.glade", - NULL, NULL); - g_return_val_if_fail (glade_xml != NULL, FALSE); + dialog = gtk_dialog_new_with_buttons ( + _("Subscribe to Other User's Folder"), + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_widget_show (dialog_vbox1); + + table1 = gtk_table_new (3, 2, FALSE); + gtk_widget_show (table1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 2); + gtk_table_set_row_spacings (GTK_TABLE (table1), 3); + gtk_table_set_col_spacings (GTK_TABLE (table1), 3); + + label1 = gtk_label_new_with_mnemonic (_("_Account:")); + gtk_widget_show (label1); + gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER); + + label3 = gtk_label_new_with_mnemonic (_("_Folder Name:")); + gtk_widget_show (label3); + gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_CENTER); + + user_picker_placeholder = gtk_hbox_new (FALSE, 0); + gtk_widget_show (user_picker_placeholder); + gtk_table_attach (GTK_TABLE (table1), user_picker_placeholder, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + button_user = gtk_button_new_with_mnemonic (_("_User:")); + gtk_widget_show (button_user); + gtk_table_attach (GTK_TABLE (table1), button_user, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + folder_name_combo = gtk_combo_box_entry_new_text (); + gtk_widget_show (folder_name_combo); + gtk_table_attach (GTK_TABLE (table1), folder_name_combo, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + server_combobox = gtk_combo_box_new_text (); + gtk_widget_show (server_combobox); + gtk_table_attach (GTK_TABLE (table1), server_combobox, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); - dialog = glade_xml_get_widget (glade_xml, "dialog"); - g_return_val_if_fail (dialog != NULL, FALSE); gtk_window_set_modal (GTK_WINDOW (dialog), FALSE); - gtk_window_set_title (GTK_WINDOW (dialog), _("Subscribe to Other User's Folder")); - subscription_info->name_selector_widget = setup_name_selector (glade_xml, &name_selector); + subscription_info->name_selector_widget = setup_name_selector (user_picker_placeholder, button_user, &name_selector); subscription_info->name_selector = name_selector; gtk_widget_grab_focus (subscription_info->name_selector_widget); - ok_button = glade_xml_get_widget (glade_xml, "button1"); - gtk_widget_set_sensitive (ok_button, FALSE); + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); g_signal_connect (subscription_info->name_selector_widget, "changed", G_CALLBACK (user_name_entry_changed_callback), dialog); - setup_server_combobox (glade_xml, account->account_name); - setup_folder_name_combo (glade_xml, fname); - subscription_info->folder_name_entry = gtk_bin_get_child (GTK_BIN (glade_xml_get_widget (glade_xml, "folder-name-combo"))); + setup_server_combobox (server_combobox, account->account_name); + setup_folder_name_combo (folder_name_combo, fname); + subscription_info->folder_name_entry = gtk_bin_get_child (GTK_BIN (folder_name_combo)); g_signal_connect (dialog, "response", G_CALLBACK (subscribe_to_folder), subscription_info); gtk_widget_show (dialog); diff --git a/plugins/exchange-operations/exchange-folder-subscription.h b/plugins/exchange-operations/exchange-folder-subscription.h index 15323cad09..942cc3a0e8 100644 --- a/plugins/exchange-operations/exchange-folder-subscription.h +++ b/plugins/exchange-operations/exchange-folder-subscription.h @@ -21,7 +21,14 @@ #ifndef __EXCHANGE_FOLDER_SUBSCRIPTION_H__ #define __EXCHANGE_FOLDER_SUBSCRIPTION_H__ +#include +#include +#include + gboolean create_folder_subscription_dialog (ExchangeAccount *account, const gchar *fname); +void call_folder_subscribe (const gchar *folder_name); +void call_folder_unsubscribe (const gchar *folder_type, const gchar *uri, ESource *source); + #endif diff --git a/plugins/exchange-operations/exchange-folder-tree.glade b/plugins/exchange-operations/exchange-folder-tree.glade deleted file mode 100644 index 487b2cee88..0000000000 --- a/plugins/exchange-operations/exchange-folder-tree.glade +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - True - Exchange Folder Tree - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - 250 - 300 - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 0 - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-folder.c b/plugins/exchange-operations/exchange-folder.c index 7c9f1bff41..5fe43453e7 100644 --- a/plugins/exchange-operations/exchange-folder.c +++ b/plugins/exchange-operations/exchange-folder.c @@ -29,9 +29,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -40,42 +37,70 @@ #include #include "exchange-operations.h" -#include "addressbook/gui/widgets/eab-popup.h" #include "exchange-folder-subscription.h" -void org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target, const gchar *fname); -void org_gnome_exchange_inbox_subscription (EPlugin *ep, EMMenuTargetSelect *target); -void org_gnome_exchange_addressbook_subscription (EPlugin *ep, EMMenuTargetSelect *target); -void org_gnome_exchange_calendar_subscription (EPlugin *ep, EMMenuTargetSelect *target); -void org_gnome_exchange_tasks_subscription (EPlugin *ep, EMMenuTargetSelect *target); -void org_gnome_exchange_check_subscribed (EPlugin *ep, ECalPopupTargetSource *target); -void org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data); -void org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSource *target); -void org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data); -void org_gnome_exchange_check_inbox_subscribed (EPlugin *ep, EMPopupTargetFolder *target); -void org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data); -void popup_free (EPopup *ep, GSList *items, gpointer data); -void popup_inbox_free (EPopup *ep, GSList *items, gpointer data); -void popup_ab_free (EPopup *ep, GSList *items, gpointer data); -static void exchange_get_folder (gchar *uri, CamelFolder *folder, gpointer data); - #define CONF_KEY_SELECTED_CAL_SOURCES "/apps/evolution/calendar/display/selected_calendars" -static EPopupItem popup_inbox_items[] = { - { E_POPUP_ITEM, (gchar *) "29.inbox_unsubscribe", (gchar *) N_("Unsubscribe Folder..."), org_gnome_exchange_folder_inbox_unsubscribe, NULL, (gchar *) "folder-new", 0, EM_POPUP_FOLDER_INFERIORS } -}; +static CamelFolderInfo * +ex_create_folder_info (CamelStore *store, gchar *name, gchar *uri, + gint unread_count, gint flags) +{ + CamelFolderInfo *info; + const gchar *path; + + path = strstr (uri, "://"); + if (!path) + return NULL; + path = strchr (path + 3, '/'); + if (!path) + return NULL; + + info = camel_folder_info_new (); + info->name = name; + info->uri = uri; + info->full_name = g_strdup (path + 1); + info->unread = unread_count; + + return info; +} -void -popup_inbox_free (EPopup *ep, GSList *items, gpointer data) +static void +exchange_get_folder (gchar *uri, CamelFolder *folder, gpointer data) { - g_slist_free (items); + CamelStore *store; + CamelException ex; + CamelFolderInfo *info; + gchar *name = NULL; + gchar *stored_name = NULL; + gchar *target_uri = (gchar *)data; + ExchangeAccount *account = NULL; + + account = exchange_operations_get_exchange_account (); + + if (!account) + return; + + /* Get the subscribed folder name. */ + name = target_uri + strlen ("exchange://") + strlen (account->account_filename); + stored_name = strrchr (name + 1, '/'); + + if (stored_name) + name[stored_name - name] = '\0'; + + camel_exception_init (&ex); + store = camel_folder_get_parent_store (folder); + + /* Construct the CamelFolderInfo */ + info = ex_create_folder_info (store, name, target_uri, -1, 0); + camel_object_trigger_event (CAMEL_OBJECT (store), + "folder_unsubscribed", info); + g_free (target_uri); } -void -org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data) +static void +eex_folder_inbox_unsubscribe (const gchar *uri) { ExchangeAccount *account = NULL; - EMPopupTargetFolder *target = data; gchar *path = NULL; gchar *stored_path = NULL; const gchar *inbox_uri = NULL; @@ -89,8 +114,8 @@ org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, gpointer if (!account) return; - target_uri = g_strdup (target->uri); - path = target->uri + strlen ("exchange://") + strlen (account->account_filename); + target_uri = g_strdup (uri); + path = g_strdup (uri + strlen ("exchange://") + strlen (account->account_filename)); /* User will be able to unsubscribe by doing a right click on any one of this two-Inbox or the tree. @@ -101,6 +126,8 @@ org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, gpointer path[stored_path - path] = '\0'; result = exchange_account_remove_shared_folder (account, path); + g_free (path); + switch (result) { case EXCHANGE_ACCOUNT_FOLDER_OK: break; @@ -140,199 +167,10 @@ org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, gpointer /* To get the CamelStore/Folder */ mail_get_folder (inbox_physical_uri, 0, exchange_get_folder, target_uri, mail_msg_unordered_push); - -} - -static CamelFolderInfo * -ex_create_folder_info (CamelStore *store, gchar *name, gchar *uri, - gint unread_count, gint flags) -{ - CamelFolderInfo *info; - const gchar *path; - - path = strstr (uri, "://"); - if (!path) - return NULL; - path = strchr (path + 3, '/'); - if (!path) - return NULL; - - info = camel_folder_info_new (); - info->name = name; - info->uri = uri; - info->full_name = g_strdup (path + 1); - info->unread = unread_count; - - return info; -} - -static void -exchange_get_folder (gchar *uri, CamelFolder *folder, gpointer data) -{ - CamelStore *store; - CamelException ex; - CamelFolderInfo *info; - gchar *name = NULL; - gchar *stored_name = NULL; - gchar *target_uri = (gchar *)data; - ExchangeAccount *account = NULL; - - account = exchange_operations_get_exchange_account (); - - if (!account) - return; - - /* Get the subscribed folder name. */ - name = target_uri + strlen ("exchange://") + strlen (account->account_filename); - stored_name = strrchr (name + 1, '/'); - - if (stored_name) - name[stored_name - name] = '\0'; - - camel_exception_init (&ex); - store = camel_folder_get_parent_store (folder); - - /* Construct the CamelFolderInfo */ - info = ex_create_folder_info (store, name, target_uri, -1, 0); - camel_object_trigger_event (CAMEL_OBJECT (store), - "folder_unsubscribed", info); - g_free (target_uri); -} - -void -org_gnome_exchange_check_inbox_subscribed (EPlugin *ep, EMPopupTargetFolder *target) -{ - GSList *menus = NULL; - gint i = 0; - ExchangeAccount *account = NULL; - gchar *path = NULL; - gchar *sub_folder = NULL; - - if (!g_strrstr (target->uri, "exchange://")) - return; - - account = exchange_operations_get_exchange_account (); - if (!account) - return; - - path = g_strdup (target->uri + strlen ("exchange://") + strlen (account->account_filename)); - sub_folder = strchr (path, '@'); - - g_free (path); - - if (!sub_folder || !g_strrstr(sub_folder, "/")) - return; - - for (i = 0; i < sizeof (popup_inbox_items) / sizeof (popup_inbox_items[0]); i++) - menus = g_slist_prepend (menus, &popup_inbox_items[i]); - - e_popup_add_items (target->target.popup, menus, NULL, popup_inbox_free, target); -} - -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar *) "29.calendar_unsubscribe", (gchar *) N_("Unsubscribe Folder..."), org_gnome_exchange_folder_unsubscribe, NULL, (gchar *) "folder-new", 0, EM_POPUP_FOLDER_INFERIORS } -}; - -void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); -} - -static EPopupItem popup_ab_items[] = { - { E_POPUP_ITEM, (gchar *) "29.address_book_unsubscribe", (gchar *) N_("Unsubscribe Folder..."), org_gnome_exchange_folder_ab_unsubscribe, NULL, (gchar *) "folder-new", 0, EM_POPUP_FOLDER_INFERIORS } -}; - -void -popup_ab_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); -} - -void -org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSource *target) -{ - GSList *menus = NULL; - gint i = 0; - ESource *source = NULL; - gchar *uri = NULL; - gchar *path = NULL; - gchar *sub_folder = NULL; - const gchar *base_uri; - ExchangeAccount *account = NULL; - ESourceGroup *group; - - account = exchange_operations_get_exchange_account (); - - if (!account) - return; - - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); - group = e_source_peek_group (source); - base_uri = e_source_group_peek_base_uri (group); - if (!base_uri || strcmp (base_uri, "exchange://")) - return; - - uri = e_source_get_uri (source); - path = g_strdup (uri + strlen ("exchange://") + strlen (account->account_filename) + strlen ("/;")); - g_free (uri); - sub_folder = strchr (path, '@'); - - if (!sub_folder) { - g_free (path); - return; - } - - for (i = 0; i < sizeof (popup_ab_items) / sizeof (popup_ab_items[0]); i++) - menus = g_slist_prepend (menus, &popup_ab_items[i]); - - e_popup_add_items (target->target.popup, menus, NULL, popup_ab_free, target); - g_free (path); - -} - -void -org_gnome_exchange_check_subscribed (EPlugin *ep, ECalPopupTargetSource *target) -{ - GSList *menus = NULL; - gint i = 0; - ESource *source = NULL; - gchar *ruri = NULL; - gchar *path = NULL; - gchar *sub_folder = NULL; - const gchar *base_uri; - ExchangeAccount *account = NULL; - ESourceGroup *group; - - account = exchange_operations_get_exchange_account (); - - if (!account) - return; - - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); - group = e_source_peek_group (source); - base_uri = e_source_group_peek_base_uri (group); - if (!base_uri || strcmp (base_uri, "exchange://")) - return; - - ruri = (gchar *) e_source_peek_relative_uri (source); - path = g_strdup (ruri + strlen (account->account_filename) + strlen ("/;")); - sub_folder = strchr (path, '@'); - - if (!sub_folder) { - g_free (path); - return; - } - - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - - e_popup_add_items (target->target.popup, menus, NULL, popup_free, target); - g_free (path); } static void -unsubscribe_dialog_ab_response (GtkDialog *dialog, gint response, gpointer data) +unsubscribe_dialog_ab_response (GtkDialog *dialog, gint response, ESource *source) { if (response == GTK_RESPONSE_OK) { @@ -341,15 +179,14 @@ unsubscribe_dialog_ab_response (GtkDialog *dialog, gint response, gpointer data) gchar *uri = NULL; const gchar *source_uid = NULL; ESourceGroup *source_group = NULL; - ESource *source = NULL; - EABPopupTargetSource *target = data; + + g_return_if_fail (source != NULL); account = exchange_operations_get_exchange_account (); if (!account) return; - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); uri = e_source_get_uri (source); path = g_strdup (uri + strlen ("exchange://") + strlen (account->account_filename)); source_uid = e_source_peek_uid (source); @@ -368,7 +205,7 @@ unsubscribe_dialog_ab_response (GtkDialog *dialog, gint response, gpointer data) } static void -unsubscribe_dialog_response (GtkDialog *dialog, gint response, gpointer data) +unsubscribe_dialog_response (GtkDialog *dialog, gint response, ESource *source) { if (response == GTK_RESPONSE_OK) { @@ -379,8 +216,8 @@ unsubscribe_dialog_response (GtkDialog *dialog, gint response, gpointer data) const gchar *source_uid = NULL; GConfClient *client; ESourceGroup *source_group = NULL; - ESource *source = NULL; - ECalPopupTargetSource *target = data; + + g_return_if_fail (source != NULL); client = gconf_client_get_default (); @@ -389,7 +226,6 @@ unsubscribe_dialog_response (GtkDialog *dialog, gint response, gpointer data) if (!account) return; - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); ruri = (gchar *) e_source_peek_relative_uri (source); source_uid = e_source_peek_uid (source); @@ -426,12 +262,10 @@ unsubscribe_dialog_response (GtkDialog *dialog, gint response, gpointer data) gtk_widget_destroy (GTK_WIDGET (dialog)); } -void -org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data) +static void +eex_addresssbook_unsubscribe (ESource *source) { GtkWidget *dialog = NULL; - EABPopupTargetSource *target = data; - ESource *source = NULL; ExchangeAccount *account = NULL; gchar *title = NULL; gchar *displayed_folder_name = NULL; @@ -439,13 +273,13 @@ org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, gpointer da gint mode; ExchangeConfigListenerStatus status; - account = exchange_operations_get_exchange_account (); + g_return_if_fail (source != NULL); + account = exchange_operations_get_exchange_account (); if (!account) return; status = exchange_is_offline (&mode); - if (status != CONFIG_LISTENER_STATUS_OK) { g_warning ("Config listener not found"); return; @@ -454,7 +288,6 @@ org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, gpointer da return; } - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); displayed_folder_name = (gchar *) e_source_peek_name (source); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, @@ -479,14 +312,13 @@ org_gnome_exchange_folder_ab_unsubscribe (EPopup *ep, EPopupItem *p, gpointer da g_free (displayed_folder_name); gtk_widget_show (dialog); - unsubscribe_dialog_ab_response (GTK_DIALOG (dialog), response, data); + unsubscribe_dialog_ab_response (GTK_DIALOG (dialog), response, source); } -void -org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data) + +static void +eex_calendar_unsubscribe (ESource *source) { GtkWidget *dialog = NULL; - ECalPopupTargetSource *target = data; - ESource *source = NULL; ExchangeAccount *account = NULL; gchar *title = NULL; const gchar *displayed_folder_name; @@ -494,8 +326,9 @@ org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data) gint mode; ExchangeConfigListenerStatus status; - account = exchange_operations_get_exchange_account (); + g_return_if_fail (source != NULL); + account = exchange_operations_get_exchange_account (); if (!account) return; @@ -509,7 +342,6 @@ org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data) return; } - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); displayed_folder_name = e_source_peek_name (source); dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, @@ -533,28 +365,27 @@ org_gnome_exchange_folder_unsubscribe (EPopup *ep, EPopupItem *p, gpointer data) g_free (title); gtk_widget_show (dialog); - unsubscribe_dialog_response (GTK_DIALOG (dialog), response, data); + unsubscribe_dialog_response (GTK_DIALOG (dialog), response, source); } void -org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target, const gchar *fname) +call_folder_subscribe (const gchar *folder_name) { ExchangeAccount *account = NULL; gint mode; ExchangeConfigListenerStatus status; - account = exchange_operations_get_exchange_account (); + g_return_if_fail (folder_name != NULL); + account = exchange_operations_get_exchange_account (); if (!account) return; status = exchange_is_offline (&mode); - if (status != CONFIG_LISTENER_STATUS_OK) { g_warning ("Config listener not found"); return; - } - else if (mode == OFFLINE_MODE) { + } else if (mode == OFFLINE_MODE) { /* Translators: this error code can be used for any operation * (like subscribing to other user's folders, unsubscribing * etc,) which can not be performed in offline mode @@ -563,33 +394,27 @@ org_gnome_exchange_folder_subscription (EPlugin *ep, EMMenuTargetSelect *target, return; } - create_folder_subscription_dialog (account, fname); + create_folder_subscription_dialog (account, folder_name); } void -org_gnome_exchange_calendar_subscription (EPlugin *ep, EMMenuTargetSelect *target) +call_folder_unsubscribe (const gchar *folder_type, const gchar *uri, ESource *source) { - const gchar *folder_name = N_("Calendar"); - org_gnome_exchange_folder_subscription (ep, target, folder_name); -} - -void -org_gnome_exchange_addressbook_subscription (EPlugin *ep, EMMenuTargetSelect *target) -{ - const gchar *folder_name = N_("Contacts"); - org_gnome_exchange_folder_subscription (ep, target, folder_name); -} - -void -org_gnome_exchange_tasks_subscription (EPlugin *ep, EMMenuTargetSelect *target) -{ - const gchar *folder_name = N_("Tasks"); - org_gnome_exchange_folder_subscription (ep, target, folder_name); -} - -void -org_gnome_exchange_inbox_subscription (EPlugin *ep, EMMenuTargetSelect *target) -{ - const gchar *folder_name = N_("Inbox"); - org_gnome_exchange_folder_subscription (ep, target, folder_name); + g_return_if_fail (folder_type != NULL); + g_return_if_fail (uri != NULL); + + if (g_str_equal (folder_type, N_("Inbox"))) { + eex_folder_inbox_unsubscribe (uri); + } else if (g_str_equal (folder_type, N_("Calendar"))) { + g_return_if_fail (source != NULL); + eex_calendar_unsubscribe (source); + } else if (g_str_equal (folder_type, N_("Tasks"))) { + g_return_if_fail (source != NULL); + eex_calendar_unsubscribe (source); + } else if (g_str_equal (folder_type, N_("Contacts"))) { + g_return_if_fail (source != NULL); + eex_addresssbook_unsubscribe (source); + } else { + g_return_if_reached (); + } } diff --git a/plugins/exchange-operations/exchange-oof.glade b/plugins/exchange-operations/exchange-oof.glade deleted file mode 100644 index 8e8c5617a4..0000000000 --- a/plugins/exchange-operations/exchange-oof.glade +++ /dev/null @@ -1,530 +0,0 @@ - - - - - - - 6 - Out of Office Assistant - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - False - False - True - - - - True - False - 6 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - GTK_RELIEF_NORMAL - -9 - - - - True - 0.5 - 0.5 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-no - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - No, Don't Change Status - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - GTK_RELIEF_NORMAL - -8 - - - - True - 0.5 - 0.5 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-yes - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Yes, Change Status - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 6 - - - - True - gtk-dialog-question - 6 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - True - - - - - - True - <b>Currently, your status is "Out of the Office". </b> - -Would you like to change your status to "In the Office"? - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - True - Out of Office Assistant - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 6 - - - - True - False - 6 - - - - True - gtk-dialog-info - 5 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - <small>The message specified below will be automatically sent to each person who sends -mail to you while you are out of the office.</small> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - False - False - - - - - - 6 - True - 2 - 2 - False - 6 - 6 - - - - True - <b>Status:</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - I am currently in the office - True - GTK_RELIEF_NORMAL - False - False - True - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - True - I am currently out of the office - True - GTK_RELIEF_NORMAL - False - False - True - oof_no_radio - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - 0 - False - True - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - 6 - True - False - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_OUT - GTK_CORNER_TOP_LEFT - - - - True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - True - True - - - - - - - - True - <b>Out of Office Message:</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-operations.h b/plugins/exchange-operations/exchange-operations.h index d735ff8ce8..60c2f200fc 100644 --- a/plugins/exchange-operations/exchange-operations.h +++ b/plugins/exchange-operations/exchange-operations.h @@ -35,7 +35,7 @@ G_BEGIN_DECLS extern ExchangeConfigListener *exchange_global_config_listener; -gint e_plugin_lib_enable (EPluginLib *eplib, gint enable); +gint e_plugin_lib_enable (EPlugin *eplib, gint enable); ExchangeAccount *exchange_operations_get_exchange_account (void); ExchangeConfigListenerStatus exchange_is_offline (gint *mode); diff --git a/plugins/exchange-operations/exchange-passwd-expiry.glade b/plugins/exchange-operations/exchange-passwd-expiry.glade deleted file mode 100644 index 14c430f65d..0000000000 --- a/plugins/exchange-operations/exchange-passwd-expiry.glade +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - True - Password Expiry Warning... - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - True - True - _Change Password - True - GTK_RELIEF_NORMAL - 0 - - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - -5 - - ok_button - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - Your password will expire in 7 days... - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 20 - - - 0 - False - False - - - - - - - diff --git a/plugins/exchange-operations/exchange-permissions-dialog.c b/plugins/exchange-operations/exchange-permissions-dialog.c index d8182a6fe1..20af66ed91 100644 --- a/plugins/exchange-operations/exchange-permissions-dialog.c +++ b/plugins/exchange-operations/exchange-permissions-dialog.c @@ -41,7 +41,6 @@ #include #include -#include struct _ExchangePermissionsDialogPrivate { ExchangeAccount *account; @@ -122,8 +121,7 @@ init (GObject *object) E2K_MAKE_TYPE (exchange_permissions_dialog, ExchangePermissionsDialog, class_init, init, PARENT_TYPE) -static void get_widgets (ExchangePermissionsDialog *dialog, - GladeXML *xml); +static GtkWidget *create_permissions_vbox (ExchangePermissionsDialog *dialog); static void setup_user_list (ExchangePermissionsDialog *dialog); static void display_permissions (ExchangePermissionsDialog *dialog); static void dialog_response (ExchangePermissionsDialog *dialog, @@ -152,7 +150,6 @@ exchange_permissions_dialog_new (ExchangeAccount *account, const gchar *base_uri, *folder_uri, *folder_path; E2kContext *ctx; ExchangeHierarchy *hier; - GladeXML *xml; GtkWidget *box; gchar *title; E2kHTTPStatus status; @@ -165,10 +162,6 @@ exchange_permissions_dialog_new (ExchangeAccount *account, ctx = exchange_account_get_context (account); g_return_if_fail (ctx); - xml = glade_xml_new ( - CONNECTOR_GLADEDIR "/exchange-permissions-dialog.glade", - "permissions_vbox", PACKAGE); - g_return_if_fail (xml != NULL); /* Create the dialog */ dialog = g_object_new (EXCHANGE_TYPE_PERMISSIONS_DIALOG, NULL); @@ -188,16 +181,9 @@ exchange_permissions_dialog_new (ExchangeAccount *account, dialog->priv->changed = FALSE; - /* Put the widgets from the glade file into it */ - box = glade_xml_get_widget (xml, "permissions_vbox"); - g_object_ref (box); - gtk_widget_unparent (box); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + box = create_permissions_vbox (dialog); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), box, TRUE, TRUE, 0); - g_object_unref (box); - - get_widgets (dialog, xml); - g_object_unref (xml); dialog->priv->account = account; g_object_ref (account); @@ -684,13 +670,247 @@ display_permissions (ExchangePermissionsDialog *dialog) dialog->priv->frozen = FALSE; } -static void -get_widgets (ExchangePermissionsDialog *dialog, GladeXML *xml) +static GtkWidget * +exchange_permissions_role_optionmenu_new (void) +{ + GtkWidget *menu; + const gchar **roles; + gint role; + + menu = gtk_combo_box_new_text (); + roles = g_new (const gchar *, E2K_PERMISSIONS_ROLE_NUM_ROLES + 1); + for (role = 0; role < E2K_PERMISSIONS_ROLE_NUM_ROLES; role++) { + roles[role] = e2k_permissions_role_get_name (role); + gtk_combo_box_append_text (GTK_COMBO_BOX (menu), roles[role]); + } + + roles[role] = NULL; + + g_free (roles); + + gtk_widget_show (menu); + return menu; +} + +static GtkWidget * +create_permissions_vbox (ExchangePermissionsDialog *dialog) { - GtkWidget *button; + GtkWidget *permissions_vbox; + GtkWidget *hbox1; + GtkWidget *scrolledwindow1; + GtkWidget *list_view; + GtkWidget *vbuttonbox1; + GtkWidget *add_button; + GtkWidget *remove_button; + GtkWidget *table2; + GtkWidget *label6; + GtkWidget *label7; + GtkWidget *label3; + GtkWidget *hbox3; + GtkWidget *label4; + GtkWidget *role_optionmenu; + GtkWidget *hbox2; + GtkWidget *vbox6; + GtkWidget *vbox8; + GtkWidget *create_items_check; + GtkWidget *read_items_check; + GtkWidget *create_subfolders_check; + GtkWidget *vbox9; + GtkWidget *edit_none_radio; + GSList *edit_none_radio_group = NULL; + GtkWidget *edit_own_radio; + GtkWidget *edit_all_radio; + GtkWidget *vbox7; + GtkWidget *vbox10; + GtkWidget *folder_owner_check; + GtkWidget *folder_contact_check; + GtkWidget *folder_visible_check; + GtkWidget *vbox11; + GtkWidget *delete_none_radio; + GSList *delete_none_radio_group = NULL; + GtkWidget *delete_own_radio; + GtkWidget *delete_all_radio; + gchar *tmp_str; GtkTreeViewColumn *column; -#define GET_WIDGET(name, type) dialog->priv->name = type (glade_xml_get_widget (xml, #name)) + permissions_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_show (permissions_vbox); + gtk_container_set_border_width (GTK_CONTAINER (permissions_vbox), 6); + + hbox1 = gtk_hbox_new (FALSE, 6); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (permissions_vbox), hbox1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox1), 6); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow1, TRUE, TRUE, 0); + GTK_WIDGET_UNSET_FLAGS (scrolledwindow1, GTK_CAN_FOCUS); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN); + + list_view = gtk_tree_view_new (); + gtk_widget_show (list_view); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), list_view); + + vbuttonbox1 = gtk_vbutton_box_new (); + gtk_widget_show (vbuttonbox1); + gtk_box_pack_start (GTK_BOX (hbox1), vbuttonbox1, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbuttonbox1), 4); + gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_SPREAD); + gtk_box_set_spacing (GTK_BOX (vbuttonbox1), 10); + + add_button = gtk_button_new_from_stock ("gtk-add"); + gtk_widget_show (add_button); + gtk_container_add (GTK_CONTAINER (vbuttonbox1), add_button); + GTK_WIDGET_SET_FLAGS (add_button, GTK_CAN_DEFAULT); + + remove_button = gtk_button_new_from_stock ("gtk-remove"); + gtk_widget_show (remove_button); + gtk_container_add (GTK_CONTAINER (vbuttonbox1), remove_button); + GTK_WIDGET_SET_FLAGS (remove_button, GTK_CAN_DEFAULT); + + table2 = gtk_table_new (3, 2, FALSE); + gtk_widget_show (table2); + gtk_box_pack_start (GTK_BOX (permissions_vbox), table2, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (table2), 6); + gtk_table_set_row_spacings (GTK_TABLE (table2), 6); + + label6 = gtk_label_new (" "); + gtk_widget_show (label6); + gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); + + label7 = gtk_label_new (" "); + gtk_widget_show (label7); + gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); + + tmp_str = g_strconcat ("", _("Permissions"), "", NULL); + label3 = gtk_label_new (tmp_str); + g_free (tmp_str); + gtk_widget_show (label3); + gtk_table_attach (GTK_TABLE (table2), label3, 0, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_use_markup (GTK_LABEL (label3), TRUE); + gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); + + hbox3 = gtk_hbox_new (FALSE, 6); + gtk_widget_show (hbox3); + gtk_table_attach (GTK_TABLE (table2), hbox3, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox3), 6); + + label4 = gtk_label_new (_("Role: ")); + gtk_widget_show (label4); + gtk_box_pack_start (GTK_BOX (hbox3), label4, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER); + + role_optionmenu = exchange_permissions_role_optionmenu_new (); + gtk_widget_show (role_optionmenu); + gtk_box_pack_start (GTK_BOX (hbox3), role_optionmenu, TRUE, TRUE, 0); + GTK_WIDGET_UNSET_FLAGS (role_optionmenu, GTK_CAN_FOCUS); + GTK_WIDGET_UNSET_FLAGS (role_optionmenu, GTK_CAN_DEFAULT); + + hbox2 = gtk_hbox_new (TRUE, 6); + gtk_widget_show (hbox2); + gtk_table_attach (GTK_TABLE (table2), hbox2, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox2), 6); + + vbox6 = gtk_vbox_new (FALSE, 12); + gtk_widget_show (vbox6); + gtk_box_pack_start (GTK_BOX (hbox2), vbox6, TRUE, TRUE, 0); + + vbox8 = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox8); + gtk_box_pack_start (GTK_BOX (vbox6), vbox8, TRUE, TRUE, 0); + + create_items_check = gtk_check_button_new_with_mnemonic (_("Create items")); + gtk_widget_show (create_items_check); + gtk_box_pack_start (GTK_BOX (vbox8), create_items_check, FALSE, FALSE, 0); + + read_items_check = gtk_check_button_new_with_mnemonic (_("Read items")); + gtk_widget_show (read_items_check); + gtk_box_pack_start (GTK_BOX (vbox8), read_items_check, FALSE, FALSE, 0); + + create_subfolders_check = gtk_check_button_new_with_mnemonic (_("Create subfolders")); + gtk_widget_show (create_subfolders_check); + gtk_box_pack_start (GTK_BOX (vbox8), create_subfolders_check, FALSE, FALSE, 0); + + vbox9 = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox9); + gtk_box_pack_start (GTK_BOX (vbox6), vbox9, TRUE, TRUE, 0); + + edit_none_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Cannot Edit")); + gtk_widget_show (edit_none_radio); + gtk_box_pack_start (GTK_BOX (vbox9), edit_none_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (edit_none_radio), edit_none_radio_group); + edit_none_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (edit_none_radio)); + + edit_own_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Edit Own Items")); + gtk_widget_show (edit_own_radio); + gtk_box_pack_start (GTK_BOX (vbox9), edit_own_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (edit_own_radio), edit_none_radio_group); + edit_none_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (edit_own_radio)); + + edit_all_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Edit Any Items")); + gtk_widget_show (edit_all_radio); + gtk_box_pack_start (GTK_BOX (vbox9), edit_all_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (edit_all_radio), edit_none_radio_group); + edit_none_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (edit_all_radio)); + + vbox7 = gtk_vbox_new (FALSE, 12); + gtk_widget_show (vbox7); + gtk_box_pack_start (GTK_BOX (hbox2), vbox7, TRUE, TRUE, 0); + + vbox10 = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox10); + gtk_box_pack_start (GTK_BOX (vbox7), vbox10, TRUE, TRUE, 0); + + folder_owner_check = gtk_check_button_new_with_mnemonic (_("Folder owner")); + gtk_widget_show (folder_owner_check); + gtk_box_pack_start (GTK_BOX (vbox10), folder_owner_check, FALSE, FALSE, 0); + + folder_contact_check = gtk_check_button_new_with_mnemonic (_("Folder contact")); + gtk_widget_show (folder_contact_check); + gtk_box_pack_start (GTK_BOX (vbox10), folder_contact_check, FALSE, FALSE, 0); + + folder_visible_check = gtk_check_button_new_with_mnemonic (_("Folder visible")); + gtk_widget_show (folder_visible_check); + gtk_box_pack_start (GTK_BOX (vbox10), folder_visible_check, FALSE, FALSE, 0); + + vbox11 = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox11); + gtk_box_pack_start (GTK_BOX (vbox7), vbox11, TRUE, TRUE, 0); + + delete_none_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Cannot Delete")); + gtk_widget_show (delete_none_radio); + gtk_box_pack_start (GTK_BOX (vbox11), delete_none_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (delete_none_radio), delete_none_radio_group); + delete_none_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (delete_none_radio)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (delete_none_radio), TRUE); + + delete_own_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Delete Own Items")); + gtk_widget_show (delete_own_radio); + gtk_box_pack_start (GTK_BOX (vbox11), delete_own_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (delete_own_radio), delete_none_radio_group); + delete_none_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (delete_own_radio)); + + delete_all_radio = gtk_radio_button_new_with_mnemonic (NULL, _("Delete Any Items")); + gtk_widget_show (delete_all_radio); + gtk_box_pack_start (GTK_BOX (vbox11), delete_all_radio, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (delete_all_radio), delete_none_radio_group); + delete_none_radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (delete_all_radio)); + +#define GET_WIDGET(name, type) dialog->priv->name = type (name) GET_WIDGET (list_view, GTK_TREE_VIEW); column = gtk_tree_view_column_new_with_attributes ( @@ -714,11 +934,9 @@ get_widgets (ExchangePermissionsDialog *dialog, GladeXML *xml) gtk_tree_view_set_model (dialog->priv->list_view, GTK_TREE_MODEL (dialog->priv->list_store)); - button = glade_xml_get_widget (xml, "add_button"); - g_signal_connect (button, "clicked", + g_signal_connect (add_button, "clicked", G_CALLBACK (add_clicked), dialog); - button = glade_xml_get_widget (xml, "remove_button"); - g_signal_connect (button, "clicked", + g_signal_connect (remove_button, "clicked", G_CALLBACK (remove_clicked), dialog); GET_WIDGET (role_optionmenu, GTK_COMBO_BOX); @@ -761,28 +979,6 @@ get_widgets (ExchangePermissionsDialog *dialog, GladeXML *xml) "toggled", G_CALLBACK (rv_toggle), dialog); g_signal_connect (dialog->priv->read_items_check, "toggled", G_CALLBACK (rv_toggle), dialog); -} - -GtkWidget *exchange_permissions_role_optionmenu_new (gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2); -GtkWidget * -exchange_permissions_role_optionmenu_new (gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2) -{ - GtkWidget *menu; - const gchar **roles; - gint role; - - menu = gtk_combo_box_new_text (); - roles = g_new (const gchar *, E2K_PERMISSIONS_ROLE_NUM_ROLES + 1); - for (role = 0; role < E2K_PERMISSIONS_ROLE_NUM_ROLES; role++) { - roles[role] = e2k_permissions_role_get_name (role); - gtk_combo_box_append_text (GTK_COMBO_BOX (menu), roles[role]); - } - - roles[role] = NULL; - - g_free (roles); - - gtk_widget_show (menu); - return menu; + return permissions_vbox; } diff --git a/plugins/exchange-operations/exchange-permissions-dialog.glade b/plugins/exchange-operations/exchange-permissions-dialog.glade deleted file mode 100644 index 91404ffb1d..0000000000 --- a/plugins/exchange-operations/exchange-permissions-dialog.glade +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - - - True - window1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - - - - 6 - True - False - 0 - - - - 6 - True - False - 6 - - - - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - - - - 0 - True - True - - - - - - 4 - True - GTK_BUTTONBOX_SPREAD - 10 - - - - True - True - True - gtk-add - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-remove - True - GTK_RELIEF_NORMAL - True - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - 6 - True - 3 - 2 - False - 6 - 0 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 2 - 3 - fill - - - - - - - True - <b>Permissions</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 2 - 0 - 1 - fill - - - - - - - 6 - True - False - 6 - - - - True - Role: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - exchange_permissions_role_optionmenu_new - 0 - 0 - Tue, 06 Aug 2002 20:48:43 GMT - - - 0 - True - True - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - 6 - True - True - 6 - - - - True - False - 12 - - - - True - False - 6 - - - - True - True - Create items - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Read items - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Create subfolders - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - True - Cannot Edit - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Edit Own Items - True - GTK_RELIEF_NORMAL - True - False - False - True - edit_none_radio - - - 0 - False - False - - - - - - True - True - Edit Any Items - True - GTK_RELIEF_NORMAL - True - False - False - True - edit_none_radio - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 12 - - - - True - False - 6 - - - - True - True - Folder owner - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Folder contact - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - True - Folder visible - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - True - Cannot Delete - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 0 - False - False - - - - - - True - True - Delete Own Items - True - GTK_RELIEF_NORMAL - True - False - False - True - delete_none_radio - - - 0 - False - False - - - - - - True - True - Delete Any Items - True - GTK_RELIEF_NORMAL - True - False - False - True - delete_none_radio - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 1 - 2 - 2 - 3 - fill - fill - - - - - 0 - False - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-send-options.c b/plugins/exchange-operations/exchange-send-options.c index 4c6e705b9d..ecc0f0359c 100644 --- a/plugins/exchange-operations/exchange-send-options.c +++ b/plugins/exchange-operations/exchange-send-options.c @@ -30,18 +30,13 @@ #include "exchange-operations.h" #include #include -#include #include "e-util/e-util-private.h" #include "exchange-send-options.h" struct _ExchangeSendOptionsDialogPrivate { - /* Glade XML data */ - GladeXML *xml; - /*Widgets*/ - GtkWidget *main; /*name selector dialog*/ @@ -168,40 +163,6 @@ exchange_send_options_get_widgets_data (ExchangeSendOptionsDialog *sod) return 1; } -static gboolean -get_widgets (ExchangeSendOptionsDialog *sod) -{ - ExchangeSendOptionsDialogPrivate *priv; - - priv = sod->priv; - -#define EXCHANGE(name) glade_xml_get_widget (priv->xml, name) - - priv->main = EXCHANGE ("send_options"); - if (!priv->main) - return FALSE; - - priv->importance = EXCHANGE ("imp_combo_box"); - priv->sensitivity = EXCHANGE ("sensitivity_combo_box"); - priv->button_user = EXCHANGE ("button-user"); - priv->delegate_enabled = EXCHANGE ("del_enabled_check"); - priv->read_receipt = EXCHANGE ("read_check_button"); - priv->delivery_receipt = EXCHANGE ("delivery_check_button"); - priv->importance_label = EXCHANGE ("Importance_label"); - priv->sensitivity_label = EXCHANGE ("Sensitivity_label"); - -#undef EXCHANGE - - return (priv->importance - &&priv->sensitivity - &&priv->button_user - &&priv->delegate_enabled - &&priv->read_receipt - &&priv->delivery_receipt - &&priv->importance_label - &&priv->sensitivity_label); -} - static void exchange_send_options_fill_widgets_with_data (ExchangeSendOptionsDialog *sod) { @@ -292,7 +253,6 @@ static void exchange_send_options_cb (GtkDialog *dialog, gint state, gpointer fu case GTK_RESPONSE_CANCEL: gtk_widget_hide (priv->main); gtk_widget_destroy (priv->main); - g_object_unref (priv->xml); break; case GTK_RESPONSE_HELP: e_display_help ( @@ -367,40 +327,162 @@ exchange_sendoptions_dialog_run (ExchangeSendOptionsDialog *sod, GtkWidget *pare ExchangeSendOptionsDialogPrivate *priv; ExchangeSendOptions *options; - GtkWidget *toplevel; - gchar *filename; EDestinationStore *destination_store; ENameSelectorDialog *name_selector_dialog; ENameSelectorModel *name_selector_model; ENameSelectorEntry *name_selector_entry; EDestination *des; - GtkWidget *name_box; + GtkWidget *send_options; + GtkWidget *send_options_vbox; + GtkWidget *options_vbox; + GtkWidget *message_settings_vbox; + GtkWidget *msg_settings_label; + GtkWidget *msg_settings_table; + GtkWidget *importance_label; + GtkWidget *sensitivity_label; + GtkWidget *sensitivity_combo_box; + GtkWidget *imp_combo_box; + GtkWidget *del_enabled_check; + GtkWidget *hbox1; + GtkWidget *hbox2; + GtkWidget *del_name_box; + GtkWidget *button_user; + GtkWidget *track_option_vbox; + GtkWidget *track_options_label; + GtkWidget *delivery_check_button; + GtkWidget *read_check_button; + gchar *tmp_str; g_return_val_if_fail (sod != NULL || EXCHANGE_IS_SENDOPTIONS_DIALOG (sod), FALSE); priv = sod->priv; options = sod->options; - filename = g_build_filename (EVOLUTION_GLADEDIR, - "exchange-send-options.glade", - NULL); - priv->xml = glade_xml_new (filename, NULL, NULL); - g_free (filename); - - if (!priv->xml) { - g_message ( G_STRLOC ": Could not load the Glade XML file "); - return FALSE; - } - - if (!get_widgets(sod)) { - g_object_unref (priv->xml); - g_message (G_STRLOC ": Could not get the Widgets \n"); - return FALSE; - } - - toplevel = gtk_widget_get_toplevel (priv->main); + send_options = gtk_dialog_new_with_buttons ( + _("Exchange - Send Options"), + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_HELP, GTK_RESPONSE_HELP, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + gtk_window_set_type_hint (GTK_WINDOW (send_options), GDK_WINDOW_TYPE_HINT_DIALOG); + + send_options_vbox = gtk_dialog_get_content_area (GTK_DIALOG (send_options)); + gtk_widget_show (send_options_vbox); + + options_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_show (options_vbox); + gtk_box_pack_start (GTK_BOX (send_options_vbox), options_vbox, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (options_vbox), 6); + + message_settings_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_show (message_settings_vbox); + gtk_box_pack_start (GTK_BOX (options_vbox), message_settings_vbox, FALSE, FALSE, 0); + + tmp_str = g_strconcat ("", _("Message Settings"), "", NULL); + msg_settings_label = gtk_label_new (tmp_str); + g_free (tmp_str); + gtk_widget_show (msg_settings_label); + gtk_box_pack_start (GTK_BOX (message_settings_vbox), msg_settings_label, FALSE, FALSE, 0); + gtk_label_set_use_markup (GTK_LABEL (msg_settings_label), TRUE); + gtk_misc_set_alignment (GTK_MISC (msg_settings_label), 0, 0.49); + + msg_settings_table = gtk_table_new (2, 2, FALSE); + gtk_widget_show (msg_settings_table); + gtk_box_pack_start (GTK_BOX (message_settings_vbox), msg_settings_table, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (msg_settings_table), 6); + gtk_table_set_row_spacings (GTK_TABLE (msg_settings_table), 6); + + importance_label = gtk_label_new_with_mnemonic (_("I_mportance: ")); + gtk_widget_show (importance_label); + gtk_table_attach (GTK_TABLE (msg_settings_table), importance_label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (importance_label), 0, 0.49); + + sensitivity_label = gtk_label_new_with_mnemonic (_("_Sensitivity: ")); + gtk_widget_show (sensitivity_label); + gtk_table_attach (GTK_TABLE (msg_settings_table), sensitivity_label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (sensitivity_label), 0, 0.5); + + sensitivity_combo_box = gtk_combo_box_new_text (); + gtk_widget_show (sensitivity_combo_box); + gtk_table_attach (GTK_TABLE (msg_settings_table), sensitivity_combo_box, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Normal")); + gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Personal")); + gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Private")); + gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Confidential")); + + imp_combo_box = gtk_combo_box_new_text (); + gtk_widget_show (imp_combo_box); + gtk_table_attach (GTK_TABLE (msg_settings_table), imp_combo_box, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (imp_combo_box), _("Normal")); + gtk_combo_box_append_text (GTK_COMBO_BOX (imp_combo_box), _("High")); + gtk_combo_box_append_text (GTK_COMBO_BOX (imp_combo_box), _("Low")); + + del_enabled_check = gtk_check_button_new_with_mnemonic (_("Send as Delegate")); + gtk_widget_show (del_enabled_check); + gtk_box_pack_start (GTK_BOX (options_vbox), del_enabled_check, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (del_enabled_check), 6); + + hbox1 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (options_vbox), hbox1, TRUE, TRUE, 0); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (hbox1), hbox2, TRUE, TRUE, 0); + + del_name_box = gtk_hbox_new (FALSE, 0); + gtk_widget_show (del_name_box); + gtk_box_pack_start (GTK_BOX (hbox2), del_name_box, TRUE, TRUE, 0); + + button_user = gtk_button_new_with_mnemonic (_("_User")); + gtk_widget_show (button_user); + gtk_box_pack_start (GTK_BOX (hbox1), button_user, FALSE, FALSE, 0); + + track_option_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_show (track_option_vbox); + gtk_box_pack_start (GTK_BOX (options_vbox), track_option_vbox, TRUE, TRUE, 0); + + tmp_str = g_strconcat ("", _("Tracking Options"), "", NULL); + track_options_label = gtk_label_new (tmp_str); + g_free (tmp_str); + gtk_widget_show (track_options_label); + gtk_box_pack_start (GTK_BOX (track_option_vbox), track_options_label, FALSE, FALSE, 6); + gtk_label_set_use_markup (GTK_LABEL (track_options_label), TRUE); + gtk_misc_set_alignment (GTK_MISC (track_options_label), 0, 0.5); + + delivery_check_button = gtk_check_button_new_with_mnemonic (_("Request a _delivery receipt for this message")); + gtk_widget_show (delivery_check_button); + gtk_box_pack_start (GTK_BOX (track_option_vbox), delivery_check_button, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (delivery_check_button), 6); + + read_check_button = gtk_check_button_new_with_mnemonic (_("Request a _read receipt for this message")); + gtk_widget_show (read_check_button); + gtk_box_pack_start (GTK_BOX (track_option_vbox), read_check_button, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (read_check_button), 6); + + priv->main = send_options; + priv->importance = imp_combo_box; + priv->sensitivity = sensitivity_combo_box; + priv->button_user = button_user; + priv->delegate_enabled = del_enabled_check; + priv->read_receipt = read_check_button; + priv->delivery_receipt = delivery_check_button; + priv->importance_label = importance_label; + priv->sensitivity_label = sensitivity_label; + + send_options = gtk_widget_get_toplevel (priv->main); if (parent) - gtk_window_set_transient_for (GTK_WINDOW (toplevel), + gtk_window_set_transient_for (GTK_WINDOW (send_options), GTK_WINDOW (parent)); priv->proxy_name_selector = e_name_selector_new (); @@ -435,8 +517,7 @@ exchange_sendoptions_dialog_run (ExchangeSendOptionsDialog *sod, GtkWidget *pare /* The name box is just a container. The name_selector_entry is added to it. This Widget is created dynamically*/ - name_box = glade_xml_get_widget (priv->xml, "del_name_box"); - gtk_container_add ((GtkContainer *) name_box, (GtkWidget *) name_selector_entry); + gtk_container_add ((GtkContainer *) del_name_box, (GtkWidget *) name_selector_entry); gtk_widget_show ((GtkWidget *) name_selector_entry); gtk_widget_grab_focus ((GtkWidget *) name_selector_entry); @@ -490,7 +571,6 @@ exchange_sendoptions_dialog_init (GObject *object) sod->options->importance = E_IMP_NORMAL; sod->options->sensitivity = E_SENSITIVITY_NORMAL; - priv->xml = NULL; priv->main = NULL; priv->importance = NULL; priv->sensitivity = NULL; diff --git a/plugins/exchange-operations/exchange-send-options.glade b/plugins/exchange-operations/exchange-send-options.glade deleted file mode 100644 index 518e0979e6..0000000000 --- a/plugins/exchange-operations/exchange-send-options.glade +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - True - Exchange - Send Options - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 0 - - - - True - False - 0 - - - - True - <b>Message Settings</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.490000009537 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - 6 - True - 2 - 2 - False - 6 - 0 - - - - True - I_mportance: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.490000009537 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - _Sensitivity: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - Normal -Personal -Private -Confidential - False - True - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - Normal -High -Low - False - True - - - 1 - 2 - 0 - 1 - fill - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - 6 - True - True - Send as Delegate - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - True - False - 0 - - - - True - False - 0 - - - - True - False - 0 - - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - True - _User - True - GTK_RELIEF_NORMAL - True - - - 0 - False - False - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - <b>Tracking Options</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 6 - False - False - - - - - - 6 - True - True - Request a _delivery receipt for this message - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - 6 - True - True - Request a _read receipt for this message - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - diff --git a/plugins/exchange-operations/exchange-user-dialog.c b/plugins/exchange-operations/exchange-user-dialog.c index 823226427d..908ffd39d1 100644 --- a/plugins/exchange-operations/exchange-user-dialog.c +++ b/plugins/exchange-operations/exchange-user-dialog.c @@ -134,7 +134,8 @@ e2k_user_dialog_construct (E2kUserDialog *dialog, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); + if (parent_window) + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window)); priv = dialog->priv; priv->section_name = g_strdup (section_name); diff --git a/plugins/exchange-operations/org-gnome-exchange-ab-subscription.xml b/plugins/exchange-operations/org-gnome-exchange-ab-subscription.xml deleted file mode 100644 index 81181ca4fb..0000000000 --- a/plugins/exchange-operations/org-gnome-exchange-ab-subscription.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - diff --git a/plugins/exchange-operations/org-gnome-exchange-cal-subscription.xml b/plugins/exchange-operations/org-gnome-exchange-cal-subscription.xml deleted file mode 100644 index 3b11479055..0000000000 --- a/plugins/exchange-operations/org-gnome-exchange-cal-subscription.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml index 063d5c98c6..fcd6ff074b 100644 --- a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml +++ b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml @@ -13,218 +13,108 @@ <_description>Activates the Evolution-Exchange extension package. - - - - - - - - - - - - - - - - + + + + + + - - - - - + + + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + + + - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/exchange-operations/org-gnome-exchange-tasks-subscription.xml b/plugins/exchange-operations/org-gnome-exchange-tasks-subscription.xml deleted file mode 100644 index bb63c9327f..0000000000 --- a/plugins/exchange-operations/org-gnome-exchange-tasks-subscription.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - diff --git a/plugins/exchange-operations/org-gnome-folder-permissions.xml b/plugins/exchange-operations/org-gnome-folder-permissions.xml deleted file mode 100644 index 785034df89..0000000000 --- a/plugins/exchange-operations/org-gnome-folder-permissions.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/plugins/exchange-operations/org-gnome-folder-subscription.xml b/plugins/exchange-operations/org-gnome-folder-subscription.xml deleted file mode 100644 index 3f65e94e19..0000000000 --- a/plugins/exchange-operations/org-gnome-folder-subscription.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - -- cgit v1.2.3