@@ -238,7 +238,7 @@ namespace jorts {
238238 color_button_strawberry. width_request = 24 ;
239239 color_button_strawberry. tooltip_text = _(" Strawberry" );
240240 color_button_strawberry. get_style_context (). add_class (" color-button" );
241- color_button_strawberry. get_style_context (). add_class (" color- strawberry" );
241+ color_button_strawberry. get_style_context (). add_class (" strawberry" );
242242
243243 var color_button_orange = new Gtk .Button ();
244244 color_button_orange. has_focus = false ;
@@ -249,7 +249,7 @@ namespace jorts {
249249
250250 var color_button_orange_context = color_button_orange. get_style_context ();
251251 color_button_orange_context. add_class (" color-button" );
252- color_button_orange_context. add_class (" color- orange" );
252+ color_button_orange_context. add_class (" orange" );
253253
254254 var color_button_banana = new Gtk .Button ();
255255 color_button_banana. has_focus = false ;
@@ -260,7 +260,7 @@ namespace jorts {
260260
261261 var color_button_banana_context = color_button_banana. get_style_context ();
262262 color_button_banana_context. add_class (" color-button" );
263- color_button_banana_context. add_class (" color- banana" );
263+ color_button_banana_context. add_class (" banana" );
264264
265265 var color_button_lime = new Gtk .Button ();
266266 color_button_lime. has_focus = false ;
@@ -271,7 +271,7 @@ namespace jorts {
271271
272272 var color_button_lime_context = color_button_lime. get_style_context ();
273273 color_button_lime_context. add_class (" color-button" );
274- color_button_lime_context. add_class (" color- lime" );
274+ color_button_lime_context. add_class (" lime" );
275275
276276 var color_button_blueberry = new Gtk .Button ();
277277 color_button_blueberry. has_focus = false ;
@@ -282,7 +282,7 @@ namespace jorts {
282282
283283 var color_button_blueberry_context = color_button_blueberry. get_style_context ();
284284 color_button_blueberry_context. add_class (" color-button" );
285- color_button_blueberry_context. add_class (" color- blueberry" );
285+ color_button_blueberry_context. add_class (" blueberry" );
286286
287287
288288 var color_button_bubblegum = new Gtk .Button ();
@@ -294,7 +294,7 @@ namespace jorts {
294294
295295 var color_button_bubblegum_context = color_button_blueberry. get_style_context ();
296296 color_button_bubblegum_context. add_class (" color-button" );
297- color_button_bubblegum_context. add_class (" color- bubblegum" );
297+ color_button_bubblegum_context. add_class (" bubblegum" );
298298
299299
300300 var color_button_grape = new Gtk .Button ();
@@ -306,7 +306,7 @@ namespace jorts {
306306
307307 var color_button_grape_context = color_button_grape. get_style_context ();
308308 color_button_grape_context. add_class (" color-button" );
309- color_button_grape_context. add_class (" color- grape" );
309+ color_button_grape_context. add_class (" grape" );
310310
311311 var color_button_cocoa = new Gtk .Button ();
312312 color_button_cocoa. has_focus = false ;
@@ -317,7 +317,7 @@ namespace jorts {
317317
318318 var color_button_cocoa_context = color_button_cocoa. get_style_context ();
319319 color_button_cocoa_context. add_class (" color-button" );
320- color_button_cocoa_context. add_class (" color- cocoa" );
320+ color_button_cocoa_context. add_class (" cocoa" );
321321
322322 var color_button_silver = new Gtk .Button ();
323323 color_button_silver. has_focus = false ;
@@ -328,7 +328,7 @@ namespace jorts {
328328
329329 var color_button_silver_context = color_button_silver. get_style_context ();
330330 color_button_silver_context. add_class (" color-button" );
331- color_button_silver_context. add_class (" color- silver" );
331+ color_button_silver_context. add_class (" silver" );
332332
333333
334334 var color_button_slate = new Gtk .Button ();
@@ -340,7 +340,7 @@ namespace jorts {
340340
341341 var color_button_slate_context = color_button_slate. get_style_context ();
342342 color_button_slate_context. add_class (" color-button" );
343- color_button_slate_context. add_class (" color- slate" );
343+ color_button_slate_context. add_class (" slate" );
344344
345345 var color_button_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 6 );
346346 // GTK4: append
@@ -526,27 +526,26 @@ namespace jorts {
526526 // And then this reconstructs a whole ass theme out of these two
527527 // Either it can be a service, or just all defined in CSS and add/remove css
528528 private void update_theme(string theme) {
529- print(uid. to_string ());
530529
531- this . get_style_context(). add_class(" mainwindow-%d " . printf(uid));
532- this . get_style_context(). add_class(" window-%d " . printf(uid));
533-
534- // Palette color
535- var css_provider = new Gtk .CssProvider ();
536- var style = jorts. Themer . generate_css(uid,theme);
537-
538- try {
539- css_provider. load_from_data(style, - 1 );
540-
541- } catch (GLib . Error e) {
542- warning (" Failed to parse css style : %s " , e. message);
543- }
530+ // in GTK4 we can replace this with setting css_classes
531+ string [] themes = {
532+ " BANANA" ,
533+ " BLUEBERRY" ,
534+ " BUBBLEGUM" ,
535+ " COCOA" ,
536+ " GRAPE" ,
537+ " LIME" ,
538+ " ORANGE" ,
539+ " SILVER" ,
540+ " SLATE" ,
541+ " STRAWBERRY"
542+ };
543+
544+ foreach (unowned var old_theme in themes) {
545+ get_style_context(). remove_class (old_theme);
546+ }
544547
545- Gtk . StyleContext . add_provider_for_screen (
546- Gdk . Screen . get_default (),
547- css_provider,
548- Gtk . STYLE_PROVIDER_PRIORITY_APPLICATION
549- );
548+ get_style_context(). add_class (theme);
550549 }
551550 }
552551
0 commit comments