Mercurial > pidgin
diff finch/gntrequest.c @ 32771:52fb2e955198
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 6ee8e5cba5c96a1f2171038180b636724b258817)
to branch 'im.pidgin.pidgin' (head 92cc5e21737e6702460525c581295fdd26a2380f)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 13 Apr 2012 07:39:04 +0000 |
parents | 03dcb0185c82 |
children |
line wrap: on
line diff
--- a/finch/gntrequest.c Fri Apr 13 07:38:01 2012 +0000 +++ b/finch/gntrequest.c Fri Apr 13 07:39:04 2012 +0000 @@ -41,12 +41,6 @@ #include "debug.h" #include "util.h" -/* XXX: Until gobjectification ... */ -#undef FINCH_GET_DATA -#undef FINCH_SET_DATA -#define FINCH_GET_DATA(obj) purple_request_field_get_ui_data(obj) -#define FINCH_SET_DATA(obj, data) purple_request_field_set_ui_data(obj, data) - typedef struct { void *user_data; @@ -323,26 +317,26 @@ continue; if (type == PURPLE_REQUEST_FIELD_BOOLEAN) { - GntWidget *check = FINCH_GET_DATA(field); + GntWidget *check = purple_request_field_get_ui_data(field); gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); purple_request_field_bool_set_value(field, value); } else if (type == PURPLE_REQUEST_FIELD_STRING) { - GntWidget *entry = FINCH_GET_DATA(field); + GntWidget *entry = purple_request_field_get_ui_data(field); const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); purple_request_field_string_set_value(field, (text && *text) ? text : NULL); } else if (type == PURPLE_REQUEST_FIELD_INTEGER) { - GntWidget *entry = FINCH_GET_DATA(field); + GntWidget *entry = purple_request_field_get_ui_data(field); const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); int value = (text && *text) ? atoi(text) : 0; purple_request_field_int_set_value(field, value); } else if (type == PURPLE_REQUEST_FIELD_CHOICE) { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); int id; id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); purple_request_field_choice_set_value(field, id); @@ -352,7 +346,7 @@ GList *list = NULL, *iter; if (purple_request_field_list_get_multi_select(field)) { - GntWidget *tree = FINCH_GET_DATA(field); + GntWidget *tree = purple_request_field_get_ui_data(field); iter = purple_request_field_list_get_items(field); for (; iter; iter = iter->next) @@ -365,7 +359,7 @@ } else { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); iter = purple_request_field_list_get_items(field); @@ -384,7 +378,7 @@ } else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) { - GntWidget *combo = FINCH_GET_DATA(field); + GntWidget *combo = purple_request_field_get_ui_data(field); PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); purple_request_field_account_set_value(field, acc); } @@ -577,6 +571,22 @@ return combo; } +static GntWidget* +create_certificate_field(PurpleRequestField *field) +{ + GntWidget *w; + PurpleCertificate *cert; + char *str; + + cert = purple_request_field_certificate_get_value(field); + str = purple_certificate_get_display_string(cert); + w = gnt_label_new(str); + + g_free(str); + + return w; +} + static void * finch_request_fields(const char *title, const char *primary, const char *secondary, PurpleRequestFields *allfields, @@ -633,36 +643,40 @@ if (type == PURPLE_REQUEST_FIELD_BOOLEAN) { - FINCH_SET_DATA(field, create_boolean_field(field)); + purple_request_field_set_ui_data(field, create_boolean_field(field)); } else if (type == PURPLE_REQUEST_FIELD_STRING) { - FINCH_SET_DATA(field, create_string_field(field, &username)); + purple_request_field_set_ui_data(field, create_string_field(field, &username)); } else if (type == PURPLE_REQUEST_FIELD_INTEGER) { - FINCH_SET_DATA(field, create_integer_field(field)); + purple_request_field_set_ui_data(field, create_integer_field(field)); } else if (type == PURPLE_REQUEST_FIELD_CHOICE) { - FINCH_SET_DATA(field, create_choice_field(field)); + purple_request_field_set_ui_data(field, create_choice_field(field)); } else if (type == PURPLE_REQUEST_FIELD_LIST) { - FINCH_SET_DATA(field, create_list_field(field)); + purple_request_field_set_ui_data(field, create_list_field(field)); } else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) { accountlist = create_account_field(field); - FINCH_SET_DATA(field, accountlist); + purple_request_field_set_ui_data(field, accountlist); + } + else if (type == PURPLE_REQUEST_FIELD_CERTIFICATE) + { + purple_request_field_set_ui_data(field, create_certificate_field(field)); } else { - FINCH_SET_DATA(field, gnt_label_new_with_format(_("Not implemented yet."), + purple_request_field_set_ui_data(field, gnt_label_new_with_format(_("Not implemented yet."), GNT_TEXT_FLAG_BOLD)); } gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); - gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field))); + gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(purple_request_field_get_ui_data(field))); } if (grlist->next) gnt_box_add_widget(GNT_BOX(box), gnt_hline_new());