aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorDamon Chaplin <damon@helixcode.com>2000-10-21 23:39:38 +0800
committerDamon Chaplin <damon@src.gnome.org>2000-10-21 23:39:38 +0800
commitdbf54684fc3b1d024253a7415d75d076a1bf4cc9 (patch)
tree9229185e2e388ac8d825cdac4691bde407de7624 /calendar/gui
parentcfa0f85ab441447009b96f97cd94f4cfb026abef (diff)
downloadgsoc2013-evolution-dbf54684fc3b1d024253a7415d75d076a1bf4cc9.tar.gz
gsoc2013-evolution-dbf54684fc3b1d024253a7415d75d076a1bf4cc9.tar.zst
gsoc2013-evolution-dbf54684fc3b1d024253a7415d75d076a1bf4cc9.zip
removed debug message.
2000-10-21 Damon Chaplin <damon@helixcode.com> * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_use_24_hour_toggled): removed debug message. * gui/e-calendar-table.c (e_calendar_table_save_state): new function to save the state of the table to a given file. * gui/e-calendar-table.h (struct _ECalendarTable): added etable field so we can access it to save the state. * gui/gnome-cal.c (gnome_calendar_destroy): call e_calendar_table_save_state() to save the state of the TaskPad. (setup_widgets): load the state of the TaskPad. * gui/calendar-config.c: added support for the default view. * gui/gnome-cal.c (gnome_calendar_construct): (gnome_calendar_set_view_internal): use/set the default view setting. svn path=/trunk/; revision=6097
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-config.c18
-rw-r--r--calendar/gui/calendar-config.h4
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c2
-rw-r--r--calendar/gui/e-calendar-table.c41
-rw-r--r--calendar/gui/e-calendar-table.h7
-rw-r--r--calendar/gui/gnome-cal.c34
6 files changed, 94 insertions, 12 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index dc726191be..0245a05f2a 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -43,6 +43,7 @@ typedef struct
gint day_end_minute;
gint time_divisions;
gboolean dnav_show_week_no;
+ gint view;
gfloat hpane_pos;
gfloat vpane_pos;
gfloat month_hpane_pos;
@@ -93,6 +94,7 @@ config_read (void)
config->day_end_hour = gnome_config_get_int ("DayEndHour=17");
config->day_end_minute = gnome_config_get_int ("DayEndMinute=0");
config->time_divisions = gnome_config_get_int ("TimeDivisions=30");
+ config->view = gnome_config_get_int ("View=0");
config->hpane_pos = gnome_config_get_float ("HPanePosition=1");
config->vpane_pos = gnome_config_get_float ("VPanePosition=1");
config->month_hpane_pos = gnome_config_get_float ("MonthHPanePosition=0");
@@ -168,6 +170,7 @@ calendar_config_write_on_exit (void)
gnome_config_push_prefix (prefix);
g_free (prefix);
+ gnome_config_set_int ("View", config->view);
gnome_config_set_int ("TimeDivisions", config->time_divisions);
gnome_config_set_float ("HPanePosition", config->hpane_pos);
gnome_config_set_float ("VPanePosition", config->vpane_pos);
@@ -302,6 +305,21 @@ calendar_config_set_dnav_show_week_no (gboolean show_week_no)
}
+/* The view to show on start-up, 0 = Day, 1 = WorkWeek, 2 = Week, 3 = Month. */
+gint
+calendar_config_get_default_view (void)
+{
+ return config->view;
+}
+
+
+void
+calendar_config_set_default_view (gint view)
+{
+ config->view = view;
+}
+
+
/* The positions of the panes in the normal and month views. */
gfloat
calendar_config_get_hpane_pos (void)
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index a636e3f185..aa9bdefb80 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -96,6 +96,10 @@ void calendar_config_set_compress_weekend (gboolean compress);
gboolean calendar_config_get_dnav_show_week_no (void);
void calendar_config_set_dnav_show_week_no (gboolean show_week_no);
+/* The view to show on start-up, 0 = Day, 1 = WorkWeek, 2 = Week, 3 = Month. */
+gint calendar_config_get_default_view (void);
+void calendar_config_set_default_view (gint view);
+
/* The positions of the panes in the normal and month views. */
gfloat calendar_config_get_hpane_pos (void);
void calendar_config_set_hpane_pos (gfloat hpane_pos);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 9a50db60b6..dd97690727 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -330,8 +330,6 @@ cal_prefs_dialog_use_24_hour_toggled (GtkWidget *button,
priv = prefs->priv;
- g_print ("In cal_prefs_dialog_use_24_hour_toggled\n");
-
use_24_hour = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_24_hour));
e_date_edit_set_use_24_hour_format (E_DATE_EDIT (priv->start_of_day),
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index b771b338e6..7f7b25ada8 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -28,6 +28,8 @@
*/
#include <config.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include <gnome.h>
#include <gal/e-table/e-table-scrolled.h>
#include <gal/e-table/e-cell-checkbox.h>
@@ -220,7 +222,9 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Create the table */
- table = e_table_scrolled_new (model, extras, E_CALENDAR_TABLE_SPEC, NULL);
+ table = e_table_scrolled_new (model, extras, E_CALENDAR_TABLE_SPEC,
+ NULL);
+ cal_table->etable = table;
gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (table);
@@ -272,8 +276,6 @@ void
e_calendar_table_set_cal_client (ECalendarTable *cal_table,
CalClient *client)
{
- g_print ("In e_calendar_table_set_cal_client\n");
-
calendar_model_set_cal_client (cal_table->model, client,
CALOBJ_TYPE_TODO);
}
@@ -284,8 +286,6 @@ e_calendar_table_on_double_click (ETable *table,
gint row,
ECalendarTable *cal_table)
{
- g_print ("In e_calendar_table_on_double_click row:%i\n", row);
-
e_calendar_table_open_task (cal_table, row);
}
@@ -375,11 +375,7 @@ e_calendar_table_on_key_press (ETable *table,
GdkEventKey *event,
ECalendarTable *cal_table)
{
- g_print ("In e_calendar_table_on_key_press\n");
-
if (event->keyval == GDK_Delete) {
- g_print (" delete key!!!\n");
-
calendar_model_delete_task (cal_table->model, row);
}
@@ -402,3 +398,30 @@ e_calendar_table_open_task (ECalendarTable *cal_table,
}
+/* Loads the state of the table (headers shown etc.) from the given file. */
+void
+e_calendar_table_load_state (ECalendarTable *cal_table,
+ gchar *filename)
+{
+ struct stat st;
+
+ g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
+
+ if (stat (filename, &st) == 0 && st.st_size > 0
+ && S_ISREG (st.st_mode)) {
+ e_table_scrolled_load_state (E_TABLE_SCROLLED (cal_table->etable), filename);
+ }
+}
+
+
+/* Saves the state of the table (headers shown etc.) to the given file. */
+void
+e_calendar_table_save_state (ECalendarTable *cal_table,
+ gchar *filename)
+{
+
+ g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
+
+ e_table_scrolled_save_state (E_TABLE_SCROLLED (cal_table->etable),
+ filename);
+}
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 38e3eafea3..1265a80a72 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -59,6 +59,7 @@ struct _ECalendarTable
CalendarModel *model;
+ GtkWidget *etable;
/* Colors for drawing. */
GdkColor colors[E_CALENDAR_TABLE_COLOR_LAST];
@@ -77,6 +78,12 @@ GtkWidget* e_calendar_table_new (void);
void e_calendar_table_set_cal_client (ECalendarTable *cal_table,
CalClient *client);
+/* These load and save the state of the table (headers shown etc.) to/from
+ the given file. */
+void e_calendar_table_load_state (ECalendarTable *cal_table,
+ gchar *filename);
+void e_calendar_table_save_state (ECalendarTable *cal_table,
+ gchar *filename);
#ifdef __cplusplus
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 46eb66e58e..379bbfec95 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -24,6 +24,7 @@
#include "e-week-view.h"
#include "event-editor.h"
#include "gnome-cal.h"
+#include "component-factory.h"
#include "calendar-commands.h"
#include "calendar-config.h"
@@ -197,6 +198,7 @@ setup_widgets (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
GtkWidget *w;
+ gchar *filename;
priv = gcal->priv;
@@ -245,6 +247,10 @@ setup_widgets (GnomeCalendar *gcal)
e_paned_pack2 (E_PANED (priv->vpane), priv->todo, TRUE, TRUE);
gtk_widget_show (priv->todo);
+ filename = g_strdup_printf ("%s/config/TaskPad", evolution_dir);
+ e_calendar_table_load_state (E_CALENDAR_TABLE (priv->todo), filename);
+ g_free (filename);
+
/* The Day View. */
priv->day_view = e_day_view_new ();
e_day_view_set_calendar (E_DAY_VIEW (priv->day_view), gcal);
@@ -337,6 +343,7 @@ gnome_calendar_destroy (GtkObject *object)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
+ gchar *filename;
g_return_if_fail (object != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (object));
@@ -344,6 +351,11 @@ gnome_calendar_destroy (GtkObject *object)
gcal = GNOME_CALENDAR (object);
priv = gcal->priv;
+ /* Save the TaskPad layout. */
+ filename = g_strdup_printf ("%s/config/TaskPad", evolution_dir);
+ e_calendar_table_save_state (E_CALENDAR_TABLE (priv->todo), filename);
+ g_free (filename);
+
priv->load_state = LOAD_STATE_NOT_LOADED;
if (priv->loading_uri) {
@@ -604,6 +616,8 @@ gnome_calendar_set_view_internal (GnomeCalendar *gcal,
priv->current_view_type = view;
priv->range_selected = range_selected;
+ calendar_config_set_default_view (view);
+
gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), view);
if (focus)
@@ -1280,6 +1294,8 @@ GtkWidget *
gnome_calendar_construct (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
+ gint view;
+ gchar *page;
g_return_val_if_fail (gcal != NULL, NULL);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
@@ -1304,7 +1320,23 @@ gnome_calendar_construct (GnomeCalendar *gcal)
e_week_view_set_cal_client (E_WEEK_VIEW (priv->week_view), priv->client);
e_week_view_set_cal_client (E_WEEK_VIEW (priv->month_view), priv->client);
- gnome_calendar_set_view (gcal, "dayview", FALSE, FALSE);
+ view = calendar_config_get_default_view ();
+ switch (view) {
+ case 1:
+ page = "workweekview";
+ break;
+ case 2:
+ page = "weekview";
+ break;
+ case 3:
+ page = "monthview";
+ break;
+ default:
+ page = "dayview";
+ break;
+ }
+
+ gnome_calendar_set_view (gcal, page, FALSE, FALSE);
return GTK_WIDGET (gcal);
}