diff options
author | Damon Chaplin <damon@ximian.com> | 2001-06-20 15:09:34 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2001-06-20 15:09:34 +0800 |
commit | 1c6b4a17d875a0ecf76c525930b832fe24929ac5 (patch) | |
tree | 9e234c59c58d049ce6f22329c5a94ec88111c075 /calendar/gui | |
parent | 541d52701f8225e45651b405fd44a7fa4aa417da (diff) | |
download | gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.tar gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.tar.gz gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.tar.bz2 gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.tar.lz gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.tar.xz gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.tar.zst gsoc2013-evolution-1c6b4a17d875a0ecf76c525930b832fe24929ac5.zip |
moved the function to check for a default timezone to calendar-config.c,
2001-06-20 Damon Chaplin <damon@ximian.com>
* gui/calendar-config.[hc]:
* gui/gnome-cal.[hc]:
* gui/tasks-control.c (tasks_control_activate):
* gui/calendar-commands.c (calendar_control_activate): moved the
function to check for a default timezone to calendar-config.c, and
also used it in the tasks control.
* gui/dialogs/e-timezone-dialog.h: #include <gtk/gtkwidget.h> fix.
svn path=/trunk/; revision=10325
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar-commands.c | 4 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 75 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/e-timezone-dialog.h | 2 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 61 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.h | 3 | ||||
-rw-r--r-- | calendar/gui/tasks-control.c | 4 |
7 files changed, 87 insertions, 66 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index d2b706a13d..4e89e44693 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -449,7 +449,9 @@ calendar_control_activate (BonoboControl *control, bonobo_ui_component_thaw (uic, NULL); - gnome_calendar_check_timezone_set (gcal); + /* Show the dialog for setting the timezone if the user hasn't chosen + a default timezone already. */ + calendar_config_check_timezone_set (); } void diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index a11e0d32b7..a106082362 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -30,7 +30,11 @@ #include <config.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-config.h> +#include <libgnomeui/gnome-dialog.h> +#include "dialogs/e-timezone-dialog.h" #include "component-factory.h" +#include "calendar-commands.h" +#include "e-tasks.h" #include "calendar-config.h" @@ -60,6 +64,12 @@ static CalendarConfig *config = NULL; static void config_read (void); +static void on_timezone_set (GnomeDialog *dialog, + int button, + ETimezoneDialog *etd); +static gboolean on_timezone_dialog_delete_event (GnomeDialog *dialog, + GdkEvent *event, + ETimezoneDialog *etd); void calendar_config_init (void) @@ -560,3 +570,68 @@ calendar_config_configure_e_calendar_table (ECalendarTable *cal_table) calendar_config_configure_e_cell_date_edit (cal_table->dates_cell); } + + + +void +calendar_config_check_timezone_set () +{ + ETimezoneDialog *timezone_dialog; + GtkWidget *dialog; + GList *elem; + char *zone; + + zone = calendar_config_get_timezone (); + if (zone && zone[0]) + return; + + /* Show timezone dialog. */ + timezone_dialog = e_timezone_dialog_new (); + dialog = e_timezone_dialog_get_toplevel (timezone_dialog); + + /* Hide the cancel button, which is the 2nd button. */ + elem = g_list_nth (GNOME_DIALOG (dialog)->buttons, 1); + gtk_widget_hide (elem->data); + + gtk_signal_connect (GTK_OBJECT (dialog), "clicked", + GTK_SIGNAL_FUNC (on_timezone_set), + timezone_dialog); + gtk_signal_connect (GTK_OBJECT (dialog), "delete-event", + GTK_SIGNAL_FUNC (on_timezone_dialog_delete_event), + timezone_dialog); + + gtk_widget_show (dialog); +} + + +static void +on_timezone_set (GnomeDialog *dialog, + int button, + ETimezoneDialog *etd) +{ + char *zone; + + zone = e_timezone_dialog_get_timezone (etd); + + if (zone && zone[0]) { + calendar_config_set_timezone (zone); + + calendar_config_write (); + update_all_config_settings (); + e_tasks_update_all_config_settings (); + } + + gtk_object_unref (GTK_OBJECT (etd)); +} + + +static gboolean +on_timezone_dialog_delete_event (GnomeDialog *dialog, + GdkEvent *event, + ETimezoneDialog *etd) +{ + gtk_object_unref (GTK_OBJECT (etd)); + return TRUE; +} + + diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 1dcfcbf17c..03f477da19 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -131,4 +131,8 @@ void calendar_config_configure_e_date_edit (EDateEdit *dedit); void calendar_config_configure_e_calendar_table (ECalendarTable *cal_table); void calendar_config_configure_e_cell_date_edit (ECellDateEdit *ecde); +/* Shows the timezone dialog if the user hasn't set a default timezone. */ +void calendar_config_check_timezone_set (void); + + #endif /* _CALENDAR_CONFIG_H_ */ diff --git a/calendar/gui/dialogs/e-timezone-dialog.h b/calendar/gui/dialogs/e-timezone-dialog.h index 860ced85f8..323375c5fc 100644 --- a/calendar/gui/dialogs/e-timezone-dialog.h +++ b/calendar/gui/dialogs/e-timezone-dialog.h @@ -23,7 +23,7 @@ #define __E_TIMEZONE_DIALOG_H__ #include <libgnome/gnome-defs.h> -#include <gtk/gtkobject.h> +#include <gtk/gtkwidget.h> diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index e15a746aa6..73ac19aabc 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -43,7 +43,6 @@ #include "widgets/misc/e-filter-bar.h" #include "dialogs/alarm-notify-dialog.h" #include "dialogs/event-editor.h" -#include "dialogs/e-timezone-dialog.h" #include "e-calendar-table.h" #include "e-day-view.h" #include "e-week-view.h" @@ -1921,63 +1920,3 @@ gnome_calendar_update_view_buttons (GnomeCalendar *gcal) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_signal_handler_unblock_by_data (GTK_OBJECT (button), gcal); } - - -static void -on_timezone_set (GnomeDialog *dialog, int button, ETimezoneDialog *etd) -{ - char *zone; - - zone = e_timezone_dialog_get_timezone (etd); - - if (zone && zone[0]) { - calendar_config_set_timezone (zone); - - calendar_config_write (); - update_all_config_settings (); - e_tasks_update_all_config_settings (); - } - - gtk_object_unref (GTK_OBJECT (etd)); -} - - -static gboolean -on_timezone_dialog_delete_event (GnomeDialog *dialog, GdkEvent *event, - ETimezoneDialog *etd) -{ - gtk_object_unref (GTK_OBJECT (etd)); - return TRUE; -} - - -void -gnome_calendar_check_timezone_set (GnomeCalendar *gcal) -{ - ETimezoneDialog *timezone_dialog; - GtkWidget *dialog; - GList *elem; - char *zone; - - zone = calendar_config_get_timezone (); - if (zone && zone[0]) - return; - - /* Show timezone dialog. */ - timezone_dialog = e_timezone_dialog_new (); - dialog = e_timezone_dialog_get_toplevel (timezone_dialog); - - /* Hide the cancel button, which is the 2nd button. */ - elem = g_list_nth (GNOME_DIALOG (dialog)->buttons, 1); - gtk_widget_hide (elem->data); - - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (on_timezone_set), - timezone_dialog); - gtk_signal_connect (GTK_OBJECT (dialog), "delete-event", - GTK_SIGNAL_FUNC (on_timezone_dialog_delete_event), - timezone_dialog); - - gtk_widget_show (dialog); -} - diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 908e680133..9ff25c50f5 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -123,9 +123,6 @@ void gnome_calendar_get_current_time_range (GnomeCalendar *gcal, void gnome_calendar_update_config_settings (GnomeCalendar *gcal, gboolean initializing); -/* Shows the timezone dialog if the user hasn't set a default timezone. */ -void gnome_calendar_check_timezone_set (GnomeCalendar *gcal); - void gnome_calendar_set_view_buttons (GnomeCalendar *gcal, GtkWidget *day_button, GtkWidget *work_week_button, diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index e460e5fe00..a7bdff3dd5 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -263,6 +263,10 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks) sensitize_commands (tasks, control, n_selected); bonobo_ui_component_thaw (uic, NULL); + + /* Show the dialog for setting the timezone if the user hasn't chosen + a default timezone already. */ + calendar_config_check_timezone_set (); } |