pidgin/gtkconv.c

changeset 33513
abde619c77bf
parent 33510
8019461267d9
parent 33394
a9fbe66bccc2
child 33514
d6f30dcbfd7e
equal deleted inserted replaced
33512:ac7b43f34108 33513:abde619c77bf
8790 purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_CONV_THEME_LOADER, "type", "conversation", NULL)); 8790 purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_CONV_THEME_LOADER, "type", "conversation", NULL));
8791 theme_dir = g_build_filename(DATADIR, "pidgin", "theme", NULL); 8791 theme_dir = g_build_filename(DATADIR, "pidgin", "theme", NULL);
8792 default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation"); 8792 default_conv_theme = purple_theme_manager_load_theme(theme_dir, "conversation");
8793 g_free(theme_dir); 8793 g_free(theme_dir);
8794 8794
8795 #if !GTK_CHECK_VERSION(3,0,0)
8795 { 8796 {
8796 /* Set default tab colors */ 8797 /* Set default tab colors */
8797 GString *str = g_string_new(NULL); 8798 GString *str = g_string_new(NULL);
8798 GtkSettings *settings = gtk_settings_get_default(); 8799 GtkSettings *settings = gtk_settings_get_default();
8799 GtkStyle *parent = gtk_rc_get_style_by_paths(settings, "tab-container.tab-label*", NULL, G_TYPE_NONE), *now; 8800 GtkStyle *parent = gtk_rc_get_style_by_paths(settings, "tab-container.tab-label*", NULL, G_TYPE_NONE), *now;
8825 } 8826 }
8826 gtk_rc_parse_string(str->str); 8827 gtk_rc_parse_string(str->str);
8827 g_string_free(str, TRUE); 8828 g_string_free(str, TRUE);
8828 gtk_rc_reset_styles(settings); 8829 gtk_rc_reset_styles(settings);
8829 } 8830 }
8831 #endif
8830 } 8832 }
8831 8833
8832 void 8834 void
8833 pidgin_conversations_uninit(void) 8835 pidgin_conversations_uninit(void)
8834 { 8836 {
10185 gtk_widget_set_tooltip_text(widget, NULL); 10187 gtk_widget_set_tooltip_text(widget, NULL);
10186 10188
10187 return FALSE; 10189 return FALSE;
10188 } 10190 }
10189 10191
10192 #if GTK_CHECK_VERSION(3,0,0)
10193 static void set_default_tab_colors(GtkWidget *widget)
10194 {
10195 GString *str;
10196 GtkCssProvider *provider;
10197 GError *error = NULL;
10198 int iter;
10199
10200 struct {
10201 const char *labelname;
10202 const char *color;
10203 } styles[] = {
10204 {"tab-label-typing", "#4e9a06"},
10205 {"tab-label-typed", "#c4a000"},
10206 {"tab-label-attention", "#006aff"},
10207 {"tab-label-unreadchat", "#cc0000"},
10208 {"tab-label-event", "#888a85"},
10209 {NULL, NULL}
10210 };
10211
10212 str = g_string_new(NULL);
10213
10214 for (iter = 0; styles[iter].labelname; iter++) {
10215 g_string_append_printf(str, "#%s {\n"
10216 " color: %s;\n"
10217 "}\n",
10218 styles[iter].labelname,
10219 styles[iter].color);
10220 }
10221
10222 provider = gtk_css_provider_new();
10223
10224 gtk_css_provider_load_from_data(provider, str->str, str->len, &error);
10225
10226 gtk_style_context_add_provider(gtk_widget_get_style_context(widget),
10227 provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
10228
10229 if (error)
10230 g_error_free(error);
10231 g_string_free(str, TRUE);
10232 }
10233 #endif
10234
10190 void 10235 void
10191 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv) 10236 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv)
10192 { 10237 {
10193 PurpleConversation *conv = gtkconv->active_conv; 10238 PurpleConversation *conv = gtkconv->active_conv;
10194 PidginConversation *focus_gtkconv; 10239 PidginConversation *focus_gtkconv;
10223 gtk_widget_show(gtkconv->icon); 10268 gtk_widget_show(gtkconv->icon);
10224 update_tab_icon(conv); 10269 update_tab_icon(conv);
10225 10270
10226 /* Tab label. */ 10271 /* Tab label. */
10227 gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv)); 10272 gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv));
10273 #if GTK_CHECK_VERSION(3,0,0)
10274 set_default_tab_colors(gtkconv->tab_label);
10275 #endif
10228 gtk_widget_set_name(gtkconv->tab_label, "tab-label"); 10276 gtk_widget_set_name(gtkconv->tab_label, "tab-label");
10229 10277
10230 gtkconv->menu_tabby = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); 10278 gtkconv->menu_tabby = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
10231 gtkconv->menu_label = gtk_label_new(tmp_lab); 10279 gtkconv->menu_label = gtk_label_new(tmp_lab);
10232 gtk_box_pack_start(GTK_BOX(gtkconv->menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0); 10280 gtk_box_pack_start(GTK_BOX(gtkconv->menu_tabby), gtkconv->menu_icon, FALSE, FALSE, 0);

mercurial