[Xfce4-commits] <orage:master> 4.9.2.0 Enhancement 8383 option to day view start on first day of week
Juha
noreply at xfce.org
Thu Feb 7 10:16:01 CET 2013
Updating branch refs/heads/master
to f452d76e6cbf4c378d74f3130be88323a26a5494 (commit)
from 881df443fc37b8371e08e4b8711eabf95b70a2e2 (commit)
commit f452d76e6cbf4c378d74f3130be88323a26a5494
Author: Juha <juha at xfce.org>
Date: Thu Feb 7 11:10:08 2013 +0200
4.9.2.0 Enhancement 8383 option to day view start on first day of week
Added visible parameter to start day view on first day of week. Also
changed small arrows to move 7 days when weekmode is selected. Also
added week movement buttons.
Now also remember day view size and location.
Also fixed rare problem with start and end dates due to timezone
changing date.
configure.in.in | 2 +-
src/day-view.c | 187 +++++++++++++++++++++++++++++++++++++++++++++---------
src/day-view.h | 12 ++-
src/functions.c | 29 +--------
src/parameters.c | 63 ++++++++++++++++++-
src/parameters.h | 5 ++
6 files changed, 235 insertions(+), 63 deletions(-)
diff --git a/configure.in.in b/configure.in.in
index c77584a..2574b41 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
dnl
dnl Version information
-m4_define([orage_version], [4.9.1.2-git])
+m4_define([orage_version], [4.9.2.0-git])
m4_define([gtk_minimum_version], [2.14.0])
m4_define([xfce_minimum_version], [4.8.0])
diff --git a/src/day-view.c b/src/day-view.c
index 899c225..ba612a2 100644
--- a/src/day-view.c
+++ b/src/day-view.c
@@ -127,6 +127,12 @@ static void close_window(day_win *dw)
appt_win *apptw;
GList *apptw_list;
+ gtk_window_get_size(GTK_WINDOW(dw->Window)
+ , &g_par.dw_size_x, &g_par.dw_size_y);
+ gtk_window_get_position(GTK_WINDOW(dw->Window)
+ , &g_par.dw_pos_x, &g_par.dw_pos_y);
+ write_parameters();
+
/* need to clean the appointment list and inform all appointments that
* we are not interested anymore (= should not get updated) */
apptw_list = dw->apptw_list;
@@ -223,26 +229,46 @@ static void on_Go_today_activate_cb(GtkMenuItem *mi, gpointer user_data)
go_to_today((day_win *)user_data);
}
-static void on_Go_previous_activate_cb(GtkMenuItem *mi, gpointer user_data)
+static void on_Go_previous_week_activate_cb(GtkMenuItem *mi, gpointer user_data)
+{
+ changeSelectedDate((day_win *)user_data, -7);
+}
+
+static void on_Go_previous_day_activate_cb(GtkMenuItem *mi, gpointer user_data)
{
changeSelectedDate((day_win *)user_data, -1);
}
-static void on_Previous_clicked(GtkButton *b, gpointer user_data)
+static void on_Previous_day_clicked(GtkButton *b, gpointer user_data)
{
changeSelectedDate((day_win *)user_data, -1);
}
-static void on_Go_next_activate_cb(GtkMenuItem *mi, gpointer user_data)
+static void on_Previous_week_clicked(GtkButton *b, gpointer user_data)
+{
+ changeSelectedDate((day_win *)user_data, -7);
+}
+
+static void on_Go_next_day_activate_cb(GtkMenuItem *mi, gpointer user_data)
{
changeSelectedDate((day_win *)user_data, 1);
}
-static void on_Next_clicked(GtkButton *b, gpointer user_data)
+static void on_Go_next_week_activate_cb(GtkMenuItem *mi, gpointer user_data)
+{
+ changeSelectedDate((day_win *)user_data, 7);
+}
+
+static void on_Next_day_clicked(GtkButton *b, gpointer user_data)
{
changeSelectedDate((day_win *)user_data, 1);
}
+static void on_Next_week_clicked(GtkButton *b, gpointer user_data)
+{
+ changeSelectedDate((day_win *)user_data, 7);
+}
+
static void build_menu(day_win *dw)
{
GtkWidget *menu_separator;
@@ -276,21 +302,51 @@ static void build_menu(day_win *dw)
/********** Go menu **********/
dw->Go_menu = orage_menu_new(_("_Go"), dw->Menubar);
+
dw->Go_menu_today = orage_image_menu_item_new_from_stock("gtk-home"
, dw->Go_menu, dw->accel_group);
gtk_widget_add_accelerator(dw->Go_menu_today
, "activate", dw->accel_group
, GDK_Home, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
- dw->Go_menu_prev = orage_image_menu_item_new_from_stock("gtk-go-back"
+ gtk_widget_add_accelerator(dw->Go_menu_today
+ , "activate", dw->accel_group
+ , GDK_KP_Home, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+
+ dw->Go_menu_prev_week = orage_image_menu_item_new_from_stock("gtk-go-up"
+ , dw->Go_menu, dw->accel_group);
+ gtk_widget_add_accelerator(dw->Go_menu_prev_week
+ , "activate", dw->accel_group
+ , GDK_Page_Up, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+ gtk_widget_add_accelerator(dw->Go_menu_prev_week
+ , "activate", dw->accel_group
+ , GDK_KP_Page_Up, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+
+ dw->Go_menu_prev_day = orage_image_menu_item_new_from_stock("gtk-go-back"
, dw->Go_menu, dw->accel_group);
- gtk_widget_add_accelerator(dw->Go_menu_prev
+ gtk_widget_add_accelerator(dw->Go_menu_prev_day
, "activate", dw->accel_group
, GDK_Left, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
- dw->Go_menu_next = orage_image_menu_item_new_from_stock("gtk-go-forward"
+ gtk_widget_add_accelerator(dw->Go_menu_prev_day
+ , "activate", dw->accel_group
+ , GDK_KP_Left, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+
+ dw->Go_menu_next_day = orage_image_menu_item_new_from_stock("gtk-go-forward"
, dw->Go_menu, dw->accel_group);
- gtk_widget_add_accelerator(dw->Go_menu_next
+ gtk_widget_add_accelerator(dw->Go_menu_next_day
, "activate", dw->accel_group
, GDK_Right, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+ gtk_widget_add_accelerator(dw->Go_menu_next_day
+ , "activate", dw->accel_group
+ , GDK_KP_Right, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+
+ dw->Go_menu_next_week = orage_image_menu_item_new_from_stock("gtk-go-down"
+ , dw->Go_menu, dw->accel_group);
+ gtk_widget_add_accelerator(dw->Go_menu_next_week
+ , "activate", dw->accel_group
+ , GDK_Page_Down, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
+ gtk_widget_add_accelerator(dw->Go_menu_next_week
+ , "activate", dw->accel_group
+ , GDK_KP_Page_Down, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
g_signal_connect((gpointer)dw->File_menu_new, "activate"
, G_CALLBACK(on_File_newApp_activate_cb), dw);
@@ -300,10 +356,14 @@ static void build_menu(day_win *dw)
, G_CALLBACK(on_View_refresh_activate_cb), dw);
g_signal_connect((gpointer)dw->Go_menu_today, "activate"
, G_CALLBACK(on_Go_today_activate_cb), dw);
- g_signal_connect((gpointer)dw->Go_menu_prev, "activate"
- , G_CALLBACK(on_Go_previous_activate_cb), dw);
- g_signal_connect((gpointer)dw->Go_menu_next, "activate"
- , G_CALLBACK(on_Go_next_activate_cb), dw);
+ g_signal_connect((gpointer)dw->Go_menu_prev_week, "activate"
+ , G_CALLBACK(on_Go_previous_week_activate_cb), dw);
+ g_signal_connect((gpointer)dw->Go_menu_prev_day, "activate"
+ , G_CALLBACK(on_Go_previous_day_activate_cb), dw);
+ g_signal_connect((gpointer)dw->Go_menu_next_day, "activate"
+ , G_CALLBACK(on_Go_next_day_activate_cb), dw);
+ g_signal_connect((gpointer)dw->Go_menu_next_week, "activate"
+ , G_CALLBACK(on_Go_next_week_activate_cb), dw);
}
static void build_toolbar(day_win *dw)
@@ -320,12 +380,16 @@ static void build_toolbar(day_win *dw)
toolbar_separator = orage_toolbar_append_separator(dw->Toolbar, i++);
- dw->Previous_toolbutton = orage_toolbar_append_button(dw->Toolbar
- , "gtk-go-back", dw->Tooltips, _("Back"), i++);
+ dw->Previous_week_toolbutton = orage_toolbar_append_button(dw->Toolbar
+ , "gtk-go-up", dw->Tooltips, _("Back one week"), i++);
+ dw->Previous_day_toolbutton = orage_toolbar_append_button(dw->Toolbar
+ , "gtk-go-back", dw->Tooltips, _("Back one day"), i++);
dw->Today_toolbutton = orage_toolbar_append_button(dw->Toolbar
, "gtk-home", dw->Tooltips, _("Today"), i++);
- dw->Next_toolbutton = orage_toolbar_append_button(dw->Toolbar
- , "gtk-go-forward", dw->Tooltips, _("Forward"), i++);
+ dw->Next_day_toolbutton = orage_toolbar_append_button(dw->Toolbar
+ , "gtk-go-forward", dw->Tooltips, _("Forward one day"), i++);
+ dw->Next_week_toolbutton = orage_toolbar_append_button(dw->Toolbar
+ , "gtk-go-down", dw->Tooltips, _("Forward one week"), i++);
toolbar_separator = orage_toolbar_append_separator(dw->Toolbar, i++);
@@ -339,12 +403,16 @@ static void build_toolbar(day_win *dw)
g_signal_connect((gpointer)dw->Create_toolbutton, "clicked"
, G_CALLBACK(on_Create_toolbutton_clicked_cb), dw);
- g_signal_connect((gpointer)dw->Previous_toolbutton, "clicked"
- , G_CALLBACK(on_Previous_clicked), dw);
+ g_signal_connect((gpointer)dw->Previous_week_toolbutton, "clicked"
+ , G_CALLBACK(on_Previous_week_clicked), dw);
+ g_signal_connect((gpointer)dw->Previous_day_toolbutton, "clicked"
+ , G_CALLBACK(on_Previous_day_clicked), dw);
g_signal_connect((gpointer)dw->Today_toolbutton, "clicked"
, G_CALLBACK(on_Today_clicked), dw);
- g_signal_connect((gpointer)dw->Next_toolbutton, "clicked"
- , G_CALLBACK(on_Next_clicked), dw);
+ g_signal_connect((gpointer)dw->Next_day_toolbutton, "clicked"
+ , G_CALLBACK(on_Next_day_clicked), dw);
+ g_signal_connect((gpointer)dw->Next_week_toolbutton, "clicked"
+ , G_CALLBACK(on_Next_week_clicked), dw);
g_signal_connect((gpointer)dw->Refresh_toolbutton, "clicked"
, G_CALLBACK(on_Refresh_clicked), dw);
g_signal_connect((gpointer)dw->Close_toolbutton, "clicked"
@@ -416,6 +484,12 @@ static void on_button_press_event_cb(GtkWidget *widget
}
}
+static void on_arrow_up_press_event_cb(GtkWidget *widget
+ , GdkEventButton *event, gpointer *user_data)
+{
+ changeSelectedDate((day_win *)user_data, -7);
+}
+
static void on_arrow_left_press_event_cb(GtkWidget *widget
, GdkEventButton *event, gpointer *user_data)
{
@@ -428,6 +502,12 @@ static void on_arrow_right_press_event_cb(GtkWidget *widget
changeSelectedDate((day_win *)user_data, 1);
}
+static void on_arrow_down_press_event_cb(GtkWidget *widget
+ , GdkEventButton *event, gpointer *user_data)
+{
+ changeSelectedDate((day_win *)user_data, 7);
+}
+
static void add_row(day_win *dw, xfical_appt *appt)
{
gint row, start_row, end_row, days;
@@ -446,6 +526,9 @@ static void add_row(day_win *dw, xfical_appt *appt)
end_col = orage_days_between(&tm_first, &tm_end)+1;
days = orage_days_between(&tm_start, &tm_end);
+ if (start_col > dw->days) { /* can happen if timezones pass date change */
+ return; /* this does not fit, so we just skip it */
+ }
if (start_col < 1) {
col = 1;
row = 0;
@@ -454,6 +537,12 @@ static void add_row(day_win *dw, xfical_appt *appt)
col = start_col;
row = tm_start.tm_hour;
}
+ if (end_col < 1) { /* can happen if timezones pass date change */
+ return; /* this does not fit, so we just skip it */
+ }
+ if (end_col > dw->days) { /* can happen if timezones pass date change */
+ end_col = days;
+ }
/* then add the appointment */
tmp_title = orage_process_text_commands(
@@ -696,13 +785,15 @@ static void fill_days(day_win *dw, gint days)
static void build_day_view_header(day_win *dw, char *start_date)
{
GtkWidget *hbox, *label;
+ struct tm tm_date;
+ char *first_date;
+ int diff_to_weeks_first_day;
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(dw->Vbox), hbox, FALSE, FALSE, 10);
label = gtk_label_new(_("Start"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 10);
-
/* start date button */
dw->StartDate_button = gtk_button_new();
gtk_box_pack_start(GTK_BOX(hbox), dw->StartDate_button, FALSE, FALSE, 0);
@@ -716,8 +807,26 @@ static void build_day_view_header(day_win *dw, char *start_date)
gtk_box_pack_start(GTK_BOX(hbox), dw->day_spin, FALSE, FALSE, 0);
/* initial values */
+ if (g_par.dw_week_mode) { /* we want to start form week start day */
+ tm_date = orage_i18_date_to_tm_date(start_date);
+ /* tm_date.wday: 0 = Sunday, 1 = Monday, 2 = Tuesday, ... 6 = Saturday
+ g_par.ical_weekstartday: 0 = Monday, 1 = Tuesday, ... 6 = Sunday */
+ diff_to_weeks_first_day = tm_date.tm_wday - (g_par.ical_weekstartday+1);
+ if (diff_to_weeks_first_day < 0)
+ diff_to_weeks_first_day += 7;
+ if (diff_to_weeks_first_day == 0) { /* we are on week start day */
+ first_date = start_date;
+ }
+ else {
+ orage_move_day(&tm_date, -1*diff_to_weeks_first_day);
+ first_date = orage_tm_date_to_i18_date(&tm_date);
+ }
+ }
+ else {
+ first_date = start_date;
+ }
gtk_button_set_label(GTK_BUTTON(dw->StartDate_button)
- , (const gchar *)start_date);
+ , (const gchar *)first_date);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dw->day_spin), 7);
/* sizes */
@@ -795,15 +904,29 @@ static void fill_hour_arrow(day_win *dw, gint col)
GtkWidget *arrow, *ev;
ev = gtk_event_box_new();
- if (col == 0) {
- arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
- g_signal_connect((gpointer)ev, "button-press-event"
- , G_CALLBACK(on_arrow_left_press_event_cb), dw);
+ if (g_par.dw_week_mode) {
+ if (col == 0) {
+ arrow = gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_NONE);
+ g_signal_connect((gpointer)ev, "button-press-event"
+ , G_CALLBACK(on_arrow_up_press_event_cb), dw);
+ }
+ else {
+ arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+ g_signal_connect((gpointer)ev, "button-press-event"
+ , G_CALLBACK(on_arrow_down_press_event_cb), dw);
+ }
}
else {
- arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
- g_signal_connect((gpointer)ev, "button-press-event"
- , G_CALLBACK(on_arrow_right_press_event_cb), dw);
+ if (col == 0) {
+ arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
+ g_signal_connect((gpointer)ev, "button-press-event"
+ , G_CALLBACK(on_arrow_left_press_event_cb), dw);
+ }
+ else {
+ arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
+ g_signal_connect((gpointer)ev, "button-press-event"
+ , G_CALLBACK(on_arrow_right_press_event_cb), dw);
+ }
}
gtk_container_add(GTK_CONTAINER(ev), arrow);
gtk_widget_set_size_request(ev, dw->hour_req.width
@@ -937,7 +1060,11 @@ day_win *create_day_win(char *start_date)
dw->accel_group = gtk_accel_group_new();
dw->Window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size(GTK_WINDOW(dw->Window), 690, 390);
+ if (g_par.dw_size_x || g_par.dw_size_y)
+ gtk_window_set_default_size(GTK_WINDOW(dw->Window)
+ , g_par.dw_size_x, g_par.dw_size_y);
+ if (g_par.dw_pos_x || g_par.dw_pos_y)
+ gtk_window_move(GTK_WINDOW(dw->Window), g_par.dw_pos_x, g_par.dw_pos_y);
gtk_window_set_title(GTK_WINDOW(dw->Window), _("Orage - day view"));
gtk_window_add_accel_group(GTK_WINDOW(dw->Window), dw->accel_group);
diff --git a/src/day-view.h b/src/day-view.h
index bb1137c..7b713e4 100644
--- a/src/day-view.h
+++ b/src/day-view.h
@@ -42,14 +42,18 @@ typedef struct _day_win
GtkWidget *View_menu_refresh;
GtkWidget *Go_menu;
GtkWidget *Go_menu_today;
- GtkWidget *Go_menu_prev;
- GtkWidget *Go_menu_next;
+ GtkWidget *Go_menu_prev_day;
+ GtkWidget *Go_menu_prev_week;
+ GtkWidget *Go_menu_next_day;
+ GtkWidget *Go_menu_next_week;
GtkWidget *Toolbar;
GtkWidget *Create_toolbutton;
- GtkWidget *Previous_toolbutton;
+ GtkWidget *Previous_week_toolbutton;
+ GtkWidget *Previous_day_toolbutton;
GtkWidget *Today_toolbutton;
- GtkWidget *Next_toolbutton;
+ GtkWidget *Next_day_toolbutton;
+ GtkWidget *Next_week_toolbutton;
GtkWidget *Refresh_toolbutton;
GtkWidget *Close_toolbutton;
diff --git a/src/functions.c b/src/functions.c
index 417ae51..823a60b 100644
--- a/src/functions.c
+++ b/src/functions.c
@@ -731,34 +731,9 @@ char *orage_localdate_i18(void)
/* move one day forward or backward */
void orage_move_day(struct tm *t, int day)
{
- gint monthdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
- if (day < -1 || day > 1) {
- g_warning("orage: orage_move_day wrong parameter %d", day);
- }
- t->tm_year += 1900;
- if (((t->tm_year%4) == 0)
- && (((t->tm_year%100) != 0) || ((t->tm_year%400) == 0)))
- ++monthdays[1]; /* leap year, february has 29 days */
-
t->tm_mday += day; /* may be negative */
- if (t->tm_mday == 0) { /* we went to previous month */
- if (--t->tm_mon == -1) { /* previous year */
- --t->tm_year;
- t->tm_mon = 11;
- }
- t->tm_mday = monthdays[t->tm_mon];
- }
- else if (t->tm_mday > (monthdays[t->tm_mon])) { /* next month */
- if (++t->tm_mon == 12) {
- ++t->tm_year;
- t->tm_mon = 0;
- }
- t->tm_mday = 1;
- }
- t->tm_year -= 1900;
- /* need to fill missing tm_wday and tm_yday, which are in use
- * in some locale's default date. For example in en_IN. mktime does it */
+ /* mktime adjusts t correctly. It also fills missing tm_wday and tm_yday,
+ * which are in use in some locale's default date. For example in en_IN */
if (mktime(t) == (time_t) -1) {
g_warning("orage: orage_move_day mktime failed %d %d %d"
, t->tm_year, t->tm_mon, t->tm_mday);
diff --git a/src/parameters.c b/src/parameters.c
index 0138501..c5845ff 100644
--- a/src/parameters.c
+++ b/src/parameters.c
@@ -1,6 +1,6 @@
/* Orage - Calendar and alarm handler
*
- * Copyright (c) 2006-2011 Juha Kautto (juha at xfce.org)
+ * Copyright (c) 2006-2013 Juha Kautto (juha at xfce.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -135,6 +135,11 @@ typedef struct _Itf
GSList *foreign_alarm_radiobutton_group;
GtkWidget *foreign_alarm_orage_radiobutton;
GtkWidget *foreign_alarm_notification_radiobutton;
+ /* day view week mode */
+ GtkWidget *dw_week_mode_frame;
+ GSList *dw_week_mode_radiobutton_group;
+ GtkWidget *dw_week_mode_week_radiobutton;
+ GtkWidget *dw_week_mode_day_radiobutton;
/***** the rest in all tabs *****/
GtkWidget *close_button;
@@ -418,6 +423,15 @@ static void foreign_alarm_changed(GtkWidget *dialog, gpointer user_data)
itf->foreign_alarm_notification_radiobutton));
}
+static void dw_week_mode_changed(GtkWidget *dialog, gpointer user_data)
+{
+ Itf *itf = (Itf *)user_data;
+
+ g_par.dw_week_mode =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
+ itf->dw_week_mode_week_radiobutton));
+}
+
static void sound_application_open_button_clicked(GtkButton *button
, gpointer user_data)
{
@@ -972,6 +986,43 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
g_signal_connect(G_OBJECT(dialog->foreign_alarm_notification_radiobutton)
, "toggled", G_CALLBACK(foreign_alarm_changed), dialog);
+
+ /***** Default start day in day view window *****/
+ dialog->dw_week_mode_radiobutton_group = NULL;
+ vbox = gtk_vbox_new(FALSE, 0);
+ dialog->dw_week_mode_frame = orage_create_framebox_with_content(
+ _("Day view window default first day"), vbox);
+ gtk_box_pack_start(GTK_BOX(dialog->extra_vbox)
+ , dialog->dw_week_mode_frame, FALSE, FALSE, 5);
+
+ dialog->dw_week_mode_week_radiobutton =
+ gtk_radio_button_new_with_mnemonic(NULL, _("First day of week"));
+ gtk_box_pack_start(GTK_BOX(vbox)
+ , dialog->dw_week_mode_week_radiobutton, FALSE, FALSE, 0);
+ gtk_radio_button_set_group(
+ GTK_RADIO_BUTTON(dialog->dw_week_mode_week_radiobutton)
+ , dialog->dw_week_mode_radiobutton_group);
+ dialog->dw_week_mode_radiobutton_group = gtk_radio_button_get_group(
+ GTK_RADIO_BUTTON(dialog->dw_week_mode_week_radiobutton));
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(dialog->dw_week_mode_week_radiobutton)
+ , g_par.dw_week_mode);
+
+ dialog->dw_week_mode_day_radiobutton =
+ gtk_radio_button_new_with_mnemonic(NULL, _("Selected day"));
+ gtk_box_pack_start(GTK_BOX(vbox)
+ , dialog->dw_week_mode_day_radiobutton, FALSE, FALSE, 0);
+ gtk_radio_button_set_group(
+ GTK_RADIO_BUTTON(dialog->dw_week_mode_day_radiobutton)
+ , dialog->dw_week_mode_radiobutton_group);
+ dialog->dw_week_mode_radiobutton_group = gtk_radio_button_get_group(
+ GTK_RADIO_BUTTON(dialog->dw_week_mode_day_radiobutton));
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(dialog->dw_week_mode_day_radiobutton)
+ , !g_par.dw_week_mode);
+
+ g_signal_connect(G_OBJECT(dialog->dw_week_mode_day_radiobutton)
+ , "toggled", G_CALLBACK(dw_week_mode_changed), dialog);
}
static Itf *create_parameter_dialog(void)
@@ -1156,6 +1207,11 @@ void read_parameters(void)
g_par.el_size_x = orage_rc_get_int(orc, "Eventlist window X", 500);
g_par.el_size_y = orage_rc_get_int(orc, "Eventlist window Y", 350);
g_par.el_days = orage_rc_get_int(orc, "Eventlist extra days", 0);
+ g_par.dw_pos_x = orage_rc_get_int(orc, "Dayview window pos X", 0);
+ g_par.dw_pos_y = orage_rc_get_int(orc, "Dayview window pos Y", 0);
+ g_par.dw_size_x = orage_rc_get_int(orc, "Dayview window X", 690);
+ g_par.dw_size_y = orage_rc_get_int(orc, "Dayview window Y", 390);
+ g_par.dw_week_mode = orage_rc_get_bool(orc, "Dayview week mode", TRUE);
g_par.show_menu = orage_rc_get_bool(orc, "Show Main Window Menu", TRUE);
g_par.select_always_today =
orage_rc_get_bool(orc, "Select Always Today", FALSE);
@@ -1250,6 +1306,11 @@ void write_parameters(void)
orage_rc_put_int(orc, "Eventlist window X", g_par.el_size_x);
orage_rc_put_int(orc, "Eventlist window Y", g_par.el_size_y);
orage_rc_put_int(orc, "Eventlist extra days", g_par.el_days);
+ orage_rc_put_int(orc, "Dayview window pos X", g_par.dw_pos_x);
+ orage_rc_put_int(orc, "Dayview window pos Y", g_par.dw_pos_y);
+ orage_rc_put_int(orc, "Dayview window X", g_par.dw_size_x);
+ orage_rc_put_int(orc, "Dayview window Y", g_par.dw_size_y);
+ orage_rc_put_bool(orc, "Dayview week mode", g_par.dw_week_mode);
orage_rc_put_bool(orc, "Show Main Window Menu", g_par.show_menu);
orage_rc_put_bool(orc, "Select Always Today"
, g_par.select_always_today);
diff --git a/src/parameters.h b/src/parameters.h
index 724e40e..ea66bea 100644
--- a/src/parameters.h
+++ b/src/parameters.h
@@ -112,6 +112,11 @@ typedef struct _parameters
gint el_size_x, el_size_y;
gint el_days;
+ /* day view window */
+ gint dw_pos_x, dw_pos_y;
+ gint dw_size_x, dw_size_y;
+ gboolean dw_week_mode;
+
/* show days window from main calendar */
gboolean show_days; /* true=show days false=show events */
More information about the Xfce4-commits
mailing list