Merge lp:~l-admin-3/gala/workspace-switcher-background-setting into lp:gala

Proposed by Marcus Wichelmann
Status: Merged
Approved by: Tom Beckmann
Approved revision: 429
Merged at revision: 428
Proposed branch: lp:~l-admin-3/gala/workspace-switcher-background-setting
Merge into: lp:gala
Diff against target: 64 lines (+21/-1)
4 files modified
data/org.pantheon.desktop.gala.gschema.xml.in.in (+4/-0)
src/Background/SystemBackground.vala (+1/-1)
src/InternalUtils.vala (+15/-0)
src/Settings.vala (+1/-0)
To merge this branch: bzr merge lp:~l-admin-3/gala/workspace-switcher-background-setting
Reviewer Review Type Date Requested Status
Tom Beckmann Approve
Rico Tzschichholz Abstain
Marcus Wichelmann (community) Needs Resubmitting
Robert Roth (community) code Approve
Review via email: mp+237166@code.launchpad.net

Commit message

systembackground: add setting to change the background image of the system background

Description of the change

These changes are making it possible to change the background-image of the workspace-switcher (the default is this gray background) in org.pantheon.desktop.gala.appearance.

To test it, please download this branch, compile it and install it. Then it should be possible to change the setting (org.pantheon.desktop.gala.appearance => workspace-switcher-background) to an own image. After logging in and out the image should be used in the workspace-overview.

I think, this setting will be very helful if you want to customize the background without replacing the texture.png after every update.

To post a comment you must log in.
Revision history for this message
Robert Roth (evfool) wrote :

Code looks fine, and a setting is indeed better than hardcoding the file to use. Maybe checking if the file exists and falling back to the default if not would be useful, but not absolutely required.

review: Approve (code)
Revision history for this message
Robert Roth (evfool) wrote :

By the way, please set a short commit message ("Set commit message" link above "Description of change")

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Yes an existence check to fallback to the internally shipped texture should be added.

Also do not touch the file endings. Please revert those.

You realize you are hardcoding the default texture location, despite having it adjusted to the install location. Please use an autoconf preprocessor variable (AC_SUBST) to adjust it accordingly in the schema.

review: Needs Fixing
Revision history for this message
Marcus Wichelmann (l-admin-3) wrote :

I have added a fallback now. But I didn't know how to use theese autoconf-variables.

I'm using scratch-text-editor and the last line will be modified automatically without touching anything. Tips for preventing that would be very helpful.

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

I have pushed r421. There you can see how it works while looking at @GETTEXT_PACKAGE@

As the fallback check I would prefer a simple file-existence check (and *maybe* combined with a mime-type check to make sure it is an image-file)

Use any other text-editor to avoid stripping the file-ending ;)

Please rebase your work on latest trunk (squashed into on commit)

review: Needs Fixing
Revision history for this message
Marcus Wichelmann (l-admin-3) wrote :

Ok, I think I have understand what you mean, thanks!

I have choosen this fallback-check, because that checks if the file is readable, too. A filename check would only check if the file exists and not if the read permissions are set. Also I have used the same check like that to load the wallpaper, so the code would be more consistent.

What?! An elementary developer says I shouldn't use elementary software? ;) Isn't there any workaround for Scratch?
What is the correct format for the file endings? One empty line after the last braceright?

Do you mean I should merge trunk into my branch?

Sorry, I'm new to elementary-, Vala- and Linux-development...

Revision history for this message
Marcus Wichelmann (l-admin-3) wrote :

Oups, I saw yet, that a not readable texture.png would cause an infinite loop... Maybe I should restrict the count of tries. ;)

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Avoid this recursion completely and make sufficient checks before async-call.

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

Completely rebase the branch, so don't merge trunk.

Revision history for this message
Marcus Wichelmann (l-admin-3) wrote :

Ok, I will create a new branch later.

But I don't understand what the advantage of making some checks before trying to load the background should be.
Theese checks would be executed on every start up. My solution would only be executed if the choosen wallpaper isn't existent/readable/broken. So the startup would be fast like ever and would only be a small bit slower if the wallpaper isn't useable.

Revision history for this message
Marcus Wichelmann (l-admin-3) wrote :
Revision history for this message
Marcus Wichelmann (l-admin-3) wrote :

Like suggested by ricotz I've now overwritten this branch and removed the second one.

review: Needs Resubmitting
Revision history for this message
Rico Tzschichholz (ricotz) :
review: Abstain
429. By Marcus Wichelmann

Code moved to InternalUtils.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Looks great now

(in case anyone is wondering, the function was moved to utils, so that it can be used more easily from the 314 branch as well later)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/org.pantheon.desktop.gala.gschema.xml.in.in'
2--- data/org.pantheon.desktop.gala.gschema.xml.in.in 2014-11-15 23:59:26 +0000
3+++ data/org.pantheon.desktop.gala.gschema.xml.in.in 2015-01-04 12:17:10 +0000
4@@ -153,6 +153,10 @@
5 <default>0.0</default>
6 <_summary>The opacity of the windows located in the background in the alt-tab-switcher.</_summary>
7 </key>
8+ <key type="s" name="workspace-switcher-background">
9+ <default>''</default>
10+ <_summary>Background-image used in the workspace-switcher</_summary>
11+ </key>
12 </schema>
13
14 <schema path="/org/pantheon/desktop/gala/animations/" id="org.pantheon.desktop.gala.animations" gettext-domain="@GETTEXT_PACKAGE@">
15
16=== modified file 'src/Background/SystemBackground.vala'
17--- src/Background/SystemBackground.vala 2014-04-08 12:51:06 +0000
18+++ src/Background/SystemBackground.vala 2015-01-04 12:17:10 +0000
19@@ -27,7 +27,7 @@
20 construct
21 {
22 var cache = BackgroundCache.get_default ();
23- cache.load_image.begin (Config.PKGDATADIR + "/texture.png", 0,
24+ cache.load_image.begin (InternalUtils.get_system_background_path (), 0,
25 GDesktop.BackgroundStyle.WALLPAPER, (obj, res) => {
26 content = cache.load_image.end (res);
27 });
28
29=== modified file 'src/InternalUtils.vala'
30--- src/InternalUtils.vala 2014-07-18 22:42:06 +0000
31+++ src/InternalUtils.vala 2015-01-04 12:17:10 +0000
32@@ -171,6 +171,21 @@
33 Util.set_stage_input_region (screen, xregion);
34 }
35
36+ public static string get_system_background_path ()
37+ {
38+ var filename = AppearanceSettings.get_default ().workspace_switcher_background;
39+ var default_file = Config.PKGDATADIR + "/texture.png";
40+
41+ if (filename == "") {
42+ filename = default_file;
43+ } else if (!FileUtils.test (filename, FileTest.IS_REGULAR)) {
44+ warning ("Failed to load %s", filename);
45+ filename = default_file;
46+ }
47+
48+ return filename;
49+ }
50+
51 /**
52 * Inserts a workspace at the given index. To ensure the workspace is not immediately
53 * removed again when in dynamic workspaces, the window is first placed on it.
54
55=== modified file 'src/Settings.vala'
56--- src/Settings.vala 2014-04-19 12:57:09 +0000
57+++ src/Settings.vala 2015-01-04 12:17:10 +0000
58@@ -74,6 +74,7 @@
59 public bool attach_modal_dialogs { get; set; }
60 public bool dim_parents { get; set; }
61 public double alt_tab_window_opacity { get; set; }
62+ public string workspace_switcher_background { get; set; }
63
64 static AppearanceSettings? instance = null;
65

Subscribers

People subscribed via source and target branches