From 7bf0bcfc8d1e681a02f820279a0621097ef0ff54 Mon Sep 17 00:00:00 2001 From: Jody Goldberg Date: Mon, 22 Apr 2002 21:34:39 +0000 Subject: [PATCH] tidy up. (choose_cat_cb) : reorder buttons to be hig compliant. 2002-04-22 Jody Goldberg * mime-edit-dialog.c (validate_data) : tidy up. (choose_cat_cb) : reorder buttons to be hig compliant. (mime_edit_dialog_init) : ditto. * service-edit-dialog.c (service_edit_dialog_init) : ditto. * mime-category-edit-dialog.c (mime_category_edit_dialog_init) : ditto. --- capplets/file-types/ChangeLog | 8 +++++ .../file-types/mime-category-edit-dialog.c | 2 +- capplets/file-types/mime-edit-dialog.c | 35 +++++++++---------- capplets/file-types/service-edit-dialog.c | 2 +- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/capplets/file-types/ChangeLog b/capplets/file-types/ChangeLog index 4de2586c1..a9dfb62a7 100644 --- a/capplets/file-types/ChangeLog +++ b/capplets/file-types/ChangeLog @@ -1,3 +1,11 @@ +2002-04-22 Jody Goldberg + + * mime-edit-dialog.c (validate_data) : tidy up. + (choose_cat_cb) : reorder buttons to be hig compliant. + (mime_edit_dialog_init) : ditto. + * service-edit-dialog.c (service_edit_dialog_init) : ditto. + * mime-category-edit-dialog.c (mime_category_edit_dialog_init) : ditto. + 2002-04-22 Jody Goldberg * service-edit-dialog.c (service_edit_dialog_set_prop) : set dialog diff --git a/capplets/file-types/mime-category-edit-dialog.c b/capplets/file-types/mime-category-edit-dialog.c index 68249c1bf..9019120e7 100644 --- a/capplets/file-types/mime-category-edit-dialog.c +++ b/capplets/file-types/mime-category-edit-dialog.c @@ -135,8 +135,8 @@ mime_category_edit_dialog_init (MimeCategoryEditDialog *dialog, MimeCategoryEdit dialog->p->dialog_win = gtk_dialog_new_with_buttons (_("Edit file category"), NULL, -1, - GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->p->dialog_win)->vbox), WID ("mime_category_edit_widget"), TRUE, TRUE, 0); diff --git a/capplets/file-types/mime-edit-dialog.c b/capplets/file-types/mime-edit-dialog.c index 821f2ffe1..dd786cb0d 100644 --- a/capplets/file-types/mime-edit-dialog.c +++ b/capplets/file-types/mime-edit-dialog.c @@ -165,8 +165,8 @@ mime_edit_dialog_init (MimeEditDialog *dialog, MimeEditDialogClass *class) dialog->p->dialog_win = gtk_dialog_new_with_buttons (_("Edit file type"), NULL, -1, - GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->p->dialog_win)->vbox), WID ("edit_widget"), TRUE, TRUE, 0); @@ -686,31 +686,30 @@ static gboolean validate_data (MimeEditDialog *dialog) { const gchar *tmp; - GtkWidget *err_dialog = NULL; + const gchar *mesg = NULL; tmp = gtk_entry_get_text (GTK_ENTRY (WID ("mime_type_entry"))); if (tmp != NULL && *tmp != '\0') { if (strchr (tmp, ' ') || !strchr (tmp, '/')) { - err_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog->p->dialog_win), - 0, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Invalid MIME type. Please enter a valid MIME type, or " - "leave the field blank to have one generated for you.")); - } - else if (dialog->p->is_add && (gnome_vfs_mime_type_is_known (tmp) || get_mime_type_info (tmp) != NULL)) { - err_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog->p->dialog_win), - 0, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("There already exists a MIME type of that name.")); + mesg = _("Invalid MIME type. Please enter a valid MIME type, or " + "leave the field blank to have one generated for you."); + } else if (dialog->p->is_add && (gnome_vfs_mime_type_is_known (tmp) || + get_mime_type_info (tmp) != NULL)) { + mesg = _("There already exists a MIME type of that name."); } } - if (err_dialog != NULL) { - gtk_window_set_modal (GTK_WINDOW (err_dialog), TRUE); + if (mesg != NULL) { + GtkWidget *err_dialog = gtk_message_dialog_new ( + GTK_WINDOW (dialog->p->dialog_win), + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + mesg); gtk_dialog_run (GTK_DIALOG (err_dialog)); - return FALSE; - } + gtk_object_destroy (GTK_OBJECT (err_dialog)); + return FALSE; + } return TRUE; } @@ -773,8 +772,8 @@ choose_cat_cb (MimeEditDialog *dialog) dialog_win = gtk_dialog_new_with_buttons (_("Choose a file category"), NULL, -1, - GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_widget_set_size_request (dialog_win, 300, 300); diff --git a/capplets/file-types/service-edit-dialog.c b/capplets/file-types/service-edit-dialog.c index 5910fafb6..07a637fed 100644 --- a/capplets/file-types/service-edit-dialog.c +++ b/capplets/file-types/service-edit-dialog.c @@ -133,8 +133,8 @@ service_edit_dialog_init (ServiceEditDialog *dialog, ServiceEditDialogClass *cla dialog->p->dialog_win = gtk_dialog_new_with_buttons (_("Edit service information"), NULL, -1, - GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->p->dialog_win)->vbox), WID ("service_edit_widget"), TRUE, TRUE, 0);