Commit e00236c7 authored by Lucas Stephen Beeler's avatar Lucas Stephen Beeler

Closes #3833.

Fixed a mismatch between null strings and empty strings in the
configuration subsystem that caused setting a custom directory path
to fail.
parent 23e510a3
...@@ -232,8 +232,8 @@ public interface ConfigurationEngine : GLib.Object { ...@@ -232,8 +232,8 @@ public interface ConfigurationEngine : GLib.Object {
public abstract int get_int_property(ConfigurableProperty p) throws ConfigurationError; public abstract int get_int_property(ConfigurableProperty p) throws ConfigurationError;
public abstract void set_int_property(ConfigurableProperty p, int val) throws ConfigurationError; public abstract void set_int_property(ConfigurableProperty p, int val) throws ConfigurationError;
public abstract string? get_string_property(ConfigurableProperty p) throws ConfigurationError; public abstract string get_string_property(ConfigurableProperty p) throws ConfigurationError;
public abstract void set_string_property(ConfigurableProperty p, string? val) throws ConfigurationError; public abstract void set_string_property(ConfigurableProperty p, string val) throws ConfigurationError;
public abstract bool get_bool_property(ConfigurableProperty p) throws ConfigurationError; public abstract bool get_bool_property(ConfigurableProperty p) throws ConfigurationError;
public abstract void set_bool_property(ConfigurableProperty p, bool val) throws ConfigurationError; public abstract void set_bool_property(ConfigurableProperty p, bool val) throws ConfigurationError;
...@@ -417,7 +417,8 @@ public abstract class ConfigurationFacade : Object { ...@@ -417,7 +417,8 @@ public abstract class ConfigurationFacade : Object {
// //
public virtual string? get_directory_pattern() { public virtual string? get_directory_pattern() {
try { try {
return get_engine().get_string_property(ConfigurableProperty.DIRECTORY_PATTERN); string s = get_engine().get_string_property(ConfigurableProperty.DIRECTORY_PATTERN);
return (s == "") ? null : s;
} catch (ConfigurationError err) { } catch (ConfigurationError err) {
on_configuration_error(err); on_configuration_error(err);
...@@ -427,6 +428,9 @@ public abstract class ConfigurationFacade : Object { ...@@ -427,6 +428,9 @@ public abstract class ConfigurationFacade : Object {
public virtual void set_directory_pattern(string? s) { public virtual void set_directory_pattern(string? s) {
try { try {
if (s == null)
s = "";
get_engine().set_string_property(ConfigurableProperty.DIRECTORY_PATTERN, s); get_engine().set_string_property(ConfigurableProperty.DIRECTORY_PATTERN, s);
} catch (ConfigurationError err) { } catch (ConfigurationError err) {
on_configuration_error(err); on_configuration_error(err);
......
...@@ -244,7 +244,7 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object { ...@@ -244,7 +244,7 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object {
} }
} }
private string? get_gconf_string(string path) throws ConfigurationError { private string get_gconf_string(string path) throws ConfigurationError {
GConf.Value? val = null; GConf.Value? val = null;
try { try {
val = client.get(path); val = client.get(path);
...@@ -262,7 +262,7 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object { ...@@ -262,7 +262,7 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object {
return stored; return stored;
} }
private void set_gconf_string(string path, string? value) throws ConfigurationError { private void set_gconf_string(string path, string value) throws ConfigurationError {
try { try {
client.set_string(path, value); client.set_string(path, value);
} catch (Error err) { } catch (Error err) {
...@@ -284,11 +284,11 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object { ...@@ -284,11 +284,11 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object {
property_changed(p); property_changed(p);
} }
public string? get_string_property(ConfigurableProperty p) throws ConfigurationError { public string get_string_property(ConfigurableProperty p) throws ConfigurationError {
return get_gconf_string(property_paths[p]); return get_gconf_string(property_paths[p]);
} }
public void set_string_property(ConfigurableProperty p, string? val) throws ConfigurationError { public void set_string_property(ConfigurableProperty p, string val) throws ConfigurationError {
set_gconf_string(property_paths[p], val); set_gconf_string(property_paths[p], val);
property_changed(p); property_changed(p);
......
...@@ -259,7 +259,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object { ...@@ -259,7 +259,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
property_changed(p); property_changed(p);
} }
public string? get_string_property(ConfigurableProperty p) throws ConfigurationError { public string get_string_property(ConfigurableProperty p) throws ConfigurationError {
string gs_result = get_gs_string(schema_names[p], key_names[p]); string gs_result = get_gs_string(schema_names[p], key_names[p]);
// if we're getting the desktop background file, convert the file uri we get back from // if we're getting the desktop background file, convert the file uri we get back from
...@@ -272,7 +272,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object { ...@@ -272,7 +272,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
return result; return result;
} }
public void set_string_property(ConfigurableProperty p, string? val) throws ConfigurationError { public void set_string_property(ConfigurableProperty p, string val) throws ConfigurationError {
// if we're setting the desktop background file, convert the filename into a file URI // if we're setting the desktop background file, convert the filename into a file URI
string converted_val = val; string converted_val = val;
if (p == ConfigurableProperty.DESKTOP_BACKGROUND_FILE) { if (p == ConfigurableProperty.DESKTOP_BACKGROUND_FILE) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment