aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-book-util.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-book-util.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-book-util.c')
-rw-r--r--addressbook/backend/ebook/e-book-util.c86
1 files changed, 41 insertions, 45 deletions
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index 06e2787f3e..a43416abbf 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -27,10 +27,8 @@
#include <config.h>
#include "e-book-util.h"
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
+#include <glib.h>
+#include <glib-object.h>
#include "e-card-compare.h"
typedef struct _CommonBookInfo CommonBookInfo;
@@ -55,7 +53,7 @@ e_book_expand_uri (const char *uri)
char *ret_val;
char *file_name;
- file_name = g_concat_dir_and_file(uri + offset, "addressbook.db");
+ file_name = g_build_path(uri + offset, "addressbook.db", NULL);
ret_val = g_strdup_printf("file://%s", file_name);
g_free(file_name);
return ret_val;
@@ -115,21 +113,23 @@ e_book_use_address_book_by_uri (const char *uri, EBookCommonCallback cb, gpointe
book = e_book_new ();
if (! e_book_load_address_book_by_uri (book, uri, got_uri_book_cb, info)) {
- gtk_object_unref (GTK_OBJECT (book));
+ g_object_unref (book);
g_free (info);
}
}
-Bonobo_ConfigDatabase
-e_book_get_config_database (CORBA_Environment *ev)
+#if PENDING_PORT_WORK
+EConfigListener *
+e_book_get_config_database ()
{
- static Bonobo_ConfigDatabase config_db;
+ static EConfigListener *config_db;
if (config_db == NULL)
- config_db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", ev);
+ config_db = e_config_listener_new ();
return config_db;
}
+#endif
static EBook *common_default_book = NULL;
@@ -144,7 +144,7 @@ got_default_book_cb (EBook *book, EBookStatus status, gpointer closure)
default book got loaded twice. */
if (common_default_book) {
- gtk_object_unref (GTK_OBJECT (book));
+ g_object_unref (book);
book = common_default_book;
}
@@ -181,7 +181,7 @@ e_book_use_default_book (EBookCommonCallback cb, gpointer closure)
book = e_book_new ();
if (! e_book_load_default_book (book, got_default_book_cb, info)) {
- gtk_object_unref (GTK_OBJECT (book));
+ g_object_unref (book);
g_free (info);
}
}
@@ -196,27 +196,27 @@ set_default_book_uri_local (void)
if (default_book_uri)
g_free (default_book_uri);
- filename = gnome_util_prepend_user_home ("evolution/local/Contacts/addressbook.db");
+ filename = g_build_filename (g_get_home_dir(),
+ "evolution/local/Contacts/addressbook.db");
default_book_uri = g_strdup_printf ("file://%s", filename);
g_free (filename);
}
static void
-set_default_book_uri_from_bonobo_conf (void)
+set_default_book_uri_from_config_db (void)
{
- CORBA_Environment ev;
+#if PENDING_PORT_WORK
char *val;
- Bonobo_ConfigDatabase config_db;
+ EConfigListener* config_db;
- CORBA_exception_init (&ev);
- config_db = e_book_get_config_database (&ev);
- val = bonobo_config_get_string (config_db, "/DefaultFolders/contacts_uri", &ev);
- CORBA_exception_free (&ev);
+ config_db = e_book_get_config_database ();
+ val = e_config_listener_get_string_with_default (config_db, "/DefaultFolders/contacts_uri", NULL, NULL);
if (val) {
default_book_uri = e_book_expand_uri (val);
g_free (val);
} else
+#endif
set_default_book_uri_local ();
}
@@ -279,7 +279,7 @@ char*
e_book_get_default_book_uri ()
{
if (!default_book_uri)
- set_default_book_uri_from_bonobo_conf ();
+ set_default_book_uri_from_config_db ();
return default_book_uri;
}
@@ -307,15 +307,15 @@ struct _SimpleQueryInfo {
static void
book_add_simple_query (EBook *book, SimpleQueryInfo *info)
{
- GList *pending = gtk_object_get_data (GTK_OBJECT (book), "sq_pending");
+ GList *pending = g_object_get_data (G_OBJECT(book), "sq_pending");
pending = g_list_prepend (pending, info);
- gtk_object_set_data (GTK_OBJECT (book), "sq_pending", pending);
+ g_object_set_data (G_OBJECT (book), "sq_pending", pending);
}
static SimpleQueryInfo *
book_lookup_simple_query (EBook *book, guint tag)
{
- GList *pending = gtk_object_get_data (GTK_OBJECT (book), "sq_pending");
+ GList *pending = g_object_get_data (G_OBJECT (book), "sq_pending");
while (pending) {
SimpleQueryInfo *sq = pending->data;
if (sq->tag == tag)
@@ -328,7 +328,7 @@ book_lookup_simple_query (EBook *book, guint tag)
static void
book_remove_simple_query (EBook *book, SimpleQueryInfo *info)
{
- GList *pending = gtk_object_get_data (GTK_OBJECT (book), "sq_pending");
+ GList *pending = g_object_get_data (G_OBJECT (book), "sq_pending");
GList *i;
for (i=pending; i != NULL; i = g_list_next (i)) {
@@ -338,17 +338,17 @@ book_remove_simple_query (EBook *book, SimpleQueryInfo *info)
break;
}
}
- gtk_object_set_data (GTK_OBJECT (book), "sq_pending", pending);
+ g_object_set_data (G_OBJECT (book), "sq_pending", pending);
}
static guint
book_issue_tag (EBook *book)
{
- gpointer ptr = gtk_object_get_data (GTK_OBJECT (book), "sq_tag");
+ gpointer ptr = g_object_get_data (G_OBJECT (book), "sq_tag");
guint tag = GPOINTER_TO_UINT (ptr);
if (tag == 0)
tag = 1;
- gtk_object_set_data (GTK_OBJECT (book), "sq_tag", GUINT_TO_POINTER (tag+1));
+ g_object_set_data (G_OBJECT (book), "sq_tag", GUINT_TO_POINTER (tag+1));
return tag;
}
@@ -359,7 +359,7 @@ simple_query_new (EBook *book, const char *query, EBookSimpleQueryCallback cb, g
sq->tag = book_issue_tag (book);
sq->book = book;
- gtk_object_ref (GTK_OBJECT (book));
+ g_object_ref (book);
sq->query = g_strdup (query);
sq->cb = cb;
sq->closure = closure;
@@ -375,17 +375,17 @@ static void
simple_query_disconnect (SimpleQueryInfo *sq)
{
if (sq->add_tag) {
- gtk_signal_disconnect (GTK_OBJECT (sq->view), sq->add_tag);
+ g_signal_handler_disconnect (sq->view, sq->add_tag);
sq->add_tag = 0;
}
if (sq->seq_complete_tag) {
- gtk_signal_disconnect (GTK_OBJECT (sq->view), sq->seq_complete_tag);
+ g_signal_handler_disconnect (sq->view, sq->seq_complete_tag);
sq->seq_complete_tag = 0;
}
if (sq->view) {
- gtk_object_unref (GTK_OBJECT (sq->view));
+ g_object_unref (sq->view);
sq->view = NULL;
}
}
@@ -401,9 +401,9 @@ simple_query_free (SimpleQueryInfo *sq)
g_free (sq->query);
if (sq->book)
- gtk_object_unref (GTK_OBJECT (sq->book));
+ g_object_unref (sq->book);
- g_list_foreach (sq->cards, (GFunc) gtk_object_unref, NULL);
+ g_list_foreach (sq->cards, (GFunc) g_object_unref, NULL);
g_list_free (sq->cards);
g_free (sq);
@@ -418,7 +418,7 @@ simple_query_card_added_cb (EBookView *view, const GList *cards, gpointer closur
return;
sq->cards = g_list_concat (sq->cards, g_list_copy ((GList *) cards));
- g_list_foreach ((GList *) cards, (GFunc) gtk_object_ref, NULL);
+ g_list_foreach ((GList *) cards, (GFunc) g_object_ref, NULL);
}
static void
@@ -452,16 +452,12 @@ simple_query_book_view_cb (EBook *book, EBookStatus status, EBookView *book_view
}
sq->view = book_view;
- gtk_object_ref (GTK_OBJECT (book_view));
-
- sq->add_tag = gtk_signal_connect (GTK_OBJECT (sq->view),
- "card_added",
- GTK_SIGNAL_FUNC (simple_query_card_added_cb),
- sq);
- sq->seq_complete_tag = gtk_signal_connect (GTK_OBJECT (sq->view),
- "sequence_complete",
- GTK_SIGNAL_FUNC (simple_query_sequence_complete_cb),
- sq);
+ g_object_ref (book_view);
+
+ sq->add_tag = g_signal_connect (sq->view, "card_added",
+ G_CALLBACK (simple_query_card_added_cb), sq);
+ sq->seq_complete_tag = g_signal_connect (sq->view, "sequence_complete",
+ G_CALLBACK (simple_query_sequence_complete_cb), sq);
}
guint