Merge lp:~ballogy/gdesklets/optional-use-gconf-appindicator into lp:gdesklets

Proposed by György Balló on 2012-03-04
Status: Needs review
Proposed branch: lp:~ballogy/gdesklets/optional-use-gconf-appindicator
Merge into: lp:gdesklets
Diff against target: 98 lines (+24/-22) 3 files modified
To merge this branch: bzr merge lp:~ballogy/gdesklets/optional-use-gconf-appindicator
Reviewer Review Type Date Requested Status
gDesklets Core Team 2012-03-04 Pending
Review via email: mp+95809@code.launchpad.net

Commit Message

Use gconf and appindicator optionally

Description of the Change

This change:

1. Makes it possible to use gdesklets without gconf. If gconf-python present on runtime, then gdekslets try to load proxy setting, otherwise not.

2. Instead of checking the availability of python-appindicator on build time, do it on runtime. In this case if python-appindicator installed later, then it's automatically used, otherwise the status icon shown. This patch is useful for distributions other than Ubuntu, where python-appindicator is not installed by default, but the user may installs it later.

To post a comment you must log in.
Bjoern Koch (h.humpel) wrote :

First if all: sorry for the late reply... :/.

Anyway... to me this looks pretty good and (IMHO) we could merge these changes.
But I guess we will first have to discuss this on the ML.

Ronny Lorenz (raumzeit) wrote :

I dont mind merging those changes into gdesklets. The gconf modification
seems reasonable to me but maybe we should make the optional
appindicator stuff behave differently. With the currently proposed
changes the drawback will be that during compile time one can not decide
to never ever use appindicator at all. It will be loaded and used as
soon as its modules are available during runtime...
I dont know if this is what we intend to do? It would be nice to still
be able to deactivate appindicator by all means.

Just my 2cents

Ronny

On 03/11/2012 11:09 AM, Bjoern Koch wrote:
> First if all: sorry for the late reply... :/.
>
> Anyway... to me this looks pretty good and (IMHO) we could merge these changes.
> But I guess we will first have to discuss this on the ML.

189. By György Balló on 2012-03-16

Allow disable appindicator

György Balló (ballogy) wrote :

Now I modified my patch to allow disable appindicator again, but do not fail if appindicator enabled but not installed.

György Balló (ballogy) wrote :

Any decision?

Unmerged revisions

189. By György Balló on 2012-03-16

Allow disable appindicator

188. By György Balló on 2012-03-04

Use gconf and appindicator optionally

Preview Diff

1=== modified file 'configure.ac'
2--- configure.ac 2011-10-19 00:50:48 +0000
3+++ configure.ac 2012-03-16 14:41:19 +0000
4@@ -73,13 +73,6 @@
5
6 if test x$enable_appindicator = xyes ; then
7 appindicator_available=True
8- PKG_CHECK_EXISTS([appindicator-0.1 >= $APPINDICATOR_REQUIRED],,
9- AC_MSG_ERROR([appindicator-0.1 is not installed]))
10- PKG_CHECK_MODULES(APP_INDICATOR,
11- appindicator-0.1 >= $APPINDICATOR_REQUIRED)
12- AC_SUBST(APP_INDICATOR_CFLAGS)
13- AC_SUBST(APP_INDICATOR_LIBS)
14- AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])
15 else
16 appindicator_available=False
17 fi
18
19=== modified file 'main/TrayIcon.py'
20--- main/TrayIcon.py 2011-10-19 00:50:48 +0000
21+++ main/TrayIcon.py 2012-03-16 14:41:19 +0000
22@@ -4,7 +4,12 @@
23 import gtk
24
25 if settings.build_time.appindicator:
26- import appindicator
27+ try:
28+ import appindicator
29+ except ImportError:
30+ appindicator = None
31+else:
32+ appindicator = None
33
34 class TrayIcon:
35
36@@ -14,8 +19,7 @@
37
38 self.__traymenu = gtk.Menu()
39
40- if not settings.build_time.appindicator:
41- # Not Ubuntu
42+ if not appindicator:
43 # self.__trayicon = gtk.status_icon_new_from_file(ICON)
44 # self.__trayicon.connect("popup-menu", self.__on_button)
45 self.__trayicon = gtk.StatusIcon()
46@@ -24,7 +28,6 @@
47 self.__trayicon.connect("popup-menu", self.__on_button, self.__traymenu)
48 self.__trayicon.set_visible(True)
49 else:
50- # Ubuntu
51 self.__appindicator = appindicator.Indicator("gDesklets",
52 "gdesklets",
53 appindicator.CATEGORY_APPLICATION_STATUS)
54@@ -66,7 +69,7 @@
55 item.show()
56 self.__traymenu.append(item)
57
58- if (not settings.build_time.appindicator):
59+ if not appindicator:
60 self.__trayicon.set_visible(True)
61 else:
62 self.__appindicator.set_menu(self.__traymenu)
63
64=== modified file 'shell/plugins/PackageInstaller/Downloader.py'
65--- shell/plugins/PackageInstaller/Downloader.py 2007-06-23 18:13:19 +0000
66+++ shell/plugins/PackageInstaller/Downloader.py 2012-03-16 14:41:19 +0000
67@@ -61,16 +61,22 @@
68
69 dest_fd = open(dest, "w")
70
71- import gconf
72- client = gconf.client_get_default()
73- use_proxy = client.get_bool('/system/http_proxy/use_http_proxy')
74- if (use_proxy != 0):
75- host = client.get_string('/system/http_proxy/host')
76- port = client.get_int('/system/http_proxy/port')
77- if (host != ""):
78- http_proxy = "http://" + host + ':' + str(port)
79- else:
80- http_proxy = None
81+ try:
82+ import gconf
83+ except ImportError:
84+ gconf = None
85+ if gconf:
86+ client = gconf.client_get_default()
87+ use_proxy = client.get_bool('/system/http_proxy/use_http_proxy')
88+ if (use_proxy != 0):
89+ host = client.get_string('/system/http_proxy/host')
90+ port = client.get_int('/system/http_proxy/port')
91+ if (host != ""):
92+ http_proxy = "http://" + host + ':' + str(port)
93+ else:
94+ http_proxy = None
95+ else:
96+ http_proxy = None
97 else:
98 http_proxy = None
99

Subscribers

People subscribed via source and target branches