[evolution-rss] add debug more debug info



commit c04f5bc1c7321e78573461ae862d2e22f824fe32
Author: Lucian Langa <lucilanga gnome org>
Date:   Sat Dec 26 10:43:03 2009 +0200

    add debug more debug info

 src/dbus.c               |   86 ++++++++++++++++++++++------------------------
 src/gecko-utils.cpp      |   35 +++++++++++++-----
 src/rss-config-factory.c |   28 ++++++++++++---
 src/rss.c                |    6 ++-
 4 files changed, 93 insertions(+), 62 deletions(-)
---
diff --git a/src/dbus.c b/src/dbus.c
index f961855..c771ae1 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -1,17 +1,17 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*  Evoution RSS Reader Plugin
- *  Copyright (C) 2007-2009  Lucian Langa <cooly gnome eu org> 
- *  
+ *  Copyright (C) 2007-2009  Lucian Langa <cooly gnome eu org>
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or 
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
@@ -50,23 +50,23 @@ static void
 send_dbus_message (const char *name, const char *data, guint new)
 {
 	DBusMessage *message;
-	
+
 	/* Create a new message on the DBUS_INTERFACE */
 	if (!(message = dbus_message_new_signal (DBUS_PATH, DBUS_INTERFACE, name)))
 		return;
-	
+
 	/* Appends the data as an argument to the message */
 	dbus_message_append_args (message,
 #if DBUS_VERSION >= 310
 				  DBUS_TYPE_STRING, &data,
 #else
 				  DBUS_TYPE_STRING, data,
-#endif	
+#endif
 				  DBUS_TYPE_INVALID);
 
 	/* Sends the message */
 	dbus_connection_send (bus, message, NULL);
-	
+
 	/* Frees the message */
 	dbus_message_unref (message);
 }
@@ -77,9 +77,9 @@ reinit_dbus (gpointer user_data)
 {
 	if (!enabled || init_dbus ())
 		return FALSE;
-	
+
 	/* keep trying to re-establish dbus connection */
-	
+
 	return TRUE;
 }
 
@@ -90,61 +90,58 @@ filter_function (DBusConnection *connection, DBusMessage *message, void *user_da
 	    strcmp (dbus_message_get_path (message), DBUS_PATH_LOCAL) == 0) {
 		dbus_connection_unref (bus);
 		bus = NULL;
-		
+
 		g_timeout_add (3000, reinit_dbus, NULL);
-		
+
 		return DBUS_HANDLER_RESULT_HANDLED;
 	}
 	else if (dbus_message_is_signal (message, DBUS_INTERFACE, "evolution_rss_feed")) {
 		DBusError error;
-    		char *s;
+		char *s;
 		add_feed *feed = g_new0(add_feed, 1);
-    		dbus_error_init (&error);
-    		if (dbus_message_get_args 
-       			(message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
-      			g_print("New Feed received: %s\n", s);
+		dbus_error_init (&error);
+		if (dbus_message_get_args
+			(message, &error, DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID)) {
+			g_print("New Feed received: %s\n", s);
 			feed->feed_url = g_strdup(s);
 			feed->add=1;
 			feed->enabled=feed->validate=1;
 			feed->fetch_html = 0;
-			if (feed->feed_url && strlen(feed->feed_url))
-        		{
-                		gchar *text = feed->feed_url;
-                		feed->feed_url = sanitize_url(feed->feed_url);
-                		g_free(text);
-      				d(g_print("sanitized feed URL: %s\n", feed->feed_url));
-                		if (g_hash_table_find(rf->hr,
+			if (feed->feed_url && strlen(feed->feed_url)) {
+				gchar *text = feed->feed_url;
+				feed->feed_url = sanitize_url(feed->feed_url);
+				g_free(text);
+				d(g_print("sanitized feed URL: %s\n", feed->feed_url));
+				if (g_hash_table_find(rf->hr,
                                         check_if_match,
-                        	        feed->feed_url))
-                		{
+					feed->feed_url)) {
                         	   rss_error(NULL, NULL, _("Error adding feed."),
                         	                   _("Feed already exists!"));
     				   return DBUS_HANDLER_RESULT_HANDLED;
                 		}
-                		if (setup_feed(feed))
-				{
+                		if (setup_feed(feed)) {
 					gchar *msg = g_strdup_printf(_("New feed imported: %s"),
 							lookup_chn_name_by_url(feed->feed_url));
 					taskbar_push_message(msg);
 					g_free(msg);
-				}	
+				}
 				if (rf->treeview)
 					store_redraw(GTK_TREE_VIEW(rf->treeview));
-        			save_gconf_feed();
-        			camel_operation_end(NULL);
+				save_gconf_feed();
+				camel_operation_end(NULL);
 			}
 
 
     //  dbus_message_unref(reply);
  //     return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
 
-      			//dbus_free (s);
-    		} else {
-      			g_print("Feed received, but error getting message: %s\n", error.message);
-      			dbus_error_free (&error);
-    		}
-    		return DBUS_HANDLER_RESULT_HANDLED;
-  	}
+			//dbus_free (s);
+		} else {
+			g_print("Feed received, but error getting message: %s\n", error.message);
+			dbus_error_free (&error);
+		}
+		return DBUS_HANDLER_RESULT_HANDLED;
+	}
 	else if (dbus_message_is_signal (message, DBUS_INTERFACE, "ping")) {
 		DBusMessage *reply;
 		fprintf(stderr, "!!Ping!! received from %s\n",
@@ -155,7 +152,7 @@ filter_function (DBusConnection *connection, DBusMessage *message, void *user_da
 //			dbus_message_get_serial(message));
 		dbus_connection_send (connection, reply, NULL);
 		dbus_connection_flush (connection);
-    		return DBUS_HANDLER_RESULT_HANDLED;
+		return DBUS_HANDLER_RESULT_HANDLED;
 	}
 
 	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -169,23 +166,22 @@ init_dbus (void)
 	GMainLoop *loop;
 	loop = g_main_loop_new (NULL, FALSE);
 
-	
 	if (rf->bus != NULL)
 		return rf->bus;
-	
+
 	dbus_error_init (&error);
 	if (!(bus = dbus_bus_get (DBUS_BUS_SESSION, &error))) {
 		g_warning ("could not get system bus: %s\n", error.message);
 		dbus_error_free (&error);
 		return NULL;
 	}
-	
+
 	dbus_connection_setup_with_g_main (bus, NULL);
 	dbus_bus_add_match (bus, "type='signal',interface='org.gnome.evolution.mail.rss.in'", NULL);
 	dbus_connection_set_exit_on_disconnect (bus, FALSE);
-	
+
 	dbus_connection_add_filter (bus, filter_function, loop, NULL);
-	
+
 	return bus;
 }
 
diff --git a/src/gecko-utils.cpp b/src/gecko-utils.cpp
index 19b52d0..25d3b36 100644
--- a/src/gecko-utils.cpp
+++ b/src/gecko-utils.cpp
@@ -27,8 +27,15 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+extern "C" int rss_verbose_debug;
+#if rss_verbose_debug
+#define d(x) x
+#else
+#define d(x)
+#endif
+
 #include <nsStringAPI.h>
- 
+
 #ifdef XPCOM_GLUE
 #include <nsXPCOMGlue.h>
 #include <gtkmozembed_glue.cpp>
@@ -55,6 +62,7 @@
 #include <nsIMarkupDocumentViewer.h>
 #include <nspr.h>
 
+
 static nsIPrefBranch* gPrefBranch;
 
 extern "C" gboolean
@@ -111,7 +119,7 @@ gint gecko_get_mouse_event_button(gpointer event) {
 
 extern "C" void
 gecko_set_zoom (GtkWidget *moz, gfloat zoom)
-{	
+{
 	nsCOMPtr<nsIWebBrowser>         mWebBrowser;
         nsCOMPtr<nsIDOMWindow>          mDOMWindow;
 
@@ -179,17 +187,19 @@ gecko_select_all (GtkMozEmbed *embed)
 extern "C" gboolean
 gecko_init (void)
 {
-       nsresult rv;
+	d(g_print("gecko_init()\n"));
+	nsresult rv;
 #ifdef HAVE_GECKO_1_9
 	NS_LogInit ();
 #endif
 
 #ifdef XPCOM_GLUE
-       static const GREVersionRange greVersion = {
-         "1.9a", PR_TRUE,
-         "2", PR_TRUE
-       };
-       char xpcomLocation[4096];
+	static const GREVersionRange greVersion = {
+	"1.9a", PR_TRUE,
+	"2", PR_TRUE
+	};
+	char xpcomLocation[4096];
+	d(g_print("init XPCOM_GLUE\n"));
        rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
        if (NS_FAILED (rv))
        {
@@ -223,15 +233,18 @@ gecko_init (void)
        if (lastSlash)
          *lastSlash = '\0';
 
-       gtk_moz_embed_set_path(xpcomLocation);
+	gtk_moz_embed_set_path(xpcomLocation);
 #else
+	d(g_print("doing old gecko init\n"));
 #ifdef HAVE_GECKO_1_9
 	gtk_moz_embed_set_path (GECKO_HOME);
 #else
 	gtk_moz_embed_set_comp_path (GECKO_HOME);
 #endif
+	d(g_print("end gecko init()\n"));
 #endif /* XPCOM_GLUE */
 
+	d(g_print("load gecko prefs\n"));
 	gchar *profile_dir = g_build_filename (g_get_home_dir (),
 					       ".evolution",
 					       "mail",
@@ -241,6 +254,7 @@ gecko_init (void)
 	gtk_moz_embed_set_profile_path (profile_dir, "mozembed-rss");
 	g_free (profile_dir);
 
+	d(g_print("embed push startup()\n"));
 	gtk_moz_embed_push_startup ();
 
 	nsCOMPtr<nsIPrefService> prefService (do_GetService (NS_PREFSERVICE_CONTRACTID, &rv));
@@ -248,7 +262,8 @@ gecko_init (void)
 
 	rv = CallQueryInterface (prefService, &gPrefBranch);
 	NS_ENSURE_SUCCESS (rv, FALSE);
-	
+	d(g_print("finished all gecko init\n"));
+
 	return TRUE;
 }
 
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 35416e0..81d8483 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -729,13 +729,17 @@ feeds_dialog_add(GtkDialog *d, gpointer data)
                 gtk_widget_destroy(feed->dialog);
 #if EVOLUTION_VERSION < 22904
 	msg_feeds = e_error_new(
+		GTK_WINDOW(rf->preferences),
+		"org-gnome-evolution-rss:rssmsg",
+		"",
+		NULL);
 #else
 	msg_feeds = e_alert_dialog_new_for_args(
-#endif
 		GTK_WINDOW(rf->preferences),
 		"org-gnome-evolution-rss:rssmsg",
 		"",
 		NULL);
+#endif
 	progress = gtk_progress_bar_new();
         gtk_box_pack_start(
 		GTK_BOX(((GtkDialog *)msg_feeds)->vbox),
@@ -824,6 +828,7 @@ rss_delete_folders (CamelStore *store, const char *full_name, CamelException *ex
 		| CAMEL_STORE_FOLDER_INFO_FAST
 		| CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
         CamelFolderInfo *fi;
+	d(g_print("rss_delete_folders() %s:%d\n", __FILE__, __LINE__));
 
         fi = camel_store_get_folder_info (store, full_name, flags, ex);
         if (camel_exception_is_set (ex))
@@ -1331,13 +1336,17 @@ import_opml(gchar *file)
         msg = g_strdup(_("Importing feeds..."));
 #if EVOLUTION_VERSION < 22904
         import_dialog = e_error_new(
+		GTK_WINDOW(rf->preferences),
+		"shell:importing",
+		msg,
+		NULL);
 #else
         import_dialog = e_alert_dialog_new_for_args(
-#endif
 		GTK_WINDOW(rf->preferences),
 		"shell:importing",
 		msg,
 		NULL);
+#endif
         gtk_window_set_keep_above(GTK_WINDOW(import_dialog), TRUE);
         g_signal_connect(
 		import_dialog,
@@ -1457,7 +1466,6 @@ import_opml(gchar *file)
 						if (tmp) g_free(tmp);
 					}
 				// we're insterested in rss/pie only
-				// we might just handle all variations of type= property
 				} else if (strcmp(prop, "link")) {
 				//	&& strcmp(prop, "vfolder")) {
 					rssprefix = root;
@@ -1833,13 +1841,18 @@ export_opml(gchar *file)
         gchar *msg = g_strdup(_("Exporting feeds..."));
 #if EVOLUTION_VERSION < 22904
         import_dialog = e_error_new(
+			GTK_WINDOW(rf->preferences),
+			"shell:importing",
+			msg,
+			NULL);
+
 #else
         import_dialog = e_alert_dialog_new_for_args(
-#endif
 			GTK_WINDOW(rf->preferences),
 			"shell:importing",
 			msg,
 			NULL);
+#endif
         gtk_window_set_keep_above(GTK_WINDOW(import_dialog), TRUE);
 //        g_signal_connect(import_dialog, "response", G_CALLBACK(import_dialog_response), NULL);
         import_label = gtk_label_new(_("Please wait"));
@@ -1881,13 +1894,18 @@ export_opml(gchar *file)
         } else {
 #if EVOLUTION_VERSION < 22904
                 e_error_run(GTK_WINDOW(rf->preferences),
+			"org-gnome-evolution-rss:feederr",
+                        _("Error exporting feeds!"),
+                        g_strerror(errno),
+                        NULL);
+
 #else
                 e_alert_run_dialog_for_args(GTK_WINDOW(rf->preferences),
-#endif
                         "org-gnome-evolution-rss:feederr",
                         _("Error exporting feeds!"),
                         g_strerror(errno),
                         NULL);
+#endif
         }
 	g_free(opml);
 
diff --git a/src/rss.c b/src/rss.c
index 506bee9..035b352 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -575,7 +575,7 @@ taskbar_op_set_progress(gchar *key, gchar *msg, gdouble progress)
 #if (EVOLUTION_VERSION < 22900) //kb//
 		e_activity_handler_operation_progressing(activity_handler,
 				activity_id,
-                                g_strdup(msg), 
+                                g_strdup(msg),
                                 progress);
 #else
 	e_activity_set_percent (activity_id, progress);
@@ -1633,6 +1633,7 @@ if (2 == gconf_client_get_int(rss_gconf, GCONF_KEY_HTML_RENDER, NULL))
 void
 rss_mozilla_init(void)
 {
+	d(g_print("rss_mozilla_init() called in %s:%d\n", __FILE__, __LINE__));
 	if (!gecko_ready) {
 		gecko_init();
 		gecko_ready = 1;
@@ -1988,8 +1989,9 @@ org_gnome_rss_browser (EMFormatHTML *efh, void *eb, EMFormatHTMLPObject *pobject
 
 #ifdef HAVE_GECKO
 	if (engine == 2) {
-		rss_mozilla_init();	//in case we this is a failover
+		rss_mozilla_init();	//in case we fail this is a failover
 		rf->mozembed = gtk_moz_embed_new();
+		d(g_print("mozembed=%p at %s:%d\n", rf->mozembed, __FILE__, __LINE__));
 		gecko_set_preferences();
 
 		/* FIXME add all those profile shits */



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