[Python-apps-commits] r8351 - in packages/rabbitvcs/trunk/debian (6 files)

adejong at users.alioth.debian.org adejong at users.alioth.debian.org
Mon Mar 19 21:25:22 UTC 2012


    Date: Monday, March 19, 2012 @ 21:25:21
  Author: adejong
Revision: 8351

  * Cherry-pick upstream change that implements a gedit 3 plugin and update
    packaging according to new directory layout (closes: #635123).

Added:
  packages/rabbitvcs/trunk/debian/patches/50_fix_gedit3_plugin.patch
Modified:
  packages/rabbitvcs/trunk/debian/changelog
  packages/rabbitvcs/trunk/debian/control
  packages/rabbitvcs/trunk/debian/patches/99_setup.py.patch
  packages/rabbitvcs/trunk/debian/patches/series
  packages/rabbitvcs/trunk/debian/rabbitvcs-gedit.install

Modified: packages/rabbitvcs/trunk/debian/changelog
===================================================================
--- packages/rabbitvcs/trunk/debian/changelog	2012-03-19 21:11:21 UTC (rev 8350)
+++ packages/rabbitvcs/trunk/debian/changelog	2012-03-19 21:25:21 UTC (rev 8351)
@@ -7,6 +7,8 @@
     - Fix a problem with rename a file (Closes: #585859).
     - Allows entering repository URL when starting the browser
       (Closes: #619644).
+  * Cherry-pick upstream change that implements a gedit 3 plugin and update
+    packaging according to new directory layout (closes: #635123).
   * Update package descriptions to match upstream's (Closes: #580716)
     (LP: #748304).
   * Drop dependency on glade (not used in 0.15).
@@ -26,7 +28,7 @@
   [ Sameer Rahmani ]
   * watch file fixed.
 
- -- Arthur de Jong <adejong at debian.org>  Mon, 19 Mar 2012 21:02:32 +0100
+ -- Arthur de Jong <adejong at debian.org>  Mon, 19 Mar 2012 22:24:42 +0100
 
 rabbitvcs (0.13.1-2) unstable; urgency=low
 

Modified: packages/rabbitvcs/trunk/debian/control
===================================================================
--- packages/rabbitvcs/trunk/debian/control	2012-03-19 21:11:21 UTC (rev 8350)
+++ packages/rabbitvcs/trunk/debian/control	2012-03-19 21:25:21 UTC (rev 8351)
@@ -32,7 +32,7 @@
 Description: Easy version control
  RabbitVCS is a set of graphical tools written to provide simple and
  straightforward access to the version control systems SVN (Subversion)
- and Git. There are extensions for Nautilus and GEdit, and a simple
+ and Git. There are extensions for Nautilus and gedit, and a simple
  command-line interface.
 
 Package: rabbitvcs-cli

Added: packages/rabbitvcs/trunk/debian/patches/50_fix_gedit3_plugin.patch
===================================================================
--- packages/rabbitvcs/trunk/debian/patches/50_fix_gedit3_plugin.patch	                        (rev 0)
+++ packages/rabbitvcs/trunk/debian/patches/50_fix_gedit3_plugin.patch	2012-03-19 21:25:21 UTC (rev 8351)
@@ -0,0 +1,309 @@
+Description: Fix the gedit plugin for Gedit3
+From: Adam Plumb <adamplumb at gmail.com>
+Origin: upstream, http://code.google.com/p/rabbitvcs/source/detail?r=3022
+Bug: http://code.google.com/p/rabbitvcs/issues/detail?id=622
+Bug-Debian: http://bugs.debian.org/635123
+
+--- a/rabbitvcs/util/contextmenuitems.py
++++ b/rabbitvcs/util/contextmenuitems.py
+@@ -204,7 +204,7 @@
+         )
+             
+         return action
+-        
++
+     def make_gtk_menu_item(self, id_magic = None):
+         action = self.make_action(id_magic)
+             
+@@ -217,6 +217,17 @@
+         else:
+             menuitem = action.create_menu_item()
+             
++        return menuitem
++        
++    def make_gtk3_menu_item(self, id_magic = None):
++        action = self.make_action(id_magic)
++        
++        if self.icon:
++            menuitem = action.create_menu_item()
++            menuitem.set_image(gtk.Image.new_from_icon_name(self.icon, gtk.IconSize.MENU))
++        else:
++            menuitem = action.create_menu_item()
++            
+         return menuitem
+     
+     def make_nautilus_menu_item(self, id_magic = None):
+--- a/clients/gedit/rabbitvcs.gedit-plugin
++++ /dev/null
+@@ -1,10 +0,0 @@
+-[Gedit Plugin]
+-Loader=python
+-Module=rabbitvcs-plugin
+-IAge=2
+-Name=RabbitVCS
+-Description=RabbitVCS plugin for Gedit
+-Authors=Adam Plumb <adamplumb at gmail.com>
+-Copyright=Copyright © 2009 Adam Plumb
+-Website=http://www.rabbitvcs.org
+-
+--- /dev/null
++++ b/clients/gedit/rabbitvcs-gedit2.gedit-plugin
+@@ -0,0 +1,10 @@
++[Gedit Plugin]
++Loader=python
++Module=rabbitvcs-plugin
++IAge=2
++Name=RabbitVCS
++Description=RabbitVCS plugin for Gedit
++Authors=Adam Plumb <adamplumb at gmail.com>
++Copyright=Copyright © 2011 Adam Plumb
++Website=http://www.rabbitvcs.org
++
+--- a/clients/gedit/rabbitvcs-plugin.py
++++ b/clients/gedit/rabbitvcs-plugin.py
+@@ -2,7 +2,7 @@
+ # This is a Gedit plugin to allow for RabbitVCS integration in the Gedit
+ # text editor.
+ # 
+-# Copyright (C) 2008-2008 by Adam Plumb <adamplumb at gmail.com>
++# Copyright (C) 2008-2011 by Adam Plumb <adamplumb at gmail.com>
+ # 
+ # RabbitVCS is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+@@ -21,8 +21,17 @@
+ from gettext import gettext as _
+ 
+ import os
+-import gtk
+-import gedit
++
++try:
++    from gi.repository import Gedit
++    os.environ["NAUTILUS_PYTHON_REQUIRE_GTK3"] = "1"
++    GTK3 = True
++except ImportError:
++    import gedit
++    GTK3 = False
++
++from gi.repository import GObject
++from gi.repository import Gtk as gtk
+ 
+ import rabbitvcs.util.helper
+ from rabbitvcs.vcs import create_vcs_instance
+@@ -327,8 +336,15 @@
+         
+         manager = self._window.get_ui_manager()
+         for menu_path in self._menu_paths:
+-            widget = manager.get_widget(menu_path)
+-            self._menubar_menu.update_action(widget.get_action())
++            # Gtk3 changes how we access a widget's action.  Get it from the
++            # UI Manager instead of the widget directly
++            if hasattr(manager, "get_action"):
++                action = manager.get_action(menu_path)
++            else:
++                widget = manager.get_widget(menu_path)
++                action = widget.get_action()
++
++            self._menubar_menu.update_action(action)
+ 
+     # Menu activate handlers
+     def reload_settings(self, proc):
+@@ -337,49 +353,100 @@
+     def on_context_menu_command_finished(self):
+         self.update_ui()
+ 
+-class RabbitVCSPlugin(gedit.Plugin):
+-    def __init__(self):
+-        gedit.Plugin.__init__(self)
+-        self._instances = {}
+-        self.id_name = "RabbitVCSContextMenuID"
+-
+-    def activate(self, window):
+-        self._instances[window] = RabbitVCSWindowHelper(self, window)
+-
+-        handler_ids = []
+-        for signal in ('tab-added', 'tab-removed'):
+-            method = getattr(self, 'on_window_' + signal.replace('-', '_'))
+-            handler_ids.append(window.connect(signal, method))
+-        
+-        window.set_data(self.id_name, handler_ids)
+-        if window in self._instances:
+-            for view in window.get_views():
+-                self._instances[window].connect_view(view, self.id_name)
+-
+-    def deactivate(self, window):
+-        widgets = [window] + window.get_views()
+-        for widget in widgets:
+-            handler_ids = widget.get_data(self.id_name)
+-            if handler_ids is not None:
+-                for handler_id in handler_ids:
+-                    widget.disconnect(handler_id)
+-                widget.set_data(self.id_name, None)
+-
+-        if window in self._instances:
+-            self._instances[window].deactivate()
+-            del self._instances[window]
+-
+-    def update_ui(self, window):
+-        if window in self._instances:
+-            self._instances[window].update_ui()
+-
+-    def on_window_tab_added(self, window, tab):
+-        if window in self._instances:
+-            self._instances[window].connect_view(tab.get_view(), self.id_name)
+-    
+-    def on_window_tab_removed(self, window, tab):
+-        if window in self._instances:
+-            self._instances[window].disconnect_view(tab.get_view(), self.id_name)
++if GTK3:
++    class RabbitVCSGedit3Plugin(GObject.Object, Gedit.WindowActivatable):
++        __gtype_name__ = "RabbitVCSGedit3Plugin"
++        window = GObject.property(type=Gedit.Window)
++        
++        def __init__(self):
++            GObject.Object.__init__(self)
++            self._instances = {}
++            self.id_name = "RabbitVCSContextMenuID"
++
++        def do_activate(self):
++            self._instances[self.window] = RabbitVCSWindowHelper(self, self.window)
++
++            handler_ids = []
++            for signal in ('tab-added', 'tab-removed'):
++                method = getattr(self, 'on_window_' + signal.replace('-', '_'))
++                handler_ids.append(self.window.connect(signal, method))
++            
++            self.window.set_data(self.id_name, handler_ids)
++            if self.window in self._instances:
++                for view in self.window.get_views():
++                    self._instances[self.window].connect_view(view, self.id_name)
++
++        def do_deactivate(self):
++            widgets = [self.window] + self.window.get_views()
++            for widget in widgets:
++                handler_ids = widget.get_data(self.id_name)
++                if handler_ids is not None:
++                    for handler_id in handler_ids:
++                        widget.disconnect(handler_id)
++                    widget.set_data(self.id_name, None)
++
++            if self.window in self._instances:
++                self._instances[self.window].deactivate()
++                del self._instances[self.window]
++
++        def do_update_state(self):
++            self.update_ui()
++
++        def update_ui(self):
++            if self.window in self._instances:
++                self._instances[self.window].update_ui()
++
++        def on_window_tab_added(self, window, tab):
++            if self.window in self._instances:
++                self._instances[self.window].connect_view(tab.get_view(), self.id_name)
++        
++        def on_window_tab_removed(self, window, tab):
++            if window in self._instances:
++                self._instances[self.window].disconnect_view(tab.get_view(), self.id_name)
++else:
++    class RabbitVCSGedit2Plugin(gedit.Plugin):
++        def __init__(self):
++            gedit.Plugin.__init__(self)
++            self._instances = {}
++            self.id_name = "RabbitVCSContextMenuID"
++
++        def activate(self, window):
++            self._instances[window] = RabbitVCSWindowHelper(self, window)
++
++            handler_ids = []
++            for signal in ('tab-added', 'tab-removed'):
++                method = getattr(self, 'on_window_' + signal.replace('-', '_'))
++                handler_ids.append(window.connect(signal, method))
++            
++            window.set_data(self.id_name, handler_ids)
++            if window in self._instances:
++                for view in window.get_views():
++                    self._instances[window].connect_view(view, self.id_name)
++
++        def deactivate(self, window):
++            widgets = [window] + window.get_views()
++            for widget in widgets:
++                handler_ids = widget.get_data(self.id_name)
++                if handler_ids is not None:
++                    for handler_id in handler_ids:
++                        widget.disconnect(handler_id)
++                    widget.set_data(self.id_name, None)
++
++            if window in self._instances:
++                self._instances[window].deactivate()
++                del self._instances[window]
++
++        def update_ui(self, window):
++            if window in self._instances:
++                self._instances[window].update_ui()
++
++        def on_window_tab_added(self, window, tab):
++            if window in self._instances:
++                self._instances[window].connect_view(tab.get_view(), self.id_name)
++        
++        def on_window_tab_removed(self, window, tab):
++            if window in self._instances:
++                self._instances[window].disconnect_view(tab.get_view(), self.id_name)
+ 
+ class MenuIgnoreByFilename(MenuItem):
+     identifier = "RabbitVCS::Ignore_By_Filename"
+@@ -593,7 +660,10 @@
+     signal = "activate"
+         
+     def make_menu_item(self, item, id_magic):
+-        return item.make_gtk_menu_item(id_magic)
++        if GTK3:
++            return item.make_gtk3_menu_item(id_magic)
++        else:
++            return item.make_gtk_menu_item(id_magic)
+     
+     def attach_submenu(self, menu_node, submenu_list):
+         submenu = gtk.Menu()
+--- /dev/null
++++ b/clients/gedit/rabbitvcs-gedit3.plugin
+@@ -0,0 +1,9 @@
++[Plugin]
++Loader=python
++Module=rabbitvcs-plugin
++IAge=3
++Name=RabbitVCS
++Description=RabbitVCS plugin for Gedit
++Authors=Adam Plumb <adamplumb at gmail.com>
++Copyright=Copyright © 2011 Adam Plumb
++Website=http://www.rabbitvcs.org
+--- a/clients/gedit/README
++++ b/clients/gedit/README
+@@ -8,14 +8,24 @@
+     * gedit
+     * (all other RabbitVCS requirements)
+ 
+-To install:
++To install for Gedit 3:
+     To install for all users, copy rabbitvcs-plugin.py and 
+-    rabbitvcs.gedit-plugin to:
++    rabbitvcs-gedit3.plugin to:
++        /usr/share/gedit/plugins
++
++    To install for a single user, copy rabbitvcs-plugin.py and 
++    rabbitvcs-gedit3.plugin to:
++        ~/.local/share/gedit/plugins
++
++To install for Gedit 2:
++    To install for all users, copy rabbitvcs-plugin.py and 
++    rabbitvcs-gedit2.gedit-plugin to:
+         /usr/lib/gedit-2/plugins
+ 
+     To install for a single user, copy rabbitvcs-plugin.py and 
+-    rabbitvcs.gedit-plugin to:
+-        ~/.gnome2/gedit/plugins
++    rabbitvcs-gedit2.gedit-plugin to:
++        ~/.gnome2/gedit/plugins        
++
+ 
+ Troubleshooting:
+ 

Modified: packages/rabbitvcs/trunk/debian/patches/99_setup.py.patch
===================================================================
--- packages/rabbitvcs/trunk/debian/patches/99_setup.py.patch	2012-03-19 21:11:21 UTC (rev 8350)
+++ packages/rabbitvcs/trunk/debian/patches/99_setup.py.patch	2012-03-19 21:25:21 UTC (rev 8351)
@@ -4,9 +4,9 @@
 Forwarded: not-needed
 Author: Jason Heeris <jason.heeris at gmail.com>
 
---- rabbitvcs-0.14/setup.py.orig	2011-02-18 21:04:33.000000000 +0800
-+++ rabbitvcs-0.14/setup.py	2011-02-19 01:23:20.000000000 +0800
-@@ -154,13 +154,4 @@
+--- a/setup.py
++++ b/setup.py
+@@ -156,13 +156,4 @@
  # Post installation
  #
  

Modified: packages/rabbitvcs/trunk/debian/patches/series
===================================================================
--- packages/rabbitvcs/trunk/debian/patches/series	2012-03-19 21:11:21 UTC (rev 8350)
+++ packages/rabbitvcs/trunk/debian/patches/series	2012-03-19 21:25:21 UTC (rev 8351)
@@ -1 +1,2 @@
+50_fix_gedit3_plugin.patch
 99_setup.py.patch

Modified: packages/rabbitvcs/trunk/debian/rabbitvcs-gedit.install
===================================================================
--- packages/rabbitvcs/trunk/debian/rabbitvcs-gedit.install	2012-03-19 21:11:21 UTC (rev 8350)
+++ packages/rabbitvcs/trunk/debian/rabbitvcs-gedit.install	2012-03-19 21:25:21 UTC (rev 8351)
@@ -1,2 +1,2 @@
-clients/gedit/rabbitvcs-plugin.py usr/lib/gedit-2/plugins
-clients/gedit/rabbitvcs.gedit-plugin usr/lib/gedit-2/plugins
+clients/gedit/rabbitvcs-plugin.py usr/lib/gedit/plugins
+clients/gedit/rabbitvcs-gedit3.plugin usr/lib/gedit/plugins




More information about the Python-apps-commits mailing list