This file is indexed.

/usr/lib/python2.7/dist-packages/mate_menu/easygsettings.py is in mate-menu 18.04.3-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
# -*- coding: utf-8 -*-

# Copyright (C) 2007-2014 Clement Lefebvre <root@linuxmint.com>
# Copyright (C) 2015 Martin Wimpress <code@ubuntu-mate.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from gi.repository import Gio

class EasyGSettings:

    def __init__( self, schema = None ):
        self.schema = schema
        self.settings = Gio.Settings.new(self.schema)
        self.handlerIds = [ ]

    def get( self, type, key ):

        if type == "bool":
            return self.settings.get_boolean( key )
        if type == "string":
            return self.settings.get_string( key )
        if type == "int":
            return self.settings.get_int( key )
        if type == "color":
            color = self.settings.get_string( key )
            if not self.evalColor( color ):
                self.settings.set_string(key, "#ffffff")
                return "#ffffff"
            return color

        t = type.split("-")
        if len(t) == 2 and t[0] == "list":
            return self.settings.get_strv( key )

        return self.settings.get( key )

    def set( self, type, key, value ):

        if type == "bool":
            return self.settings.set_boolean( key, value )

        if type == "string":
            return self.settings.set_string( key, value )

        if type == "int":
            return self.settings.set_int( key, value )

        if type == "color":
            if self.evalColor( value ):
                return self.settings.set_string( key, value )
            else:
                return self.settings.set_string( key, "#ffffff" )

        t = type.split("-")
        if len(t) == 2 and t[0] == "list":
            return self.settings.set_strv( key, value )

        return self.settings.set( key, value )

    def notifyAdd( self, key, callback, args = None ):
        handlerId = self.settings.connect("changed::"+key, callback, args)
        self.handlerIds.append( handlerId )
        return handlerId

    def notifyRemove( self, handlerId ):
        return self.settings.disconnect(handlerId)

    def notifyRemoveAll( self ):
        for handlerId in self.handlerIds:
            self.settings.disconnect( handlerId )

    def evalColor(self, colorToTest ):
        if colorToTest[0] != '#' or len( colorToTest ) != 7:
            return False
        for i in colorToTest[1:]:
            if i not in ['a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
                return False
        return True

    def bindGSettingsEntryToVar( self, type, key, obj, varName ):
        return self.notifyAdd( key, self.setVar, ( type, obj, varName ) )

    def setVar( self, settings, key, args ):
        type, obj, varName = args

        if type == "string":
            setattr( obj, varName, settings.get_string(key) )
        elif type == "int":
            setattr( obj, varName, settings.get_int(key) )
        elif type == "float":
            setattr( obj, varName, settings.get_float(key) )
        elif type == "bool":
            setattr( obj, varName, settings.get_boolean(key) )
        else:
            setattr( obj, varName, settings.get_value(key) )