aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-13 05:01:07 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-13 05:01:07 +0800
commit1c721c4abb74d443b0a0bc0893e11716a348c846 (patch)
treed90dd8f5cd58b05668c04fb1396118cb11e16fb5
parent96b7f9a5fd8eaafc7b79ef8761a5b2ff15850b4c (diff)
downloadgsoc2013-evolution-1c721c4abb74d443b0a0bc0893e11716a348c846.tar.gz
gsoc2013-evolution-1c721c4abb74d443b0a0bc0893e11716a348c846.tar.zst
gsoc2013-evolution-1c721c4abb74d443b0a0bc0893e11716a348c846.zip
remove stupid debug code. (add_mail_store): use camel_session_get_store
1999-08-12 bertrand <Bertrand.Guiheneuf@aful.org> * tests/ui-tests/store_listing.c (show_folder_messages): remove stupid debug code. (add_mail_store): use camel_session_get_store instead of creating MH store directly. (main): load MH provider. * camel/camel-provider.c (camel_provider_register_as_module): register new provider. (camel_provider_get_for_protocol): Now, implementation is correct. * camel/camel-store.c (_finalize): * camel/camel-store.h (struct _CamelStore): further disabled url_name field use. URL will be generated dynamically. Ben dam don dieu, vla t'y pas que ya tout le bourier qui marche ! (Autoload store/protocol from URL works) svn path=/trunk/; revision=1108
-rw-r--r--ChangeLog16
-rw-r--r--camel/camel-provider.c45
-rw-r--r--camel/camel-session.c6
-rw-r--r--camel/camel-session.h2
-rw-r--r--camel/camel-store.c5
-rw-r--r--camel/camel-store.h2
-rw-r--r--tests/test7.c2
-rw-r--r--tests/ui-tests/store_listing.c20
8 files changed, 61 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index f323fa2a6e..66ec5e040f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
1999-08-12 bertrand <Bertrand.Guiheneuf@aful.org>
+ * tests/ui-tests/store_listing.c (show_folder_messages):
+ remove stupid debug code.
+ (add_mail_store): use camel_session_get_store instead
+ of creating MH store directly.
+ (main): load MH provider.
+
+ * camel/camel-provider.c (camel_provider_register_as_module):
+ register new provider.
+ (camel_provider_get_for_protocol):
+ Now, implementation is correct.
+
+ * camel/camel-store.c (_finalize):
+ * camel/camel-store.h (struct _CamelStore):
+ further disabled url_name field use.
+ URL will be generated dynamically.
+
* camel/camel-session.c (camel_session_get_store_for_protocol):
compilation and runtime fixes.
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
index 98c43bd7ce..79b9dfd97d 100644
--- a/camel/camel-provider.c
+++ b/camel/camel-provider.c
@@ -118,6 +118,7 @@ camel_provider_register_as_module (const gchar *module_path)
new_provider = camel_provider_module_init();
new_provider->gmodule = new_module;
+ camel_provider_register (new_provider);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
return new_provider;
@@ -148,7 +149,7 @@ _provider_protocol_find (gconstpointer a, gconstpointer b)
*
* Look into the list of registered provider if
* one correspond both to the protocol name
- * and to the protocol type. When several providerss
+ * and to the protocol type. When several providers
* exist for a same protocol, the last registered
* is returned.
*
@@ -157,27 +158,27 @@ _provider_protocol_find (gconstpointer a, gconstpointer b)
const CamelProvider *
camel_provider_get_for_protocol (const gchar *protocol, ProviderType type)
{
- GList *found_provider_node;
- CamelProvider *found_provider = NULL;
-
+ CamelProvider *current_provider = NULL;
+ GList *current_provider_node;
+ gboolean protocol_is_found;
+ gboolean provider_is_found;
+
g_assert (protocol);
g_return_val_if_fail (_provider_list, NULL);
-
- /* we've got a compilation warning here because of bad prototype of
- g_list_find_custom (), don't worry about that */
- do {
- found_provider_node = g_list_find_custom (_provider_list, (gconstpointer)protocol, _provider_name_cmp);
- /* we will get the last registered provider
- here because providers are registered
- using g_list_prepend(). This is a bit
- dangerous however because we rely on
- the way g_list_find_custom() is implemented.
- This should be changed one day */
- if (found_provider_node)
- found_provider = (CamelProvider*)found_provider_node->data;
- else found_provider = NULL;
- }
- while (found_provider && (found_provider->provider_type != type));
-
- return found_provider;
+
+ current_provider_node = _provider_list;
+ provider_is_found = FALSE;
+
+ while ((!provider_is_found) && current_provider_node) {
+ current_provider = (CamelProvider *)current_provider_node->data;
+
+ protocol_is_found = (g_strcasecmp (protocol, current_provider->protocol) == 0);
+ if (protocol_is_found)
+ provider_is_found = (current_provider->provider_type == type);
+
+ g_list_next (current_provider_node);
+ }
+
+ if (provider_is_found) return current_provider;
+ else return NULL;
}
diff --git a/camel/camel-session.c b/camel/camel-session.c
index a32ff510a4..20f0462368 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -79,6 +79,12 @@ camel_session_get_type (void)
}
+CamelSession *
+camel_session_new ()
+{
+ return gtk_type_new (CAMEL_SESSION_TYPE);
+}
+
/**
* camel_session_set_provider: set the default provider for a protocol
* @session: session object for wich the provider will the default
diff --git a/camel/camel-session.h b/camel/camel-session.h
index 9bec37851a..3435f3b604 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -71,7 +71,7 @@ typedef struct {
GtkType camel_session_get_type (void);
-
+CamelSession *camel_session_new ();
void camel_session_set_provider (CamelSession *session, CamelProvider *provider);
CamelStore *camel_session_get_store_for_protocol (CamelSession *session, const gchar *protocol);
CamelStore *camel_session_get_store (CamelSession *session, const gchar *url_string);
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 209a03d101..8b3a05d624 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -125,10 +125,9 @@ _init (CamelStore *store, CamelSession *session, const gchar *url_name)
{
#warning re-enable assertion here.
- /* g_assert(session); */
+ g_assert(session);
g_assert(url_name);
- if (store->session) gtk_object_unref (GTK_OBJECT (store->session));
store->session = session;
gtk_object_ref (GTK_OBJECT (session));
/*store->url_name = url_name;*/
@@ -141,7 +140,7 @@ _finalize (GtkObject *object)
CamelStore *camel_store = CAMEL_STORE (object);
CAMEL_LOG_FULL_DEBUG ("Entering CamelStore::finalize\n");
- if (camel_store->url_name) g_free (camel_store->url_name);
+ /* if (camel_store->url_name) g_free (camel_store->url_name); */
if (camel_store->session) gtk_object_unref (GTK_OBJECT (camel_store->session));
GTK_OBJECT_CLASS (parent_class)->finalize (object);
diff --git a/camel/camel-store.h b/camel/camel-store.h
index 9634e9d0e7..8ad5bc8d9d 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -50,7 +50,7 @@ struct _CamelStore
CamelService parent_object;
CamelSession *session;
- gchar *url_name;
+ /* gchar *url_name; */
gchar separator;
};
diff --git a/tests/test7.c b/tests/test7.c
index aaf256f64b..6b2494aa0e 100644
--- a/tests/test7.c
+++ b/tests/test7.c
@@ -18,5 +18,7 @@ main (int argc, char**argv)
new_provider = camel_provider_register_as_module ("../camel/providers/MH/.libs/libcamelmh.so");
+
+
}
diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c
index 2f73921ad6..a9f1d875cd 100644
--- a/tests/ui-tests/store_listing.c
+++ b/tests/ui-tests/store_listing.c
@@ -16,6 +16,8 @@
#include "camel.h"
static GladeXML *xml;
+static CamelSession *_session;
+
static void add_mail_store (const gchar *store_url);
static void show_folder_messages (CamelFolder *folder);
@@ -88,9 +90,7 @@ show_folder_messages (CamelFolder *folder)
current_row = gtk_clist_append (GTK_CLIST (message_clist), clist_row_text);
gtk_clist_set_row_data_full (GTK_CLIST (message_clist), current_row, (gpointer)message, message_destroy_notify);
}
- for (i=0; i<10; i++)
- gtk_clist_append (GTK_CLIST (message_clist), clist_row_text);
-
+
}
@@ -112,12 +112,10 @@ add_mail_store (const gchar *store_url)
CamelFolder *new_folder;
- /* normally the store type is found automatically
- with the URL, this is not implemented for
- the moment */
- store = gtk_type_new (CAMEL_MH_STORE_TYPE);
- camel_store_init (store, (CamelSession *)NULL, g_strdup (store_url));
-
+
+ store = camel_session_get_store (_session, store_url);
+ if (!store) return;
+
//store_list = g_list_append (store_list, (gpointer)store);
mailbox_and_store_tree = glade_xml_get_widget (xml, "store-and-mailbox-tree");
new_tree_text[0] = g_strdup (store_url);
@@ -216,7 +214,9 @@ main(int argc, char *argv[])
camel_init ();
xml = glade_xml_new ("store_listing.glade", NULL);
if (xml) glade_xml_signal_autoconnect (xml);
-
+
+ _session = camel_session_new ();
+ camel_provider_register_as_module ("../../camel/providers/MH/.libs/libcamelmh.so");
gtk_main ();