Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
FUSS
fuss-software
Commits
ffb12a5d
Commit
ffb12a5d
authored
Jul 07, 2014
by
Christopher R. Gabriel
Browse files
fuss-app-indicator now show a link to webpasswd, if installed on a configured fuss-client
parent
32f747fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
debian/changelog
View file @
ffb12a5d
fuss-software (6.0.18.1fuss1) precise; urgency=medium
* fuss app indicator links to webpasswd if is installed on a fuss-client
-- Christopher R. Gabriel <cgabriel@truelite.it> Mon, 07 Jul 2014 10:57:44 +0200
fuss-software (6.0.17.1fuss1) precise; urgency=low
* Added web resources to indicators
...
...
fuss-app-indicator
View file @
ffb12a5d
...
...
@@ -2,7 +2,7 @@
#
# File: fuss-app-indicator
#
# Copyright (C) 2012 Christopher R. Gabriel <cgabriel@truelite.it>
# Copyright (C) 2012
-2014
Christopher R. Gabriel <cgabriel@truelite.it>
#
# Based on
# ClassicMenu Indicator - an indicator applet for Unity, that
...
...
@@ -26,6 +26,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
sys
import
os.path
import
ConfigParser
import
gmenu
import
gtk
,
glib
,
gobject
import
appindicator
...
...
@@ -53,6 +55,8 @@ resources = (
(
'http://didattica.fuss.bz.it/'
,
'Didattica'
)
)
FUSS_CLIENT_CONF
=
"/etc/fuss-client/server.conf"
class
FussAppIndicator
(
object
):
def
__init__
(
self
,
menu_name
):
self
.
indicator
=
appindicator
.
Indicator
(
'fuss-app-indicator-%s'
%
menu_name
,
...
...
@@ -61,12 +65,22 @@ class FussAppIndicator(object):
self
.
icon_size
=
22
self
.
update_requested
=
False
self
.
indicator
.
set_status
(
appindicator
.
STATUS_ACTIVE
)
self
.
server_url
=
self
.
discover_server
()
self
.
trees
=
[]
tree
=
self
.
create_tree
(
'fuss-%s.menu'
%
menu_name
)
self
.
trees
.
append
(
tree
)
self
.
indicator
.
set_menu
(
self
.
create_menu
())
def
discover_server
(
self
):
if
os
.
path
.
isfile
(
FUSS_CLIENT_CONF
):
from
ConfigParser
import
ConfigParser
c
=
ConfigParser
()
c
.
read
(
FUSS_CLIENT_CONF
)
if
c
.
has_option
(
"Server"
,
"address"
):
url
=
c
.
get
(
"Server"
,
"address"
)
return
"http://%s/webpasswd"
%
url
return
None
def
run
(
self
):
try
:
gtk
.
main
()
...
...
@@ -159,6 +173,9 @@ class FussAppIndicator(object):
def
open_url
(
self
,
obj
,
url
):
webbrowser
.
open
(
url
)
def
on_menuitem_change_password
(
self
,
menuitem
):
webbrowser
.
open
(
self
.
server_url
)
def
create_menu
(
self
):
menu
=
gtk
.
Menu
()
...
...
@@ -172,13 +189,24 @@ class FussAppIndicator(object):
menu_item
=
gtk
.
MenuItem
(
'%s'
%
APP_NAME
)
menu
.
append
(
menu_item
)
submenu
=
gtk
.
Menu
()
menu_item
.
set_submenu
(
submenu
)
#menu_item = gtk.SeparatorMenuItem()
#submenu.append(menu_item)
# password
if
self
.
server_url
:
menu_item
=
gtk
.
SeparatorMenuItem
()
menu
.
append
(
menu_item
)
menu_item
=
gtk
.
MenuItem
(
"Cambia Password"
)
menu_item
.
connect
(
'activate'
,
self
.
on_menuitem_change_password
)
menu
.
append
(
menu_item
)
menu_item
=
gtk
.
SeparatorMenuItem
()
menu
.
append
(
menu_item
)
resource_menu_item
=
gtk
.
MenuItem
(
'Risorse'
)
menu
.
append
(
resource_menu_item
)
resource_menu
=
gtk
.
Menu
()
...
...
@@ -188,7 +216,8 @@ class FussAppIndicator(object):
r_item
=
gtk
.
MenuItem
(
r
[
1
])
resource_menu
.
append
(
r_item
)
r_item
.
connect
(
'activate'
,
self
.
open_url
,
r
[
0
])
menu_item
=
gtk
.
ImageMenuItem
(
gtk
.
STOCK_ABOUT
)
menu_item
.
connect
(
'activate'
,
self
.
on_menuitem_about_activate
)
submenu
.
append
(
menu_item
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment