aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/CMakeLists.txt15
-rw-r--r--main/src/ui/util/helper.vala6
-rw-r--r--main/src/ui/widgets/avatar_picture.vala4
-rw-r--r--main/src/ui/widgets/fixed_ratio_picture.vala4
4 files changed, 25 insertions, 4 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 7f85f7ae..4e408294 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -111,9 +111,24 @@ endif()
if(GTK4_VERSION VERSION_GREATER_EQUAL "4.8")
set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} GTK_4_8)
endif()
+if(GTK4_VERSION VERSION_GREATER_EQUAL "4.12")
+ set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} GTK_4_12)
+endif()
if(Adwaita_VERSION VERSION_GREATER_EQUAL "1.2")
set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} Adw_1_2)
endif()
+if(VALA_VERSION VERSION_GREATER_EQUAL "0.56.5" AND VALA_VERSION VERSION_LESS "0.58")
+ set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} VALA_0_56_GREATER_5)
+endif()
+if(VALA_VERSION VERSION_GREATER_EQUAL "0.56.11" AND VALA_VERSION VERSION_LESS "0.58")
+ set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} VALA_0_56_GREATER_11)
+endif()
+if(VALA_VERSION VERSION_EQUAL "0.56.11")
+ set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} VALA_0_56_11)
+endif()
+if(VALA_VERSION VERSION_EQUAL "0.56.12")
+ set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} VALA_0_56_12)
+endif()
vala_precompile(MAIN_VALA_C
SOURCES
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index d6da72dd..63288fc2 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -103,7 +103,13 @@ private const string force_color_css = "%s { color: %s; }";
public static Gtk.CssProvider force_css(Gtk.Widget widget, string css) {
var p = new Gtk.CssProvider();
try {
+#if GTK_4_12 && (VALA_0_56_GREATER_11 || VALA_0_58)
+ p.load_from_string(css);
+#elif (VALA_0_56_11 || VALA_0_56_12)
+ p.load_from_data(css, css.length);
+#else
p.load_from_data(css.data);
+#endif
widget.get_style_context().add_provider(p, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (GLib.Error err) {
// handle err
diff --git a/main/src/ui/widgets/avatar_picture.vala b/main/src/ui/widgets/avatar_picture.vala
index e632413c..fb254915 100644
--- a/main/src/ui/widgets/avatar_picture.vala
+++ b/main/src/ui/widgets/avatar_picture.vala
@@ -454,7 +454,7 @@ public class Dino.Ui.AvatarPicture : Gtk.Widget {
label.insert_after(this, null);
label.attributes = new Pango.AttrList();
label.attributes.insert(Pango.attr_foreground_new(uint16.MAX, uint16.MAX, uint16.MAX));
-#if GTK_4_8 && VALA_0_58
+#if GTK_4_8 && (VALA_0_56_GREATER_5 || VALA_0_58)
picture.content_fit = Gtk.ContentFit.COVER;
#elif GTK_4_8
picture.@set("content-fit", 2);
@@ -516,4 +516,4 @@ public class Dino.Ui.AvatarPicture : Gtk.Widget {
base.snapshot(snapshot);
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/ui/widgets/fixed_ratio_picture.vala b/main/src/ui/widgets/fixed_ratio_picture.vala
index 79c60141..3e83ec0c 100644
--- a/main/src/ui/widgets/fixed_ratio_picture.vala
+++ b/main/src/ui/widgets/fixed_ratio_picture.vala
@@ -8,7 +8,7 @@ class Dino.Ui.FixedRatioPicture : Gtk.Widget {
public int max_height { get; set; default = int.MAX; }
public File file { get { return inner.file; } set { inner.file = value; } }
public Gdk.Paintable paintable { get { return inner.paintable; } set { inner.paintable = value; } }
-#if GTK_4_8 && VALA_0_58
+#if GTK_4_8 && (VALA_0_56_GREATER_5 || VALA_0_58)
public Gtk.ContentFit content_fit { get { return inner.content_fit; } set { inner.content_fit = value; } }
#endif
private Gtk.Picture inner = new Gtk.Picture();
@@ -85,4 +85,4 @@ class Dino.Ui.FixedRatioPicture : Gtk.Widget {
inner.unparent();
base.dispose();
}
-} \ No newline at end of file
+}