evolution r36072 - branches/mail-dbus-remoting/mail



Author: abharath
Date: Tue Aug 26 08:12:16 2008
New Revision: 36072
URL: http://svn.gnome.org/viewvc/evolution?rev=36072&view=rev

Log:
Few more cleanups and added some more funcs


Modified:
   branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
   branches/mail-dbus-remoting/mail/camel-session-remote.c
   branches/mail-dbus-remoting/mail/camel-session-remote.h

Modified: branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote-impl.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote-impl.c	Tue Aug 26 08:12:16 2008
@@ -35,6 +35,7 @@
 
 	CamelSession *session = NULL;
 	CamelStore *store;
+	char *store_not_found = _("Store not found");
 
   	printf ("D-Bus message: obj_path = '%s' interface = '%s' method = '%s' destination = '%s'\n",
            dbus_message_get_path (message),
@@ -78,7 +79,7 @@
 
 		store = g_hash_table_lookup (store_hash, store_hash_key);
 		if (!store) {
-			dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, _("Store not found"), DBUS_TYPE_INVALID);
+			dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, &(store_not_found), DBUS_TYPE_INVALID);
 			goto fail;
 		}
 
@@ -92,7 +93,7 @@
 			err = g_strdup ("");
 		camel_exception_free (ex);
 			
-		dbus_message_append_args (return_val, DBUS_TYPE_STRING, passwd, DBUS_TYPE_STRING, err, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &passwd, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_get_storage_path") == 0) {
 		char *session_str, *store_hash_key, *storage_path, *err;
@@ -108,7 +109,7 @@
 		
 		store = g_hash_table_lookup (store_hash, store_hash_key);
 		if (!store) {
-			dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, _("Store not found"), DBUS_TYPE_INVALID);
+			dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, &(store_not_found), DBUS_TYPE_INVALID);
 			goto fail;
 		}
 
@@ -123,7 +124,7 @@
 
 		camel_exception_free (ex);
 			
-		dbus_message_append_args (return_val, DBUS_TYPE_STRING, storage_path, DBUS_TYPE_STRING, err, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &storage_path, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_forget_password") == 0) {
 		char *session_str, *store_hash_key, *domain, *item, *err;
@@ -141,7 +142,7 @@
 		
 		store = g_hash_table_lookup (store_hash, store_hash_key);
 		if (!store) {
-			dbus_message_append_args (return_val, DBUS_TYPE_STRING, _("Store not found"), DBUS_TYPE_INVALID);
+			dbus_message_append_args (return_val, DBUS_TYPE_STRING, &(store_not_found), DBUS_TYPE_INVALID);
 			goto fail;
 		}
 
@@ -156,7 +157,7 @@
 
 		camel_exception_free (ex);
 			
-		dbus_message_append_args (return_val, DBUS_TYPE_STRING, err, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_get_service") == 0) {
 		char *session_str, *url_string, *err;
@@ -185,7 +186,7 @@
 		camel_exception_free (ex);
 			
 /*verify and fix this*/	
-		dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, err, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_alert_user") == 0) {
 		char *session_str, *prompt, *err = NULL;
@@ -201,7 +202,7 @@
 		
 		response = camel_session_alert_user (session, alert, prompt, cancel);
 
-		dbus_message_append_args (return_val, DBUS_TYPE_INT32, response, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_build_password_prompt") == 0) {
 		gboolean ret;
@@ -215,7 +216,7 @@
 		
 		prompt = camel_session_build_password_prompt (type, user, host);
 
-		dbus_message_append_args (return_val, DBUS_TYPE_STRING, prompt, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &prompt, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_is_online") == 0) {
 		gboolean ret, is_online;
@@ -227,7 +228,7 @@
 		
 		is_online = camel_session_is_online (session);
 
-		dbus_message_append_args (return_val, DBUS_TYPE_INT32, is_online, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &is_online, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_set_online") == 0) {
 		gboolean ret, set;
@@ -252,7 +253,7 @@
 		
 		check_junk = camel_session_check_junk (session);
 
-		dbus_message_append_args (return_val, DBUS_TYPE_INT32, check_junk, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &check_junk, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_set_check_junk") == 0) {
 		gboolean ret, set_check;
@@ -267,6 +268,31 @@
 
 		dbus_message_append_args (return_val, DBUS_TYPE_INVALID);
 		g_free (err);
+	} else if (strcmp (method, "camel_session_get_network_state") == 0) {
+		gboolean ret, network_state;
+		char *session_str, *err = NULL;
+		
+		ret = dbus_message_get_args(message, NULL,
+				DBUS_TYPE_STRING, &session_str,
+				DBUS_TYPE_INVALID);
+		
+		network_state = camel_session_get_network_state (session);
+
+		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &network_state, DBUS_TYPE_INVALID);
+		g_free (err);
+	} else if (strcmp (method, "camel_session_set_network_state") == 0) {
+		gboolean ret, set_network;
+		char *session_str, *err = NULL;
+		
+		ret = dbus_message_get_args(message, NULL,
+				DBUS_TYPE_STRING, &session_str,
+				DBUS_TYPE_INT32, &set_network,
+				DBUS_TYPE_INVALID);
+		
+		camel_session_set_online (session, set_network);
+
+		dbus_message_append_args (return_val, DBUS_TYPE_INVALID);
+		g_free (err);
 	}
 
 

Modified: branches/mail-dbus-remoting/mail/camel-session-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.c	Tue Aug 26 08:12:16 2008
@@ -337,3 +337,57 @@
 
 	return;
 }
+
+gboolean 
+camel_session_remote_get_network_state (CamelSessionRemote *session)
+{
+	gboolean ret, network_state;
+	DBusError error;
+
+	dbus_error_init (&error);
+	/* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+	ret = dbind_context_method_call (evolution_dbus_peek_context(), 
+			CAMEL_DBUS_NAME,
+			CAMEL_SESSION_OBJECT_PATH,
+			CAMEL_SESSION_INTERFACE,
+			"camel_session_get_network_state",
+			&error, 
+			"s=>i", session->object_id, &network_state);
+
+	if (!ret) {
+		g_warning ("Error: Camel session check for network state: %s\n", error.message);
+		return 0;
+	}
+
+	d(printf("Camel session check for network state remotely\n"));
+
+	return network_state;
+}
+
+void 
+camel_session_remote_set_network_state  (CamelSessionRemote *session,
+				     	gboolean network_state)
+{
+	gboolean ret;
+	DBusError error;
+
+	dbus_error_init (&error);
+	/* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+	ret = dbind_context_method_call (evolution_dbus_peek_context(), 
+			CAMEL_DBUS_NAME,
+			CAMEL_SESSION_OBJECT_PATH,
+			CAMEL_SESSION_INTERFACE,
+			"camel_session_set_network_state",
+			&error, 
+			"ss", session->object_id, network_state);
+
+	if (!ret) {
+		g_warning ("Error: Camel session set network state: %s\n", error.message);
+		return;
+	}
+
+	d(printf("Camel session set check network state remotely\n"));
+
+	return;
+}
+

Modified: branches/mail-dbus-remoting/mail/camel-session-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.h	(original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.h	Tue Aug 26 08:12:16 2008
@@ -50,5 +50,11 @@
 
 
 void camel_session_remote_set_check_junk (CamelSessionRemote *session,
-				   gboolean check_junk);
+				   	gboolean check_junk);
+
+gboolean camel_session_remote_get_network_state (CamelSessionRemote *session);
+
+void camel_session_remote_set_network_state  (CamelSessionRemote *session,
+				     	gboolean network_state);
+
 



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