diff options
author | Chris Toshok <toshok@ximian.com> | 2002-11-12 07:06:00 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-11-12 07:06:00 +0800 |
commit | a1a10f1ebef52168ec01c99f9f952cf13c099d54 (patch) | |
tree | d45b35a49fd99969e3dd145525229084ffba4a70 /addressbook/gui/contact-editor/e-contact-save-as.c | |
parent | e1e75fa38d0aac27008cf089cf99257cb83964ae (diff) | |
download | gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.gz gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.bz2 gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.lz gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.xz gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.zst gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.zip |
change around a little, still ifdefed though.
2002-11-11 Chris Toshok <toshok@ximian.com>
* gui/contact-editor/e-contact-editor.c (_arrow_pressed): change
around a little, still ifdefed though.
* gui/contact-editor/e-contact-save-as.c (file_exists): same.
(save_it): deal with the GtkDialog response ids.
* gui/contact-editor/e-contact-editor.c
(e_contact_editor_confirm_delete): just build the dialog here
(using gtk_message_dialog*).
* gui/contact-editor/Makefile.am (glade_DATA): remove
file-exists.glade and e-contact-editor-confirm-delete.glade.
svn path=/trunk/; revision=18712
Diffstat (limited to 'addressbook/gui/contact-editor/e-contact-save-as.c')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-save-as.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c index d044332be1..73651b9f21 100644 --- a/addressbook/gui/contact-editor/e-contact-save-as.c +++ b/addressbook/gui/contact-editor/e-contact-save-as.c @@ -34,7 +34,7 @@ #include <string.h> #include <libgnomeui/gnome-messagebox.h> -static int file_exists(GtkFileSelection *filesel, const char *filename); +static gint file_exists(GtkFileSelection *filesel, const char *filename); typedef struct { GtkFileSelection *filesel; @@ -54,10 +54,10 @@ save_it(GtkWidget *widget, SaveAsInfo *info) if (error == EEXIST) { response = file_exists(info->filesel, filename); switch (response) { - case 0 : /* Overwrite */ + case GTK_RESPONSE_ACCEPT : /* Overwrite */ e_write_file(filename, info->vcard, O_WRONLY | O_CREAT | O_TRUNC); break; - case 1 : /* cancel */ + case GTK_RESPONSE_REJECT : /* cancel */ return; } } else if (error != 0) { @@ -204,32 +204,24 @@ e_contact_list_save_as(char *title, GList *list, GtkWindow *parent_window) gtk_widget_show(GTK_WIDGET(filesel)); } -static int +static gint file_exists(GtkFileSelection *filesel, const char *filename) { - GtkDialog *dialog = NULL; - GtkWidget *label; - GladeXML *gui = NULL; - int result = 0; - char *string; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/file-exists.glade", NULL, NULL); - dialog = GTK_DIALOG(glade_xml_get_widget(gui, "dialog-exists")); - - label = glade_xml_get_widget (gui, "label-exists"); - if (GTK_IS_LABEL (label)) { - string = g_strdup_printf (_("%s already exists\nDo you want to overwrite it?"), filename); - gtk_label_set_text (GTK_LABEL (label), string); - g_free (string); - } - - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(filesel)); - - gtk_widget_show (GTK_WIDGET (dialog)); - result = gtk_dialog_run(dialog); - gtk_widget_destroy (GTK_WIDGET (dialog)); - - g_free(gui); - - return result; + GtkWidget *dialog; + gint response; + + dialog = gtk_message_dialog_new (GTK_WINDOW (filesel), + 0, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + _("%s already exists\nDo you want to overwrite it?"), filename); + + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + _("Overwrite"), GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, + NULL); + + response = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + return response; } |