From 83223a05bc7e8657a9b6c2fe8638c3e59ea99cd7 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 7 Mar 2002 20:53:43 +0000 Subject: set initial focus to editor (do_exit): use hasUndo to avoid question 2002-03-07 Radek Doulik * mail-signature-editor.c (mail_signature_editor): set initial focus to editor (do_exit): use hasUndo to avoid question dialog when content is unchanged svn path=/trunk/; revision=15970 --- mail/ChangeLog | 7 +++++++ mail/mail-signature-editor.c | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 576ff81b2e..d81d4567be 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2002-03-07 Radek Doulik + + * mail-signature-editor.c (mail_signature_editor): set initial + focus to editor + (do_exit): use hasUndo to avoid question dialog when content is + unchanged + 2002-03-07 Dan Winship * component-factory.c (add_storage): Update for storage changes: diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c index 4a962bf872..9d06dd9095 100644 --- a/mail/mail-signature-editor.c +++ b/mail/mail-signature-editor.c @@ -17,7 +17,8 @@ struct _ESignatureEditor { gchar *filename; gboolean html; - gboolean has_changed; + + GNOME_GtkHTML_Editor_Engine engine; }; typedef struct _ESignatureEditor ESignatureEditor; @@ -111,7 +112,10 @@ exit_dialog_cb (int reply, ESignatureEditor *editor) static void do_exit (ESignatureEditor *editor) { - if (editor->has_changed) { + CORBA_Environment ev; + + CORBA_exception_init (&ev); + if (GNOME_GtkHTML_Editor_Engine_hasUndo (editor->engine, &ev)) { GtkWidget *dialog; GtkWidget *label; gint button; @@ -133,6 +137,7 @@ do_exit (ESignatureEditor *editor) exit_dialog_cb (button, editor); } else destroy_editor (editor); + CORBA_exception_free (&ev); } static int @@ -224,6 +229,7 @@ load_signature (ESignatureEditor *editor) void mail_signature_editor (const gchar *filename, gboolean html) { + CORBA_Environment ev; ESignatureEditor *editor; BonoboUIComponent *component; BonoboUIContainer *container; @@ -236,7 +242,6 @@ mail_signature_editor (const gchar *filename, gboolean html) editor->html = html; editor->filename = g_strdup (filename); - editor->has_changed = TRUE; title = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename); editor->win = bonobo_window_new ("e-sig-editor", title); @@ -262,6 +267,9 @@ mail_signature_editor (const gchar *filename, gboolean html) destroy_editor (editor); return; } + + editor->engine = (GNOME_GtkHTML_Editor_Engine) bonobo_object_client_query_interface + (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", NULL); load_signature (editor); @@ -272,5 +280,8 @@ mail_signature_editor (const gchar *filename, gboolean html) bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL); gtk_widget_show (GTK_WIDGET (editor->win)); gtk_widget_show (GTK_WIDGET (editor->control)); - gtk_widget_grab_focus (editor->control); + + CORBA_exception_init (&ev); + GNOME_GtkHTML_Editor_Engine_runCommand (editor->engine, "grab-focus", &ev); + CORBA_exception_free (&ev); } -- cgit v1.2.3