Skip to content

Commit

Permalink
Merge pull request #608 from openSUSE/drop-language1-service
Browse files Browse the repository at this point in the history
Drop `Language1` service
  • Loading branch information
imobachgs committed Jun 7, 2023
2 parents 7e56639 + e49cbf3 commit 6a995a1
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 545 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Agama consists on a set of D-Bus services and a web client (an experimental CLI
* Agama service: it is the main service which manages and controls the installation process.
* Software service: configures the product and software to install.
* Users service: manages first user creation and configuration for root.
* Language service: allows to configure the language and keyboard settings.
* Localization service: allows to configure the language and keyboard settings.
* Storage service: analyzes and prepares the storage devices in order to perform the installation.
* Questions service: helper service used for requesting information from clients.

Expand Down Expand Up @@ -138,10 +138,10 @@ $ busctl --address=unix:path=/run/agama/bus \

$ busctl --address=unix:path=/run/agama/bus \
call \
org.opensuse.Agama.Language1 \
/org/opensuse/Agama/Language1 \
org.opensuse.Agama.Locale1 \
/org/opensuse/Agama/Locale1 \
org.freedesktop.DBus.Properties \
GetAll s org.opensuse.Agama.Language1
GetAll s org.opensuse.Agama.Locale1
```

## How to Contribute
Expand Down
39 changes: 0 additions & 39 deletions doc/dbus/bus/org.opensuse.Agama.Language1.bus.xml

This file was deleted.

33 changes: 33 additions & 0 deletions doc/dbus/bus/org.opensuse.Agama.Locale1.bus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.opensuse.Agama.Locale1">
<!--
Get labels for locales. The first pair is english language and territory
and second one is localized one to target language from locale.
-->
<method name="LabelsForLocales">
<arg type="a((ss)(ss))" direction="out"/>
</method>
<method name="ListVConsoleKeyboards">
<arg type="as" direction="out"/>
</method>
<method name="ListTimezones">
<arg name="locale" type="s" direction="in"/>
<arg type="a(ss)" direction="out"/>
</method>
<method name="Commit">
</method>
<property name="Locales" type="as" access="readwrite"/>
<property name="SupportedLocales" type="as" access="readwrite"/>
<property name="Timezone" type="s" access="readwrite"/>
<property name="VConsoleKeyboard" type="s" access="readwrite"/>
</interface>
</node>

2 changes: 1 addition & 1 deletion doc/dbus/bus/seed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ look() {
> $DD.$1.bus.xml
}

look Language1
look Locale1
look Questions1
look Software1
look Software1.Proposal
Expand Down
46 changes: 0 additions & 46 deletions doc/dbus/org.opensuse.Agama.Language1.doc.xml

This file was deleted.

37 changes: 37 additions & 0 deletions doc/dbus/org.opensuse.Agama.Locale1.doc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/org/opensuse/Agama/Locale1">
<!--
org.opensuse.Agama.Locale1:
Implementation note about language identifiers:
Maybe use <ulink url="https://www.rubydoc.info/github/yast/yast-packager/master/LanguageTag">yast2-packager/LanguageTag</ulink>.
See <ulink url="https://lists.opensuse.org/archives/list/yast-devel&commat;lists.opensuse.org/message/D52PSZ7TRID2RVM6CE6K2C2RUNNGOS6Z/">its announcement on yast-devel</ulink>.
See also <ulink url="https://tools.ietf.org/html/rfc4647">RFC 4647 Matching of Language Tags</ulink>.
-->
<interface name="org.opensuse.Agama.Locale1">
<!--
Get labels for locales. The first pair is english language and territory
and second one is localized one to target language from locale.
-->
<method name="LabelsForLocales">
<arg type="a((ss)(ss))" direction="out"/>
</method>
<method name="ListVConsoleKeyboards">
<arg type="as" direction="out"/>
</method>
<method name="ListTimezones">
<arg name="locale" type="s" direction="in"/>
<arg type="a(ss)" direction="out"/>
</method>
<method name="Commit">
</method>
<property name="Locales" type="as" access="readwrite"/>
<property name="SupportedLocales" type="as" access="readwrite"/>
<property name="Timezone" type="s" access="readwrite"/>
<property name="VConsoleKeyboard" type="s" access="readwrite"/>
</interface>
</node>

8 changes: 4 additions & 4 deletions doc/dbus_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ should be prevented and instead use for that struct or dictionary object.

### Localization

We also discuss aproach how to solve localization of some strings like language human names,
We also discuss approach how to solve localization of some strings like language human names,
error messages from some scripts or strings from libraries.
Setting locale for whole service is basically discouraged as there can be multiple clients
working with given service, e.g. some log collector beside user doing setup.
Expand All @@ -44,12 +44,12 @@ We use these resources to get more familiar with D-Bus API designing.

## Language

Iface: o.o.Agama.Language1
Iface: o.o.Agama.Locale1

See the new-style [reference][lang-ref] ([source][lang-src]).

[lang-ref]: https://opensuse.github.io/agama/dbus/ref-org.opensuse.Agama.Language1.html
[lang-src]: dbus/org.opensuse.Agama.Language1.doc.xml
[lang-ref]: https://opensuse.github.io/agama/dbus/ref-org.opensuse.Agama.Locale1.html
[lang-src]: dbus/org.opensuse.Agama.Locale1.doc.xml

## Base Product

Expand Down
6 changes: 3 additions & 3 deletions rust/agama-dbus-server/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ pub struct LocaleService {

#[dbus_interface(name = "org.opensuse.Agama.Locale1")]
impl LocaleService {
// Can be `async` as well.
/// get labels for given locale. The first pair is english language and territory
/// Get labels for locales. The first pair is english language and territory
/// and second one is localized one to target language from locale.
///
/// Note: check how often it is used and if often, it can be easily cached
// Can be `async` as well.
// NOTE: check how often it is used and if often, it can be easily cached
fn labels_for_locales(&self) -> Result<Vec<((String, String), (String, String))>, Error> {
const DEFAULT_LANG: &str = "en";
let mut res = Vec::with_capacity(self.supported_locales.len());
Expand Down
51 changes: 29 additions & 22 deletions rust/agama-lib/src/proxies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,40 @@ trait Manager {
) -> zbus::Result<Vec<std::collections::HashMap<String, zbus::zvariant::OwnedValue>>>;
}

#[dbus_proxy(
interface = "org.opensuse.Agama.Language1",
default_service = "org.opensuse.Agama.Language1",
default_path = "/org/opensuse/Agama/Language1"
)]
trait Language1 {
/// Finish method
fn finish(&self) -> zbus::Result<()>;
#[dbus_proxy(interface = "org.opensuse.Agama.Locale1", assume_defaults = true)]
trait Locale1 {
/// Commit method
fn commit(&self) -> zbus::Result<()>;

/// LabelsForLocales method
fn labels_for_locales(&self) -> zbus::Result<Vec<(String, String)>>;

/// ListTimezones method
fn list_timezones(&self, locale: &str) -> zbus::Result<Vec<(String, String)>>;

/// ToInstall method
fn to_install(&self, lang_ids: &[&str]) -> zbus::Result<()>;
/// ListVConsoleKeyboards method
#[dbus_proxy(name = "ListVConsoleKeyboards")]
fn list_vconsole_keyboards(&self) -> zbus::Result<Vec<String>>;

/// AvailableLanguages property
/// Locales property
#[dbus_proxy(property)]
fn available_languages(
&self,
) -> zbus::Result<
Vec<(
String,
String,
std::collections::HashMap<String, zbus::zvariant::OwnedValue>,
)>,
>;
fn locales(&self) -> zbus::Result<Vec<String>>;
fn set_locales(&self, value: &[&str]) -> zbus::Result<()>;

/// SupportedLocales property
#[dbus_proxy(property)]
fn supported_locales(&self) -> zbus::Result<Vec<String>>;
fn set_supported_locales(&self, value: &[&str]) -> zbus::Result<()>;

/// MarkedForInstall property
/// Timezone property
#[dbus_proxy(property)]
fn marked_for_install(&self) -> zbus::Result<Vec<String>>;
fn timezone(&self) -> zbus::Result<String>;
fn set_timezone(&self, value: &str) -> zbus::Result<()>;

/// VConsoleKeyboard property
#[dbus_proxy(property, name = "VConsoleKeyboard")]
fn vconsole_keyboard(&self) -> zbus::Result<String>;
fn set_vconsole_keyboard(&self, value: &str) -> zbus::Result<()>;
}

#[dbus_proxy(
Expand Down
93 changes: 0 additions & 93 deletions service/lib/agama/dbus/language.rb

This file was deleted.

Loading

0 comments on commit 6a995a1

Please sign in to comment.