From 8cb514d6dd9497893a35a089d07a132d51263ee7 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Thu, 10 Aug 2000 17:30:50 +0000 Subject: Merge with camel-async. svn path=/trunk/; revision=4687 --- camel/providers/nntp/Makefile.am | 5 ++- camel/providers/nntp/camel-nntp-folder.c | 52 ++++++++++++------------------ camel/providers/nntp/camel-nntp-folder.h | 11 +++---- camel/providers/nntp/camel-nntp-provider.c | 7 ++-- camel/providers/nntp/camel-nntp-store.c | 46 +++++++++++--------------- camel/providers/nntp/camel-nntp-store.h | 11 +++---- 6 files changed, 55 insertions(+), 77 deletions(-) (limited to 'camel/providers/nntp') diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am index 247dffbfd4..4b7c385872 100644 --- a/camel/providers/nntp/Makefile.am +++ b/camel/providers/nntp/Makefile.am @@ -7,15 +7,14 @@ providerdir = $(pkglibdir)/camel-providers/$(VERSION) provider_LTLIBRARIES = libcamelnntp.la provider_DATA = libcamelnntp.urls -INCLUDES = -I.. \ - -I$(srcdir)/.. \ +INCLUDES = -I../.. \ -I$(top_srcdir)/camel \ -I$(top_srcdir)/intl \ -I$(top_srcdir)/libibex \ -I$(top_srcdir)/e-util \ -I$(top_srcdir) \ -I$(includedir) \ - $(GTK_INCLUDEDIR) \ + $(GTK_INCLUDEDIR) \ -DG_LOG_DOMAIN=\"camel-nntp-provider\" libcamelnntp_la_SOURCES = \ diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index dae572136e..5beabb5587 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -52,9 +52,9 @@ static CamelFolderClass *parent_class=NULL; /* Returns the class for a CamelNNTPFolder */ -#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (GTK_OBJECT(so)->klass) -#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) -#define CNNTPS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass) +#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CNNTPS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) static void @@ -270,21 +270,21 @@ nntp_folder_get_message (CamelFolder *folder, const gchar *uid, CamelException * message = camel_mime_message_new (); if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)message, message_stream) == -1) { - gtk_object_unref (GTK_OBJECT (message)); - gtk_object_unref (GTK_OBJECT (message_stream)); + camel_object_unref (CAMEL_OBJECT (message)); + camel_object_unref (CAMEL_OBJECT (message_stream)); camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, /* XXX */ "Could not create message for message_id %s.", message_id); return NULL; } - gtk_object_unref (GTK_OBJECT (message_stream)); + camel_object_unref (CAMEL_OBJECT (message_stream)); /* init other fields? */ - gtk_object_ref (GTK_OBJECT (folder)); + camel_object_ref (CAMEL_OBJECT (folder)); #if 0 - gtk_signal_connect (GTK_OBJECT (message), "message_changed", message_changed, folder); + gtk_signal_connect (CAMEL_OBJECT (message), "message_changed", message_changed, folder); #endif return message; @@ -356,22 +356,19 @@ nntp_folder_get_message_info (CamelFolder *folder, const char *uid) } static void -nntp_folder_finalize (GtkObject *object) +nntp_folder_finalize (CamelObject *object) { CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (object); g_free (nntp_folder->summary_file_path); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); } static void camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class) { CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_nntp_folder_class); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class); - parent_class = gtk_type_class (camel_folder_get_type ()); + parent_class = CAMEL_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_folder_get_type ())); /* virtual method definition */ @@ -393,30 +390,21 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class) camel_folder_class->free_subfolder_names = nntp_folder_free_subfolder_names; camel_folder_class->search_by_expression = nntp_folder_search_by_expression; camel_folder_class->get_message_info = nntp_folder_get_message_info; - - gtk_object_class->finalize = nntp_folder_finalize; - } -GtkType +CamelType camel_nntp_folder_get_type (void) { - static GtkType camel_nntp_folder_type = 0; + static CamelType camel_nntp_folder_type = CAMEL_INVALID_TYPE; - if (!camel_nntp_folder_type) { - GtkTypeInfo camel_nntp_folder_info = - { - "CamelNNTPFolder", - sizeof (CamelNNTPFolder), - sizeof (CamelNNTPFolderClass), - (GtkClassInitFunc) camel_nntp_folder_class_init, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_nntp_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_nntp_folder_info); + if (camel_nntp_folder_type == CAMEL_INVALID_TYPE) { + camel_nntp_folder_type = camel_type_register (CAMEL_FOLDER_TYPE, "CamelNNTPFolder", + sizeof (CamelNNTPFolder), + sizeof (CamelNNTPFolderClass), + (CamelObjectClassInitFunc) camel_nntp_folder_class_init, + NULL, + (CamelObjectInitFunc) NULL, + (CamelObjectFinalizeFunc) nntp_folder_finalize); } return camel_nntp_folder_type; diff --git a/camel/providers/nntp/camel-nntp-folder.h b/camel/providers/nntp/camel-nntp-folder.h index f6c04bb005..9bbd1466b9 100644 --- a/camel/providers/nntp/camel-nntp-folder.h +++ b/camel/providers/nntp/camel-nntp-folder.h @@ -33,15 +33,14 @@ extern "C" { #pragma } #endif /* __cplusplus }*/ -#include #include "camel-folder.h" /* #include "camel-store.h" */ #define CAMEL_NNTP_FOLDER_TYPE (camel_nntp_folder_get_type ()) -#define CAMEL_NNTP_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolder)) -#define CAMEL_NNTP_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolderClass)) -#define IS_CAMEL_NNTP_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_NNTP_FOLDER_TYPE)) +#define CAMEL_NNTP_FOLDER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolder)) +#define CAMEL_NNTP_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_NNTP_FOLDER_TYPE, CamelNNTPFolderClass)) +#define IS_CAMEL_NNTP_FOLDER(o) (CAMEL_CHECK_TYPE((o), CAMEL_NNTP_FOLDER_TYPE)) typedef struct { @@ -64,8 +63,8 @@ typedef struct { /* public methods */ -/* Standard Gtk function */ -GtkType camel_nntp_folder_get_type (void); +/* Standard Camel function */ +CamelType camel_nntp_folder_get_type (void); #ifdef __cplusplus } diff --git a/camel/providers/nntp/camel-nntp-provider.c b/camel/providers/nntp/camel-nntp-provider.c index 8badba0e9c..214fd4b0fa 100644 --- a/camel/providers/nntp/camel-nntp-provider.c +++ b/camel/providers/nntp/camel-nntp-provider.c @@ -68,10 +68,13 @@ camel_provider_module_init (CamelSession *session) nntp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_nntp_transport_get_type(); #endif - + news_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); nntp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); - + camel_session_register_provider (session, &news_provider); camel_session_register_provider (session, &nntp_provider); } + + + diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index a7b8f7df01..48537ed2b3 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -51,9 +51,9 @@ static CamelServiceClass *service_class = NULL; /* Returns the class for a CamelNNTPStore */ -#define CNNTPS_CLASS(so) CAMEL_NNTP_STORE_CLASS (GTK_OBJECT(so)->klass) -#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) -#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (GTK_OBJECT(so)->klass) +#define CNNTPS_CLASS(so) CAMEL_NNTP_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) +#define CNNTPF_CLASS(so) CAMEL_NNTP_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so)) static gboolean ensure_news_dir_exists (CamelNNTPStore *store); @@ -134,8 +134,8 @@ nntp_store_disconnect (CamelService *service, CamelException *ex) if (!service_class->disconnect (service, ex)) return FALSE; - gtk_object_unref (GTK_OBJECT (store->ostream)); - gtk_object_unref (GTK_OBJECT (store->istream)); + camel_object_unref (CAMEL_OBJECT (store->ostream)); + camel_object_unref (CAMEL_OBJECT (store->istream)); store->ostream = NULL; store->istream = NULL; return TRUE; @@ -165,7 +165,7 @@ nntp_store_get_folder (CamelStore *store, const gchar *folder_name, /* call the standard routine for that when */ /* it is done ... */ - new_nntp_folder = gtk_type_new (CAMEL_NNTP_FOLDER_TYPE); + new_nntp_folder = CAMEL_NNTP_FOLDER (camel_object_new (CAMEL_NNTP_FOLDER_TYPE)); new_folder = CAMEL_FOLDER (new_nntp_folder); /* XXX We shouldn't be passing NULL here, but it's equivalent to @@ -186,7 +186,7 @@ nntp_store_get_folder_name (CamelStore *store, const char *folder_name, } static void -finalize (GtkObject *object) +finalize (CamelObject *object) { CamelException ex; @@ -198,16 +198,12 @@ finalize (GtkObject *object) static void camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class) { - GtkObjectClass *object_class = - GTK_OBJECT_CLASS (camel_nntp_store_class); CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_nntp_store_class); CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS (camel_nntp_store_class); - service_class = gtk_type_class (camel_service_get_type ()); + service_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ())); /* virtual method overload */ - object_class->finalize = finalize; - camel_service_class->connect = nntp_store_connect; camel_service_class->disconnect = nntp_store_disconnect; camel_service_class->get_name = nntp_store_get_name; @@ -226,25 +222,19 @@ camel_nntp_store_init (gpointer object, gpointer klass) service->url_flags = CAMEL_SERVICE_URL_NEED_HOST; } -GtkType +CamelType camel_nntp_store_get_type (void) { - static GtkType camel_nntp_store_type = 0; + static CamelType camel_nntp_store_type = CAMEL_INVALID_TYPE; - if (!camel_nntp_store_type) { - GtkTypeInfo camel_nntp_store_info = - { - "CamelNNTPStore", - sizeof (CamelNNTPStore), - sizeof (CamelNNTPStoreClass), - (GtkClassInitFunc) camel_nntp_store_class_init, - (GtkObjectInitFunc) camel_nntp_store_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_nntp_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_nntp_store_info); + if (camel_nntp_store_type == CAMEL_INVALID_TYPE) { + camel_nntp_store_type = camel_type_register (CAMEL_STORE_TYPE, "CamelNNTPStore", + sizeof (CamelNNTPStore), + sizeof (CamelNNTPStoreClass), + (CamelObjectClassInitFunc) camel_nntp_store_class_init, + NULL, + (CamelObjectInitFunc) camel_nntp_store_init, + (CamelObjectFinalizeFunc) finalize); } return camel_nntp_store_type; diff --git a/camel/providers/nntp/camel-nntp-store.h b/camel/providers/nntp/camel-nntp-store.h index 9d4d6edebc..3099f84962 100644 --- a/camel/providers/nntp/camel-nntp-store.h +++ b/camel/providers/nntp/camel-nntp-store.h @@ -31,14 +31,13 @@ extern "C" { #pragma } #endif /* __cplusplus }*/ -#include #include "camel-store.h" #include "camel-nntp-newsrc.h" #define CAMEL_NNTP_STORE_TYPE (camel_nntp_store_get_type ()) -#define CAMEL_NNTP_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_NNTP_STORE_TYPE, CamelNNTPStore)) -#define CAMEL_NNTP_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_NNTP_STORE_TYPE, CamelNNTPStoreClass)) -#define IS_CAMEL_NNTP_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_NNTP_STORE_TYPE)) +#define CAMEL_NNTP_STORE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_NNTP_STORE_TYPE, CamelNNTPStore)) +#define CAMEL_NNTP_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_NNTP_STORE_TYPE, CamelNNTPStoreClass)) +#define IS_CAMEL_NNTP_STORE(o) (CAMEL_CHECK_TYPE((o), CAMEL_NNTP_STORE_TYPE)) typedef struct { @@ -76,8 +75,8 @@ enum { CAMEL_NNTP_OK, CAMEL_NNTP_ERR, CAMEL_NNTP_FAIL }; int camel_nntp_command (CamelNNTPStore *store, char **ret, char *fmt, ...); char *camel_nntp_command_get_additional_data (CamelNNTPStore *store); -/* Standard Gtk function */ -GtkType camel_nntp_store_get_type (void); +/* Standard Camel function */ +CamelType camel_nntp_store_get_type (void); #ifdef __cplusplus } -- cgit v1.2.3