aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-destination.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-03 14:14:01 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-03 14:14:01 +0800
commitf54b808bf2b6c6649f33c062036a207fe152bdd8 (patch)
tree9e4f2e0a40597c4ea425ba60501f20f5403ed76f /addressbook/backend/ebook/e-destination.c
parent805e75e7d9315f8cb9f6a7213fc373a8a873a242 (diff)
downloadgsoc2013-evolution-f54b808bf2b6c6649f33c062036a207fe152bdd8.tar.gz
gsoc2013-evolution-f54b808bf2b6c6649f33c062036a207fe152bdd8.tar.zst
gsoc2013-evolution-f54b808bf2b6c6649f33c062036a207fe152bdd8.zip
just include glib.h instead of the gtk stuff.
2002-11-02 Chris Toshok <toshok@ximian.com> * backend/ebook/e-book-types.h: just include glib.h instead of the gtk stuff. * backend/ebook/e-book-listener.[ch]: convert to GObject/bonobo-activation/etc/etc. * e-book-util.[ch]: same. * e-book-view-listener.[ch]: same. * e-book-view.[ch]: same. * e-book.[ch]: same. * e-card-compare.[ch]: same. * e-card-cursor.[ch]: same. * e-card-simple.[ch]: same. * e-card.[ch]: same. * e-destination.[ch]: same. * evolution-ldif-importer.c: same. * evolution-vcard-importer.c: same. * load-gnomecard-addressbook.c: same. * load-pine-addressbok.c: same. * test-card.c: same. * test-client-list.c: same. * test-client.c: same. * backend/ebook/Makefile.am: add e-book-marshal.c to SOURCES, add e-book-marshal.[ch] to CLEANFILES, and add e-book-marshal.list to EXTRA_DIST. Also, remove the camel libs from the test LDADD's, and leave e-destination.[ch] out of the build. * backend/ebook/.cvsignore: ignore e-book-marshal.[ch] * backend/ebook/e-book-marshal.list: marshallers for e-book. svn path=/trunk/; revision=18505
Diffstat (limited to 'addressbook/backend/ebook/e-destination.c')
-rw-r--r--addressbook/backend/ebook/e-destination.c123
1 files changed, 59 insertions, 64 deletions
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 25932c29e6..1c85efa6fb 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -30,10 +30,6 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtkmain.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
#include "e-book.h"
#include "e-book-util.h"
#include <gal/widgets/e-unicode.h>
@@ -91,55 +87,52 @@ struct _EDestinationPrivate {
static void e_destination_clear_card (EDestination *);
static void e_destination_clear_strings (EDestination *);
-static GtkObjectClass *parent_class;
+static GObjectClass *parent_class;
static void
-e_destination_destroy (GtkObject *obj)
+e_destination_destroy (GObject *obj)
{
EDestination *dest = E_DESTINATION (obj);
e_destination_clear (dest);
if (dest->priv->old_card)
- gtk_object_unref (GTK_OBJECT (dest->priv->old_card));
+ g_object_unref (dest->priv->old_card);
if (dest->priv->cardify_book)
- gtk_object_unref (GTK_OBJECT (dest->priv->cardify_book));
+ g_object_unref (dest->priv->cardify_book);
g_free (dest->priv->old_textrep);
g_free (dest->priv);
-
- if (parent_class->destroy)
- parent_class->destroy (obj);
}
static void
e_destination_class_init (EDestinationClass *klass)
{
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (GTK_TYPE_OBJECT));
+ parent_class = g_type_class_ref (G_TYPE_OBJECT);
object_class->destroy = e_destination_destroy;
e_destination_signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EDestinationClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EDestinationClass, changed),
+ NULL, NULL,
+ e_book_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_destination_signals[CARDIFIED] =
- gtk_signal_new ("cardified",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EDestinationClass, cardified),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_destination_signals, LAST_SIGNAL);
+ g_signal_new ("cardified",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EDestinationClass, cardified),
+ NULL, NULL,
+ e_book_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
}
static void
@@ -153,23 +146,25 @@ e_destination_init (EDestination *dest)
dest->priv->pending_cardification = 0;
}
-GtkType
+GType
e_destination_get_type (void)
{
- static GtkType dest_type = 0;
+ static GType dest_type = 0;
if (!dest_type) {
- GtkTypeInfo dest_info = {
- "EDestination",
- sizeof (EDestination),
+ GTypeInfo dest_info = {
sizeof (EDestinationClass),
- (GtkClassInitFunc) e_destination_class_init,
- (GtkObjectInitFunc) e_destination_init,
- NULL, NULL, /* reserved */
- (GtkClassInitFunc) NULL
- };
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) e_destination_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EDestination),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_destination_init
- dest_type = gtk_type_unique (gtk_object_get_type (), &dest_info);
+ dest_type = g_type_register_static (G_TYPE_OBJECT, "EDestination", &dest_info, 0);
+ };
}
return dest_type;
@@ -178,7 +173,7 @@ e_destination_get_type (void)
EDestination *
e_destination_new (void)
{
- return E_DESTINATION (gtk_type_new (E_TYPE_DESTINATION));
+ return g_object_new (E_TYPE_DESTINATION, NULL);
}
static void
@@ -205,7 +200,7 @@ void
e_destination_changed (EDestination *dest)
{
if (dest->priv->freeze_count == 0) {
- gtk_signal_emit (GTK_OBJECT (dest), e_destination_signals[CHANGED]);
+ g_signal_emit (dest, e_destination_signals[CHANGED], 0);
dest->priv->pending_change = FALSE;
dest->priv->cannot_cardify = FALSE;
@@ -235,11 +230,11 @@ e_destination_copy (const EDestination *dest)
new_dest->priv->card = dest->priv->card;
if (new_dest->priv->card)
- gtk_object_ref (GTK_OBJECT (new_dest->priv->card));
+ g_object_ref (new_dest->priv->card);
new_dest->priv->old_card = dest->priv->old_card;
if (new_dest->priv->old_card)
- gtk_object_ref (GTK_OBJECT (new_dest->priv->old_card));
+ g_object_ref (new_dest->priv->old_card);
new_dest->priv->html_mail_override = dest->priv->html_mail_override;
new_dest->priv->wants_html_mail = dest->priv->wants_html_mail;
@@ -257,7 +252,7 @@ e_destination_clear_card (EDestination *dest)
{
if (dest->priv->card) {
if (dest->priv->old_card)
- gtk_object_unref (GTK_OBJECT (dest->priv->old_card));
+ g_object_unref (dest->priv->old_card);
dest->priv->old_card = dest->priv->card;
dest->priv->old_card_email_num = dest->priv->card_email_num;
@@ -274,7 +269,7 @@ e_destination_clear_card (EDestination *dest)
dest->priv->card = NULL;
dest->priv->card_email_num = -1;
- g_list_foreach (dest->priv->list_dests, (GFunc) gtk_object_unref, NULL);
+ g_list_foreach (dest->priv->list_dests, (GFunc) g_object_unref, NULL);
g_list_free (dest->priv->list_dests);
dest->priv->list_dests = NULL;
@@ -424,7 +419,7 @@ e_destination_set_card (EDestination *dest, ECard *card, gint email_num)
e_destination_clear (dest);
dest->priv->card = card;
- gtk_object_ref (GTK_OBJECT (dest->priv->card));
+ g_object_ref (dest->priv->card);
dest->priv->card_email_num = email_num;
@@ -448,7 +443,7 @@ e_destination_set_book_uri (EDestination *dest, const gchar *uri)
if (dest->priv->card) {
EBook *book = e_card_get_book (dest->priv->card);
if ((!book) || strcmp (uri, e_book_get_uri (book))) {
- gtk_object_unref (GTK_OBJECT (dest->priv->card));
+ g_object_unref (dest->priv->card);
dest->priv->card = NULL;
}
}
@@ -474,7 +469,7 @@ e_destination_set_card_uid (EDestination *dest, const gchar *uid, gint email_num
/* If we already have a card, remove it unless it's uri matches the one
we just set. */
if (dest->priv->card && strcmp (uid, e_card_get_id (dest->priv->card))) {
- gtk_object_unref (GTK_OBJECT (dest->priv->card));
+ g_object_unref (dest->priv->card);
dest->priv->card = NULL;
}
@@ -594,7 +589,7 @@ use_card_cb (ECard *card, gpointer closure)
if (card != NULL && uc->dest->priv->card == NULL) {
uc->dest->priv->card = card;
- gtk_object_ref (GTK_OBJECT (uc->dest->priv->card));
+ g_object_ref (uc->dest->priv->card);
e_destination_changed (uc->dest);
}
@@ -603,7 +598,7 @@ use_card_cb (ECard *card, gpointer closure)
}
/* We held a copy of the destination during the callback. */
- gtk_object_unref (GTK_OBJECT (uc->dest));
+ g_object_unref (uc->dest);
g_free (uc);
}
@@ -620,7 +615,7 @@ e_destination_use_card (EDestination *dest, EDestinationCardCallback cb, gpointe
uc->dest = dest;
/* Hold a reference to the destination during the callback. */
- gtk_object_ref (GTK_OBJECT (uc->dest));
+ g_object_ref (uc->dest);
uc->cb = cb;
uc->closure = closure;
e_card_load_uri (dest->priv->book_uri, dest->priv->card_uid, use_card_cb, uc);
@@ -940,13 +935,13 @@ static void
set_cardify_book (EDestination *dest, EBook *book)
{
if (dest->priv->cardify_book && dest->priv->cardify_book != book) {
- gtk_object_unref (GTK_OBJECT (dest->priv->cardify_book));
+ g_object_unref (dest->priv->cardify_book);
}
dest->priv->cardify_book = book;
if (book)
- gtk_object_ref (GTK_OBJECT (book));
+ g_object_ref (book);
}
static void
@@ -971,7 +966,7 @@ name_and_email_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, cons
dest->priv->has_been_cardified = TRUE;
e_destination_set_card (dest, card, email_num);
e_destination_set_book_uri (dest, book_uri);
- gtk_signal_emit (GTK_OBJECT (dest), e_destination_signals[CARDIFIED]);
+ g_signal_emit (dest, e_destination_signals[CARDIFIED], 0);
}
}
@@ -979,7 +974,7 @@ name_and_email_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, cons
dest->priv->cannot_cardify = TRUE;
}
- gtk_object_unref (GTK_OBJECT (dest)); /* drop the reference held by the query */
+ g_object_unref (dest); /* drop the reference held by the query */
}
@@ -997,9 +992,9 @@ nickname_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GLis
dest->priv->has_been_cardified = TRUE;
e_destination_set_card (dest, E_CARD (cards->data), 0); /* Uses primary e-mail by default. */
e_destination_set_book_uri (dest, book_uri);
- gtk_signal_emit (GTK_OBJECT (dest), e_destination_signals[CARDIFIED]);
+ g_signal_emit (dest, e_destination_signals[CARDIFIED], 0);
- gtk_object_unref (GTK_OBJECT (dest)); /* drop the reference held by the query */
+ g_object_unref (dest); /* drop the reference held by the query */
} else {
/* We can only end up here if we don't look at all like an e-mail address, so
@@ -1013,7 +1008,7 @@ nickname_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GLis
}
} else {
/* Something went wrong with the query: drop our ref to the destination and return. */
- gtk_object_unref (GTK_OBJECT (dest));
+ g_object_unref (dest);
}
}
@@ -1042,7 +1037,7 @@ use_default_book_cb (EBook *book, gpointer closure)
EDestination *dest = E_DESTINATION (closure);
if (dest->priv->cardify_book == NULL) {
dest->priv->cardify_book = book;
- gtk_object_ref (GTK_OBJECT (book));
+ g_object_ref (book);
}
launch_cardify_query (dest);
@@ -1107,7 +1102,7 @@ e_destination_cardify (EDestination *dest, EBook *book)
/* If we have a book ready, proceed. We hold a reference to ourselves
until our query is complete. */
- gtk_object_ref (GTK_OBJECT (dest));
+ g_object_ref (dest);
if (dest->priv->cardify_book != NULL) {
launch_cardify_query (dest);
} else {
@@ -1137,7 +1132,7 @@ e_destination_cardify_delayed (EDestination *dest, EBook *book, gint delay)
set_cardify_book (dest, book);
- dest->priv->pending_cardification = gtk_timeout_add (delay, do_cardify_delayed, dest);
+ dest->priv->pending_cardification = g_timeout_add (delay, do_cardify_delayed, dest);
}
void
@@ -1146,7 +1141,7 @@ e_destination_cancel_cardify (EDestination *dest)
g_return_if_fail (E_IS_DESTINATION (dest));
if (dest->priv->pending_cardification) {
- gtk_timeout_remove (dest->priv->pending_cardification);
+ g_source_remove (dest->priv->pending_cardification);
dest->priv->pending_cardification = 0;
}
}
@@ -1520,7 +1515,7 @@ e_destination_import (const gchar *str)
if (dest_doc && dest_doc->xmlRootNode) {
dest = e_destination_new ();
if (! e_destination_xml_decode (dest, dest_doc->xmlRootNode)) {
- gtk_object_unref (GTK_OBJECT (dest));
+ g_object_unref (dest);
dest = NULL;
}
}
@@ -1593,7 +1588,7 @@ e_destination_importv (const gchar *str)
if (e_destination_xml_decode (dest, node) && !e_destination_is_empty (dest)) {
g_ptr_array_add (dest_array, dest);
} else {
- gtk_object_unref (GTK_OBJECT (dest));
+ g_object_unref (dest);
}
node = node->next;
@@ -1648,7 +1643,7 @@ e_destination_freev (EDestination **destv)
if (destv) {
for (i = 0; destv[i] != NULL; ++i) {
- gtk_object_unref (GTK_OBJECT (destv[i]));
+ g_object_unref (destv[i]);
}
g_free (destv);
}