Check for LC_MEASUREMENT in a more portable way (upstream).

This commit is contained in:
ajacoutot 2017-03-15 10:37:44 +00:00
parent ce330c233d
commit 1ac3050514
5 changed files with 22 additions and 121 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.73 2017/03/14 09:38:10 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.74 2017/03/15 10:37:44 ajacoutot Exp $
COMMENT = digital photo organizer
GNOME_VERSION = 0.25.92
GNOME_PROJECT = shotwell
REVISION = 0
CATEGORIES = graphics

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-misc_org_yorba_shotwell_gschema_xml,v 1.1 2017/03/14 09:38:10 ajacoutot Exp $
REVERT: LC_MEASUREMENT is a GNU extension
From eaf7e88240369f87defe0f7f8ba9fe9f468a256e Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Mon, 13 Mar 2017 19:33:07 +0100
Subject: printing: Use inch/cm depending on locale settings
--- misc/org.yorba.shotwell.gschema.xml.orig Mon Mar 13 19:34:49 2017
+++ misc/org.yorba.shotwell.gschema.xml Tue Mar 14 10:27:42 2017
@@ -668,7 +668,7 @@
</key>
<key name="size-selection" type="i">
- <default>-1</default>
+ <default>3</default>
<summary>size selection</summary>
<description>The index of the current print size in a pre-defined list of standard sizes</description>
</key>

View File

@ -1,27 +0,0 @@
$OpenBSD: patch-src_Printing_vala,v 1.3 2017/03/14 09:38:10 ajacoutot Exp $
REVERT: LC_MEASUREMENT is a GNU extension
From eaf7e88240369f87defe0f7f8ba9fe9f468a256e Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Mon, 13 Mar 2017 19:33:07 +0100
Subject: printing: Use inch/cm depending on locale settings
--- src/Printing.vala.orig Mon Mar 13 19:34:49 2017
+++ src/Printing.vala Tue Mar 14 10:27:44 2017
@@ -318,8 +318,6 @@ public class CustomPrintTab : Gtk.Box {
standard_sizes_combo.append_text(size.name);
}
- standard_sizes_combo.set_active(9 * Resources.get_default_measurement_unit());
-
custom_width_entry.insert_text.connect(on_entry_insert_text);
custom_width_entry.focus_out_event.connect(on_width_entry_focus_out);
@@ -327,7 +325,6 @@ public class CustomPrintTab : Gtk.Box {
custom_height_entry.focus_out_event.connect(on_height_entry_focus_out);
units_combo.changed.connect(on_units_combo_changed);
- units_combo.set_active(Resources.get_default_measurement_unit());
ppi_entry.insert_text.connect(on_ppi_entry_insert_text);
ppi_entry.focus_out_event.connect(on_ppi_entry_focus_out);

View File

@ -1,56 +1,30 @@
$OpenBSD: patch-src_Resources_vala,v 1.1 2017/03/14 09:38:10 ajacoutot Exp $
$OpenBSD: patch-src_Resources_vala,v 1.2 2017/03/15 10:37:44 ajacoutot Exp $
REVERT: LC_MEASUREMENT is a GNU extension
From eaf7e88240369f87defe0f7f8ba9fe9f468a256e Mon Sep 17 00:00:00 2001
From b11f1b0fe626f50c5c715018d97bf7e438777fd7 Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Mon, 13 Mar 2017 19:33:07 +0100
Subject: printing: Use inch/cm depending on locale settings
Date: Tue, 14 Mar 2017 20:44:44 +0100
Subject: Check for LC_MEASUREMENT in a more portable way
--- src/Resources.vala.orig Mon Mar 13 19:34:49 2017
+++ src/Resources.vala Tue Mar 14 10:27:46 2017
@@ -765,45 +765,6 @@ along with Shotwell; if not, write to the Free Softwar
if (old_language != null) {
Environment.set_variable("LANGUAGE", old_language, true);
}
-
- }
-
+++ src/Resources.vala Wed Mar 15 11:18:41 2017
@@ -768,11 +768,6 @@ along with Shotwell; if not, write to the Free Softwar
}
- [CCode (cname = "int", cprefix = "LC_", cheader_filename = "locale.h", has_type_id = false)]
- private enum Lc {
- MEASUREMENT
- }
-
- public enum UnitSystem {
- IMPERIAL,
- METRIC,
- UNKNOWN
- }
-
- private string lc_measurement = null;
- private UnitSystem unit_system = UnitSystem.UNKNOWN;
- private const string IMPERIAL_COUNTRIES[] = {"unm_US", "es_US", "en_US", "yi_US" };
-
- public UnitSystem get_default_measurement_unit() {
- if (unit_system != UnitSystem.UNKNOWN) {
- return unit_system;
- }
-
public enum UnitSystem {
IMPERIAL,
METRIC,
@@ -788,7 +783,7 @@ along with Shotwell; if not, write to the Free Softwar
return unit_system;
}
- lc_measurement = Intl.setlocale((LocaleCategory) Lc.MEASUREMENT, null);
- if (lc_measurement == null) {
- lc_measurement = Intl.get_language_names()[0];
- }
-
- var index = lc_measurement.last_index_of_char('.');
- if (index > 0) {
- lc_measurement = lc_measurement.substring(0, index);
- }
-
- unit_system = UnitSystem.METRIC;
- if (lc_measurement in IMPERIAL_COUNTRIES) {
- unit_system = UnitSystem.IMPERIAL;
- }
-
- return unit_system;
}
/**
+ lc_measurement = Environment.get_variable("LC_MEASUREMENT");
if (lc_measurement == null) {
lc_measurement = Intl.get_language_names()[0];
}

View File

@ -1,28 +0,0 @@
$OpenBSD: patch-src_config_ConfigurationInterfaces_vala,v 1.1 2017/03/14 09:38:10 ajacoutot Exp $
REVERT: LC_MEASUREMENT is a GNU extension
From eaf7e88240369f87defe0f7f8ba9fe9f468a256e Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Mon, 13 Mar 2017 19:33:07 +0100
Subject: printing: Use inch/cm depending on locale settings
--- src/config/ConfigurationInterfaces.vala.orig Mon Mar 13 19:34:49 2017
+++ src/config/ConfigurationInterfaces.vala Tue Mar 14 10:27:49 2017
@@ -1515,16 +1515,7 @@ public abstract class ConfigurationFacade : Object {
//
public virtual int get_printing_size_selection() {
try {
- var val = get_engine().get_int_property(ConfigurableProperty.PRINTING_SIZE_SELECTION) - 1;
- if (val == -2) {
- if (Resources.get_default_measurement_unit() == Resources.UnitSystem.IMPERIAL) {
- val = 2;
- } else {
- val = 10;
- }
- }
-
- return val;
+ return get_engine().get_int_property(ConfigurableProperty.PRINTING_SIZE_SELECTION) - 1;
} catch (ConfigurationError err) {
on_configuration_error(err);