[evolution-rss] adapt to camel headers include policy



commit 2740b52efa09ae5572e5dfb352327abc0faa3eb7
Author: Lucian Langa <lucilanga gnome org>
Date:   Sun Apr 4 12:24:35 2010 +0300

    adapt to camel headers include policy

 src/file-gio.c  |   48 +++++++++++++++++----------------
 src/misc.c      |    5 +++-
 src/parser.c    |    4 +++
 src/rss-cache.c |   20 ++++++++-----
 src/rss-cache.h |    4 +++
 src/rss.c       |   80 +++++++++++++++++++++++++++++++++++++++----------------
 src/rss.h       |    4 +++
 7 files changed, 110 insertions(+), 55 deletions(-)
---
diff --git a/src/file-gio.c b/src/file-gio.c
index ec1a0dc..7b8d887 100644
--- a/src/file-gio.c
+++ b/src/file-gio.c
@@ -27,41 +27,43 @@
 
 gboolean
 file_get_unblocking(const char *uri, NetStatusCallback cb,
-                                gpointer data, gpointer cb2,
-                                gpointer cbdata2,
-                                guint track,
-                                GError **err)
+		gpointer data, gpointer cb2,
+		gpointer cbdata2,
+		guint track,
+		GError **err)
 {
 	GFile *file;
 
 	file = g_file_new_for_uri (uri);
-	g_file_load_contents_async (file,
-                           NULL,
-                           cb2,
-                           cbdata2);
+	g_file_load_contents_async (
+		file,
+		NULL,
+		cb2,
+		cbdata2);
 	return 1;
 }
 
 void
 gio_finish_feed (GObject *object, GAsyncResult *res, gpointer user_data)
 {
-        gsize file_size;
-        char *file_contents;
-        gboolean result;
+	gsize file_size;
+	char *file_contents;
+	gboolean result;
 
-        rfMessage *rfmsg = g_new0(rfMessage, 1);
+	rfMessage *rfmsg = g_new0(rfMessage, 1);
 
-        result = g_file_load_contents_finish (G_FILE (object),
-                                              res,
-                                              &file_contents, &file_size,
-                                              NULL, NULL);
+	result = g_file_load_contents_finish (
+			G_FILE (object),
+			res,
+			&file_contents, &file_size,
+			NULL, NULL);
 	if (result) {
-        	rfmsg->status_code = SOUP_STATUS_OK;
-        	rfmsg->body = file_contents;
-        	rfmsg->length = file_size;
-        	generic_finish_feed(rfmsg, user_data);
-                g_free (file_contents);
-        }
-        g_free(rfmsg);
+		rfmsg->status_code = SOUP_STATUS_OK;
+		rfmsg->body = file_contents;
+		rfmsg->length = file_size;
+		generic_finish_feed(rfmsg, user_data);
+		g_free (file_contents);
+	}
+	g_free(rfmsg);
 }
 
diff --git a/src/misc.c b/src/misc.c
index a34294a..311a82d 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -23,8 +23,11 @@
 #include <stdint.h>
 #include <string.h>
 #include <glib.h>
-//#include <libedataserver/md5-utils.h>
+#if (DATASERVER_VERSION >= 2031001)
+#include <camel/camel.h>
+#else
 #include <camel/camel-mime-utils.h>
+#endif
 
 extern int rss_verbose_debug;
 
diff --git a/src/parser.c b/src/parser.c
index 7dd8068..0f64551 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -24,7 +24,11 @@
 #include <libxml/HTMLparser.h>
 #include <libxml/HTMLtree.h>
 #include <libxml/debugXML.h>
+#if (DATASERVER_VERSION >= 2031001)
+#include <camel/camel.h>
+#else
 #include <camel/camel-url.h>
+#endif
 #include <e-util/e-mktemp.h>
 
 extern int rss_verbose_debug;
diff --git a/src/rss-cache.c b/src/rss-cache.c
index 8740a9e..a7b98bd 100644
--- a/src/rss-cache.c
+++ b/src/rss-cache.c
@@ -17,8 +17,12 @@
  */
 
 #include <string.h>
+#if (DATASERVER_VERSION >= 2031001)
+#include <camel/camel.h>
+#else
 #include <camel/camel-data-cache.h>
 #include <camel/camel-file-utils.h>
+#endif
 
 #include "rss.h"
 #include "rss-cache.h"
@@ -37,18 +41,18 @@ rss_cache_init(void)
 	gchar *base_dir, *feed_dir;
 
 	base_dir = rss_component_peek_base_directory();
-        feed_dir = g_build_path("/",
+	feed_dir = g_build_path("/",
 			base_dir,
 			"static",
 			NULL);
-        g_free(base_dir);
-        if (!g_file_test(feed_dir, G_FILE_TEST_EXISTS))
-                g_mkdir_with_parents (feed_dir, 0755);
-        cache = camel_data_cache_new(feed_dir, 0, NULL);
-        g_free(feed_dir);
+	g_free(base_dir);
+	if (!g_file_test(feed_dir, G_FILE_TEST_EXISTS))
+		g_mkdir_with_parents (feed_dir, 0755);
+	cache = camel_data_cache_new(feed_dir, 0, NULL);
+	g_free(feed_dir);
 
-        if (!cache)
-                return;
+	if (!cache)
+		return;
 
 	// expire in a month max
 	// and one week if not accessed sooner
diff --git a/src/rss-cache.h b/src/rss-cache.h
index adf11a1..288d070 100644
--- a/src/rss-cache.h
+++ b/src/rss-cache.h
@@ -16,7 +16,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+#if (DATASERVER_VERSION >= 2031001)
+#include <camel/camel.h>
+#else
 #include <camel/camel-data-cache.h>
+#endif
 
 void rss_cache_init(void);
 CamelStream *rss_cache_get(gchar *url);
diff --git a/src/rss.c b/src/rss.c
index bcaaf6e..7f63b5b 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -29,15 +29,19 @@ int rss_verbose_debug = 0;
 #include <time.h>
 #include <errno.h>
 
+#if (DATASERVER_VERSION >= 2031001)
+#include <camel/camel.h>
+#else
 #include <camel/camel-mime-message.h>
+#include <camel/camel-file-utils.h>
 #include <camel/camel-folder.h>
 #include <camel/camel-multipart.h>
 #include <camel/camel-stream-mem.h>
 #include <camel/camel-stream-fs.h>
 #include <camel/camel-text-index.h>
+#endif
 
 #include <e-util/e-icon-factory.h>
-//#include <e-util/e-mktemp.h>
 #include <e-util/e-util.h>
 
 
@@ -69,8 +73,6 @@ int rss_verbose_debug = 0;
 #include <mail/mail-tools.h>
 #include <mail/mail-ops.h>
 
-
-
 #include <mail/em-format-html.h>
 #include <mail/em-format-hook.h>
 
@@ -91,7 +93,6 @@ int rss_verbose_debug = 0;
 #include <gtk/gtk.h>
 
 #include <shell/es-event.h>
-#include <camel/camel-file-utils.h>
 
 #ifdef HAVE_GTKHTMLEDITOR
 #include <editor/gtkhtml-editor.h>
@@ -1825,15 +1826,21 @@ webkit_click (GtkEntry *entry,
 	return TRUE;
 }
 
+#include <shell/e-shell-view.h>
+#include <shell/e-shell-searchbar.h>
+#if EVOLUTION_VERSION >= 22900
 static void
-action_search_cb (GtkAction *action,
-			EMailReader *reader)
+action_search_cb (EShellView *shell,
+			GtkWidget *sb)
 {
-	g_print("search\n");
+//	g_signal_connect_swapped (
+//		search_bar, "changed",
+//		G_CALLBACK (em_format_redraw), priv->html_display);
+		g_print("my search\n");
+//	g_print("search:%s\n", e_shell_searchbar_get_search_text(sb));
 }
 
 
-#include <shell/e-shell-searchbar.h>
 void
 rss_search_bar_hook(void)
 {
@@ -1842,21 +1849,47 @@ rss_search_bar_hook(void)
 	GtkAction *action;
 	EShellSearchbar *search_bar;
 	gchar *action_name;
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	
+
+	CamelFolder *folder;
+	EMFolderTree *folder_tree;
+	EShellSidebar *shell_sidebar = e_shell_view_get_shell_sidebar(
+					rss_shell_view);
+	g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
+	folder = em_folder_tree_get_selected_folder (folder_tree);
+	g_print("file:%s\n", mail_config_folder_to_cachename (
+				folder, "et-header-"));
 
-	shell_content = e_shell_view_get_shell_content (rss_shell_view);
-	reader = E_MAIL_READER (shell_content);
 
-	action_name = "mail-find";
-	action = e_mail_reader_get_action (reader, action_name);
-	g_signal_connect_swapped (
-		action, "activate",
-		G_CALLBACK (action_search_cb), reader);
-	search_bar = e_shell_content_get_searchbar(shell_content);
-	g_signal_connect_swapped (
-		search_bar, "activate",
-		G_CALLBACK (action_search_cb), NULL);
+	shell_content = e_shell_view_get_shell_content (rss_shell_view);
+//	reader = E_MAIL_READER (shell_content);
+
+//	action_name = "mail-find";
+//	action = e_mail_reader_get_action (reader, action_name);
+//	g_signal_connect_swapped (
+//		action, "activate",
+//		G_CALLBACK (action_search_cb), reader);
+//	search_bar = e_shell_view_get_searchbar(rss_shell_view);
+	//search_bar = e_shell_content_get_searchbar(shell_content);
+	shell_view = e_shell_searchbar_get_shell_view (search_bar);
+//	g_signal_connect_after (
+//		"execute-search", "activate",
+//		G_CALLBACK (action_search_cb), search_bar);
+	shell_window = e_shell_view_get_shell_window (rss_shell_view);
+	g_signal_connect_after (
+			search_bar,
+			"expose-event",
+		G_CALLBACK (action_search_cb),
+		rss_shell_view);
+	e_shell_view_clear_search(shell_view);
+//	g_signal_connect (
+//		search_bar, "execute-search",
+//		G_CALLBACK (action_search_cb), search_bar);
 
 }
+#endif
 
 #endif
 
@@ -4482,9 +4515,9 @@ check_feed_folder(gchar *folder_name)
 	gchar *real_folder = lookup_feed_folder(folder_name);
 	gchar *real_name = g_strdup_printf(
 				"%s/%s", main_folder, real_folder);
-	dp("main_folder:%s\n", main_folder);
-	dp("real_folder:%s\n", real_folder);
-	dp("real_name:%s\n", real_name);
+	d("main_folder:%s\n", main_folder);
+	d("real_folder:%s\n", real_folder);
+	d("real_name:%s\n", real_name);
 	mail_folder = camel_store_get_folder (store, real_name, 0, NULL);
 	base_folder = main_folder;
 	if (mail_folder == NULL) {
@@ -5387,8 +5420,9 @@ e_plugin_ui_init (GtkUIManager *ui_manager,
 		"activate",
 		G_CALLBACK (quit_cb),
 		rss_shell_view);
-		g_print("hhok\n");
+#if EVOLUTION_VERSION >= 22900
 	rss_search_bar_hook();
+#endif
 	return TRUE;
 }
 #endif
diff --git a/src/rss.h b/src/rss.h
index bbd902b..21a2e49 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -40,8 +40,12 @@
 #endif
 #include <shell/es-event.h>
 
+#if (DATASERVER_VERSION >= 2031001)
+#include <camel/camel.h>
+#else
 #include <camel/camel-folder.h>
 #include <camel/camel-operation.h>
+#endif
 #include <mail/em-event.h>
 
 #ifdef HAVE_WEBKIT



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]