pax_global_header00006660000000000000000000000064131753306040014514gustar00rootroot0000000000000052 comment=6b3d6d20aafbcbceb16a4ec60cc6a103521af9a8 mailnag-gnome-shell-3.26.0/000077500000000000000000000000001317533060400154245ustar00rootroot00000000000000mailnag-gnome-shell-3.26.0/.gitignore000066400000000000000000000000461317533060400174140ustar00rootroot00000000000000aggregate-avatars* schemas/*.compiled mailnag-gnome-shell-3.26.0/LICENSE000066400000000000000000000432541317533060400164410ustar00rootroot00000000000000 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. mailnag-gnome-shell-3.26.0/Makefile000066400000000000000000000026771317533060400171000ustar00rootroot00000000000000CC = valac LIBS = folks UUID = mailnag@pulb.github.com FILES = aggregate-avatars.vala DATA = extension.js indicator.js utils.js convenience.js prefs.js opts.js stylesheet.css metadata.json DATADIR = share/gnome-shell/extensions/$(UUID) SCHEMAS = schemas/org.gnome.shell.extensions.mailnag.gschema.xml SCHEMASDIR = share/glib-2.0/schemas PROGRAMS = aggregate-avatars prefix = /usr $(PROGRAMS): $(FILES) $(CC) --pkg $(LIBS) $(FILES) .PHONY: install install: $(PROGRAMS) $(DATA) $(SCHEMAS) test -d $(prefix)/bin || mkdir --parents $(prefix)/bin for p in $(PROGRAMS); do \ install -m 0755 $$p $(prefix)/bin; \ done test -d $(prefix)/$(DATADIR) || mkdir --parents $(prefix)/$(DATADIR) for d in $(DATA); do \ install -m 0644 $$d $(prefix)/$(DATADIR); \ done test -d $(prefix)/$(SCHEMASDIR) || mkdir --parents $(prefix)/$(SCHEMASDIR) for d in $(SCHEMAS); do \ install -m 0644 $$d $(prefix)/$(SCHEMASDIR); \ done install-local: $(PROGRAMS) $(DATA) $(SCHEMAS) test -d ~/.local/$(DATADIR) || mkdir --parents ~/.local/$(DATADIR) for p in $(PROGRAMS); do \ install -m 0755 $$p ~/.local/$(DATADIR); \ done for d in $(DATA); do \ install -m 0644 $$d ~/.local/$(DATADIR); \ done test -d $(prefix)/$(DATADIR)/schemas || mkdir --parents ~/.local/$(DATADIR)/schemas for d in $(SCHEMAS); do \ install -m 0644 $$d ~/.local/$(DATADIR)/schemas; \ done glib-compile-schemas ~/.local/$(DATADIR)/schemas .PHONY: clean clean: rm -f $(PROGRAMS) mailnag-gnome-shell-3.26.0/README.md000066400000000000000000000040751317533060400167110ustar00rootroot00000000000000# mailnag-gnome-shell GNOME-Shell extension that shows a mail indicator in the top panel (including mail counter and popup menu). ## Installation This extension requires the [Mailnag daemon](https://github.com/pulb/mailnag). Prior to installation, run `mailnag-config`. If you want notification popups ensure that the *libnotify* plugin is enabled. ### Ubuntu This extension is available in the official [Ubuntu PPA](https://launchpad.net/~pulb/+archive/mailnag). Issue the following commands in a terminal to enable the PPA and install the extension. sudo add-apt-repository ppa:pulb/mailnag sudo apt-get update sudo apt-get install gnome-shell-mailnag As of Ubuntu 14.10 (Utopic), this extension is also available in the official repos. Run `sudo apt-get install gnome-shell-mailnag` in a terminal to install it. ### Debian This extension is currently available in Debian unstable. Run `sudo apt-get install gnome-shell-mailnag` in a terminal to install it. ### Arch Linux This extension is available in the [AUR](https://aur.archlinux.org/packages/mailnag-gnome-shell/) repository. Please either run `yaourt -S mailnag-gnome-shell` or `packer -S mailnag-gnome-shell` (as root) to install the package. ### Other GNOME 3 Distros This extension is also available for easy 1-click installation at [extensions.gnome.org](https://extensions.gnome.org/extension/886/mailnag/). Please note that this version does not support avatars (as shown in the screenshot below). ### Generic Source Tarballs Distribution independent tarball releases are available [here](https://github.com/pulb/mailnag-gnome-shell/releases). To install the extension type the following commands in a terminal (root is *not* required): tar xvf mailnag-gnome-shell-*.tar.gz cd mailnag-gnome-shell-* make install-local That's it. Now fire up `gnome-tweak-tool` and enable the extension. ###### Requirements * vala (at compiletime only) * libfolks * gnome-shell * mailnag ## Screenshots ![Screenshot](https://raw.github.com/pulb/mailnag-gnome-shell/docs/docs/screenshots/mailnag-gnome-shell.png) mailnag-gnome-shell-3.26.0/aggregate-avatars.vala000066400000000000000000000051551317533060400216640ustar00rootroot00000000000000/* Mailnag - GNOME-Shell extension frontend * * Copyright 2013, 2016 Patrick Ulbrich * * 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. */ /* This tool aggregates a list of (email, avatar_file) pairs * which is passed to the Mailnag GNOME-Shell extension. * Compile with `valac --pkg folks aggregate-avatars.vala`. */ using Folks; static int main(string args[]) { MainLoop mainloop = new MainLoop(); var aggregator = IndividualAggregator.dup(); aggregator.prepare.begin(); Idle.add(() => { if (!aggregator.is_quiescent) return true; aggregate_async.begin(mainloop, aggregator); return false; }); mainloop.run(); return 0; } async void aggregate_async(MainLoop mainloop, IndividualAggregator aggregator) { File cache_dir = File.new_for_path( Environment.get_user_runtime_dir()).get_child("aggregate-avatars-cache"); if (!cache_dir.query_exists()) cache_dir.make_directory_with_parents(); var sb = new StringBuilder(); foreach (var e in aggregator.individuals.entries) { OutputStream dst_stream = null; InputStream src_stream = null; try { Individual individual = e.value; File dst_file = cache_dir.get_child(individual.id); if (dst_file.query_exists()) dst_file.delete(); if ((individual.avatar != null) && !individual.email_addresses.is_empty) { src_stream = individual.avatar.load(-1, null, null); dst_stream = dst_file.replace(null, false, FileCreateFlags.PRIVATE); dst_stream.splice(src_stream, OutputStreamSpliceFlags.NONE); foreach (var email in individual.email_addresses) sb.append_printf("%s;%s;", email.value.strip(), dst_file.get_path()); } } catch (Error e) { stderr.printf("Error: %s\n", e.message); } finally { try { if (src_stream != null) src_stream.close(); if (dst_stream != null) dst_stream.close(); } catch (IOError e) {} } } if (sb.len > 0) { stdout.printf(sb.truncate(sb.len - 1).str); stdout.flush(); } mainloop.quit(); } mailnag-gnome-shell-3.26.0/convenience.js000066400000000000000000000072131317533060400202610ustar00rootroot00000000000000/* Copyright (c) 2011-2012, Giovanni Campagna Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the GNOME nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ const Gettext = imports.gettext; const Gio = imports.gi.Gio; const Config = imports.misc.config; const ExtensionUtils = imports.misc.extensionUtils; /** * initTranslations: * @domain: (optional): the gettext domain to use * * Initialize Gettext to load translations from extensionsdir/locale. * If @domain is not provided, it will be taken from metadata['gettext-domain'] */ function initTranslations(domain) { let extension = ExtensionUtils.getCurrentExtension(); domain = domain || extension.metadata['gettext-domain']; // check if this extension was built with "make zip-file", and thus // has the locale files in a subfolder // otherwise assume that extension has been installed in the // same prefix as gnome-shell let localeDir = extension.dir.get_child('locale'); if (localeDir.query_exists(null)) Gettext.bindtextdomain(domain, localeDir.get_path()); else Gettext.bindtextdomain(domain, Config.LOCALEDIR); } /** * getSettings: * @schema: (optional): the GSettings schema id * * Builds and return a GSettings schema for @schema, using schema files * in extensionsdir/schemas. If @schema is not provided, it is taken from * metadata['settings-schema']. */ function getSettings(schema) { let extension = ExtensionUtils.getCurrentExtension(); schema = schema || extension.metadata['settings-schema']; const GioSSS = Gio.SettingsSchemaSource; // check if this extension was built with "make zip-file", and thus // has the schema files in a subfolder // otherwise assume that extension has been installed in the // same prefix as gnome-shell (and therefore schemas are available // in the standard folders) let schemaDir = extension.dir.get_child('schemas'); let schemaSource; if (schemaDir.query_exists(null)) schemaSource = GioSSS.new_from_directory(schemaDir.get_path(), GioSSS.get_default(), false); else schemaSource = GioSSS.get_default(); let schemaObj = schemaSource.lookup(schema, true); if (!schemaObj) throw new Error('Schema ' + schema + ' could not be found for extension ' + extension.metadata.uuid + '. Please check your installation.'); return new Gio.Settings({ settings_schema: schemaObj }); } mailnag-gnome-shell-3.26.0/extension.js000066400000000000000000000244571317533060400200120ustar00rootroot00000000000000/* Mailnag - GNOME-Shell extension frontend * * Copyright 2013 - 2016 Patrick Ulbrich * * 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. */ const Main = imports.ui.main; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const Lang = imports.lang; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Convenience = Me.imports.convenience; const Indicator = Me.imports.indicator; const Opts = Me.imports.opts; const AVATAR_ICON_SIZE = 38; const SHOW_AVATARS_KEY = 'show-avatars'; const MAX_VISIBLE_MAILS_KEY = 'max-visible-mails'; const SHOW_DATES_KEY = 'show-dates'; const SHOW_MARK_ALL_AS_READ_BUTTON_KEY = 'show-mark-all-as-read-button'; const SHOW_CHECK_FOR_MAIL_BUTTON_KEY = 'show-check-for-mail-button'; const SHOW_SETTINGS_BUTTON_KEY = 'show-settings-button'; const SHOW_QUIT_BUTTON_KEY = 'show-quit-button'; const GROUP_BY_ACCOUNT_KEY = 'group-by-account'; const REMOVE_INDICATOR_KEY = 'remove-indicator'; const KeyActionMap = new Map([ [ SHOW_MARK_ALL_AS_READ_BUTTON_KEY, Opts.ACTION_FLAGS.MARK_ALL_AS_READ ], [ SHOW_CHECK_FOR_MAIL_BUTTON_KEY, Opts.ACTION_FLAGS.CHECK_FOR_MAIL ], [ SHOW_SETTINGS_BUTTON_KEY, Opts.ACTION_FLAGS.SETTINGS ], [ SHOW_QUIT_BUTTON_KEY, Opts.ACTION_FLAGS.QUIT ] ]); const MailnagIface = '\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ '; const MailnagDbus = Gio.DBusProxy.makeProxyWrapper(MailnagIface); const MailnagExtension = new Lang.Class({ Name: 'MailnagExtension', _init: function(options) { this._mails = []; this._opts = options; this._indicator = null; this._proxy = new MailnagDbus(Gio.DBus.session, 'mailnag.MailnagService', '/mailnag/MailnagService'); this._onMailsAddedId = this._proxy.connectSignal('MailsAdded', Lang.bind(this, this._onMailsAdded)); this._onMailsRemovedId = this._proxy.connectSignal('MailsRemoved', Lang.bind(this, this._onMailsRemoved)); // TODO : what if Mailnag sends a MailsAdded signal here or after GetMailsRemote() // (should happen *extremely* rarely)? // Is it possible to prevent the extension from notifying twice? // Mailnag possibly fired a 'MailsAdded' signal before this extension was started, // so check if Mailnag fetched mails already and pull them manually. this._proxy.GetMailsRemote(Lang.bind(this, function([mails], error) { if (!error) { if ((mails.length > 0) || !this._opts.removeIndicator) { this._handle_new_mails(mails, mails); } } })); }, _onMailsAdded: function(proxy, sender, [new_mails, all_mails]) { this._handle_new_mails(new_mails, all_mails); }, _onMailsRemoved: function(proxy, sender, [remaining_mails]) { // TODO : not only support removal of *all* mails if (remaining_mails.length == 0) { this._mails = []; if (this._indicator != null) { if ((this._mails.length == 0) && this._opts.removeIndicator) { this._destroyIndicator(); } else { this._indicator.setMails(this._mails); } } } }, _handle_new_mails: function(new_mails, all_mails) { this._mails = all_mails; if (this._indicator == null) { this._createIndicator(); } else { this._indicator.setMails(all_mails); } }, _createIndicator: function() { this._indicator = new Indicator.MailnagIndicator(this._opts, this); this._indicator.setMails(this._mails); Main.panel.addToStatusArea('mailnag-indicator', this._indicator, 0); }, _destroyIndicator: function() { if (this._indicator != null) { this._indicator.destroy(); this._indicator = null; } }, markMailAsRead: function(mail_id) { // Find the mail object with the specified mail_id let idx = -1; for (let i = 0; i < this._mails.length; i++) { [id, size] = this._mails[i]['id'].get_string(); if (id == mail_id) { idx = i; break; } } // There is no mail object with the specified mail_id -> return if (idx == -1) return; // Remove mail from local mail list this._mails.splice(idx, 1); // Notify the Mailnag daemon to mark the mail as read this._proxy.MarkMailAsReadRemote(mail_id, function(result, error) { if (error) { log("Error: markMailAsReadRemote() failed."); } }); // Update Panel Indicator if ((this._mails.length == 0) && this._opts.removeIndicator) { this._destroyIndicator(); } else { if (this._indicator != null) this._indicator.setMails(this._mails); } }, markAllMailsAsRead: function() { // TODO: add a markAllMailsAsRead() method to the DBus interface for (let i = 0; i < this._mails.length; i++) { [id, size] = this._mails[i]['id'].get_string(); // Notify the Mailnag daemon to mark the mail as read this._proxy.MarkMailAsReadRemote(id, function(result, error) { if (error) { log("Error: markMailAsReadRemote() failed."); } }); } this._mails = []; if (this._opts.removeIndicator) { this._destroyIndicator(); } else { if (this._indicator != null) this._indicator.setMails(this._mails); } }, checkForMails: function() { this._proxy.CheckForMailsRemote(function(result, error) { if (error) { log("Error: checkForMailsRemote() failed."); } }); }, shutdown: function() { this._proxy.ShutdownRemote(function(result, error) { if (error) { log("Error: shutdownRemote() failed."); } }); }, dispose: function() { if (this._onMailsAddedId > -1) { this._proxy.disconnectSignal(this._onMailsAddedId); this._onMailsAddedId = -1; } if (this._onMailsRemovedId > -1) { this._proxy.disconnectSignal(this._onMailsRemovedId); this._onMailsRemovedId = -1; } this._destroyIndicator(); } }); function aggregateAvatarsAsync(completedCallback) { let aggregator = "aggregate-avatars"; let result = null; let avatars = {}; try { result = GLib.spawn_async_with_pipes( null, [aggregator], null, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD, null); } catch (ex) { try { result = GLib.spawn_async_with_pipes( Me.path, [aggregator], null, GLib.SpawnFlags.DO_NOT_REAP_CHILD, null); } catch (ex) { logError(ex, "Failed to spawn '%s'".format(aggregator)); } } if (result == null) { completedCallback(avatars); } else { let [res, pid, stdin_fd, stdout_fd, stderr_fd] = result; let stdout = new Gio.DataInputStream({ base_stream: new Gio.UnixInputStream({ fd: stdout_fd, close_fd: true })}); GLib.close(stdin_fd); GLib.close(stderr_fd); let childWatch = GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function(pid, status, requestObject) { let [out, size] = stdout.read_line(null); if (size > 0) { let lst = out.toString().split(";"); for (let i = 0; i < lst.length; i += 2) { let email = lst[i].toLowerCase(); let avatarFile = lst[i + 1]; avatars[email] = avatarFile; } } stdout.close(null); GLib.source_remove(childWatch); completedCallback(avatars); }); } } function createExt(s, avatars) { let opts = new Opts.Options(); opts.maxVisibleMails = s.get_int(MAX_VISIBLE_MAILS_KEY); opts.showDates = s.get_boolean(SHOW_DATES_KEY); opts.groupMailsByAccount = s.get_boolean(GROUP_BY_ACCOUNT_KEY); opts.removeIndicator = s.get_boolean(REMOVE_INDICATOR_KEY); opts.avatars = avatars; opts.avatarSize = AVATAR_ICON_SIZE; opts.menuActions = Opts.ACTION_FLAGS.NONE; for ([k, v] of KeyActionMap) { if (s.get_boolean(k)) opts.menuActions |= v; } return new MailnagExtension(opts); } let ext = null; let watch_id = -1; let settings = null; let cachedAvatars = null; let reloadInProgress = false; function init() { } function enable() { settings = Convenience.getSettings(); // Register changed handler for gsettings. // (Restarts the extension if settings // have been changed, e.g. via prefs.js) settings.connect('changed', function(settings, key) { if ((ext != null) && !reloadInProgress) { ext.dispose(); if ((cachedAvatars == null) && (key == SHOW_AVATARS_KEY) && settings.get_boolean(key)) { reloadInProgress = true; aggregateAvatarsAsync(function(avatars) { cachedAvatars = avatars; ext = createExt(settings, avatars); reloadInProgress = false; }); } else { ext = createExt(settings, settings.get_boolean(SHOW_AVATARS_KEY) ? cachedAvatars : {}); } } }); // Register dbus watch handlers - create the extension // if the Mailnag daemon is running / remove it if the daemon is gone. watch_id = Gio.DBus.session.watch_name('mailnag.MailnagService', Gio.BusNameWatcherFlags.NONE, function (owner) { if (settings.get_boolean(SHOW_AVATARS_KEY)) { aggregateAvatarsAsync(function(avatars) { cachedAvatars = avatars; ext = createExt(settings, avatars); }); } else { ext = createExt(settings, {}); } }, function (owner) { if (ext != null) { ext.dispose(); ext = null; } }); } function disable() { if (watch_id > -1) { // TODO : test: does this call the function (owner) callback, so ext.dispose() is called twice? Gio.DBus.session.unwatch_name(watch_id); watch_id = -1; } cachedAvatars = null; reloadInProgress = false; if (settings != null) { settings.run_dispose(); settings = null; } if (ext != null) { ext.dispose(); ext = null; } } mailnag-gnome-shell-3.26.0/indicator.js000066400000000000000000000323131317533060400177400ustar00rootroot00000000000000/* Mailnag - GNOME-Shell extension frontend * * Copyright 2013 - 2017 Patrick Ulbrich * * 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. */ const St = imports.gi.St; const Clutter = imports.gi.Clutter; const Util = imports.misc.util; const Pango = imports.gi.Pango; const PopupMenu = imports.ui.popupMenu; const PanelMenu = imports.ui.panelMenu; const Lang = imports.lang; const Mainloop = imports.mainloop; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Utils = Me.imports.utils; const Opts = Me.imports.opts; const INDICATOR_ICON = 'mail-unread-symbolic' const INACTIVE_ITEM = { reactive: true, can_focus: false, activate: false, hover: false }; const IndicatorMailMenuItem = new Lang.Class({ Name: 'IndicatorMailMenuItem', Extends: PopupMenu.PopupBaseMenuItem, _init: function(mail, avatars, avatarSize, showDates, extension) { this.parent(INACTIVE_ITEM); this._extension = extension; this._mailID = null; this._dateLabel = null; this._iconBin = null; this._closeButton = null; let [sender, ] = mail['sender_name'].get_string(); let [senderAddr, ] = mail['sender_addr'].get_string(); let [subject, ] = mail['subject'].get_string(); let [mailID, ] = mail['id'].get_string(); let datetime = mail['datetime'].get_int32(); this._mailID = mailID; if (sender.length == 0) sender = senderAddr; let hbox = new St.BoxLayout({ vertical: false, x_expand: true, reactive: true, can_focus: true, track_hover: true, style_class: 'menu-item-box'}); let vbox = new St.BoxLayout({ vertical: true, x_expand: true }); let senderLabel = new St.Label({ text: sender, x_expand: true, style_class: 'sender-label' }); let subjectLabel = new St.Label({ text: subject, x_expand: true, style_class: 'subject-label' }); /* TODO : somehow these linewrap settings are ignored... */ senderLabel.clutter_text.line_wrap = false; senderLabel.clutter_text.ellipsize = Pango.EllipsizeMode.END; subjectLabel.clutter_text.line_wrap = false; subjectLabel.clutter_text.ellipsize = Pango.EllipsizeMode.END; let hbox2 = new St.BoxLayout({ vertical: false, x_expand: true, style_class: 'generic-box' }); hbox2.add(senderLabel); if (showDates) { this._dateLabel = new St.Label({ text: Util.formatTime(new Date(datetime * 1000)), style_class: 'date-label' }); hbox2.add(this._dateLabel, { expand: true, x_fill: false, x_align: St.Align.END }); } this._closeButton = new St.Button({ reactive: true, can_focus: true, visible: false, track_hover: true }); this._closeButton.connect('clicked', function() { extension.markMailAsRead(mailID); }); this._closeButton.child = new St.Icon({ icon_name: 'window-close-symbolic', style_class: 'popup-menu-icon' }); hbox2.add(this._closeButton); vbox.add(hbox2); vbox.add(subjectLabel); hbox.add(vbox); let avatarFile = avatars[senderAddr.toString().toLowerCase()]; if (avatarFile != undefined) { this._iconBin = new St.Bin({ style_class: 'avatar', style: 'background-image: url("%s")'.format(avatarFile), width: avatarSize, height: avatarSize, x_fill: true, y_fill: true }); hbox.add(this._iconBin); } else { /*hbox.add(new St.Icon({ icon_name: 'avatar-default', icon_size: avatarSize }));*/ } hbox.connect('button-release-event', Lang.bind(this, this._onButtonReleaseEvent)); hbox.connect('touch-event', Lang.bind(this, this._onTouchEvent)); hbox.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); hbox.connect('notify::hover', Lang.bind(this, this._onHover)); hbox.isMailnagMailItem = true; this.actor.add_child(hbox); }, _onButtonReleaseEvent: function (actor, event) { Utils.openDefaultMailReader(); this.activate(event); return Clutter.EVENT_STOP; }, _onTouchEvent: function (actor, event) { if (event.type() == Clutter.EventType.TOUCH_END) { Utils.openDefaultMailReader(); this.activate(event); return Clutter.EVENT_STOP; } return Clutter.EVENT_PROPAGATE; }, _onKeyPressEvent: function (actor, event) { let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) { Utils.openDefaultMailReader(); this.activate(event); return Clutter.EVENT_STOP; } else if (symbol == Clutter.KEY_Delete) { this._extension.markMailAsRead(this._mailID); return Clutter.EVENT_STOP; } return Clutter.EVENT_PROPAGATE; }, _onHover: function(actor) { if (this._dateLabel != null) this._dateLabel.visible = !actor.hover; if (this._iconBin != null) this._iconBin.visible = !actor.hover; this._closeButton.visible = actor.hover; } }); const MailnagIndicator = new Lang.Class({ Name: 'MailnagIndicator', Extends: PanelMenu.Button, _init: function(options, extension) { this.parent(0.0, this.Name); this._opts = options; this._extension = extension; this._icon = new St.Icon({ icon_name: INDICATOR_ICON, style_class: 'system-status-icon'}); this._iconBin = new St.Bin({ child: this._icon, x_fill: false, y_fill: false }); this._counterLabel = new St.Label({ text: "0", x_align: Clutter.ActorAlign.CENTER, x_expand: true, y_align: Clutter.ActorAlign.CENTER, y_expand: true }); this._counterBin = new St.Bin({ style_class: 'mailnag-counter', child: this._counterLabel, layout_manager: new Clutter.BinLayout() }); this._counterBin.connect('style-changed', Lang.bind(this, function() { let themeNode = this._counterBin.get_theme_node(); this._counterBin.translation_x = themeNode.get_length('-mailnag-counter-overlap-x'); this._counterBin.translation_y = themeNode.get_length('-mailnag-counter-overlap-y'); })); this.actor.add_actor(this._iconBin); this.actor.add_actor(this._counterBin); this.setMails([]); }, _allocate: function(actor, box, flags) { // the iconBin should fill our entire box this._iconBin.allocate(box, flags); // get the allocation box of the indicator icon let iconBox = this._iconBin.child.get_allocation_box(); // create a temporary box for calculating the counter allocation let childBox = new Clutter.ActorBox(); let [minWidth, minHeight, naturalWidth, naturalHeight] = this._counterBin.get_preferred_size(); let direction = this.actor.get_text_direction(); if (direction == Clutter.TextDirection.LTR) { // allocate on the right in LTR childBox.x1 = iconBox.x2 - (naturalWidth / 2); childBox.x2 = childBox.x1 + naturalWidth; } else { // allocate on the left in RTL childBox.x1 = iconBox.x1 - (naturalWidth / 2); childBox.x2 = childBox.x1 + naturalWidth; } childBox.y1 = iconBox.y2 - (naturalHeight / 2); childBox.y2 = childBox.y1 + naturalHeight; this._counterBin.allocate(childBox, flags); }, _updateMenu: function(mails) { let item = null; this.menu.removeAll(); if (mails.length > 0) { let maxMails = (mails.length <= this._opts.maxVisibleMails) ? mails.length : this._opts.maxVisibleMails; if (this._opts.groupMailsByAccount && (mails[0]['account_name'] != undefined)) { this._addGroupedMailItems(this.menu, mails, maxMails); } else { this._addMailItems(this.menu, mails, maxMails); if (mails.length > this._opts.maxVisibleMails) { let str = _("(and {0} more)").replace("{0}", (mails.length - this._opts.maxVisibleMails)); item = new PopupMenu.PopupBaseMenuItem(INACTIVE_ITEM); item.actor.add_child(new St.Label({ text: str, style_class: 'more-label' })); this.menu.addMenuItem(item); } } if (this._opts.menuActions != Opts.ACTION_FLAGS.NONE) this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()) if (this._opts.menuActions & Opts.ACTION_FLAGS.MARK_ALL_AS_READ) { item = new PopupMenu.PopupMenuItem(_("Mark All As Read")); item.connect('activate', Lang.bind(this, function() { // We call markAllMailsAsRead() on the mainloop (deferred) // because it will cause the menu to be rebuilt // (the 'activate' event is closing the menu and // rebuilding it while it is being closed, somehow // reopens the menu). Mainloop.idle_add(Lang.bind(this, function() { this._extension.markAllMailsAsRead(); return false; })); })); this.menu.addMenuItem(item); } } if (this._opts.menuActions & Opts.ACTION_FLAGS.CHECK_FOR_MAIL) { item = new PopupMenu.PopupMenuItem(_("Check For Mail")); item.connect('activate', Lang.bind(this, function() { this._extension.checkForMails(); })); this.menu.addMenuItem(item); } if (this._opts.menuActions & Opts.ACTION_FLAGS.SETTINGS) this._addSettingsSubmenu(this.menu); if (this._opts.menuActions & Opts.ACTION_FLAGS.QUIT) { item = new PopupMenu.PopupMenuItem(_("Quit")); item.connect('activate', Lang.bind(this, function() { item.actor.reactive = false; this._extension.shutdown(); })); this.menu.addMenuItem(item); } if (this.menu.isOpen) { if (mails.length == 0) { // It the menu is open and the last mail was removed by the user, // close the menu. this.menu.close(); } else { // Fix hover effect of the focused mail menu-item after menu rebuild let [x, y] = global.get_pointer(); let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y); if ((actor != null) && (actor.isMailnagMailItem)) { actor.hover = true; } // If the menu is open, set the key-focus on the panel icon // so the focus won't get lost if a mail was removed via the delete key. this.actor.grab_key_focus(); } } }, _addMailItems: function(menu, mails, maxMails) { for (let i = 0; i < maxMails; i++) { let item = new IndicatorMailMenuItem(mails[i], this._opts.avatars, this._opts.avatarSize, this._opts.showDates, this._extension); menu.addMenuItem(item); } }, _addGroupedMailItems: function(menu, mails, maxMails) { // // Group mails by account // let groups = new Map(); for (let m of mails) { let [name, size] = m['account_name'].get_string(); if (!groups.has(name)) groups.set(name, []) groups.get(name).push(m); } // // Trim mails of groups // let groupsTrimmed = new Map(); let counter = maxMails; counter = Math.min(counter, mails.length); // Make sure all accounts are shown (i.e. at least one mail per account). counter = Math.max(counter, groups.size); while (counter > 0) { for ([k, v] of groups) { if (v.length > 0) { if (!groupsTrimmed.has(k)) groupsTrimmed.set(k, []) let m = v.shift(); groupsTrimmed.get(k).push(m); counter--; if (counter == 0) break; } } } // // Add groups to the menu // let keys = [...groupsTrimmed.keys()].sort(); for (let k of keys) { let item = new PopupMenu.PopupBaseMenuItem(INACTIVE_ITEM); let label = new St.Label({ text: k, style_class: 'account-group-label' }); let mails = groupsTrimmed.get(k); let remainingMails = groups.get(k); label.clutter_text.line_wrap = false; label.clutter_text.ellipsize = Pango.EllipsizeMode.END; if (remainingMails.length > 0) { let hbox = new St.BoxLayout({ vertical: false, x_expand: true, style_class: 'generic-box' }); let str = "%d/%d".format(mails.length, mails.length + remainingMails.length); let bin = new St.Bin({ style_class: 'overflow-badge', child: new St.Label( { text: str } ) }); hbox.add(label); hbox.add(bin, { expand: true, x_fill: false, x_align: St.Align.END }); item.actor.add_child(hbox); } else { item.actor.add_child(label); } menu.addMenuItem(item); this._addMailItems(menu, mails, mails.length); } }, _addSettingsSubmenu: function(menu) { let item = null; let subMenu = new PopupMenu.PopupSubMenuMenuItem(_("Settings"), false); item = new PopupMenu.PopupMenuItem(_("Mailnag Settings")); item.connect('activate', function() { Utils.launchApp('mailnag-config.desktop'); }); subMenu.menu.addMenuItem(item); item = new PopupMenu.PopupMenuItem(_("Extension Settings")); item.connect('activate', function() { Util.spawn(['gnome-shell-extension-prefs', 'mailnag@pulb.github.com']); }); subMenu.menu.addMenuItem(item); menu.addMenuItem(subMenu); }, setMails: function(mails) { let label = mails.length <= 99 ? mails.length.toString() : "..."; this._counterLabel.set_text(label); if (mails.length > 0) { this._counterBin.visible = true; this._icon.opacity = 255; } else { this._counterBin.visible = false; this._icon.opacity = 130; } this._updateMenu(mails); } }); mailnag-gnome-shell-3.26.0/metadata.json000066400000000000000000000004241317533060400200770ustar00rootroot00000000000000{ "shell-version": ["3.16", "3.18", "3.20", "3.22", "3.24", "3.26"], "uuid": "mailnag@pulb.github.com", "settings-schema": "org.gnome.shell.extensions.mailnag", "gettext-domain": "mailnag-gnome-shell", "name": "Mailnag", "description": "Mailnag GNOME-Shell extension" } mailnag-gnome-shell-3.26.0/opts.js000066400000000000000000000022551317533060400167530ustar00rootroot00000000000000/* Mailnag - GNOME-Shell extension frontend * * Copyright 2016 Patrick Ulbrich * * 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. */ const Lang = imports.lang; const ACTION_FLAGS = { NONE : 0, MARK_ALL_AS_READ : 1, CHECK_FOR_MAIL : 2, SETTINGS : 4, QUIT : 8, ALL : 15 }; const Options = new Lang.Class({ Name: 'Options', maxVisibleMails : 10, showDates : true, groupMailsByAccount : false, removeIndicator : true, avatars : {}, avatarSize : 38, menuActions : ACTION_FLAGS.ALL }); mailnag-gnome-shell-3.26.0/prefs.js000066400000000000000000000074071317533060400171110ustar00rootroot00000000000000/* Mailnag - GNOME-Shell extension frontend * * Copyright 2013 - 2016 Patrick Ulbrich * * 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. */ const Gio = imports.gi.Gio; const Gtk = imports.gi.Gtk; const GObject = imports.gi.GObject; const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Convenience = Me.imports.convenience; const Gettext = imports.gettext.domain('mailnag-gnome-shell'); const _ = Gettext.gettext; const MAX_VISIBLE_MAILS_LIMIT = 20; const MailnagSettingsWidget = new GObject.Class({ Name: 'Mailnag.Prefs.MailnagSettingsWidget', GTypeName: 'MailnagSettingsWidget', Extends: Gtk.Box, _init : function(params) { this.parent(params); this.orientation = Gtk.Orientation.VERTICAL; this.margin = 12; this.spacing = 6; let settings = Convenience.getSettings(); let box = new Gtk.Box( { orientation: Gtk.Orientation.HORIZONTAL, spacing: 6 } ); box.add(new Gtk.Label( { label: _('Maximum number of visible mails:') } )); let spinbtn = Gtk.SpinButton.new_with_range(1, MAX_VISIBLE_MAILS_LIMIT, 1); spinbtn.set_value(settings.get_int('max-visible-mails')); settings.bind('max-visible-mails', spinbtn, 'value', Gio.SettingsBindFlags.DEFAULT); box.add(spinbtn); this.add(box); let checkbtn_remove = new Gtk.CheckButton( { label: _('Remove indicator icon if maillist is empty') } ); settings.bind('remove-indicator', checkbtn_remove, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_remove); let checkbtn_group = new Gtk.CheckButton( { label: _('Group mails by account') } ); settings.bind('group-by-account', checkbtn_group, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_group); let checkbtn_avatars = new Gtk.CheckButton( { label: _('Show avatars') } ); settings.bind('show-avatars', checkbtn_avatars, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_avatars); let checkbtn_dates = new Gtk.CheckButton( { label: _('Show dates') } ); settings.bind('show-dates', checkbtn_dates, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_dates); let checkbtn_mark = new Gtk.CheckButton( { label: _('Show Mark-All-As-Read button') } ); settings.bind('show-mark-all-as-read-button', checkbtn_mark, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_mark); let checkbtn_check = new Gtk.CheckButton( { label: _('Show Check-For-Mail button') } ); settings.bind('show-check-for-mail-button', checkbtn_check, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_check); let checkbtn_settings = new Gtk.CheckButton( { label: _('Show Settings button') } ); settings.bind('show-settings-button', checkbtn_settings, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_settings); let checkbtn_quit = new Gtk.CheckButton( { label: _('Show Quit button') } ); settings.bind('show-quit-button', checkbtn_quit, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(checkbtn_quit); } }); function init() { Convenience.initTranslations(); } function buildPrefsWidget() { let widget = new MailnagSettingsWidget(); widget.show_all(); return widget; } mailnag-gnome-shell-3.26.0/schemas/000077500000000000000000000000001317533060400170475ustar00rootroot00000000000000mailnag-gnome-shell-3.26.0/schemas/org.gnome.shell.extensions.mailnag.gschema.xml000066400000000000000000000040271317533060400300100ustar00rootroot00000000000000 true Show avatars Show avatars in the indicator mail list (if available) true Show dates Show labels indicating the date of a mail true Show Mark-All-As-Read button Show a button to mark all mails as read true Show Check-For-Mail-Button Show a button to check for mail true Show Settings button Show a button to open a settings submenu false Show Quit button Show a button to quit Mailnag false Remove indicator icon Removes the indicator icon if the maillist is empty false Group mails by account Group mails by account 10 Maximum number of visible mails Maximum number of mails listed in the panel indicator mailnag-gnome-shell-3.26.0/stylesheet.css000066400000000000000000000034101317533060400203250ustar00rootroot00000000000000/* Copyright 2013 - 2016 Patrick Ulbrich * * 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. */ .mailnag-counter { background-color: rgba(70, 144, 217, 0.75); color: #ffffff; border-radius: 24px; font-size: 6pt; min-width: 14px; min-height: 14px; -mailnag-counter-overlap-x: -4px; -mailnag-counter-overlap-y: -2px; } .menu-item-box { background-color: rgba(255, 255, 255, 0.05); padding:6px; border-radius: 4px; spacing: 12px; width: 24em; } .menu-item-box:hover, .menu-item-box:focus { background-color: rgba(255, 255, 255, 0.12); } .account-group-label { color: #8e8e80; font-size: medium; font-weight: bold; } .more-label { color: #8e8e80; font-size: small; font-style: italic; } .sender-label { font-size: medium; font-weight: bold; } .generic-box { spacing: 12px; } .subject-label { font-size: small; } .date-label { color: #8e8e80; font-size: small; } .overflow-badge { color: #393f3f; background-color: #59594f; /*#8e8e80;*/ font-size: small; padding: 0em 0.4em 0em 0.4em; border-radius: 4px; } .avatar { border-radius: 4px; background-size:contain; } mailnag-gnome-shell-3.26.0/utils.js000066400000000000000000000023701317533060400171240ustar00rootroot00000000000000/* Mailnag - GNOME-Shell extension frontend * * Copyright 2014 Patrick Ulbrich * * 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. */ const Gio = imports.gi.Gio; const Shell = imports.gi.Shell; function launchApp(desktop_file) { let app = Shell.AppSystem.get_default() .lookup_app(desktop_file); if (app != null) app.activate(); } function openDefaultMailReader() { // Get default application for emails. let appInfo = Gio.AppInfo .get_default_for_type("x-scheme-handler/mailto", false); if (appInfo != null) { // Run default email application. launchApp(appInfo.get_id()); } }