aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-01-19 22:14:56 +0800
committerMilan Crha <mcrha@src.gnome.org>2009-01-19 22:14:56 +0800
commitd63754acb1a37037ce09251c00fefa5e689f780b (patch)
treefd94473f060473b0918700d0e457b85903b6a3c5 /calendar/gui/dialogs
parent2be7cd3b2ab50047820da4a1e873785b53f41acd (diff)
downloadgsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.tar
gsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.tar.gz
gsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.tar.bz2
gsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.tar.lz
gsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.tar.xz
gsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.tar.zst
gsoc2013-evolution-d63754acb1a37037ce09251c00fefa5e689f780b.zip
** Part of fix for bug #260853
2009-01-19 Milan Crha <mcrha@redhat.com> ** Part of fix for bug #260853 * gui/calendar-config-keys.h: * gui/calendar-config.h: (calendar_config_get_ba_reminder), (calendar_config_set_ba_reminder): * gui/calendar-config.c: (calendar_config_get_ba_reminder), (calendar_config_set_ba_reminder), (string_to_units), (calendar_config_get_default_reminder_units): * gui/dialogs/cal-prefs-dialog.glade: * gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog): * gui/dialogs/cal-prefs-dialog.c: (ba_reminder_toggled), (ba_reminder_interval_changed), (ba_reminder_units_changed), (setup_changes), (show_config), (calendar_prefs_dialog_construct): User interface and related function to allow use change setup of the alarm for Birthdays and Anniversaries calendar. svn path=/trunk/; revision=37098
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c46
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade92
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h3
3 files changed, 141 insertions, 0 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 8cec102e4a..21ace5aea4 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -49,6 +49,7 @@ static const int hide_completed_units_map[] = {
CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1
};
+/* same is used for Birthdays & Anniversaries calendar */
static const int default_reminder_units_map[] = {
CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1
};
@@ -414,6 +415,34 @@ default_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
}
static void
+ba_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
+{
+ gboolean enabled = gtk_toggle_button_get_active (toggle);
+
+ calendar_config_set_ba_reminder (&enabled, NULL, NULL);
+}
+
+static void
+ba_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
+{
+ const gchar *str;
+ int value;
+
+ str = gtk_entry_get_text (GTK_ENTRY (widget));
+ value = (int) g_ascii_strtod (str, NULL);
+
+ calendar_config_set_ba_reminder (NULL, &value, NULL);
+}
+
+static void
+ba_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
+{
+ CalUnits units = e_dialog_combo_box_get (prefs->ba_reminder_units, default_reminder_units_map);
+
+ calendar_config_set_ba_reminder (NULL, NULL, &units);
+}
+
+static void
alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs)
{
ESourceList *source_list = prefs->alarms_list;
@@ -507,6 +536,11 @@ setup_changes (CalendarPrefsDialog *prefs)
G_CALLBACK (default_reminder_interval_changed), prefs);
g_signal_connect (G_OBJECT (prefs->default_reminder_units), "changed", G_CALLBACK (default_reminder_units_changed), prefs);
+ g_signal_connect (G_OBJECT (prefs->ba_reminder), "toggled", G_CALLBACK (ba_reminder_toggled), prefs);
+ g_signal_connect (G_OBJECT (prefs->ba_reminder_interval), "changed",
+ G_CALLBACK (ba_reminder_interval_changed), prefs);
+ g_signal_connect (G_OBJECT (prefs->ba_reminder_units), "changed", G_CALLBACK (ba_reminder_units_changed), prefs);
+
g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs);
@@ -600,6 +634,8 @@ show_config (CalendarPrefsDialog *prefs)
gboolean sensitive, set = FALSE;
icalcomponent *icalcomp, *dl_comp;
char *location;
+ CalUnits units;
+ int interval;
/* Timezone. */
location = calendar_config_get_timezone ();
@@ -678,6 +714,13 @@ show_config (CalendarPrefsDialog *prefs)
e_dialog_toggle_set (prefs->default_reminder, calendar_config_get_use_default_reminder ());
e_dialog_spin_set (prefs->default_reminder_interval, calendar_config_get_default_reminder_interval ());
e_dialog_combo_box_set (prefs->default_reminder_units, calendar_config_get_default_reminder_units (), default_reminder_units_map);
+
+ /* Birthdays & Anniversaries reminder */
+ set = calendar_config_get_ba_reminder (&interval, &units);
+
+ e_dialog_toggle_set (prefs->ba_reminder, set);
+ e_dialog_spin_set (prefs->ba_reminder_interval, interval);
+ e_dialog_combo_box_set (prefs->ba_reminder_units, units, default_reminder_units_map);
}
/* plugin meta-data */
@@ -759,6 +802,9 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
prefs->default_reminder = glade_xml_get_widget (gui, "default_reminder");
prefs->default_reminder_interval = glade_xml_get_widget (gui, "default_reminder_interval");
prefs->default_reminder_units = glade_xml_get_widget (gui, "default_reminder_units");
+ prefs->ba_reminder = glade_xml_get_widget (gui, "ba_reminder");
+ prefs->ba_reminder_interval = glade_xml_get_widget (gui, "ba_reminder_interval");
+ prefs->ba_reminder_units = glade_xml_get_widget (gui, "ba_reminder_units");
/* Display tab */
prefs->time_divisions = glade_xml_get_widget (gui, "time_divisions");
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade
index 9f7f6a8092..b8947b4c44 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -950,6 +950,98 @@ Days</property>
<property name="fill">True</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox25">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">4</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="ba_reminder">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show a _reminder</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="ba_reminder_interval">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 9999 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="ba_reminder_units">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Minutes
+Hours
+Days</property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="ba_reminder_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">before every anniversary/birthday</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 512d5d06c6..3c006b8711 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -56,6 +56,9 @@ struct _CalendarPrefsDialog {
GtkWidget *default_reminder;
GtkWidget *default_reminder_interval;
GtkWidget *default_reminder_units;
+ GtkWidget *ba_reminder;
+ GtkWidget *ba_reminder_interval;
+ GtkWidget *ba_reminder_units;
/* Display tab */
GtkWidget *time_divisions;