pidgin/gtkconv.c

branch
soc.2009.webkitmessageview
changeset 32498
943ecd58841b
parent 32497
052b58f0209b
parent 29193
e07ecf0ae368
child 32500
d8aa742c6288
equal deleted inserted replaced
32497:052b58f0209b 32498:943ecd58841b
3828 3828
3829 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); 3829 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
3830 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); 3830 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4);
3831 3831
3832 if (buddy != NULL && 3832 if (buddy != NULL &&
3833 !purple_presence_is_online(purple_buddy_get_presence(buddy)) && 3833 !purple_presence_is_online(purple_buddy_get_presence(buddy)))
3834 !purple_account_supports_offline_message(account, buddy))
3835 { 3834 {
3836 gtk_widget_set_sensitive(label, FALSE); 3835 gtk_widget_set_sensitive(label, FALSE);
3837 3836
3838 /* Set the label sensitive when the menuitem is highlighted and 3837 /* Set the label sensitive when the menuitem is highlighted and
3839 * insensitive again when the mouse leaves it. This way, it 3838 * insensitive again when the mouse leaves it. This way, it
5364 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); 5363 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
5365 ui_ops->create_conversation = pidgin_conv_new; 5364 ui_ops->create_conversation = pidgin_conv_new;
5366 } 5365 }
5367 5366
5368 /* Somebody wants to keep this conversation around, so don't time it out */ 5367 /* Somebody wants to keep this conversation around, so don't time it out */
5369 timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer")); 5368 if (conv) {
5370 if (timer) { 5369 timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer"));
5371 purple_timeout_remove(timer); 5370 if (timer) {
5372 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(0)); 5371 purple_timeout_remove(timer);
5372 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(0));
5373 }
5373 } 5374 }
5374 } 5375 }
5375 5376
5376 static void 5377 static void
5377 pidgin_conv_destroy(PurpleConversation *conv) 5378 pidgin_conv_destroy(PurpleConversation *conv)
7254 } 7255 }
7255 list = list->next; 7256 list = list->next;
7256 } 7257 }
7257 } 7258 }
7258 7259
7260 struct _status_timeout_user {
7261 gchar *name;
7262 PurpleAccount *account;
7263 };
7264
7259 static gboolean 7265 static gboolean
7260 update_buddy_status_timeout(PurpleBuddy *buddy) 7266 update_buddy_status_timeout(struct _status_timeout_user *user)
7261 { 7267 {
7262 /* To remove the signing-on/off door icon */ 7268 /* To remove the signing-on/off door icon */
7263 PurpleConversation *conv; 7269 PurpleConversation *conv;
7264 7270
7265 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); 7271 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, user->name, user->account);
7266 if (conv) 7272 if (conv)
7267 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); 7273 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON);
7268 7274
7275 g_free(user->name);
7276 g_free(user);
7277
7269 return FALSE; 7278 return FALSE;
7270 } 7279 }
7271 7280
7272 static void 7281 static void
7273 update_buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *newstatus) 7282 update_buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *newstatus)
7274 { 7283 {
7275 PidginConversation *gtkconv; 7284 PidginConversation *gtkconv;
7276 PurpleConversation *conv; 7285 PurpleConversation *conv;
7286 struct _status_timeout_user *user;
7277 7287
7278 gtkconv = get_gtkconv_with_contact(purple_buddy_get_contact(buddy)); 7288 gtkconv = get_gtkconv_with_contact(purple_buddy_get_contact(buddy));
7279 if (gtkconv) 7289 if (gtkconv)
7280 { 7290 {
7281 conv = gtkconv->active_conv; 7291 conv = gtkconv->active_conv;
7284 | PIDGIN_CONV_BUDDY_ICON); 7294 | PIDGIN_CONV_BUDDY_ICON);
7285 if ((purple_status_is_online(old) ^ purple_status_is_online(newstatus)) != 0) 7295 if ((purple_status_is_online(old) ^ purple_status_is_online(newstatus)) != 0)
7286 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); 7296 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU);
7287 } 7297 }
7288 7298
7299 user = g_malloc(sizeof(struct _status_timeout_user));
7300 user->name = g_strdup(buddy->name);
7301 user->account = buddy->account;
7302
7289 /* In case a conversation is started after the buddy has signed-on/off */ 7303 /* In case a conversation is started after the buddy has signed-on/off */
7290 purple_timeout_add_seconds(11, (GSourceFunc)update_buddy_status_timeout, buddy); 7304 purple_timeout_add_seconds(11, (GSourceFunc)update_buddy_status_timeout, user);
7291 } 7305 }
7292 7306
7293 static void 7307 static void
7294 update_buddy_privacy_changed(PurpleBuddy *buddy) 7308 update_buddy_privacy_changed(PurpleBuddy *buddy)
7295 { 7309 {
7562 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/font_size", 3); 7576 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/font_size", 3);
7563 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/tabs", TRUE); 7577 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/tabs", TRUE);
7564 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/tab_side", GTK_POS_TOP); 7578 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/tab_side", GTK_POS_TOP);
7565 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/scrollback_lines", 4000); 7579 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/scrollback_lines", 4000);
7566 7580
7581 #ifdef _WIN32
7567 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE); 7582 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font", TRUE);
7568 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", ""); 7583 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/custom_font", "");
7584 #endif
7569 7585
7570 /* Conversations -> Chat */ 7586 /* Conversations -> Chat */
7571 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/chat"); 7587 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/conversations/chat");
7572 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", 54); 7588 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", 54);
7573 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", 80); 7589 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width", 80);

mercurial