~micahg/ubuntu/natty/pidgin/2.7.9-2

« back to all changes in this revision

Viewing changes to pidgin/gtkconv.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-11-05 19:44:21 UTC
  • mfrom: (62.1.1 maverick-security) (2.3.12 sid)
  • Revision ID: james.westby@ubuntu.com-20101105194421-8r8o4pzw2m5j4hiy
Tags: 1:2.7.5-1ubuntu1
Resync on Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
750
750
do_invite(GtkWidget *w, int resp, InviteBuddyInfo *info)
751
751
{
752
752
        const char *buddy, *message;
753
 
        PidginConversation *gtkconv;
 
753
        PurpleConversation *conv;
754
754
 
755
 
        gtkconv = PIDGIN_CONVERSATION(info->conv);
 
755
        conv = info->conv;
756
756
 
757
757
        if (resp == GTK_RESPONSE_OK) {
758
758
                buddy   = gtk_entry_get_text(GTK_ENTRY(info->entry));
761
761
                if (!g_ascii_strcasecmp(buddy, ""))
762
762
                        return;
763
763
 
764
 
                serv_chat_invite(purple_conversation_get_gc(info->conv),
765
 
                                                 purple_conv_chat_get_id(PURPLE_CONV_CHAT(info->conv)),
 
764
                serv_chat_invite(purple_conversation_get_gc(conv),
 
765
                                                 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)),
766
766
                                                 message, buddy);
767
767
        }
768
768
 
856
856
        InviteBuddyInfo *info = NULL;
857
857
 
858
858
        if (invite_dialog == NULL) {
859
 
                PurpleConnection *gc;
860
859
                PidginWindow *gtkwin;
861
860
                GtkWidget *label;
862
861
                GtkWidget *vbox, *hbox;
869
868
                info = g_new0(InviteBuddyInfo, 1);
870
869
                info->conv = conv;
871
870
 
872
 
                gc        = purple_conversation_get_gc(conv);
873
871
                gtkwin    = pidgin_conv_get_window(gtkconv);
874
872
 
875
873
                /* Create the new dialog. */
1200
1198
menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget)
1201
1199
{
1202
1200
        PidginWindow *win = data;
1203
 
        PurpleConversation *conv;
1204
1201
        PidginConversation *gtkconv;
1205
1202
        GtkIMHtmlToolbar *toolbar;
1206
1203
 
1207
1204
        gtkconv = pidgin_conv_window_get_active_gtkconv(win);
1208
 
        conv    = gtkconv->active_conv;
1209
1205
        toolbar = GTK_IMHTMLTOOLBAR(gtkconv->toolbar);
1210
1206
 
1211
1207
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->image),
1911
1907
conv_keypress_common(PidginConversation *gtkconv, GdkEventKey *event)
1912
1908
{
1913
1909
        PidginWindow *win;
1914
 
        PurpleConversation *conv;
1915
1910
        int curconv;
1916
1911
 
1917
 
        conv     = gtkconv->active_conv;
1918
1912
        win      = gtkconv->win;
1919
1913
        curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook));
1920
1914
 
2009
2003
static gboolean
2010
2004
entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
2011
2005
{
2012
 
        PidginWindow *win;
2013
2006
        PurpleConversation *conv;
2014
2007
        PidginConversation *gtkconv;
2015
2008
 
2016
2009
        gtkconv  = (PidginConversation *)data;
2017
2010
        conv     = gtkconv->active_conv;
2018
 
        win      = gtkconv->win;
2019
2011
 
2020
2012
        if (conv_keypress_common(gtkconv, event))
2021
2013
                return TRUE;
2350
2342
                           gchar *new_text, gint new_text_length, gpointer user_data)
2351
2343
{
2352
2344
        PidginConversation *gtkconv = (PidginConversation *)user_data;
2353
 
        PurpleConversation *conv;
2354
2345
 
2355
2346
        g_return_if_fail(gtkconv != NULL);
2356
2347
 
2357
 
        conv = gtkconv->active_conv;
2358
 
 
2359
2348
        if (!purple_prefs_get_bool("/purple/conversations/im/send_typing"))
2360
2349
                return;
2361
2350
 
2617
2606
        PidginConversation *gtkconv = (PidginConversation *)data;
2618
2607
        PurpleConversation *conv = gtkconv->active_conv;
2619
2608
        PurpleAccount *account;
2620
 
        PurplePluginProtocolInfo *prpl_info = NULL;
2621
2609
 
2622
2610
        GdkPixbuf *buf;
2623
2611
        GdkPixbuf *scale;
2628
2616
        gtkconv = PIDGIN_CONVERSATION(conv);
2629
2617
        account = purple_conversation_get_account(conv);
2630
2618
 
2631
 
        if(account && account->gc) {
2632
 
                prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
2633
 
        } else {
 
2619
        if (!(account && account->gc)) {
2634
2620
                gtkconv->u.im->icon_timer = 0;
2635
2621
                return FALSE;
2636
2622
        }
2702
2688
        GList *children;
2703
2689
        GtkWidget *event;
2704
2690
        PurpleConversation *conv = gtkconv->active_conv;
2705
 
        PidginWindow *gtkwin;
2706
2691
 
2707
2692
        g_return_if_fail(conv != NULL);
2708
2693
 
2730
2715
        gtkconv->u.im->anim = NULL;
2731
2716
        gtkconv->u.im->iter = NULL;
2732
2717
        gtkconv->u.im->show_icon = FALSE;
2733
 
 
2734
 
        gtkwin = gtkconv->win;
2735
2718
}
2736
2719
 
2737
2720
static void
3684
3667
static void
3685
3668
update_typing_icon(PidginConversation *gtkconv)
3686
3669
{
3687
 
        PidginWindow *gtkwin;
3688
3670
        PurpleConvIm *im = NULL;
3689
3671
        PurpleConversation *conv = gtkconv->active_conv;
3690
3672
        char *message = NULL;
3691
3673
 
3692
 
        gtkwin = gtkconv->win;
3693
 
 
3694
3674
        if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
3695
3675
                im = PURPLE_CONV_IM(conv);
3696
3676
 
3923
3903
                                                continue;
3924
3904
 
3925
3905
                                        account = purple_buddy_get_account(buddy);
3926
 
                                        if (purple_account_is_connected(account))
 
3906
                                        if (purple_account_is_connected(account) || account == gtkconv->active_conv->account)
3927
3907
                                        {
3928
3908
                                                /* Use the PurplePresence to get unique buddies. */
3929
3909
                                                PurplePresence *presence = purple_buddy_get_presence(buddy);
5740
5720
                                                time_t mtime)
5741
5721
{
5742
5722
        PidginConversation *gtkconv;
5743
 
        PidginWindow *win;
5744
5723
        PurpleConnection *gc;
5745
5724
        PurpleAccount *account;
5746
 
        PurplePluginProtocolInfo *prpl_info;
5747
5725
        int gtk_font_options = 0;
5748
5726
        int gtk_font_options_all = 0;
5749
5727
        int max_scrollback_lines;
5830
5808
                g_free(tmp);
5831
5809
        }
5832
5810
 
5833
 
        win = gtkconv->win;
5834
 
        prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
5835
 
 
5836
5811
        line_count = gtk_text_buffer_get_line_count(
5837
5812
                        gtk_text_view_get_buffer(GTK_TEXT_VIEW(
5838
5813
                                gtkconv->imhtml)));
6263
6238
pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user)
6264
6239
{
6265
6240
        PurpleConvChat *chat;
6266
 
        PurpleConvChatBuddyFlags flags;
6267
6241
        PurpleConvChatBuddy *cbuddy;
6268
6242
        PidginConversation *gtkconv;
6269
6243
        PidginChatPane *gtkchat;
6306
6280
 
6307
6281
        g_return_if_fail(alias != NULL);
6308
6282
 
6309
 
        flags = purple_conv_chat_user_get_flags(chat, user);
6310
 
 
6311
6283
        cbuddy = purple_conv_chat_cb_find(chat, user);
6312
6284
        if (cbuddy)
6313
6285
                add_chat_buddy_common(conv, cbuddy, NULL);
6729
6701
                PurpleConvIm *im = NULL;
6730
6702
                PurpleAccount *account = purple_conversation_get_account(conv);
6731
6703
                PurpleBuddy *buddy = NULL;
6732
 
                PurplePresence *p = NULL;
6733
6704
                char *markup = NULL;
6734
6705
                AtkObject *accessibility_obj;
6735
6706
                /* I think this is a little longer than it needs to be but I'm lazy. */
6749
6720
                if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
6750
6721
                        buddy = purple_find_buddy(account, conv->name);
6751
6722
                        if (buddy) {
6752
 
                                p = purple_buddy_get_presence(buddy);
6753
6723
                                markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE);
6754
6724
                        } else {
6755
6725
                                markup = title;
6964
6934
        int size = 0;
6965
6935
 
6966
6936
        PurpleAccount *account;
6967
 
        PurplePluginProtocolInfo *prpl_info = NULL;
6968
6937
 
6969
6938
        PurpleBuddyIcon *icon;
6970
6939
 
6981
6950
                return;
6982
6951
 
6983
6952
        account = purple_conversation_get_account(conv);
6984
 
        if(account && account->gc)
6985
 
                prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
6986
6953
 
6987
6954
        /* Remove the current icon stuff */
6988
6955
        children = gtk_container_get_children(GTK_CONTAINER(gtkconv->u.im->icon_container));
8627
8594
static gboolean
8628
8595
notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
8629
8596
{
8630
 
        gint nb_x, nb_y, x_rel, y_rel;
 
8597
        gint nb_x, nb_y;
8631
8598
        int tab_clicked;
8632
8599
        GtkWidget *page;
8633
8600
        GtkWidget *tab;
8670
8637
        */
8671
8638
        gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
8672
8639
 
8673
 
        x_rel = e->x_root - nb_x;
8674
 
        y_rel = e->y_root - nb_y;
8675
 
 
8676
8640
        /* Reset the min/max x/y */
8677
8641
        win->drag_min_x = 0;
8678
8642
        win->drag_min_y = 0;
9239
9203
        if (win && win->window &&
9240
9204
                        !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) {
9241
9205
 
 
9206
#ifdef _WIN32  /* only override window manager placement on Windows */
9242
9207
                /* ...check position is on screen... */
9243
9208
                if (conv_x >= gdk_screen_width())
9244
9209
                        conv_x = gdk_screen_width() - 100;
9251
9216
                        conv_y = 100;
9252
9217
 
9253
9218
                /* ...and move it back. */
9254
 
#ifdef _WIN32  /* only override window manager placement on Windows */
9255
9219
                gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y);
9256
9220
#endif
9257
9221
                gtk_window_resize(GTK_WINDOW(win->window), conv_width, conv_height);
9503
9467
 
9504
9468
        gtk_widget_show(gtkconv->menu_tabby);
9505
9469
 
9506
 
        if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
 
9470
        if (conv_type == PURPLE_CONV_TYPE_IM)
9507
9471
                pidgin_conv_update_buddy_icon(conv);
9508
9472
 
9509
9473
        /* Build and set conversations tab */
9630
9594
pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
9631
9595
{
9632
9596
        unsigned int index;
9633
 
        PurpleConversationType conv_type;
9634
9597
 
9635
 
        conv_type = purple_conversation_get_type(gtkconv->active_conv);
9636
9598
        index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont);
9637
9599
 
9638
9600
        g_object_ref(gtkconv->tab_cont);
9965
9927
static void
9966
9928
conv_placement_by_group(PidginConversation *conv)
9967
9929
{
9968
 
        PurpleConversationType type;
9969
9930
        PurpleGroup *group = NULL;
9970
9931
        GList *wl, *cl;
9971
9932
 
9972
 
        type = purple_conversation_get_type(conv->active_conv);
9973
 
 
9974
9933
        group = conv_get_group(conv);
9975
9934
 
9976
9935
        /* Go through the list of IMs and find one with this group. */
10004
9963
static void
10005
9964
conv_placement_by_account(PidginConversation *conv)
10006
9965
{
10007
 
        PurpleConversationType type;
10008
9966
        GList *wins, *convs;
10009
9967
        PurpleAccount *account;
10010
9968
 
10011
9969
        account = purple_conversation_get_account(conv->active_conv);
10012
 
        type = purple_conversation_get_type(conv->active_conv);
10013
9970
 
10014
9971
        /* Go through the list of IMs and find one with this group. */
10015
9972
        for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) {