diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-07-05 05:25:30 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-07-05 05:25:30 +0800 |
commit | dcb5ea4101ffdd79ff7849867f8c32426e88da7f (patch) | |
tree | 23683de8db80a5cfba3a779d45d2f0c4ccc10e68 /calendar/gui | |
parent | 1e5fac65aa65ed25c18ead0a13552e5ec98ed53f (diff) | |
download | gsoc2013-evolution-dcb5ea4101ffdd79ff7849867f8c32426e88da7f.tar.gz gsoc2013-evolution-dcb5ea4101ffdd79ff7849867f8c32426e88da7f.tar.zst gsoc2013-evolution-dcb5ea4101ffdd79ff7849867f8c32426e88da7f.zip |
Fixes bug #4018 and what would be the analogous bugs for the other
2001-07-04 Federico Mena Quintero <federico@ximian.com>
Fixes bug #4018 and what would be the analogous bugs for the other
component editors.
* gui/dialogs/comp-editor-page.h (CompEditorPageClass): New
virtual method "::focus_main_widget()".
* gui/dialogs/comp-editor-page.c
(comp_editor_page_focus_main_widget): New function.
* gui/dialogs/comp-editor.c (comp_editor_append_page): If we are
inserting the main page, ask it to focus its main widget.
* gui/dialogs/alarm-page.c (alarm_page_focus_main_widget):
Implemented.
* gui/dialogs/event-page.c (event_page_focus_main_widget):
Implemented.
#include "e-util/e-categories-config.h".
* gui/dialogs/meeting-page.c (meeting_page_focus_main_widget):
Implemented.
* gui/dialogs/recurrence-page.c
(recurrence_page_focus_main_widget): Implemented.
* gui/dialogs/task-details-page.c
(task_details_page_focus_main_widget): Implemented.
* gui/dialogs/task-page.c (task_page_focus_main_widget):
Implemented.
svn path=/trunk/; revision=10784
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 15 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.c | 19 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.h | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 9 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 16 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 15 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 22 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 16 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 15 |
9 files changed, 128 insertions, 1 deletions
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c index 3946c15310..e6e09d4d3a 100644 --- a/calendar/gui/dialogs/alarm-page.c +++ b/calendar/gui/dialogs/alarm-page.c @@ -77,6 +77,7 @@ static void alarm_page_init (AlarmPage *apage); static void alarm_page_destroy (GtkObject *object); static GtkWidget *alarm_page_get_widget (CompEditorPage *page); +static void alarm_page_focus_main_widget (CompEditorPage *page); static void alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void alarm_page_fill_component (CompEditorPage *page, CalComponent *comp); static void alarm_page_set_summary (CompEditorPage *page, const char *summary); @@ -131,6 +132,7 @@ alarm_page_class_init (AlarmPageClass *class) parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); editor_page_class->get_widget = alarm_page_get_widget; + editor_page_class->focus_main_widget = alarm_page_focus_main_widget; editor_page_class->fill_widgets = alarm_page_fill_widgets; editor_page_class->fill_component = alarm_page_fill_component; editor_page_class->set_summary = alarm_page_set_summary; @@ -241,6 +243,19 @@ alarm_page_get_widget (CompEditorPage *page) return priv->main; } +/* focus_main_widget handler for the alarm page */ +static void +alarm_page_focus_main_widget (CompEditorPage *page) +{ + AlarmPage *apage; + AlarmPagePrivate *priv; + + apage = ALARM_PAGE (page); + priv = apage->priv; + + gtk_widget_grab_focus (priv->action); +} + /* Fills the widgets with default values */ static void clear_widgets (AlarmPage *apage) diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 85e7b8c9af..4e15ebeda9 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -134,6 +134,7 @@ comp_editor_page_class_init (CompEditorPageClass *class) class->dates_changed = NULL; class->get_widget = NULL; + class->focus_main_widget = NULL; class->fill_widgets = NULL; class->fill_component = NULL; class->set_summary = NULL; @@ -188,6 +189,24 @@ comp_editor_page_get_widget (CompEditorPage *page) } /** + * comp_editor_page_focus_main_widget: + * @page: An editor page. + * + * Makes an editor page focus its main widget. This is used by the component + * editor when it first pops up so that it can focus the main widget in the + * first page. + **/ +void +comp_editor_page_focus_main_widget (CompEditorPage *page) +{ + g_return_if_fail (page != NULL); + g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); + + g_assert (CLASS (page)->focus_main_widget != NULL); + (* CLASS (page)->focus_main_widget) (page); +} + +/** * comp_editor_page_fill_widgets: * @page: An editor page. * @comp: A calendar component. diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 08fe1d8508..6565d9888e 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -66,6 +66,7 @@ typedef struct { /* Virtual methods */ GtkWidget *(* get_widget) (CompEditorPage *page); + void (* focus_main_widget) (CompEditorPage *page); void (* fill_widgets) (CompEditorPage *page, CalComponent *comp); void (* fill_component) (CompEditorPage *page, CalComponent *comp); @@ -77,6 +78,7 @@ typedef struct { GtkType comp_editor_page_get_type (void); GtkWidget *comp_editor_page_get_widget (CompEditorPage *page); +void comp_editor_page_focus_main_widget (CompEditorPage *page); void comp_editor_page_fill_widgets (CompEditorPage *page, CalComponent *comp); void comp_editor_page_fill_component (CompEditorPage *page, diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index ea42980c2c..829b536ded 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -264,6 +264,7 @@ comp_editor_append_page (CompEditor *editor, CompEditorPrivate *priv; GtkWidget *page_widget; GtkWidget *label_widget; + gboolean is_first_page; g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -289,6 +290,8 @@ comp_editor_append_page (CompEditor *editor, label_widget = gtk_label_new (label); + is_first_page = (priv->pages == NULL); + priv->pages = g_list_append (priv->pages, page); gtk_notebook_append_page (priv->notebook, page_widget, label_widget); @@ -301,6 +304,12 @@ comp_editor_append_page (CompEditor *editor, GTK_SIGNAL_FUNC (page_summary_changed_cb), editor); gtk_signal_connect (GTK_OBJECT (page), "dates_changed", GTK_SIGNAL_FUNC (page_dates_changed_cb), editor); + + /* The first page is the main page of the editor, so we ask it to focus + * its main widget. + */ + if (is_first_page) + comp_editor_page_focus_main_widget (page); } /** diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index c9f1891fdc..6b6736f041 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -31,6 +31,7 @@ #include <glade/glade.h> #include <gal/widgets/e-unicode.h> #include <gal/widgets/e-categories.h> +#include "e-util/e-categories-config.h" #include "e-util/e-dialog-widgets.h" #include "widgets/misc/e-dateedit.h" #include "cal-util/timeutil.h" @@ -85,6 +86,7 @@ static void event_page_init (EventPage *epage); static void event_page_destroy (GtkObject *object); static GtkWidget *event_page_get_widget (CompEditorPage *page); +static void event_page_focus_main_widget (CompEditorPage *page); static void event_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void event_page_fill_component (CompEditorPage *page, CalComponent *comp); static void event_page_set_summary (CompEditorPage *page, const char *summary); @@ -139,6 +141,7 @@ event_page_class_init (EventPageClass *class) parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); editor_page_class->get_widget = event_page_get_widget; + editor_page_class->focus_main_widget = event_page_focus_main_widget; editor_page_class->fill_widgets = event_page_fill_widgets; editor_page_class->fill_component = event_page_fill_component; editor_page_class->set_summary = event_page_set_summary; @@ -225,6 +228,19 @@ event_page_get_widget (CompEditorPage *page) return priv->main; } +/* focus_main_widget handler for the event page */ +static void +event_page_focus_main_widget (CompEditorPage *page) +{ + EventPage *epage; + EventPagePrivate *priv; + + epage = EVENT_PAGE (page); + priv = epage->priv; + + gtk_widget_grab_focus (priv->summary); +} + /* Checks if the event's time starts and ends at midnight, and sets the *"all day event" box accordingly. */ diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index b67cf622ba..9e9e3e96db 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -145,6 +145,7 @@ static void meeting_page_init (MeetingPage *mpage); static void meeting_page_destroy (GtkObject *object); static GtkWidget *meeting_page_get_widget (CompEditorPage *page); +static void meeting_page_focus_main_widget (CompEditorPage *page); static void meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void meeting_page_fill_component (CompEditorPage *page, CalComponent *comp); @@ -200,6 +201,7 @@ meeting_page_class_init (MeetingPageClass *class) parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); editor_page_class->get_widget = meeting_page_get_widget; + editor_page_class->focus_main_widget = meeting_page_focus_main_widget; editor_page_class->fill_widgets = meeting_page_fill_widgets; editor_page_class->fill_component = meeting_page_fill_component; editor_page_class->set_summary = NULL; @@ -276,6 +278,19 @@ meeting_page_get_widget (CompEditorPage *page) return priv->main; } +/* focus_main_widget handler for the task page */ +static void +meeting_page_focus_main_widget (CompEditorPage *page) +{ + MeetingPage *mpage; + MeetingPagePrivate *priv; + + mpage = MEETING_PAGE (page); + priv = mpage->priv; + + gtk_widget_grab_focus (priv->organizer); +} + /* Fills the widgets with default values */ static void clear_widgets (MeetingPage *mpage) diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index a8961fef7b..54cd1e25c3 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -174,6 +174,7 @@ static void recurrence_page_init (RecurrencePage *rpage); static void recurrence_page_destroy (GtkObject *object); static GtkWidget *recurrence_page_get_widget (CompEditorPage *page); +static void recurrence_page_focus_main_widget (CompEditorPage *page); static void recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void recurrence_page_fill_component (CompEditorPage *page, CalComponent *comp); static void recurrence_page_set_summary (CompEditorPage *page, const char *summary); @@ -230,6 +231,7 @@ recurrence_page_class_init (RecurrencePageClass *class) parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); editor_page_class->get_widget = recurrence_page_get_widget; + editor_page_class->focus_main_widget = recurrence_page_focus_main_widget; editor_page_class->fill_widgets = recurrence_page_fill_widgets; editor_page_class->fill_component = recurrence_page_fill_component; editor_page_class->set_summary = recurrence_page_set_summary; @@ -345,6 +347,26 @@ recurrence_page_get_widget (CompEditorPage *page) return priv->main; } +/* focus_main_widget handler for the recurrence page */ +static void +recurrence_page_focus_main_widget (CompEditorPage *page) +{ + RecurrencePage *rpage; + RecurrencePagePrivate *priv; + + rpage = RECURRENCE_PAGE (page); + priv = rpage->priv; + + if (e_dialog_toggle_get (priv->none)) + gtk_widget_grab_focus (priv->none); + else if (e_dialog_toggle_get (priv->simple)) + gtk_widget_grab_focus (priv->simple); + else if (e_dialog_toggle_get (priv->custom)) + gtk_widget_grab_focus (priv->custom); + else + g_assert_not_reached (); +} + /* Fills the widgets with default values */ static void clear_widgets (RecurrencePage *rpage) diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 82d3e14b62..52a1fe2706 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -71,6 +71,7 @@ static void task_details_page_init (TaskDetailsPage *tdpage); static void task_details_page_destroy (GtkObject *object); static GtkWidget *task_details_page_get_widget (CompEditorPage *page); +static void task_details_page_focus_main_widget (CompEditorPage *page); static void task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void task_details_page_fill_component (CompEditorPage *page, CalComponent *comp); static void task_details_page_set_summary (CompEditorPage *page, const char *summary); @@ -126,6 +127,7 @@ task_details_page_class_init (TaskDetailsPageClass *class) parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); editor_page_class->get_widget = task_details_page_get_widget; + editor_page_class->focus_main_widget = task_details_page_focus_main_widget; editor_page_class->fill_widgets = task_details_page_fill_widgets; editor_page_class->fill_component = task_details_page_fill_component; editor_page_class->set_summary = task_details_page_set_summary; @@ -194,6 +196,19 @@ task_details_page_get_widget (CompEditorPage *page) return priv->main; } +/* focus_main_widget handler for the task page */ +static void +task_details_page_focus_main_widget (CompEditorPage *page) +{ + TaskDetailsPage *tdpage; + TaskDetailsPagePrivate *priv; + + tdpage = TASK_DETAILS_PAGE (page); + priv = tdpage->priv; + + gtk_widget_grab_focus (priv->organizer); +} + /* Fills the widgets with default values */ static void clear_widgets (TaskDetailsPage *tdpage) @@ -278,7 +293,6 @@ task_details_page_fill_component (CompEditorPage *page, CalComponent *comp) TaskDetailsPagePrivate *priv; struct icaltimetype icaltime; GSList list; - CalComponentDateTime date; CalComponentOrganizer organizer; CalComponentAttendee attendee; char *url; diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 2fc7bbf23e..6127087b3b 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -116,6 +116,7 @@ static void task_page_init (TaskPage *tpage); static void task_page_destroy (GtkObject *object); static GtkWidget *task_page_get_widget (CompEditorPage *page); +static void task_page_focus_main_widget (CompEditorPage *page); static void task_page_fill_widgets (CompEditorPage *page, CalComponent *comp); static void task_page_fill_component (CompEditorPage *page, CalComponent *comp); static void task_page_set_summary (CompEditorPage *page, const char *summary); @@ -170,6 +171,7 @@ task_page_class_init (TaskPageClass *class) parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); editor_page_class->get_widget = task_page_get_widget; + editor_page_class->focus_main_widget = task_page_focus_main_widget; editor_page_class->fill_widgets = task_page_fill_widgets; editor_page_class->fill_component = task_page_fill_component; editor_page_class->set_summary = task_page_set_summary; @@ -249,6 +251,19 @@ task_page_get_widget (CompEditorPage *page) return priv->main; } +/* focus_main_widget handler for the task page */ +static void +task_page_focus_main_widget (CompEditorPage *page) +{ + TaskPage *tpage; + TaskPagePrivate *priv; + + tpage = TASK_PAGE (page); + priv = tpage->priv; + + gtk_widget_grab_focus (priv->summary); +} + /* Fills the widgets with default values */ static void clear_widgets (TaskPage *tpage) |