/dev/tomkiewicz/e2ee: 641bff383b0a: Request API: replace purple_...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Wed Oct 23 14:50:37 EDT 2013
Changeset: 641bff383b0aeff018a361560fcb4f349b483840
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2013-10-23 20:50 +0200
Branch: default
URL: https://hg.pidgin.im/dev/tomkiewicz/e2ee/rev/641bff383b0a
Description:
Request API: replace purple_request_field_string_set_editable with purple_request_field_set_sensitive
diffstat:
libpurple/plugins/perl/common/Request.xs | 9 ---------
libpurple/protocols/mxit/actions.c | 2 +-
libpurple/protocols/mxit/login.c | 2 +-
libpurple/request.c | 21 ---------------------
libpurple/request.h | 18 ------------------
pidgin/gtkrequest.c | 14 ++++++++------
6 files changed, 10 insertions(+), 56 deletions(-)
diffs (183 lines):
diff --git a/libpurple/plugins/perl/common/Request.xs b/libpurple/plugins/perl/common/Request.xs
--- a/libpurple/plugins/perl/common/Request.xs
+++ b/libpurple/plugins/perl/common/Request.xs
@@ -487,10 +487,6 @@ purple_request_field_string_get_value(fi
Purple::Request::Field field
gboolean
-purple_request_field_string_is_editable(field)
- Purple::Request::Field field
-
-gboolean
purple_request_field_string_is_masked(field)
Purple::Request::Field field
@@ -504,11 +500,6 @@ purple_request_field_string_set_default_
const char *default_value
void
-purple_request_field_string_set_editable(field, editable)
- Purple::Request::Field field
- gboolean editable
-
-void
purple_request_field_string_set_masked(field, masked)
Purple::Request::Field field
gboolean masked
diff --git a/libpurple/protocols/mxit/actions.c b/libpurple/protocols/mxit/actions.c
--- a/libpurple/protocols/mxit/actions.c
+++ b/libpurple/protocols/mxit/actions.c
@@ -239,7 +239,7 @@ static void mxit_profile_action( PurpleP
field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE );
purple_request_field_group_add_field( public_group, field );
if ( profile->flags & CP_PROF_DOBLOCKED )
- purple_request_field_string_set_editable( field, FALSE );
+ purple_request_field_set_sensitive( field, FALSE );
/* gender */
field = purple_request_field_choice_new( "male", _( "Gender" ), GINT_TO_POINTER(profile->male ? 1 : 0));
diff --git a/libpurple/protocols/mxit/login.c b/libpurple/protocols/mxit/login.c
--- a/libpurple/protocols/mxit/login.c
+++ b/libpurple/protocols/mxit/login.c
@@ -338,7 +338,7 @@ static void mxit_register_view( struct M
/* mxit login name */
field = purple_request_field_string_new( "loginname", _( "MXit ID" ), purple_account_get_username( session->acc ), FALSE );
- purple_request_field_string_set_editable( field, FALSE );
+ purple_request_field_set_sensitive( field, FALSE );
purple_request_field_group_add_field( group, field );
/* nick name (required) */
diff --git a/libpurple/request.c b/libpurple/request.c
--- a/libpurple/request.c
+++ b/libpurple/request.c
@@ -62,7 +62,6 @@ struct _PurpleRequestField
{
gboolean multiline;
gboolean masked;
- gboolean editable;
char *default_value;
char *value;
@@ -1168,7 +1167,6 @@ purple_request_field_string_new(const ch
field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_STRING);
field->u.string.multiline = multiline;
- field->u.string.editable = TRUE;
purple_request_field_string_set_default_value(field, default_value);
purple_request_field_string_set_value(field, default_value);
@@ -1208,16 +1206,6 @@ purple_request_field_string_set_masked(P
field->u.string.masked = masked;
}
-void
-purple_request_field_string_set_editable(PurpleRequestField *field,
- gboolean editable)
-{
- g_return_if_fail(field != NULL);
- g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING);
-
- field->u.string.editable = editable;
-}
-
const char *
purple_request_field_string_get_default_value(const PurpleRequestField *field)
{
@@ -1254,15 +1242,6 @@ purple_request_field_string_is_masked(co
return field->u.string.masked;
}
-gboolean
-purple_request_field_string_is_editable(const PurpleRequestField *field)
-{
- g_return_val_if_fail(field != NULL, FALSE);
- g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE);
-
- return field->u.string.editable;
-}
-
PurpleRequestField *
purple_request_field_int_new(const char *id, const char *text,
int default_value, int lower_bound, int upper_bound)
diff --git a/libpurple/request.h b/libpurple/request.h
--- a/libpurple/request.h
+++ b/libpurple/request.h
@@ -968,15 +968,6 @@ void purple_request_field_string_set_mas
gboolean masked);
/**
- * Sets whether or not a string field is editable.
- *
- * @param field The field.
- * @param editable The editable value.
- */
-void purple_request_field_string_set_editable(PurpleRequestField *field,
- gboolean editable);
-
-/**
* Returns the default value in a string field.
*
* @param field The field.
@@ -1013,15 +1004,6 @@ gboolean purple_request_field_string_is_
*/
gboolean purple_request_field_string_is_masked(const PurpleRequestField *field);
-/**
- * Returns whether or not a string field is editable.
- *
- * @param field The field.
- *
- * @return @c TRUE if the field is editable, or @c FALSE otherwise.
- */
-gboolean purple_request_field_string_is_editable(const PurpleRequestField *field);
-
/*@}*/
/**************************************************************************/
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1087,10 +1087,14 @@ req_field_changed_cb(GtkWidget *widget,
for (; it != NULL; it = g_list_next(it)) {
PurpleRequestField *field = it->data;
GtkWidget *widget = purple_request_field_get_ui_data(field);
+ gboolean sensitive;
- gtk_widget_set_sensitive(widget,
- purple_request_field_is_sensitive(field));
- /* TODO: string fields and set_editable */
+ sensitive = purple_request_field_is_sensitive(field);
+ gtk_widget_set_sensitive(widget, sensitive);
+
+ /* XXX: and what about multiline? */
+ if (GTK_IS_EDITABLE(widget))
+ gtk_editable_set_editable(GTK_EDITABLE(widget), sensitive);
}
}
@@ -1149,7 +1153,7 @@ create_string_field(PurpleRequestField *
gboolean is_editable;
value = purple_request_field_string_get_default_value(field);
- is_editable = purple_request_field_string_is_editable(field);
+ is_editable = purple_request_field_is_sensitive(field);
if (purple_request_field_string_is_multiline(field))
{
@@ -1178,7 +1182,6 @@ create_string_field(PurpleRequestField *
gtk_widget_set_tooltip_text(textview, purple_request_field_get_tooltip(field));
gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), is_editable);
- gtk_widget_set_sensitive(textview, is_editable);
g_signal_connect(G_OBJECT(textview), "focus-out-event",
G_CALLBACK(field_string_focus_out_cb), field);
@@ -1209,7 +1212,6 @@ create_string_field(PurpleRequestField *
}
gtk_editable_set_editable(GTK_EDITABLE(widget), is_editable);
- gtk_widget_set_sensitive(widget, is_editable);
g_signal_connect(G_OBJECT(widget), "focus-out-event",
G_CALLBACK(field_string_focus_out_cb), field);
More information about the Commits
mailing list