diff options
author | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-08-18 19:20:23 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-08-18 19:20:23 +0800 |
commit | 4f56bd0a43427ac45f7ca3ca20ca70a6e9696a64 (patch) | |
tree | fca0bbade652c437cc8aedf4d3b12ad11ae457ec | |
parent | 38909705f4d3f23febcee4f16114f9dc07d38f06 (diff) | |
download | gsoc2013-evolution-4f56bd0a43427ac45f7ca3ca20ca70a6e9696a64.tar.gz gsoc2013-evolution-4f56bd0a43427ac45f7ca3ca20ca70a6e9696a64.tar.zst gsoc2013-evolution-4f56bd0a43427ac45f7ca3ca20ca70a6e9696a64.zip |
Show the attachment bar menu items when needed.
svn path=/trunk/; revision=30157
-rw-r--r-- | calendar/ChangeLog | 22 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 21 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 34 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 16 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 1 | ||||
-rw-r--r-- | calendar/gui/e-cal-popup.c | 18 | ||||
-rw-r--r-- | calendar/gui/e-cal-popup.h | 5 |
9 files changed, 81 insertions, 47 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 8b8e7b8851..905de743b4 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,25 @@ +2005-08-02 Viren.l <lviren@novell.com> + + * gui/dialogs/meeting-page.c:(meeting_page_fill_widgets): + Removed sensitizing of Add, Remove & Invite buttons. + Assigned user_org using CompEditorPageFlags. + * gui/dialogs/recurrence-page.c: (sensitize_button): + Added a check for COMP_EDITOR_PAGE_MEETING. + * gui/dialogs/event-page.c: (sensitize_widgets): + Added sensitize boolean variable to store the && operation of + user_org,!read_only. + * gui/dialogs/event-editor.c: (show_meeting): + If user is not organizer dont allow the widget to receive + notification of drags. + * gui/e-cal-popup.[ch]: (e_cal_popup_target_new_attachments): + Added a flag E_CAL_POPUP_ATTACHMENTS_MODIFY and set it in the + e_cal_popup_target_new_attachments function. + * gui/dialogs/comp-editor.c: Added visibility mask + to Remove and Add attachments popup menus. + Removed function comp_editor_sensitize_attachment_bar which + is no longer required. + * gui/dialogs/task-editor.c: (task_editor_construct): + Removed call made to comp_editor_sensitize_attachment_bar. 2005-08-16 Not Zed <NotZed@Ximian.com> ** See bug #312668. diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index c7178f17fe..6e8f8ce6e8 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1077,10 +1077,10 @@ cab_remove(EPopup *ep, EPopupItem *item, void *data) /* Popup menu handling. */ static EPopupItem cab_popups[] = { - { E_POPUP_ITEM, "10.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY }, + { E_POPUP_ITEM, "10.attach", N_("_Remove"), cab_remove, NULL, GTK_STOCK_REMOVE, E_CAL_POPUP_ATTACHMENTS_MANY | E_CAL_POPUP_ATTACHMENTS_MODIFY }, { E_POPUP_ITEM, "20.attach", N_("_Properties"), cab_properties, NULL, GTK_STOCK_PROPERTIES, E_CAL_POPUP_ATTACHMENTS_ONE }, { E_POPUP_BAR, "30.attach.00", NULL, NULL, NULL, NULL, E_CAL_POPUP_ATTACHMENTS_MANY|E_CAL_POPUP_ATTACHMENTS_ONE }, - { E_POPUP_ITEM, "30.attach.01", N_("_Add attachment..."), cab_add, NULL, GTK_STOCK_ADD, 0 }, + { E_POPUP_ITEM, "30.attach.01", N_("_Add attachment..."), cab_add, NULL, GTK_STOCK_ADD, E_CAL_POPUP_ATTACHMENTS_MODIFY }, }; static void @@ -1121,6 +1121,7 @@ cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) ECalPopup *ecp; ECalPopupTargetAttachments *t; GtkMenu *menu; + CompEditor *editor = COMP_EDITOR (gtk_widget_get_toplevel (GTK_WIDGET (bar))); attachments = e_attachment_bar_get_attachment(bar, id); @@ -1136,7 +1137,7 @@ cab_popup(EAttachmentBar *bar, GdkEventButton *event, int id) */ ecp = e_cal_popup_new("org.gnome.evolution.calendar.attachmentbar.popup"); e_popup_add_items((EPopup *)ecp, menus, NULL, cab_popups_free, bar); - t = e_cal_popup_target_new_attachments(ecp, attachments); + t = e_cal_popup_target_new_attachments(ecp, editor, attachments); t->target.widget = (GtkWidget *)bar; menu = e_popup_create_menu_once((EPopup *)ecp, (EPopupTarget *)t, 0); @@ -1274,19 +1275,6 @@ setup_widgets (CompEditor *editor) } -void -comp_editor_sensitize_attachment_bar (CompEditor *editor, gboolean set) -{ - CompEditorPrivate *priv; - - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - gtk_widget_set_sensitive (GTK_WIDGET (priv->attachment_bar), set); - gtk_widget_set_sensitive (GTK_WIDGET (priv->attachment_scrolled_window), set); -} - /* Object initialization function for the calendar component editor */ static void comp_editor_init (CompEditor *editor) @@ -2520,7 +2508,6 @@ comp_editor_notify_client_changed (CompEditor *editor, ECal *client) if (!e_cal_is_read_only (client, &read_only, NULL)) read_only = TRUE; - comp_editor_sensitize_attachment_bar (editor, !read_only); gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, !read_only); } diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 1c15bc1f53..37e6be7929 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -410,7 +410,9 @@ static void show_meeting (EventEditor *ee) { EventEditorPrivate *priv; - + CompEditor *editor = COMP_EDITOR (ee); + CompEditorFlags flags = comp_editor_get_flags (editor); + priv = ee->priv; event_page_set_meeting (priv->event_page, TRUE); @@ -428,6 +430,9 @@ show_meeting (EventEditor *ee) } if (comp_editor_get_flags (COMP_EDITOR (ee)) & COMP_EDITOR_DELEGATE) comp_editor_show_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->meet_page)); + + if (!(flags & COMP_EDITOR_NEW_ITEM) && !(flags & COMP_EDITOR_USER_ORG)) + gtk_drag_dest_unset (GTK_WIDGET (editor)); } void diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 3d1ee328f2..414aa5ecca 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -603,7 +603,7 @@ is_custom_alarm_store (EAlarmList *alarm_list_store, char *old_summary, CalUnit static void sensitize_widgets (EventPage *epage) { - gboolean read_only, custom, alarm, sens = TRUE; + gboolean read_only, custom, alarm, sens = TRUE, sensitize; EventPagePrivate *priv; priv = epage->priv; @@ -612,22 +612,24 @@ sensitize_widgets (EventPage *epage) if (!e_cal_is_read_only (COMP_EDITOR_PAGE (epage)->client, &read_only, NULL)) read_only = TRUE; + + sensitize = !read_only && sens; custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL); alarm = e_dialog_toggle_get (priv->alarm); - gtk_widget_set_sensitive (priv->summary_label, !read_only && sens); - gtk_entry_set_editable (GTK_ENTRY (priv->summary), !read_only && sens); - gtk_widget_set_sensitive (priv->location_label, !read_only && sens); - gtk_entry_set_editable (GTK_ENTRY (priv->location), !read_only && sens); - gtk_widget_set_sensitive (priv->start_time, !read_only && sens); - gtk_widget_set_sensitive (priv->start_timezone, !read_only && sens); - gtk_widget_set_sensitive (priv->end_time, !read_only && sens); - gtk_widget_set_sensitive (priv->end_timezone, !read_only && sens); - gtk_widget_set_sensitive (priv->all_day_event, !read_only && sens); - gtk_widget_set_sensitive (priv->description, !read_only && sens); - gtk_widget_set_sensitive (priv->classification, !read_only && sens); - gtk_widget_set_sensitive (priv->show_time_as_busy, !read_only && sens); + gtk_widget_set_sensitive (priv->summary_label, sensitize); + gtk_entry_set_editable (GTK_ENTRY (priv->summary), sensitize); + gtk_widget_set_sensitive (priv->location_label, sensitize); + gtk_entry_set_editable (GTK_ENTRY (priv->location), sensitize); + gtk_widget_set_sensitive (priv->start_time, sensitize); + gtk_widget_set_sensitive (priv->start_timezone, sensitize); + gtk_widget_set_sensitive (priv->end_time, sensitize); + gtk_widget_set_sensitive (priv->end_timezone, sensitize); + gtk_widget_set_sensitive (priv->all_day_event, sensitize); + gtk_widget_set_sensitive (priv->description, sensitize); + gtk_widget_set_sensitive (priv->classification, sensitize); + gtk_widget_set_sensitive (priv->show_time_as_busy, sensitize); gtk_widget_set_sensitive (priv->alarm, !read_only); gtk_widget_set_sensitive (priv->alarm_time, !read_only && !custom && alarm); gtk_widget_set_sensitive (priv->alarm_custom, alarm); @@ -635,9 +637,9 @@ sensitize_widgets (EventPage *epage) gtk_widget_show (priv->alarm_warning); else gtk_widget_hide (priv->alarm_warning); - gtk_widget_set_sensitive (priv->categories_btn, !read_only && sens); - gtk_widget_set_sensitive (priv->sendoptions_button, !read_only && sens); - gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only && sens); + gtk_widget_set_sensitive (priv->categories_btn, sensitize); + gtk_widget_set_sensitive (priv->sendoptions_button, sensitize); + gtk_entry_set_editable (GTK_ENTRY (priv->categories), sensitize); if (COMP_EDITOR_PAGE (epage)->flags & COMP_EDITOR_PAGE_DELEGATE) { gtk_widget_set_sensitive (priv->sendoptions_button, TRUE); diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index 17072c6a2c..4ca971c3f3 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -384,9 +384,6 @@ meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) gtk_widget_hide (priv->organizer_table); gtk_widget_show (priv->existing_organizer_table); if (itip_organizer_is_user (comp, page->client)) { - gtk_widget_set_sensitive (priv->invite, TRUE); - gtk_widget_set_sensitive (priv->add, TRUE); - gtk_widget_set_sensitive (priv->remove, TRUE); if (e_cal_get_static_capability ( page->client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) @@ -433,6 +430,7 @@ meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } priv->updating = FALSE; + priv->user_org = page->flags & COMP_EDITOR_PAGE_USER_ORG; sensitize_widgets (mpage); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 2c777e9edf..243dc19bb7 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -474,7 +474,9 @@ sensitize_recur_widgets (RecurrencePage *rpage) GtkWidget *label; priv = rpage->priv; - sens = COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_USER_ORG; + + if (COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_MEETING) + sens = COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_USER_ORG; recurs = e_dialog_toggle_get (priv->recurs); @@ -511,7 +513,7 @@ sensitize_recur_widgets (RecurrencePage *rpage) static void sensitize_buttons (RecurrencePage *rpage) { - gboolean read_only, sens = TRUE; + gboolean read_only, sensitize = TRUE; gint selected_rows; RecurrencePagePrivate *priv; icalcomponent *icalcomp; @@ -519,7 +521,7 @@ sensitize_buttons (RecurrencePage *rpage) priv = rpage->priv; if (COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_MEETING) - sens = COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_USER_ORG; + sensitize = COMP_EDITOR_PAGE (rpage)->flags & COMP_EDITOR_PAGE_USER_ORG; selected_rows = gtk_tree_selection_count_selected_rows ( gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list))); @@ -554,10 +556,10 @@ sensitize_buttons (RecurrencePage *rpage) else gtk_widget_set_sensitive (priv->params, FALSE); - gtk_widget_set_sensitive (priv->recurs, !read_only && sens); - gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp) && sens); - gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0 && sens); - gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sens); + gtk_widget_set_sensitive (priv->recurs, !read_only && sensitize); + gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp) && sensitize); + gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0 && sensitize); + gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0 && sensitize); } #if 0 diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 199e8fe78a..4a393f6bf8 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -148,7 +148,6 @@ task_editor_construct (TaskEditor *te, ECal *client, gboolean is_assigned) if (!e_cal_is_read_only (client, &read_only, NULL)) read_only = TRUE; - comp_editor_sensitize_attachment_bar (COMP_EDITOR (te), !read_only); if (priv->is_assigned) { if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)) diff --git a/calendar/gui/e-cal-popup.c b/calendar/gui/e-cal-popup.c index 909b668f6e..1aafb58cad 100644 --- a/calendar/gui/e-cal-popup.c +++ b/calendar/gui/e-cal-popup.c @@ -347,11 +347,26 @@ e_cal_popup_target_new_source(ECalPopup *eabp, ESourceSelector *selector) * Return value: **/ ECalPopupTargetAttachments * -e_cal_popup_target_new_attachments(ECalPopup *ecp, GSList *attachments) +e_cal_popup_target_new_attachments(ECalPopup *ecp, CompEditor *editor, GSList *attachments) { ECalPopupTargetAttachments *t = e_popup_target_new(&ecp->popup, E_CAL_POPUP_TARGET_ATTACHMENTS, sizeof(*t)); guint32 mask = ~0; int len = g_slist_length(attachments); + ECal *client = comp_editor_get_e_cal (editor); + CompEditorFlags flags = comp_editor_get_flags (editor); + gboolean read_only = FALSE; + GError *error = NULL; + + if (!e_cal_is_read_only (client, &read_only, &error)) { + if (error->code != E_CALENDAR_STATUS_BUSY) + read_only = TRUE; + g_error_free (error); + } + + if (!read_only && (!(flags & COMP_EDITOR_MEETING) || + (flags & COMP_EDITOR_NEW_ITEM) || + (flags & COMP_EDITOR_USER_ORG))) + mask &= ~ E_CAL_POPUP_ATTACHMENTS_MODIFY; t->attachments = attachments; if (len > 0) @@ -423,6 +438,7 @@ static const EPopupHookTargetMask ecalph_source_masks[] = { static const EPopupHookTargetMask ecalph_attachments_masks[] = { { "one", E_CAL_POPUP_ATTACHMENTS_ONE }, { "many", E_CAL_POPUP_ATTACHMENTS_MANY }, + { "modify", E_CAL_POPUP_ATTACHMENTS_MODIFY }, { 0 } }; diff --git a/calendar/gui/e-cal-popup.h b/calendar/gui/e-cal-popup.h index 0945591fb0..72f3928139 100644 --- a/calendar/gui/e-cal-popup.h +++ b/calendar/gui/e-cal-popup.h @@ -25,6 +25,7 @@ #include <glib-object.h> #include "e-util/e-popup.h" +#include "dialogs/comp-editor.h" #ifdef __cplusplus extern "C" { @@ -111,6 +112,7 @@ enum _e_cal_popup_target_source_t { enum _e_cal_popup_target_attachments_t { E_CAL_POPUP_ATTACHMENTS_ONE = 1<<0, /* only 1 selected */ E_CAL_POPUP_ATTACHMENTS_MANY = 1<<1, /* one or more selected */ + E_CAL_POPUP_ATTACHMENTS_MODIFY =1<<2, /* check for modify operation */ }; typedef struct _ECalPopupTargetSelect ECalPopupTargetSelect; @@ -184,7 +186,8 @@ ECalPopup *e_cal_popup_new(const char *menuid); ECalPopupTargetSelect *e_cal_popup_target_new_select(ECalPopup *eabp, struct _ECalModel *model, GPtrArray *events); ECalPopupTargetSource *e_cal_popup_target_new_source(ECalPopup *eabp, struct _ESourceSelector *selector); -ECalPopupTargetAttachments * e_cal_popup_target_new_attachments (ECalPopup *ecp, GSList *attachments); +ECalPopupTargetAttachments * e_cal_popup_target_new_attachments (ECalPopup *ecp, + CompEditor *editor, GSList *attachments); /* ********************************************************************** */ |