Mercurial > pidgin.yaz
comparison pidgin/gtkrequest.c @ 22795:42dfa1139b5c
merge of '21d37789f674809d615fc7676a092f1da438b0f5'
and 'aafbbc317ab5f69e31e0bb6cabc264bb70745ef2'
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Fri, 02 May 2008 22:51:14 +0000 |
parents | 862382aa6086 |
children | f10aba5592c6 5d681e194fb3 365b90fa23cf |
comparison
equal
deleted
inserted
replaced
22750:d5b3afea8764 | 22795:42dfa1139b5c |
---|---|
1118 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); | 1118 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); |
1119 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | 1119 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
1120 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | 1120 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
1121 gtk_widget_show(img); | 1121 gtk_widget_show(img); |
1122 | 1122 |
1123 /* Cancel button */ | |
1124 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data); | |
1125 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
1126 | |
1127 /* OK button */ | |
1128 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data); | |
1129 data->ok_button = button; | |
1130 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
1131 gtk_window_set_default(GTK_WINDOW(win), button); | |
1132 | |
1123 /* Setup the vbox */ | 1133 /* Setup the vbox */ |
1124 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); | 1134 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); |
1125 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); | 1135 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
1126 gtk_widget_show(vbox); | 1136 gtk_widget_show(vbox); |
1127 | 1137 |
1270 col_num++, fl = fl->next) | 1280 col_num++, fl = fl->next) |
1271 { | 1281 { |
1272 size_t col_offset = col_num * 2; | 1282 size_t col_offset = col_num * 2; |
1273 PurpleRequestFieldType type; | 1283 PurpleRequestFieldType type; |
1274 GtkWidget *widget = NULL; | 1284 GtkWidget *widget = NULL; |
1285 const char *field_label; | |
1275 | 1286 |
1276 label = NULL; | 1287 label = NULL; |
1277 field = fl->data; | 1288 field = fl->data; |
1278 | 1289 |
1279 if (!purple_request_field_is_visible(field)) { | 1290 if (!purple_request_field_is_visible(field)) { |
1280 col_num--; | 1291 col_num--; |
1281 continue; | 1292 continue; |
1282 } | 1293 } |
1283 | 1294 |
1284 type = purple_request_field_get_type(field); | 1295 type = purple_request_field_get_type(field); |
1285 | 1296 field_label = purple_request_field_get_label(field); |
1286 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && | 1297 |
1287 purple_request_field_get_label(field)) | 1298 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && field_label) |
1288 { | 1299 { |
1289 char *text; | 1300 char *text = NULL; |
1290 | 1301 |
1291 text = g_strdup_printf("%s:", | 1302 if (field_label[strlen(field_label) - 1] != ':') |
1292 purple_request_field_get_label(field)); | 1303 text = g_strdup_printf("%s:", field_label); |
1293 | 1304 |
1294 label = gtk_label_new(NULL); | 1305 label = gtk_label_new(NULL); |
1295 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text); | 1306 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text ? text : field_label); |
1296 g_free(text); | 1307 g_free(text); |
1297 | 1308 |
1298 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 1309 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
1299 | 1310 |
1300 gtk_size_group_add_widget(sg, label); | 1311 gtk_size_group_add_widget(sg, label); |
1391 } | 1402 } |
1392 } | 1403 } |
1393 | 1404 |
1394 g_object_unref(sg); | 1405 g_object_unref(sg); |
1395 | 1406 |
1396 /* Cancel button */ | |
1397 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data); | |
1398 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
1399 | |
1400 /* OK button */ | |
1401 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data); | |
1402 data->ok_button = button; | |
1403 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
1404 gtk_window_set_default(GTK_WINDOW(win), button); | |
1405 | |
1406 if (!purple_request_fields_all_required_filled(fields)) | 1407 if (!purple_request_fields_all_required_filled(fields)) |
1407 gtk_widget_set_sensitive(button, FALSE); | 1408 gtk_widget_set_sensitive(data->ok_button, FALSE); |
1408 | 1409 |
1409 pidgin_auto_parent_window(win); | 1410 pidgin_auto_parent_window(win); |
1410 | 1411 |
1411 gtk_widget_show(win); | 1412 gtk_widget_show(win); |
1412 | 1413 |