aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-commands.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-07-31 06:21:13 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-07-31 06:21:13 +0800
commitb7e0730aab5e67535dd8bcd70e400869fa55601b (patch)
tree4f5e56303fbad308b9bada27e7706e80ab8305c6 /calendar/gui/calendar-commands.c
parentbf408fed06a3da3336303f2d1085d1d6e5df3ce4 (diff)
downloadgsoc2013-evolution-b7e0730aab5e67535dd8bcd70e400869fa55601b.tar.gz
gsoc2013-evolution-b7e0730aab5e67535dd8bcd70e400869fa55601b.tar.zst
gsoc2013-evolution-b7e0730aab5e67535dd8bcd70e400869fa55601b.zip
started some code to show the currently displayed dates in the folder
2001-07-30 Damon Chaplin <damon@ximian.com> * gui/gnome-cal.c: * gui/calendar-commands.c (clear_folder_bar_label): started some code to show the currently displayed dates in the folder title bar. Unfinished. * gui/e-itip-control.c (set_date_label): * conduits/todo/todo-conduit.c (local_record_from_comp): * conduits/calendar/calendar-conduit.c (local_record_from_comp): free the CalComponentDateTimes. (Note the iTIP control needs updating for timezone support.) * cal-util/cal-component.c: Changed CalComponentDateTime so that the TZID is malloc'ed and freed rather than being a pointer to a static string. This was causing problems as sometimes we were freeing the string that was being pointed to, so we got corrupted TZIDs. * gui/comp-util.c (cal_comp_util_add_exdate): set TZID to NULL. DATE values do not have timezones. * gui/e-week-view.c: * gui/e-day-view.c: Moved 'Paste' after the New Appointment commands, since I think they are more commonly-used. Also added underlined accelerator keys. * gui/e-calendar-table.c: changed 'Edit this task' to 'Open' in the popup menu to be consistent with other folders, and separated from the clipboard commands. Also changed to use EPopupMenu so the accelerators work, and the masks may be useful at some point. * gui/dialogs/recurrence-page.c: use DATE values for UNTIL, since that makes it simpler. Fixes bug #5034. * gui/calendar-config.c (calendar_config_set_timezone): strdup the location string. Fixes bug #4990. * gui/tag-calendar.c (tag_calendar_cb): take 1 off iend as the times don't include the end time. * gui/e-week-view-layout.c (e_week_view_layout_event): fixed days_shown. Fixes bug #5709. * cal-client/cal-client.c (cal_client_get_timezone): took out some debugging messages. svn path=/trunk/; revision=11494
Diffstat (limited to 'calendar/gui/calendar-commands.c')
-rw-r--r--calendar/gui/calendar-commands.c98
1 files changed, 95 insertions, 3 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index a0366685c9..f51a4142ca 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -354,18 +354,100 @@ get_shell_view_interface (BonoboControl *control)
return shell_view;
}
-/* Clears the folder bar label on the shell view */
+/* Displays the currently displayed time range in the folder bar label on the
+ shell view, according to which view we are showing. */
static void
-clear_folder_bar_label (BonoboControl *control)
+clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
{
GNOME_Evolution_ShellView shell_view;
CORBA_Environment ev;
+ icaltimezone *zone;
+ struct icaltimetype start_tt, end_tt;
+ time_t start_time, end_time;
+ struct tm start_tm, end_tm;
+ char buffer[512], end_buffer[256];
+ GnomeCalendarViewType view;
+
+ /* FIXME: This isn't the same as the currently visible time range. */
+ gnome_calendar_get_selected_time_range (gcal, &start_time, &end_time);
+ zone = gnome_calendar_get_timezone (gcal);
+
+ start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone);
+ start_tm.tm_year = start_tt.year - 1900;
+ start_tm.tm_mon = start_tt.month - 1;
+ start_tm.tm_mday = start_tt.day;
+ start_tm.tm_hour = start_tt.hour;
+ start_tm.tm_min = start_tt.minute;
+ start_tm.tm_sec = start_tt.second;
+ start_tm.tm_isdst = -1;
+ start_tm.tm_wday = time_day_of_week (start_tt.day, start_tt.month - 1,
+ start_tt.year);
+
+ end_tt = icaltime_from_timet_with_zone (end_time, FALSE, zone);
+ end_tm.tm_year = end_tt.year - 1900;
+ end_tm.tm_mon = end_tt.month - 1;
+ end_tm.tm_mday = end_tt.day;
+ end_tm.tm_hour = end_tt.hour;
+ end_tm.tm_min = end_tt.minute;
+ end_tm.tm_sec = end_tt.second;
+ end_tm.tm_isdst = -1;
+ end_tm.tm_wday = time_day_of_week (end_tt.day, end_tt.month - 1,
+ end_tt.year);
+
+ view = gnome_calendar_get_view (gcal);
+
+ switch (view) {
+ case GNOME_CAL_DAY_VIEW:
+ strftime (buffer, sizeof (buffer),
+ _("%A %d %B %Y"), &start_tm);
+ break;
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ case GNOME_CAL_WEEK_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year) {
+ strftime (buffer, sizeof (buffer),
+ _("%a %d %b"), &start_tm);
+ strftime (end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ strftime (buffer, sizeof (buffer),
+ _("%a %d %b %Y"), &start_tm);
+ strftime (end_buffer, sizeof (end_buffer),
+ _("%a %d %b %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+ case GNOME_CAL_MONTH_VIEW:
+ if (start_tm.tm_year == end_tm.tm_year) {
+ strftime (buffer, sizeof (buffer),
+ _("%B"), &start_tm);
+ strftime (end_buffer, sizeof (end_buffer),
+ _("%B %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ } else {
+ strftime (buffer, sizeof (buffer),
+ _("%B %Y"), &start_tm);
+ strftime (end_buffer, sizeof (end_buffer),
+ _("%B %Y"), &end_tm);
+ strcat (buffer, " - ");
+ strcat (buffer, end_buffer);
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ }
shell_view = get_shell_view_interface (control);
if (shell_view == CORBA_OBJECT_NIL)
return;
CORBA_exception_init (&ev);
+#if 0
+ GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, buffer, &ev);
+#endif
GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, "", &ev);
if (ev._major != CORBA_NO_EXCEPTION)
g_message ("clear_folder_bar_label(): Could not set the folder bar label");
@@ -465,7 +547,7 @@ calendar_control_activate (BonoboControl *control,
a default timezone already. */
calendar_config_check_timezone_set ();
- clear_folder_bar_label (control);
+ clear_folder_bar_label (gcal, control);
}
void
@@ -487,6 +569,13 @@ on_calendar_destroyed (GnomeCalendar *gcal)
all_calendars = g_list_remove (all_calendars, gcal);
}
+static void
+on_calendar_dates_shown_changed (GnomeCalendar *gcal)
+{
+ g_print ("In on_calendar_dates_shown_changed\n");
+}
+
+
GnomeCalendar *
new_calendar (void)
{
@@ -501,6 +590,9 @@ new_calendar (void)
gtk_signal_connect (GTK_OBJECT (gcal), "destroy",
GTK_SIGNAL_FUNC (on_calendar_destroyed), NULL);
+ gtk_signal_connect (GTK_OBJECT (gcal), "dates_shown_changed",
+ GTK_SIGNAL_FUNC (on_calendar_dates_shown_changed),
+ NULL);
all_calendars = g_list_prepend (all_calendars, gcal);