cpw.nader.asynclogging-3: bbbce3f1: More code cleanup!

morshed.nader at gmail.com morshed.nader at gmail.com
Mon May 16 22:15:47 EDT 2011


----------------------------------------------------------------------
Revision: bbbce3f1e8f8bb9db5ca5e0d3d5d4d76ad3f3550
Parent:   d02f6040790861f0cc5fc68db64fa8c10e569070
Author:   morshed.nader at gmail.com
Date:     05/16/11 22:09:10
Branch:   im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/bbbce3f1e8f8bb9db5ca5e0d3d5d4d76ad3f3550

Changelog: 

More code cleanup!
Got rid of a few of the /* XXX: ... */ in log.c and made g_object_notify_by_pspec be used when available
Cleaned up log.h's section headers

Changes against parent d02f6040790861f0cc5fc68db64fa8c10e569070

  patched  libpurple/log.c
  patched  libpurple/log.h

-------------- next part --------------
============================================================
--- libpurple/log.c	48da8b5505668d4ea023241288e22c3fa91fe9d1
+++ libpurple/log.c	7d92e3a461ffc04f55d764845742233ac4c2a94c
@@ -400,8 +400,11 @@ purple_log_set_chat_type(PurpleLog *log,
 
 	PURPLE_LOG_GET_PRIVATE(log)->chat_type = chat_type;
 
+#if GLIB_CHECK_VERSION(2, 26, 0)
+	g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CHAT_TYPE]);
+#else
 	g_object_notify(G_OBJECT(log), "chat-type");
-	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CHAT_TYPE]); */
+#endif
 }
 
 static void
@@ -412,8 +415,11 @@ purple_log_set_name(PurpleLog *log, cons
 
 	PURPLE_LOG_GET_PRIVATE(log)->name = g_strdup(name);
 
+#if GLIB_CHECK_VERSION(2, 26, 0)
+	g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_NAME]);
+#else
 	g_object_notify(G_OBJECT(log), "name");
-	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_NAME]); */
+#endif
 }
 
 static void
@@ -425,8 +431,11 @@ purple_log_set_account(PurpleLog *log, P
 
 	PURPLE_LOG_GET_PRIVATE(log)->account = account; /* XXX: g_object_ref */
 
+#if GLIB_CHECK_VERSION(2, 26, 0)
+	g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_ACCOUNT]);
+#else
 	g_object_notify(G_OBJECT(log), "account");
-	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_ACCOUNT]); */
+#endif
 }
 
 static void
@@ -437,8 +446,11 @@ purple_log_set_conversation(PurpleLog *l
 
 	PURPLE_LOG_GET_PRIVATE(log)->conversation = conversation; /* XXX: g_object_ref */
 
+#if GLIB_CHECK_VERSION(2, 26, 0)
+	g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CONVERSATION]);
+#else
 	g_object_notify(G_OBJECT(log), "conversation");
-	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CONVERSATION]); */
+#endif
 }
 
 static void
@@ -448,8 +460,11 @@ purple_log_set_time(PurpleLog *log, time
 
 	PURPLE_LOG_GET_PRIVATE(log)->time = log_time;
 
+#if GLIB_CHECK_VERSION(2, 26, 0)
+	g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TIME]);
+#else
 	g_object_notify(G_OBJECT(log), "time");
-	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TIME]); */
+#endif
 }
 
 static void
@@ -484,8 +499,11 @@ purple_log_set_tm(PurpleLog *log, struct
 #endif
 	}
 
+#if GLIB_CHECK_VERSION(2, 26, 0)
+	g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TM]);
+#else
 	g_object_notify(G_OBJECT(log), "tm");
-	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TM]); */
+#endif
 }
 
 PurpleLogChatType
@@ -2230,31 +2248,6 @@ purple_log_get_log_dir(PurpleLogChatType
 	return dir;
 }
 
-GList *
-purple_log_list_copy(GList *list)
-{
-	if (list == NULL)
-		return NULL;
-
-	g_list_foreach(list, (GFunc) g_object_ref, NULL);
-
-	return g_list_copy(list);
-}
-
-void
-purple_log_list_free(GList *list)
-{
-	if (list == NULL)
-		return;
-
-	g_list_foreach(list, (GFunc) g_object_unref, NULL);
-	g_list_free(list);
-}
-
-/****************************************************************************
- * LOGGER FUNCTIONS *********************************************************
- ****************************************************************************/
-
 static void
 logger_pref_cb(const gchar *name, PurplePrefType type, gconstpointer value,
 	gpointer data)
@@ -2455,7 +2448,28 @@ _purple_log_add_log_set_to_hash(GHashTab
 		purple_log_set_free(set);
 }
 
+GList *
+purple_log_list_copy(GList *list)
+{
+	if (list == NULL)
+		return NULL;
+
+	g_list_foreach(list, (GFunc) g_object_ref, NULL);
+
+	return g_list_copy(list);
+}
+
 void
+purple_log_list_free(GList *list)
+{
+	if (list == NULL)
+		return;
+
+	g_list_foreach(list, (GFunc) g_object_unref, NULL);
+	g_list_free(list);
+}
+
+void
 purple_log_set_free(PurpleLogSet *set)
 {
 	g_return_if_fail(set != NULL);
============================================================
--- libpurple/log.h	3bf31a6bd648f5d2eb65bf56e8599cd8359bbae8
+++ libpurple/log.h	0e50e86f6cde6fba595b05c623e510bdae0bfb39
@@ -60,9 +60,9 @@ GType purple_struct_tm_get_type(void);
 GType purple_struct_tm_get_type(void);
 
 
-/**************************************************************************/
-/* Enumerations                                                           */
-/**************************************************************************/
+/******************************************/
+/** @name Enumerations                    */
+/******************************************/
 
 /**
  * The log type
@@ -81,9 +81,9 @@ typedef enum {
 } PurpleLogReadFlags;
 
 
-/********************************************************
- * DATA STRUCTURES **************************************
- ********************************************************/
+/******************************************/
+/** @name Data Structures                 */
+/******************************************/
 
 /**
  * A log. Not the wooden type.
@@ -310,14 +310,14 @@ struct _PurpleLogSet {
 	void (*_purple_reserved4)(void);
 };
 
-/***************************************/
-/** @name Log Functions                */
-/***************************************/
+GType purple_log_get_type(void);
 
+/******************************************/
+/** @name Log Functions                   */
+/******************************************/
+
 /*@{*/
 
-GType purple_log_get_type(void);
-
 /**
  * Creates a new log
  *
@@ -1025,6 +1025,14 @@ gboolean purple_log_remove_finish(Purple
 gboolean purple_log_remove_finish(PurpleLog *log, GAsyncResult *res,
 	GError **error);
 
+/*@}*/
+
+/******************************************/
+/** @name Miscellaneous Logger Functions  */
+/******************************************/
+
+/*@{*/
+
 /**
  * Returns the default logger directory Purple uses for a given account
  * and username.  This would be where Purple stores logs created by
@@ -1040,44 +1048,44 @@ gchar *purple_log_get_log_dir(PurpleLogC
 	PurpleAccount *account);
 
 /**
- * Copies a GList of GObjects, g_object_ref'ing each member in the list
+ * Implements GCompareFunc for PurpleLog
  *
- * @param list         The list to copy
+ * @param y            A PurpleLog
+ * @param z            Another PurpleLog
  *
- * @return             The copied list
- *
- * @since 3.0.0
+ * @return             A value as specified by GCompareFunc
  */
-GList *purple_log_list_copy(GList *list);
+gint purple_log_compare(gconstpointer y, gconstpointer z);
 
 /**
- * Frees a GList of GObjects, ensuring to g_object_unref each member in the list
+ * Implements GCompareFunc for PurpleLogSet
  *
- * @param list         The list to free
+ * @param y            A PurpleLogSet
+ * @param z            Another PurpleLogSet
  *
- * @since 3.0.0
+ * @return             A value as specified by GCompareFunc
  */
-void purple_log_list_free(GList *list);
+gint purple_log_set_compare(gconstpointer y, gconstpointer z);
 
 /**
- * Implements GCompareFunc for PurpleLog
+ * Copies a GList of GObjects, g_object_ref'ing each member in the list
  *
- * @param y            A PurpleLog
- * @param z            Another PurpleLog
+ * @param list         The list to copy
  *
- * @return             A value as specified by GCompareFunc
+ * @return             The copied list
+ *
+ * @since 3.0.0
  */
-gint purple_log_compare(gconstpointer y, gconstpointer z);
+GList *purple_log_list_copy(GList *list);
 
 /**
- * Implements GCompareFunc for PurpleLogSet
+ * Frees a GList of GObjects, ensuring to g_object_unref each member in the list
  *
- * @param y            A PurpleLogSet
- * @param z            Another PurpleLogSet
+ * @param list         The list to free
  *
- * @return             A value as specified by GCompareFunc
+ * @since 3.0.0
  */
-gint purple_log_set_compare(gconstpointer y, gconstpointer z);
+void purple_log_list_free(GList *list);
 
 /**
  * Frees a log set
@@ -1141,9 +1149,9 @@ GList *purple_log_logger_get_options(voi
 
 /*@}*/
 
-/**************************************************************************/
-/** @name Log Subsystem                                                   */
-/**************************************************************************/
+/******************************************/
+/** @name Log Subsystem                   */
+/******************************************/
 
 /*@{*/
 


More information about the Commits mailing list