From 460a3fb010bb5c636b823df67364e39addaf8078 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 12 Mar 2003 16:04:50 +0000 Subject: corrected button ordering and changed the return type to be a 2003-03-12 Rodrigo Moya * gui/dialogs/save-comp.[ch] (save_component_dialog): corrected button ordering and changed the return type to be a GtkResponseType. * gui/dialogs/comp-editor.c (prompt_to_save_changes): adapted to changes in save_component_dialog. svn path=/trunk/; revision=20261 --- calendar/gui/dialogs/comp-editor.c | 6 +++--- calendar/gui/dialogs/save-comp.c | 17 ++++++++++++----- calendar/gui/dialogs/save-comp.h | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index af97707f9e..27dd2ea8c2 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -402,7 +402,7 @@ prompt_to_save_changes (CompEditor *editor, gboolean send) return TRUE; switch (save_component_dialog (GTK_WINDOW (editor))) { - case 0: /* Save */ + case GTK_RESPONSE_YES: /* Save */ if (cal_component_is_instance (priv->comp)) if (!recur_component_dialog (priv->comp, &priv->mod, GTK_WINDOW (editor))) return FALSE; @@ -413,9 +413,9 @@ prompt_to_save_changes (CompEditor *editor, gboolean send) return TRUE; else return FALSE; - case 1: /* Discard */ + case GTK_RESPONSE_NO: /* Discard */ return TRUE; - case 2: /* Cancel */ + case GTK_RESPONSE_CANCEL: /* Cancel */ default: return FALSE; } diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c index 29701f92d7..899ff34ec2 100644 --- a/calendar/gui/dialogs/save-comp.c +++ b/calendar/gui/dialogs/save-comp.c @@ -39,23 +39,30 @@ * Pops up a dialog box asking the user whether he wants to save changes for * a calendar component. * - * Return value: TRUE if changes shold be saved, FALSE otherwise. + * Return value: the response_id of the button selected. **/ -gint +GtkResponseType save_component_dialog (GtkWindow *parent) { GtkWidget *dialog; + gint r; dialog = gnome_message_box_new (_("Do you want to save changes?"), GNOME_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, GNOME_STOCK_BUTTON_CANCEL, + GNOME_STOCK_BUTTON_NO, + GNOME_STOCK_BUTTON_YES, NULL); gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); gnome_dialog_grab_focus (GNOME_DIALOG (dialog), 0); gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent); - return gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + r = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + if (r == 1) + return GTK_RESPONSE_NO; + else if (r == 2) + return GTK_RESPONSE_YES; + + return GTK_RESPONSE_CANCEL; } diff --git a/calendar/gui/dialogs/save-comp.h b/calendar/gui/dialogs/save-comp.h index 7090464a4e..a9aedd2bce 100644 --- a/calendar/gui/dialogs/save-comp.h +++ b/calendar/gui/dialogs/save-comp.h @@ -22,8 +22,8 @@ #ifndef SAVE_COMP_H #define SAVE_COMP_H -#include +#include -gint save_component_dialog (GtkWindow *parent); +GtkResponseType save_component_dialog (GtkWindow *parent); #endif -- cgit v1.2.3