diff options
author | Chris Toshok <toshok@ximian.com> | 2003-05-15 06:00:45 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-05-15 06:00:45 +0800 |
commit | b9d38c709a95889a3dbc4993c0d7c488b6b0de85 (patch) | |
tree | 9d75a212bd0e3392aa25142b881ce689c022d36c /addressbook/gui | |
parent | 7535239b99706fbd3760c0e98deb34418123f6a7 (diff) | |
download | gsoc2013-evolution-b9d38c709a95889a3dbc4993c0d7c488b6b0de85.tar.gz gsoc2013-evolution-b9d38c709a95889a3dbc4993c0d7c488b6b0de85.tar.zst gsoc2013-evolution-b9d38c709a95889a3dbc4993c0d7c488b6b0de85.zip |
replace the text_buffer_delete/text_buffer_insert with
2003-05-14 Chris Toshok <toshok@ximian.com>
* gui/contact-editor/e-contact-editor.c (full_addr_clicked):
replace the text_buffer_delete/text_buffer_insert with
set_buffer_set_text. call widget_changed if they clicked OK, so
we actually mark the dialog changed.
(fill_in_field): make this handle GtkTextViews, because for some
reason that escapes rational thought GtkTextView's don't implement
GtkEditable. fixes #42606.
(extract_field): same.
svn path=/trunk/; revision=21184
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index bf83eeb012..8ecd2b6a08 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -784,17 +784,11 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor) address_widget = glade_xml_get_widget(editor->gui, "text-address"); if (address_widget && GTK_IS_TEXT_VIEW(address_widget)) { GtkTextBuffer *buffer; - GtkTextIter start_iter, end_iter; char *string = e_card_delivery_address_to_string(new_address); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (address_widget)); - gtk_text_buffer_get_start_iter (buffer, &start_iter); - gtk_text_buffer_get_end_iter (buffer, &end_iter); - - gtk_text_buffer_delete (buffer, &start_iter, &end_iter); - - gtk_text_buffer_insert (buffer, &start_iter, string, strlen (string)); + gtk_text_buffer_set_text (buffer, string, strlen (string)); g_free(string); } @@ -804,6 +798,8 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor) e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address); e_card_delivery_address_unref(new_address); + + widget_changed (NULL, editor); } gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -2137,10 +2133,17 @@ fill_in_field(EContactEditor *editor, char *id, char *value) { GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && E_IS_URL_ENTRY (widget)) - widget = e_url_entry_get_entry (E_URL_ENTRY (widget)); + if (!widget) + return; - if (widget && GTK_IS_EDITABLE(widget)) { + if (E_IS_URL_ENTRY (widget)) + widget = e_url_entry_get_entry (E_URL_ENTRY (widget)); + else if (GTK_IS_TEXT_VIEW (widget)) { + if (value) + gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), + value, strlen (value)); + } + else if (GTK_IS_EDITABLE(widget)) { int position = 0; GtkEditable *editable = GTK_EDITABLE(widget); gtk_editable_delete_text(editable, 0, -1); @@ -2164,6 +2167,7 @@ fill_in_single_field(EContactEditor *editor, char *name) { ECardSimple *simple = editor->simple; GtkWidget *widget = glade_xml_get_widget(editor->gui, name); + if (widget && GTK_IS_EDITABLE(widget)) { int position = 0; GtkEditable *editable = GTK_EDITABLE(widget); @@ -2506,25 +2510,37 @@ static void extract_field(EContactEditor *editor, ECard *card, char *editable_id, char *key) { GtkWidget *widget = glade_xml_get_widget(editor->gui, editable_id); + char *string = NULL; - if (widget && E_IS_URL_ENTRY (widget)) + if (!widget) + return; + + if (E_IS_URL_ENTRY (widget)) widget = e_url_entry_get_entry (E_URL_ENTRY (widget)); - if (widget && GTK_IS_EDITABLE (widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); + if (GTK_IS_EDITABLE (widget)) + string = gtk_editable_get_chars(GTK_EDITABLE (widget), 0, -1); + else if (GTK_IS_TEXT_VIEW (widget)) { + GtkTextIter start, end; + GtkTextBuffer *buffer; - if (string && *string) - g_object_set (card, - key, string, - NULL); - else - g_object_set (card, - key, NULL, - NULL); + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); + gtk_text_buffer_get_start_iter (buffer, &start); + gtk_text_buffer_get_end_iter (buffer, &end); - if (string) g_free(string); + string = gtk_text_buffer_get_text (buffer, &start, &end, TRUE); } + + if (string && *string) + g_object_set (card, + key, string, + NULL); + else + g_object_set (card, + key, NULL, + NULL); + + if (string) g_free(string); } static void |