~ubuntu-branches/ubuntu/intrepid/pidgin/intrepid-security

« back to all changes in this revision

Viewing changes to pidgin/gtkblist.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2008-04-04 02:18:00 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080404021800-qaa00wom38gd7xus
Tags: 1:2.4.1-1ubuntu1
* Sync with Debian, remaining Ubuntu changes; (LP: #211769)
  - debian/control:
    + Set Maintainer to Ubuntu Core Developers.
    + Add build-deps on liblaunchpad-integration-dev, intltool,
      libnm-glib-dev (for --enable-nm)
    + Drop build-deps on libsilc-1.1-2-dev | libsilc-dev (>= 1.1.1) as
      this library is in universe.
    + Drop the libpurple0 recommends on libpurple-bin.
    + Add a gaim transitionnal package for upgrades.
    + Moved finch's libx11-6 dependency to Suggests
  - Ship compatibility symlinks via debian/gaim.links
  - debian/rules:
    + Pass --enable-nm to configure to enable NetworkManager support
    + Pass --disable-silc to configure to disable silc support even if
      it's installed in the build environment.
    + Add X-Ubuntu-Gettext-Domain to the desktop file and update the
      translation templates in common-install-impl::.
    + Added necessary arguments to dh_shlibdeps for finch
  - Update debian/prefs.xml to set the notify plugin prefs
    /plugins/gtk/X11/notify/* and set /pidgin/plugins/loaded to load
    the notify plugin
  - debian/patches:
    + 02_lpi for LP integration
    + 04_let_crasher_for_apport to stop catching the SIGSEGV signal
      and let apport handle it
    + 05_default_to_irc_ubuntu_com to set the default IRC
      server to irc.ubuntu.com.
    + 70_autoconf patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
549
549
                char *msg = g_strdup_printf(ngettext("You have %d contact named %s. Would you like to merge them?", "You currently have %d contacts named %s. Would you like to merge them?", i), i, alias);
550
550
                purple_request_action(NULL, NULL, msg, _("Merging these contacts will cause them to share a single entry on the buddy list and use a single conversation window. "
551
551
                                                         "You can separate them again by choosing 'Expand' from the contact's context menu"), 0, NULL, NULL, NULL,
552
 
                                      merges, 2, _("_Merge"), PURPLE_CALLBACK(gtk_blist_do_personize), _("_Cancel"), PURPLE_CALLBACK(g_list_free));
 
552
                                      merges, 2, _("_Yes"), PURPLE_CALLBACK(gtk_blist_do_personize), _("_No"), PURPLE_CALLBACK(g_list_free));
553
553
                g_free(msg);
554
554
        } else
555
555
                g_list_free(merges);
705
705
                for (bnode = node->child; bnode != NULL; bnode = bnode->next) {
706
706
                        purple_blist_node_set_bool(bnode, "show_offline", setting);
707
707
                }
 
708
        } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 
709
                PurpleBlistNode *cnode, *bnode;
 
710
                gboolean setting = !purple_blist_node_get_bool(node, "show_offline");
 
711
 
 
712
                purple_blist_node_set_bool(node, "show_offline", setting);
 
713
                for (cnode = node->child; cnode != NULL; cnode = cnode->next) {
 
714
                        purple_blist_node_set_bool(cnode, "show_offline", setting);
 
715
                        for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) {
 
716
                                purple_blist_node_set_bool(bnode, "show_offline", setting);
 
717
                        }
 
718
                }
708
719
        }
709
720
        pidgin_blist_update(purple_get_blist(), node);
710
721
}
1459
1470
                                 G_CALLBACK(pidgin_blist_remove_cb), node, 0, 0, NULL);
1460
1471
        pidgin_new_item_from_stock(menu, _("_Rename"), NULL,
1461
1472
                                 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
 
1473
        if (!(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) {
 
1474
                gboolean show_offline = purple_blist_node_get_bool(node, "show_offline");
 
1475
                pidgin_new_item_from_stock(menu, show_offline ? _("Hide when offline") : _("Show when offline"),
 
1476
                                NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL);
 
1477
        }
1462
1478
 
1463
1479
        pidgin_append_blist_node_extended_menu(menu, node);
1464
1480
 
2482
2498
                        purple_buddy_icon_get_scale_size(&prpl_info->icon_spec, &scale_width, &scale_height);
2483
2499
 
2484
2500
                if (scaled || scale_height > 200 || scale_width > 200) {
 
2501
                        GdkPixbuf *tmpbuf;
2485
2502
                        float scale_size = scaled ? 32.0 : 200.0;
2486
2503
                        if(scale_height > scale_width) {
2487
2504
                                scale_width = scale_size * (double)scale_width / (double)scale_height;
2490
2507
                                scale_height = scale_size * (double)scale_height / (double)scale_width;
2491
2508
                                scale_width = scale_size;
2492
2509
                        }
2493
 
 
 
2510
                        /* scale & round before making square, so rectangular (but non-square)
 
2511
                         * images get rounded corners too */
 
2512
                        tmpbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_width, scale_height);
 
2513
                        gdk_pixbuf_fill(tmpbuf, 0x00000000);
 
2514
                        gdk_pixbuf_scale(buf, tmpbuf, 0, 0, scale_width, scale_height, 0, 0, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR);
 
2515
                        if (pidgin_gdk_pixbuf_is_opaque(tmpbuf))
 
2516
                                pidgin_gdk_pixbuf_make_round(tmpbuf);
2494
2517
                        ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_size, scale_size);
2495
2518
                        gdk_pixbuf_fill(ret, 0x00000000);
2496
 
                        gdk_pixbuf_scale(buf, ret, (scale_size-scale_width)/2, (scale_size-scale_height)/2, scale_width, scale_height, (scale_size-scale_width)/2, (scale_size-scale_height)/2, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR);
2497
 
                        if (pidgin_gdk_pixbuf_is_opaque(ret))
2498
 
                                pidgin_gdk_pixbuf_make_round(ret);
 
2519
                        gdk_pixbuf_copy_area(tmpbuf, 0, 0, scale_width, scale_height, ret, (scale_size-scale_width)/2, (scale_size-scale_height)/2);
 
2520
                        g_object_unref(G_OBJECT(tmpbuf));
2499
2521
                } else {
2500
2522
                        ret = gdk_pixbuf_scale_simple(buf,scale_width,scale_height, GDK_INTERP_BILINEAR);
2501
2523
                }
3116
3138
                GList *cur;
3117
3139
                struct proto_chat_entry *pce;
3118
3140
                char *name, *value;
 
3141
                PurpleConversation *conv;
3119
3142
                PidginBlistNode *bnode = node->ui_data;
3120
3143
 
3121
3144
                chat = (PurpleChat *)node;
3129
3152
                        g_free(tmp);
3130
3153
                }
3131
3154
 
3132
 
                if (bnode && bnode->conv.conv &&
3133
 
                                prpl_info && (prpl_info->options & OPT_PROTO_CHAT_TOPIC) &&
3134
 
                                !purple_conv_chat_has_left(PURPLE_CONV_CHAT(bnode->conv.conv))) {
3135
 
                        const char *topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(bnode->conv.conv));
 
3155
                if (bnode && bnode->conv.conv) {
 
3156
                        conv = bnode->conv.conv;
 
3157
                } else {
 
3158
                        char *chat_name;
 
3159
                        if (prpl_info && prpl_info->get_chat_name)
 
3160
                                chat_name = prpl_info->get_chat_name(chat->components);
 
3161
                        else
 
3162
                                chat_name = g_strdup(purple_chat_get_name(chat));
 
3163
 
 
3164
                        conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name,
 
3165
                                        chat->account);
 
3166
                        g_free(chat_name);
 
3167
                }
 
3168
                if (conv && prpl_info && (prpl_info->options & OPT_PROTO_CHAT_TOPIC) &&
 
3169
                                !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
 
3170
                        char *topic = g_markup_escape_text(purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)), -1);
3136
3171
                        g_string_append_printf(str, _("\n<b>Topic:</b> %s"), topic ? topic : _("(no topic set)"));
 
3172
                        g_free(topic);
3137
3173
                }
3138
3174
 
3139
3175
                if (prpl_info->chat_info != NULL)
3318
3354
 
3319
3355
                purple_notify_user_info_destroy(user_info);
3320
3356
        } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 
3357
                gint count;
3321
3358
                PurpleGroup *group = (PurpleGroup*)node;
3322
3359
                PurpleNotifyUserInfo *user_info;
3323
3360
 
3324
3361
                user_info = purple_notify_user_info_new();
3325
3362
 
3326
 
                /* Total buddies (from online accounts) in group */
3327
 
                tmp = g_strdup_printf("%d",
3328
 
                                      purple_blist_get_group_size(group, FALSE));
3329
 
                purple_notify_user_info_add_pair(user_info, _("Total Buddies"),
3330
 
                                                 tmp);
3331
 
                g_free(tmp);
3332
 
 
3333
 
                /* Online buddies in group */
3334
 
                tmp = g_strdup_printf("%d",
3335
 
                                      purple_blist_get_group_online_count(group));
3336
 
                purple_notify_user_info_add_pair(user_info, _("Online Buddies"),
3337
 
                                                 tmp);
3338
 
                g_free(tmp);
 
3363
                count = purple_blist_get_group_online_count(group);
 
3364
 
 
3365
                if (count != 0) {
 
3366
                        /* Online buddies in group */
 
3367
                        tmp = g_strdup_printf("%d", count);
 
3368
                        purple_notify_user_info_add_pair(user_info,
 
3369
                                                         _("Online Buddies"),
 
3370
                                                         tmp);
 
3371
                        g_free(tmp);
 
3372
                }
 
3373
                count = 0;
 
3374
 
 
3375
                count = purple_blist_get_group_size(group, FALSE);
 
3376
                if (count != 0) {
 
3377
                        /* Total buddies (from online accounts) in group */
 
3378
                        tmp = g_strdup_printf("%d", count);
 
3379
                        purple_notify_user_info_add_pair(user_info,
 
3380
                                                         _("Total Buddies"),
 
3381
                                                         tmp);
 
3382
                        g_free(tmp);
 
3383
                }
 
3384
                count = 0;
3339
3385
 
3340
3386
                tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
3341
3387
                g_string_append(str, tmp);
6320
6366
        vbox = gtk_vbox_new(FALSE, 0);
6321
6367
        gtk_container_add(GTK_CONTAINER(hbox), vbox);
6322
6368
 
6323
 
        label = gtk_label_new(
6324
 
                _("Please enter the screen name of the person you would like "
6325
 
                  "to add to your buddy list. You may optionally enter an alias, "
6326
 
                  "or nickname,  for the buddy. The alias will be displayed in "
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);
6332
 
        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
6369
        g_signal_connect(G_OBJECT(data->window), "destroy",
6338
 
                                         G_CALLBACK(destroy_add_buddy_dialog_cb), data);
 
6370
                         G_CALLBACK(destroy_add_buddy_dialog_cb), data);
 
6371
 
 
6372
        label = gtk_label_new(_("Add a buddy.\n"));
 
6373
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 
6374
        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
6339
6375
 
6340
6376
        table = gtk_table_new(4, 2, FALSE);
6341
6377
        gtk_table_set_row_spacings(GTK_TABLE(table), 5);
6343
6379
        gtk_container_set_border_width(GTK_CONTAINER(table), 0);
6344
6380
        gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
6345
6381
 
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
6382
        data->account_box = pidgin_account_option_menu_new(account, FALSE,
6352
6383
                        G_CALLBACK(add_buddy_select_account_cb), NULL, data);
6353
6384
 
6354
 
        gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 1, 2, 0, 1);
6355
 
        gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->account_box);
6356
 
        pidgin_set_accessible_label (data->account_box, label);
6357
 
        /* End of account box */
 
6385
        gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 0, 2, 0, 1);
6358
6386
 
6359
 
        label = gtk_label_new_with_mnemonic(_("_Screen name:"));
 
6387
        label = gtk_label_new_with_mnemonic(_("Buddy's _screen name:"));
6360
6388
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6361
6389
        gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
6362
6390
 
6368
6396
                gtk_entry_set_text(GTK_ENTRY(data->entry), username);
6369
6397
        else
6370
6398
                gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window),
6371
 
                                                                                  GTK_RESPONSE_OK, FALSE);
 
6399
                                                  GTK_RESPONSE_OK, FALSE);
6372
6400
 
6373
6401
        gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
6374
6402
        gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->entry);
6375
6403
        pidgin_set_accessible_label (data->entry, label);
6376
6404
 
6377
6405
        g_signal_connect(G_OBJECT(data->entry), "changed",
6378
 
                                         G_CALLBACK(pidgin_set_sensitive_if_input),
6379
 
                                         data->window);
 
6406
                         G_CALLBACK(pidgin_set_sensitive_if_input),
 
6407
                         data->window);
6380
6408
 
6381
 
        label = gtk_label_new_with_mnemonic(_("A_lias:"));
 
6409
        label = gtk_label_new_with_mnemonic(_("(Optional) A_lias:"));
6382
6410
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6383
6411
        gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
6384
6412
 
6385
6413
        data->entry_for_alias = gtk_entry_new();
6386
6414
        gtk_table_attach_defaults(GTK_TABLE(table),
6387
 
                                                          data->entry_for_alias, 1, 2, 2, 3);
 
6415
                                  data->entry_for_alias, 1, 2, 2, 3);
6388
6416
 
6389
6417
        if (alias != NULL)
6390
6418
                gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
6396
6424
        gtk_label_set_mnemonic_widget(GTK_LABEL(label), data->entry_for_alias);
6397
6425
        pidgin_set_accessible_label (data->entry_for_alias, label);
6398
6426
 
6399
 
        label = gtk_label_new_with_mnemonic(_("_Group:"));
 
6427
        label = gtk_label_new_with_mnemonic(_("Add buddy to _group:"));
6400
6428
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
6401
6429
        gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4);
6402
6430