diff options
-rw-r--r-- | calendar/ChangeLog | 8 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.c | 58 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.h | 6 | ||||
-rw-r--r-- | calendar/gui/control-factory.c | 2 |
4 files changed, 20 insertions, 54 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 187e16f4a5..40cd501fa9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,13 @@ 2000-10-30 Federico Mena Quintero <federico@helixcode.com> + * gui/calendar-commands.c (new_calendar): Removed the geometry and + hidden arguments. This code is ancient. + (all_calendars): Made static. This sucks; configuration should be + notification-based instead of "let's iterate through all open + calendars". + (active_calendars): Removed. Functions can check the length of + the all_calendars list if they are interested. + * gui/event-editor.c (sync_entries): Do not take in an extra data pointer. (summary_changed_cb): Use a single call back to sync both entries. diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 41892b51b1..c26144e307 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -69,11 +69,8 @@ struct color_prop color_props[] = { { 0xbbbb, 0xdddd, 0x0000, N_("To-Do item that is overdue:"), "/calendar/Colors/todo_overdue" } }; -/* Number of active calendars */ -int active_calendars = 0; - /* A list of all of the calendars started */ -GList *all_calendars = NULL; +static GList *all_calendars = NULL; /* If set, beep on display alarms */ gboolean beep_on_display = 0; @@ -348,7 +345,7 @@ show_month_view_clicked (BonoboUIComponent *uih, void *user_data, const char *pa static void new_calendar_cmd (BonoboUIComponent *uih, void *user_data, const char *path) { - new_calendar (full_name, NULL, FALSE); + new_calendar (full_name); } static void @@ -358,9 +355,8 @@ close_cmd (BonoboUIComponent *uih, void *user_data, const char *path) all_calendars = g_list_remove (all_calendars, gcal); gtk_widget_destroy (GTK_WIDGET (gcal)); - active_calendars--; - if (active_calendars == 0) + if (all_calendars == NULL) gtk_main_quit (); } @@ -396,7 +392,7 @@ open_ok (GtkWidget *widget, GtkFileSelection *fs) #warning "FIXME: find out who owns this calendar and use that name" #endif /* - new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, FALSE); + new_calendar ("Somebody", gtk_file_selection_get_filename (fs)); */ gtk_widget_destroy (GTK_WIDGET (fs)); } @@ -576,51 +572,17 @@ calendar_control_deactivate (BonoboControl *control) bonobo_ui_component_unset_container (uic); } - - - -static gint -calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal) -{ - close_cmd (NULL, gcal, NULL); - return TRUE; -} - - GnomeCalendar * -new_calendar (char *full_name, char *geometry, gboolean hidden) +new_calendar (char *full_name) { - GtkWidget *toplevel; - int xpos, ypos, width, height; + GtkWidget *gcal; + gcal = gnome_calendar_new (); - toplevel = gnome_calendar_new (); - - if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)) { - if (xpos != -1) - gtk_widget_set_uposition (toplevel, xpos, ypos); - } - - gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event", - GTK_SIGNAL_FUNC(calendar_close_event), toplevel); - - active_calendars++; - all_calendars = g_list_prepend (all_calendars, toplevel); - - if (hidden){ - GnomeWinState state; - - /* Realize the toplevel window to prevent a segfault */ - gtk_widget_realize (toplevel); - state = gnome_win_hints_get_state (toplevel); - - state |= WIN_STATE_MINIMIZED; - gnome_win_hints_set_state (toplevel, state); - } - - gtk_widget_show (toplevel); + all_calendars = g_list_prepend (all_calendars, gcal); - return GNOME_CALENDAR (toplevel); + gtk_widget_show (gcal); + return GNOME_CALENDAR (gcal); } diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h index f7afa4b3c2..19752c9cc8 100644 --- a/calendar/gui/calendar-commands.h +++ b/calendar/gui/calendar-commands.h @@ -106,9 +106,7 @@ void parse_color_spec (char *spec, int *r, int *g, int *b); /* Calls build_color_spec() for the color in the specified property number */ char *color_spec_from_prop (ColorProp propnum); -GnomeCalendar *new_calendar (char *full_name, - char *geometry, - gboolean hidden); +GnomeCalendar *new_calendar (char *full_name); void calendar_set_uri (GnomeCalendar *gcal, char *calendar_file); @@ -129,7 +127,5 @@ void quit_cmd (BonoboUIComponent *uih, void *user_data, const char *path); extern char *user_name; extern char *full_name; extern int debug_alarms; -extern int active_calendars; -extern GList *all_calendars; #endif /* CALENDAR_COMMANDS_H */ diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c index 104eb3a4c9..80f55db054 100644 --- a/calendar/gui/control-factory.c +++ b/calendar/gui/control-factory.c @@ -167,7 +167,7 @@ control_factory_new_control (void) BonoboControl *control; GnomeCalendar *gcal; - gcal = new_calendar (full_name, NULL, 0); + gcal = new_calendar (full_name); gtk_widget_show (GTK_WIDGET (gcal)); control = bonobo_control_new (GTK_WIDGET (gcal)); |