After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 162298 - [PATCH] GConf cleanup
[PATCH] GConf cleanup
Status: RESOLVED FIXED
Product: muine
Classification: Other
Component: general
trunk
Other Linux
: Normal normal
: ---
Assigned To: Muine Maintainers
Muine Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-12-27 07:34 UTC by Tamara Roberson
Modified: 2004-12-27 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GConf cleanup patch (13.45 KB, patch)
2004-12-27 07:35 UTC, Tamara Roberson
none Details | Review

Description Tamara Roberson 2004-12-27 07:34:17 UTC
This is a patch to cleanup the use of GConf in Muine (patch is against CVS as of
2004-12-26 but should also work against 0.7.0).

This patch should not change how Muine operates. If it does, it is a bug!

Overview:

2004-12-26  Tamara Roberson  <foxxygirltamara@gmail.com>

        * src/AddAlbumWindow.cs:
        * src/AddSongWindow.cs:
        * src/CoverDatabase.cs:
        * src/FileSelector.cs:
        * src/GnomeProxy.cs:
        * src/InfoWindow.cs:
        * src/Muine.cs:
        * src/PlaylistWindow.cs:
        * src/SongDatabase.cs:

        Cleaned up GConf code.


Number of lines removed: 140
Number of lines added:    41


Stability: This patch is not expected to break anything.


Description:

public static object Muine.GetGConfValue (string key)

        Get the value of "key" in GConf (see Muine.GConfClient).

public static object Muine.GetGConfValue (string key, object default_val)

        Same as Muine.GetGConfValue (string key) but returns "default_val" on
all exceptions.

public static void Muine.SetGConfValue (string key, object val)

        Sets the value of the GConf key "key" to "val".

---
Using Muine.GetGConfValue () allows a net difference of 99 lines to be removed
from the code by replacing this common construct:

        int width;
        try {
                width = (int) Muine.GConfClient.Get
("/apps/muine/add_album_window/width");
        } catch {
                width = 350;
        }

with:

        int width = (int) Muine.GetGConfValue
("/apps/muine/add_album_window/width", 350);

The Muine.GetGConfValue () method is not currently used. It simply calls
Muine.GConfClient.Get ().

The Muine.SetGConfValue () method is simply provided for symmetry with
Muine.GetGConfValue ().

This patch changes all instances of Muine.GConfClient.Get () and
Muine.GConfClient.Set () and replaces them with Muine.GetGConfValue () and
Muine.GetGconfValue () respectively.
Comment 1 Tamara Roberson 2004-12-27 07:35:38 UTC
Created attachment 35212 [details] [review]
GConf cleanup patch
Comment 2 Jorn Baayen 2004-12-27 18:40:06 UTC
Committed, thanks again!