pidgin/gtkconv.c

changeset 38748
17f8a2a8ccba
parent 38712
ea49cd76cf47
parent 38699
e7b5011e4728
child 38833
47a8f1e4c414
equal deleted inserted replaced
38747:40a320274adc 38748:17f8a2a8ccba
59 #include "gtklog.h" 59 #include "gtklog.h"
60 #include "gtkmenutray.h" 60 #include "gtkmenutray.h"
61 #include "gtkpounce.h" 61 #include "gtkpounce.h"
62 #include "gtkprefs.h" 62 #include "gtkprefs.h"
63 #include "gtkprivacy.h" 63 #include "gtkprivacy.h"
64 #include "gtkstyle.h"
64 #include "gtkutils.h" 65 #include "gtkutils.h"
65 #include "gtkwebview.h" 66 #include "gtkwebview.h"
66 #include "pidginstock.h" 67 #include "pidginstock.h"
67 #include "pidgintooltip.h" 68 #include "pidgintooltip.h"
68 69
8938 { 8939 {
8939 g_hash_table_destroy(e2ee_stock); 8940 g_hash_table_destroy(e2ee_stock);
8940 e2ee_stock = NULL; 8941 e2ee_stock = NULL;
8941 } 8942 }
8942 8943
8944 /* Invalidate the first tab color set */
8945 static gboolean tab_color_fuse = TRUE;
8946
8947 static void
8948 pidgin_conversations_set_tab_colors(void)
8949 {
8950 /* Set default tab colors */
8951 GString *str = g_string_new(NULL);
8952 GtkSettings *settings = gtk_settings_get_default();
8953 GtkStyle *parent = gtk_rc_get_style_by_paths(settings, "tab-container.tab-label*", NULL, G_TYPE_NONE), *now;
8954 struct {
8955 const char *stylename;
8956 const char *labelname;
8957 const char *color;
8958 } styles[] = {
8959 {"pidgin_tab_label_typing_default", "tab-label-typing", "#4e9a06"},
8960 {"pidgin_tab_label_typed_default", "tab-label-typed", "#c4a000"},
8961 {"pidgin_tab_label_attention_default", "tab-label-attention", "#006aff"},
8962 {"pidgin_tab_label_unreadchat_default", "tab-label-unreadchat", "#cc0000"},
8963 {"pidgin_tab_label_event_default", "tab-label-event", "#888a85"},
8964 {NULL, NULL, NULL}
8965 };
8966 int iter;
8967
8968 if(tab_color_fuse) {
8969 tab_color_fuse = FALSE;
8970 return;
8971 }
8972
8973 for (iter = 0; styles[iter].stylename; iter++) {
8974 now = gtk_rc_get_style_by_paths(settings, styles[iter].labelname, NULL, G_TYPE_NONE);
8975 if (parent == now ||
8976 (parent && now && parent->rc_style == now->rc_style)) {
8977 GdkColor color;
8978 gdk_color_parse(styles[iter].color, &color);
8979 pidgin_style_adjust_contrast(gtk_widget_get_default_style(), &color);
8980
8981 g_string_append_printf(str, "style \"%s\" {\n"
8982 "fg[ACTIVE] = \"%s\"\n"
8983 "}\n"
8984 "widget \"*%s\" style \"%s\"\n",
8985 styles[iter].stylename,
8986 gdk_color_to_string(&color),
8987 styles[iter].labelname, styles[iter].stylename);
8988 }
8989 }
8990 gtk_rc_parse_string(str->str);
8991 g_string_free(str, TRUE);
8992 gtk_rc_reset_styles(settings);
8993 }
8994
8943 void 8995 void
8944 pidgin_conversations_uninit(void) 8996 pidgin_conversations_uninit(void)
8945 { 8997 {
8946 purple_prefs_disconnect_by_handle(pidgin_conversations_get_handle()); 8998 purple_prefs_disconnect_by_handle(pidgin_conversations_get_handle());
8947 purple_signals_disconnect_by_handle(pidgin_conversations_get_handle()); 8999 purple_signals_disconnect_by_handle(pidgin_conversations_get_handle());
10245 #endif 10297 #endif
10246 10298
10247 purple_signal_emit(pidgin_conversations_get_handle(), 10299 purple_signal_emit(pidgin_conversations_get_handle(),
10248 "conversation-window-created", win); 10300 "conversation-window-created", win);
10249 10301
10302 /* Fix colours */
10303 pidgin_conversations_set_tab_colors();
10304
10250 return win; 10305 return win;
10251 } 10306 }
10252 10307
10253 void 10308 void
10254 pidgin_conv_window_destroy(PidginConvWindow *win) 10309 pidgin_conv_window_destroy(PidginConvWindow *win)
11208 time_t breakout_time; 11263 time_t breakout_time;
11209 11264
11210 gdk_rgba_parse(&nick_highlight, DEFAULT_HIGHLIGHT_COLOR); 11265 gdk_rgba_parse(&nick_highlight, DEFAULT_HIGHLIGHT_COLOR);
11211 gdk_rgba_parse(&send_color, DEFAULT_SEND_COLOR); 11266 gdk_rgba_parse(&send_color, DEFAULT_SEND_COLOR);
11212 11267
11268 pidgin_style_adjust_contrast(NULL, &nick_highlight);
11269 pidgin_style_adjust_contrast(NULL, &send_color);
11270
11213 srand(background.red * 65535 + background.green * 65535 + background.blue * 65535 + 1); 11271 srand(background.red * 65535 + background.green * 65535 + background.blue * 65535 + 1);
11214 11272
11215 breakout_time = time(NULL) + 3; 11273 breakout_time = time(NULL) + 3;
11216 11274
11217 /* first we look through the list of "good" colors: colors that differ from every other color in the 11275 /* first we look through the list of "good" colors: colors that differ from every other color in the

mercurial