From ce6c174542bd02a2adf9330bee9871064477d33d Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 8 Apr 2003 14:32:25 +0000 Subject: Remove button_ok, button_cancel, canceled members from struct Dialog. * gui/dialogs/alarm-options.c: Remove button_ok, button_cancel, canceled members from struct Dialog. (get_widgets): Do not initialize. (close_dialog): Destroy the toplevel. (toplevel_delete_event_cb): Removed. (button_cancel_clicked_cb): Removed. (button_ok_clicked_cb): Removed. (close_dialog): Removed. (alarm_options_dialog_run): Use gtk_dialog_run. (init_widgets): Do not init ->canceled, do not connect OK/Cancel buttons. (alarm_to_dialog): No need to make the file entry modal from here anymore. * gui/dialogs/alarm-options.glade: Turned into a GtkDialog. Set the "modal" property to True for the file entry. svn path=/trunk/; revision=20749 --- calendar/gui/dialogs/alarm-options.c | 75 +-- calendar/gui/dialogs/alarm-options.glade | 834 ++++++++++++++++--------------- 2 files changed, 430 insertions(+), 479 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/alarm-options.c b/calendar/gui/dialogs/alarm-options.c index e731f1c35c..c201e66979 100644 --- a/calendar/gui/dialogs/alarm-options.c +++ b/calendar/gui/dialogs/alarm-options.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -45,19 +46,12 @@ typedef struct { - /* Whether the dialog was accepted or canceled */ - gboolean canceled; - /* Glade XML data */ GladeXML *xml; /* Toplevel */ GtkWidget *toplevel; - /* Buttons */ - GtkWidget *button_ok; - GtkWidget *button_cancel; - /* Alarm repeat widgets */ gboolean repeat; GtkWidget *repeat_toggle; @@ -102,9 +96,6 @@ get_widgets (Dialog *dialog) dialog->toplevel = GW ("alarm-options-toplevel"); - dialog->button_ok = GW ("button-ok"); - dialog->button_cancel = GW ("button-cancel"); - dialog->repeat_toggle = GW ("repeat-toggle"); dialog->repeat_group = GW ("repeat-group"); dialog->repeat_quantity = GW ("repeat-quantity"); @@ -127,8 +118,6 @@ get_widgets (Dialog *dialog) dialog->palarm_args = GW ("palarm-args"); return (dialog->toplevel - && dialog->button_ok - && dialog->button_cancel && dialog->repeat_toggle && dialog->repeat_group && dialog->repeat_quantity @@ -196,44 +185,6 @@ setup_select_names (Dialog *dialog) return TRUE; } -/* Closes the dialog by terminating its main loop */ -static void -close_dialog (Dialog *dialog, gboolean canceled) -{ - dialog->canceled = canceled; - gtk_main_quit (); -} - -/* Callback used when the toplevel window is deleted */ -static guint -toplevel_delete_event_cb (GtkWidget *widget, GdkEventAny *event, gpointer data) -{ - Dialog *dialog; - - dialog = data; - close_dialog (dialog, TRUE); - return TRUE; -} - -/* Callback used when the OK button is clicked */ -static void -button_ok_clicked_cb (GtkWidget *button, gpointer data) -{ - Dialog *dialog; - - dialog = data; - close_dialog (dialog, FALSE); -} - -/* Callback used when the Cancel button is clicked */ -static void -button_cancel_clicked_cb (GtkWidget *button, gpointer data) -{ - Dialog *dialog; - - dialog = data; - close_dialog (dialog, TRUE); -} /* Callback used when the repeat toggle button is toggled. We sensitize the * repeat group options as appropriate. @@ -255,19 +206,6 @@ repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data) static void init_widgets (Dialog *dialog) { - /* Toplevel, buttons */ - - dialog->canceled = TRUE; - - g_signal_connect((dialog->toplevel), "delete_event", - G_CALLBACK (toplevel_delete_event_cb), dialog); - - g_signal_connect((dialog->button_ok), "clicked", - G_CALLBACK (button_ok_clicked_cb), dialog); - - g_signal_connect((dialog->button_cancel), "clicked", - G_CALLBACK (button_cancel_clicked_cb), dialog); - /* Alarm repeat */ g_signal_connect((dialog->repeat_toggle), "toggled", @@ -468,13 +406,9 @@ static void alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm) { CalAlarmAction action; - GnomeFileEntry *file_entry; alarm_to_repeat_widgets (dialog, alarm); - file_entry = glade_xml_get_widget (dialog->xml, "file-entry1"); - gnome_file_entry_set_modal (file_entry, TRUE); - cal_component_alarm_get_action (alarm, &action); switch (action) { @@ -783,6 +717,7 @@ gboolean alarm_options_dialog_run (CalComponentAlarm *alarm, const char *email, gboolean repeat) { Dialog dialog; + int response_id; g_return_val_if_fail (alarm != NULL, FALSE); @@ -808,10 +743,10 @@ alarm_options_dialog_run (CalComponentAlarm *alarm, const char *email, gboolean alarm_to_dialog (&dialog, alarm); - gtk_widget_show (dialog.toplevel); - gtk_main (); + response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); + gtk_widget_hide (dialog.toplevel); - if (!dialog.canceled) + if (response_id == GTK_RESPONSE_OK) dialog_to_alarm (&dialog, alarm); gtk_widget_destroy (dialog.toplevel); diff --git a/calendar/gui/dialogs/alarm-options.glade b/calendar/gui/dialogs/alarm-options.glade index 83f0af1f80..3393688be2 100644 --- a/calendar/gui/dialogs/alarm-options.glade +++ b/calendar/gui/dialogs/alarm-options.glade @@ -4,92 +4,91 @@ - - + + True + dialog1 GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE True True - False + True + True - - - 4 + + True False - 4 + 0 - - + + True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN + GTK_BUTTONBOX_END - - 4 + True - False - 4 + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + - - - True - True - True - Repeat the alarm - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 4 + True + False + 4 + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN - + + 4 True False 4 - + True True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 1 999 1 10 10 - - - 0 - True - True - - - - - - True - extra times every - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 + True + Repeat the alarm + True + GTK_RELIEF_NORMAL + False + False + True 0 @@ -99,58 +98,111 @@ - + True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 0 999 1 10 10 - - - 0 - True - True - - + False + 4 - - - True - True - 0 + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 1 999 1 10 10 + + + 0 + True + True + + - - + + True + extra times every + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + - - - True - minutes - True - - + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 0 999 1 10 10 + + + 0 + True + True + + - - - True - hours - True - - + + + True + True + 0 - - + + True - days - True + + + + True + minutes + True + + + + + + True + hours + True + + + + + + True + days + True + + + + 0 + False + False + @@ -160,60 +212,27 @@ + + + + + True + Alarm Repeat + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + - 0 - False - False + label_item - - - - - True - Alarm Repeat - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - - - - 0 - False - False - - - - - - False - 4 - - - - True - Message to Display - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - 0 False @@ -222,29 +241,62 @@ - - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + + False + 4 - + True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - + Message to Display + False + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + + 0 + False + False + + + + + + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + @@ -253,94 +305,119 @@ True - - - 0 - True - True - - - - - - False - 4 - - True - Play sound: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - + + False + 4 - - - True - 10 - False - False + + + True + Play sound: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + - - + + True - True - True - True - 0 - - True - * - False + 10 + False + True + + + + True + True + True + True + 0 + + True + * + False + + + + 0 + True + True + 0 - True - True + False + False - - - 0 - False - False - - - - - - True - False - 4 - + True False 4 - + True - True - Send To: - True - GTK_RELIEF_NORMAL + False + 4 + + + + True + True + Send To: + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + + + + + 0 + True + True + + + + + + True + Message to Send + False + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 0 @@ -350,29 +427,38 @@ - - - - - 0 - True - True - - + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT - - - True - Message to Send - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + + 0 @@ -382,104 +468,89 @@ - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT + + False + 4 + + + + True + Run program: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + - + True True True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 + True + 0 + True + * + False + + 0 + True + True + - - - 0 - True - True - - - - - 0 - False - False - - - - - - False - 4 - - - - True - Run program: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - True - True - True - True - 0 - - True - * - False - - - 0 - True - True - - + + + True + With these arguments: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + - - - True - With these arguments: - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + 0 @@ -487,66 +558,11 @@ False - - - - True - True - True - True - 0 - - True - * - False - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - GTK_BUTTONBOX_END - 30 - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - - 0 - False - False + True + True -- cgit v1.2.3