Debian Codegraph @

debian/patches/debian-changes

raw symbols SCIP
1 Description: <short summary of the patch>
2 TODO: Put a short summary on the line above and replace this paragraph
3 with a longer explanation of this change. Complete the meta-information
4 with other relevant fields (see below for details). To make it easier, the
5 information below has been extracted from the changelog. Adjust it or drop
6 it.
7 .
8 nuntius-linux (0.2.0-5) unstable; urgency=medium
9 .
10 * Address footprint accuracy in package description (closes: #827439)
11 * Secure copyright format URL
12 * Hotwire appdatadir per lintian whining
13 Author: Barak A. Pearlmutter <[email protected]>
14 Bug-Debian: https://bugs.debian.org/827439
15
16 ---
17 The information above should follow the Patch Tagging Guidelines, please
18 checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
19 are templates for supplementary fields that you might want to add:
20
21 Origin: <vendor|upstream|other>, <url of original patch>
22 Bug: <url in upstream bugtracker>
23 Bug-Debian: https://bugs.debian.org/<bugnumber>
24 Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
25 Forwarded: <no|not-needed|url proving that it has been forwarded>
26 Reviewed-By: <name and email of someone who approved the patch>
27 Last-Update: 2018-09-12
28
29 --- /dev/null
30 +++ nuntius-linux-0.2.0/.tx/config
31 @@ -0,0 +1,8 @@
32 +[main]
33 +host = https://www.transifex.com
34 +type = PO
35 +
36 +[nuntius-linux.strings]
37 +file_filter = po/<lang>.po
38 +source_file = po/nuntius.pot
39 +source_lang = en
40 \ No newline at end of file
41 --- nuntius-linux-0.2.0.orig/Makefile.am
42 +++ nuntius-linux-0.2.0/Makefile.am
43 @@ -3,16 +3,14 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
44 SUBDIRS = po
45
46 # desktop file
47 -# (we can't use INTLTOOL_DESKTOP_RULE here due to lp#605826)
48 -%.desktop: %.desktop.in
49 - $(AM_V_GEN) $(MKDIR_P) $(dir $@); LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
50 -applicationsdir = $(datadir)/applications
51 -applications_DATA = data/org.holylobster.nuntius.desktop
52 -dist_noinst_DATA = data/org.holylobster.nuntius.desktop.in
53 +desktopdir = $(datadir)/applications
54 +desktop_in_files = data/org.holylobster.nuntius.desktop.in
55 +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
56 +@INTLTOOL_DESKTOP_RULE@
57
58 # autostart file
59 autostartdir = $(sysconfdir)/xdg/autostart
60 -autostart_DATA = $(applications_DATA)
61 +autostart_DATA = $(desktop_DATA)
62
63 # appdata file
64 appdatadir = $(datadir)/appdata
65 @@ -23,11 +21,15 @@ appdata_in_files = data/org.holylobster.
66 # DBus service file
67 servicedir = $(datadir)/dbus-1/services
68 service_DATA = data/org.holylobster.nuntius.service
69 -dist_noinst_DATA += data/org.holylobster.nuntius.service.in
70 +dist_noinst_DATA = data/org.holylobster.nuntius.service.in
71
72 data/org.holylobster.nuntius.service: data/org.holylobster.nuntius.service.in Makefile
73 $(AM_V_GEN) $(MKDIR_P) $(dir $@); sed -e "s|\@bindir\@|$(bindir)|" $< > $@
74
75 +# gsettings
76 +gsettings_SCHEMAS = data/org.holylobster.nuntius.gschema.xml
77 +@GSETTINGS_RULES@
78 +
79 data_icons_public_icons = \
80 hicolor_apps_16x16_nuntius.png \
81 hicolor_apps_22x22_nuntius.png \
82 @@ -60,7 +62,8 @@ data-icons-uninstall-icons:
83 AM_CPPFLAGS = \
84 -DGETTEXT_PACKAGE=\""$(GETTEXT_PACKAGE)"\" \
85 -DGNOMELOCALEDIR=\""$(localedir)"\" \
86 - -DDATADIR=\""$(datadir)"\"
87 + -DDATADIR=\""$(datadir)"\" \
88 + -DTOOLSDIR=\""$(libexecdir)/$(PACKAGE)"\"
89
90 AM_VALAFLAGS = \
91 --target-glib=2.40 \
92 @@ -71,7 +74,7 @@ AM_VALAFLAGS = \
93 --pkg posix \
94 --gresources $(top_srcdir)/src/resources/nuntius.gresource.xml
95
96 -bin_PROGRAMS = nuntius
97 +bin_PROGRAMS = nuntius qrtest
98
99 BUILT_SOURCES = \
100 src/resources.c
101 @@ -80,6 +83,9 @@ resource_files = $(shell $(GLIB_COMPILE_
102 src/resources.c: $(top_srcdir)/src/resources/nuntius.gresource.xml $(resource_files)
103 $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/src/resources --generate-source $<
104
105 +toolsdir = $(libexecdir)/$(PACKAGE)
106 +tools_SCRIPTS = createcert.sh
107 +
108 VALA_SOURCES = \
109 src/application.vala \
110 src/appslistpanel.vala \
111 @@ -87,14 +93,19 @@ VALA_SOURCES = \
112 src/connection.vala \
113 src/notification.vala \
114 src/notificationapp.vala \
115 + src/notificationcounter.vala \
116 src/notificationsview.vala \
117 + src/qrimage.vala \
118 + src/smsnotification.vala \
119 + src/testview.vala \
120 src/window.vala \
121 src/main.vala
122
123 nuntius_SOURCES = \
124 $(BUILT_SOURCES) \
125 $(VALA_SOURCES) \
126 - src/config.vapi
127 + src/config.vapi \
128 + src/qrencode.vapi
129
130 AM_CFLAGS = \
131 $(NUNTIUS_CFLAGS) \
132 @@ -107,21 +118,33 @@ nuntius_LDADD = \
133 $(NUNTIUS_LIBS) \
134 -lm
135
136 +qrtest_SOURCES = \
137 + tests/qrtest.vala \
138 + src/qrimage.vala \
139 + src/qrencode.vapi
140 +
141 +qrtest_LDFLAGS = -export-dynamic
142 +qrtest_LDADD = \
143 + $(NUNTIUS_LIBS) \
144 + -lm
145 +
146 +check-local: $(desktop_DATA)
147 + $(DESKTOP_FILE_VALIDATE) $(desktop_DATA)
148 +
149 install-data-local: data-icons-install-icons
150
151 uninstall-local: data-icons-uninstall-icons
152
153 EXTRA_DIST = \
154 - $(applications_DATA) \
155 $(appdata_in_files) \
156 + $(desktop_in_files) \
157 $(resource_files) \
158 - data/org.holylobster.nuntius.appdata.xml \
159 src/resources/nuntius.gresource.xml \
160 $(addprefix data/icons/,$(data_icons_public_icons))
161
162 CLEANFILES = \
163 $(appdata_DATA) \
164 - $(applications_DATA) \
165 + $(desktop_DATA) \
166 $(service_DATA)
167
168 MAINTAINERCLEANFILES = \
169 --- nuntius-linux-0.2.0.orig/README.md
170 +++ nuntius-linux-0.2.0/README.md
171 @@ -1,37 +1,40 @@
172 Nuntius
173 ===================================
174
175 -##Introduction
176 +## Introduction
177 Nuntius delivers notifications from your phone or tablet to your computer over Bluetooth.
178
179 Nuntius is an Open Source project from HolyLobster.
180
181 To use Nuntius you will need to install a companion tool on your phone or tablet and pair it via Bluetooth.
182 +You will also need to restart your session to auto-start nuntius.
183
184 For more information on the project and the companion tools to install on the computer check https://github.com/holylobster
185
186 -##The Icon
187 +## The Icon
188 You may have questions on the icon. Nice shot.
189 In fact most of the Nuntius development time has been spent on the icon design concept.
190 If you have suggestions on how to improve it we are very open... but... we think it is hardly possible to do better than this.
191
192 -##Packages
193 +## Packages
194 You can install Nuntius from:
195
196 - * Fedora: yum install nuntius
197 + * Fedora: `dnf install nuntius` (use `yum` instead of `dnf` on Fedora <= 21)
198 * [Arch Linux (AUR)](https://aur.archlinux.org/packages/nuntius/)
199 + * [Debian](https://packages.debian.org/nuntius) and Debian derivatives: `sudo apt install nuntius`
200
201 You will need to install Nuntius also on your phone or tablet.
202
203 -At the moment Nuntius is available for Android, check here
204 +At the moment Nuntius is available for Android.
205
206 - * https://github.com/holylobster/nuntius-android
207 + * Nuntius-Android [Development Repository](https://github.com/holylobster/nuntius-android)
208 + * Nuntius for Android [on Google Play](https://play.google.com/store/apps/details?id=org.holylobster.nuntius)
209
210 -##Getting in touch
211 +## Getting in touch
212 We have an IRC channel: #nuntius on the irc.gnome.org server.
213 Feel free to join and talk to us! Note that the channel is new and there are not many people (yet!) so be patient and hang around if you do not receive a reply immediately.
214
215 -##Some tips to debug
216 +## Some tips to debug
217 * Launch the bluetooth dameon as "sudo /usr/libexec/bluetooth/bluetoothd -d -n"
218 * Using bluetoothctl
219 * I had to set "agent on", "default-agent" and "trust 98:D6:F7:73:03:F1"
220 @@ -39,4 +42,3 @@ Feel free to join and talk to us! Note t
221 * /var/log/messages gives also some information about bluetoothd if you do not run it directly
222 * run "sudo btmon > btmon.log" to get information from the devices that try to connect to the computer
223 * This is very useful to see to which uuid is trying to connect and what kind of errors it gets
224 -
225 --- nuntius-linux-0.2.0.orig/autogen.sh
226 +++ nuntius-linux-0.2.0/autogen.sh
227 @@ -1,28 +1,6 @@
228 #!/bin/sh
229 # Run this to generate all the initial makefiles, etc.
230 +set -e
231
232 -test -n "$srcdir" || srcdir=`dirname "$0"`
233 -test -n "$srcdir" || srcdir=.
234 -
235 -OLDDIR=`pwd`
236 -cd $srcdir
237 -
238 -AUTORECONF=`which autoreconf`
239 -if test -z $AUTORECONF; then
240 - echo "*** No autoreconf found, please install it ***"
241 - exit 1
242 -fi
243 -
244 -INTLTOOLIZE=`which intltoolize`
245 -if test -z $INTLTOOLIZE; then
246 - echo "*** No intltoolize found, please install the intltool package ***"
247 - exit 1
248 -fi
249 -
250 -git submodule update --init --recursive
251 -
252 -autopoint --force || exit $?
253 -AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose
254 -
255 -cd $OLDDIR
256 -test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
257 +autopoint --force
258 +AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose $@
259 --- nuntius-linux-0.2.0.orig/configure.ac
260 +++ nuntius-linux-0.2.0/configure.ac
261 @@ -1,6 +1,6 @@
262 -AC_PREREQ(2.63)
263 +AC_PREREQ([2.69])
264
265 -AC_INIT([nuntius], [0.2.0])
266 +AC_INIT([nuntius],[0.2.0])
267
268 dnl http://people.gnome.org/~walters/docs/build-api.txt
269 dnl We don't support separate builddir when building from git
270 @@ -10,7 +10,7 @@ AC_CONFIG_MACRO_DIR([m4])
271 AC_CONFIG_HEADERS(config.h)
272 AC_CONFIG_SRCDIR(src/main.vala)
273
274 -AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip foreign])
275 +AM_INIT_AUTOMAKE([1.11 tar-ustar dist-xz no-dist-gzip foreign subdir-objects -Wall])
276 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
277
278 IT_PROG_INTLTOOL([0.50.1])
279 @@ -25,20 +25,25 @@ AC_PROG_CC_STDC
280 AC_PROG_INSTALL
281 AM_PROG_VALAC([0.23.3])
282
283 +AC_PATH_PROG(DESKTOP_FILE_VALIDATE, desktop-file-validate, /bin/true)
284 AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
285
286 +GLIB_GSETTINGS
287 +
288 PKG_PROG_PKG_CONFIG
289
290 PKG_CHECK_MODULES(NUNTIUS, [
291 gio-2.0 >= 2.40
292 gio-unix-2.0 >= 2.38
293 glib-2.0 >= 2.38
294 - gtk+-3.0 >= 3.10.0
295 + gtk+-3.0 >= 3.14.0
296 json-glib-1.0 >= 0.16.2
297 + libqrencode >= 3.1.0
298 ])
299
300 AC_CONFIG_FILES([
301 Makefile
302 + data/org.holylobster.nuntius.gschema.xml
303 po/Makefile.in
304 ])
305
306 --- /dev/null
307 +++ nuntius-linux-0.2.0/createcert.sh
308 @@ -0,0 +1,35 @@
309 +#!/bin/bash
310 +
311 +function try {
312 + "$@"
313 + local status=$?
314 + if [ $status -ne 0 ]; then
315 + echo -e "\nError with $1" >&2
316 + exit $?
317 + fi
318 + return $status
319 +}
320 +
321 +function create_cert() {
322 + if [[ ! -f $HOME/.config/nuntius/nuntius.pem || ! -f $HOME/.config/nuntius/nuntius.key ]]; then
323 + echo "Creating cert..."
324 + cd $HOME/.config/nuntius
325 + try openssl genrsa -out nuntius.key 2048
326 + try openssl req -new -key nuntius.key -out nuntius.csr -subj "/O=Holylobster/OU=Nuntius"
327 + try openssl x509 -req -days 3650 -in nuntius.csr -signkey nuntius.key -out nuntius.crt
328 + try openssl x509 -in nuntius.crt -out nuntius.pem
329 + exit $?
330 + else
331 + echo "Certificate already exist..."
332 + exit 0
333 + fi
334 +}
335 +
336 +if [[ ! -d $HOME/.config/nuntius ]]; then
337 + echo "Creating nuntius config directory..."
338 + mkdir -p $HOME/.config/nuntius
339 +fi
340 +
341 +create_cert
342 +
343 +# ex:set ts=4 et:
344 --- /dev/null
345 +++ nuntius-linux-0.2.0/data/org.holylobster.nuntius.gschema.xml.in
346 @@ -0,0 +1,21 @@
347 +<schemalist gettext-domain="@GETTEXT_PACKAGE@">
348 + <schema id="org.holylobster.nuntius.state" path="/org/holylobster/nuntius/state/">
349 + <child schema="org.holylobster.nuntius.state.window" name="window"/>
350 + </schema>
351 + <schema id="org.holylobster.nuntius.state.window" path="/org/holylobster/nuntius/state/window/">
352 + <key type="i" name="state">
353 + <default>0</default>
354 + <summary>Window state</summary>
355 + <description>
356 + State of the window, e.g. maximized.
357 + </description>
358 + </key>
359 + <key type="(ii)" name="size">
360 + <default>(870, 690)</default>
361 + <summary>Window width and height</summary>
362 + <description>
363 + Width and height of the window.
364 + </description>
365 + </key>
366 + </schema>
367 +</schemalist>
368 --- nuntius-linux-0.2.0.orig/po/LINGUAS
369 +++ nuntius-linux-0.2.0/po/LINGUAS
370 @@ -1,4 +1,3 @@
371 -#
372 # nuntius translations
373 # please keep this list sorted alphabetically
374 de
375 --- nuntius-linux-0.2.0.orig/po/POTFILES.in
376 +++ nuntius-linux-0.2.0/po/POTFILES.in
377 @@ -1,4 +1,11 @@
378 +# List of source files containing translatable strings.
379 +# Please keep this file sorted alphabetically.
380 data/org.holylobster.nuntius.appdata.xml.in
381 data/org.holylobster.nuntius.desktop.in
382 +[type: gettext/gsettings]data/org.holylobster.nuntius.gschema.xml.in
383 +src/application.vala
384 +src/appslist.vala
385 +[type: gettext/glade]src/resources/gtk/menus.ui
386 [type: gettext/glade]src/resources/ui/appslistpanel.ui
387 [type: gettext/glade]src/resources/ui/window.ui
388 +src/smsnotification.vala
389 --- /dev/null
390 +++ nuntius-linux-0.2.0/po/POTFILES.skip
391 @@ -0,0 +1,5 @@
392 +# List of source files that should *not* be translated.
393 +# Please keep this file sorted alphabetically.
394 +src/application.c
395 +src/appslist.c
396 +src/smsnotification.c
397 --- nuntius-linux-0.2.0.orig/po/de.po
398 +++ nuntius-linux-0.2.0/po/de.po
399 @@ -5,38 +5,113 @@
400 #
401 msgid ""
402 msgstr ""
403 -"Project-Id-Version: \n"
404 +"Project-Id-Version: nuntius-linux\n"
405 "Report-Msgid-Bugs-To: \n"
406 -"POT-Creation-Date: 2015-03-11 11:24+0100\n"
407 +"POT-Creation-Date: 2016-07-15 17:00+0200\n"
408 "PO-Revision-Date: 2015-03-11 18:29+0100\n"
409 "Last-Translator: Raphael Guttenberger <[email protected]>\n"
410 "Language-Team: \n"
411 "Language: de\n"
412 "MIME-Version: 1.0\n"
413 -"Content-Type: text/plain; charset=utf-8\n"
414 +"Content-Type: text/plain; charset=UTF-8\n"
415 "Content-Transfer-Encoding: 8bit\n"
416 +"Plural-Forms: nplurals=2; plural=(n != 1);\n"
417 +
418 #: ../data/org.holylobster.nuntius.appdata.xml.in.h:1
419 msgid ""
420 "Nuntius delivers notifications from your phone or tablet to your computer "
421 "over Bluetooth."
422 msgstr ""
423 -"Nuntius sendet Benachrichtigungen von deinem Handy oder Tablet direkt an deinen Computer"
424 -"über Bluetooth."
425 +"Nuntius sendet Benachrichtigungen von deinem Handy oder Tablet direkt an "
426 +"deinen Computer über Bluetooth."
427 +
428 #: ../data/org.holylobster.nuntius.appdata.xml.in.h:2
429 msgid ""
430 "To use Nuntius you will need to install a companion tool on your phone or "
431 "tablet and pair it via Bluetooth."
432 msgstr ""
433 -"Um Nuntius zu benutzen, musst du ein Hilfstool auf deinem Handy oder"
434 -"Tablet installieren und es über Bluetooth mit deinem PC verbinden."
435 +"Um Nuntius zu benutzen, musst du ein Hilfstool auf deinem Handy oder Tablet "
436 +"installieren und es über Bluetooth mit deinem PC verbinden."
437 +
438 #: ../data/org.holylobster.nuntius.desktop.in.h:1
439 msgid ""
440 "Deliver notifications from your phone or tablet to your computer over "
441 "Bluetooth"
442 msgstr ""
443 -"Sende Benachrichtigungen von deinem Handy oder Tablet an deinen PC über"
444 +"Sende Benachrichtigungen von deinem Handy oder Tablet an deinen PC über "
445 "Bluetooth"
446 +
447 #: ../data/org.holylobster.nuntius.desktop.in.h:2
448 msgid "notifications;"
449 +msgstr "Benachrichtigungen;"
450 +
451 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:1
452 +msgid "Window state"
453 +msgstr ""
454 +
455 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:2
456 +msgid "State of the window, e.g. maximized."
457 +msgstr ""
458 +
459 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:3
460 +msgid "Window width and height"
461 +msgstr ""
462 +
463 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:4
464 +msgid "Width and height of the window."
465 +msgstr ""
466 +
467 +#: ../src/application.vala:144
468 +msgid "Connect to a specific server"
469 +msgstr ""
470 +
471 +#: ../src/application.vala:297
472 +msgid "Certificate Fingerprint"
473 +msgstr ""
474 +
475 +#: ../src/application.vala:300
476 +msgid "_OK"
477 +msgstr ""
478 +
479 +#: ../src/application.vala:469 ../src/resources/ui/window.ui.h:1
480 +msgid "Nuntius"
481 +msgstr ""
482 +
483 +#: ../src/application.vala:472
484 +msgid ""
485 +"Deliver notifications from your phone or tablet to your computer over "
486 +"Bluetooth."
487 +msgstr ""
488 +"Sende Benachrichtigungen von deinem Handy oder Tablet an deinen PC über "
489 +"Bluetooth."
490 +
491 +#: ../src/application.vala:477
492 +msgid "translator-credits"
493 +msgstr "Raphael Guttenberger <[email protected]>, 2015"
494 +
495 +#: ../src/appslist.vala:75
496 +msgid "Blacklist this application"
497 +msgstr ""
498 +
499 +#. namespace Nuntius
500 +#. ex:set ts=4 et:
501 +#: ../src/resources/gtk/menus.ui.h:1
502 +msgid "Show _QR Code"
503 +msgstr ""
504 +
505 +#: ../src/resources/gtk/menus.ui.h:2
506 +msgid "_About"
507 +msgstr ""
508 +
509 +#: ../src/resources/ui/appslistpanel.ui.h:1
510 +msgid "Type to search"
511 +msgstr ""
512 +
513 +#: ../src/resources/ui/window.ui.h:2
514 +msgid "All Applications"
515 +msgstr ""
516 +
517 +#. FIXME: just a test message until we have UI to type the reply
518 +#: ../src/smsnotification.vala:63
519 +msgid "Reply"
520 msgstr ""
521 -"Benachrichtigungen"
522 --- nuntius-linux-0.2.0.orig/po/es.po
523 +++ nuntius-linux-0.2.0/po/es.po
524 @@ -1,23 +1,21 @@
525 # SOME DESCRIPTIVE TITLE.
526 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
527 # This file is distributed under the same license as the PACKAGE package.
528 -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
529 # Daniel Mustieles <[email protected]>, 2015.
530 #
531 msgid ""
532 msgstr ""
533 -"Project-Id-Version: PACKAGE VERSION\n"
534 +"Project-Id-Version: nuntius-linux\n"
535 "Report-Msgid-Bugs-To: \n"
536 -"POT-Creation-Date: 2015-03-11 11:24+0100\n"
537 +"POT-Creation-Date: 2016-07-15 17:00+0200\n"
538 "PO-Revision-Date: 2015-03-12 11:41+0100\n"
539 "Last-Translator: Daniel Mustieles <[email protected]>\n"
540 "Language-Team: Español; Castellano <[email protected]>\n"
541 -"Language: \n"
542 +"Language: es\n"
543 "MIME-Version: 1.0\n"
544 "Content-Type: text/plain; charset=UTF-8\n"
545 "Content-Transfer-Encoding: 8bit\n"
546 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
547 -"X-Generator: Gtranslator 2.91.6\n"
548
549 #: ../data/org.holylobster.nuntius.appdata.xml.in.h:1
550 msgid ""
551 @@ -46,3 +44,74 @@ msgstr ""
552 #: ../data/org.holylobster.nuntius.desktop.in.h:2
553 msgid "notifications;"
554 msgstr "notificaciones;"
555 +
556 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:1
557 +msgid "Window state"
558 +msgstr ""
559 +
560 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:2
561 +msgid "State of the window, e.g. maximized."
562 +msgstr ""
563 +
564 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:3
565 +msgid "Window width and height"
566 +msgstr ""
567 +
568 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:4
569 +msgid "Width and height of the window."
570 +msgstr ""
571 +
572 +#: ../src/application.vala:144
573 +msgid "Connect to a specific server"
574 +msgstr ""
575 +
576 +#: ../src/application.vala:297
577 +msgid "Certificate Fingerprint"
578 +msgstr ""
579 +
580 +#: ../src/application.vala:300
581 +msgid "_OK"
582 +msgstr ""
583 +
584 +#: ../src/application.vala:469 ../src/resources/ui/window.ui.h:1
585 +msgid "Nuntius"
586 +msgstr ""
587 +
588 +#: ../src/application.vala:472
589 +msgid ""
590 +"Deliver notifications from your phone or tablet to your computer over "
591 +"Bluetooth."
592 +msgstr ""
593 +"Enviar notificaciones desde su teléfono o tableta a su equipo mediante "
594 +"Bluetooth."
595 +
596 +#: ../src/application.vala:477
597 +msgid "translator-credits"
598 +msgstr "Daniel Mustieles <[email protected]>, 2015"
599 +
600 +#: ../src/appslist.vala:75
601 +msgid "Blacklist this application"
602 +msgstr ""
603 +
604 +#. namespace Nuntius
605 +#. ex:set ts=4 et:
606 +#: ../src/resources/gtk/menus.ui.h:1
607 +msgid "Show _QR Code"
608 +msgstr ""
609 +
610 +#: ../src/resources/gtk/menus.ui.h:2
611 +msgid "_About"
612 +msgstr ""
613 +
614 +#: ../src/resources/ui/appslistpanel.ui.h:1
615 +msgid "Type to search"
616 +msgstr ""
617 +
618 +#: ../src/resources/ui/window.ui.h:2
619 +msgid "All Applications"
620 +msgstr ""
621 +
622 +#. FIXME: just a test message until we have UI to type the reply
623 +#: ../src/smsnotification.vala:63
624 +msgid "Reply"
625 +msgstr ""
626 --- nuntius-linux-0.2.0.orig/po/pl.po
627 +++ nuntius-linux-0.2.0/po/pl.po
628 @@ -1,34 +1,30 @@
629 -# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
630 -# Aviary.pl
631 -# Jeśli masz jakiekolwiek uwagi odnoszące się do tłumaczenia lub chcesz
632 -# pomóc w jego rozwijaniu i pielęgnowaniu, napisz do nas:
633 -# [email protected]
634 -# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
635 -# Piotr Drąg <[email protected]>, 2015.
636 -# Aviary.pl <[email protected]>, 2015.
637 +# Polish translation for nuntius-linux.
638 +# Copyright © 2015-2016 the nuntius-linux authors.
639 +# This file is distributed under the same license as the nuntius-linux package.
640 +# Piotr Drąg <[email protected]>, 2015-2016.
641 +# Aviary.pl <[email protected]>, 2015-2016.
642 +#
643 msgid ""
644 msgstr ""
645 "Project-Id-Version: nuntius-linux\n"
646 "Report-Msgid-Bugs-To: \n"
647 -"POT-Creation-Date: 2015-03-10 20:10+0100\n"
648 -"PO-Revision-Date: 2015-03-10 20:11+0100\n"
649 +"POT-Creation-Date: 2016-08-29 18:54+0200\n"
650 +"PO-Revision-Date: 2016-08-29 18:55+0200\n"
651 "Last-Translator: Piotr Drąg <[email protected]>\n"
652 -"Language-Team: Polish <[email protected]>\n"
653 +"Language-Team: Polish <[email protected]>\n"
654 "Language: pl\n"
655 "MIME-Version: 1.0\n"
656 "Content-Type: text/plain; charset=UTF-8\n"
657 "Content-Transfer-Encoding: 8bit\n"
658 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
659 "|| n%100>=20) ? 1 : 2);\n"
660 -"X-Poedit-Language: Polish\n"
661 -"X-Poedit-Country: Poland\n"
662
663 #: ../data/org.holylobster.nuntius.appdata.xml.in.h:1
664 msgid ""
665 "Nuntius delivers notifications from your phone or tablet to your computer "
666 "over Bluetooth."
667 msgstr ""
668 -"Nuntius wyświetla powiadomienia z telefonu lub tabletu na komputerze za "
669 +"Nuntius wyświetla powiadomienia z telefonu lub tabletu na komputerze za "
670 "pomocą Bluetooth."
671
672 #: ../data/org.holylobster.nuntius.appdata.xml.in.h:2
673 @@ -37,14 +33,14 @@ msgid ""
674 "tablet and pair it via Bluetooth."
675 msgstr ""
676 "Aby użyć programu Nuntius, należy zainstalować uzupełniające narzędzie na "
677 -"telefonie lub tablecie i połączyć je z komputerem za pomocą Bluetooth."
678 +"telefonie lub tablecie i połączyć je z komputerem za pomocą Bluetooth."
679
680 #: ../data/org.holylobster.nuntius.desktop.in.h:1
681 msgid ""
682 "Deliver notifications from your phone or tablet to your computer over "
683 "Bluetooth"
684 msgstr ""
685 -"Wyświetlanie powiadomień z telefonu lub tabletu na komputerze za pomocą "
686 +"Wyświetlanie powiadomień z telefonu lub tabletu na komputerze za pomocą "
687 "Bluetooth"
688
689 #: ../data/org.holylobster.nuntius.desktop.in.h:2
690 @@ -52,3 +48,76 @@ msgid "notifications;"
691 msgstr ""
692 "powiadomienia;powiadamianie;notyfikacje;wiadomości;komunikaty;telefon;tablet;"
693 "smartfon;phablet;fablet;android;"
694 +
695 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:1
696 +msgid "Window state"
697 +msgstr "Stan okna"
698 +
699 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:2
700 +msgid "State of the window, e.g. maximized."
701 +msgstr "Stan okna, tzn. czy jest zmaksymalizowane."
702 +
703 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:3
704 +msgid "Window width and height"
705 +msgstr "Szerokość i wysokość okna"
706 +
707 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:4
708 +msgid "Width and height of the window."
709 +msgstr "Szerokość i wysokość okna."
710 +
711 +#: ../src/application.vala:144
712 +msgid "Connect to a specific server"
713 +msgstr "Łączy z podanym serwerem"
714 +
715 +#: ../src/application.vala:297
716 +msgid "Certificate Fingerprint"
717 +msgstr "Odcisk certyfikatu"
718 +
719 +#: ../src/application.vala:300
720 +msgid "_OK"
721 +msgstr "_OK"
722 +
723 +#: ../src/application.vala:469 ../src/resources/ui/window.ui.h:1
724 +msgid "Nuntius"
725 +msgstr "Nuntius"
726 +
727 +#: ../src/application.vala:472
728 +msgid ""
729 +"Deliver notifications from your phone or tablet to your computer over "
730 +"Bluetooth."
731 +msgstr ""
732 +"Wyświetlanie powiadomień z telefonu lub tabletu na komputerze za pomocą "
733 +"Bluetooth."
734 +
735 +#: ../src/application.vala:477
736 +msgid "translator-credits"
737 +msgstr ""
738 +"Piotr Drąg <[email protected]>, 2015-2016\n"
739 +"Aviary.pl <[email protected]>, 2015-2016"
740 +
741 +#: ../src/appslist.vala:75
742 +msgid "Blacklist this application"
743 +msgstr "Dodaj program do czarnej listy"
744 +
745 +#. namespace Nuntius
746 +#. ex:set ts=4 et:
747 +#: ../src/resources/gtk/menus.ui.h:1
748 +msgid "Show _QR Code"
749 +msgstr "Wyświetl kod _QR"
750 +
751 +#: ../src/resources/gtk/menus.ui.h:2
752 +msgid "_About"
753 +msgstr "_O programie"
754 +
755 +#: ../src/resources/ui/appslistpanel.ui.h:1
756 +msgid "Type to search"
757 +msgstr "Wyszukiwanie"
758 +
759 +#: ../src/resources/ui/window.ui.h:2
760 +msgid "All Applications"
761 +msgstr "Wszystkie programy"
762 +
763 +#. FIXME: just a test message until we have UI to type the reply
764 +#: ../src/smsnotification.vala:63
765 +msgid "Reply"
766 +msgstr "Odpowiedz"
767 --- nuntius-linux-0.2.0.orig/po/sk.po
768 +++ nuntius-linux-0.2.0/po/sk.po
769 @@ -1,22 +1,21 @@
770 # SOME DESCRIPTIVE TITLE.
771 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
772 # This file is distributed under the same license as the PACKAGE package.
773 -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
774 +# Dušan Kazik <[email protected]>, 2015.
775 #
776 msgid ""
777 msgstr ""
778 -"Project-Id-Version: \n"
779 +"Project-Id-Version: nuntius-linux\n"
780 "Report-Msgid-Bugs-To: \n"
781 -"POT-Creation-Date: 2015-03-11 11:24+0100\n"
782 -"PO-Revision-Date: 2015-03-11 13:12+0100\n"
783 +"POT-Creation-Date: 2016-07-15 17:00+0200\n"
784 +"PO-Revision-Date: 2015-03-20 18:28+0100\n"
785 +"Last-Translator: Dušan Kazik <[email protected]>\n"
786 +"Language-Team: \n"
787 +"Language: sk\n"
788 "MIME-Version: 1.0\n"
789 "Content-Type: text/plain; charset=UTF-8\n"
790 "Content-Transfer-Encoding: 8bit\n"
791 -"Last-Translator: Dušan Kazik <[email protected]>\n"
792 -"Language-Team: \n"
793 -"X-Generator: Poedit 1.7.4\n"
794 "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
795 -"Language: sk\n"
796
797 #: ../data/org.holylobster.nuntius.appdata.xml.in.h:1
798 msgid ""
799 @@ -31,8 +30,8 @@ msgid ""
800 "To use Nuntius you will need to install a companion tool on your phone or "
801 "tablet and pair it via Bluetooth."
802 msgstr ""
803 -"Na používanie programu Nuntius budete musieť vo vašom telefóne alebo "
804 -"tablete nainštalovať spoločný nástroj a spárovať ho cez Bluetooth."
805 +"Na používanie programu Nuntius budete musieť vo vašom telefóne alebo tablete "
806 +"nainštalovať spoločný nástroj a spárovať ho cez Bluetooth."
807
808 #: ../data/org.holylobster.nuntius.desktop.in.h:1
809 msgid ""
810 @@ -45,3 +44,75 @@ msgstr ""
811 #: ../data/org.holylobster.nuntius.desktop.in.h:2
812 msgid "notifications;"
813 msgstr "oznámenia;upozornenia;"
814 +
815 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:1
816 +msgid "Window state"
817 +msgstr "Stav okna"
818 +
819 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:2
820 +msgid "State of the window, e.g. maximized."
821 +msgstr "Stav okna, napr. maximalizované."
822 +
823 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:3
824 +msgid "Window width and height"
825 +msgstr "Šírka a výška okna"
826 +
827 +#: ../data/org.holylobster.nuntius.gschema.xml.in.h:4
828 +msgid "Width and height of the window."
829 +msgstr "Šírka a výška okna."
830 +
831 +#: ../src/application.vala:144
832 +msgid "Connect to a specific server"
833 +msgstr ""
834 +
835 +#: ../src/application.vala:297
836 +msgid "Certificate Fingerprint"
837 +msgstr ""
838 +
839 +#: ../src/application.vala:300
840 +msgid "_OK"
841 +msgstr ""
842 +
843 +#: ../src/application.vala:469 ../src/resources/ui/window.ui.h:1
844 +msgid "Nuntius"
845 +msgstr "Nuntius"
846 +
847 +#: ../src/application.vala:472
848 +msgid ""
849 +"Deliver notifications from your phone or tablet to your computer over "
850 +"Bluetooth."
851 +msgstr ""
852 +"Doručenie oznámení z vášho telefónu alebo tabletu do vášho počítača cez "
853 +"Bluetooth."
854 +
855 +#: ../src/application.vala:477
856 +msgid "translator-credits"
857 +msgstr "Dušan Kazik <[email protected]>, 2015"
858 +
859 +#: ../src/appslist.vala:75
860 +#, fuzzy
861 +msgid "Blacklist this application"
862 +msgstr "Všetky aplikácie"
863 +
864 +#. namespace Nuntius
865 +#. ex:set ts=4 et:
866 +#: ../src/resources/gtk/menus.ui.h:1
867 +msgid "Show _QR Code"
868 +msgstr ""
869 +
870 +#: ../src/resources/gtk/menus.ui.h:2
871 +msgid "_About"
872 +msgstr "_O programe"
873 +
874 +#: ../src/resources/ui/appslistpanel.ui.h:1
875 +msgid "Type to search"
876 +msgstr "Text na vyhľadanie"
877 +
878 +#: ../src/resources/ui/window.ui.h:2
879 +msgid "All Applications"
880 +msgstr "Všetky aplikácie"
881 +
882 +#. FIXME: just a test message until we have UI to type the reply
883 +#: ../src/smsnotification.vala:63
884 +msgid "Reply"
885 +msgstr ""
886 --- nuntius-linux-0.2.0.orig/src/application.vala
887 +++ nuntius-linux-0.2.0/src/application.vala
888 @@ -34,72 +34,116 @@ public interface BluezProfileManager : O
889 public abstract void unregister_profile(ObjectPath profile) throws IOError;
890 }
891
892 -[DBus (name = "org.bluez.Profile1")]
893 -public class BluezProfile : Object {
894 - HashTable<ObjectPath, DeviceConnection>? connections;
895 +public class Connections : Object {
896 + private HashTable<string, Connection>? connections;
897
898 - public BluezProfile(Cancellable cancellable) {
899 - connections = new HashTable<ObjectPath, DeviceConnection>(str_hash, str_equal);
900 -
901 - cancellable.connect(() => {
902 - connections.remove_all();
903 - });
904 - }
905 -
906 - public void release() {
907 - print("release method called\n");
908 + construct {
909 + connections = new HashTable<string, Connection>(str_hash, str_equal);
910 }
911
912 - public void new_connection(ObjectPath device, Socket socket, HashTable<string, Variant> fd_properties) {
913 - print("new_connection method called for device: %s\n", device);
914 - var connection = new DeviceConnection(device, socket);
915 -
916 - connections.insert(device, connection);
917 + public void add_connection(Connection connection) {
918 + connections.insert(connection.server_name, connection);
919 connection.notify["connected"].connect(() => {
920 if (!connection.connected) {
921 - connections.remove(connection.device);
922 - print("removed connection for device '%s'\n", connection.device);
923 + connections.remove(connection.server_name);
924 + print("removed connection for device '%s'\n",
925 + connection.server_name);
926 }
927 });
928
929 connection.notification_posted.connect((notification) => {
930 - var app = GLib.Application.get_default();
931 - (app as Application).add_notification(notification);
932 + var app = (Application) GLib.Application.get_default();
933 + app.add_notification(notification);
934 + });
935 +
936 + connection.sms_received.connect((sms_notification) => {
937 + var app = (Application) GLib.Application.get_default();
938 + app.add_sms_notification(sms_notification);
939 });
940
941 connection.notification_removed.connect((id, package_name) => {
942 - var app = GLib.Application.get_default();
943 - (app as Application).mark_notification_read(id, package_name);
944 + var app = (Application) GLib.Application.get_default();
945 + app.mark_notification_read(id, package_name);
946 });
947 }
948
949 - public void request_disconnection(ObjectPath device) {
950 - print("request_disconnection method called for devices: %s\n", device);
951 -
952 - var device_connection = connections.lookup(device);
953 - if (device_connection != null) {
954 - connections.remove(device);
955 + public void remove_connection(string server_name) {
956 + var connection = connections.lookup(server_name);
957 + if (connection != null) {
958 + connections.remove(server_name);
959 }
960 }
961
962 - public bool has_any_device_connected() {
963 + public bool is_connected() {
964 return connections.size() > 0;
965 }
966
967 - public bool get_device_connected(ObjectPath device) {
968 - return connections.get(device) != null;
969 + public bool get_connected(string server_name) {
970 + return connections.get(server_name) != null;
971 }
972 }
973
974 +[DBus (name = "org.bluez.Profile1")]
975 +public class BluezProfile : Object {
976 + private Connections connections;
977 +
978 + public BluezProfile(Connections connections) {
979 + this.connections = connections;
980 + }
981 +
982 + public void release() {
983 + print("release method called\n");
984 + }
985 +
986 + public void new_connection(ObjectPath device, Socket socket, HashTable<string, Variant> fd_properties) {
987 + print("new_connection method called for device: %s\n", device);
988 + var connection = new Connection(device,
989 + SocketConnection.factory_create_connection(socket));
990 +
991 + connections.add_connection(connection);
992 + }
993 +
994 + public void request_disconnection(ObjectPath device) {
995 + print("request_disconnection method called for devices: %s\n", device);
996 +
997 + connections.remove_connection(device);
998 + }
999 +}
1000 +
1001 +private enum TcpConnectionStatus {
1002 + DISCONNECTED,
1003 + CONNECTING,
1004 + CONNECTED
1005 +}
1006 +
1007 public class Application : Gtk.Application {
1008 - Cancellable? cancellable;
1009 - DBusObjectManager manager;
1010 - BluezProfileManager? profile_manager;
1011 - BluezProfile? profile;
1012 - uint connect_devices_id;
1013 - bool first_activation;
1014 - Window window;
1015 - List<NotificationApp> _notification_apps;
1016 + private Cancellable? cancellable;
1017 + private Connections connections;
1018 + private DBusObjectManager manager;
1019 + private BluezProfileManager? profile_manager;
1020 + private BluezProfile? profile;
1021 + private uint connect_devices_id;
1022 + private bool first_activation;
1023 + private bool cert_created;
1024 + private Window window;
1025 + private string connect_host;
1026 + private TcpConnectionStatus tcp_status;
1027 + private TlsCertificate? cert;
1028 + private List<NotificationApp> _notification_apps;
1029 + private List<SmsNotification> sms_notifications;
1030 +
1031 + private const GLib.ActionEntry[] app_entries = {
1032 + { "about", on_about_activate },
1033 + { "show-qrcode", on_show_qrcode_activate },
1034 + { "open-notifications-view", on_open_notifications_view_activate, "(ss)"},
1035 + { "send-sms", on_send_sms_activate, "(ss)"}
1036 + };
1037 +
1038 + private const OptionEntry[] options = {
1039 + {"connect", '\0', 0, OptionArg.STRING, null,
1040 + N_("Connect to a specific server"), null},
1041 + {null}
1042 + };
1043
1044 public signal void notification_app_added(NotificationApp notification_app);
1045
1046 @@ -108,12 +152,16 @@ public class Application : Gtk.Applicati
1047 }
1048
1049 public Application() {
1050 - Object(application_id: "org.holylobster.nuntius");
1051 + Object(application_id: "org.holylobster.nuntius",
1052 + flags: ApplicationFlags.HANDLES_COMMAND_LINE);
1053 + add_main_option_entries(options);
1054 }
1055
1056 construct {
1057 cancellable = new Cancellable();
1058 + cert_created = false;
1059 first_activation = true;
1060 + tcp_status = TcpConnectionStatus.DISCONNECTED;
1061 _notification_apps = new List<NotificationApp>();
1062 }
1063
1064 @@ -137,6 +185,8 @@ public class Application : Gtk.Applicati
1065 // Since it works as a daemon keep a hold forever on the primary instance
1066 hold();
1067
1068 + add_action_entries(app_entries, this);
1069 +
1070 var css_provider = new Gtk.CssProvider();
1071 try {
1072 var file = File.new_for_uri("resource:///org/holylobster/nuntius/css/nuntius-style.css");
1073 @@ -148,7 +198,8 @@ public class Application : Gtk.Applicati
1074 css_provider,
1075 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
1076
1077 - profile = new BluezProfile(cancellable);
1078 + connections = new Connections();
1079 + profile = new BluezProfile(connections);
1080
1081 var profile_path = new ObjectPath(get_dbus_object_path() + "/Profile");
1082
1083 @@ -177,6 +228,8 @@ public class Application : Gtk.Applicati
1084 } catch (Error e) {
1085 warning("%s", e.message);
1086 }
1087 +
1088 + create_cert();
1089 }
1090
1091 private void ensure_window() {
1092 @@ -188,19 +241,134 @@ public class Application : Gtk.Applicati
1093 }
1094 }
1095
1096 + private string? spawn_command(string[] args) {
1097 + try {
1098 + string[] spawn_args = args;
1099 + string[] spawn_env = Environ.get ();
1100 + string ls_stdout;
1101 + string ls_stderr;
1102 + int ls_status;
1103 +
1104 + Process.spawn_sync (".",
1105 + spawn_args,
1106 + spawn_env,
1107 + SpawnFlags.SEARCH_PATH,
1108 + null,
1109 + out ls_stdout,
1110 + out ls_stderr,
1111 + out ls_status);
1112 + return ls_stdout;
1113 +
1114 + } catch (SpawnError e) {
1115 + stdout.printf ("Error: %s\n", e.message);
1116 + return null;
1117 + }
1118 + }
1119 +
1120 + private void create_cert() {
1121 + var path_to_conf = GLib.Path.build_filename(GLib.Environment.get_user_config_dir(), "nuntius");
1122 + var cert_path = GLib.Path.build_filename(path_to_conf, "nuntius.pem");
1123 + var key_path = GLib.Path.build_filename(path_to_conf, "nuntius.key");
1124 + var file = File.new_for_path(cert_path);
1125 + if (!file.query_exists()) {
1126 + var script = GLib.Path.build_filename(Config.TOOLSDIR, "createcert.sh");
1127 + string[] spawn_args = { script };
1128 + spawn_command(spawn_args);
1129 + cert_created = true;
1130 + }
1131 + try {
1132 + cert = new TlsCertificate.from_files(cert_path, key_path);
1133 + } catch (Error e) {
1134 + warning("Failed to load certificate: %s", e.message);
1135 + }
1136 + }
1137 +
1138 + private string get_fingerprint() {
1139 + string path_to_pem = GLib.Path.build_filename(GLib.Environment.get_user_config_dir(), "nuntius/nuntius.pem");
1140 + string[] spawn_args = {"openssl", "x509", "-in", path_to_pem, "-fingerprint", "-sha1"};
1141 + string result = spawn_command(spawn_args);
1142 + string[] splitted = result.split("=");
1143 + splitted = splitted[1].split("\n");
1144 + string fingerprint = splitted[0];
1145 + return fingerprint;
1146 + }
1147 +
1148 + private void show_qrcode() {
1149 + var dialog = new Gtk.Dialog.with_buttons(_("Certificate Fingerprint"),
1150 + window,
1151 + Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
1152 + _("_OK"),
1153 + Gtk.ResponseType.OK);
1154 + dialog.border_width = 30;
1155 + dialog.set_default_size(300, 300);
1156 +
1157 + dialog.response.connect(i => {
1158 + window.destroy();
1159 + });
1160 +
1161 + var qr = new Nuntius.QRImage();
1162 + qr.text = get_fingerprint() + "-" + GLib.Environment.get_host_name();
1163 + qr.show();
1164 +
1165 + dialog.get_content_area().pack_end(qr, true, true, 0);
1166 + dialog.show();
1167 + }
1168 +
1169 protected override void activate() {
1170 // We want it to start as a daemon and not showing the window from
1171 // the beginning
1172 if (!first_activation) {
1173 ensure_window();
1174 window.present();
1175 + if (cert_created) {
1176 + show_qrcode();
1177 + }
1178 }
1179
1180 first_activation = false;
1181
1182 + if (tcp_status == TcpConnectionStatus.DISCONNECTED && connect_host != null && cert != null) {
1183 + var host = connect_host;
1184 + var client = new SocketClient();
1185 +
1186 + tcp_status = TcpConnectionStatus.CONNECTING;
1187 +
1188 + client.tls = true;
1189 + client.event.connect(on_socket_client_event);
1190 + client.connect_to_host_async.begin(connect_host, 12233, cancellable, (obj, res) => {
1191 + try {
1192 + var connection = client.connect_to_host_async.end(res);
1193 + tcp_status = TcpConnectionStatus.CONNECTED;
1194 + connections.add_connection(new Connection(host, connection));
1195 + } catch (Error e) {
1196 + tcp_status = TcpConnectionStatus.DISCONNECTED;
1197 + warning("Could not connect to server: %s", connect_host);
1198 + }
1199 + });
1200 + }
1201 +
1202 base.activate();
1203 }
1204
1205 + private void on_socket_client_event(SocketClientEvent event, SocketConnectable? connectable, IOStream? ios) {
1206 + if (event == SocketClientEvent.TLS_HANDSHAKING) {
1207 + var tls = (TlsConnection) ios;
1208 + tls.accept_certificate.connect((cert, err) => {
1209 + return true;
1210 + });
1211 + tls.set_certificate(cert);
1212 + }
1213 + }
1214 +
1215 + protected override int command_line(ApplicationCommandLine cl) {
1216 + var dict = cl.get_options_dict();
1217 +
1218 + dict.lookup("connect", "s", out connect_host);
1219 + activate();
1220 +
1221 + return 0;
1222 + }
1223 +
1224 private async void connect_interface(DBusObject object, DBusInterface iface, bool dump) {
1225 if (!(iface is DBusProxy)) {
1226 return;
1227 @@ -217,7 +385,7 @@ public class Application : Gtk.Applicati
1228 }
1229
1230 // try to get the device
1231 - if (name == "org.bluez.Device1" && !profile.get_device_connected(path)) {
1232 + if (name == "org.bluez.Device1" && !connections.get_connected(path)) {
1233 try {
1234 BluezDeviceBus device = Bus.get_proxy_sync(BusType.SYSTEM, "org.bluez", path);
1235
1236 @@ -253,7 +421,7 @@ public class Application : Gtk.Applicati
1237 }
1238 }
1239
1240 - if (!profile.has_any_device_connected()) {
1241 + if (!connections.is_connected()) {
1242 // try to connect to the paired device every few seconds
1243 connect_devices_id = Timeout.add_seconds(5, on_try_to_connect_devices);
1244 }
1245 @@ -266,6 +434,66 @@ public class Application : Gtk.Applicati
1246 return false;
1247 }
1248
1249 + public void on_open_notifications_view_activate(GLib.SimpleAction action, GLib.Variant? parameter) {
1250 + string id, package_name;
1251 + parameter.get("(ss)", out id, out package_name);
1252 +
1253 + Notification? notification = null;
1254 + notification = get_notification(id, package_name);
1255 + if (notification == null) {
1256 + return;
1257 + }
1258 +
1259 + /* FIXME: just temporary until we add actions to the main UI */
1260 + if (notification.actions != null) {
1261 + var view = new TestView(notification);
1262 + view.show_all();
1263 + return;
1264 + }
1265 +
1266 + /* FIXME for now just raise the main window */
1267 + activate();
1268 + }
1269 +
1270 + private void on_about_activate() {
1271 + const string copyright = "Copyright \xc2\xa9 2015 Holy Lobster Team";
1272 +
1273 + const string authors[] = {
1274 + "Andrea Curtoni <[email protected]>",
1275 + "Ignacio Casal Quinteiro <[email protected]>",
1276 + "Paolo Borelli <[email protected]>",
1277 + null
1278 + };
1279 +
1280 + Gtk.show_about_dialog(window,
1281 + "program-name", _("Nuntius"),
1282 + "logo-icon-name", "nuntius",
1283 + "version", Config.VERSION,
1284 + "comments", _("Deliver notifications from your phone or tablet to your computer over Bluetooth."),
1285 + "copyright", copyright,
1286 + "authors", authors,
1287 + "license-type", Gtk.License.GPL_2_0,
1288 + "wrap-license", false,
1289 + "translator-credits", _("translator-credits"),
1290 + null);
1291 + }
1292 +
1293 + private void on_show_qrcode_activate() {
1294 + show_qrcode();
1295 + }
1296 +
1297 + public Notification? get_notification(string id, string package_name) {
1298 + foreach (var napp in notification_apps) {
1299 + if (napp.id == package_name) {
1300 + var notification = napp.get_notification(id);
1301 + if (notification != null) {
1302 + return notification;
1303 + }
1304 + }
1305 + }
1306 + return null;
1307 + }
1308 +
1309 public void add_notification(Notification notification) {
1310 bool found = false;
1311
1312 @@ -278,7 +506,7 @@ public class Application : Gtk.Applicati
1313 }
1314
1315 if (!found) {
1316 - var napp = new NotificationApp(notification.package_name);
1317 + var napp = new NotificationApp(notification.package_name, notification.connection);
1318 napp.add_notification(notification);
1319 _notification_apps.prepend(napp);
1320
1321 @@ -292,18 +520,45 @@ public class Application : Gtk.Applicati
1322 public void mark_notification_read(string id, string package_name) {
1323 Notification? notification = null;
1324
1325 - foreach (var napp in _notification_apps) {
1326 + notification = get_notification(id, package_name);
1327 +
1328 + if (notification != null) {
1329 + withdraw_notification(notification.id);
1330 + notification.read = true;
1331 + }
1332 + }
1333 +
1334 + public void blacklist_application(string package_name) {
1335 + foreach (var napp in notification_apps) {
1336 if (napp.id == package_name) {
1337 - notification = napp.get_notification(id);
1338 - break;
1339 + napp.blacklist();
1340 }
1341 }
1342 + }
1343
1344 - if (notification != null) {
1345 - withdraw_notification(notification.id);
1346 + public SmsNotification? get_sms_notification(string id) {
1347 + foreach (var sms_notification in sms_notifications) {
1348 + if (sms_notification.id == id) {
1349 + return sms_notification;
1350 + }
1351 + }
1352 + return null;
1353 + }
1354 +
1355 + public void add_sms_notification(SmsNotification sms_notification) {
1356 + sms_notifications.prepend(sms_notification);
1357 + send_notification(sms_notification.id, sms_notification.to_gnotification());
1358 + }
1359 +
1360 + public void on_send_sms_activate(GLib.SimpleAction action, GLib.Variant? parameter) {
1361 + string id, text;
1362 + parameter.get("(ss)", out id, out text);
1363 +
1364 + if (id != null && text != null) {
1365 + var sms_notification = get_sms_notification(id);
1366
1367 - if (!notification.read) {
1368 - notification.read = true;
1369 + if (sms_notification != null) {
1370 + sms_notification.send_sms_message(text);
1371 }
1372 }
1373 }
1374 --- nuntius-linux-0.2.0.orig/src/appslist.vala
1375 +++ nuntius-linux-0.2.0/src/appslist.vala
1376 @@ -25,9 +25,8 @@ public class AppsList : Gtk.ListBox {
1377 [GtkChild]
1378 private Gtk.Label label;
1379 [GtkChild]
1380 - private Gtk.Frame notifications_unread_frame;
1381 - [GtkChild]
1382 - private Gtk.Label notifications_unread_label;
1383 + private NotificationCounter notification_counter;
1384 + private Gtk.Menu menu;
1385
1386 private NotificationApp _notification_app;
1387
1388 @@ -40,9 +39,13 @@ public class AppsList : Gtk.ListBox {
1389 Object(notification_app: notification_app);
1390
1391 image.set_from_gicon(notification_app.icon, Gtk.IconSize.BUTTON);
1392 - notifications_unread_label.set_label(notification_app.unread_notifications.to_string());
1393 + notification_app.bind_property("unread-notifications",
1394 + notification_counter,
1395 + "counter",
1396 + BindingFlags.SYNC_CREATE);
1397 +
1398 if (notification_app.unread_notifications > 0) {
1399 - notifications_unread_frame.show();
1400 + notification_counter.show();
1401 label.set_markup("<b>" + notification_app.app_name + "</b>");
1402 } else {
1403 label.set_label(notification_app.app_name);
1404 @@ -57,8 +60,7 @@ public class AppsList : Gtk.ListBox {
1405 });
1406
1407 notification_app.notify["unread-notifications"].connect(() => {
1408 - notifications_unread_frame.set_visible(notification_app.unread_notifications > 0);
1409 - notifications_unread_label.set_label(notification_app.unread_notifications.to_string());
1410 + notification_counter.set_visible(notification_app.unread_notifications > 0);
1411
1412 if (notification_app.unread_notifications > 0) {
1413 label.set_markup("<b>" + notification_app.app_name + "</b>");
1414 @@ -67,6 +69,17 @@ public class AppsList : Gtk.ListBox {
1415 }
1416 });
1417 }
1418 +
1419 + public void show_popup_menu(Gdk.EventButton event) {
1420 + menu = new Gtk.Menu();
1421 + var item = new Gtk.MenuItem.with_label (_("Blacklist this application"));
1422 + item.activate.connect(() => {
1423 + notification_app.blacklist();
1424 + });
1425 + menu.append(item);
1426 + menu.show_all();
1427 + menu.popup(null, null, null, event.button, event.get_time());
1428 + }
1429 }
1430
1431 private string? filter_text;
1432 @@ -89,6 +102,24 @@ public class AppsList : Gtk.ListBox {
1433 var row = new AppRow(napp);
1434 add(row);
1435 });
1436 +
1437 + button_press_event.connect((event) => {
1438 + if (event.type == Gdk.EventType.BUTTON_PRESS &&
1439 + event.button == Gdk.BUTTON_SECONDARY) {
1440 + print("button press right click\n");
1441 + unselect_all();
1442 +
1443 + var row = get_row_at_y((int) event.y) as AppRow;
1444 + if (row != null) {
1445 + select_row(get_row_at_y((int) event.y));
1446 + row.show_popup_menu(event);
1447 + }
1448 +
1449 + return true;
1450 + }
1451 +
1452 + return false;
1453 + });
1454 }
1455
1456 private void update_header(Gtk.ListBoxRow row, Gtk.ListBoxRow? before) {
1457 --- nuntius-linux-0.2.0.orig/src/config.vapi
1458 +++ nuntius-linux-0.2.0/src/config.vapi
1459 @@ -4,5 +4,6 @@ namespace Config {
1460 public const string DATADIR;
1461 public const string GETTEXT_PACKAGE;
1462 public const string GNOMELOCALEDIR;
1463 + public const string TOOLSDIR;
1464 }
1465
1466 --- nuntius-linux-0.2.0.orig/src/connection.vala
1467 +++ nuntius-linux-0.2.0/src/connection.vala
1468 @@ -17,40 +17,48 @@
1469
1470 namespace Nuntius {
1471
1472 -public class DeviceConnection : Object {
1473 - Cancellable cancellable;
1474 - Socket socket;
1475 - SocketConnection? connection;
1476 - DataInputStream? input;
1477 - bool _connected;
1478 - ObjectPath _device;
1479 +public class Connection : Object {
1480 + private Cancellable cancellable;
1481 + private SocketConnection? _connection;
1482 + private DataInputStream? input;
1483 + private DataOutputStream? output;
1484 + private bool _connected;
1485 + private string _server_name;
1486
1487 public bool connected {
1488 get { return _connected; }
1489 set { _connected = value; }
1490 }
1491
1492 - public ObjectPath device {
1493 - get { return _device; }
1494 + public string server_name {
1495 + get { return _server_name; }
1496 + set construct { _server_name = value; }
1497 + }
1498 +
1499 + public SocketConnection? connection {
1500 + get { return _connection; }
1501 + set construct { _connection = value; }
1502 }
1503
1504 public signal void notification_posted(Notification notification);
1505
1506 + public signal void sms_received(SmsNotification notification);
1507 +
1508 public signal void notification_removed(string id, string package_name);
1509
1510 - public DeviceConnection(ObjectPath device, Socket socket) {
1511 - cancellable = new Cancellable();
1512 - this.socket = socket;
1513 - _connected = true;
1514 - _device = device;
1515 + public Connection(string server_name, SocketConnection connection) {
1516 + Object(connected: true, server_name: server_name, connection: connection);
1517
1518 - connection = SocketConnection.factory_create_connection(socket);
1519 - input = new DataInputStream(connection.get_input_stream());
1520 + input = new DataInputStream(_connection.get_input_stream());
1521 input.set_newline_type(DataStreamNewlineType.CR_LF);
1522 -
1523 + output = new DataOutputStream(_connection.get_output_stream());
1524 read_message();
1525 }
1526
1527 + construct {
1528 + cancellable = new Cancellable();
1529 + }
1530 +
1531 protected override void dispose() {
1532 if (cancellable != null) {
1533 cancellable.cancel();
1534 @@ -63,6 +71,15 @@ public class DeviceConnection : Object {
1535 base.dispose();
1536 }
1537
1538 + public void send_message(string msg) {
1539 + try {
1540 + output.put_string(msg + "\n");
1541 + } catch (Error e) {
1542 + print("Couldn't send message to " + _server_name);
1543 + }
1544 + print(msg);
1545 + }
1546 +
1547 void read_message() {
1548 input.read_line_async.begin(Priority.DEFAULT, cancellable, (obj, res) => {
1549 try {
1550 @@ -94,6 +111,7 @@ public class DeviceConnection : Object {
1551 case "notificationPosted":
1552 foreach (var i in eventItems) {
1553 Notification? notification = null;
1554 + string? key = null;
1555
1556 var object = i.get_object();
1557 var id = object.get_int_member("id").to_string();
1558 @@ -105,16 +123,36 @@ public class DeviceConnection : Object {
1559 icon = new BytesIcon(new Bytes(Base64.decode(object.get_string_member("icon"))));
1560 }
1561
1562 + if (object.has_member("key")) {
1563 + key = object.get_string_member("key");
1564 + }
1565 +
1566 var notification_object = object.get_object_member("notification");
1567 if (notification_object.has_member("title")) {
1568 var title = notification_object.get_string_member("title");
1569 string? text = null;
1570 + string? flags = null;
1571 + string[]? actions_string = null;
1572 +
1573 + if (notification_object.has_member("flags")) {
1574 + flags = notification_object.get_string_member("flags");
1575 + }
1576
1577 if (notification_object.has_member("text")) {
1578 text = notification_object.get_string_member("text");
1579 }
1580
1581 - notification = new Notification(id, package_name, app_name, title, text, icon);
1582 + if (notification_object.has_member("actions")) {
1583 + var actions = notification_object.get_array_member("actions").get_elements();
1584 + var number_of_actions = notification_object.get_array_member("actions").get_length();
1585 + actions_string = new string[number_of_actions];
1586 + var count = 0;
1587 + foreach (var action in actions) {
1588 + actions_string[count] = action.get_object().get_string_member("title");
1589 + count++;
1590 + }
1591 + }
1592 + notification = new Notification(this, id, package_name, app_name, title, flags, key, text, icon, actions_string);
1593
1594 notification_posted(notification);
1595 }
1596 @@ -125,12 +163,43 @@ public class DeviceConnection : Object {
1597 var object = i.get_object();
1598 var id = object.get_int_member("id").to_string();
1599 var package_name = object.get_string_member("packageName");
1600 -
1601 notification_removed(id, package_name);
1602 }
1603 break;
1604 case "listNotifications":
1605 break;
1606 + case "sms":
1607 + foreach (var i in eventItems) {
1608 + var object = i.get_object();
1609 + string? id = null;
1610 + string? sender = null;
1611 + string? sender_num = null;
1612 + string? msg = null;
1613 + BytesIcon? icon = null;
1614 +
1615 + if (object.has_member("id")) {
1616 + id = object.get_string_member("id");
1617 + }
1618 +
1619 + if (object.has_member("sender")) {
1620 + sender = object.get_string_member("sender");
1621 + }
1622 +
1623 + if (object.has_member("sender_num")) {
1624 + sender_num = object.get_string_member("sender_num");
1625 + }
1626 +
1627 + if (object.has_member("message")) {
1628 + msg = object.get_string_member("message");
1629 + }
1630 +
1631 + if (object.has_member("icon")) {
1632 + icon = new BytesIcon(new Bytes(Base64.decode(object.get_string_member("icon"))));
1633 + }
1634 + SmsNotification notification = new SmsNotification(this, id, sender, sender_num, msg, icon);
1635 + sms_received(notification);
1636 + }
1637 + break;
1638 default:
1639 warning("Unknown event: %s", event);
1640 break;
1641 --- nuntius-linux-0.2.0.orig/src/main.vala
1642 +++ nuntius-linux-0.2.0/src/main.vala
1643 @@ -29,9 +29,9 @@ public static int main(string[] args) {
1644
1645 app = new Nuntius.Application();
1646
1647 - Unix.signal_add(Posix.SIGINT, on_terminate_app);
1648 - Unix.signal_add(Posix.SIGHUP, on_terminate_app);
1649 - Unix.signal_add(Posix.SIGTERM, on_terminate_app);
1650 + Unix.signal_add(Posix.Signal.INT, on_terminate_app);
1651 + Unix.signal_add(Posix.Signal.HUP, on_terminate_app);
1652 + Unix.signal_add(Posix.Signal.TERM, on_terminate_app);
1653
1654 return app.run(args);
1655 }
1656 --- nuntius-linux-0.2.0.orig/src/notification.vala
1657 +++ nuntius-linux-0.2.0/src/notification.vala
1658 @@ -18,52 +18,86 @@
1659 namespace Nuntius {
1660
1661 public class Notification : Object {
1662 - private string _id;
1663 - private string _package_name;
1664 - private string _app_name;
1665 - private string _title;
1666 - private string _body;
1667 - private BytesIcon _icon;
1668 - private bool _read;
1669 -
1670 - public string id {
1671 - get { return _id; }
1672 - set construct { _id = value; }
1673 - }
1674 -
1675 - public string package_name {
1676 - get { return _package_name; }
1677 - set construct { _package_name = value; }
1678 - }
1679 + public string id { get; construct set; }
1680 + public string package_name { get; construct set; }
1681 + public string app_name { get; construct set; }
1682 + public string title { get; construct set; }
1683 + public string body { get; construct set; }
1684 + public string? flag { get; construct set; }
1685 + public string? key { get; construct set; }
1686 + public BytesIcon icon { get; construct set; }
1687 + public string[]? actions { get; construct set; }
1688 + public Connection connection { get; construct set; }
1689
1690 - public string app_name {
1691 - get { return _app_name; }
1692 - set construct { _app_name = value; }
1693 - }
1694 + private bool _read = false;
1695
1696 - public string title {
1697 - get { return _title; }
1698 - set construct { _title = value; }
1699 - }
1700 -
1701 - public string body {
1702 - get { return _body; }
1703 - set construct { _body = value; }
1704 + [CCode (notify = false)]
1705 + public bool read {
1706 + get {
1707 + return _read;
1708 + }
1709 + set {
1710 + if (_read != value) {
1711 + _read = value;
1712 + notify_property("read");
1713 + }
1714 + }
1715 }
1716
1717 - public BytesIcon icon {
1718 - get { return _icon; }
1719 - set construct { _icon = value; }
1720 + public Notification(Connection connection, string id, string package_name, string app_name, string title, string? flag, string? key, string? body, BytesIcon? icon, string[]? actions) {
1721 + Object(connection: connection, id: id, package_name: package_name, app_name: app_name, title: title, flag: flag, key: key, body: body, icon: icon, actions: actions);
1722 }
1723
1724 - public bool read {
1725 - get { return _read; }
1726 - set { _read = value; }
1727 - default = false;
1728 - }
1729 + public void send_dismiss_message() {
1730 + Json.Builder builder = new Json.Builder();
1731 + builder.begin_object();
1732 + builder.set_member_name("event");
1733 + builder.add_string_value("dismiss");
1734 + builder.set_member_name("notification");
1735 + builder.begin_object();
1736 +
1737 + if (key != null){
1738 + builder.set_member_name("key");
1739 + builder.add_string_value(_key);
1740 + } else {
1741 + builder.set_member_name("packageName");
1742 + builder.add_string_value(_package_name);
1743 + builder.set_member_name("flag");
1744 + builder.add_string_value(_flag);
1745 + builder.set_member_name("id");
1746 + builder.add_string_value(_id);
1747 + }
1748 + builder.end_object();
1749 + builder.end_object();
1750
1751 - public Notification(string id, string package_name, string app_name, string title, string? body, BytesIcon? icon) {
1752 - Object(id: id, package_name: package_name, app_name: app_name, title: title, body: body, icon: icon);
1753 + Json.Generator generator = new Json.Generator();
1754 + Json.Node root = builder.get_root();
1755 + generator.set_root(root);
1756 + string dismiss_message = generator.to_data(null);
1757 + connection.send_message(dismiss_message);
1758 + }
1759 +
1760 + public void send_action_message(string s) {
1761 + Json.Builder builder = new Json.Builder();
1762 + builder.begin_object();
1763 + builder.set_member_name("event");
1764 + builder.add_string_value("action");
1765 + builder.set_member_name("action");
1766 + builder.begin_object();
1767 +
1768 + builder.set_member_name("key");
1769 + builder.add_string_value(_key);
1770 + builder.set_member_name("actionName");
1771 + builder.add_string_value(s);
1772 +
1773 + builder.end_object();
1774 + builder.end_object();
1775 +
1776 + Json.Generator generator = new Json.Generator();
1777 + Json.Node root = builder.get_root();
1778 + generator.set_root(root);
1779 + string action_message = generator.to_data(null);
1780 + connection.send_message(action_message);
1781 }
1782
1783 public GLib.Notification to_gnotification() {
1784 @@ -77,6 +111,9 @@ public class Notification : Object {
1785 notification.set_icon(icon);
1786 }
1787
1788 + var variant = new Variant("(ss)", id, package_name);
1789 + notification.set_default_action_and_target_value("app.open-notifications-view", variant);
1790 +
1791 return notification;
1792 }
1793 }
1794 --- nuntius-linux-0.2.0.orig/src/notificationapp.vala
1795 +++ nuntius-linux-0.2.0/src/notificationapp.vala
1796 @@ -18,16 +18,12 @@
1797 namespace Nuntius {
1798
1799 public class NotificationApp : Object {
1800 - private string _id;
1801 + public string id { get; construct set; }
1802 + public Connection connection { get; construct set; }
1803 private string _app_name;
1804 private BytesIcon _icon;
1805 private uint _unread_notifications;
1806 - List<Notification> _notifications;
1807 -
1808 - public string id {
1809 - get { return _id; }
1810 - set construct { _id = value; }
1811 - }
1812 + private List<Notification> _notifications;
1813
1814 public string app_name {
1815 get { return _app_name; }
1816 @@ -45,8 +41,8 @@ public class NotificationApp : Object {
1817 get { return _notifications; }
1818 }
1819
1820 - public NotificationApp(string id) {
1821 - Object(id: id);
1822 + public NotificationApp(string id, Connection connection) {
1823 + Object(id: id, connection: connection);
1824 }
1825
1826 construct {
1827 @@ -95,6 +91,28 @@ public class NotificationApp : Object {
1828
1829 return n;
1830 }
1831 +
1832 + public void blacklist() {
1833 + Json.Builder builder = new Json.Builder();
1834 + builder.begin_object();
1835 + builder.set_member_name("event");
1836 + builder.add_string_value("blacklist");
1837 + builder.set_member_name("app");
1838 + builder.begin_object();
1839 +
1840 + builder.set_member_name("packageName");
1841 + builder.add_string_value(id);
1842 +
1843 + builder.end_object();
1844 + builder.end_object();
1845 +
1846 + Json.Generator generator = new Json.Generator();
1847 + Json.Node root = builder.get_root();
1848 + generator.set_root(root);
1849 +
1850 + string blacklist_message = generator.to_data(null);
1851 + connection.send_message(blacklist_message);
1852 + }
1853 }
1854
1855 } // namespace Nuntius
1856 --- /dev/null
1857 +++ nuntius-linux-0.2.0/src/notificationcounter.vala
1858 @@ -0,0 +1,38 @@
1859 +/*
1860 + * Copyright (C) 2015 - Holy Lobster
1861 + *
1862 + * Nuntius is free software; you can redistribute it and/or modify
1863 + * it under the terms of the GNU General Public License as published by
1864 + * the Free Software Foundation; either version 2 of the License, or
1865 + * (at your option) any later version.
1866 + *
1867 + * Nuntius is distributed in the hope that it will be useful,
1868 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1869 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1870 + * GNU General Public License for more details.
1871 + *
1872 + * You should have received a copy of the GNU General Public License
1873 + * along with Nuntius. If not, see <http://www.gnu.org/licenses/>.
1874 + */
1875 +
1876 +namespace Nuntius {
1877 +
1878 +[GtkTemplate (ui = "/org/holylobster/nuntius/ui/notificationcounter.ui")]
1879 +public class NotificationCounter : Gtk.Frame {
1880 + private uint _counter;
1881 +
1882 + [GtkChild]
1883 + private Gtk.Label label_counter;
1884 +
1885 + public uint counter {
1886 + get { return _counter; }
1887 + set {
1888 + _counter = value;
1889 + label_counter.set_label(_counter.to_string());
1890 + }
1891 + }
1892 +}
1893 +
1894 +} // namespace Nuntius
1895 +
1896 +/* ex:set ts=4 et: */
1897 --- nuntius-linux-0.2.0.orig/src/notificationsview.vala
1898 +++ nuntius-linux-0.2.0/src/notificationsview.vala
1899 @@ -132,12 +132,21 @@ public class NotificationsView : Gtk.Tex
1900 buf.insert(ref it, "\n\n", -1);
1901 }
1902
1903 +#if VALA_0_28
1904 buf.insert_with_tags(ref it, notification.title, -1, notification_tag, title_tag, null);
1905
1906 if (notification.body != null) {
1907 buf.insert_with_tags(ref it, "\n\n", -1, notification_tag, null);
1908 buf.insert_with_tags(ref it, notification.body, -1, notification_tag, null);
1909 }
1910 +#else
1911 + buf.insert_with_tags(it, notification.title, -1, notification_tag, title_tag, null);
1912 +
1913 + if (notification.body != null) {
1914 + buf.insert_with_tags(it, "\n\n", -1, notification_tag, null);
1915 + buf.insert_with_tags(it, notification.body, -1, notification_tag, null);
1916 + }
1917 +#endif
1918
1919 buf.insert(ref it, "\n\n\n", -1);
1920
1921 --- /dev/null
1922 +++ nuntius-linux-0.2.0/src/qrencode.vapi
1923 @@ -0,0 +1,45 @@
1924 +
1925 +/*
1926 + * Minimal VAPI file for LIBQRENCODE Barcode library.
1927 + */
1928 +namespace Qrencode {
1929 +
1930 + [CCode (cheader_filename = "qrencode.h", cname = "QRcode", unref_function = "QRcode_free")]
1931 + public class QRcode {
1932 + [CCode (cname = "QRcode_encodeString")]
1933 + public QRcode.encodeString(string digits, int version, EcLevel level, Mode hint, int casesensitive);
1934 +
1935 + public int version;
1936 + public int width;
1937 + [CCode (array_length = false)]
1938 + public uint8[] data;
1939 + }
1940 +
1941 + [CCode (cheader_filename = "qrencode.h", cname="QRencLevel")]
1942 + public enum EcLevel {
1943 + [CCode (cname="QR_ECLEVEL_L")]
1944 + L,
1945 + [CCode (cname="QR_ECLEVEL_M")]
1946 + M,
1947 + [CCode (cname="QR_ECLEVEL_Q")]
1948 + Q,
1949 + [CCode (cname="QR_ECLEVEL_H")]
1950 + H
1951 + }
1952 +
1953 + [CCode (cheader_filename = "qrencode.h", cname="QRencodeMode")]
1954 + public enum Mode {
1955 + [CCode (cname="QR_MODE_NUL")]
1956 + NUL,
1957 + [CCode (cname="QR_MODE_NUM")]
1958 + NUM,
1959 + [CCode (cname="QR_MODE_AN")]
1960 + AN,
1961 + [CCode (cname="QR_MODE_8")]
1962 + B8,
1963 + [CCode (cname="QR_MODE_KANJI")]
1964 + KANJI,
1965 + [CCode (cname="QR_MODE_STRUCTURE")]
1966 + STRUCTURE
1967 + }
1968 +}
1969 --- /dev/null
1970 +++ nuntius-linux-0.2.0/src/qrimage.vala
1971 @@ -0,0 +1,86 @@
1972 +/*
1973 + * Copyright (C) 2015 - Holy Lobster
1974 + *
1975 + * Nuntius is free software; you can redistribute it and/or modify
1976 + * it under the terms of the GNU General Public License as published by
1977 + * the Free Software Foundation; either version 2 of the License, or
1978 + * (at your option) any later version.
1979 + *
1980 + * Nuntius is distributed in the hope that it will be useful,
1981 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1982 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1983 + * GNU General Public License for more details.
1984 + *
1985 + * You should have received a copy of the GNU General Public License
1986 + * along with Nuntius. If not, see <http://www.gnu.org/licenses/>.
1987 + */
1988 +
1989 +namespace Nuntius {
1990 +
1991 +public class QRImage : Gtk.DrawingArea {
1992 + private string _text;
1993 + private Qrencode.QRcode? qrcode;
1994 + private const double MIN_SQUARE_SIZE = 1.0;
1995 +
1996 + [CCode (notify = false)]
1997 + public string text {
1998 + get { return _text; }
1999 + set {
2000 + if (_text != value) {
2001 + _text = value;
2002 + qrcode = new Qrencode.QRcode.encodeString(_text, 0,
2003 + Qrencode.EcLevel.M,
2004 + Qrencode.Mode.B8, 1);
2005 + notify_property("text");
2006 +
2007 + queue_draw();
2008 + }
2009 + }
2010 + }
2011 +
2012 + protected override bool draw(Cairo.Context cr) {
2013 + if (qrcode != null) {
2014 + uint width, height;
2015 +
2016 + width = get_allocated_width();
2017 + height = get_allocated_height();
2018 +
2019 + /* make it square */
2020 + if (height < width) {
2021 + width = height;
2022 + }
2023 +
2024 + double square_size = width / qrcode.width;
2025 + if (square_size < MIN_SQUARE_SIZE) {
2026 + square_size = MIN_SQUARE_SIZE;
2027 + }
2028 +
2029 + cr.save();
2030 +
2031 + cr.set_source_rgb(0, 0, 0);
2032 +
2033 + for (int iy = 0; iy < qrcode.width; iy++) {
2034 + for (int ix = 0; ix < qrcode.width; ix++) {
2035 + /* Symbol data is represented as an array contains
2036 + * width*width uchars. Each uchar represents a module
2037 + * (dot). If the less significant bit of the uchar
2038 + * is 1, the corresponding module is black. The other
2039 + * bits are meaningless for us.
2040 + */
2041 + if ((qrcode.data[iy * qrcode.width + ix] & 1) != 0) {
2042 + cr.rectangle(ix * square_size, iy * square_size, square_size, square_size);
2043 + cr.fill();
2044 + }
2045 + }
2046 + }
2047 +
2048 + cr.restore();
2049 + }
2050 +
2051 + return false;
2052 + }
2053 +}
2054 +
2055 +} // namespace Nuntius
2056 +
2057 +/* ex:set ts=4 et: */
2058 --- nuntius-linux-0.2.0.orig/src/resources/css/nuntius-style.css
2059 +++ nuntius-linux-0.2.0/src/resources/css/nuntius-style.css
2060 @@ -39,7 +39,7 @@ NuntiusAppsListPanel.frame:dir(rtl) {
2061 background-color: transparent;
2062 }
2063
2064 -.nuntius-notifications-unread {
2065 +NuntiusNotificationCounter {
2066 border-style: none;
2067 border-radius: 10px;
2068 background-color: darker(@theme_selected_bg_color);
2069 --- /dev/null
2070 +++ nuntius-linux-0.2.0/src/resources/gtk/menus.ui
2071 @@ -0,0 +1,16 @@
2072 +<?xml version="1.0"?>
2073 +<interface>
2074 + <!-- interface-requires gtk+ 3.0 -->
2075 + <menu id="app-menu">
2076 + <section>
2077 + <item>
2078 + <attribute name="label" translatable="yes">Show _QR Code</attribute>
2079 + <attribute name="action">app.show-qrcode</attribute>
2080 + </item>
2081 + <item>
2082 + <attribute name="label" translatable="yes">_About</attribute>
2083 + <attribute name="action">app.about</attribute>
2084 + </item>
2085 + </section>
2086 + </menu>
2087 +</interface>
2088 --- nuntius-linux-0.2.0.orig/src/resources/nuntius.gresource.xml
2089 +++ nuntius-linux-0.2.0/src/resources/nuntius.gresource.xml
2090 @@ -4,6 +4,8 @@
2091 <file preprocess="xml-stripblanks">ui/window.ui</file>
2092 <file preprocess="xml-stripblanks">ui/appslistpanel.ui</file>
2093 <file preprocess="xml-stripblanks">ui/approw.ui</file>
2094 + <file preprocess="xml-stripblanks">ui/notificationcounter.ui</file>
2095 + <file preprocess="xml-stripblanks">gtk/menus.ui</file>
2096 <file>css/nuntius-style.css</file>
2097 </gresource>
2098 </gresources>
2099 --- nuntius-linux-0.2.0.orig/src/resources/ui/approw.ui
2100 +++ nuntius-linux-0.2.0/src/resources/ui/approw.ui
2101 @@ -38,24 +38,11 @@
2102 </packing>
2103 </child>
2104 <child>
2105 - <object class="GtkFrame" id="notifications_unread_frame">
2106 + <object class="NuntiusNotificationCounter" id="notification_counter">
2107 <property name="visible">False</property>
2108 <property name="can_focus">False</property>
2109 <property name="halign">end</property>
2110 <property name="valign">center</property>
2111 - <style>
2112 - <class name="nuntius-notifications-unread"/>
2113 - </style>
2114 - <child>
2115 - <object class="GtkLabel" id="notifications_unread_label">
2116 - <property name="visible">True</property>
2117 - <property name="can_focus">False</property>
2118 - <property name="halign">start</property>
2119 - <property name="valign">center</property>
2120 - <property name="ellipsize">end</property>
2121 - <property name="label">50</property>
2122 - </object>
2123 - </child>
2124 </object>
2125 <packing>
2126 <property name="left_attach">2</property>
2127 --- /dev/null
2128 +++ nuntius-linux-0.2.0/src/resources/ui/notificationcounter.ui
2129 @@ -0,0 +1,17 @@
2130 +<?xml version="1.0" encoding="UTF-8"?>
2131 +<!-- Generated with glade 3.18.1 -->
2132 +<interface>
2133 + <template class="NuntiusNotificationCounter" parent="GtkFrame">
2134 + <property name="can_focus">False</property>
2135 + <property name="shadow_type">none</property>
2136 + <child>
2137 + <object class="GtkLabel" id="label_counter">
2138 + <property name="visible">True</property>
2139 + <property name="can_focus">False</property>
2140 + <property name="halign">center</property>
2141 + <property name="valign">center</property>
2142 + <property name="ellipsize">end</property>
2143 + </object>
2144 + </child>
2145 + </template>
2146 +</interface>
2147 --- /dev/null
2148 +++ nuntius-linux-0.2.0/src/smsnotification.vala
2149 @@ -0,0 +1,69 @@
2150 +/*
2151 + * Copyright (C) 2015 - Holy Lobster
2152 + *
2153 + * Nuntius is free software; you can redistribute it and/or modify
2154 + * it under the terms of the GNU General Public License as published by
2155 + * the Free Software Foundation; either version 2 of the License, or
2156 + * (at your option) any later version.
2157 + *
2158 + * Nuntius is distributed in the hope that it will be useful,
2159 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2160 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2161 + * GNU General Public License for more details.
2162 + *
2163 + * You should have received a copy of the GNU General Public License
2164 + * along with Nuntius. If not, see <http://www.gnu.org/licenses/>.
2165 + */
2166 +namespace Nuntius {
2167 +
2168 +public class SmsNotification : Object {
2169 + public string id { get; construct set; }
2170 + public string sender { get; construct set; }
2171 + public string sender_num { get; construct set; }
2172 + public string message { get; construct set; }
2173 + public BytesIcon icon { get; construct set; }
2174 + public Connection connection { get; construct set; }
2175 +
2176 + public SmsNotification(Connection connection, string id, string sender, string sender_num, string message, BytesIcon icon) {
2177 + Object(connection: connection, id: id, sender: sender, sender_num: sender_num, message: message, icon: icon);
2178 + }
2179 +
2180 + public void send_sms_message(string message) {
2181 + Json.Builder builder = new Json.Builder();
2182 + builder.begin_object();
2183 + builder.set_member_name("event");
2184 + builder.add_string_value("sms");
2185 + builder.set_member_name("sms");
2186 + builder.begin_object();
2187 +
2188 + builder.set_member_name("senderNum");
2189 + builder.add_string_value(_sender_num);
2190 +
2191 + builder.set_member_name("msg");
2192 + builder.add_string_value(message);
2193 +
2194 + builder.end_object();
2195 + builder.end_object();
2196 +
2197 + Json.Generator generator = new Json.Generator();
2198 + Json.Node root = builder.get_root();
2199 + generator.set_root(root);
2200 + string sms_message = generator.to_data(null);
2201 + connection.send_message(sms_message);
2202 + }
2203 +
2204 + public GLib.Notification to_gnotification() {
2205 + GLib.Notification notification = new GLib.Notification(sender);
2206 +
2207 + notification.set_body(message);
2208 + notification.set_icon(icon);
2209 +
2210 + // FIXME: just a test message until we have UI to type the reply
2211 + var variant = new Variant("(ss)", id, "Sent by Nuntius");
2212 + notification.add_button_with_target_value(_("Reply"),"app.send-sms", variant);
2213 +
2214 + return notification;
2215 + }
2216 +}
2217 +
2218 +}
2219 --- /dev/null
2220 +++ nuntius-linux-0.2.0/src/testview.vala
2221 @@ -0,0 +1,92 @@
2222 +/*
2223 + * Copyright (C) 2015 - Holy Lobster
2224 + *
2225 + * Nuntius is free software; you can redistribute it and/or modify
2226 + * it under the terms of the GNU General Public License as published by
2227 + * the Free Software Foundation; either version 2 of the License, or
2228 + * (at your option) any later version.
2229 + *
2230 + * Nuntius is distributed in the hope that it will be useful,
2231 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2232 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2233 + * GNU General Public License for more details.
2234 + *
2235 + * You should have received a copy of the GNU General Public License
2236 + * along with Nuntius. If not, see <http://www.gnu.org/licenses/>.
2237 + */
2238 +
2239 +namespace Nuntius {
2240 +
2241 +/* Just a temporary UI to send actions, this should go in the main UI */
2242 +public class TestView : Gtk.Window {
2243 +
2244 + Notification notification;
2245 +
2246 + public TestView(Notification notification) {
2247 + this.notification = notification;
2248 +
2249 + // Sets the title of the Window:
2250 + this.title = notification.title;
2251 +
2252 + // Center window at startup:
2253 + this.window_position = Gtk.WindowPosition.CENTER;
2254 +
2255 + // Sets the default size of a window:
2256 + this.set_default_size(500,150);
2257 +
2258 + // Whether the titlebar should be hidden during maximization.
2259 + this.hide_titlebar_when_maximized = false;
2260 +
2261 + // Method called on pressing [X]
2262 + this.destroy.connect(() => {
2263 + stdout.printf("Bye!\n");
2264 + });
2265 +
2266 + Gtk.Box vertical_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
2267 + vertical_box.set_margin_left(20);
2268 + vertical_box.set_margin_right(20);
2269 + this.add(vertical_box);
2270 +
2271 + Gtk.Box notification_area = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 10);
2272 + vertical_box.pack_start(notification_area);
2273 +
2274 + Gtk.Image icon = new Gtk.Image();
2275 + icon.set_from_gicon(notification.icon, Gtk.IconSize.DIALOG);
2276 + notification_area.pack_start(icon);
2277 +
2278 + var label = new Gtk.Label(notification.body);
2279 + notification_area.pack_start(label);
2280 +
2281 + Gtk.Box button_area = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 10);
2282 + vertical_box.pack_start(button_area, false, false, 10);
2283 + var dismiss_button = new Gtk.Button.with_label("Dismiss");
2284 +
2285 + dismiss_button.clicked.connect(() => {
2286 + notification.send_dismiss_message();
2287 + });
2288 +
2289 + button_area.pack_start(dismiss_button);
2290 +
2291 + if (notification.actions != null) {
2292 + var actions = notification.actions;
2293 + foreach(string s in actions) {
2294 + var action_button = new Gtk.Button.with_label(s);
2295 + button_area.pack_start(action_button);
2296 + action_button.clicked.connect(() => {
2297 + notification.send_action_message(s);
2298 + });
2299 + }
2300 + }
2301 +
2302 + var blacklist_button = new Gtk.Button.with_label("Blacklist this app");
2303 +
2304 + blacklist_button.clicked.connect(() => {
2305 + var app = (Application) GLib.Application.get_default();
2306 + app.blacklist_application(notification.package_name);
2307 + });
2308 +
2309 + button_area.pack_start(blacklist_button);
2310 + }
2311 +}
2312 +
2313 +}
2314 --- nuntius-linux-0.2.0.orig/src/window.vala
2315 +++ nuntius-linux-0.2.0/src/window.vala
2316 @@ -26,14 +26,50 @@ public class Window : Gtk.ApplicationWin
2317 [GtkChild]
2318 private Gtk.HeaderBar titlebar_right;
2319
2320 + private GLib.Settings settings;
2321 +
2322 public Window(Application app) {
2323 Object(application: app);
2324 }
2325
2326 construct {
2327 + settings = new Settings("org.holylobster.nuntius.state.window");
2328 + settings.delay ();
2329 +
2330 + destroy.connect(() => {
2331 + settings.apply();
2332 + });
2333 +
2334 + // Setup window geometry saving
2335 + Gdk.WindowState window_state = (Gdk.WindowState)settings.get_int("state");
2336 + if (Gdk.WindowState.MAXIMIZED in window_state) {
2337 + maximize();
2338 + }
2339 +
2340 + int width, height;
2341 + settings.get ("size", "(ii)", out width, out height);
2342 + resize(width, height);
2343 +
2344 apps_list_panel.selection_changed.connect(on_selection_changed);
2345 }
2346
2347 + protected override bool configure_event(Gdk.EventConfigure event) {
2348 + if (get_realized() && !(Gdk.WindowState.MAXIMIZED in get_window ().get_state())) {
2349 + settings.set("size", "(ii)", event.width, event.height);
2350 + }
2351 +
2352 + return base.configure_event(event);
2353 + }
2354 +
2355 + protected override bool window_state_event(Gdk.EventWindowState event) {
2356 + settings.set_int("state", event.new_window_state);
2357 + return base.window_state_event(event);
2358 + }
2359 +
2360 + protected override bool delete_event(Gdk.EventAny event) {
2361 + return base.hide_on_delete();
2362 + }
2363 +
2364 private void on_selection_changed(NotificationApp? notification_app) {
2365 if (notification_app == null) {
2366 titlebar_right.title = null;
2367 --- /dev/null
2368 +++ nuntius-linux-0.2.0/tests/qrtest.vala
2369 @@ -0,0 +1,38 @@
2370 +/*
2371 + * Copyright (C) 2015 - Holy Lobster
2372 + *
2373 + * Nuntius is free software; you can redistribute it and/or modify
2374 + * it under the terms of the GNU General Public License as published by
2375 + * the Free Software Foundation; either version 2 of the License, or
2376 + * (at your option) any later version.
2377 + *
2378 + * Nuntius is distributed in the hope that it will be useful,
2379 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2380 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2381 + * GNU General Public License for more details.
2382 + *
2383 + * You should have received a copy of the GNU General Public License
2384 + * along with Nuntius. If not, see <http://www.gnu.org/licenses/>.
2385 + */
2386 +
2387 +public static int main(string[] args) {
2388 + Gtk.init(ref args);
2389 +
2390 + var window = new Gtk.Window();
2391 + window.title = "QR Test";
2392 + window.border_width = 10;
2393 + window.set_default_size(350, 70);
2394 + window.destroy.connect(Gtk.main_quit);
2395 +
2396 + var qr = new Nuntius.QRImage();
2397 + qr.text = "This is a test";
2398 +
2399 + window.add(qr);
2400 + window.show_all();
2401 +
2402 + Gtk.main();
2403 +
2404 + return 0;
2405 +}
2406 +
2407 +/* ex:set ts=4 et: */