diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1999-01-29 09:13:29 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-01-29 09:13:29 +0800 |
commit | b1f6df5d5d869861e1fb3e38d6e665f2cf638709 (patch) | |
tree | fe486e3005c92d2da2829d10eeaa112216be3154 /calendar | |
parent | 7fa29f65a4b068db075d0da9dbf05c2a3c4569a4 (diff) | |
download | gsoc2013-evolution-b1f6df5d5d869861e1fb3e38d6e665f2cf638709.tar.gz gsoc2013-evolution-b1f6df5d5d869861e1fb3e38d6e665f2cf638709.tar.zst gsoc2013-evolution-b1f6df5d5d869861e1fb3e38d6e665f2cf638709.zip |
Add --hidden key to hide the calendar at startup. Only works with GNOME
1999-01-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* main.c (parse_an_arg): Add --hidden key to hide the calendar at
startup. Only works with GNOME window managers though :-(
svn path=/trunk/; revision=635
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 9 | ||||
-rw-r--r-- | calendar/calendar.c | 9 | ||||
-rw-r--r-- | calendar/gui/calendar.c | 9 | ||||
-rw-r--r-- | calendar/gui/main.c | 34 | ||||
-rw-r--r-- | calendar/main.c | 34 |
5 files changed, 79 insertions, 16 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 8edc312dd7..289f66feec 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,7 +1,12 @@ 1999-01-28 Miguel de Icaza <miguel@nuclecu.unam.mx> - * calendar.c (calendar_init_alarms): Schedule an alarm for - midnight to change the calendar_day_begin/calendar_day_end. + * main.c (parse_an_arg): Add --hidden key to hide the calendar at + startup. Only works with GNOME window managers though :-( + + * calendar.c (calendar_day_change): Reschedule alarms for the new day. + + (calendar_init_alarms): Schedule an alarm for midnight to change + the calendar_day_begin/calendar_day_end. * alarm.c (alarm_ready): If we reschedule, there is no need to activate any pending alarms. diff --git a/calendar/calendar.c b/calendar/calendar.c index c9f4dc9493..b451703e8a 100644 --- a/calendar/calendar.c +++ b/calendar/calendar.c @@ -434,7 +434,16 @@ calendar_object_changed (Calendar *cal, iCalObject *obj, int flags) static void calendar_day_change (time_t time, CalendarAlarm *which, void *closure) { + GList *events; + Calendar *cal = closure; + calendar_set_day (); + + for (events = cal->events; events; events = events->next){ + iCalObject *obj = events->data; + + ical_object_try_alarms (obj); + } } static void diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index c9f4dc9493..b451703e8a 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -434,7 +434,16 @@ calendar_object_changed (Calendar *cal, iCalObject *obj, int flags) static void calendar_day_change (time_t time, CalendarAlarm *which, void *closure) { + GList *events; + Calendar *cal = closure; + calendar_set_day (); + + for (events = cal->events; events; events = events->next){ + iCalObject *obj = events->data; + + ical_object_try_alarms (obj); + } } static void diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 23409be930..db56026ecc 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -43,6 +43,9 @@ int day_begin, day_end; /* Whether weeks starts on Sunday or Monday */ int week_starts_on_monday; +/* If true, do not show our top level window */ +int startup_hidden = 0; + /* The array of color properties -- keep in sync with the enumeration defined in main.h. The color * values specified here are the defaults for the program. */ @@ -62,7 +65,7 @@ int active_calendars = 0; /* A list of all of the calendars started */ GList *all_calendars = NULL; -static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *view); +static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *view, gboolean hidden); /* For dumping part of a calendar */ static time_t from_t, to_t; @@ -305,14 +308,14 @@ goto_clicked (GtkWidget *widget, GnomeCalendar *gcal) static void new_calendar_cmd (GtkWidget *widget, void *data) { - new_calendar (full_name, NULL, NULL, NULL); + new_calendar (full_name, NULL, NULL, NULL, FALSE); } static void open_ok (GtkWidget *widget, GtkFileSelection *fs) { /* FIXME: find out who owns this calendar and use that name */ - new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, NULL); + new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, NULL, FALSE); gtk_widget_destroy (GTK_WIDGET (fs)); } @@ -517,7 +520,7 @@ calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal) } static void -new_calendar (char *full_name, char *calendar_file, char *geometry, char *page) +new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, gboolean hidden) { GtkWidget *toplevel; char title[128]; @@ -528,6 +531,7 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page) g_snprintf(title, 128, _("%s%s"), full_name, _("'s calendar")); toplevel = gnome_calendar_new (title); + if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){ if (xpos != -1) gtk_widget_set_uposition (toplevel, xpos, ypos); @@ -552,6 +556,16 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page) active_calendars++; all_calendars = g_list_prepend (all_calendars, toplevel); gtk_widget_realize (toplevel); + + if (hidden){ + GnomeWinState state; + + state = gnome_win_hints_get_state (toplevel); + + state |= WIN_STATE_MINIMIZED; + gnome_win_hints_set_state (toplevel, state); + } + gtk_widget_show (toplevel); } @@ -568,7 +582,8 @@ process_dates (void) enum { GEOMETRY_KEY = -1, USERFILE_KEY = -2, - VIEW_KEY = -3 + VIEW_KEY = -3, + HIDDEN_KEY = -4, }; /* Lists used to startup various GnomeCalendars */ @@ -672,6 +687,10 @@ parse_an_arg (poptContext ctx, show_events = 1; break; + case HIDDEN_KEY: + startup_hidden = 1; + break; + default: } } @@ -686,6 +705,7 @@ static const struct poptOption options [] = { { "geometry", '\0', POPT_ARG_STRING, NULL, GEOMETRY_KEY, N_("Geometry for starting up"), N_("GEOMETRY") }, { "view", '\0', POPT_ARG_STRING, NULL, VIEW_KEY, N_("The startup view mode"), N_("VIEW") }, { "to", 't', POPT_ARG_STRING, NULL, 't', N_("Specifies ending date [for --events]"), N_("DATE") }, + { "hidden", 0, POPT_ARG_NONE, NULL, HIDDEN_KEY, N_("If used, starts in iconic mode"), NULL }, { NULL, '\0', 0, NULL, 0} }; @@ -789,7 +809,7 @@ main(int argc, char *argv[]) title = full_name; else title = file; - new_calendar (title, file, geometry, page_name); + new_calendar (title, file, geometry, page_name, startup_hidden); p = p->next; if (g) @@ -802,7 +822,7 @@ main(int argc, char *argv[]) char *geometry = start_geometries ? start_geometries->data : NULL; char *page_name = start_views ? start_views->data : NULL; - new_calendar (full_name, user_calendar_file, geometry, page_name); + new_calendar (full_name, user_calendar_file, geometry, page_name, startup_hidden); } gtk_main (); return 0; diff --git a/calendar/main.c b/calendar/main.c index 23409be930..db56026ecc 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -43,6 +43,9 @@ int day_begin, day_end; /* Whether weeks starts on Sunday or Monday */ int week_starts_on_monday; +/* If true, do not show our top level window */ +int startup_hidden = 0; + /* The array of color properties -- keep in sync with the enumeration defined in main.h. The color * values specified here are the defaults for the program. */ @@ -62,7 +65,7 @@ int active_calendars = 0; /* A list of all of the calendars started */ GList *all_calendars = NULL; -static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *view); +static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *view, gboolean hidden); /* For dumping part of a calendar */ static time_t from_t, to_t; @@ -305,14 +308,14 @@ goto_clicked (GtkWidget *widget, GnomeCalendar *gcal) static void new_calendar_cmd (GtkWidget *widget, void *data) { - new_calendar (full_name, NULL, NULL, NULL); + new_calendar (full_name, NULL, NULL, NULL, FALSE); } static void open_ok (GtkWidget *widget, GtkFileSelection *fs) { /* FIXME: find out who owns this calendar and use that name */ - new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, NULL); + new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, NULL, FALSE); gtk_widget_destroy (GTK_WIDGET (fs)); } @@ -517,7 +520,7 @@ calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal) } static void -new_calendar (char *full_name, char *calendar_file, char *geometry, char *page) +new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, gboolean hidden) { GtkWidget *toplevel; char title[128]; @@ -528,6 +531,7 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page) g_snprintf(title, 128, _("%s%s"), full_name, _("'s calendar")); toplevel = gnome_calendar_new (title); + if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){ if (xpos != -1) gtk_widget_set_uposition (toplevel, xpos, ypos); @@ -552,6 +556,16 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page) active_calendars++; all_calendars = g_list_prepend (all_calendars, toplevel); gtk_widget_realize (toplevel); + + if (hidden){ + GnomeWinState state; + + state = gnome_win_hints_get_state (toplevel); + + state |= WIN_STATE_MINIMIZED; + gnome_win_hints_set_state (toplevel, state); + } + gtk_widget_show (toplevel); } @@ -568,7 +582,8 @@ process_dates (void) enum { GEOMETRY_KEY = -1, USERFILE_KEY = -2, - VIEW_KEY = -3 + VIEW_KEY = -3, + HIDDEN_KEY = -4, }; /* Lists used to startup various GnomeCalendars */ @@ -672,6 +687,10 @@ parse_an_arg (poptContext ctx, show_events = 1; break; + case HIDDEN_KEY: + startup_hidden = 1; + break; + default: } } @@ -686,6 +705,7 @@ static const struct poptOption options [] = { { "geometry", '\0', POPT_ARG_STRING, NULL, GEOMETRY_KEY, N_("Geometry for starting up"), N_("GEOMETRY") }, { "view", '\0', POPT_ARG_STRING, NULL, VIEW_KEY, N_("The startup view mode"), N_("VIEW") }, { "to", 't', POPT_ARG_STRING, NULL, 't', N_("Specifies ending date [for --events]"), N_("DATE") }, + { "hidden", 0, POPT_ARG_NONE, NULL, HIDDEN_KEY, N_("If used, starts in iconic mode"), NULL }, { NULL, '\0', 0, NULL, 0} }; @@ -789,7 +809,7 @@ main(int argc, char *argv[]) title = full_name; else title = file; - new_calendar (title, file, geometry, page_name); + new_calendar (title, file, geometry, page_name, startup_hidden); p = p->next; if (g) @@ -802,7 +822,7 @@ main(int argc, char *argv[]) char *geometry = start_geometries ? start_geometries->data : NULL; char *page_name = start_views ? start_views->data : NULL; - new_calendar (full_name, user_calendar_file, geometry, page_name); + new_calendar (full_name, user_calendar_file, geometry, page_name, startup_hidden); } gtk_main (); return 0; |