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

Proposed by Balló György
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
configure.ac (+0/-7)
main/TrayIcon.py (+8/-5)
shell/plugins/PackageInstaller/Downloader.py (+16/-10)
To merge this branch: bzr merge lp:~ballogy/gdesklets/optional-use-gconf-appindicator
Reviewer Review Type Date Requested Status
gDesklets Core Team 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.
Revision history for this message
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.

Revision history for this message
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 Balló György

Allow disable appindicator

Revision history for this message
Balló György (ballogy) wrote :

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

Revision history for this message
Balló György (ballogy) wrote :

Any decision?

Revision history for this message
sergiomb (sergio-sergiomb) wrote :

Hi, I will apply it on Fedora package . gconf it not used anymore ...

Unmerged revisions

189. By Balló György

Allow disable appindicator

188. By Balló György

Use gconf and appindicator optionally

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2011-10-19 00:50:48 +0000
+++ configure.ac 2012-03-16 14:41:19 +0000
@@ -73,13 +73,6 @@
7373
74if test x$enable_appindicator = xyes ; then74if test x$enable_appindicator = xyes ; then
75 appindicator_available=True75 appindicator_available=True
76 PKG_CHECK_EXISTS([appindicator-0.1 >= $APPINDICATOR_REQUIRED],,
77 AC_MSG_ERROR([appindicator-0.1 is not installed]))
78 PKG_CHECK_MODULES(APP_INDICATOR,
79 appindicator-0.1 >= $APPINDICATOR_REQUIRED)
80 AC_SUBST(APP_INDICATOR_CFLAGS)
81 AC_SUBST(APP_INDICATOR_LIBS)
82 AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])
83else76else
84 appindicator_available=False77 appindicator_available=False
85fi78fi
8679
=== modified file 'main/TrayIcon.py'
--- main/TrayIcon.py 2011-10-19 00:50:48 +0000
+++ main/TrayIcon.py 2012-03-16 14:41:19 +0000
@@ -4,7 +4,12 @@
4import gtk4import gtk
55
6if settings.build_time.appindicator:6if settings.build_time.appindicator:
7 import appindicator7 try:
8 import appindicator
9 except ImportError:
10 appindicator = None
11else:
12 appindicator = None
813
9class TrayIcon:14class TrayIcon:
1015
@@ -14,8 +19,7 @@
1419
15 self.__traymenu = gtk.Menu()20 self.__traymenu = gtk.Menu()
1621
17 if not settings.build_time.appindicator:22 if not appindicator:
18 # Not Ubuntu
19# self.__trayicon = gtk.status_icon_new_from_file(ICON)23# self.__trayicon = gtk.status_icon_new_from_file(ICON)
20# self.__trayicon.connect("popup-menu", self.__on_button)24# self.__trayicon.connect("popup-menu", self.__on_button)
21 self.__trayicon = gtk.StatusIcon()25 self.__trayicon = gtk.StatusIcon()
@@ -24,7 +28,6 @@
24 self.__trayicon.connect("popup-menu", self.__on_button, self.__traymenu)28 self.__trayicon.connect("popup-menu", self.__on_button, self.__traymenu)
25 self.__trayicon.set_visible(True)29 self.__trayicon.set_visible(True)
26 else:30 else:
27 # Ubuntu
28 self.__appindicator = appindicator.Indicator("gDesklets",31 self.__appindicator = appindicator.Indicator("gDesklets",
29 "gdesklets",32 "gdesklets",
30 appindicator.CATEGORY_APPLICATION_STATUS)33 appindicator.CATEGORY_APPLICATION_STATUS)
@@ -66,7 +69,7 @@
66 item.show()69 item.show()
67 self.__traymenu.append(item)70 self.__traymenu.append(item)
6871
69 if (not settings.build_time.appindicator):72 if not appindicator:
70 self.__trayicon.set_visible(True)73 self.__trayicon.set_visible(True)
71 else:74 else:
72 self.__appindicator.set_menu(self.__traymenu)75 self.__appindicator.set_menu(self.__traymenu)
7376
=== modified file 'shell/plugins/PackageInstaller/Downloader.py'
--- shell/plugins/PackageInstaller/Downloader.py 2007-06-23 18:13:19 +0000
+++ shell/plugins/PackageInstaller/Downloader.py 2012-03-16 14:41:19 +0000
@@ -61,16 +61,22 @@
6161
62 dest_fd = open(dest, "w")62 dest_fd = open(dest, "w")
6363
64 import gconf64 try:
65 client = gconf.client_get_default()65 import gconf
66 use_proxy = client.get_bool('/system/http_proxy/use_http_proxy')66 except ImportError:
67 if (use_proxy != 0):67 gconf = None
68 host = client.get_string('/system/http_proxy/host')68 if gconf:
69 port = client.get_int('/system/http_proxy/port')69 client = gconf.client_get_default()
70 if (host != ""):70 use_proxy = client.get_bool('/system/http_proxy/use_http_proxy')
71 http_proxy = "http://" + host + ':' + str(port)71 if (use_proxy != 0):
72 else:72 host = client.get_string('/system/http_proxy/host')
73 http_proxy = None73 port = client.get_int('/system/http_proxy/port')
74 if (host != ""):
75 http_proxy = "http://" + host + ':' + str(port)
76 else:
77 http_proxy = None
78 else:
79 http_proxy = None
74 else:80 else:
75 http_proxy = None81 http_proxy = None
7682

Subscribers

People subscribed via source and target branches