[Addressbook] Fix for #333855
"simon.zheng" <[email protected]>
| Newsgroups | gmane.comp.gnome.evolution.patches |
|---|---|
| Message-ID | <1141803668.16861.17.camel@fulltime> |
Hi, Bug 333855 – Fullname dialog in contacts editor shouldn't be modal as well as categories dialog. http://bugzilla.gnome.org/show_bug.cgi?id=333855 Sending patch for review. Thanks, -Simon _______________________________________________ Evolution-patches mailing list [email protected] http://mail.gnome.org/mailman/listinfo/evolution-patches
333855-fullname-dialog-modal.diff
(text/x-patch, 3.8 KB)
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v retrieving revision 1.2062 diff -u -p -r1.2062 ChangeLog --- ChangeLog 6 Mar 2006 10:59:03 -0000 1.2062 +++ ChangeLog 8 Mar 2006 06:36:43 -0000 @@ -1,3 +1,11 @@ +2006-03-08 Simon Zheng <[email protected]> + + Fix for bug #333855 + * gui/contact-editor/e-contact-editor.c (full_name_response), + (full_name_key_press_event), (full_name_editor_delete_event_cb), + (full_name_clicked): + The fullname dialog should be non-modal as well as categories dialog. + 2006-03-06 Devashish Sharma <[email protected]> * gui/contact-editor/e-contact-editor.c (fill_in_address_textview): Index: gui/contact-editor/e-contact-editor.c =================================================================== RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v retrieving revision 1.256 diff -u -p -r1.256 e-contact-editor.c --- gui/contact-editor/e-contact-editor.c 6 Mar 2006 10:59:02 -0000 1.256 +++ gui/contact-editor/e-contact-editor.c 8 Mar 2006 06:36:43 -0000 @@ -2551,6 +2551,8 @@ source_selected (GtkWidget *source_optio (EBookCallback) new_target_cb, editor); } +static GtkWidget *fullname_dialog = NULL; + static gboolean full_name_key_press_event( GtkWidget *widget, GdkEventKey *event, EContactEditor *editor) { @@ -2562,29 +2564,18 @@ full_name_key_press_event( GtkWidget *wi } static void -full_name_clicked (GtkWidget *button, EContactEditor *editor) +full_name_response (GtkDialog *dialog, int response, EContactEditor *editor) { - GtkDialog *dialog = GTK_DIALOG (e_contact_editor_fullname_new (editor->name)); - gboolean fullname_supported; - int result; + EContactName *name; + GtkWidget *fname_widget; + int style = 0; + gboolean editable = FALSE; - fullname_supported = is_field_supported (editor, E_CONTACT_FULL_NAME); - - g_object_set (dialog, - "editable", fullname_supported & editor->target_editable, + g_object_get (dialog, + "editable", &editable, NULL); - g_signal_connect (GTK_WIDGET (dialog), "key-press-event", G_CALLBACK (full_name_key_press_event), editor); - - gtk_widget_show (GTK_WIDGET(dialog)); - result = gtk_dialog_run (dialog); - gtk_widget_hide (GTK_WIDGET (dialog)); - - if (fullname_supported && editor->target_editable && result == GTK_RESPONSE_OK) { - EContactName *name; - GtkWidget *fname_widget; - int style = 0; - + if (editable && response == GTK_RESPONSE_OK) { g_object_get (dialog, "name", &name, NULL); @@ -2607,6 +2598,48 @@ full_name_clicked (GtkWidget *button, EC file_as_set_style(editor, style); } gtk_widget_destroy (GTK_WIDGET (dialog)); + fullname_dialog = NULL; +} + +static gint +full_name_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + if (widget) + if (GTK_IS_WIDGET (widget)) { + gtk_widget_destroy(widget); + fullname_dialog = NULL; + } + return TRUE; +} + +static void +full_name_clicked (GtkWidget *button, EContactEditor *editor) +{ + gboolean fullname_supported; + + if (fullname_dialog){ + gtk_widget_show (fullname_dialog); + return; + } + + fullname_dialog = e_contact_editor_fullname_new (editor->name); + + fullname_supported = is_field_supported (editor, E_CONTACT_FULL_NAME); + + g_object_set (fullname_dialog, + "editable", fullname_supported & editor->target_editable, + NULL); + + g_signal_connect (fullname_dialog, "key-press-event", G_CALLBACK (full_name_key_press_event), editor); + + g_signal_connect(fullname_dialog, "response", + G_CALLBACK (full_name_response), editor); + + /* Close the fullname dialog if the editor is closed */ + g_signal_connect_swapped (EAB_EDITOR (editor), "editor_closed", + G_CALLBACK (full_name_editor_delete_event_cb), fullname_dialog); + + gtk_widget_show (fullname_dialog); } static void