changeset 15264:a46c40c7a0e9

[gaim-migrate @ 18053] Added setters and manipulators for GaimNotifyUserInfo and GaimNotifyUserInfoEntry, and fixed the declared parameters to the 'displaying-userinfo' signal committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Tue, 26 Dec 2006 02:42:54 +0000
parents dfaad00e60dd
children 0a41469d6440
files libgaim/notify.c libgaim/notify.h
diffstat 2 files changed, 98 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/notify.c	Tue Dec 26 02:01:15 2006 +0000
+++ b/libgaim/notify.c	Tue Dec 26 02:42:54 2006 +0000
@@ -580,6 +580,18 @@
 	return user_info_entry->label;
 }
 
+void
+gaim_notify_user_info_entry_set_label(GaimNotifyUserInfoEntry *user_info_entry, const char *label)
+{
+	g_return_if_fail(user_info_entry != NULL);
+
+	if (label != user_info_entry->label)
+	{
+		g_free(user_info_entry->label);
+		user_info_entry->label = g_strdup(label);
+	}
+}
+
 gchar *
 gaim_notify_user_info_entry_get_value(GaimNotifyUserInfoEntry *user_info_entry)
 {
@@ -589,6 +601,34 @@
 }
 
 void
+gaim_notify_user_info_entry_set_value(GaimNotifyUserInfoEntry *user_info_entry, const char *value)
+{
+	g_return_if_fail(user_info_entry != NULL);
+
+	if (value != user_info_entry->value)
+	{
+		g_free(user_info_entry->value);
+		user_info_entry->value = g_strdup(value);
+	}
+}
+
+GaimNotifyUserInfoEntryType
+gaim_notify_user_info_entry_get_type(GaimNotifyUserInfoEntry *user_info_entry)
+{
+	g_return_val_if_fail(user_info_entry != NULL, NULL);
+	
+	return user_info_entry->type;
+}
+
+void
+gaim_notify_user_info_entry_set_value(GaimNotifyUserInfoEntry *user_info_entry, GaimNotifyUserInfoEntryType type)
+{
+	g_return_if_fail(user_info_entry != NULL);
+
+	user_info_entry->type = type;
+}
+
+void
 gaim_notify_user_info_add_pair(GaimNotifyUserInfo *user_info, const char *label, const char *value)
 {
 	GaimNotifyUserInfoEntry *entry;
@@ -755,7 +795,8 @@
 						 gaim_value_new(GAIM_TYPE_SUBTYPE,
 										GAIM_SUBTYPE_ACCOUNT),
 						 gaim_value_new(GAIM_TYPE_STRING),
-						 gaim_value_new_outgoing(GAIM_TYPE_STRING));
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_USERINFO));
 }
 
 void
--- a/libgaim/notify.h	Tue Dec 26 02:01:15 2006 +0000
+++ b/libgaim/notify.h	Tue Dec 26 02:42:54 2006 +0000
@@ -444,6 +444,10 @@
 /**
  * Retrieve the array of GaimNotifyUserInfoEntry objects from a GaimNotifyUserInfo
  *
+ * This GList may be manipulated directly with normal GList functions such as g_list_insert(). Only 
+ * GaimNotifyUserInfoEntry are allowed in the list.  If a GaimNotifyUserInfoEntry item is added to the list,
+ * it should not be g_free()'d by the caller; GaimNotifyUserInfo will g_free it when destroyed.
+ *
  * @param user_info          The GaimNotifyUserInfo
  *
  * @result                   A GList of GaimNotifyUserInfoEntry objects
@@ -483,6 +487,23 @@
 void gaim_notify_user_info_prepend_pair(GaimNotifyUserInfo *user_info, const char *label, const char *value);
 
 /**
+ * Create a new GaimNotifyUserInfoEntry
+ *
+ * If added to a GaimNotifyUserInfo object, this should not be free()'d, as GaimNotifyUserInfo will do so
+ * when destroyed.  gaim_notify_user_info_add_pair() and gaim_notify_user_info_prepend_pair() are convenience
+ * methods for creating entries and adding them to a GaimNotifyUserInfo.
+ *
+ * @param label              A label, which for example might be displayed by a UI with a colon after it ("Status:"). Do not include a colon.
+ *                           If NULL, value will be displayed without a label.
+ * @param value              The value, which might be displayed by a UI after the label.
+ *                           If NULL, label will still be displayed; the UI should then treat label as independent
+ *                           and not include a colon if it would otherwise.
+ *
+ * @result A new GaimNotifyUserInfoEntry
+ */
+GaimNotifyUserInfoEntry *gaim_notify_user_info_entry_new(const char *label, const char *value);
+
+/**
  * Add a section break.  A UI might display this as a horizontal line.
  *
  * @param user_info          The GaimNotifyUserInfo
@@ -512,6 +533,14 @@
 gchar *gaim_notify_user_info_entry_get_label(GaimNotifyUserInfoEntry *user_info_entry);
 
 /**
+ * Set the label for a GaimNotifyUserInfoEntry
+ *
+ * @param user_info_entry     The GaimNotifyUserInfoEntry
+ * @param label			      The label
+ */
+void gaim_notify_user_info_entry_set_label(GaimNotifyUserInfoEntry *user_info_entry, const char *label);
+
+/**
  * Get the value for a GaimNotifyUserInfoEntry
  *
  * @param user_info_entry     The GaimNotifyUserInfoEntry
@@ -521,6 +550,33 @@
 gchar *gaim_notify_user_info_entry_get_value(GaimNotifyUserInfoEntry *user_info_entry);
 
 /**
+ * Set the value for a GaimNotifyUserInfoEntry
+ *
+ * @param user_info_entry     The GaimNotifyUserInfoEntry
+ * @param value				  The value
+ */
+void gaim_notify_user_info_entry_set_value(GaimNotifyUserInfoEntry *user_info_entry, const char *value);
+
+
+/**
+ * Get the type of a GaimNotifyUserInfoEntry
+ *
+ * @param user_info_entry     The GaimNotifyUserInfoEntry
+ *
+ * @result					  The GaimNotifyUserInfoEntryType
+ */
+GaimNotifyUserInfoEntryType gaim_notify_user_info_entry_get_type(GaimNotifyUserInfoEntry *user_info_entry);
+
+/**
+ * Set the type of a GaimNotifyUserInfoEntry
+ *
+ * @param user_info_entry     The GaimNotifyUserInfoEntry
+ * @param					  The GaimNotifyUserInfoEntryType
+ */
+void gaim_notify_user_info_entry_set_type(GaimNotifyUserInfoEntry *user_info_entry,
+										  GaimNotifyUserInfoEntryType type);
+
+/**
  * Opens a URI or somehow presents it to the user.
  *
  * @param handle The plugin or connection handle.