nautilus-pastebin-0.7.1/0000755000175000017500000000000011712311223016277 5ustar alessioalessio00000000000000nautilus-pastebin-0.7.1/PKG-INFO0000644000175000017500000000076611712311223017405 0ustar alessioalessio00000000000000Metadata-Version: 1.0 Name: nautilus-pastebin Version: 0.7.1 Summary: Nautilus extension to send files to a pastebin Home-page: https://launchpad.net/nautilus-pastebin Author: Alessio Treglia Author-email: quadrispro@ubuntu.com License: GPL-2 Description: nautilus-pastebin is a Nautilus extension written in Python, which allows users to upload text-only files to a pastebin service just by right-clicking on them. Users can also add their favorite service just by creatine new presets. Platform: all nautilus-pastebin-0.7.1/data/0000755000175000017500000000000011712311223017210 5ustar alessioalessio00000000000000nautilus-pastebin-0.7.1/data/nautilus-pastebin-configurator.10000664000175000017500000000270011656527406025465 0ustar alessioalessio00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH NAUTILUS-PASTEBIN-CONFIGURATOR 1 "October 1, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME nautilus-pastebin-configurator \- Nautilus Pastebin configuration panel .SH SYNOPSIS .B nautilus-pastebin-configurator .SH DESCRIPTION .B nautilus-pastebin-configurator is a graphical tool to configure .B Nautilus Pastebin , a small extension for the Nautilus file manager, which allows users to send files just a right-click away. .PP .B nautilus-pastebin-configurator has been written in Python and GTK+2, and after installing the application you can run it from the Settings submenu. .SH SEE ALSO .BR nautilus (1), .br .SH AUTHOR nautilus-pastebin-configurator was written by Alessio Treglia . .PP This manual page was written by Alessio Treglia , for the Debian project (and may be used by others). nautilus-pastebin-0.7.1/data/nautilus-pastebin.svg0000664000175000017500000014205411656527406023433 0ustar alessioalessio00000000000000 image/svg+xml nautilus-pastebin-0.7.1/data/nautilus-pastebin-configurator.ui0000664000175000017500000002724211712305466025743 0ustar alessioalessio00000000000000 False 5 Nautilus Pastebin configuration panel normal True False vertical 2 True False end gtk-close False True True True False True False False 1 False True end 0 True True False True False 6 6 2 12 12 True False 0 <b>Pastebin</b>: True True False 0 <b>Open browser</b>: True 4 5 True False 0 <b>Show a notification</b>: True 5 6 False True True False False True 1 2 4 5 False True True False False True 1 2 5 6 True False 0 <b>Username</b>: True 2 3 True False 0 <b>Password</b> True 3 4 True False 0 <b>Author</b>: True 1 2 True True 1 2 1 2 True True 1 2 2 3 True True 1 2 3 4 True False 0 1 2 False True 0 False True 1 button_close nautilus-pastebin-0.7.1/data/nautilus-pastebin.png0000664000175000017500000000574211656527406023422 0ustar alessioalessio00000000000000PNG  IHDR00WsBIT|d pHYs a aJ%tEXtSoftwarewww.inkscape.org< _IDAThՙil\u7e8ER4)Im%ԕԸI4M EՇh@[CnZh4 6Z!Vua# ;KƈP4E o޻K?̢"0rgfy c b}+Np|n拁@3`(#PhF PA|N p|<ۼseYc=F^RJw#CO;Si'b{1x^;S| ^őN|ĝ^& !cx\ZEuQ\~D"aOA%Pc R}W!!Z/oYV>b%ƫ\|K",ٟw'wXW#~#۟얓,!ϽxB/rfh_I_}є7~y Jz}[▰2}+ř(o/=k{𓟾Mȁ!$VBn>c+g ;&ԵľK?%Gß$ |]*ǫ/,tPEs_kýd(i80hKHt-ߗjVnKSẗ́4g }CMI0XYVXٛnr'Rttodp /ަ0Gy_+ld?v rzXPv#C{aɷhNp$pr eNP(S'Ht{Wn&3d*L͖ÁCp!=ٯ| ^_yk"P֙C_BJiqu0&8B1sػLbp~ \jRJY"s lA, eRr'EBy?Rdo/~P,;BZ4ٵ8Z{hhۄln0`6׃+K%}-SL5ElcRjbޗAg=R4ZП97즻mlLRСcUv K|td4J7{,Si^# //꿾BJAJ>4o~; ѩF"V10ԕ+w8v#n}a _YA(s֦t2T= ;gNsMjagz˞T1xα!m@J[Rthϓ O5/則yg3 FǮOf.bqU(Оu] EUrc mL-( NmXBl\cHƂs .{%$I8T ~<񽟨[ϴgbnnU,4T$ -Ocgar?su?b`p+ҥ7,(Bc(ā ]I7sa0PMYMk@>+Ջ) O#h! Ty3v|[[@;i0'Hu ĨTvU4>XNr`ɡ}Ɏh[-GsUvn|v-1{΁vP@|f1Nif<`pm|=jYN0Nov Ueʙ)]1.e`74M/]I` pF^ԮMךj5QDJlV'roꛥɓ+n6ݰ|UnL JÐVYy<IENDB`nautilus-pastebin-0.7.1/data/nautilus-pastebin-configurator.desktop0000664000175000017500000000046211712202225026757 0ustar alessioalessio00000000000000[Desktop Entry] Name=Nautilus Pastebin Configurator Type=Application GenericName=Nautilus Pastebin configuration panel GenericName[it]=Pannello di configurazione per Nautilus Pastebin Icon=nautilus-pastebin Categories=Settings; X-Ubuntu-Gettext-Domain=nautilus-pastebin Exec=nautilus-pastebin-configurator nautilus-pastebin-0.7.1/data/nautilus-pastebin-notification0000664000175000017500000000130611656527406025313 0ustar alessioalessio00000000000000Name: nautilus-pastebin-notification Priority: High Terminal: False DontShowAfterReboot: True DisplayIf: true Description: Nautilus Pastebin has been installed. A session restart is needed to make it work properly. Once the session is restarted, a new option will display in Nautilus context menu. This option lets you to send the content of text files to a pastebin through the Internet. Description-it: Nautilus Pastebin é stato installato. Per poterlo utilizzare é necessario riavviare la sessione. Una volta riavviata la sessione, nel menù contestuale di Nautilus sarà disponibile una nuova opzione, la quale consentirà di inviare il contenuto dei file di testo a un servizio di pastebin su Internet. nautilus-pastebin-0.7.1/data/nautilus-pastebin.gschema.xml0000664000175000017500000000302111712305264025015 0ustar alessioalessio00000000000000 false Show a bubble Show a notification to inform the user about whether the operation has been completed successfully or not. false Open a browser window Open a browser and point it to the pasted document's URL. "pastebin.com" Selected pastebin service The pastebin which the file will be sent to. '' Author (if not set, the login name will be used) The name to use as author of the document. '' Username Most services don't need this. '' Password (if needed) Most services don't need this. nautilus-pastebin-0.7.1/nautilus-pastebin-configurator.py0000775000175000017500000001344411712305242025037 0ustar alessioalessio00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- # nautilus-pastebin - Nautilus extension to paste a file to a pastebin service # Written by: # Alessio Treglia # Copyright (C) 2009-2010, Alessio Treglia # # This package 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. # # This package 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 package; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # import os import sys import re import gettext from subprocess import check_output from xdg import BaseDirectory from gi.repository import Gio, Gtk APP_NAME = "nautilus-pastebin" APP_DATA_PATHS = [os.path.join(sys.path[0], 'data')] for dir in BaseDirectory.xdg_data_dirs: APP_DATA_PATHS.append(os.path.join(dir, APP_NAME)) gettext.install(APP_NAME) def find_data_file(path): target = None for p in APP_DATA_PATHS: target = os.path.join(p, path) if os.path.isfile(target): return target if target == None: raise IOError(_("Can't find %s in any known prefix!") % path) def get_presets(): try: res = check_output(["pastebinit", "-l"]) # split the line and throw away the first slice res = re.split("\n-?\s?", res.strip())[1:] except OSError: sys.exit(1) except: sys.exit(-1) return res UI_FILE = find_data_file('nautilus-pastebin-configurator.ui') ICON_FILE = find_data_file('nautilus-pastebin.png') class Controller(object): BASE_KEY = "apps.nautilus-pastebin" def __init__(self): self.settings = settings = Gio.Settings.new(self.BASE_KEY) builder = Gtk.Builder.new() builder.add_from_file(UI_FILE) self.dialog_main = builder.get_object('dialog_main') tableOptions = builder.get_object('table_options') # Set checkbuttons up openbrowser = builder.get_object('openbrowser') shownotification = builder.get_object('shownotification') openbrowser.set_active(settings.get_boolean("openbrowser")) settings.connect("changed::openbrowser", self.on_openbrowser_changed, openbrowser) openbrowser.connect('toggled', self.on_openbrowser_toggled, settings) shownotification.set_active(settings.get_boolean("shownotification")) settings.connect("changed::shownotification", self.on_shownotification_changed, shownotification) shownotification.connect('toggled', self.on_shownotification_toggled, settings) # Setup entries self.author = author = builder.get_object('entry_author') self.username = username = builder.get_object('entry_username') self.password = password = builder.get_object('entry_password') author.set_text(settings.get_string("author")) username.set_text(settings.get_string("username")) password.set_text(settings.get_string("password")) # Set combobox up self.presets = presets = get_presets() print presets pastebin = builder.get_object("combobox_pastebin") pastebin.set_entry_text_column(0) curr_selected = settings.get_string("pastebin") pastebin.insert_text(0, curr_selected) #presets.remove(curr_selected) for i in presets: if i != curr_selected: pastebin.append_text(i) pastebin.set_active(0) settings.connect("changed::pastebin", self.on_pastebin_changed, pastebin) pastebin.connect("changed", self.on_pastebin_combo_changed, settings) builder.connect_signals(self) self.dialog_main.connect('delete_event', self.quit) self.dialog_main.show_all() def on_openbrowser_changed(self, settings, key, check_button): check_button.set_active(settings.get_boolean("openbrowser")) def on_shownotification_changed(self, settings, key, check_button): check_button.set_active(settings.get_boolean("shownotification")) def on_openbrowser_toggled(self, button, settings): settings.set_boolean("openbrowser", button.get_active()) def on_shownotification_toggled(self, button, settings): settings.set_boolean("shownotification", button.get_active()) def on_pastebin_changed(self, settings, key, combo_box): pass #combo_box.set_active(self.presets.index(settings.get_string("pastebin"))) def on_pastebin_combo_changed(self, combo_box, settings): print "Selected ", combo_box.get_active_text() settings.set_string("pastebin", combo_box.get_active_text()) def _save_remaining_settings(self): self.settings.set_string("author", self.author.get_text()) self.settings.set_string("username", self.username.get_text()) self.settings.set_string("password", self.password.get_text()) def showErrorMessage(self, message): md = Gtk.MessageDialog.new(parent=self.dialog_main, message_format=message, buttons=Gtk.ButtonsType.CLOSE, type = Gtk.MessageType.ERROR, flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT) md.run() md.destroy() def quit(self, *args): Gtk.main_quit() def on_button_close_clicked(self, widget, data=None): self._save_remaining_settings() self.dialog_main.destroy() self.quit() def main(): c = Controller() Gtk.main() if __name__ == "__main__": main() nautilus-pastebin-0.7.1/po/0000755000175000017500000000000011712311223016715 5ustar alessioalessio00000000000000nautilus-pastebin-0.7.1/po/nautilus-pastebin.pot0000644000175000017500000000235311712270273023124 0ustar alessioalessio00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-02-01 18:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../nautilus-pastebin.py:73 msgid "" "The file will be sent to the selected pastebin: are you sure to continue?" msgstr "" #. if not pasteurl or not re.match("^http://.*$", pasteurl): #: ../nautilus-pastebin.py:116 msgid "Unable to read or parse the result page." msgstr "" #: ../nautilus-pastebin.py:117 msgid "It could be a server timeout or a change server side. Try later." msgstr "" #: ../nautilus-pastebin.py:170 #, python-format msgid "Pastebin to %s" msgstr "" #: ../nautilus-pastebin.py:171 #, python-format msgid "Send this file to %s" msgstr "" #: ../nautilus-pastebin-configurator.py:45 #, python-format msgid "Can't find %s in any known prefix!" msgstr "" nautilus-pastebin-0.7.1/po/POTFILES.in0000664000175000017500000000025511712202225020477 0ustar alessioalessio00000000000000nautilus-pastebin.py nautilus-pastebin-configurator.py data/nautilus-pastebin-configurator.ui data/nautilus-pastebin-configurator.desktop data/nautilus-pastebin.gschema.xml nautilus-pastebin-0.7.1/README0000664000175000017500000000246611656527406017214 0ustar alessioalessio00000000000000What is this? -------------------- nautilus-pastebin is an extension for the GNOME file manager, which allows users to send files to pastebins just a right-click away. How does it work? -------------------- Simply: right-click on a file, select «Pastebin» and, if the Internet connection is active, after few seconds the application will show a notification and copy the paste URL to your clipboard, allowing you to paste it in a browser tab, IRC channel or wherever you want. Where can I download it? And how can install it? -------------------- After uncompressing this tarball, you can: 1) Use the setup.py script. 2) Copy: scripts/nautilus-pastebin.py to /usr/lib/nautilus/extensions-2.0/python/ data/nautilus-pastebin.png to /usr/share/pixmaps/ After the installation, you may need to restart Nautilus by typing: killall nautilus At the moment, some pastebins of the preconfigured ones don’t work well and I need some time to improve and extend the support for other websites. If you wanted to contribute to the development by sending me patches, configurations or suggestions I would be very happy! Alessio Treglia Credits -------------------- Author: Alessio Treglia Copyright © 2009, Alessio Treglia License: GPL-2 nautilus-pastebin-0.7.1/ChangeLog0000644000175000017500000000364611712311223020062 0ustar alessioalessio00000000000000Changes: revno: 46 New entry. revno: 45 Bump Version. revno: 44 Fix libnotify integration. revno: 43 Remove "askconfirmation" feature, needs more work. revno: 42 Fix a regresssion, the configuration didn't save the values of the entries. revno: 41 Update translations template. revno: 40 Clean-up, again revno: 39 New mechanism for data files lookup. revno: 38 Clean-up revno: 37 Fix configurator. revno: 36 Install the png file into usr/share/nautilus-pastebin and the svg in usr/share/pixmaps revno: 35 Fix clipboard revno: 34 Update changelog. revno: 33 Fix Debian bug#570131 revno: 32 Clean-up old translations revno: 31 Update translations revno: 30 Update MANIFEST revno: 29 delete TODO file revno: 28 Update changelog. revno: 27 Rename configurator's UI file. revno: 26 Don't install presets. revno: 25 Standards?? I'm a fucking Debian nerd :) revno: 24 Bump Standards. revno: 23 Update schemas path revno: 22 Remove old presets, now relies on pastebinit. revno: 21 Remove old modules. revno: 20 Port to gir, mostly re-written revno: 19 New glib schema and new configurator. revno: 18 Porting from GConf to GSettings revno: 17 It isn't a glade a file, it's a GtkBuilder file. revno: 16 New parsing methods, broken for now. revno: 15 Update translations template revno: 14 codepad.org updated revno: 13 Remove test.conf, now unnecessary revno: 12 Update code.bulix.org preset revno: 11 another test commit revno: 10 test commit revno: 9 Add show_error_message() function. revno: 8 Update test preset, fixes bugs revno: 7 Update paste.ubuntu.com preset; show an error message and don't send the file if it's empty revno: 6 Raise an exception if the content is empty. revno: 5 New syntax for presets, new APIs, code cleanup. revno: 4 Merge with experimental branch revno: 3 Removed tests directory revno: 2 Change presets spec. revno: 1 New experimental branch nautilus-pastebin-0.7.1/GPL-20000664000175000017500000004310311656527406017031 0ustar alessioalessio00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 of the License, or (at your option) any later 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. nautilus-pastebin-0.7.1/setup.py0000775000175000017500000000457511712310634020036 0ustar alessioalessio00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- # nautilus-pastebin - Nautilus extension to paste a file to a pastebin service # Written by: # Alessio Treglia # Copyright (C) 2009-2010, Alessio Treglia # # This package 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. # # This package 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 package; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # import os from distutils.core import setup from DistUtilsExtra.command import * def get_app_path_files(): return [ 'data/nautilus-pastebin.png', 'data/nautilus-pastebin-notification', 'data/nautilus-pastebin-configurator.ui' ] pkg_data_files = [ ('share/pixmaps/', ['data/nautilus-pastebin.svg']), ('share/applications/', ['data/nautilus-pastebin-configurator.desktop']), ('share/glib-2.0/schemas/', ['data/nautilus-pastebin.gschema.xml']), ('share/nautilus-pastebin/', get_app_path_files()), ] pkg_scripts = [ 'nautilus-pastebin.py', 'nautilus-pastebin-configurator.py' ] pkg_short_dsc = "Nautilus extension to send files to a pastebin" pkg_long_dsc = """nautilus-pastebin is a Nautilus extension written in Python, which allows users to upload text-only files to a pastebin service just by right-clicking on them. Users can also add their favorite service just by creatine new presets.""" setup(name='nautilus-pastebin', version='0.7.1', platforms=['all'], author='Alessio Treglia', author_email='quadrispro@ubuntu.com', license='GPL-2', url='https://launchpad.net/nautilus-pastebin', description=pkg_short_dsc, long_description=pkg_long_dsc, data_files=pkg_data_files, scripts=pkg_scripts, cmdclass = { "build" : build_extra.build_extra, "build_i18n" : build_i18n.build_i18n, "build_icons" : build_icons.build_icons, "clean": clean_i18n.clean_i18n, } ) nautilus-pastebin-0.7.1/nautilus-pastebin.py0000775000175000017500000001420111712310514022325 0ustar alessioalessio00000000000000#!/usr/bin/python # -*- coding: utf-8 -*- # nautilus-pastebin - Nautilus extension to paste a file to a pastebin service # Written by: # Alessio Treglia # Copyright (C) 2009-2010, Alessio Treglia # # This package 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. # # This package 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 package; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # import os import sys import time import gettext import re import urllib import webbrowser from subprocess import check_output, CalledProcessError from threading import Thread from gi.repository import GObject, Gdk, Gio, Gtk from gi.repository import Nautilus try: from gi.repository import Notify except ImportError: Notify = None # Globals APP_NAME = "nautilus-pastebin" LOGGING = 1 MAINTAINER_MODE = True gettext.install(APP_NAME) class log: def log(self, message): if self.logger: self.logger.debug(message) def __init__(self): logger = None if LOGGING: import logging logger = logging.getLogger(APP_NAME) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) logger.addHandler(ch) self.logger = logger log = log().log Notify.init("Nautilus pastebin extension") class PastebinThread(Thread): def __init__(self, settings, filename): self.settings = settings self.filename = filename Thread.__init__(self) def run(self): log ("PastebinThread started!") cmdline = ["pastebinit"] options = {} options['-b'] = "http://" + self.settings.get_string("pastebin") options['-a'] = self.settings.get_string("author") options['-u'] = self.settings.get_string("username") options['-p'] = self.settings.get_string("password") if not options['-a'] or options['-a'].strip() == '': options['-a'] = os.getenv("USERNAME") for opt in options: if options[opt] != None and options[opt].strip() != '': cmdline.append(opt) cmdline.append(options[opt]) cmdline.append(self.filename) summary = '' message = '' icon = None helper = Gtk.Button() try: pasteurl = check_output(cmdline).strip() except CalledProcessError as error: # error.cmd and error.returncode, pasteurl has strerr summary = error.message message = pasteurl icon = helper.render_icon(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.DIALOG, None) except: # if not pasteurl or not re.match("^http://.*$", pasteurl): summary = _("Unable to read or parse the result page.") message = _("It could be a server timeout or a change server side. Try later.") icon = helper.render_icon(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.DIALOG, None) else: summary = 'File pasted to: ' #URLmarkup = '%(pasteurl)s' #message = URLmarkup % {'pasteurl':pasteurl} message = pasteurl icon = helper.render_icon(Gtk.STOCK_PASTE, Gtk.IconSize.DIALOG, None) atom = Gdk.atom_intern('CLIPBOARD', True) cb = Gtk.Clipboard.get(atom) cb.clear() cb.set_text(pasteurl, -1) # Open a browser window if self.settings['openbrowser']: webbrowser.open(pasteurl) # Show a bubble if self.settings['shownotification']: if Notify != None: n = Notify.Notification.new(summary, message, None) n.set_image_from_pixbuf(icon) n.show() else: print "libnotify is not installed" class PastebinitExtension(GObject.GObject, Nautilus.MenuProvider): BASE_KEY = "apps.nautilus-pastebin" def __init__(self): log ("Intializing nautilus-pastebin extension...") self.settings = Gio.Settings.new(self.BASE_KEY) self.validate_settings() def validate_settings(self): # Make sure "pastebin" value is supported by pastebinit pass #TODO def show_error_message(self, error, description): n = Notify.Notification.new(error, description, None) helper = Gtk.Button() icon = helper.render_icon(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.DIALOG) n.set_icon_from_pixbuf(icon) n.show() def get_file_items(self, window, files): if len(files)!=1: return filename = files[0] if filename.get_uri_scheme() != 'file' or filename.is_directory(): return items = [] pastebin = self.settings.get_string("pastebin") #Called when the user selects a file in Nautilus. item = Nautilus.MenuItem(name="NautilusPython::pastebin_item", label=_("Pastebin to %s" % pastebin), tip=_("Send this file to %s" % pastebin)) item.set_property('icon', "nautilus-pastebin") item.connect("activate", self.menu_activate_cb, files) items.append(item) return items def menu_activate_cb(self, menu, files): if len(files) != 1: return filename = files[0] # TODO: MIME check filename = urllib.unquote(filename.get_uri()[7:]) thread = PastebinThread(self.settings, filename) thread.start() while (thread.isAlive()): time.sleep(0.09) while Gtk.events_pending(): Gtk.main_iteration() nautilus-pastebin-0.7.1/setup.cfg0000664000175000017500000000005111656527406020141 0ustar alessioalessio00000000000000[build_i18n] domain = nautilus-pastebin nautilus-pastebin-0.7.1/NEWS0000664000175000017500000000576611712311136017021 0ustar alessioalessio000000000000000.7.1: * Regression fix: the configuration didn't reflect changes to 'author', 'username' and 'password'. * Remove "askconfirmation" feature, needs more work. * Fix libnotify integration. 0.7.0 - Pastella: * Port to GObject Introspection. * Migrate from GConf to GSettings. * Port configurator's UI from libglade to GtkBuilder. * Now depends on pastebinit at runtime; see: http://launchpad.net/pastebinit * Fix Debian bug#570131, desktop file missed the "Exec" key. 0.5.0: * New supported pastebins: - http://codepad.org * Fix pastebin.com.conf preset. * The following pastebins seem no longer to work and they will be dropped in the next release: - paste.lisp.org - pastebot.ltsp.org - pastebin.ws 0.4.1: * Re-add translations. 0.4.0: * Add XML-RPC support. * New supported pastebins: - http://pastie.org - http://pastebin.mozilla.org - http://code.bulix.org - http://paste.lisp.org - http://paste.debian.net (XML-RPC version) * Great API changes and code refactoring. 0.3.0: * Application's settings are now managed through GConf. * New presets' installation path: /usr/share/nautilus-pastebin/presets/. * Low coupling: nautilus-pastebin <-> python-pastebin * Improve setup.py. * Better support for almost all pastebins. * Update translation templates. * Code cleanup. 0.2.1: * Rename pypastebin to the pastebin. * Update mimetypes maps. * Disable gettext support for pastebin module. 0.2.0: * Import translations. * Fix configurator's manpage. 0.2pre1: * New configuration panel. * New code organization. - Apply "high-coesion", "low-coupling" design patterns between pastebin's management core and the {extension,configurator}. * Update translations template. * Add icons to the notifications. 0.1.5: * Bugfixes: - Fix shebangs. - Don't install nautilus-pastebin.py as data file. 0.1.4: * Bugfixes: - yourpaste.net and pastey.net ddidn't work well, their regexs weren't set properly. * New features: - 3 global options to configure several actions: + enable_open_browser: whether open a browser window after sending the file. + enable_notification: whether show a bubble after sending the file. + enable_confirmation: whether ask user to confirm the send. - Configuration option pastebin-related to select the Validator. - New supported pastebin: http://pastebot.ltsp.org * Large code refactoring and other changes: - Almost all those fake-validators have been removed, now the GenericPastebinValidator class isn't virtual anymore and instances could be created. - Now the default pastebin is pastebin.com. 0.1.3: * Nautilus doesn't freeze anymore. 0.1.2: * Check MIME type compatibility only after the mouse click; this is needed to prevent that Nautilus freezes. 0.1.1: * Update MIME types map. * Add README file. * Add a short syntax explanation into the configuration file. 0.1.0: * First stable release.