Merge lp:~noskcaj/ubuntu/wily/redshift/merge2 into lp:ubuntu/wily/redshift

Proposed by Jackson Doak on 2015-10-14
Status: Merged
Approved by: Michael Terry on 2015-10-14
Approved revision: 22
Merge reported by: Michael Terry
Merged at revision: not available
Proposed branch: lp:~noskcaj/ubuntu/wily/redshift/merge2
Merge into: lp:ubuntu/wily/redshift
Diff against target: 1046 lines (+108/-795)
16 files modified
.pc/applied-patches (+0/-2)
.pc/remove_autostart.patch/src/redshift-gtk/statusicon.py (+0/-520)
.pc/retry-geoclue.patch/src/location-geoclue.c (+0/-217)
debian/README.Debian (+0/-24)
debian/changelog (+36/-0)
debian/control (+1/-1)
debian/gbp.conf (+2/-0)
debian/patches/add-desktop-file.patch (+34/-0)
debian/patches/retry-geoclue.patch (+8/-6)
debian/patches/series (+1/-1)
debian/redshift-gtk.docs (+0/-1)
debian/redshift-gtk.install (+2/-1)
debian/redshift.install (+1/-0)
debian/rules (+3/-2)
src/location-geoclue.c (+8/-20)
src/redshift-gtk/statusicon.py (+12/-0)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/wily/redshift/merge2
Reviewer Review Type Date Requested Status
Michael Terry 2015-10-14 Approve on 2015-10-14
Review via email: mp+274448@code.launchpad.net

Description of the change

Merge from debian. package is currently broken in wily, this merge is required for it to work as intended

To post a comment you must log in.
Michael Terry (mterry) wrote :

Looks good, thanks! Uploaded to wily.

review: Approve
Michael Terry (mterry) wrote :

Only change was I also fixed the typo in the changelog (rues to rules)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '.pc/applied-patches'
2--- .pc/applied-patches 2014-11-01 17:06:15 +0000
3+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
4@@ -1,2 +0,0 @@
5-remove_autostart.patch
6-retry-geoclue.patch
7
8=== removed directory '.pc/remove_autostart.patch'
9=== removed directory '.pc/remove_autostart.patch/src'
10=== removed directory '.pc/remove_autostart.patch/src/redshift-gtk'
11=== removed file '.pc/remove_autostart.patch/src/redshift-gtk/statusicon.py'
12--- .pc/remove_autostart.patch/src/redshift-gtk/statusicon.py 2015-05-24 16:48:08 +0000
13+++ .pc/remove_autostart.patch/src/redshift-gtk/statusicon.py 1970-01-01 00:00:00 +0000
14@@ -1,520 +0,0 @@
15-# statusicon.py -- GUI status icon source
16-# This file is part of Redshift.
17-
18-# Redshift is free software: you can redistribute it and/or modify
19-# it under the terms of the GNU General Public License as published by
20-# the Free Software Foundation, either version 3 of the License, or
21-# (at your option) any later version.
22-
23-# Redshift is distributed in the hope that it will be useful,
24-# but WITHOUT ANY WARRANTY; without even the implied warranty of
25-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26-# GNU General Public License for more details.
27-
28-# You should have received a copy of the GNU General Public License
29-# along with Redshift. If not, see <http://www.gnu.org/licenses/>.
30-
31-# Copyright (c) 2013-2014 Jon Lund Steffensen <jonlst@gmail.com>
32-
33-
34-'''GUI status icon for Redshift.
35-
36-The run method will try to start an appindicator for Redshift. If the
37-appindicator module isn't present it will fall back to a GTK status icon.
38-'''
39-
40-import sys, os
41-import fcntl
42-import signal
43-import re
44-import gettext
45-
46-from gi.repository import Gtk, GLib, GObject
47-
48-try:
49- from gi.repository import AppIndicator3 as appindicator
50-except ImportError:
51- appindicator = None
52-
53-from . import defs
54-from . import utils
55-
56-_ = gettext.gettext
57-
58-
59-class RedshiftController(GObject.GObject):
60- '''A GObject wrapper around the child process'''
61-
62- __gsignals__ = {
63- 'inhibit-changed': (GObject.SIGNAL_RUN_FIRST, None, (bool,)),
64- 'temperature-changed': (GObject.SIGNAL_RUN_FIRST, None, (int,)),
65- 'period-changed': (GObject.SIGNAL_RUN_FIRST, None, (str,)),
66- 'location-changed': (GObject.SIGNAL_RUN_FIRST, None, (float, float)),
67- 'error-occured': (GObject.SIGNAL_RUN_FIRST, None, (str,))
68- }
69-
70- def __init__(self, args):
71- '''Initialize controller and start child process
72-
73- The parameter args is a list of command line arguments to pass on to
74- the child process. The "-v" argument is automatically added.'''
75-
76- GObject.GObject.__init__(self)
77-
78- # Initialize state variables
79- self._inhibited = False
80- self._temperature = 0
81- self._period = 'Unknown'
82- self._location = (0.0, 0.0)
83-
84- # Start redshift with arguments
85- args.insert(0, os.path.join(defs.BINDIR, 'redshift'))
86- if '-v' not in args:
87- args.insert(1, '-v')
88-
89- # Start child process with C locale so we can parse the output
90- env = os.environ.copy()
91- env['LANG'] = env['LANGUAGE'] = env['LC_ALL'] = env['LC_MESSAGES'] = 'C'
92- self._process = GLib.spawn_async(args, envp=['{}={}'.format(k,v) for k, v in env.items()],
93- flags=GLib.SPAWN_DO_NOT_REAP_CHILD,
94- standard_output=True, standard_error=True)
95-
96- # Wrap remaining contructor in try..except to avoid that the child
97- # process is not closed properly.
98- try:
99- # Handle child input
100- # The buffer is encapsulated in a class so we
101- # can pass an instance to the child callback.
102- class InputBuffer(object):
103- buf = ''
104-
105- self._input_buffer = InputBuffer()
106- self._error_buffer = InputBuffer()
107- self._errors = ''
108-
109- # Set non blocking
110- fcntl.fcntl(self._process[2], fcntl.F_SETFL,
111- fcntl.fcntl(self._process[2], fcntl.F_GETFL) | os.O_NONBLOCK)
112-
113- # Add watch on child process
114- GLib.child_watch_add(GLib.PRIORITY_DEFAULT, self._process[0], self._child_cb)
115- GLib.io_add_watch(self._process[2], GLib.PRIORITY_DEFAULT, GLib.IO_IN,
116- self._child_data_cb, (True, self._input_buffer))
117- GLib.io_add_watch(self._process[3], GLib.PRIORITY_DEFAULT, GLib.IO_IN,
118- self._child_data_cb, (False, self._error_buffer))
119-
120- # Signal handler to relay USR1 signal to redshift process
121- def relay_signal_handler(signal):
122- os.kill(self._process[0], signal)
123- return True
124-
125- GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGUSR1,
126- relay_signal_handler, signal.SIGUSR1)
127- except:
128- self.termwait()
129- raise
130-
131- @property
132- def inhibited(self):
133- '''Current inhibition state'''
134- return self._inhibited
135-
136- @property
137- def temperature(self):
138- '''Current screen temperature'''
139- return self._temperature
140-
141- @property
142- def period(self):
143- '''Current period of day'''
144- return self._period
145-
146- @property
147- def location(self):
148- '''Current location'''
149- return self._location
150-
151- def set_inhibit(self, inhibit):
152- '''Set inhibition state'''
153- if inhibit != self._inhibited:
154- self._child_toggle_inhibit()
155-
156- def _child_toggle_inhibit(self):
157- '''Sends a request to the child process to toggle state'''
158- os.kill(self._process[0], signal.SIGUSR1)
159-
160- def _child_cb(self, pid, status, data=None):
161- '''Called when the child process exists'''
162-
163- # Empty stdout and stderr
164- for f in (self._process[2], self._process[3]):
165- while True:
166- buf = os.read(f, 256).decode('utf-8')
167- if buf == '':
168- break
169- if f == self._process[3]: # stderr
170- self._errors += buf
171-
172- # Check exit status of child
173- report_errors = False
174- try:
175- GLib.spawn_check_exit_status(status)
176- Gtk.main_quit()
177- except GLib.GError:
178- report_errors = True
179-
180- if report_errors:
181- self.emit('error-occured', self._errors)
182-
183- def _child_key_change_cb(self, key, value):
184- '''Called when the child process reports a change of internal state'''
185-
186- def parse_coord(s):
187- '''Parse coordinate like `42.0 N` or `91.5 W`'''
188- v, d = s.split(' ')
189- return float(v) * (1 if d in 'NE' else -1)
190-
191- if key == 'Status':
192- new_inhibited = value != 'Enabled'
193- if new_inhibited != self._inhibited:
194- self._inhibited = new_inhibited
195- self.emit('inhibit-changed', new_inhibited)
196- elif key == 'Color temperature':
197- new_temperature = int(value.rstrip('K'), 10)
198- if new_temperature != self._temperature:
199- self._temperature = new_temperature
200- self.emit('temperature-changed', new_temperature)
201- elif key == 'Period':
202- new_period = value
203- if new_period != self._period:
204- self._period = new_period
205- self.emit('period-changed', new_period)
206- elif key == 'Location':
207- new_location = tuple(parse_coord(x) for x in value.split(', '))
208- if new_location != self._location:
209- self._location = new_location
210- self.emit('location-changed', *new_location)
211-
212- def _child_stdout_line_cb(self, line):
213- '''Called when the child process outputs a line to stdout'''
214- if line:
215- m = re.match(r'([\w ]+): (.+)', line)
216- if m:
217- key = m.group(1)
218- value = m.group(2)
219- self._child_key_change_cb(key, value)
220-
221- def _child_data_cb(self, f, cond, data):
222- '''Called when the child process has new data on stdout/stderr'''
223-
224- stdout, ib = data
225- ib.buf += os.read(f, 256).decode('utf-8')
226-
227- # Split input at line break
228- while True:
229- first, sep, last = ib.buf.partition('\n')
230- if sep == '':
231- break
232- ib.buf = last
233- if stdout:
234- self._child_stdout_line_cb(first)
235- else:
236- self._errors += first + '\n'
237-
238- return True
239-
240- def termwait(self):
241- '''Send SIGINT and wait for the child process to quit'''
242- try:
243- os.kill(self._process[0], signal.SIGINT)
244- os.waitpid(self._process[0], 0)
245- except ProcessLookupError:
246- # Process has apparently already disappeared
247- pass
248-
249-
250-class RedshiftStatusIcon(object):
251- '''The status icon tracking the RedshiftController'''
252-
253- def __init__(self, controller):
254- '''Creates a new instance of the status icon'''
255-
256- self._controller = controller
257-
258- if appindicator:
259- # Create indicator
260- self.indicator = appindicator.Indicator.new('redshift',
261- 'redshift-status-on',
262- appindicator.IndicatorCategory.APPLICATION_STATUS)
263- self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
264- else:
265- # Create status icon
266- self.status_icon = Gtk.StatusIcon()
267- self.status_icon.set_from_icon_name('redshift-status-on')
268- self.status_icon.set_tooltip_text('Redshift')
269-
270- # Create popup menu
271- self.status_menu = Gtk.Menu()
272-
273- # Add toggle action
274- self.toggle_item = Gtk.CheckMenuItem.new_with_label(_('Enabled'))
275- self.toggle_item.connect('activate', self.toggle_item_cb)
276- self.status_menu.append(self.toggle_item)
277-
278- # Add suspend menu
279- suspend_menu_item = Gtk.MenuItem.new_with_label(_('Suspend for'))
280- suspend_menu = Gtk.Menu()
281- for minutes, label in [(30, _('30 minutes')),
282- (60, _('1 hour')),
283- (120, _('2 hours'))]:
284- suspend_item = Gtk.MenuItem.new_with_label(label)
285- suspend_item.connect('activate', self.suspend_cb, minutes)
286- suspend_menu.append(suspend_item)
287- suspend_menu_item.set_submenu(suspend_menu)
288- self.status_menu.append(suspend_menu_item)
289-
290- # Add autostart option
291- autostart_item = Gtk.CheckMenuItem.new_with_label(_('Autostart'))
292- try:
293- autostart_item.set_active(utils.get_autostart())
294- except IOError as strerror:
295- print(strerror)
296- autostart_item.set_property('sensitive', False)
297- else:
298- autostart_item.connect('toggled', self.autostart_cb)
299- finally:
300- self.status_menu.append(autostart_item)
301-
302- # Add info action
303- info_item = Gtk.MenuItem.new_with_label(_('Info'))
304- info_item.connect('activate', self.show_info_cb)
305- self.status_menu.append(info_item)
306-
307- # Add quit action
308- quit_item = Gtk.ImageMenuItem.new_with_label(_('Quit'))
309- quit_item.connect('activate', self.destroy_cb)
310- self.status_menu.append(quit_item)
311-
312- # Create info dialog
313- self.info_dialog = Gtk.Dialog()
314- self.info_dialog.set_title(_('Info'))
315- self.info_dialog.add_button(_('Close'), Gtk.ButtonsType.CLOSE)
316- self.info_dialog.set_resizable(False)
317- self.info_dialog.set_property('border-width', 6)
318-
319- self.status_label = Gtk.Label()
320- self.status_label.set_alignment(0.0, 0.5)
321- self.status_label.set_padding(6, 6)
322- self.info_dialog.get_content_area().pack_start(self.status_label, True, True, 0)
323- self.status_label.show()
324-
325- self.location_label = Gtk.Label()
326- self.location_label.set_alignment(0.0, 0.5)
327- self.location_label.set_padding(6, 6)
328- self.info_dialog.get_content_area().pack_start(self.location_label, True, True, 0)
329- self.location_label.show()
330-
331- self.temperature_label = Gtk.Label()
332- self.temperature_label.set_alignment(0.0, 0.5)
333- self.temperature_label.set_padding(6, 6)
334- self.info_dialog.get_content_area().pack_start(self.temperature_label, True, True, 0)
335- self.temperature_label.show()
336-
337- self.period_label = Gtk.Label()
338- self.period_label.set_alignment(0.0, 0.5)
339- self.period_label.set_padding(6, 6)
340- self.info_dialog.get_content_area().pack_start(self.period_label, True, True, 0)
341- self.period_label.show()
342-
343- self.info_dialog.connect('response', self.response_info_cb)
344-
345- # Setup signals to property changes
346- self._controller.connect('inhibit-changed', self.inhibit_change_cb)
347- self._controller.connect('period-changed', self.period_change_cb)
348- self._controller.connect('temperature-changed', self.temperature_change_cb)
349- self._controller.connect('location-changed', self.location_change_cb)
350- self._controller.connect('error-occured', self.error_occured_cb)
351-
352- # Set info box text
353- self.change_inhibited(self._controller.inhibited)
354- self.change_period(self._controller.period)
355- self.change_temperature(self._controller.temperature)
356- self.change_location(self._controller.location)
357-
358- if appindicator:
359- self.status_menu.show_all()
360-
361- # Set the menu
362- self.indicator.set_menu(self.status_menu)
363- else:
364- # Connect signals for status icon and show
365- self.status_icon.connect('activate', self.toggle_cb)
366- self.status_icon.connect('popup-menu', self.popup_menu_cb)
367- self.status_icon.set_visible(True)
368-
369- # Initialize suspend timer
370- self.suspend_timer = None
371-
372- def remove_suspend_timer(self):
373- '''Disable any previously set suspend timer'''
374- if self.suspend_timer is not None:
375- GLib.source_remove(self.suspend_timer)
376- self.suspend_timer = None
377-
378- def suspend_cb(self, item, minutes):
379- '''Callback that handles activation of a suspend timer
380-
381- The minutes parameter is the number of minutes to suspend. Even if redshift
382- is not disabled when called, it will still set a suspend timer and
383- reactive redshift when the timer is up.'''
384-
385- # Inhibit
386- self._controller.set_inhibit(True)
387-
388- # If "suspend" is clicked while redshift is disabled, we reenable
389- # it after the last selected timespan is over.
390- self.remove_suspend_timer()
391-
392- # If redshift was already disabled we reenable it nonetheless.
393- self.suspend_timer = GLib.timeout_add_seconds(minutes * 60, self.reenable_cb)
394-
395- def reenable_cb(self):
396- '''Callback to reenable redshift when a suspend timer expires'''
397- self._controller.set_inhibit(False)
398-
399- def popup_menu_cb(self, widget, button, time, data=None):
400- '''Callback when the popup menu on the status icon has to open'''
401- self.status_menu.show_all()
402- self.status_menu.popup(None, None, Gtk.StatusIcon.position_menu,
403- self.status_icon, button, time)
404-
405- def toggle_cb(self, widget, data=None):
406- '''Callback when a request to toggle redshift was made'''
407- self.remove_suspend_timer()
408- self._controller.set_inhibit(not self._controller.inhibited)
409-
410- def toggle_item_cb(self, widget, data=None):
411- '''Callback then a request to toggle redshift was made from a toggle item
412-
413- This ensures that the state of redshift is synchronised with
414- the toggle state of the widget (e.g. Gtk.CheckMenuItem).'''
415-
416- active = not self._controller.inhibited
417- if active != widget.get_active():
418- self.remove_suspend_timer()
419- self._controller.set_inhibit(not self._controller.inhibited)
420-
421- # Info dialog callbacks
422- def show_info_cb(self, widget, data=None):
423- '''Callback when the info dialog should be presented'''
424- self.info_dialog.show()
425-
426- def response_info_cb(self, widget, data=None):
427- '''Callback when a button in the info dialog was activated'''
428- self.info_dialog.hide()
429-
430- def update_status_icon(self):
431- '''Update the status icon according to the internally recorded state
432-
433- This should be called whenever the internally recorded state
434- might have changed.'''
435-
436- # Update status icon
437- if appindicator:
438- if not self._controller.inhibited:
439- self.indicator.set_icon('redshift-status-on')
440- else:
441- self.indicator.set_icon('redshift-status-off')
442- else:
443- if not self._controller.inhibited:
444- self.status_icon.set_from_icon_name('redshift-status-on')
445- else:
446- self.status_icon.set_from_icon_name('redshift-status-off')
447-
448- # State update functions
449- def inhibit_change_cb(self, controller, inhibit):
450- '''Callback when controller changes inhibition status'''
451- self.change_inhibited(inhibit)
452-
453- def period_change_cb(self, controller, period):
454- '''Callback when controller changes period'''
455- self.change_period(period)
456-
457- def temperature_change_cb(self, controller, temperature):
458- '''Callback when controller changes temperature'''
459- self.change_temperature(temperature)
460-
461- def location_change_cb(self, controller, lat, lon):
462- '''Callback when controlled changes location'''
463- self.change_location((lat, lon))
464-
465- def error_occured_cb(self, controller, error):
466- '''Callback when an error occurs in the controller'''
467- error_dialog = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR,
468- Gtk.ButtonsType.CLOSE, '')
469- error_dialog.set_markup('<b>Failed to run Redshift</b>\n<i>' + error + '</i>')
470- error_dialog.run()
471-
472- # Quit when the model dialog is closed
473- sys.exit(-1)
474-
475- # Update interface
476- def change_inhibited(self, inhibited):
477- '''Change interface to new inhibition status'''
478- self.update_status_icon()
479- self.toggle_item.set_active(not inhibited)
480- self.status_label.set_markup(_('<b>Status:</b> {}').format(_('Disabled') if inhibited else _('Enabled')))
481-
482- def change_temperature(self, temperature):
483- '''Change interface to new temperature'''
484- self.temperature_label.set_markup('<b>{}:</b> {}K'.format(_('Color temperature'), temperature))
485-
486- def change_period(self, period):
487- '''Change interface to new period'''
488- self.period_label.set_markup('<b>{}:</b> {}'.format(_('Period'), period))
489-
490- def change_location(self, location):
491- '''Change interface to new location'''
492- self.location_label.set_markup('<b>{}:</b> {}, {}'.format(_('Location'), *location))
493-
494-
495- def autostart_cb(self, widget, data=None):
496- '''Callback when a request to toggle autostart is made'''
497- utils.set_autostart(widget.get_active())
498-
499- def destroy_cb(self, widget, data=None):
500- '''Callback when a request to quit the application is made'''
501- if not appindicator:
502- self.status_icon.set_visible(False)
503- Gtk.main_quit()
504- return False
505-
506-
507-def sigterm_handler(data=None):
508- sys.exit(0)
509-
510-
511-def run():
512- utils.setproctitle('redshift-gtk')
513-
514- # Install TERM signal handler
515- GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGTERM,
516- sigterm_handler, None)
517- GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT,
518- sigterm_handler, None)
519-
520- # Internationalisation
521- gettext.bindtextdomain('redshift', defs.LOCALEDIR)
522- gettext.textdomain('redshift')
523-
524- # Create redshift child process controller
525- c = RedshiftController(sys.argv[1:])
526- try:
527- # Create status icon
528- s = RedshiftStatusIcon(c)
529-
530- # Run main loop
531- Gtk.main()
532- finally:
533- # Always make sure that the child process is closed
534- c.termwait()
535
536=== removed directory '.pc/retry-geoclue.patch'
537=== removed directory '.pc/retry-geoclue.patch/src'
538=== removed file '.pc/retry-geoclue.patch/src/location-geoclue.c'
539--- .pc/retry-geoclue.patch/src/location-geoclue.c 2015-06-28 09:25:43 +0000
540+++ .pc/retry-geoclue.patch/src/location-geoclue.c 1970-01-01 00:00:00 +0000
541@@ -1,217 +0,0 @@
542-/* location-geoclue.c -- Geoclue location provider source
543- This file is part of Redshift.
544-
545- Redshift is free software: you can redistribute it and/or modify
546- it under the terms of the GNU General Public License as published by
547- the Free Software Foundation, either version 3 of the License, or
548- (at your option) any later version.
549-
550- Redshift is distributed in the hope that it will be useful,
551- but WITHOUT ANY WARRANTY; without even the implied warranty of
552- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
553- GNU General Public License for more details.
554-
555- You should have received a copy of the GNU General Public License
556- along with Redshift. If not, see <http://www.gnu.org/licenses/>.
557-
558- Copyright (c) 2010 Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com>
559-*/
560-
561-#include <stdio.h>
562-#include <stdlib.h>
563-#include <string.h>
564-
565-#include <geoclue/geoclue-master.h>
566-#include <geoclue/geoclue-position.h>
567-
568-#include <glib.h>
569-#include <glib-object.h>
570-
571-#include "location-geoclue.h"
572-
573-#ifdef ENABLE_NLS
574-# include <libintl.h>
575-# define _(s) gettext(s)
576-#else
577-# define _(s) s
578-#endif
579-
580-#define DEFAULT_PROVIDER "org.freedesktop.Geoclue.Providers.UbuntuGeoIP"
581-#define DEFAULT_PROVIDER_PATH "/org/freedesktop/Geoclue/Providers/UbuntuGeoIP"
582-
583-int
584-location_geoclue_init(location_geoclue_state_t *state)
585-{
586-#if !GLIB_CHECK_VERSION(2, 35, 0)
587- g_type_init();
588-#endif
589-
590- state->position = NULL;
591- state->provider = NULL;
592- state->provider_path = NULL;
593-
594- return 0;
595-}
596-
597-int
598-location_geoclue_start(location_geoclue_state_t *state)
599-{
600- if (state->provider && state->provider_path) {
601- state->position = geoclue_position_new(state->provider,
602- state->provider_path);
603- } else {
604- if (getenv("DISPLAY") == NULL || *getenv("DISPLAY") == '\0') {
605- /* TODO This (hack) should be removed when GeoClue has been patched. */
606- putenv("DISPLAY=:0");
607- }
608- GError *error = NULL;
609- GeoclueMaster *master = geoclue_master_get_default();
610- GeoclueMasterClient *client = geoclue_master_create_client(master,
611- NULL, &error);
612- g_object_unref(master);
613-
614- if (client == NULL) {
615- if (error != NULL) {
616- g_printerr(_("Unable to obtain master client: %s\n"),
617- error->message);
618- g_error_free(error);
619- } else {
620- g_printerr(_("Unable to obtain master client\n"));
621- }
622- return -1;
623- }
624-
625- if (!geoclue_master_client_set_requirements(client,
626- GEOCLUE_ACCURACY_LEVEL_REGION,
627- 0, FALSE,
628- GEOCLUE_RESOURCE_NETWORK,
629- &error)) {
630- if (error != NULL) {
631- g_printerr(_("Can't set requirements for master: %s\n"),
632- error->message);
633- g_error_free(error);
634- } else {
635- g_printerr(_("Can't set requirements for master\n"));
636- }
637- g_object_unref(client);
638-
639- return -1;
640- }
641-
642- state->position = geoclue_master_client_create_position(client, NULL);
643-
644- g_object_unref(client);
645- }
646-
647- gchar *name = NULL;
648-
649- if (geoclue_provider_get_provider_info(GEOCLUE_PROVIDER(state->position),
650- &name, NULL, NULL)) {
651- fprintf(stdout, _("Started Geoclue provider `%s'.\n"), name);
652- g_free(name);
653- } else {
654- fputs(_("Could not find a usable Geoclue provider.\n"), stderr);
655- fputs(_("Try setting name and path to specify which to use.\n"), stderr);
656- return -1;
657- }
658-
659- return 0;
660-}
661-
662-void
663-location_geoclue_free(location_geoclue_state_t *state)
664-{
665- if (state->position != NULL) g_object_unref(state->position);
666- if (state->provider != NULL) free(state->provider);
667- if (state->provider_path != NULL) free(state->provider_path);
668-}
669-
670-void
671-location_geoclue_print_help(FILE *f)
672-{
673- fputs(_("Use the location as discovered by a Geoclue provider.\n"), f);
674- fputs("\n", f);
675-
676- /* TRANSLATORS: Geoclue help output
677- left column must not be translated */
678- fputs(_(" name=N\tName of Geoclue provider (or `default')\n"
679- " path=N\tPath of Geoclue provider (or `default')\n"), f);
680- fputs("\n", f);
681- fprintf(f, _("NOTE: currently Redshift doesn't recheck %s once started,\n"
682- "which means it has to be restarted to take notice after travel.\n"),
683- "GeoClue");
684- fputs("\n", f);
685-}
686-
687-int
688-location_geoclue_set_option(location_geoclue_state_t *state,
689- const char *key, const char *value)
690-{
691- const char *provider = NULL;
692- const char *path = NULL;
693-
694- /* Parse string value */
695- if (strcasecmp(key, "name") == 0) {
696- if (strcasecmp(value, "default") == 0) {
697- provider = DEFAULT_PROVIDER;
698- } else {
699- provider = value;
700- }
701-
702- state->provider = strdup(provider);
703- if (state->provider == NULL) {
704- perror("strdup");
705- return -1;
706- }
707- } else if (strcasecmp(key, "path") == 0) {
708- if (value != NULL && strcasecmp(value, "default") == 0) {
709- path = DEFAULT_PROVIDER_PATH;
710- } else {
711- path = value;
712- }
713-
714- state->provider_path = strdup(path);
715- if (state->provider_path == NULL) {
716- perror("strdup");
717- return -1;
718- }
719- } else {
720- fprintf(stderr, _("Unknown method parameter: `%s'.\n"), key);
721- return -1;
722- }
723-
724- return 0;
725-}
726-
727-int
728-location_geoclue_get_location(location_geoclue_state_t *state,
729- float *lat, float *lon)
730-{
731- GeocluePositionFields fields;
732- GError *error = NULL;
733- double latitude = 0, longitude = 0;
734-
735- fields = geoclue_position_get_position(state->position, NULL,
736- &latitude, &longitude, NULL,
737- NULL, &error);
738- if (error) {
739- g_printerr(_("Could not get location: %s.\n"), error->message);
740- g_error_free(error);
741- return -1;
742- }
743-
744- if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
745- fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
746- fprintf(stdout, _("According to the geoclue provider"
747- " we're at: %.2f, %.2f\n"),
748- latitude, longitude);
749- } else {
750- g_warning(_("Provider does not have a valid location available."));
751- return -1;
752- }
753-
754- *lat = latitude;
755- *lon = longitude;
756-
757- return 0;
758-}
759
760=== removed file 'debian/README.Debian'
761--- debian/README.Debian 2015-05-26 14:55:19 +0000
762+++ debian/README.Debian 1970-01-01 00:00:00 +0000
763@@ -1,24 +0,0 @@
764-Geoclue 2
765----------
766-
767-Starting with version 1.10, redshift has support for Geoclue 2.
768-By default, geoclue will not allow access to redshift.
769-
770-To make geoclue accept requests from redshift, add the following to
771-/etc/geoclue/geoclue.conf
772-
773-[redshift]
774-allowed=true
775-system=false
776-users=
777-
778-
779-Autostart of gtk-redshift
780--------------------------
781-
782-Autostart was removed from Debian package because of violation of 'Desktop Application
783-Autostart Specification' (see bug #619699). If you want gtk-redshift autostarted please
784-configure this in your specific desktop environment (e.g. by placing
785-/usr/share/applications/gtk-redshift.desktop in
786-$HOME/$XDG_CONFIG_HOME/autostart/
787-(usually defaults to $HOME/.config/autostart).
788
789=== modified file 'debian/changelog'
790--- debian/changelog 2015-06-28 09:25:43 +0000
791+++ debian/changelog 2015-10-14 19:20:52 +0000
792@@ -1,3 +1,39 @@
793+redshift (1.10-5ubuntu1) wily; urgency=medium
794+
795+ * Merge from Debian. (LP: #1485153) Remaining changes:
796+ - debian/rues: Add --enable-ubuntu
797+ - debian/patches/retry-geoclue.patch: Retry geoclue a few times so
798+ redshift does not explode at startup.
799+
800+ -- Jackson Doak <noskcaj@ubuntu.com> Thu, 15 Oct 2015 06:10:29 +1100
801+
802+redshift (1.10-5) unstable; urgency=medium
803+
804+ * [8a88246] Add some changes from Laurent Bigonville
805+ * [ca45b49] Drop README.Debian
806+ * [4b34f2c] Add header to quilt patch
807+ * [9e854c4] Add debian/gbp.conf
808+
809+ -- Ritesh Raj Sarraf <rrs@debian.org> Thu, 27 Aug 2015 17:05:00 +0530
810+
811+redshift (1.10-4) unstable; urgency=medium
812+
813+ * [c3cdd0e] Drop patch remove_autostart.patch (Closes: #791598)
814+ * [47e94ba] Ship appdata file in redshift-gtk.
815+ Thanks to Laurent Bigonville (Closes: #791600)
816+ * [3a6b76d] Fix reference to correct name.
817+ Thanks to Torquil Macdonal Sorensen (Closes: #795502)
818+ * [26605bd] Add redshift.desktop file entry. Needed for GeoClue activation.
819+ Thanks to Laurent Bigonville (Closes: #789883)
820+ * [536ef7e] Add dh-autoreconf to build. Drop autotools_dev from build.
821+ Call intltoolize to update po/ files
822+ * [4983734] Ship redshift.desktop file
823+ * [a1397f2] Add configure flag for systemd user unit dir
824+ * [fb6fb18] Add redshift-gtk.desktop file that got dropped off mistakenly
825+ in the redshift.desktop patch
826+
827+ -- Ritesh Raj Sarraf <rrs@debian.org> Sat, 15 Aug 2015 16:46:00 +0200
828+
829 redshift (1.10-3ubuntu1) wily; urgency=medium
830
831 * Merge from Debian. Remaining changes:
832
833=== modified file 'debian/control'
834--- debian/control 2015-06-28 09:25:43 +0000
835+++ debian/control 2015-10-14 19:20:52 +0000
836@@ -4,7 +4,7 @@
837 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
838 XSBC-Original-Maintainer: Ritesh Raj Sarraf <rrs@debian.org>
839 Uploaders: Franziska Lichtblau <rhalina@old-forest.org>
840-Build-Depends: debhelper (>= 9), autotools-dev (>= 20100122.1~), pkg-config (>= 0.25), dpkg-dev (>= 1.16.1~), libxcb-randr0-dev, libxxf86vm-dev, libgconf2-dev, python3, libxext-dev, libgeoclue-dev, libdrm-dev, intltool, dh-python
841+Build-Depends: debhelper (>= 9), autotools-dev (>= 20100122.1~), pkg-config (>= 0.25), dpkg-dev (>= 1.16.1~), libxcb-randr0-dev, libxxf86vm-dev, libgconf2-dev, python3, libxext-dev, libdrm-dev, intltool, dh-python, dh-autoreconf
842 X-Python3-Version: >= 3.2
843 Standards-Version: 3.9.3
844 Vcs-Git: git://anonscm.debian.org/users/rhalina-guest/redshift.git
845
846=== added file 'debian/gbp.conf'
847--- debian/gbp.conf 1970-01-01 00:00:00 +0000
848+++ debian/gbp.conf 2015-10-14 19:20:52 +0000
849@@ -0,0 +1,2 @@
850+[DEFAULT]
851+pristine-tar = True
852
853=== added file 'debian/patches/add-desktop-file.patch'
854--- debian/patches/add-desktop-file.patch 1970-01-01 00:00:00 +0000
855+++ debian/patches/add-desktop-file.patch 2015-10-14 19:20:52 +0000
856@@ -0,0 +1,34 @@
857+Add .desktop file until next release, when we can then drop it
858+--- a/Makefile.am
859++++ b/Makefile.am
860+@@ -28,6 +28,7 @@
861+ data/icons/ubuntu-mono-light/scalable/apps/redshift-status-off.svg
862+
863+ DESKTOP_IN_FILES = \
864++ data/applications/redshift.desktop.in \
865+ data/applications/redshift-gtk.desktop.in
866+
867+ SYSTEMD_USER_UNIT_IN_FILES = \
868+--- /dev/null
869++++ b/data/applications/redshift.desktop.in
870+@@ -0,0 +1,10 @@
871++[Desktop Entry]
872++Version=1.0
873++_Name=Redshift
874++_GenericName=Color temperature adjustment
875++_Comment=Color temperature adjustment tool
876++Exec=redshift
877++Icon=redshift
878++Terminal=true
879++Type=Application
880++NoDisplay=true
881+--- a/po/POTFILES.in
882++++ b/po/POTFILES.in
883+@@ -1,6 +1,7 @@
884+ # List of source files containing translatable strings
885+
886+ data/appdata/redshift-gtk.appdata.xml.in
887++data/applications/redshift.desktop.in
888+ data/applications/redshift-gtk.desktop.in
889+
890+ src/redshift.c
891
892=== modified file 'debian/patches/retry-geoclue.patch'
893--- debian/patches/retry-geoclue.patch 2014-11-01 17:06:15 +0000
894+++ debian/patches/retry-geoclue.patch 2015-10-14 19:20:52 +0000
895@@ -2,11 +2,13 @@
896 Author: Clint Byrum <clint@ubuntu.com>
897 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/redshift/+bug/868904
898
899-Index: redshift/src/location-geoclue.c
900-===================================================================
901---- redshift.orig/src/location-geoclue.c 2012-03-02 17:45:30.000000000 -0800
902-+++ redshift/src/location-geoclue.c 2012-03-02 19:06:32.854211600 -0800
903-@@ -19,6 +19,7 @@
904+---
905+ src/location-geoclue.c | 28 ++++++++++++++++++++--------
906+ 1 file changed, 20 insertions(+), 8 deletions(-)
907+
908+--- a/src/location-geoclue.c
909++++ b/src/location-geoclue.c
910+@@ -20,6 +20,7 @@
911 #include <stdio.h>
912 #include <stdlib.h>
913 #include <string.h>
914@@ -14,7 +16,7 @@
915
916 #include <geoclue/geoclue-master.h>
917 #include <geoclue/geoclue-position.h>
918-@@ -160,17 +161,28 @@
919+@@ -191,17 +192,28 @@ location_geoclue_get_location(location_g
920 GError *error = NULL;
921 double latitude = 0, longitude = 0;
922
923
924=== modified file 'debian/patches/series'
925--- debian/patches/series 2014-11-01 17:06:15 +0000
926+++ debian/patches/series 2015-10-14 19:20:52 +0000
927@@ -1,2 +1,2 @@
928-remove_autostart.patch
929+add-desktop-file.patch
930 retry-geoclue.patch
931
932=== modified file 'debian/redshift-gtk.docs'
933--- debian/redshift-gtk.docs 2015-06-28 09:25:43 +0000
934+++ debian/redshift-gtk.docs 2015-10-14 19:20:52 +0000
935@@ -1,2 +1,1 @@
936 README
937-debian/README.Debian
938
939=== modified file 'debian/redshift-gtk.install'
940--- debian/redshift-gtk.install 2015-06-28 09:25:43 +0000
941+++ debian/redshift-gtk.install 2015-10-14 19:20:52 +0000
942@@ -1,4 +1,5 @@
943 usr/bin/redshift-gtk
944 usr/lib/python*
945 usr/share/icons
946-usr/share/applications/
947+usr/share/appdata/redshift-gtk.appdata.xml
948+usr/share/applications/redshift-gtk.desktop
949
950=== modified file 'debian/redshift.install'
951--- debian/redshift.install 2010-02-18 09:58:46 +0000
952+++ debian/redshift.install 2015-10-14 19:20:52 +0000
953@@ -1,2 +1,3 @@
954 usr/bin/redshift
955 usr/share/locale
956+usr/share/applications/redshift.desktop
957
958=== modified file 'debian/rules'
959--- debian/rules 2015-06-28 09:25:43 +0000
960+++ debian/rules 2015-10-14 19:20:52 +0000
961@@ -6,10 +6,11 @@
962 include /usr/share/dpkg/buildflags.mk
963
964 %:
965- dh $@ --with autotools_dev,python3
966+ dh $@ --with python3,autoreconf
967
968 override_dh_auto_configure:
969- dh_auto_configure -- --enable-randr --enable-vidmode --enable-geoclue2 --disable-geoclue --enable-ubuntu
970+ intltoolize --force
971+ dh_auto_configure -- --enable-randr --enable-vidmode --enable-geoclue2 --disable-geoclue --with-systemduserunitdir=/usr/lib/systemd/user/ --enable-ubuntu
972
973 override_dh_installchangelogs:
974 dh_installchangelogs NEWS
975
976=== modified file 'src/location-geoclue.c'
977--- src/location-geoclue.c 2015-06-28 09:25:43 +0000
978+++ src/location-geoclue.c 2015-10-14 19:20:52 +0000
979@@ -20,7 +20,6 @@
980 #include <stdio.h>
981 #include <stdlib.h>
982 #include <string.h>
983-#include <unistd.h>
984
985 #include <geoclue/geoclue-master.h>
986 #include <geoclue/geoclue-position.h>
987@@ -192,28 +191,17 @@
988 GError *error = NULL;
989 double latitude = 0, longitude = 0;
990
991- /* Retry 3 times because this seems to timeout quite a bit */
992- int retries = 4;
993- while(--retries) {
994- fields = geoclue_position_get_position(state->position, NULL,
995- &latitude, &longitude, NULL,
996- NULL, &error);
997- if (error) {
998- g_printerr(_("Could not get location (%d retries left): %s.\n"), retries, error->message);
999- g_error_free(error);
1000- return -1;
1001- }
1002- if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
1003- fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
1004- break;
1005- }
1006- g_warning(_("Could not get location, %d retries left.\n"), retries);
1007- /* Sleep for a while to let */
1008- usleep(1000000);
1009+ fields = geoclue_position_get_position(state->position, NULL,
1010+ &latitude, &longitude, NULL,
1011+ NULL, &error);
1012+ if (error) {
1013+ g_printerr(_("Could not get location: %s.\n"), error->message);
1014+ g_error_free(error);
1015+ return -1;
1016 }
1017
1018 if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE &&
1019- fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
1020+ fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) {
1021 fprintf(stdout, _("According to the geoclue provider"
1022 " we're at: %.2f, %.2f\n"),
1023 latitude, longitude);
1024
1025=== modified file 'src/redshift-gtk/statusicon.py'
1026--- src/redshift-gtk/statusicon.py 2015-06-28 09:25:43 +0000
1027+++ src/redshift-gtk/statusicon.py 2015-10-14 19:20:52 +0000
1028@@ -273,6 +273,18 @@
1029 suspend_menu_item.set_submenu(suspend_menu)
1030 self.status_menu.append(suspend_menu_item)
1031
1032+ # Add autostart option
1033+ autostart_item = Gtk.CheckMenuItem.new_with_label(_('Autostart'))
1034+ try:
1035+ autostart_item.set_active(utils.get_autostart())
1036+ except IOError as strerror:
1037+ print(strerror)
1038+ autostart_item.set_property('sensitive', False)
1039+ else:
1040+ autostart_item.connect('toggled', self.autostart_cb)
1041+ finally:
1042+ self.status_menu.append(autostart_item)
1043+
1044 # Add info action
1045 info_item = Gtk.MenuItem.new_with_label(_('Info'))
1046 info_item.connect('activate', self.show_info_cb)

Subscribers

People subscribed via source and target branches

to all changes: