[Merge] lp:~ubuntu-mate-dev/compiz/marco-gsettings into lp:compiz
Alberts Muktupāvels
alberts.muktupavels at gmail.com
Wed Mar 2 17:13:50 UTC 2016
I would use something like this:
static gboolean
is_mate_desktop (GWDSettingsStorageGSettings *storage)
{
GWDSettingsStorageGSettingsPrivate *priv;
const gchar *xdg_current_desktop;
gboolean retval;
gchar **desktops;
gint i;
priv = GET_PRIVATE (storage);
if (!priv->marco)
return FALSE;
xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
if (!xdg_current_desktop || *xdg_current_desktop == '\0')
return FALSE;
retval = FALSE;
desktops = g_strsplit (xdg_current_desktop, ":", 0);
for (i = 0; desktops[i] != NULL; i++)
{
if (g_strcmp0 (desktops[i], "MATE") == 0)
{
retval = TRUE;
break;
}
}
g_strfreev (desktops);
return retval;
}
But return value should not change so it is pointless to do same work multiple times. I think it might be better to add is_mate_desktop to GWDSettingsStorageGSettingsPrivate and initialize it in gwd_settings_storage_gsettings_new.
--
https://code.launchpad.net/~ubuntu-mate-dev/compiz/marco-gsettings/+merge/282882
Your team Ubuntu Sponsors Team is requested to review the proposed merge of lp:~ubuntu-mate-dev/compiz/marco-gsettings into lp:compiz.
More information about the Ubuntu-sponsors
mailing list