/pidgin/main: df8af87d4424: Pidgin: validate username in buddy a...
Tomasz Wasilczyk
tomkiewicz at cpw.pidgin.im
Sun Jul 15 12:40:46 EDT 2012
Changeset: df8af87d44242b80891a932def09cc4adddaf9e8
Author: Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date: 2012-07-15 18:40 +0200
Branch: default
URL: http://hg.pidgin.im/pidgin/main/rev/df8af87d4424
Description:
Pidgin: validate username in buddy adding dialog
diffstat:
pidgin/gtkblist.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diffs (71 lines):
diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
--- a/pidgin/gtkblist.c
+++ b/pidgin/gtkblist.c
@@ -898,7 +898,7 @@
* strings are empty then don't allow the user to click on "OK."
*/
static void
-set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
+set_sensitive_if_input_chat_cb(GtkWidget *entry, gpointer user_data)
{
PurplePluginProtocolInfo *prpl_info;
PurpleConnection *gc;
@@ -931,6 +931,21 @@
}
static void
+set_sensitive_if_input_buddy_cb(GtkWidget *entry, gpointer user_data)
+{
+ PurplePlugin *prpl;
+ PidginAddBuddyData *data = user_data;
+ const char *text;
+
+ prpl = purple_find_prpl(purple_account_get_protocol_id(
+ data->rq_data.account));
+ text = gtk_entry_get_text(GTK_ENTRY(entry));
+
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window),
+ GTK_RESPONSE_OK, purple_validate(prpl, text));
+}
+
+static void
pidgin_blist_update_privacy_cb(PurpleBuddy *buddy)
{
struct _pidgin_blist_node *ui_data = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
@@ -1093,7 +1108,7 @@
}
pidgin_add_widget_to_vbox(data->rq_data.vbox, pce->label, data->rq_data.sg, input, TRUE, NULL);
g_signal_connect(G_OBJECT(input), "changed",
- G_CALLBACK(set_sensitive_if_input_cb), data);
+ G_CALLBACK(set_sensitive_if_input_chat_cb), data);
}
/* Do the following for any type of input widget */
@@ -1114,7 +1129,7 @@
g_hash_table_destroy(defaults);
/* Set whether the "OK" button should be clickable initially */
- set_sensitive_if_input_cb(NULL, data);
+ set_sensitive_if_input_chat_cb(NULL, data);
gtk_widget_show_all(GTK_WIDGET(data->rq_data.vbox));
}
@@ -7054,6 +7069,7 @@
invite_enabled = FALSE;
gtk_widget_set_sensitive(data->entry_for_invite, invite_enabled);
+ set_sensitive_if_input_buddy_cb(data->entry, data);
}
static void
@@ -7179,8 +7195,8 @@
gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
g_signal_connect(G_OBJECT(data->entry), "changed",
- G_CALLBACK(pidgin_set_sensitive_if_input),
- data->rq_data.window);
+ G_CALLBACK(set_sensitive_if_input_buddy_cb),
+ data);
data->entry_for_alias = gtk_entry_new();
pidgin_add_widget_to_vbox(data->rq_data.vbox, _("(Optional) A_lias:"),
More information about the Commits
mailing list