From 5c85a8211ecc53c48666a9180787659f88a8fea8 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 10 Jul 2001 01:31:29 +0000 Subject: Use e_utf8_from_gtk_event_key() so that we can input utf8 text properly. 2001-07-09 Federico Mena Quintero * gui/e-day-view.c (e_day_view_key_press): Use e_utf8_from_gtk_event_key() so that we can input utf8 text properly. (e_day_view_cut_clipboard): Constify. (e_day_view_on_cut): Constify. (e_day_view_reshape_long_event): Remove unused variable. * gui/e-week-view.c (e_week_view_key_press): Use e_utf8_from_gtk_event_key() so that we can input utf8 text properly. (e_week_view_cut_clipboard): Constify. (e_week_view_on_cut): Constify. * cal-client/cal-client.c (cal_client_resolve_tzid_cb): Fix the prototype so that this matches CalRecurResolveTimezoneFn. Also renamed it so that it is clear that it is supposed to be a callback. svn path=/trunk/; revision=10942 --- calendar/ChangeLog | 20 ++++++++++++++++++++ calendar/cal-client/cal-client.c | 11 +++++++++-- calendar/cal-client/cal-client.h | 2 +- calendar/gui/e-day-view.c | 17 ++++++++++------- calendar/gui/e-week-view.c | 13 ++++++++----- calendar/gui/tag-calendar.c | 2 +- 6 files changed, 49 insertions(+), 16 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 27e4c97758..f910acaece 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,23 @@ +2001-07-09 Federico Mena Quintero + + * gui/e-day-view.c (e_day_view_key_press): Use + e_utf8_from_gtk_event_key() so that we can input utf8 text + properly. + (e_day_view_cut_clipboard): Constify. + (e_day_view_on_cut): Constify. + (e_day_view_reshape_long_event): Remove unused variable. + + * gui/e-week-view.c (e_week_view_key_press): Use + e_utf8_from_gtk_event_key() so that we can input utf8 text + properly. + (e_week_view_cut_clipboard): Constify. + (e_week_view_on_cut): Constify. + + * cal-client/cal-client.c (cal_client_resolve_tzid_cb): Fix the + prototype so that this matches CalRecurResolveTimezoneFn. Also + renamed it so that it is clear that it is supposed to be a + callback. + 2001-07-06 JP Rosevear * gui/dialogs/meeting-page.c (init_widgets): connect to the entry diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 6bef9508b3..8acbbc376a 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -912,11 +912,17 @@ cal_client_get_timezone (CalClient *client, /* Resolves TZIDs for the recurrence generator. */ icaltimezone* -cal_client_resolve_tzid (const char *tzid, CalClient *client) +cal_client_resolve_tzid_cb (const char *tzid, gpointer data) { + CalClient *client; icaltimezone *zone = NULL; CalClientGetStatus status; + g_return_val_if_fail (data != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (data), NULL); + + client = CAL_CLIENT (data); + /* FIXME: Handle errors. */ status = cal_client_get_timezone (client, tzid, &zone); @@ -1430,7 +1436,8 @@ cal_client_generate_instances (CalClient *client, CalObjType type, CalComponent *comp; comp = l->data; - cal_recur_generate_instances (comp, start, end, add_instance, &instances, (CalRecurResolveTimezoneFn) cal_client_resolve_tzid, client); + cal_recur_generate_instances (comp, start, end, add_instance, &instances, + cal_client_resolve_tzid_cb, client); gtk_object_unref (GTK_OBJECT (comp)); } diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index 72619074d2..12d04b70d4 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -142,7 +142,7 @@ gboolean cal_client_remove_object (CalClient *client, const char *uid); CalQuery *cal_client_get_query (CalClient *client, const char *sexp); /* Resolves TZIDs for the recurrence generator. */ -icaltimezone *cal_client_resolve_tzid (const char *tzid, CalClient *client); +icaltimezone *cal_client_resolve_tzid_cb (const char *tzid, gpointer data); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index e854576659..5315dfcb1b 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -1486,7 +1487,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid, cal_recur_generate_instances (comp, day_view->lower, day_view->upper, e_day_view_add_event, day_view, - (CalRecurResolveTimezoneFn) cal_client_resolve_tzid, day_view->client); + cal_client_resolve_tzid_cb, day_view->client); gtk_object_unref (GTK_OBJECT (comp)); e_day_view_check_layout (day_view); @@ -2607,7 +2608,7 @@ void e_day_view_cut_clipboard (EDayView *day_view) { EDayViewEvent *event; - char *uid; + const char *uid; g_return_if_fail (E_IS_DAY_VIEW (day_view)); @@ -3504,7 +3505,7 @@ e_day_view_on_cut (GtkWidget *widget, gpointer data) { EDayView *day_view; EDayViewEvent *event; - char *uid; + const char *uid; day_view = E_DAY_VIEW (data); @@ -4491,7 +4492,7 @@ e_day_view_reshape_long_event (EDayView *day_view, } if (show_icons) { - GSList *categories_list, *elem; + GSList *categories_list; if (cal_component_has_alarms (comp)) num_icons++; @@ -4884,9 +4885,8 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event) || (event->length == 0) || (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) { return FALSE; - } else { - initial_text = event->string; - } + } else + initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string); /* Add a new event covering the selected range */ @@ -4923,6 +4923,9 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event) g_warning ("Couldn't find event to start editing.\n"); } + if (initial_text) + g_free (initial_text); + gtk_object_unref (GTK_OBJECT (comp)); return TRUE; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 10655feecb..a31961dd98 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "dialogs/delete-comp.h" #include "comp-util.h" #include "cal-util/timeutil.h" @@ -990,7 +991,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid, week_view->day_starts[0], week_view->day_starts[num_days], e_week_view_add_event, week_view, - cal_client_resolve_tzid, week_view->client); + cal_client_resolve_tzid_cb, week_view->client); gtk_object_unref (GTK_OBJECT (comp)); @@ -1699,7 +1700,7 @@ void e_week_view_cut_clipboard (EWeekView *week_view) { EWeekViewEvent *event; - char *uid; + const char *uid; g_return_if_fail (E_IS_WEEK_VIEW (week_view)); @@ -3064,9 +3065,8 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event) || (event->length == 0) || (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) { return FALSE; - } else { - initial_text = event->string; - } + } else + initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string); /* Add a new event covering the selected range. */ comp = cal_component_new (); @@ -3101,6 +3101,9 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event) g_warning ("Couldn't find event to start editing.\n"); } + if (initial_text) + g_free (initial_text); + gtk_object_unref (GTK_OBJECT (comp)); return TRUE; diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index 485e013c4e..f0f8951842 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -170,5 +170,5 @@ tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client) #endif cal_recur_generate_instances (comp, c.start_time, c.end_time, tag_calendar_cb, &c, - cal_client_resolve_tzid, client); + cal_client_resolve_tzid_cb, client); } -- cgit v1.2.3