def __init(self, *args): self.debug = args[0] or os.getenv("GGET_DEBUG") self.base_dir = os.path.expanduser(os.path.join(XDG_CONFIG_DIR, "gget")) if not os.path.exists(self.base_dir): os.makedirs(self.base_dir) self.client = gconf.client_get_default() if self.client.dir_exists(DIR_GGET): self.client.add_dir(DIR_GGET, gconf.CLIENT_PRELOAD_RECURSIVE) else: if utils.runned_from_source(): os.system("gconftool-2 --install-schema-file %s" % os.path.join(utils.get_data_dir(), "gget.schemas")) else: ed = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK, message_format=_("Could not find configuration directory in GConf")) ed.format_secondary_text(_("Please make sure that gget.schemas was correctly installed.")) ed.set_title(_("Error")) #ed = dialogs.ErrorDialog(_("Could not find configuration directory in GConf"), _("Please make sure that gget.schemas was correctly installed.")) ed.run() sys.exit(1)
height) else: pixbuf = icon_theme.load_icon(os.path.splitext(icon)[0], width, gtk.ICON_LOOKUP_USE_BUILTIN) except Exception, msg1: try: pixbuf = icon_theme.load_icon(icon, width, gtk.ICON_LOOKUP_USE_BUILTIN) except Exception, msg2: print 'Error:load_icon:Icon Load Error:%s (or %s)' % (msg1, msg2) return pixbuf # Register our icon with the icon theme if running from source if utils.runned_from_source(): for size in [16, 22, 24, 32]: icon_dir = "%sx%s" % (size, size) icon_file = os.path.join(icon_dir, "gget.png") pixbuf = load_icon(icon_file, size, size) gtk.icon_theme_add_builtin_icon(NAME.lower(), size, pixbuf) def load_icon_from_mime_type(mime_type, size=48): """Loads an icon from a mime type string. This is ugly and error prone, there must be a better way to do this.""" pixbuf = None l = mime_type.split("/") mime = "%s-%s" % (l[0], l[1]) try: pixbuf = icon_theme.load_icon(mime, size, gtk.ICON_LOOKUP_USE_BUILTIN) except Exception, msg1: