fix: text direction on RTL window

fix: #19
This commit is contained in:
Evangelos Paterakis 2022-11-27 18:05:56 +02:00
parent 6999d46539
commit aaabd3517a
No known key found for this signature in database
GPG Key ID: FE5185F095BFC8C9
2 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,7 @@ namespace Tooth {
public static ImageCache image_cache;
public static GLib.Regex rtl_regex;
public static bool is_rtl;
public static bool start_hidden = false;
@ -147,8 +148,10 @@ namespace Tooth {
}
else {
message ("Presenting MainWindow");
if (main_window == null)
if (main_window == null) {
main_window = new Dialogs.MainWindow (this);
is_rtl = main_window.get_default_direction() == Gtk.TextDirection.RTL;
}
main_window.present ();
}
}

View File

@ -55,7 +55,9 @@ public class Tooth.Widgets.RichLabel : Adw.Bin {
widget.set_label (text);
var rtl = rtl_regex.match(text);
if (rtl) {
xalign = 1;
xalign = is_rtl ? 0 : 1;
} else {
xalign = is_rtl ? 1 : 0;
}
}