Merge lp:~smspillaz/compiz-core/compiz-core.fix_936781 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Approved by: Alan Griffiths
Approved revision: 3012
Merged at revision: 3017
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_936781
Merge into: lp:compiz-core
Diff against target: 36 lines (+9/-6)
1 file modified
gtk/window-decorator/settings.c (+9/-6)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_936781
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Daniel van Vugt Approve
Review via email: mp+93948@code.launchpad.net

This proposal supersedes a proposal from 2012-02-20.

Description of the change

Check if the mutter key exists before using it

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I thought the fallback draggable border width should come from the theme definition. Or is it not in the theme?

review: Needs Information
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Mon, 20 Feb 2012, Daniel van Vugt wrote:

> Review: Needs Information
>
> I thought the fallback draggable border width should come from the theme definition. Or is it not in the theme?

Not anymore, I dropped that patch

> --
> https://code.launchpad.net/~smspillaz/compiz-core/compiz-core.fix_936781/+merge/93776
> You are the owner of lp:~smspillaz/compiz-core/compiz-core.fix_936781.
>

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I think it would be cleaner to use the built-in error detection (last parameter)...
    new_width = gconf_client_get_int (client, MUTTER_DRAGGABLE_BORDER_WIDTH_KEY, &err);
instead of ignoring all the error codes ("NULL").

That would allow you to remove:
    if (gconf_client_dir_exists (client, "/apps/mutter/general", NULL))

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I had a look a the gconf documentation while I was writing this and it wasn't exactly all that clear as to what conditions the error bit would be set. Gconf has some weird semantics with schemaless keys (which is why gsettings exists), and really what I care about is whether or not that option actually exists in the directory, or if gconf is going to give me some default value. As far as I could tell, all it does is give you a default value of zero, which isn't particularly useful.

The reason why I chose to use that API is because 1) that API is there and seems to serve the purpose of checking whether or not a particular key exists in the database and 2) There is no documentation as to when Gconf will return an error condition for a missing key.

Of course, if you can point to something to the contrary I'd be glad to use that.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Ooook, didrocks says the GError gets set in this case. Soooo lets change that :)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Looks good and tests OK.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gtk/window-decorator/settings.c'
--- gtk/window-decorator/settings.c 2011-10-13 12:22:14 +0000
+++ gtk/window-decorator/settings.c 2012-02-21 10:23:49 +0000
@@ -21,10 +21,6 @@
2121
22#include "gtk-window-decorator.h"22#include "gtk-window-decorator.h"
2323
24/* TODO: Trash all of this and use a window property
25 * instead - much much cleaner!
26 */
27
28gboolean24gboolean
29shadow_property_changed (WnckScreen *s)25shadow_property_changed (WnckScreen *s)
30{26{
@@ -151,12 +147,19 @@
151static gboolean147static gboolean
152mutter_draggable_border_width_changed (GConfClient *client)148mutter_draggable_border_width_changed (GConfClient *client)
153{149{
150 static const unsigned int default_draggable_border_width = 7;
154 int new_width;151 int new_width;
155 int width = settings->mutter_draggable_border_width;152 int width = settings->mutter_draggable_border_width;
153 GError *error = NULL;
156154
157 new_width = gconf_client_get_int (client,155 new_width = gconf_client_get_int (client,
158 MUTTER_DRAGGABLE_BORDER_WIDTH_KEY,156 MUTTER_DRAGGABLE_BORDER_WIDTH_KEY,
159 NULL);157 &error);
158 if (error)
159 {
160 new_width = default_draggable_border_width;
161 g_error_free (error);
162 }
160163
161 if (new_width != width)164 if (new_width != width)
162 {165 {

Subscribers

People subscribed via source and target branches