aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-07-15 02:46:05 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-07-15 02:46:05 +0800
commitea8b624e51eb2e1122d96e4eec0521e7fa719413 (patch)
tree126f79e5b9d23587aa3f8383cb647bae2d2d95f4 /calendar/gui
parentd4942420aee29ceba632ac87000933ce8aeb337b (diff)
downloadgsoc2013-evolution-ea8b624e51eb2e1122d96e4eec0521e7fa719413.tar.gz
gsoc2013-evolution-ea8b624e51eb2e1122d96e4eec0521e7fa719413.tar.zst
gsoc2013-evolution-ea8b624e51eb2e1122d96e4eec0521e7fa719413.zip
Fixes #41676
2003-07-14 Rodrigo Moya <rodrigo@ximian.com> Fixes #41676 * gui/dialogs/alarm-options.c (palarm_options_changed_cb, repeat_spin_button_changed_cb, repeat_unit_changed_cb): new callbacks for managing modifications in the 'Run a program' alarm case. (repeat_toggle_toggled_cb): if the alarm being edited has a procedure action, call palarm_options_changed_cb. (init_widgets): connect new callbacks. (alarm_to_dialog): disable 'OK' button if a procedure alarm. svn path=/trunk/; revision=21810
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/alarm-options.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/calendar/gui/dialogs/alarm-options.c b/calendar/gui/dialogs/alarm-options.c
index c201e66979..ef13b78b13 100644
--- a/calendar/gui/dialogs/alarm-options.c
+++ b/calendar/gui/dialogs/alarm-options.c
@@ -28,6 +28,7 @@
#include <gtk/gtkmain.h>
#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkdialog.h>
+#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkhbox.h>
@@ -49,6 +50,9 @@ typedef struct {
/* Glade XML data */
GladeXML *xml;
+ /* The alarm action selected */
+ CalAlarmAction action;
+
/* Toplevel */
GtkWidget *toplevel;
@@ -185,6 +189,18 @@ setup_select_names (Dialog *dialog)
return TRUE;
}
+static void
+palarm_options_changed_cb (GtkEditable *entry, gpointer user_data)
+{
+ const gchar *text;
+ Dialog *dialog = user_data;
+
+ text = gtk_entry_get_text (GTK_ENTRY (dialog->palarm_program));
+ if (text && *text)
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, TRUE);
+ else
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, FALSE);
+}
/* Callback used when the repeat toggle button is toggled. We sensitize the
* repeat group options as appropriate.
@@ -200,6 +216,29 @@ repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data)
active = gtk_toggle_button_get_active (toggle);
gtk_widget_set_sensitive (dialog->repeat_group, active);
+
+ /* activate the 'OK' button */
+ if (dialog->action == CAL_ALARM_PROCEDURE)
+ palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog);
+}
+
+static void
+repeat_spin_button_changed_cb (GtkWidget *spin, gpointer user_data)
+{
+ Dialog *dialog = user_data;
+
+ if (dialog->action == CAL_ALARM_PROCEDURE)
+ palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog);
+}
+
+
+static void
+repeat_unit_changed_cb (GtkWidget *option_menu, gpointer user_data)
+{
+ Dialog *dialog = user_data;
+
+ if (dialog->action == CAL_ALARM_PROCEDURE)
+ palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog);
}
/* Hooks the widget signals */
@@ -208,8 +247,16 @@ init_widgets (Dialog *dialog)
{
/* Alarm repeat */
- g_signal_connect((dialog->repeat_toggle), "toggled",
- G_CALLBACK (repeat_toggle_toggled_cb), dialog);
+ g_signal_connect (G_OBJECT (dialog->repeat_toggle), "toggled",
+ G_CALLBACK (repeat_toggle_toggled_cb), dialog);
+
+ g_signal_connect (G_OBJECT (dialog->repeat_quantity), "value_changed",
+ G_CALLBACK (repeat_spin_button_changed_cb), dialog);
+ g_signal_connect (G_OBJECT (dialog->repeat_value), "value_changed",
+ G_CALLBACK (repeat_spin_button_changed_cb), dialog);
+
+ g_signal_connect (G_OBJECT (dialog->repeat_unit), "changed",
+ G_CALLBACK (repeat_unit_changed_cb), dialog);
}
/* Fills the audio alarm widgets with the values from the alarm component */
@@ -400,7 +447,6 @@ alarm_to_repeat_widgets (Dialog *dialog, CalComponentAlarm *alarm)
e_dialog_option_menu_set (dialog->repeat_unit, units, duration_units_map);
}
-
/* Fills the widgets with the values from the alarm component */
static void
alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
@@ -450,6 +496,13 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
gtk_widget_hide (dialog->malarm_group);
gtk_widget_show (dialog->palarm_group);
alarm_to_palarm_widgets (dialog, alarm);
+
+ /* make sure the 'OK' button is disabled while the program entry is empty */
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, FALSE);
+ g_signal_connect (G_OBJECT (dialog->palarm_program), "changed",
+ G_CALLBACK (palarm_options_changed_cb), dialog);
+ g_signal_connect (G_OBJECT (dialog->palarm_args), "changed",
+ G_CALLBACK (palarm_options_changed_cb), dialog);
break;
case CAL_ALARM_UNKNOWN:
@@ -460,6 +513,8 @@ alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm)
g_assert_not_reached ();
return;
}
+
+ dialog->action = action;
}