aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-08 19:24:00 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-08 19:24:00 +0800
commite9267e9f028e27cc1d3b4590291b5c5462054d1a (patch)
tree5f27a616ccbf2ba7444fd816f2f9cdee6512e48c /addressbook
parent768d77efa0ed6f6ac5780700cdae692422bf1613 (diff)
downloadgsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.tar
gsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.tar.gz
gsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.tar.bz2
gsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.tar.lz
gsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.tar.xz
gsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.tar.zst
gsoc2013-evolution-e9267e9f028e27cc1d3b4590291b5c5462054d1a.zip
port work.
2002-11-08 Chris Toshok <toshok@ximian.com> * gui/contact-editor/e-contact-editor-address.[ch]: port work. * gui/contact-editor/e-contact-editor-fullname.[ch]: port work. * gui/contact-editor/e-contact-editor.[ch]: port work. * gui/contact-editor/e-contact-quick-add.c: port work. * gui/contact-editor/e-contact-save-as.c: port work. svn path=/trunk/; revision=18667
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.c73
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.h22
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c66
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.h22
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c261
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h22
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c24
-rw-r--r--addressbook/gui/contact-editor/e-contact-save-as.c21
9 files changed, 245 insertions, 278 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index e09f0787a2..9e355b3632 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,17 @@
2002-11-08 Chris Toshok <toshok@ximian.com>
+ * gui/contact-editor/e-contact-editor-address.[ch]: port work.
+
+ * gui/contact-editor/e-contact-editor-fullname.[ch]: port work.
+
+ * gui/contact-editor/e-contact-editor.[ch]: port work.
+
+ * gui/contact-editor/e-contact-quick-add.c: port work.
+
+ * gui/contact-editor/e-contact-save-as.c: port work.
+
+2002-11-08 Chris Toshok <toshok@ximian.com>
+
* backend/ebook/e-book-util.c
(set_default_book_uri_from_config_db): prepend /apps/Evolution to
config db paths.
diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c
index 01d08df8fb..1c54b3c122 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-address.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-address.c
@@ -52,27 +52,26 @@ enum {
PROP_IS_READ_ONLY
};
-GtkType
+GType
e_contact_editor_address_get_type (void)
{
- static GtkType contact_editor_address_type = 0;
-
- if (!contact_editor_address_type)
- {
- static const GtkTypeInfo contact_editor_address_info =
- {
- "EContactEditorAddress",
- sizeof (EContactEditorAddress),
- sizeof (EContactEditorAddressClass),
- (GtkClassInitFunc) e_contact_editor_address_class_init,
- (GtkObjectInitFunc) e_contact_editor_address_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- contact_editor_address_type = gtk_type_unique (gtk_dialog_get_type (), &contact_editor_address_info);
- }
+ static GType contact_editor_address_type = 0;
+
+ if (!contact_editor_address_type) {
+ static const GTypeInfo contact_editor_address_info = {
+ sizeof (EContactEditorAddressClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) e_contact_editor_address_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EContactEditorAddress),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_contact_editor_address_init,
+ };
+
+ contact_editor_address_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorAddress", &contact_editor_address_info, 0);
+ }
return contact_editor_address_type;
}
@@ -84,7 +83,7 @@ e_contact_editor_address_class_init (EContactEditorAddressClass *klass)
object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (gtk_dialog_get_type ());
+ parent_class = g_type_class_ref (GTK_TYPE_DIALOG);
object_class->set_property = e_contact_editor_address_set_property;
object_class->get_property = e_contact_editor_address_get_property;
@@ -412,13 +411,10 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
GtkWidget *widget;
char *icon_path;
-#if 0
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
- GNOME_STOCK_BUTTON_OK);
-
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
- GNOME_STOCK_BUTTON_CANCEL);
-#endif
+ gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_address),
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE);
@@ -437,7 +433,7 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
widget = glade_xml_get_widget(gui, "table-checkaddress");
g_object_ref(widget);
gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0);
g_object_unref(widget);
icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png");
@@ -450,15 +446,21 @@ e_contact_editor_address_dispose (GObject *object)
{
EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object);
- if (e_contact_editor_address->gui)
+ if (e_contact_editor_address->gui) {
g_object_unref(e_contact_editor_address->gui);
- e_card_delivery_address_unref(e_contact_editor_address->address);
+ e_contact_editor_address->gui = NULL;
+ }
+
+ if (e_contact_editor_address->address) {
+ e_card_delivery_address_unref(e_contact_editor_address->address);
+ e_contact_editor_address->address = NULL;
+ }
}
GtkWidget*
e_contact_editor_address_new (const ECardDeliveryAddress *address)
{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_address_get_type ()));
+ GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_ADDRESS, NULL);
g_object_set (widget,
"address", address,
NULL);
@@ -537,9 +539,12 @@ e_contact_editor_address_get_property (GObject *object, guint prop_id,
static void
fill_in_field(EContactEditorAddress *editor, char *field, char *string)
{
- GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field));
- if (editable) {
- e_utf8_gtk_editable_set_text(editable, string);
+ GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
+ if (entry) {
+ if (string)
+ gtk_entry_set_text(entry, string);
+ else
+ gtk_entry_set_text(entry, "");
}
}
diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.h b/addressbook/gui/contact-editor/e-contact-editor-address.h
index b2b385ab47..7faab47a4f 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-address.h
+++ b/addressbook/gui/contact-editor/e-contact-editor-address.h
@@ -24,10 +24,7 @@
#include <glade/glade.h>
#include <ebook/e-card.h>
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
/* EContactEditorAddress - A dialog displaying information about a contact.
*
@@ -38,11 +35,11 @@ extern "C" {
* name ECardName * RW The card currently being edited. Returns a copy.
*/
-#define E_CONTACT_EDITOR_ADDRESS_TYPE (e_contact_editor_address_get_type ())
-#define E_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddress))
-#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddressClass))
-#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE))
-#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE))
+#define E_TYPE_CONTACT_EDITOR_ADDRESS (e_contact_editor_address_get_type ())
+#define E_CONTACT_EDITOR_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS, EContactEditorAddress))
+#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR_ADDRESS, EContactEditorAddressClass))
+#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS))
+#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS))
typedef struct _EContactEditorAddress EContactEditorAddress;
@@ -67,11 +64,8 @@ struct _EContactEditorAddressClass
GtkWidget *e_contact_editor_address_new(const ECardDeliveryAddress *name);
-GtkType e_contact_editor_address_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+GType e_contact_editor_address_get_type (void);
+G_END_DECLS
#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index dbd4b01efd..bf733b6af1 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -26,6 +26,7 @@
#include <libgnome/gnome-util.h>
#include <libgnome/gnome-i18n.h>
#include <gtk/gtkcombo.h>
+#include <gtk/gtkstock.h>
static void e_contact_editor_fullname_init (EContactEditorFullname *card);
static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass);
@@ -45,27 +46,26 @@ enum {
PROP_IS_READ_ONLY
};
-GtkType
+GType
e_contact_editor_fullname_get_type (void)
{
- static GtkType contact_editor_fullname_type = 0;
-
- if (!contact_editor_fullname_type)
- {
- static const GtkTypeInfo contact_editor_fullname_info =
- {
- "EContactEditorFullname",
- sizeof (EContactEditorFullname),
- sizeof (EContactEditorFullnameClass),
- (GtkClassInitFunc) e_contact_editor_fullname_class_init,
- (GtkObjectInitFunc) e_contact_editor_fullname_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- contact_editor_fullname_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_fullname_info);
- }
+ static GType contact_editor_fullname_type = 0;
+
+ if (!contact_editor_fullname_type) {
+ static const GTypeInfo contact_editor_fullname_info = {
+ sizeof (EContactEditorFullnameClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) e_contact_editor_fullname_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EContactEditorFullname),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_contact_editor_fullname_init,
+ };
+
+ contact_editor_fullname_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorFullname", &contact_editor_fullname_info, 0);
+ }
return contact_editor_fullname_type;
}
@@ -77,8 +77,7 @@ e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass)
object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
+ parent_class = g_type_class_ref (GTK_TYPE_DIALOG);
object_class->set_property = e_contact_editor_fullname_set_property;
object_class->get_property = e_contact_editor_fullname_get_property;
@@ -105,13 +104,10 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
GtkWidget *widget;
char *icon_path;
-#if 0
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
- GNOME_STOCK_BUTTON_OK);
-
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
- GNOME_STOCK_BUTTON_CANCEL);
-#endif
+ gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_fullname),
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE);
@@ -139,15 +135,21 @@ e_contact_editor_fullname_dispose (GObject *object)
{
EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object);
- if (e_contact_editor_fullname->gui)
+ if (e_contact_editor_fullname->gui) {
g_object_unref(e_contact_editor_fullname->gui);
- e_card_name_unref(e_contact_editor_fullname->name);
+ e_contact_editor_fullname->gui = NULL;
+ }
+
+ if (e_contact_editor_fullname->name) {
+ e_card_name_unref(e_contact_editor_fullname->name);
+ e_contact_editor_fullname->name = NULL;
+ }
}
GtkWidget*
e_contact_editor_fullname_new (const ECardName *name)
{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ()));
+ GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_FULLNAME, NULL);
g_object_set (widget,
"name", name,
NULL);
@@ -227,7 +229,7 @@ fill_in_field(EContactEditorFullname *editor, char *field, char *string)
GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
if (entry) {
if (string)
- e_utf8_gtk_entry_set_text(entry, string);
+ gtk_entry_set_text(entry, string);
else
gtk_entry_set_text(entry, "");
}
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.h b/addressbook/gui/contact-editor/e-contact-editor-fullname.h
index e1e6f85963..3c8e055a96 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.h
@@ -24,10 +24,7 @@
#include <glade/glade.h>
#include <ebook/e-card.h>
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
/* EContactEditorFullname - A dialog displaying information about a contact.
*
@@ -38,11 +35,11 @@ extern "C" {
* name ECardName * RW The card currently being edited. Returns a copy.
*/
-#define E_CONTACT_EDITOR_FULLNAME_TYPE (e_contact_editor_fullname_get_type ())
-#define E_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullname))
-#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullnameClass))
-#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE))
-#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE))
+#define E_TYPE_CONTACT_EDITOR_FULLNAME (e_contact_editor_fullname_get_type ())
+#define E_CONTACT_EDITOR_FULLNAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME, EContactEditorFullname))
+#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR_FULLNAME, EContactEditorFullnameClass))
+#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME))
+#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME))
typedef struct _EContactEditorFullname EContactEditorFullname;
@@ -67,11 +64,8 @@ struct _EContactEditorFullnameClass
GtkWidget *e_contact_editor_fullname_new(const ECardName *name);
-GtkType e_contact_editor_fullname_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+GType e_contact_editor_fullname_get_type (void);
+G_END_DECLS
#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 583a68d5e1..f9d541df45 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -27,9 +27,7 @@
#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkcheckmenuitem.h>
#include <gtk/gtkcombo.h>
-#define GTK_ENABLE_BROKEN
-#include <gtk/gtktext.h>
-#undef GTK_ENABLE_BROKEN
+#include <gtk/gtktextview.h>
#include <libgnomeui/gnome-popup-menu.h>
#include <libgnomeui/gnome-window-icon.h>
#include <libgnome/gnome-i18n.h>
@@ -116,29 +114,28 @@ enum {
static GSList *all_contact_editors = NULL;
-GtkType
+GType
e_contact_editor_get_type (void)
{
- static GtkType contact_editor_type = 0;
-
- if (!contact_editor_type)
- {
- static const GtkTypeInfo contact_editor_info =
- {
- "EContactEditor",
- sizeof (EContactEditor),
- sizeof (EContactEditorClass),
- (GtkClassInitFunc) e_contact_editor_class_init,
- (GtkObjectInitFunc) e_contact_editor_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
+ static GType contact_editor_type = 0;
+
+ if (!contact_editor_type) {
+ static const GTypeInfo contact_editor_info = {
+ sizeof (EContactEditorClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) e_contact_editor_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EContactEditor),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_contact_editor_init,
+ };
- contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info);
- }
+ contact_editor_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactEditor", &contact_editor_info, 0);
+ }
- return contact_editor_type;
+ return contact_editor_type;
}
static void
@@ -146,7 +143,7 @@ e_contact_editor_class_init (EContactEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (GTK_TYPE_OBJECT);
+ parent_class = g_type_class_ref (GTK_TYPE_OBJECT);
object_class->set_property = e_contact_editor_set_property;
object_class->get_property = e_contact_editor_get_property;
@@ -318,10 +315,10 @@ email_entry_changed (GtkWidget *widget, EContactEditor *editor)
}
static void
-address_text_changed (GtkWidget *widget, EContactEditor *editor)
+address_text_changed (GtkTextBuffer *buffer, EContactEditor *editor)
{
- GtkEditable *editable = GTK_EDITABLE(widget);
ECardAddrLabel *address;
+ GtkTextIter start_iter, end_iter;
if (editor->address_choice == -1)
return;
@@ -347,12 +344,15 @@ address_text_changed (GtkWidget *widget, EContactEditor *editor)
}
}
- address->data = e_utf8_gtk_editable_get_chars(editable, 0, -1);
+ gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter);
+ gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter);
+
+ address->data = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer), &start_iter, &end_iter, FALSE);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
e_card_address_label_unref(address);
- widget_changed (widget, editor);
+ widget_changed (NULL, editor);
}
@@ -370,7 +370,9 @@ address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
/* Mark the current address as the mailing address */
text = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT(text)) {
+ if (text && GTK_IS_TEXT_VIEW(text)) {
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+ GtkTextIter start_iter, end_iter;
address = e_card_address_label_new();
@@ -378,8 +380,12 @@ address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
address->flags |= E_CARD_ADDR_DEFAULT;
else
address->flags &= ~E_CARD_ADDR_DEFAULT;
- address->data = e_utf8_gtk_editable_get_chars(GTK_EDITABLE (text), 0, -1);
-
+
+ gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter);
+ gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter);
+
+ address->data = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
+
e_card_simple_set_address(editor->simple, editor->address_choice, address);
e_card_address_label_unref(address);
}
@@ -651,8 +657,9 @@ set_entry_changed_signals(EContactEditor *editor)
G_CALLBACK (email_entry_changed), editor);
}
widget = glade_xml_get_widget(editor->gui, "text-address");
- if (widget && GTK_IS_TEXT(widget)) {
- g_signal_connect(widget, "changed",
+ if (widget && GTK_IS_TEXT_VIEW(widget)) {
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
+ g_signal_connect(buffer, "changed",
G_CALLBACK (address_text_changed), editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-fullname");
@@ -721,8 +728,9 @@ set_entry_changed_signals(EContactEditor *editor)
G_CALLBACK (widget_changed), editor);
}
widget = glade_xml_get_widget(editor->gui, "text-comments");
- if (widget && GTK_IS_TEXT(widget)) {
- g_signal_connect (widget, "changed",
+ if (widget && GTK_IS_TEXT_VIEW(widget)) {
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
+ g_signal_connect (buffer, "changed",
G_CALLBACK (widget_changed), editor);
}
widget = glade_xml_get_widget(editor->gui, "dateedit-birthday");
@@ -779,7 +787,7 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
file_as_set_style(editor, style);
}
- g_object_unref(dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -810,9 +818,20 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
NULL);
address_widget = glade_xml_get_widget(editor->gui, "text-address");
- if (address_widget && GTK_IS_EDITABLE(address_widget)) {
+ 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);
- e_utf8_gtk_editable_set_text(GTK_EDITABLE(address_widget), string);
+
+ 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));
+
g_free(string);
} else {
ECardAddrLabel *address = e_card_delivery_address_to_label(new_address);
@@ -824,7 +843,7 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
e_card_delivery_address_unref(new_address);
}
- g_object_unref(dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -861,9 +880,9 @@ categories_clicked(GtkWidget *button, EContactEditor *editor)
NULL);
g_object_unref (ecml);
gtk_widget_show(GTK_WIDGET(dialog));
- result = gnome_dialog_run (dialog);
+ result = gtk_dialog_run (dialog);
g_free (categories);
- if (result == 0) {
+ if (result == GTK_RESPONSE_OK) {
g_object_get (dialog,
"categories", &categories,
NULL);
@@ -1107,17 +1126,19 @@ file_send_to_cb (GtkWidget *widget, gpointer data)
gboolean
e_contact_editor_confirm_delete(GtkWindow *parent)
{
- GnomeDialog *dialog;
+ GtkDialog *dialog;
GladeXML *gui;
int result;
gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL, NULL);
- dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog"));
+ dialog = GTK_DIALOG(glade_xml_get_widget(gui, "confirm-dialog"));
- gnome_dialog_set_parent(dialog, parent);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
- result = gnome_dialog_run_and_close(dialog);
+ result = gtk_dialog_run(dialog);
+
+ gtk_widget_hide (GTK_WIDGET (dialog));
g_object_unref(gui);
@@ -1447,50 +1468,74 @@ e_contact_editor_dispose (GObject *object) {
if (e_contact_editor->writable_fields) {
g_object_unref(e_contact_editor->writable_fields);
+ e_contact_editor->writable_fields = NULL;
}
if (e_contact_editor->email_list) {
g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL);
g_list_free(e_contact_editor->email_list);
+ e_contact_editor->email_list = NULL;
}
if (e_contact_editor->email_info) {
g_free(e_contact_editor->email_info);
+ e_contact_editor->email_info = NULL;
}
if (e_contact_editor->email_popup) {
g_object_unref(e_contact_editor->email_popup);
+ e_contact_editor->email_popup = NULL;
}
if (e_contact_editor->phone_list) {
g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL);
g_list_free(e_contact_editor->phone_list);
+ e_contact_editor->phone_list = NULL;
}
if (e_contact_editor->phone_info) {
g_free(e_contact_editor->phone_info);
+ e_contact_editor->phone_info = NULL;
}
if (e_contact_editor->phone_popup) {
g_object_unref(e_contact_editor->phone_popup);
+ e_contact_editor->phone_popup = NULL;
}
if (e_contact_editor->address_list) {
g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL);
g_list_free(e_contact_editor->address_list);
+ e_contact_editor->address_list = NULL;
}
if (e_contact_editor->address_info) {
g_free(e_contact_editor->address_info);
+ e_contact_editor->address_info = NULL;
}
if (e_contact_editor->address_popup) {
g_object_unref(e_contact_editor->address_popup);
+ e_contact_editor->address_popup = NULL;
}
- if (e_contact_editor->simple)
+ if (e_contact_editor->simple) {
g_object_unref(e_contact_editor->simple);
+ e_contact_editor->simple = NULL;
+ }
- if (e_contact_editor->book)
+ if (e_contact_editor->book) {
g_object_unref(e_contact_editor->book);
+ e_contact_editor->book = NULL;
+ }
- e_card_name_unref(e_contact_editor->name);
- g_free (e_contact_editor->company);
+ if (e_contact_editor->name) {
+ e_card_name_unref(e_contact_editor->name);
+ e_contact_editor->name = NULL;
+ }
- g_object_unref(e_contact_editor->gui);
+ if (e_contact_editor->company) {
+ g_free (e_contact_editor->company);
+ e_contact_editor->company = NULL;
+ }
+
+ if (e_contact_editor->gui) {
+ g_object_unref(e_contact_editor->gui);
+ e_contact_editor->gui = NULL;
+ }
}
static void
@@ -1548,7 +1593,7 @@ e_contact_editor_new (EBook *book,
g_return_val_if_fail (E_IS_BOOK (book), NULL);
g_return_val_if_fail (E_IS_CARD (card), NULL);
- ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE));
+ ce = g_object_new (E_TYPE_CONTACT_EDITOR, NULL);
all_contact_editors = g_slist_prepend (all_contact_editors, ce);
g_object_weak_ref (G_OBJECT (ce), contact_editor_destroy_notify, ce);
@@ -1859,93 +1904,6 @@ e_contact_editor_build_address_ui (EContactEditor *editor)
editor->address_popup = gnome_popup_menu_new(editor->address_info);
}
}
-#if 0
-static void
-_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor)
-{
- GtkWidget *label = g_object_get_data(G_OBJECT(dialog),
- "e_contact_editor_label");
-
- GtkWidget *dialog_entry = g_object_get_data(G_OBJECT(dialog),
- "e_contact_editor_dialog_entry");
-
- GList **list = g_object_get_data(G_OBJECT(dialog),
- "e_contact_editor_list");
- GList **info = g_object_get_data(G_OBJECT(dialog),
- "e_contact_editor_info");
- switch (button) {
- case 0:
- if (label && GTK_IS_LABEL(label)) {
- g_object_set (label,
- "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)),
- NULL);
- *list = g_list_append(*list, e_utf8_gtk_entry_get_text(GTK_ENTRY(dialog_entry)));
- g_free(*info);
- *info = NULL;
- }
- break;
- }
- gnome_dialog_close(GNOME_DIALOG(dialog));
-}
-
-static void
-_dialog_destroy(EContactEditor *editor, GtkWidget *dialog)
-{
- gnome_dialog_close(GNOME_DIALOG(dialog));
-}
-
-static GtkWidget *
-e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info)
-{
- GtkWidget *dialog_entry = gtk_entry_new();
- GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id);
- GtkWidget *label = glade_xml_get_widget(editor->gui, label_id);
-
- GtkWidget *dialog = gnome_dialog_new(title,
- NULL);
-
- gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox),
- gtk_widget_new (gtk_frame_get_type(),
- "border_width", 4,
- "label", title,
- "child", gtk_widget_new(gtk_alignment_get_type(),
- "child", dialog_entry,
- "xalign", .5,
- "yalign", .5,
- "xscale", 1.0,
- "yscale", 1.0,
- "border_width", 9,
- NULL),
- NULL));
-
- gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog),
- "Add",
- GNOME_STOCK_PIXMAP_ADD);
- gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL);
- gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
-
- g_signal_connect (dialog, "clicked",
- _dialog_clicked, editor);
- g_signal_connect_object(editor, "destroy",
- _dialog_destroy,
- G_OBJECT(dialog),
- G_CONNECT_SWAPPED);
-
- g_object_set_data(G_OBJECT(dialog),
- "e_contact_editor_entry", entry);
- gk_object_set_data(G_OBJECT(dialog),
- "e_contact_editor_label", label);
- g_object_set_data(G_OBJECT(dialog),
- "e_contact_editor_dialog_entry", dialog_entry);
- g_object_set_data(G_OBJECT(dialog),
- "e_contact_editor_list", list);
- g_object_set_data(G_OBJECT(dialog),
- "e_contact_editor_info", info);
-
- gtk_widget_show_all(dialog);
- return dialog;
-}
-#endif
static void
_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor)
@@ -2152,25 +2110,26 @@ set_address_field(EContactEditor *editor, int result)
text = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT(text)) {
- int position;
- GtkEditable *editable;
+ if (text && GTK_IS_TEXT_VIEW(text)) {
+ GtkTextView *text_view = GTK_TEXT_VIEW (text);
+ GtkTextBuffer *buffer;
+ GtkTextIter start_iter, end_iter;
const ECardAddrLabel *address;
if (result == -1)
result = editor->address_choice;
editor->address_choice = -1;
- position = 0;
- editable = GTK_EDITABLE(text);
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
+
+ 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_editable_delete_text(editable, 0, -1);
address = e_card_simple_get_address(editor->simple, result);
- if (address && address->data) {
- gchar *u = e_utf8_to_gtk_string ((GtkWidget *) editable, address->data);
- gtk_editable_insert_text(editable, u, strlen(u), &position);
- g_free (u);
- }
+ if (address && address->data)
+ gtk_text_buffer_insert (buffer, &start_iter, address->data, strlen (address->data));
check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress");
if (check && GTK_IS_CHECK_BUTTON (check)) {
@@ -2226,7 +2185,7 @@ add_field_callback(GtkWidget *widget, EContactEditor *editor)
if (!strcmp(name, builtins[i]))
return;
}
- if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT(widget)) {
+ if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT_VIEW(widget)) {
editor->arbitrary_fields = g_list_prepend(editor->arbitrary_fields, g_strdup(name));
}
}
@@ -2798,8 +2757,8 @@ enable_widget (GtkWidget *widget, gboolean enabled)
if (GTK_IS_ENTRY (widget)) {
gtk_entry_set_editable (GTK_ENTRY (widget), enabled);
}
- else if (GTK_IS_TEXT (widget)) {
- gtk_text_set_editable (GTK_TEXT (widget), enabled);
+ else if (GTK_IS_TEXT_VIEW (widget)) {
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), enabled);
}
else if (GTK_IS_COMBO (widget)) {
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (widget)->entry),
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index 0010182b99..eb3b294af8 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -30,10 +30,7 @@
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
/* EContactEditor - A dialog displaying information about a contact.
*
@@ -44,11 +41,11 @@ extern "C" {
* card ECard * RW The card currently being edited
*/
-#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ())
-#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor))
-#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass))
-#define E_IS_CONTACT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
-#define E_IS_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
+#define E_TYPE_CONTACT_EDITOR (e_contact_editor_get_type ())
+#define E_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR, EContactEditor))
+#define E_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR, EContactEditorClass))
+#define E_IS_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR))
+#define E_IS_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR))
typedef struct _EContactEditor EContactEditor;
@@ -121,7 +118,7 @@ EContactEditor *e_contact_editor_new (EBook *book,
ECard *card,
gboolean is_new_card,
gboolean editable);
-GtkType e_contact_editor_get_type (void);
+GType e_contact_editor_get_type (void);
void e_contact_editor_show (EContactEditor *editor);
void e_contact_editor_close (EContactEditor *editor);
@@ -131,9 +128,6 @@ gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
gboolean e_contact_editor_request_close_all (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
#endif /* __E_CONTACT_EDITOR_H__ */
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 64336abea2..715ab2bee1 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -237,13 +237,15 @@ edit_card (QuickAdd *qa)
}
}
+#define QUICK_ADD_RESPONSE_EDIT_FULL 2
+
static void
clicked_cb (GtkWidget *w, gint button, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
/* Get data out of entries. */
- if (button == 0 || button == 1) {
+ if (button == GTK_RESPONSE_OK || button == QUICK_ADD_RESPONSE_EDIT_FULL) {
gchar *name = NULL;
gchar *email = NULL;
@@ -270,12 +272,12 @@ clicked_cb (GtkWidget *w, gint button, gpointer closure)
gtk_widget_destroy (w);
- if (button == 0) {
+ if (button == GTK_RESPONSE_OK) {
/* OK */
quick_add_merge_card (qa);
- } else if (button == 1) {
+ } else if (button == QUICK_ADD_RESPONSE_EDIT_FULL) {
/* EDIT FULL */
edit_card (qa);
@@ -296,13 +298,15 @@ build_quick_add_dialog (QuickAdd *qa)
g_return_val_if_fail (qa != NULL, NULL);
- dialog = gnome_dialog_new (_("Contact Quick-Add"),
- GNOME_STOCK_BUTTON_OK,
- _("Edit Full"),
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
+ dialog = gtk_dialog_new_with_buttons (_("Contact Quick-Add"),
+ NULL, /* XXX */
+ (GtkDialogFlags) 0,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ _("Edit Full"), QUICK_ADD_RESPONSE_EDIT_FULL,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
- g_signal_connect (dialog, "clicked",
+ g_signal_connect (dialog, "reponse",
G_CALLBACK (clicked_cb), qa);
qa->name_entry = gtk_entry_new ();
@@ -335,7 +339,7 @@ build_quick_add_dialog (QuickAdd *qa)
1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
GTK_WIDGET (table),
TRUE, TRUE, 0);
gtk_widget_show_all (GTK_WIDGET (table));
diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c
index 2713cc6d21..d044332be1 100644
--- a/addressbook/gui/contact-editor/e-contact-save-as.c
+++ b/addressbook/gui/contact-editor/e-contact-save-as.c
@@ -26,7 +26,7 @@
#include <fcntl.h>
#include <gtk/gtkfilesel.h>
#include <gtk/gtksignal.h>
-#include <gtk/gtkdialog.h>
+#include <gtk/gtkmessagedialog.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
#include <libgnome/gnome-i18n.h>
@@ -64,12 +64,14 @@ save_it(GtkWidget *widget, SaveAsInfo *info)
GtkWidget *dialog;
char *str;
- str = g_strdup_printf ("Error saving %s: %s", filename, strerror(errno));
- dialog = gnome_message_box_new (str, GNOME_MESSAGE_BOX_ERROR, GNOME_STOCK_BUTTON_OK, NULL);
+ str = g_strdup_printf (_("Error saving %s: %s"), filename, strerror(errno));
+ dialog = gtk_message_dialog_new (GTK_WINDOW (info->filesel),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ str);
g_free (str);
- gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (info->filesel));
-
gtk_widget_show (dialog);
return;
@@ -205,14 +207,14 @@ e_contact_list_save_as(char *title, GList *list, GtkWindow *parent_window)
static int
file_exists(GtkFileSelection *filesel, const char *filename)
{
- GnomeDialog *dialog = NULL;
+ GtkDialog *dialog = NULL;
GtkWidget *label;
GladeXML *gui = NULL;
int result = 0;
char *string;
gui = glade_xml_new (EVOLUTION_GLADEDIR "/file-exists.glade", NULL, NULL);
- dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "dialog-exists"));
+ dialog = GTK_DIALOG(glade_xml_get_widget(gui, "dialog-exists"));
label = glade_xml_get_widget (gui, "label-exists");
if (GTK_IS_LABEL (label)) {
@@ -221,10 +223,11 @@ file_exists(GtkFileSelection *filesel, const char *filename)
g_free (string);
}
- gnome_dialog_set_parent(dialog, GTK_WINDOW(filesel));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(filesel));
gtk_widget_show (GTK_WIDGET (dialog));
- result = gnome_dialog_run_and_close(dialog);
+ result = gtk_dialog_run(dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
g_free(gui);