changeset 7904:9b478c6e0bfa

[gaim-migrate @ 8564] Added support for invisible fields. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 21 Dec 2003 08:57:56 +0000
parents d91806e4ea64
children 1d0bc32f8038
files src/gtkrequest.c src/request.c src/request.h
diffstat 3 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkrequest.c	Sun Dec 21 08:52:38 2003 +0000
+++ b/src/gtkrequest.c	Sun Dec 21 08:57:56 2003 +0000
@@ -834,6 +834,9 @@
 
 				field = fl->data;
 
+				if (!gaim_request_field_is_visible(field))
+					continue;
+
 				type = gaim_request_field_get_type(field);
 
 				if (type != GAIM_REQUEST_FIELD_BOOLEAN)
@@ -880,6 +883,8 @@
 					widget = create_choice_field(field);
 				else if (type == GAIM_REQUEST_FIELD_LIST)
 					widget = create_list_field(field);
+				else
+					continue;
 
 				if (type == GAIM_REQUEST_FIELD_STRING &&
 					gaim_request_field_string_is_multiline(field))
--- a/src/request.c	Sun Dec 21 08:52:38 2003 +0000
+++ b/src/request.c	Sun Dec 21 08:57:56 2003 +0000
@@ -254,6 +254,7 @@
 	field->type = type;
 
 	gaim_request_field_set_label(field, text);
+	gaim_request_field_set_visible(field, TRUE);
 
 	return field;
 }
@@ -314,6 +315,14 @@
 	field->label = (label == NULL ? NULL : g_strdup(label));
 }
 
+void
+gaim_request_field_set_visible(GaimRequestField *field, gboolean visible)
+{
+	g_return_if_fail(field != NULL);
+
+	field->visible = visible;
+}
+
 GaimRequestFieldType
 gaim_request_field_get_type(const GaimRequestField *field)
 {
@@ -338,6 +347,14 @@
 	return field->label;
 }
 
+gboolean
+gaim_request_field_is_visible(const GaimRequestField *field)
+{
+	g_return_val_if_fail(field != NULL, FALSE);
+
+	return field->visible;
+}
+
 GaimRequestField *
 gaim_request_field_string_new(const char *id, const char *text,
 							  const char *default_value, gboolean multiline)
--- a/src/request.h	Sun Dec 21 08:52:38 2003 +0000
+++ b/src/request.h	Sun Dec 21 08:57:56 2003 +0000
@@ -63,6 +63,8 @@
 	char *id;
 	char *label;
 
+	gboolean visible;
+
 	union
 	{
 		struct
@@ -355,6 +357,14 @@
 void gaim_request_field_set_label(GaimRequestField *field, const char *label);
 
 /**
+ * Sets whether or not a field is visible.
+ *
+ * @param field  The field.
+ * @param visible TRUE if visible, or FALSE if not.
+ */
+void gaim_request_field_set_visible(GaimRequestField *field, gboolean visible);
+
+/**
  * Returns the type of a field.
  *
  * @param field The field.
@@ -381,6 +391,15 @@
  */
 const char *gaim_request_field_get_label(const GaimRequestField *field);
 
+/**
+ * Returns whether or not a field is visible.
+ *
+ * @param field The field.
+ *
+ * @return TRUE if the field is visible. FALSE otherwise.
+ */
+gboolean gaim_request_field_is_visible(const GaimRequestField *field);
+
 /*@}*/
 
 /**************************************************************************/