pidgin: 6c35eb28: gtkrequest: Handle a multiline text fiel...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Fri Jan 22 23:01:23 EST 2010
-----------------------------------------------------------------
Revision: 6c35eb289b2e2af14435d1da40f4f0001afcba6e
Ancestor: 03816da05484733897f0207bba09a143085f8631
Author: darkrain42 at pidgin.im
Date: 2010-01-23T03:56:35
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6c35eb289b2e2af14435d1da40f4f0001afcba6e
Modified files:
ChangeLog pidgin/gtkrequest.c
ChangeLog:
gtkrequest: Handle a multiline text field being set as required properly.
The GtkTextView wasn't having setup_entry_field() called on it, which
listens for the changed signal if the field is required. The result was
that it was impossible to submit such a form because Pidgin never thought
it was sufficiently filled in.
-------------- next part --------------
============================================================
--- ChangeLog 38a4c64cb47e8c3853ffa22d8c15f22296282012
+++ ChangeLog 63b87bc6999ae39fb08930ca61e9b9f55f7a85a0
@@ -31,6 +31,8 @@ version 2.6.6 (??/??/20??):
Pidgin:
* Correctly size conversation and status box entries when the
interior-focus style property is diabled. (Gabriel Schulhof)
+ * Correctly handle a multiline text field being required in a
+ request form. (Thanks to Florian Zeitz for finding this problem)
version 2.6.5 (01/08/2010):
libpurple:
============================================================
--- pidgin/gtkrequest.c 9f3195f34e3f8fe3ea4e7c33bfa660b56a7115d6
+++ pidgin/gtkrequest.c f14c8a6d483e4817e61ccc7ea53e69ff4573c71c
@@ -719,10 +719,24 @@ req_entry_field_changed_cb(GtkWidget *en
{
PurpleRequestFieldGroup *group;
PidginRequestData *req_data;
- const char *text = gtk_entry_get_text(GTK_ENTRY(entry));
+ const char *text = NULL;
- purple_request_field_string_set_value(field, (*text == '\0' ? NULL : text));
+ if (purple_request_field_string_is_multiline(field))
+ {
+ GtkTextIter start_iter, end_iter;
+ gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(entry), &start_iter);
+ gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(entry), &end_iter);
+
+ text = gtk_text_buffer_get_text(GTK_TEXT_BUFFER(entry), &start_iter, &end_iter, FALSE);
+ }
+ else
+ {
+ text = gtk_entry_get_text(GTK_ENTRY(entry));
+ }
+
+ purple_request_field_string_set_value(field, (*text == '\0') ? NULL : text);
+
group = purple_request_field_get_group(field);
req_data = (PidginRequestData *)group->fields_list->ui_data;
@@ -824,6 +838,13 @@ create_string_field(PurpleRequestField *
g_signal_connect(G_OBJECT(textview), "focus-out-event",
G_CALLBACK(field_string_focus_out_cb), field);
+
+ if (purple_request_field_is_required(field))
+ {
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
+ g_signal_connect(G_OBJECT(buffer), "changed",
+ G_CALLBACK(req_entry_field_changed_cb), field);
+ }
}
else
{
More information about the Commits
mailing list