comparison pidgin/gtkblist.c @ 27933:f44832c6a65b

propagate from branch 'im.pidgin.pidgin' (head a840b7a77c7e395db5e7877fab90763d91f70b3a) to branch 'im.pidgin.pidgin.yaz' (head 42d24988b115ba197f27a95547b1445c10f06d2c)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 08 Mar 2009 20:38:09 +0000
parents d8e6a2d592a4 c0115655a94e
children 1688f7e15530
comparison
equal deleted inserted replaced
27932:4033fea1709c 27933:f44832c6a65b
4000 status_font = name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4000 status_font = name_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4001 4001
4002 } else if (!purple_presence_is_online(presence)) { 4002 } else if (!purple_presence_is_online(presence)) {
4003 if (theme) 4003 if (theme)
4004 pair = pidgin_blist_theme_get_offline_text_info(theme); 4004 pair = pidgin_blist_theme_get_offline_text_info(theme);
4005 name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; 4005 name_color = (pair != NULL && pair->color != NULL) ? pair->color : NULL;
4006 name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4006 name_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4007 4007
4008 if (theme) 4008 if (theme)
4009 pair = pidgin_blist_theme_get_status_text_info(theme); 4009 pair = pidgin_blist_theme_get_status_text_info(theme);
4010 status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey"; 4010 status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey";
4011 status_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4011 status_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4012 4012
4013 } else if (purple_presence_is_available(presence)) { 4013 } else if (purple_presence_is_available(presence)) {
4014 if (theme) 4014 if (theme)
4015 pair = pidgin_blist_theme_get_online_text_info(theme); 4015 pair = pidgin_blist_theme_get_online_text_info(theme);
4016 name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; 4016 name_color = (pair != NULL && pair->color != NULL) ? pair->color : NULL;
4017 name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4017 name_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4018 4018
4019 if (theme) 4019 if (theme)
4020 pair = pidgin_blist_theme_get_status_text_info(theme); 4020 pair = pidgin_blist_theme_get_status_text_info(theme);
4021 status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey"; 4021 status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey";
4022 status_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4022 status_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4023 4023
4024 } else { 4024 } else {
4025 if (theme) 4025 if (theme)
4026 pair = pidgin_blist_theme_get_away_text_info(theme); 4026 pair = pidgin_blist_theme_get_away_text_info(theme);
4027 name_color = (pair != NULL && pair->color != NULL) ? pair->color : "black"; 4027 name_color = (pair != NULL && pair->color != NULL) ? pair->color : NULL;
4028 name_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4028 name_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4029 4029
4030 if (theme) 4030 if (theme)
4031 pair = pidgin_blist_theme_get_status_text_info(theme); 4031 pair = pidgin_blist_theme_get_status_text_info(theme);
4032 status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey"; 4032 status_color = (pair != NULL && pair->color != NULL) ? pair->color : "dim grey";
4033 status_font = (pair != NULL && pair->font != NULL) ? pair->font : ""; 4033 status_font = (pair != NULL && pair->font != NULL) ? pair->font : "";
4034 } 4034 }
4035 4035
4036 if (aliased && selected) { 4036 if (aliased && selected) {
4037 name_color = "black"; 4037 if (theme) {
4038 status_color = "black"; 4038 name_color = "black";
4039 status_color = "black";
4040 } else {
4041 name_color = NULL;
4042 status_color = NULL;
4043 }
4039 } 4044 }
4040 4045
4041 /* Put it all together */ 4046 /* Put it all together */
4042 if (aliased && biglist && (statustext || idletime)) { 4047 if (aliased && biglist && (statustext || idletime)) {
4043 /* using <span size='smaller'> breaks the status, so it must be seperated into <small><span>*/ 4048 /* using <span size='smaller'> breaks the status, so it must be seperated into <small><span>*/
4044 text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n" 4049 if (name_color) {
4045 "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>", 4050 text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n"
4046 name_font, name_color, nametext, status_font, status_color, 4051 "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>",
4047 idletime != NULL ? idletime : "", 4052 name_font, name_color, nametext, status_font, status_color,
4048 (idletime != NULL && statustext != NULL) ? " - " : "", 4053 idletime != NULL ? idletime : "",
4049 statustext != NULL ? statustext : ""); 4054 (idletime != NULL && statustext != NULL) ? " - " : "",
4050 4055 statustext != NULL ? statustext : "");
4051 } else 4056 } else if (status_color) {
4052 text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", name_font, name_color, nametext); 4057 text = g_strdup_printf("<span font_desc='%s'>%s</span>\n"
4053 4058 "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>",
4059 name_font, nametext, status_font, status_color,
4060 idletime != NULL ? idletime : "",
4061 (idletime != NULL && statustext != NULL) ? " - " : "",
4062 statustext != NULL ? statustext : "");
4063 } else {
4064 text = g_strdup_printf("<span font_desc='%s'>%s</span>\n"
4065 "<small><span font_desc='%s'>%s%s%s</span></small>",
4066 name_font, nametext, status_font,
4067 idletime != NULL ? idletime : "",
4068 (idletime != NULL && statustext != NULL) ? " - " : "",
4069 statustext != NULL ? statustext : "");
4070 }
4071 } else {
4072 if (name_color) {
4073 text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>",
4074 name_font, name_color, nametext);
4075 } else {
4076 text = g_strdup_printf("<span font_desc='%s'>%s</span>", name_font,
4077 nametext);
4078 }
4079 }
4054 g_free(nametext); 4080 g_free(nametext);
4055 g_free(statustext); 4081 g_free(statustext);
4056 g_free(idletime); 4082 g_free(idletime);
4057 4083
4058 if (hidden_conv) { 4084 if (hidden_conv) {
4816 } 4842 }
4817 4843
4818 #define SSL_FAQ_URI "http://d.pidgin.im/wiki/FAQssl" 4844 #define SSL_FAQ_URI "http://d.pidgin.im/wiki/FAQssl"
4819 4845
4820 static void 4846 static void
4821 ssl_faq_clicked_cb(GtkButton *button, 4847 ssl_faq_clicked_cb(PidginMiniDialog *mini_dialog,
4822 PurpleAccount *account) 4848 GtkButton *button,
4849 gpointer ignored)
4823 { 4850 {
4824 purple_notify_uri(NULL, SSL_FAQ_URI); 4851 purple_notify_uri(NULL, SSL_FAQ_URI);
4825 } 4852 }
4826 4853
4827 static void 4854 static void
4850 g_free(primary); 4877 g_free(primary);
4851 4878
4852 g_object_set_data(G_OBJECT(mini_dialog), OBJECT_DATA_KEY_ACCOUNT, 4879 g_object_set_data(G_OBJECT(mini_dialog), OBJECT_DATA_KEY_ACCOUNT,
4853 account); 4880 account);
4854 4881
4855 if(err->type == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT) { 4882 if(err->type == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT)
4856 GtkWidget *faq_button = gtk_button_new(); 4883 pidgin_mini_dialog_add_button(PIDGIN_MINI_DIALOG(mini_dialog),
4857 GtkWidget *faq_label = gtk_label_new(NULL); 4884 _("SSL FAQs"), ssl_faq_clicked_cb, NULL);
4858 gtk_label_set_markup(GTK_LABEL(faq_label),
4859 "<span underline=\"single\" foreground=\"blue\""
4860 " size=\"smaller\">" SSL_FAQ_URI "</span>");
4861 #if GTK_CHECK_VERSION(2,6,0)
4862 g_object_set(G_OBJECT(faq_label), "ellipsize",
4863 PANGO_ELLIPSIZE_MIDDLE, NULL);
4864 #endif
4865 gtk_container_add(GTK_CONTAINER(faq_button), faq_label);
4866 gtk_button_set_relief(GTK_BUTTON(faq_button), GTK_RELIEF_NONE);
4867
4868 g_signal_connect(faq_button, "clicked",
4869 (GCallback)ssl_faq_clicked_cb, account);
4870
4871 gtk_box_pack_start(PIDGIN_MINI_DIALOG(mini_dialog)->contents,
4872 faq_button, FALSE, FALSE, 0);
4873 }
4874 4885
4875 g_signal_connect_after(mini_dialog, "destroy", 4886 g_signal_connect_after(mini_dialog, "destroy",
4876 (GCallback)generic_error_destroy_cb, 4887 (GCallback)generic_error_destroy_cb,
4877 account); 4888 account);
4878 4889
6163 pair = pidgin_blist_theme_get_expanded_text_info(theme); 6174 pair = pidgin_blist_theme_get_expanded_text_info(theme);
6164 else 6175 else
6165 pair = pidgin_blist_theme_get_collapsed_text_info(theme); 6176 pair = pidgin_blist_theme_get_collapsed_text_info(theme);
6166 6177
6167 6178
6168 text_color = (selected || pair == NULL || pair->color == NULL) ? "black" : pair->color; 6179 text_color = (selected || pair == NULL || pair->color == NULL) ? NULL : pair->color;
6169 text_font = (pair == NULL || pair->font == NULL) ? "" : pair->font; 6180 text_font = (pair == NULL || pair->font == NULL) ? "" : pair->font;
6170 6181
6171 esc = g_markup_escape_text(group->name, -1); 6182 esc = g_markup_escape_text(group->name, -1);
6172 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s</span>", 6183 if (text_color) {
6184 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s</span>",
6173 text_color, text_font, esc ? esc : "", group_count); 6185 text_color, text_font, esc ? esc : "", group_count);
6186 } else {
6187 mark = g_strdup_printf("<span font_desc='%s'><b>%s</b>%s</span>",
6188 text_font, esc ? esc : "", group_count);
6189 }
6174 6190
6175 g_free(esc); 6191 g_free(esc);
6176 return mark; 6192 return mark;
6177 } 6193 }
6178 6194
6229 imin = ((t - idle_secs) / 60) % 60; 6245 imin = ((t - idle_secs) / 60) % 60;
6230 6246
6231 if (!selected && theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL && pair->color != NULL) 6247 if (!selected && theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL && pair->color != NULL)
6232 textcolor = pair->color; 6248 textcolor = pair->color;
6233 else 6249 else
6234 textcolor = "black"; 6250 textcolor = NULL;
6235 6251
6236 idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>", textcolor, 6252 if (textcolor) {
6237 (pair == NULL || pair->font == NULL) ? "" : pair->font, ihrs, imin); 6253 idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>",
6254 textcolor, (pair == NULL || pair->font == NULL) ? "" : pair->font,
6255 ihrs, imin);
6256 } else {
6257 idle = g_strdup_printf("<span font_desc='%s'>%d:%02d</span>",
6258 (pair == NULL || pair->font == NULL) ? "" : pair->font,
6259 ihrs, imin);
6260 }
6238 } 6261 }
6239 } 6262 }
6240 6263
6241 prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL); 6264 prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL);
6242 6265
6329 pair = pidgin_blist_theme_get_contact_text_info(theme); 6352 pair = pidgin_blist_theme_get_contact_text_info(theme);
6330 color = pidgin_blist_theme_get_contact_color(theme); 6353 color = pidgin_blist_theme_get_contact_color(theme);
6331 } 6354 }
6332 6355
6333 font = (pair == NULL || pair->font == NULL) ? "" : pair->font; 6356 font = (pair == NULL || pair->font == NULL) ? "" : pair->font;
6334 fg_color = (selected || pair == NULL || pair->color == NULL) ? "black" : pair->color; 6357 fg_color = (selected || pair == NULL || pair->color == NULL) ? NULL : pair->color;
6335 6358
6336 tmp = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>", 6359 if (fg_color) {
6360 tmp = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>",
6337 font, fg_color, mark); 6361 font, fg_color, mark);
6362 } else {
6363 tmp = g_strdup_printf("<span font_desc='%s'>%s</span>", font,
6364 mark);
6365 }
6338 g_free(mark); 6366 g_free(mark);
6339 mark = tmp; 6367 mark = tmp;
6340 6368
6341 status = pidgin_blist_get_status_icon(cnode, 6369 status = pidgin_blist_get_status_icon(cnode,
6342 biglist? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); 6370 biglist? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL);
6462 6490
6463 6491
6464 font = (pair == NULL || pair->font == NULL) ? "" : pair->font; 6492 font = (pair == NULL || pair->font == NULL) ? "" : pair->font;
6465 if (selected || pair == NULL || pair->color == NULL) 6493 if (selected || pair == NULL || pair->color == NULL)
6466 /* nick_said color is the same as gtkconv:tab-label-attention */ 6494 /* nick_said color is the same as gtkconv:tab-label-attention */
6467 color = (nick_said ? "#006aff" : "black"); 6495 color = (nick_said ? "#006aff" : NULL);
6468 else 6496 else
6469 color = pair->color; 6497 color = pair->color;
6470 6498
6471 tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>", 6499 if (color) {
6472 font, color, hidden ? "bold" : "normal", mark); 6500 tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>",
6473 6501 font, color, hidden ? "bold" : "normal", mark);
6502 } else {
6503 tmp = g_strdup_printf("<span font_desc='%s' weight='%s'>%s</span>",
6504 font, hidden ? "bold" : "normal", mark);
6505 }
6474 g_free(mark); 6506 g_free(mark);
6475 mark = tmp; 6507 mark = tmp;
6476 6508
6477 prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL); 6509 prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL);
6478 6510