pidgin/gtkblist.c

branch
trac-17174
changeset 38822
93c0cd117e1d
parent 38754
ce9ac4939540
child 38913
8ed31ec968af
equal deleted inserted replaced
38821:329cf2453fb8 38822:93c0cd117e1d
58 #include "gtkprivacy.h" 58 #include "gtkprivacy.h"
59 #include "gtkroomlist.h" 59 #include "gtkroomlist.h"
60 #include "gtkstatusbox.h" 60 #include "gtkstatusbox.h"
61 #include "gtkscrollbook.h" 61 #include "gtkscrollbook.h"
62 #include "gtksmiley.h" 62 #include "gtksmiley.h"
63 #include "gtkstyle.h"
63 #include "gtkblist-theme.h" 64 #include "gtkblist-theme.h"
64 #include "gtkblist-theme-loader.h" 65 #include "gtkblist-theme-loader.h"
65 #include "gtkutils.h" 66 #include "gtkutils.h"
66 #include "pidgin/minidialog.h" 67 #include "pidgin/minidialog.h"
67 #include "pidgin/pidgintooltip.h" 68 #include "pidgin/pidgintooltip.h"
4176 } 4177 }
4177 4178
4178 gchar * 4179 gchar *
4179 pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased) 4180 pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased)
4180 { 4181 {
4181 const char *name, *name_color, *name_font, *status_color, *status_font; 4182 const char *name, *name_color, *name_font, *status_color, *status_font, *dim_grey;
4182 char *text = NULL; 4183 char *text = NULL;
4183 PurplePlugin *prpl; 4184 PurplePlugin *prpl;
4184 PurplePluginProtocolInfo *prpl_info = NULL; 4185 PurplePluginProtocolInfo *prpl_info = NULL;
4185 PurpleContact *contact; 4186 PurpleContact *contact;
4186 PurplePresence *presence; 4187 PurplePresence *presence;
4279 4280
4280 /* choose the colors of the text */ 4281 /* choose the colors of the text */
4281 theme = pidgin_blist_get_theme(); 4282 theme = pidgin_blist_get_theme();
4282 name_color = NULL; 4283 name_color = NULL;
4283 4284
4285 dim_grey = pidgin_style_is_dark(NULL) ? "light slate grey" : "dim grey";
4286
4284 if (theme) { 4287 if (theme) {
4285 if (purple_presence_is_idle(presence)) { 4288 if (purple_presence_is_idle(presence)) {
4286 namefont = statusfont = pidgin_blist_theme_get_idle_text_info(theme); 4289 namefont = statusfont = pidgin_blist_theme_get_idle_text_info(theme);
4287 name_color = "dim grey"; 4290 name_color = dim_grey;
4288 } else if (!purple_presence_is_online(presence)) { 4291 } else if (!purple_presence_is_online(presence)) {
4289 namefont = pidgin_blist_theme_get_offline_text_info(theme); 4292 namefont = pidgin_blist_theme_get_offline_text_info(theme);
4290 name_color = "dim grey"; 4293 name_color = dim_grey;
4291 statusfont = pidgin_blist_theme_get_status_text_info(theme); 4294 statusfont = pidgin_blist_theme_get_status_text_info(theme);
4292 } else if (purple_presence_is_available(presence)) { 4295 } else if (purple_presence_is_available(presence)) {
4293 namefont = pidgin_blist_theme_get_online_text_info(theme); 4296 namefont = pidgin_blist_theme_get_online_text_info(theme);
4294 statusfont = pidgin_blist_theme_get_status_text_info(theme); 4297 statusfont = pidgin_blist_theme_get_status_text_info(theme);
4295 } else { 4298 } else {
4299 } else { 4302 } else {
4300 if (!selected 4303 if (!selected
4301 && (purple_presence_is_idle(presence) 4304 && (purple_presence_is_idle(presence)
4302 || !purple_presence_is_online(presence))) 4305 || !purple_presence_is_online(presence)))
4303 { 4306 {
4304 name_color = "dim grey"; 4307 name_color = dim_grey;
4305 } 4308 }
4306 } 4309 }
4307 4310
4308 name_color = theme_font_get_color_default(namefont, name_color); 4311 name_color = theme_font_get_color_default(namefont, name_color);
4309 name_font = theme_font_get_face_default(namefont, ""); 4312 name_font = theme_font_get_face_default(namefont, "");
4310 4313
4311 status_color = theme_font_get_color_default(statusfont, "dim grey"); 4314 status_color = theme_font_get_color_default(statusfont, dim_grey);
4312 status_font = theme_font_get_face_default(statusfont, ""); 4315 status_font = theme_font_get_face_default(statusfont, "");
4313 4316
4314 if (aliased && selected) { 4317 if (aliased && selected) {
4315 if (theme) { 4318 if (theme) {
4316 name_color = "black"; 4319 name_color = "black";
4724 purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", 4727 purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed",
4725 ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), buddy); 4728 ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), buddy);
4726 } 4729 }
4727 } 4730 }
4728 break; 4731 break;
4732 default:
4733 break;
4734 }
4735 }
4736
4737 static void
4738 chat_joined_cb(PurpleConversation *conv, PidginBuddyList *gtkblist)
4739 {
4740 switch (conv->type) {
4729 case PURPLE_CONV_TYPE_CHAT: 4741 case PURPLE_CONV_TYPE_CHAT:
4730 { 4742 {
4731 PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name); 4743 PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name);
4732 struct _pidgin_blist_node *ui; 4744 struct _pidgin_blist_node *ui;
4733 if (!chat) 4745 if (!chat)
6090 PURPLE_CALLBACK(conversation_deleting_cb), 6102 PURPLE_CALLBACK(conversation_deleting_cb),
6091 gtkblist); 6103 gtkblist);
6092 purple_signal_connect(handle, "conversation-created", gtkblist, 6104 purple_signal_connect(handle, "conversation-created", gtkblist,
6093 PURPLE_CALLBACK(conversation_created_cb), 6105 PURPLE_CALLBACK(conversation_created_cb),
6094 gtkblist); 6106 gtkblist);
6107 purple_signal_connect(handle, "chat-joined", gtkblist,
6108 PURPLE_CALLBACK(chat_joined_cb),
6109 gtkblist);
6095 6110
6096 gtk_widget_hide(gtkblist->headline_hbox); 6111 gtk_widget_hide(gtkblist->headline_hbox);
6097 6112
6098 show_initial_account_errors(gtkblist); 6113 show_initial_account_errors(gtkblist);
6099 6114
6533 textcolor = NULL; 6548 textcolor = NULL;
6534 else if (theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL) 6549 else if (theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL)
6535 textcolor = pidgin_theme_font_get_color_describe(pair); 6550 textcolor = pidgin_theme_font_get_color_describe(pair);
6536 else 6551 else
6537 /* If no theme them default to making idle buddy names grey */ 6552 /* If no theme them default to making idle buddy names grey */
6538 textcolor = "dim grey"; 6553 textcolor = pidgin_style_is_dark(NULL) ? "light slate grey" : "dim grey";
6539 6554
6540 if (textcolor) { 6555 if (textcolor) {
6541 idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>", 6556 idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>",
6542 textcolor, theme_font_get_face_default(pair, ""), 6557 textcolor, theme_font_get_face_default(pair, ""),
6543 ihrs, imin); 6558 ihrs, imin);

mercurial