diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-04-08 22:32:25 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-04-08 22:32:25 +0800 |
commit | ce6c174542bd02a2adf9330bee9871064477d33d (patch) | |
tree | b720667936cf23d042576aaffb5e3754ee74ff8a /calendar/gui/dialogs/alarm-options.c | |
parent | 7a7bea488709da631d4e62af3288110f5e1db275 (diff) | |
download | gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.tar gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.tar.gz gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.tar.bz2 gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.tar.lz gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.tar.xz gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.tar.zst gsoc2013-evolution-ce6c174542bd02a2adf9330bee9871064477d33d.zip |
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
Diffstat (limited to 'calendar/gui/dialogs/alarm-options.c')
-rw-r--r-- | calendar/gui/dialogs/alarm-options.c | 75 |
1 files changed, 5 insertions, 70 deletions
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 <libgnome/gnome-i18n.h> #include <gtk/gtkmain.h> #include <gtk/gtkcheckbutton.h> +#include <gtk/gtkdialog.h> #include <gtk/gtksignal.h> #include <gtk/gtkwindow.h> #include <gtk/gtkhbox.h> @@ -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); |