[rhythmbox] Add new plugin that calls nautilus-sendto with selected tracks (bug #605301)



commit 64c49e5b52cb2512dd4e3b32c46ca940e0441145
Author: Filipp Ivanov <feelout ut ee>
Date:   Sun Jan 24 09:53:51 2010 +1000

    Add new plugin that calls nautilus-sendto with selected tracks (bug #605301)

 configure.ac                       |    1 +
 data/rhythmbox.schemas             |   26 ++++++++++++-
 plugins/Makefile.am                |    1 +
 plugins/sendto/Makefile.am         |   11 +++++
 plugins/sendto/__init__.py         |   73 ++++++++++++++++++++++++++++++++++++
 plugins/sendto/sendto.rb-plugin.in |    8 ++++
 6 files changed, 118 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d2554dd..abb08fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -864,6 +864,7 @@ plugins/visualizer/Makefile
 plugins/mmkeys/Makefile
 plugins/context/Makefile
 plugins/context/context/Makefile
+plugins/sendto/Makefile
 bindings/Makefile
 bindings/python/Makefile
 bindings/vala/Makefile
diff --git a/data/rhythmbox.schemas b/data/rhythmbox.schemas
index 90599b4..68eeb62 100644
--- a/data/rhythmbox.schemas
+++ b/data/rhythmbox.schemas
@@ -1479,8 +1479,8 @@
 	</locale>
       </schema>
       <schema>
-        <key>/schemas/apps/rhythmbox/plugins/tray-icon/hidden</key>
-        <applyto>/apps/rhythmbox/plugins/tray-icon/hidden</applyto>
+        <key>/schemas/apps/rhythmbox/plugins/status-icon/hidden</key>
+        <applyto>/apps/rhythmbox/plugins/status-icon/hidden</applyto>
         <owner>rhythmbox</owner>
         <type>bool</type>
         <default>FALSE</default>
@@ -1545,5 +1545,27 @@
 	<long>When set to false, causes Rhythmbox to start only as a tray icon with the window hidden.</long>
         </locale>
       </schema>
+      <schema>
+        <key>/schemas/apps/rhythmbox/plugins/sendto/active</key>
+        <applyto>/apps/rhythmbox/plugins/sendto/active</applyto>
+        <owner>rhythmbox</owner>
+        <type>bool</type>
+        <default>FALSE</default>
+        <locale name="C">
+        <short>True if the send tracks plugin is enabled.</short>
+	<long>True if the send tracks plugin is enabled.</long>
+	</locale>
+      </schema>
+      <schema>
+        <key>/schemas/apps/rhythmbox/plugins/sendto/hidden</key>
+        <applyto>/apps/rhythmbox/plugins/sendto/hidden</applyto>
+        <owner>rhythmbox</owner>
+        <type>bool</type>
+        <default>FALSE</default>
+        <locale name="C">
+        <short>True if the send tracks plugin is hidden.</short>
+	<long>True if the send tracks plugin is hidden.</long>
+	</locale>
+      </schema>
     </schemalist>
 </gconfschemafile>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index a9ea329..f971fb3 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -24,6 +24,7 @@ SUBDIRS += 						\
 	coherence					\
 	im-status					\
 	context						\
+	sendto						\
 	rb
 endif
 
diff --git a/plugins/sendto/Makefile.am b/plugins/sendto/Makefile.am
new file mode 100644
index 0000000..93aa586
--- /dev/null
+++ b/plugins/sendto/Makefile.am
@@ -0,0 +1,11 @@
+plugindir = $(PLUGINDIR)
+
+plugin_in_files = sendto.rb-plugin.in
+%.rb-plugin: %.rb-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.rb-plugin.in=.rb-plugin)
+
+EXTRA_DIST = $(plugin_in_files) __init__.py
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
diff --git a/plugins/sendto/__init__.py b/plugins/sendto/__init__.py
new file mode 100644
index 0000000..fe9d1a2
--- /dev/null
+++ b/plugins/sendto/__init__.py
@@ -0,0 +1,73 @@
+# __init__.py
+#
+# Copyright (C) 2010 - Filipp Ivanov
+#
+# 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, or (at your option)
+# any later version.
+#
+# The Rhythmbox authors hereby grant permission for non-GPL compatible
+# GStreamer plugins to be used and distributed together with GStreamer
+# and Rhythmbox. This permission is above and beyond the permissions granted
+# by the GPL license by which Rhythmbox 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.
+#
+# 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.
+
+import rb
+import gtk
+import glib
+
+ui_definition = """
+<ui>
+    <popup name="BrowserSourceViewPopup">
+        <menuitem name="SendToLibraryPopup" action="SendTo" />
+    </popup>
+
+    <popup name="PlaylistViewPopup">
+        <menuitem name="SendToPlaylistPopup" action="SendTo" />
+    </popup>
+
+    <popup name="QueuePlaylistViewPopup">
+        <menuitem name="SendToQueuePlaylistPopup" action="SendTo" />
+    </popup>
+</ui>"""
+
+class SendToPlugin (rb.Plugin):
+    def __init__(self):
+        rb.Plugin.__init__(self)
+
+    def activate(self, shell):
+        self.__action = gtk.Action('SendTo', _('Send to...'),
+                                _('Send files by mail, instant message...'), '')
+        self.__action.connect('activate', self.send_to, shell)
+
+        self.__action_group = gtk.ActionGroup('SendToActionGroup')
+        self.__action_group.add_action(self.__action)
+        shell.get_ui_manager().insert_action_group(self.__action_group)
+
+        self.__ui_id = shell.get_ui_manager().add_ui_from_string(ui_definition)
+
+    def deactivate(self, shell):
+        shell.get_ui_manager().remove_action_group(self.__action_group)
+        shell.get_ui_manager().remove_ui(self.__ui_id)
+        shell.get_ui_manager().ensure_update()
+
+        del self.__action_group
+        del self.__action
+
+    def send_to(self, action, shell):
+        entries = shell.props.selected_source.get_entry_view().get_selected_entries()
+
+        cmdline = ['nautilus-sendto'] + [entry.get_playback_uri() for entry in entries]
+	glib.spawn_async(argv=cmdline, flags=glib.SPAWN_SEARCH_PATH)
diff --git a/plugins/sendto/sendto.rb-plugin.in b/plugins/sendto/sendto.rb-plugin.in
new file mode 100644
index 0000000..d501ef8
--- /dev/null
+++ b/plugins/sendto/sendto.rb-plugin.in
@@ -0,0 +1,8 @@
+[RB Plugin]
+Loader=python
+Module=sendto
+IAge=1
+_Name=Send tracks
+_Description=Send selected tracks by email or instant message
+Authors=Filipp Ivanov <feelout ut ee>
+Copyright=Copyright © 2010 Filipp Ivanov



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]