/usr/lib/python3/dist-packages/gnomemusic/application.py is in gnome-music 3.18.2-1ubuntu1.
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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | # Copyright (c) 2013 Arnel A. Borja <kyoushuu@yahoo.com>
# Copyright (c) 2013 Vadim Rutkovsky <vrutkovs@redhat.com>
# Copyright (c) 2013 Lubosz Sarnecki <lubosz@gmail.com>
# Copyright (c) 2013 Guillaume Quintard <guillaume.quintard@gmail.com>
# Copyright (c) 2013 Felipe Borges <felipe10borges@gmail.com>
# Copyright (c) 2013 Eslam Mostafa <cseslam@gmail.com>
# Copyright (c) 2013 Shivani Poddar <shivani.poddar92@gmail.com>
# Copyright (c) 2013 Sai Suman Prayaga <suman.sai14@gmail.com>
# Copyright (c) 2013 Seif Lotfy <seif@lotfy.com>
#
# GNOME Music 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.
#
# GNOME Music 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 GNOME Music; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# The GNOME Music authors hereby grant permission for non-GPL compatible
# GStreamer plugins to be used and distributed together with GStreamer
# and GNOME Music. This permission is above and beyond the permissions
# granted by the GPL license by which GNOME Music is covered. If you
# modify this code, you may extend this exception to your version of the
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Gtk, Gio, GLib, Gdk, Notify
from gettext import gettext as _
from gnomemusic.window import Window
from gnomemusic.mpris import MediaPlayer2Service
from gnomemusic.notification import NotificationManager
from gnomemusic import log
import logging
logger = logging.getLogger(__name__)
class Application(Gtk.Application):
def __repr__(self):
return '<Application>'
@log
def __init__(self):
Gtk.Application.__init__(self,
application_id='org.gnome.Music',
flags=Gio.ApplicationFlags.FLAGS_NONE)
GLib.set_application_name(_("Music"))
GLib.set_prgname('gnome-music')
self.settings = Gio.Settings.new('org.gnome.Music')
cssProviderFile = Gio.File.new_for_uri('resource:///org/gnome/Music/application.css')
cssProvider = Gtk.CssProvider()
cssProvider.load_from_file(cssProviderFile)
screen = Gdk.Screen.get_default()
styleContext = Gtk.StyleContext()
styleContext.add_provider_for_screen(screen, cssProvider,
Gtk.STYLE_PROVIDER_PRIORITY_USER)
self._window = None
@log
def build_app_menu(self):
builder = Gtk.Builder()
builder.add_from_resource('/org/gnome/Music/app-menu.ui')
menu = builder.get_object('app-menu')
self.set_app_menu(menu)
aboutAction = Gio.SimpleAction.new('about', None)
aboutAction.connect('activate', self.about)
self.add_action(aboutAction)
helpAction = Gio.SimpleAction.new('help', None)
helpAction.connect('activate', self.help)
self.add_action(helpAction)
newPlaylistAction = Gio.SimpleAction.new('newPlaylist', None)
newPlaylistAction.connect('activate', self.new_playlist)
self.add_action(newPlaylistAction)
quitAction = Gio.SimpleAction.new('quit', None)
quitAction.connect('activate', self.quit)
self.add_action(quitAction)
@log
def new_playlist(self, action, param):
pass
@log
def help(self, action, param):
Gtk.show_uri(None, "help:gnome-music", Gdk.CURRENT_TIME)
@log
def about(self, action, param):
builder = Gtk.Builder()
builder.add_from_resource('/org/gnome/Music/AboutDialog.ui')
about = builder.get_object('about_dialog')
about.set_transient_for(self._window)
about.connect("response", self.about_response)
about.show()
@log
def about_response(self, dialog, response):
dialog.destroy()
@log
def do_startup(self):
Gtk.Application.do_startup(self)
Notify.init(_("Music"))
self.build_app_menu()
@log
def quit(self, action=None, param=None):
self._window.destroy()
def do_activate(self):
if not self._window:
self._window = Window(self)
self.service = MediaPlayer2Service(self)
if self.settings.get_value('notifications'):
self._notifications = NotificationManager(self._window.player)
self._window.present()
|