diff options
-rw-r--r-- | e-util/ChangeLog | 13 | ||||
-rw-r--r-- | e-util/e-dialog-utils.h | 6 | ||||
-rw-r--r-- | e-util/e-request.c | 48 |
3 files changed, 43 insertions, 24 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 3a0896ab8a..05bb50c343 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,16 @@ +2003-01-27 Ettore Perazzoli <ettore@ximian.com> + + * e-request.c (e_request_string): Port to GtkDialog. Strdup the + text returned by GtkEntry after destroying the dialog, not before. + Use gtk_editable_select_region() instead of + gtk_entry_select_region(). Add a little bit of padding to make it + look less crampy and set a default width. + + * e-dialog-utils.h (e_gnome_dialog_set_parent): Declare only if + GNOME_DISABLE_DEPRECATED is not #defined. + (e_gnome_warning_dialog_parented): Likewise. + (e_gnome_ok_cancel_dialog_parented): Likewise. + 2003-01-26 Chris Toshok <toshok@ximian.com> * e-pilot-settings.c (e_pilot_settings_new): ref/sink the pilot diff --git a/e-util/e-dialog-utils.h b/e-util/e-dialog-utils.h index 275f8ec264..fbb32d8804 100644 --- a/e-util/e-dialog-utils.h +++ b/e-util/e-dialog-utils.h @@ -34,6 +34,10 @@ void e_set_dialog_parent (GtkWindow *dialog, GtkWidget *parent_widget); void e_set_dialog_parent_from_xid (GtkWindow *dialog, Window xid); + +/* FIXME These functions should go away completely at some point. */ + +#ifndef GNOME_DISABLE_DEPRECATED void e_gnome_dialog_set_parent (GnomeDialog *dialog, GtkWindow *parent); GtkWidget *e_gnome_warning_dialog_parented (const char *warning, @@ -42,6 +46,8 @@ GtkWidget *e_gnome_ok_cancel_dialog_parented (const char *message, GnomeReplyCallback callback, gpointer data, GtkWindow *parent); +#endif + char *e_file_dialog_save (const char *title); diff --git a/e-util/e-request.c b/e-util/e-request.c index 5cb85907f3..615a9fc69b 100644 --- a/e-util/e-request.c +++ b/e-util/e-request.c @@ -26,11 +26,11 @@ #include "e-request.h" -#include <libgnomeui/gnome-dialog.h> - -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> #include <gtk/gtkbox.h> +#include <gtk/gtkdialog.h> +#include <gtk/gtkentry.h> +#include <gtk/gtklabel.h> +#include <gtk/gtkstock.h> /** @@ -52,7 +52,7 @@ e_request_string (GtkWindow *parent, const char *default_string) { GtkWidget *prompt_label; - const char *text = NULL; + char *text; GtkWidget *dialog; GtkWidget *entry; GtkWidget *vbox; @@ -60,42 +60,42 @@ e_request_string (GtkWindow *parent, g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (prompt != NULL, NULL); - dialog = gnome_dialog_new (title, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); - - vbox = GNOME_DIALOG (dialog)->vbox; + dialog = gtk_dialog_new_with_buttons (title, parent, + GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + gtk_window_set_default_size (GTK_WINDOW (dialog), 275, -1); + + vbox = GTK_DIALOG (dialog)->vbox; prompt_label = gtk_label_new (prompt); - gtk_box_pack_start (GTK_BOX (vbox), prompt_label, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), prompt_label, TRUE, TRUE, 3); entry = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry), default_string); - gtk_entry_select_region (GTK_ENTRY (entry), 0, -1); - gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0); + gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); + gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 3); gtk_widget_grab_focus (entry); - gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE (entry)); gtk_widget_show (prompt_label); gtk_widget_show (entry); gtk_widget_show (dialog); - switch (gnome_dialog_run (GNOME_DIALOG (dialog))) { - case 0: - /* OK. */ - text = gtk_entry_get_text (GTK_ENTRY (entry)); + switch (gtk_dialog_run (GTK_DIALOG (dialog))) { + case GTK_RESPONSE_OK: + text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); break; - case -1: - case 1: - /* Cancel. */ + case GTK_RESPONSE_CANCEL: + text = NULL; break; default: g_assert_not_reached (); } - + gtk_widget_destroy (dialog); - return text ? g_strdup (text) : NULL; + return text; } |