gget r3 - trunk/gget



Author: johans
Date: Wed Jun 11 09:56:49 2008
New Revision: 3
URL: http://svn.gnome.org/viewvc/gget?rev=3&view=rev

Log:
Added files.

Added:
   trunk/gget/AboutDialog.py
   trunk/gget/StatusIcon.py

Added: trunk/gget/AboutDialog.py
==============================================================================
--- (empty file)
+++ trunk/gget/AboutDialog.py	Wed Jun 11 09:56:49 2008
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
+
+# This file is part of gget.
+
+# gget 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.
+
+# gget 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 gget; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+from gettext import gettext as _
+
+import gtk
+import gnome.ui
+
+import GUI
+from gget import NAME, VERSION
+
+class AboutDialog(gtk.AboutDialog):
+    def __init__(self):
+        gtk.AboutDialog.__init__(self)
+        gtk.about_dialog_set_email_hook(self.__url_hook, "mailto:";)
+        gtk.about_dialog_set_url_hook(self.__url_hook, "")
+
+        self.set_logo_icon_name(NAME.lower())
+        self.set_name(NAME)
+        self.set_version(VERSION)
+        self.set_copyright("Copyright (C) 2008 Johan Svedberg")
+        self.set_website("http://live.gnome.org/GGet";)
+        self.set_comments(_("GGet is a Download Manager for the GNOME desktop."))
+        self.set_authors(["Johan Svedberg <johan svedberg com>"])
+        self.set_translator_credits(_("translator-credits"))
+        self.set_license("GNU General Public License version 2")
+        # self.set_artists([""])
+
+        self.connect("response", lambda self, *args: self.destroy())
+
+    def __url_hook(self, widget, url, scheme):
+        gnome.ui.url_show_on_screen(scheme + url, widget.get_screen())
+
+# vim: set sw=4 et sts=4 tw=79 fo+=l:

Added: trunk/gget/StatusIcon.py
==============================================================================
--- (empty file)
+++ trunk/gget/StatusIcon.py	Wed Jun 11 09:56:49 2008
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2008 Johan Svedberg <johan svedberg com>
+
+# This file is part of gget.
+
+# gget 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.
+
+# gget 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 gget; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+import gtk
+
+from gget import NAME
+
+class StatusIcon:
+    def __init__(self, main_window):
+        self.main_window = main_window
+
+        self.icon = gtk.status_icon_new_from_icon_name(NAME.lower())
+
+        self.__build_context_menu()
+
+        self.__connect_widgets()
+
+    def __build_context_menu(self):
+        self.context_menu = gtk.Menu()
+
+        self.add_imi = gtk.ImageMenuItem(gtk.STOCK_ADD)
+        self.add_imi.show()
+        self.context_menu.append(self.add_imi)
+
+        separator = gtk.SeparatorMenuItem()
+        separator.show()
+        self.context_menu.append(separator)
+
+        self.quit_imi = gtk.ImageMenuItem(gtk.STOCK_QUIT)
+        self.quit_imi.show()
+        self.context_menu.append(self.quit_imi)
+
+    def __connect_widgets(self):
+        self.icon.connect("activate", self.__icon_clicked)
+        self.icon.connect("popup-menu", self.__icon_popup_menu,
+                self.context_menu)
+
+        self.quit_imi.connect("activate", self.main_window.quit)
+        self.add_imi.connect("activate", self.main_window.add_transfer)
+
+    def __icon_clicked(self, icon):
+        if self.main_window.window.get_property("visible"):
+            self.main_window.window.hide()
+        else:
+            self.main_window.window.present()
+
+    def __icon_popup_menu(self, icon, button, activate_time, menu):
+        menu.popup(None, None, gtk.status_icon_position_menu, button,
+                activate_time, icon)
+
+# vim: set sw=4 et sts=4 tw=79 fo+=l:



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