From b2b00bfbcdf007a8efa9a73d2f98f28535c51652 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 15 Jun 2004 11:57:17 +0000 Subject: new function. (e_meeting_time_selector_construct): store some missing 2004-06-15 Rodrigo Moya * gui/e-meeting-time-sel.[ch] (e_meeting_time_selector_set_read_only): new function. (e_meeting_time_selector_construct): store some missing buttons in the EMeetingTimeSelector structure. * gui/dialogs/schedule-page.c (schedule_page_construct): connect to "client_changed" signal on the page. (client_changed_cb): new callback. (sensitize_widgets): new function. (schedule_page_fill_widgets): call sensitize_widgets(). svn path=/trunk/; revision=26344 --- calendar/gui/dialogs/schedule-page.c | 24 +++++++++++++ calendar/gui/e-meeting-time-sel.c | 65 +++++++++++++++++++++++------------- calendar/gui/e-meeting-time-sel.h | 7 ++++ 3 files changed, 72 insertions(+), 24 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index d9f37b414f..0069208a81 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -194,6 +194,26 @@ schedule_page_focus_main_widget (CompEditorPage *page) gtk_widget_grab_focus (GTK_WIDGET (priv->sel)); } +static void +sensitize_widgets (SchedulePage *spage) +{ + gboolean read_only; + SchedulePagePrivate *priv = spage->priv; + + if (!e_cal_is_read_only (COMP_EDITOR_PAGE (spage)->client, &read_only, NULL)) + read_only = TRUE; + + e_meeting_time_selector_set_read_only (GTK_WIDGET (priv->sel), read_only); +} + +static void +client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) +{ + SchedulePage *spage = SCHEDULE_PAGE (page); + + sensitize_widgets (spage); +} + /* Set date/time */ static void update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date) @@ -309,6 +329,8 @@ schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) priv->updating = FALSE; + sensitize_widgets (spage); + return validated; } @@ -443,6 +465,8 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) return NULL; } + g_signal_connect_after (G_OBJECT (spage), "client_changed", + G_CALLBACK (client_changed_cb), NULL); return spage; } diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 42f904f100..43b3dacce6 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -1,10 +1,12 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Author : + * Authors : * Damon Chaplin + * Rodrigo Moya * * Copyright 1999, Ximian, Inc. + * Copyright 2004, Novell, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -266,7 +268,7 @@ void e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *ems) { char *filename; - GtkWidget *hbox, *vbox, *separator, *button, *label, *table; + GtkWidget *hbox, *vbox, *separator, *label, *table; GtkWidget *alignment, *child_hbox, *arrow, *menuitem; GSList *group; GdkVisual *visual; @@ -412,17 +414,17 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em 0, 1, 3, 4, GTK_FILL, 0, 0, 0); gtk_widget_show (hbox); - button = gtk_button_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (button)->child), + mts->add_attendees_button = gtk_button_new_with_label (""); + gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->add_attendees_button)->child), _("Add attendees from addressbook")); - accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (button)->child)); - gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 6); - gtk_widget_show (button); - gtk_widget_add_accelerator (button, "clicked", mts->accel_group, + accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->add_attendees_button)->child)); + gtk_box_pack_start (GTK_BOX (hbox), mts->add_attendees_button, TRUE, TRUE, 6); + gtk_widget_show (mts->add_attendees_button); + gtk_widget_add_accelerator (mts->add_attendees_button, "clicked", mts->accel_group, accel_key, GDK_MOD1_MASK, 0); - g_signal_connect (button, "clicked", + g_signal_connect (mts->add_attendees_button, "clicked", G_CALLBACK (e_meeting_time_selector_on_invite_others_button_clicked), mts); - g_signal_connect (button, "expose-event", + g_signal_connect (mts->add_attendees_button, "expose-event", G_CALLBACK (e_meeting_time_selector_on_invite_others_button_expose), mts); mts->options_button = gtk_button_new (); @@ -492,15 +494,15 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em 0, 1, 5, 6, GTK_FILL, 0, 0, 0); gtk_widget_show (hbox); - button = gtk_button_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (button)->child), + mts->autopick_down_button = gtk_button_new_with_label (""); + gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->autopick_down_button)->child), _("_<<")); - accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (button)->child)); - gtk_widget_add_accelerator (button, "clicked", mts->accel_group, + accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->autopick_down_button)->child)); + gtk_widget_add_accelerator (mts->autopick_down_button, "clicked", mts->accel_group, accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0); - gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 6); - gtk_widget_show (button); - g_signal_connect (button, "clicked", + gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_down_button, TRUE, TRUE, 6); + gtk_widget_show (mts->autopick_down_button); + g_signal_connect (mts->autopick_down_button, "clicked", G_CALLBACK (e_meeting_time_selector_on_prev_button_clicked), mts); mts->autopick_button = gtk_button_new (); @@ -525,15 +527,15 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em gtk_box_pack_start (GTK_BOX (child_hbox), arrow, FALSE, FALSE, 6); gtk_widget_show (arrow); - button = gtk_button_new_with_label (""); - gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (button)->child), + mts->autopick_up_button = gtk_button_new_with_label (""); + gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->autopick_up_button)->child), _(">_>")); - accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (button)->child)); - gtk_widget_add_accelerator (button, "clicked", mts->accel_group, + accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->autopick_up_button)->child)); + gtk_widget_add_accelerator (mts->autopick_up_button, "clicked", mts->accel_group, accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0); - gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 6); - gtk_widget_show (button); - g_signal_connect (button, "clicked", + gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_up_button, TRUE, TRUE, 6); + gtk_widget_show (mts->autopick_up_button); + g_signal_connect (mts->autopick_up_button, "clicked", G_CALLBACK (e_meeting_time_selector_on_next_button_clicked), mts); /* Create the Autopick menu. */ @@ -1261,6 +1263,21 @@ e_meeting_time_selector_attendee_set_send_meeting_to (EMeetingTimeSelector *mts, } #endif +void +e_meeting_time_selector_set_read_only (EMeetingTimeSelector *mts, gboolean read_only) +{ + g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts)); + + gtk_widget_set_sensitive (GTK_WIDGET (mts->list_view), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->display_main), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->add_attendees_button), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->autopick_down_button), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->autopick_button), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->autopick_up_button), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->start_date_edit), !read_only); + gtk_widget_set_sensitive (GTK_WIDGET (mts->end_date_edit), !read_only); +} + /* * DEBUGGING ROUTINES - functions to output various bits of data. */ diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h index ee23dbe672..7ff6811657 100644 --- a/calendar/gui/e-meeting-time-sel.h +++ b/calendar/gui/e-meeting-time-sel.h @@ -132,12 +132,17 @@ struct _EMeetingTimeSelector vertically. */ GtkWidget *display_main; + /* The 'Add attendees from addressbook' button */ + GtkWidget *add_attendees_button; + /* This is the 'Options' button & menu. */ GtkWidget *options_button; GtkWidget *options_menu; /* This is the 'Autopick' button, menu & radio menu items. */ + GtkWidget *autopick_down_button; GtkWidget *autopick_button; + GtkWidget *autopick_up_button; GtkWidget *autopick_menu; GtkWidget *autopick_all_item; GtkWidget *autopick_all_people_one_resource_item; @@ -317,6 +322,8 @@ void e_meeting_time_selector_attendee_set_send_meeting_to (EMeetingTimeSelector gint row, gboolean send_meeting_to); +void e_meeting_time_selector_set_read_only (EMeetingTimeSelector *mts, gboolean read_only); + /* Clears all busy times for the given attendee. */ void e_meeting_time_selector_attendee_clear_busy_periods (EMeetingTimeSelector *mts, gint row); -- cgit