comparison pidgin/gtkblist.c @ 22507:2f7b42cc612c

Change up the Add Budy dialog a little bit, this hopefully makes it a bit cleaner and a bit more obvious what some of the fields do. At very least it shouldn't be any worse. Further helpful changes and/or suggestions for replacing the "Add a buddy." helper text welcome. Also, only show the Online Buddies and Total Buddies items in the group tooltip when there are more than 0 online or total buddies.
author Etan Reisner <pidgin@unreliablesource.net>
date Fri, 29 Feb 2008 04:12:32 +0000
parents 42724bd41274
children 69a5f005fdbf
comparison
equal deleted inserted replaced
22506:fbb49435cf80 22507:2f7b42cc612c
3316 g_string_append(str, tmp); 3316 g_string_append(str, tmp);
3317 g_free(tmp); 3317 g_free(tmp);
3318 3318
3319 purple_notify_user_info_destroy(user_info); 3319 purple_notify_user_info_destroy(user_info);
3320 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { 3320 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
3321 gint count;
3321 PurpleGroup *group = (PurpleGroup*)node; 3322 PurpleGroup *group = (PurpleGroup*)node;
3322 PurpleNotifyUserInfo *user_info; 3323 PurpleNotifyUserInfo *user_info;
3323 3324
3324 user_info = purple_notify_user_info_new(); 3325 user_info = purple_notify_user_info_new();
3325 3326
3326 /* Total buddies (from online accounts) in group */ 3327 count = purple_blist_get_group_online_count(group);
3327 tmp = g_strdup_printf("%d", 3328
3328 purple_blist_get_group_size(group, FALSE)); 3329 if (count != 0) {
3329 purple_notify_user_info_add_pair(user_info, _("Total Buddies"), 3330 /* Online buddies in group */
3330 tmp); 3331 tmp = g_strdup_printf("%d", count);
3331 g_free(tmp); 3332 purple_notify_user_info_add_pair(user_info,
3332 3333 _("Online Buddies"),
3333 /* Online buddies in group */ 3334 tmp);
3334 tmp = g_strdup_printf("%d", 3335 g_free(tmp);
3335 purple_blist_get_group_online_count(group)); 3336 }
3336 purple_notify_user_info_add_pair(user_info, _("Online Buddies"), 3337 count = 0;
3337 tmp); 3338
3338 g_free(tmp); 3339 count = purple_blist_get_group_size(group, FALSE);
3340 if (count != 0) {
3341 /* Total buddies (from online accounts) in group */
3342 tmp = g_strdup_printf("%d", count);
3343 purple_notify_user_info_add_pair(user_info,
3344 _("Total Buddies"),
3345 tmp);
3346 g_free(tmp);
3347 }
3348 count = 0;
3339 3349
3340 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n"); 3350 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
3341 g_string_append(str, tmp); 3351 g_string_append(str, tmp);
3342 g_free(tmp); 3352 g_free(tmp);
3343 3353
6318 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); 6328 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
6319 6329
6320 vbox = gtk_vbox_new(FALSE, 0); 6330 vbox = gtk_vbox_new(FALSE, 0);
6321 gtk_container_add(GTK_CONTAINER(hbox), vbox); 6331 gtk_container_add(GTK_CONTAINER(hbox), vbox);
6322 6332
6323 label = gtk_label_new( 6333 g_signal_connect(G_OBJECT(data->window), "destroy",
6324 _("Please enter the screen name of the person you would like " 6334 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
6325 "to add to your buddy list. You may optionally enter an alias, " 6335
6326 "or nickname, for the buddy. The alias will be displayed in " 6336 label = gtk_label_new(_("Add a buddy.\n"));
6327 "place of the screen name whenever possible.\n"));
6328
6329 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
6330 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
6331 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); 6337 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
6332 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); 6338 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
6333
6334 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
6335 gtk_container_add(GTK_CONTAINER(vbox), hbox);
6336
6337 g_signal_connect(G_OBJECT(data->window), "destroy",
6338 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
6339 6339
6340 table = gtk_table_new(4, 2, FALSE); 6340 table = gtk_table_new(4, 2, FALSE);
6341 gtk_table_set_row_spacings(GTK_TABLE(table), 5); 6341 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
6342 gtk_table_set_col_spacings(GTK_TABLE(table), 5); 6342 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
6343 gtk_container_set_border_width(GTK_CONTAINER(table), 0); 6343 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
6344 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); 6344 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
6345 6345
6346 /* Set up stuff for the account box */
6347 label = gtk_label_new_with_mnemonic(_("A_ccount:"));
6348 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6349 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
6350
6351 data->account_box = pidgin_account_option_menu_new(account, FALSE, 6346 data->account_box = pidgin_account_option_menu_new(account, FALSE,
6352 G_CALLBACK(add_buddy_select_account_cb), NULL, data); 6347 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
6353 6348
6354 gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 1, 2, 0, 1); 6349 gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 0, 2, 0, 1);
6355 gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->account_box); 6350
6356 pidgin_set_accessible_label (data->account_box, label); 6351 label = gtk_label_new_with_mnemonic(_("Buddy's _screen name:"));
6357 /* End of account box */
6358
6359 label = gtk_label_new_with_mnemonic(_("_Screen name:"));
6360 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 6352 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6361 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); 6353 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
6362 6354
6363 data->entry = gtk_entry_new(); 6355 data->entry = gtk_entry_new();
6364 gtk_table_attach_defaults(GTK_TABLE(table), data->entry, 1, 2, 1, 2); 6356 gtk_table_attach_defaults(GTK_TABLE(table), data->entry, 1, 2, 1, 2);
6366 6358
6367 if (username != NULL) 6359 if (username != NULL)
6368 gtk_entry_set_text(GTK_ENTRY(data->entry), username); 6360 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
6369 else 6361 else
6370 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), 6362 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window),
6371 GTK_RESPONSE_OK, FALSE); 6363 GTK_RESPONSE_OK, FALSE);
6372 6364
6373 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE); 6365 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
6374 gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->entry); 6366 gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->entry);
6375 pidgin_set_accessible_label (data->entry, label); 6367 pidgin_set_accessible_label (data->entry, label);
6376 6368
6377 g_signal_connect(G_OBJECT(data->entry), "changed", 6369 g_signal_connect(G_OBJECT(data->entry), "changed",
6378 G_CALLBACK(pidgin_set_sensitive_if_input), 6370 G_CALLBACK(pidgin_set_sensitive_if_input),
6379 data->window); 6371 data->window);
6380 6372
6381 label = gtk_label_new_with_mnemonic(_("A_lias:")); 6373 label = gtk_label_new_with_mnemonic(_("(Optional) A_lias:"));
6382 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 6374 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6383 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); 6375 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
6384 6376
6385 data->entry_for_alias = gtk_entry_new(); 6377 data->entry_for_alias = gtk_entry_new();
6386 gtk_table_attach_defaults(GTK_TABLE(table), 6378 gtk_table_attach_defaults(GTK_TABLE(table),
6387 data->entry_for_alias, 1, 2, 2, 3); 6379 data->entry_for_alias, 1, 2, 2, 3);
6388 6380
6389 if (alias != NULL) 6381 if (alias != NULL)
6390 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias); 6382 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
6391 6383
6392 if (username != NULL) 6384 if (username != NULL)
6394 6386
6395 gtk_entry_set_activates_default (GTK_ENTRY(data->entry_for_alias), TRUE); 6387 gtk_entry_set_activates_default (GTK_ENTRY(data->entry_for_alias), TRUE);
6396 gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->entry_for_alias); 6388 gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->entry_for_alias);
6397 pidgin_set_accessible_label (data->entry_for_alias, label); 6389 pidgin_set_accessible_label (data->entry_for_alias, label);
6398 6390
6399 label = gtk_label_new_with_mnemonic(_("_Group:")); 6391 label = gtk_label_new_with_mnemonic(_("Add buddy to _group:"));
6400 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 6392 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6401 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); 6393 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4);
6402 6394
6403 data->combo = pidgin_text_combo_box_entry_new(group, groups_tree()); 6395 data->combo = pidgin_text_combo_box_entry_new(group, groups_tree());
6404 gtk_table_attach_defaults(GTK_TABLE(table), data->combo, 1, 2, 3, 4); 6396 gtk_table_attach_defaults(GTK_TABLE(table), data->combo, 1, 2, 3, 4);