2
# Permission is hereby granted, free of charge, to any person
3
# obtaining a copy of this software and associated documentation
4
# files (the "Software"), to deal in the Software without
5
# restriction, including without limitation the rights to use,
6
# copy, modify, merge, publish, distribute, sublicense, and/or sell
7
# copies of the Software, and to permit persons to whom the
8
# Software is furnished to do so, subject to the following
11
# The above copyright notice and this permission notice shall be
12
# included in all copies or substantial portions of the Software.
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
# OTHER DEALINGS IN THE SOFTWARE.
23
# Copyright (c) 2009 Mario Carrion <http://www.mariocarrion.com>
26
# Mario Carrion <mario@carrion.ws>
32
class NautilusExtension(nautilus.MenuProvider):
36
def on_gwibber_share(self, menu, file):
37
file=file[7:] # HACK: Remove this
38
print os.spawnv(os.P_NOWAIT,
39
"/home/mario/bin/gwibber-share", # FIXME: Hardcoded path
42
str("--filename=%s" % file),
47
def get_file_items(self, window, files):
49
if not files[0].is_directory():
50
#Try to load gwibber using dbus
52
bus = dbus.SessionBus()
53
obj = bus.get_object("net.launchpad.Gwibber", "/net/launchpad/gwibber/Interface")
54
gwibber = dbus.Interface(obj, "net.launchpad.Gwibber")
56
item = nautilus.MenuItem(
57
"NautilusPython::gwibber_share",
59
"Share %s on Gwibber" % files[0].get_name(),
61
item.connect("activate",self.on_gwibber_share, files[0].get_uri())