Merge lp:~osmoma/audio-recorder/trunk into lp:audio-recorder

Proposed by moma
Status: Merged
Approved by: moma
Approved revision: no longer in the source branch.
Merged at revision: 498
Proposed branch: lp:~osmoma/audio-recorder/trunk
Merge into: lp:audio-recorder
Diff against target: 1554 lines (+511/-543)
30 files modified
ChangeLog (+6/-0)
Makefile.in (+0/-1)
aclocal.m4 (+0/-25)
configure (+10/-49)
configure.ac (+1/-1)
data/Makefile.in (+0/-1)
debian/changelog (+11/-3)
icons/Makefile.in (+0/-1)
icons/hicolor/Makefile.in (+0/-1)
icons/hicolor/scalable/Makefile.in (+0/-1)
icons/hicolor/scalable/apps/Makefile.in (+0/-1)
icons/hicolor/scalable/status/Makefile.in (+0/-1)
linux-distros/arch-linux/PKGBUILD (+3/-3)
linux-distros/fedora/audio-recorder.spec (+1/-1)
pixmaps/Makefile.in (+0/-1)
po/POTFILES.in (+2/-2)
src/Makefile.am (+1/-1)
src/Makefile.in (+3/-4)
src/audio-sources.c (+1/-1)
src/dbus-mpris2.c (+24/-6)
src/gtklevelbar.c (+0/-357)
src/gtklevelbar.h (+0/-60)
src/levelbar.c (+357/-0)
src/levelbar.h (+60/-0)
src/main.c (+13/-13)
src/rec-window.h (+2/-2)
src/settings.c (+1/-1)
src/systray-icon.c (+1/-1)
src/utility.c (+13/-4)
src/utility.h (+1/-1)
To merge this branch: bzr merge lp:~osmoma/audio-recorder/trunk
Reviewer Review Type Date Requested Status
moma Approve
Review via email: mp+255223@code.launchpad.net

Commit message

dbus-mpris.c: MPRIS2 'Metdata' is not necessary if 'PlaybackStatus'=='Playing'. Missing 'Metadata' is actually an error but the recorder can survive without it.

Description of the change

Merge changes (from moma) to lp:audio-recorder.

To post a comment you must log in.
Revision history for this message
moma (osmoma) wrote :

This change should be OK.

review: Approve
lp:~osmoma/audio-recorder/trunk updated
491. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

492. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

493. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

494. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

495. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

496. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

497. By Launchpad Translations on behalf of audio-recorder

Launchpad automatic translations update.

498. By moma

Pushing my changes, revisions 471 - 477 of ~osmoma.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2015-03-17 16:24:30 +0000
3+++ ChangeLog 2015-04-11 20:15:48 +0000
4@@ -1,3 +1,9 @@
5+2015-04-11 Osmo Antero <osmoma@gmail.com>
6+
7+ * Version 1.6-4
8+ * GTK3+ has now a standard GtkLevelBar widget. Renamed our 'GtkLevelBar' widget to 'LevelBar'.
9+ * Renamed src/gtklevelbar.[ch] to src/levelbar.[ch].
10+
11 2015-03-17 Osmo Antero <osmoma@gmail.com>
12
13 * Version 1.6-3
14
15=== modified file 'Makefile.in'
16--- Makefile.in 2015-02-10 20:45:27 +0000
17+++ Makefile.in 2015-04-11 20:15:48 +0000
18@@ -237,7 +237,6 @@
19 CXXDEPMODE = @CXXDEPMODE@
20 CXXFLAGS = @CXXFLAGS@
21 CYGPATH_W = @CYGPATH_W@
22-DATADIRNAME = @DATADIRNAME@
23 DBUS_CFLAGS = @DBUS_CFLAGS@
24 DBUS_LIBS = @DBUS_LIBS@
25 DEFS = @DEFS@
26
27=== modified file 'aclocal.m4'
28--- aclocal.m4 2014-09-24 13:51:15 +0000
29+++ aclocal.m4 2015-04-11 20:15:48 +0000
30@@ -238,31 +238,6 @@
31 # Substitute ALL_LINGUAS so we can use it in po/Makefile
32 AC_SUBST(ALL_LINGUAS)
33
34-# Set DATADIRNAME correctly if it is not set yet
35-# (copied from glib-gettext.m4)
36-if test -z "$DATADIRNAME"; then
37- AC_LINK_IFELSE(
38- [AC_LANG_PROGRAM([[]],
39- [[extern int _nl_msg_cat_cntr;
40- return _nl_msg_cat_cntr]])],
41- [DATADIRNAME=share],
42- [case $host in
43- *-*-solaris*)
44- dnl On Solaris, if bind_textdomain_codeset is in libc,
45- dnl GNU format message catalog is always supported,
46- dnl since both are added to the libc all together.
47- dnl Hence, we'd like to go with DATADIRNAME=share
48- dnl in this case.
49- AC_CHECK_FUNC(bind_textdomain_codeset,
50- [DATADIRNAME=share], [DATADIRNAME=lib])
51- ;;
52- *)
53- [DATADIRNAME=lib]
54- ;;
55- esac])
56-fi
57-AC_SUBST(DATADIRNAME)
58-
59 IT_PO_SUBDIR([po])
60
61 ])
62
63=== modified file 'configure'
64--- configure 2015-03-17 16:24:30 +0000
65+++ configure 2015-04-11 20:15:48 +0000
66@@ -1,6 +1,6 @@
67 #! /bin/sh
68 # Guess values for system-dependent variables and create Makefiles.
69-# Generated by GNU Autoconf 2.69 for Audio Recorder 1.6-3.
70+# Generated by GNU Autoconf 2.69 for Audio Recorder 1.6-4.
71 #
72 # Report bugs to <https://bugs.launchpad.net/audio-recorder/+filebug>.
73 #
74@@ -581,8 +581,8 @@
75 # Identity of this package.
76 PACKAGE_NAME='Audio Recorder'
77 PACKAGE_TARNAME='audio-recorder'
78-PACKAGE_VERSION='1.6-3'
79-PACKAGE_STRING='Audio Recorder 1.6-3'
80+PACKAGE_VERSION='1.6-4'
81+PACKAGE_STRING='Audio Recorder 1.6-4'
82 PACKAGE_BUGREPORT='https://bugs.launchpad.net/audio-recorder/+filebug'
83 PACKAGE_URL=''
84
85@@ -631,7 +631,6 @@
86 GLIB_COMPILE_SCHEMAS
87 gsettingsschemadir
88 GSETTINGS_DISABLE_SCHEMAS_COMPILE
89-DATADIRNAME
90 ALL_LINGUAS
91 INTLTOOL_PERL
92 GMSGFMT
93@@ -1364,7 +1363,7 @@
94 # Omit some internal or obsolete options to make the list less imposing.
95 # This message is too long to be a string in the A/UX 3.1 sh.
96 cat <<_ACEOF
97-\`configure' configures Audio Recorder 1.6-3 to adapt to many kinds of systems.
98+\`configure' configures Audio Recorder 1.6-4 to adapt to many kinds of systems.
99
100 Usage: $0 [OPTION]... [VAR=VALUE]...
101
102@@ -1430,7 +1429,7 @@
103
104 if test -n "$ac_init_help"; then
105 case $ac_init_help in
106- short | recursive ) echo "Configuration of Audio Recorder 1.6-3:";;
107+ short | recursive ) echo "Configuration of Audio Recorder 1.6-4:";;
108 esac
109 cat <<\_ACEOF
110
111@@ -1558,7 +1557,7 @@
112 test -n "$ac_init_help" && exit $ac_status
113 if $ac_init_version; then
114 cat <<\_ACEOF
115-Audio Recorder configure 1.6-3
116+Audio Recorder configure 1.6-4
117 generated by GNU Autoconf 2.69
118
119 Copyright (C) 2012 Free Software Foundation, Inc.
120@@ -1965,7 +1964,7 @@
121 This file contains any messages produced by compilers while
122 running configure, to aid debugging if configure makes a mistake.
123
124-It was created by Audio Recorder $as_me 1.6-3, which was
125+It was created by Audio Recorder $as_me 1.6-4, which was
126 generated by GNU Autoconf 2.69. Invocation command line was
127
128 $ $0 $@
129@@ -2828,7 +2827,7 @@
130
131 # Define the identity of the package.
132 PACKAGE='audio-recorder'
133- VERSION='1.6-3'
134+ VERSION='1.6-4'
135
136
137 cat >>confdefs.h <<_ACEOF
138@@ -8056,44 +8055,6 @@
139 # Substitute ALL_LINGUAS so we can use it in po/Makefile
140
141
142-# Set DATADIRNAME correctly if it is not set yet
143-# (copied from glib-gettext.m4)
144-if test -z "$DATADIRNAME"; then
145- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
146-/* end confdefs.h. */
147-
148-int
149-main ()
150-{
151-extern int _nl_msg_cat_cntr;
152- return _nl_msg_cat_cntr
153- ;
154- return 0;
155-}
156-_ACEOF
157-if ac_fn_c_try_link "$LINENO"; then :
158- DATADIRNAME=share
159-else
160- case $host in
161- *-*-solaris*)
162- ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset"
163-if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :
164- DATADIRNAME=share
165-else
166- DATADIRNAME=lib
167-fi
168-
169- ;;
170- *)
171- DATADIRNAME=lib
172- ;;
173- esac
174-fi
175-rm -f core conftest.err conftest.$ac_objext \
176- conftest$ac_exeext conftest.$ac_ext
177-fi
178-
179-
180
181
182
183@@ -8924,7 +8885,7 @@
184 # report actual input values of CONFIG_FILES etc. instead of their
185 # values after options handling.
186 ac_log="
187-This file was extended by Audio Recorder $as_me 1.6-3, which was
188+This file was extended by Audio Recorder $as_me 1.6-4, which was
189 generated by GNU Autoconf 2.69. Invocation command line was
190
191 CONFIG_FILES = $CONFIG_FILES
192@@ -8981,7 +8942,7 @@
193 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
194 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
195 ac_cs_version="\\
196-Audio Recorder config.status 1.6-3
197+Audio Recorder config.status 1.6-4
198 configured by $0, generated by GNU Autoconf 2.69,
199 with options \\"\$ac_cs_config\\"
200
201
202=== modified file 'configure.ac'
203--- configure.ac 2015-03-17 16:24:30 +0000
204+++ configure.ac 2015-04-11 20:15:48 +0000
205@@ -1,5 +1,5 @@
206 # ================= initialization =================== #
207-AC_INIT([Audio Recorder], [1.6-3], [https://bugs.launchpad.net/audio-recorder/+filebug], [audio-recorder])
208+AC_INIT([Audio Recorder], [1.6-4], [https://bugs.launchpad.net/audio-recorder/+filebug], [audio-recorder])
209 AM_INIT_AUTOMAKE
210
211 AC_USE_SYSTEM_EXTENSIONS
212
213=== modified file 'data/Makefile.in'
214--- data/Makefile.in 2015-02-02 21:59:14 +0000
215+++ data/Makefile.in 2015-04-11 20:15:48 +0000
216@@ -157,7 +157,6 @@
217 CXXDEPMODE = @CXXDEPMODE@
218 CXXFLAGS = @CXXFLAGS@
219 CYGPATH_W = @CYGPATH_W@
220-DATADIRNAME = @DATADIRNAME@
221 DBUS_CFLAGS = @DBUS_CFLAGS@
222 DBUS_LIBS = @DBUS_LIBS@
223 DEFS = @DEFS@
224
225=== modified file 'debian/changelog'
226--- debian/changelog 2015-03-17 16:24:30 +0000
227+++ debian/changelog 2015-04-11 20:15:48 +0000
228@@ -1,6 +1,14 @@
229-audio-recorder (1.6-3~vivid) vivid; urgency=low
230-
231- * Version 1.6-3
232+audio-recorder (1.6-4~vivid) vivid; urgency=low
233+
234+ * Version 1.6-4
235+ * GTK3+ has now a standard GtkLevelBar widget. Renamed our 'GtkLevelBar' widget to 'LevelBar'.
236+ * Renamed src/gtklevelbar.[ch] to src/levelbar.[ch].
237+
238+ -- moma <osmoma@gmail.com> tue, 11 Apr 2015 10:00:00 +0200
239+
240+audio-recorder (1.6-4~vivid) vivid; urgency=low
241+
242+ * Version 1.6-4
243 * Added -e (--eos-on-shutdown) option to the gst-launch command in Additional Settings -> Recording Commands -> Show Cmd.
244 * This will make sure all test files (test recordings) are terminated properly.
245
246
247=== modified file 'icons/Makefile.in'
248--- icons/Makefile.in 2015-02-02 21:59:14 +0000
249+++ icons/Makefile.in 2015-04-11 20:15:48 +0000
250@@ -185,7 +185,6 @@
251 CXXDEPMODE = @CXXDEPMODE@
252 CXXFLAGS = @CXXFLAGS@
253 CYGPATH_W = @CYGPATH_W@
254-DATADIRNAME = @DATADIRNAME@
255 DBUS_CFLAGS = @DBUS_CFLAGS@
256 DBUS_LIBS = @DBUS_LIBS@
257 DEFS = @DEFS@
258
259=== modified file 'icons/hicolor/Makefile.in'
260--- icons/hicolor/Makefile.in 2015-02-02 21:59:14 +0000
261+++ icons/hicolor/Makefile.in 2015-04-11 20:15:48 +0000
262@@ -185,7 +185,6 @@
263 CXXDEPMODE = @CXXDEPMODE@
264 CXXFLAGS = @CXXFLAGS@
265 CYGPATH_W = @CYGPATH_W@
266-DATADIRNAME = @DATADIRNAME@
267 DBUS_CFLAGS = @DBUS_CFLAGS@
268 DBUS_LIBS = @DBUS_LIBS@
269 DEFS = @DEFS@
270
271=== modified file 'icons/hicolor/scalable/Makefile.in'
272--- icons/hicolor/scalable/Makefile.in 2015-02-02 21:59:14 +0000
273+++ icons/hicolor/scalable/Makefile.in 2015-04-11 20:15:48 +0000
274@@ -185,7 +185,6 @@
275 CXXDEPMODE = @CXXDEPMODE@
276 CXXFLAGS = @CXXFLAGS@
277 CYGPATH_W = @CYGPATH_W@
278-DATADIRNAME = @DATADIRNAME@
279 DBUS_CFLAGS = @DBUS_CFLAGS@
280 DBUS_LIBS = @DBUS_LIBS@
281 DEFS = @DEFS@
282
283=== modified file 'icons/hicolor/scalable/apps/Makefile.in'
284--- icons/hicolor/scalable/apps/Makefile.in 2015-02-02 21:59:14 +0000
285+++ icons/hicolor/scalable/apps/Makefile.in 2015-04-11 20:15:48 +0000
286@@ -155,7 +155,6 @@
287 CXXDEPMODE = @CXXDEPMODE@
288 CXXFLAGS = @CXXFLAGS@
289 CYGPATH_W = @CYGPATH_W@
290-DATADIRNAME = @DATADIRNAME@
291 DBUS_CFLAGS = @DBUS_CFLAGS@
292 DBUS_LIBS = @DBUS_LIBS@
293 DEFS = @DEFS@
294
295=== modified file 'icons/hicolor/scalable/status/Makefile.in'
296--- icons/hicolor/scalable/status/Makefile.in 2015-02-02 21:59:14 +0000
297+++ icons/hicolor/scalable/status/Makefile.in 2015-04-11 20:15:48 +0000
298@@ -155,7 +155,6 @@
299 CXXDEPMODE = @CXXDEPMODE@
300 CXXFLAGS = @CXXFLAGS@
301 CYGPATH_W = @CYGPATH_W@
302-DATADIRNAME = @DATADIRNAME@
303 DBUS_CFLAGS = @DBUS_CFLAGS@
304 DBUS_LIBS = @DBUS_LIBS@
305 DEFS = @DEFS@
306
307=== modified file 'linux-distros/arch-linux/PKGBUILD'
308--- linux-distros/arch-linux/PKGBUILD 2015-03-17 16:24:30 +0000
309+++ linux-distros/arch-linux/PKGBUILD 2015-04-11 20:15:48 +0000
310@@ -2,8 +2,8 @@
311 # Contributor: Lucas Saliés Brum <lucas@archlinux.com.br>
312
313 pkgname=audio-recorder
314-pkgver=1.6-3
315-pkgrel=3
316+pkgver=1.6-4
317+pkgrel=4
318 pkgdesc="Audio recorder for GNOME and Unity Desktops"
319 arch=('i686' 'x86_64')
320 url='https://launchpad.net/audio-recorder'
321@@ -19,7 +19,7 @@
322 provides=('audio-recorder')
323 install="$pkgname.install"
324 conflicts=('audio-recorder-bzr' 'audio-recorder-from-deb')
325-source=("https://launchpad.net/$pkgname/trunk/version1.6-3/+download/$pkgname-1.6-3.tar.gz")
326+source=("https://launchpad.net/$pkgname/trunk/version1.6-4/+download/$pkgname-1.6-4.tar.gz")
327 md5sums=('??????')
328
329 build() {
330
331=== modified file 'linux-distros/fedora/audio-recorder.spec'
332--- linux-distros/fedora/audio-recorder.spec 2015-03-17 16:24:30 +0000
333+++ linux-distros/fedora/audio-recorder.spec 2015-04-11 20:15:48 +0000
334@@ -1,4 +1,4 @@
335-%define releasenum 3
336+%define releasenum 4
337
338 Name: audio-recorder
339 Version: 1.6
340
341=== modified file 'pixmaps/Makefile.in'
342--- pixmaps/Makefile.in 2015-02-02 21:59:14 +0000
343+++ pixmaps/Makefile.in 2015-04-11 20:15:48 +0000
344@@ -157,7 +157,6 @@
345 CXXDEPMODE = @CXXDEPMODE@
346 CXXFLAGS = @CXXFLAGS@
347 CYGPATH_W = @CYGPATH_W@
348-DATADIRNAME = @DATADIRNAME@
349 DBUS_CFLAGS = @DBUS_CFLAGS@
350 DBUS_LIBS = @DBUS_LIBS@
351 DEFS = @DEFS@
352
353=== modified file 'po/POTFILES.in'
354--- po/POTFILES.in 2014-09-30 19:54:05 +0000
355+++ po/POTFILES.in 2015-04-11 20:15:48 +0000
356@@ -24,8 +24,8 @@
357 src/gst-pipeline.h
358 src/gst-recorder.c
359 src/gst-recorder.h
360-src/gtklevelbar.c
361-src/gtklevelbar.h
362+src/levelbar.c
363+src/levelbar.h
364 src/help.c
365 src/help.h
366 src/log.c
367
368=== modified file 'src/Makefile.am'
369--- src/Makefile.am 2014-10-07 17:02:33 +0000
370+++ src/Makefile.am 2015-04-11 20:15:48 +0000
371@@ -43,7 +43,7 @@
372 utility.c utility.h \
373 settings.c settings-pipe.c settings.h \
374 about.c about.h \
375- gtklevelbar.c gtklevelbar.h \
376+ levelbar.c levelbar.h \
377 main.c
378
379
380
381=== modified file 'src/Makefile.in'
382--- src/Makefile.in 2015-02-02 21:59:14 +0000
383+++ src/Makefile.in 2015-04-11 20:15:48 +0000
384@@ -98,7 +98,7 @@
385 gst-devices.$(OBJEXT) rec-manager.$(OBJEXT) support.$(OBJEXT) \
386 timer.$(OBJEXT) timer-parser.$(OBJEXT) utility.$(OBJEXT) \
387 settings.$(OBJEXT) settings-pipe.$(OBJEXT) about.$(OBJEXT) \
388- gtklevelbar.$(OBJEXT) main.$(OBJEXT)
389+ levelbar.$(OBJEXT) main.$(OBJEXT)
390 audio_recorder_OBJECTS = $(am_audio_recorder_OBJECTS)
391 audio_recorder_LDADD = $(LDADD)
392 AM_V_P = $(am__v_P_@AM_V@)
393@@ -175,7 +175,6 @@
394 CXXDEPMODE = @CXXDEPMODE@
395 CXXFLAGS = @CXXFLAGS@
396 CYGPATH_W = @CYGPATH_W@
397-DATADIRNAME = @DATADIRNAME@
398 DBUS_CFLAGS = @DBUS_CFLAGS@
399 DBUS_LIBS = @DBUS_LIBS@
400 DEFS = @DEFS@
401@@ -329,7 +328,7 @@
402 utility.c utility.h \
403 settings.c settings-pipe.c settings.h \
404 about.c about.h \
405- gtklevelbar.c gtklevelbar.h \
406+ levelbar.c levelbar.h \
407 main.c
408
409 all: all-am
410@@ -431,8 +430,8 @@
411 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst-pipeline.Po@am__quote@
412 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst-recorder.Po@am__quote@
413 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst-vad.Po@am__quote@
414-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtklevelbar.Po@am__quote@
415 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@
416+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/levelbar.Po@am__quote@
417 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
418 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
419 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/media-profiles.Po@am__quote@
420
421=== modified file 'src/audio-sources.c'
422--- src/audio-sources.c 2015-02-06 14:13:34 +0000
423+++ src/audio-sources.c 2015-04-11 20:15:48 +0000
424@@ -687,7 +687,7 @@
425 GdkPixbuf *pixbuf = NULL;
426 if (item->type == MEDIA_PLAYER || item->type == COMM_PROGRAM) {
427
428- pixbuf = load_icon_pixbuf((gchar*)p);
429+ pixbuf = load_icon_pixbuf((gchar*)p, 22);
430
431 // Got icon??
432 if (!GDK_IS_PIXBUF(pixbuf)) {
433
434=== modified file 'src/dbus-mpris2.c'
435--- src/dbus-mpris2.c 2015-02-06 14:13:34 +0000
436+++ src/dbus-mpris2.c 2015-04-11 20:15:48 +0000
437@@ -3,10 +3,7 @@
438 *
439 * This library is free software; you can redistribute it and/or
440 * modify it under the terms of the GNU Library General Public
441- * License as published by the Free Software Foundation; either
442- * version 3 of the License (GPL3), or any later version.
443- *
444- * This library is distributed in the hope that it will be useful,
445+ * License as published by the Free Software Foundation; either"OK
446 * but WITHOUT ANY WARRANTY; without even the implied warranty of
447 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
448 * See the GNU Library General Public License 3 for more details.
449@@ -573,6 +570,20 @@
450 return res;
451 }
452
453+#if 0
454+void debug_variant(const gchar *tag, GVariant *v) {
455+ if (!v) {
456+ g_print("%s is NULL.\n", tag);
457+ return;
458+ }
459+
460+ gchar *sval = g_variant_print(v, TRUE);
461+ const gchar *stype = g_variant_get_type_string(v);
462+ g_print("%s has type:%s and value:%s\n", tag, stype, sval);
463+ g_free(sval);
464+}
465+#endif
466+
467 void mpris2_get_metadata(gpointer player_rec) {
468 // Get track information (=metadata) and state for the given media player.
469 // Ref: http://www.mpris.org/2.1/spec/Player_Node.html#Property:Metadata
470@@ -602,6 +613,8 @@
471 //
472 GVariant *result = mpris2_get_player_value(player, "PlaybackStatus");
473
474+ // DEBUG: debug_variant("PlaybackStatus", result);
475+
476 if (!result) {
477 // Cannot contact player (it has quit)?
478 tr->status = PLAYER_STATUS_CLOSED;
479@@ -657,9 +670,14 @@
480 //
481 GVariant *dict = mpris2_get_player_value(player, "Metadata");
482
483+ // DEBUG: debug_variant("Metadata", dict);
484+
485 if (!dict) {
486- // Cannot contact player (it has quit)?
487- tr->status = PLAYER_STATUS_CLOSED;
488+ // Cannot get Metadata (should we consider this as on error?)
489+ // 03.april.2015, commented out by MOma: Ambient Noise Player does not support "Metadata" yet.
490+
491+ // tr->status = PLAYER_STATUS_CLOSED;
492+
493 return;
494 }
495
496
497=== removed file 'src/gtklevelbar.c'
498--- src/gtklevelbar.c 2015-02-06 14:13:34 +0000
499+++ src/gtklevelbar.c 1970-01-01 00:00:00 +0000
500@@ -1,357 +0,0 @@
501-/*
502- * Copyright (c) Linux community.
503- *
504- * This library is free software; you can redistribute it and/or
505- * modify it under the terms of the GNU Library General Public
506- * License as published by the Free Software Foundation; either
507- * version 3 of the License (GPL3), or any later version.
508- *
509- * This library is distributed in the hope that it will be useful,
510- * but WITHOUT ANY WARRANTY; without even the implied warranty of
511- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
512- * See the GNU Library General Public License 3 for more details.
513- *
514- * You should have received a copy of the GNU Library General Public
515- * License 3 along with this program; if not, see /usr/share/common-licenses/GPL file
516- * or write to Free Software Foundation, Inc., 59 Temple Place - Suite 330,
517- * Boston, MA 02111-1307, USA.
518-*/
519-#include "gtklevelbar.h"
520-#include <math.h> // round()
521-
522-// A simple level bar widget.
523-// By Osmo Antero.
524-//
525-// Sample call:
526-// GtkWidget *lb = gtk_level_bar_new();
527-// gtk_widget_show(lb);
528-//
529-// Set value [0.0, 1.0].
530-// gtk_level_bar_set_fraction(GTK_LEVEL_BAR(lb), 0.8);
531-//
532-// Show %-value [0 - 100%] or plain value [0 - 1.0] on the level bar. See BAR_VALUE enum.
533-// gtk_level_bar_set_value_type(GTK_LEVEL_BAR(lb), VALUE_PRECENT);
534-//
535-
536-struct _GtkLevelBarPrivate {
537- gdouble fraction;
538- guint bar_height;
539- enum BAR_VALUE bar_value;
540- enum BAR_SHAPE bar_shape;
541-};
542-
543-static void gtk_level_bar_get_preferred_width(GtkWidget *widget, gint *minimum, gint *natural);
544-static void gtk_level_bar_get_preferred_height (GtkWidget *widget,gint *minimum, gint *natural);
545-
546-static void gtk_level_bar_real_update(GtkLevelBar *progress);
547-static gboolean gtk_level_bar_draw(GtkWidget *widget, cairo_t *cr);
548-
549-static void gtk_level_bar_finalize(GObject *object);
550-
551-G_DEFINE_TYPE(GtkLevelBar, gtk_level_bar, GTK_TYPE_WIDGET);
552-
553-static void gtk_level_bar_class_init (GtkLevelBarClass *class) {
554- GObjectClass *gobject_class;
555- GtkWidgetClass *widget_class;
556-
557- gobject_class = G_OBJECT_CLASS (class);
558- widget_class = (GtkWidgetClass *)class;
559-
560- gobject_class->set_property = NULL;
561- gobject_class->get_property = NULL;
562- gobject_class->finalize = gtk_level_bar_finalize;
563-
564- widget_class->draw = gtk_level_bar_draw;
565- widget_class->get_preferred_width = gtk_level_bar_get_preferred_width;
566- widget_class->get_preferred_height = gtk_level_bar_get_preferred_height;
567-
568- g_type_class_add_private (class, sizeof (GtkLevelBarPrivate));
569-}
570-
571-static void gtk_level_bar_init(GtkLevelBar *pbar) {
572- GtkLevelBarPrivate *priv;
573-
574- pbar->priv = G_TYPE_INSTANCE_GET_PRIVATE(pbar, GTK_TYPE_LEVEL_BAR, GtkLevelBarPrivate);
575- priv = pbar->priv;
576-
577- priv->fraction = 0.0;
578- priv->bar_height = 8;
579- priv->bar_value = VALUE_NONE;
580- priv->bar_shape = SHAPE_CIRCLE; // pulsing line with circle at end.
581-
582- gtk_widget_set_has_window(GTK_WIDGET (pbar), FALSE);
583-}
584-
585-GtkWidget *gtk_level_bar_new(void) {
586- GtkWidget *pbar;
587- pbar = g_object_new(GTK_TYPE_LEVEL_BAR, NULL);
588- return pbar;
589-}
590-
591-static void gtk_level_bar_real_update (GtkLevelBar *pbar) {
592- GtkWidget *widget;
593-
594- g_return_if_fail (GTK_IS_LEVEL_BAR (pbar));
595-
596- GtkLevelBarPrivate __attribute__ ((unused)) *priv = pbar->priv;
597-
598- widget = GTK_WIDGET(pbar);
599-
600- gtk_widget_queue_draw(widget);
601-}
602-
603-static void gtk_level_bar_finalize (GObject *object) {
604- G_OBJECT_CLASS(gtk_level_bar_parent_class)->finalize (object);
605-}
606-
607-static void gtk_level_bar_get_preferred_width (GtkWidget *widget,gint *minimum, gint *natural) {
608- *minimum = 50;
609- *natural = 160;
610-}
611-
612-static void gtk_level_bar_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) {
613- *minimum = 6;
614- *natural = 8;
615-}
616-
617-static gboolean gtk_level_bar_draw(GtkWidget *widget, cairo_t *cr) {
618- // Draw level bar and optional text
619- GtkLevelBar *pbar = GTK_LEVEL_BAR (widget);
620- GtkLevelBarPrivate *priv = pbar->priv;
621- GtkStyleContext *context;
622- int width, height;
623-
624- context = gtk_widget_get_style_context(widget);
625-
626- width = gtk_widget_get_allocated_width(widget);
627- height = gtk_widget_get_allocated_height(widget);
628-
629- // Bar thickness
630- gdouble bar_height = MIN(height , priv->bar_height);
631-
632- // Vertical pos
633- gdouble y = (height - bar_height)/2;
634-
635- // Pulse width
636- gdouble w = priv->fraction/(1.00/width);
637-
638- // Debug:
639- // LOG_DEBUG("width=%d height=%d bar_height=%2.1f y=%2.1f w=%2.1f fraction=%2.1f\n", width, height, bar_height, y, w, priv->fraction);
640-
641- gtk_style_context_save(context);
642- gtk_render_background(context, cr, 0, 0, width, height);
643- gtk_render_frame(context, cr, 0, 0, width, height);
644-
645- // Render level bar with current theme and color.
646-
647- // Progressbar style
648- gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR);
649-
650- if (priv->fraction > 0.001) {
651-
652- switch (priv->bar_shape) {
653-
654- case SHAPE_LINE:
655- // Render a single line
656- if (priv->bar_value == VALUE_NONE) {
657- // No value (text) shown. Draw a line on the middle.
658- gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2));
659-
660- } else {
661- // Draw a line under text.
662- gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height ));
663- }
664-
665- break;
666-
667- case SHAPE_LINE2:
668- // Render two horizontal lines + close the end.
669- gtk_render_line(context, cr, 0, y-1 , w, y-1);
670- gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height ));
671- gtk_render_line(context, cr, w, y - 1, w, y + (bar_height ));
672- break;
673-
674- case SHAPE_CIRCLE:
675- // Draw a line on the middle + circle at the end.
676- gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2));
677- gtk_render_option(context, cr, w, y, bar_height+1, bar_height+1);
678- break;
679-
680- default:
681- // case SHAPE_LEVELBAR:
682-
683- // EDIT: gtk_render_activity() does not work in GTK 3.14+
684- // gtk_style_context_set_state(context, GTK_STATE_FLAG_ACTIVE);
685- // gtk_render_activity(context, cr, 0, y, w, bar_height);
686-
687- // Render a filled frame (this is a typical levelbar).
688- gtk_render_frame(context, cr, 0, y, w, bar_height);
689- break;
690-
691- }
692- }
693-
694- gtk_style_context_restore(context);
695-
696- cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
697- cairo_set_font_size(cr, priv->bar_height);
698-
699- GdkRGBA color;
700- gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color);
701- gdk_cairo_set_source_rgba(cr, &color);
702- color.alpha = 0.9;
703-
704- // Calculate total width of scale
705- cairo_text_extents_t extents;
706- cairo_text_extents(cr, "0.0", &extents);
707- gint total_w = 9 * (extents.x_advance + extents.width);
708-
709- // Debug:
710- // g_print("Bar width=%d total_w=%d bearing=%3.1f advance=%3.1f char.width=%3.1f\n", width, total_w,
711- // extents.x_bearing, extents.x_advance, extents.width);
712-
713- // Draw values
714- gboolean draw_all = (total_w - extents.width) < width;
715-
716- // Show normalized value [0 - 1.0]?
717- if (priv->bar_value == VALUE_0_1) {
718- // Value: 0.1 0.2 0.3 0.4...0.9
719-
720- gint i = 0;
721- for (i=0; i < 10; i++) {
722- gchar *s = NULL;
723-
724- // Draw all or draw only each second value?
725- if (draw_all || (i % 2 == 0))
726- s = g_strdup_printf("%2.1f", (gdouble)i/10.0);
727-
728- if (!s) continue;
729-
730- cairo_text_extents_t extents;
731- cairo_text_extents(cr, s, &extents);
732-
733- gdouble xx = (width/10) * i;
734- gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing) + 0.2;
735-
736- cairo_move_to(cr, xx, yy);
737- cairo_show_text(cr, s);
738-
739- g_free(s);
740- }
741-
742- // Show percentage value?
743- } else if (priv->bar_value == VALUE_PERCENT) {
744- // Value: 10% . 20% . 30% . 40% . 50% ... 90%
745- gint i = 0;
746- for (i=0; i < 10; i++) {
747- gchar *s = NULL;
748- if (i % 2 == 0)
749- s = g_strdup_printf("%2.0f%%", (gdouble)i*10.0);
750- else
751- s = g_strdup_printf("%3s", ".");
752-
753- cairo_text_extents_t extents;
754- cairo_text_extents(cr, s, &extents);
755-
756- gdouble xx = (width/10) * i;
757- gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing);
758-
759- cairo_move_to(cr, xx, yy);
760- cairo_show_text(cr, s);
761-
762- g_free(s);
763- }
764- }
765-
766-#if 0
767- // Commented out by moma 30.sep.2012.
768-
769- // Set text
770- if (priv->text) {
771- cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
772-
773- cairo_set_font_size(cr, 0.5*height);
774- cairo_text_extents_t extents;
775- cairo_text_extents(cr, priv->text, &extents);
776-
777- // Ref: http://cairographics.org/manual/cairo-cairo-scaled-font-t.html#cairo-text-extents-t
778- gdouble xx = width-(extents.width + extents.x_bearing)-2;
779- gdouble yy = height/2-(extents.height/2 + extents.y_bearing);
780-
781- GdkRGBA color;
782- gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color);
783- gdk_cairo_set_source_rgba(cr, &color);
784- color.alpha = 0.9;
785-
786- cairo_move_to(cr, xx, yy);
787- cairo_show_text(cr, priv->text);
788- }
789-#endif
790-
791- return FALSE;
792-}
793-
794-void gtk_level_bar_set_fraction(GtkLevelBar *pbar, gdouble fraction) {
795- // Set fraction [0.0, 1.0]
796- GtkLevelBarPrivate* priv;
797- g_return_if_fail (GTK_IS_LEVEL_BAR (pbar));
798- priv = pbar->priv;
799-
800- priv->fraction = CLAMP(fraction, 0.0, 1.0);
801- gtk_level_bar_real_update (pbar);
802-}
803-
804-gdouble gtk_level_bar_get_fraction(GtkLevelBar *pbar) {
805- // Get fraction
806- g_return_val_if_fail(GTK_IS_LEVEL_BAR (pbar), 0);
807- return pbar->priv->fraction;
808-}
809-
810-void gtk_level_bar_set_bar_height(GtkLevelBar *pbar, guint height) {
811- // Set bar height (thickness). Normally 8 pixels.
812- g_return_if_fail(GTK_IS_LEVEL_BAR (pbar));
813- GtkLevelBarPrivate* priv = pbar->priv;
814- priv->bar_height = height;
815- // Redraw
816- gtk_level_bar_real_update(pbar);
817-}
818-
819-guint gtk_level_bar_get_bar_height(GtkLevelBar *pbar) {
820- // Get bar thickness
821- g_return_val_if_fail(GTK_IS_LEVEL_BAR(pbar), 0);
822- return pbar->priv->bar_height;
823-}
824-
825-void gtk_level_bar_set_value_type(GtkLevelBar *pbar, enum BAR_VALUE bar_value) {
826- // Set BAR_VALUE
827- g_return_if_fail(GTK_IS_LEVEL_BAR(pbar));
828- GtkLevelBarPrivate* priv = pbar->priv;
829- priv->bar_value = bar_value;
830- // Redraw
831- gtk_level_bar_real_update(pbar);
832-}
833-
834-enum BAR_VALUE gtk_level_bar_get_scale(GtkLevelBar *pbar) {
835- // Get BAR_VALUE
836- g_return_val_if_fail(GTK_IS_LEVEL_BAR(pbar), VALUE_NONE);
837- GtkLevelBarPrivate* priv = pbar->priv;
838- return priv->bar_value;
839-}
840-
841-void gtk_level_bar_set_shape(GtkLevelBar *pbar, enum BAR_SHAPE bar_shape) {
842- // Set BAR_SHAPE
843- g_return_if_fail(GTK_IS_LEVEL_BAR(pbar));
844- GtkLevelBarPrivate* priv = pbar->priv;
845- priv->bar_shape = bar_shape;
846- // Redraw
847- gtk_level_bar_real_update(pbar);
848-}
849-
850-enum BAR_SHAPE gtk_level_bar_get_shape(GtkLevelBar *pbar) {
851- // Get BAR_SHAPE
852- g_return_val_if_fail(GTK_IS_LEVEL_BAR(pbar), SHAPE_LEVELBAR);
853- GtkLevelBarPrivate* priv = pbar->priv;
854- return priv->bar_shape;
855-}
856-
857-
858
859=== removed file 'src/gtklevelbar.h'
860--- src/gtklevelbar.h 2015-02-06 14:13:34 +0000
861+++ src/gtklevelbar.h 1970-01-01 00:00:00 +0000
862@@ -1,60 +0,0 @@
863-#ifndef __GTK_LEVEL_BAR_H__
864-#define __GTK_LEVEL_BAR_H__
865-
866-// A simple level bar widget.
867-
868-#include <gtk/gtk.h>
869-
870-typedef enum BAR_VALUE {VALUE_NONE, VALUE_0_1/*0 - 1.0*/, VALUE_PERCENT/*0 - 100%*/} BAR_VALUE;
871-typedef enum BAR_SHAPE {SHAPE_LEVELBAR, SHAPE_LINE, SHAPE_LINE2, SHAPE_CIRCLE} BAR_SHAPE;
872-
873-G_BEGIN_DECLS
874-
875-#define GTK_TYPE_LEVEL_BAR (gtk_level_bar_get_type ())
876-#define GTK_LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LEVEL_BAR, GtkLevelBar))
877-#define GTK_LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LEVEL_BAR, GtkLevelBarClass))
878-#define GTK_IS_LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LEVEL_BAR))
879-#define GTK_IS_LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LEVEL_BAR))
880-#define GTK_LEVEL_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LEVEL_BAR, GtkLevelBarClass))
881-
882-typedef struct _GtkLevelBar GtkLevelBar;
883-typedef struct _GtkLevelBarPrivate GtkLevelBarPrivate;
884-typedef struct _GtkLevelBarClass GtkLevelBarClass;
885-
886-struct _GtkLevelBar {
887- GtkWidget parent;
888-
889- /*< private >*/
890- GtkLevelBarPrivate *priv;
891-};
892-
893-struct _GtkLevelBarClass {
894- GtkWidgetClass parent_class;
895-
896- /* Padding for future expansion */
897- void (*_gtk_reserved1) (void);
898- void (*_gtk_reserved2) (void);
899- void (*_gtk_reserved3) (void);
900- void (*_gtk_reserved4) (void);
901-};
902-
903-GType gtk_level_bar_get_type(void) G_GNUC_CONST;
904-GtkWidget* gtk_level_bar_new(void);
905-
906-void gtk_level_bar_set_bar_height(GtkLevelBar *pbar, guint height);
907-void gtk_level_bar_set_fraction(GtkLevelBar *pbar, gdouble fraction);
908-
909-guint gtk_level_bar_get_bar_height(GtkLevelBar *pbar);
910-gdouble gtk_level_bar_get_fraction(GtkLevelBar *pbar);
911-
912-void gtk_level_bar_set_value_type(GtkLevelBar *pbar, enum BAR_VALUE bar_value);
913-enum BAR_VALUE gtk_level_bar_get_value_type(GtkLevelBar *pbar);
914-
915-void gtk_level_bar_set_shape(GtkLevelBar *pbar, enum BAR_SHAPE bar_shape);
916-enum BAR_SHAPE gtk_level_bar_get_shape(GtkLevelBar *pbar);
917-
918-G_END_DECLS
919-
920-#endif
921-
922-
923
924=== added file 'src/levelbar.c'
925--- src/levelbar.c 1970-01-01 00:00:00 +0000
926+++ src/levelbar.c 2015-04-11 20:15:48 +0000
927@@ -0,0 +1,357 @@
928+/*
929+ * Copyright (c) Linux community.
930+ *
931+ * This library is free software; you can redistribute it and/or
932+ * modify it under the terms of the GNU Library General Public
933+ * License as published by the Free Software Foundation; either
934+ * version 3 of the License (GPL3), or any later version.
935+ *
936+ * This library is distributed in the hope that it will be useful,
937+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
938+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
939+ * See the GNU Library General Public License 3 for more details.
940+ *
941+ * You should have received a copy of the GNU Library General Public
942+ * License 3 along with this program; if not, see /usr/share/common-licenses/GPL file
943+ * or write to Free Software Foundation, Inc., 59 Temple Place - Suite 330,
944+ * Boston, MA 02111-1307, USA.
945+*/
946+#include "levelbar.h"
947+#include <math.h> // round()
948+
949+// A simple level bar widget.
950+// By Osmo Antero.
951+//
952+// Sample call:
953+// GtkWidget *lb = level_bar_new();
954+// gtk_widget_show(lb);
955+//
956+// Set value [0.0, 1.0].
957+// level_bar_set_fraction(LEVEL_BAR(lb), 0.8);
958+//
959+// Show %-value [0 - 100%] or plain value [0 - 1.0] on the level bar. See BAR_VALUE enum.
960+// level_bar_set_value_type(LEVEL_BAR(lb), VALUE_PRECENT);
961+//
962+
963+struct _LevelBarPrivate {
964+ gdouble fraction;
965+ guint bar_height;
966+ enum BAR_VALUE bar_value;
967+ enum BAR_SHAPE bar_shape;
968+};
969+
970+static void level_bar_get_preferred_width(GtkWidget *widget, gint *minimum, gint *natural);
971+static void level_bar_get_preferred_height (GtkWidget *widget,gint *minimum, gint *natural);
972+
973+static void level_bar_real_update(LevelBar *progress);
974+static gboolean level_bar_draw(GtkWidget *widget, cairo_t *cr);
975+
976+static void level_bar_finalize(GObject *object);
977+
978+G_DEFINE_TYPE(LevelBar, level_bar, GTK_TYPE_WIDGET);
979+
980+static void level_bar_class_init(LevelBarClass *class) {
981+ GObjectClass *gobject_class;
982+ GtkWidgetClass *widget_class;
983+
984+ gobject_class = G_OBJECT_CLASS (class);
985+ widget_class = (GtkWidgetClass *)class;
986+
987+ gobject_class->set_property = NULL;
988+ gobject_class->get_property = NULL;
989+ gobject_class->finalize = level_bar_finalize;
990+
991+ widget_class->draw = level_bar_draw;
992+ widget_class->get_preferred_width = level_bar_get_preferred_width;
993+ widget_class->get_preferred_height = level_bar_get_preferred_height;
994+
995+ g_type_class_add_private(class, sizeof (LevelBarPrivate));
996+}
997+
998+static void level_bar_init(LevelBar *pbar) {
999+ LevelBarPrivate *priv;
1000+
1001+ pbar->priv = G_TYPE_INSTANCE_GET_PRIVATE(pbar, TYPE_LEVEL_BAR, LevelBarPrivate);
1002+ priv = pbar->priv;
1003+
1004+ priv->fraction = 0.0;
1005+ priv->bar_height = 8;
1006+ priv->bar_value = VALUE_NONE;
1007+ priv->bar_shape = SHAPE_CIRCLE; // pulsing line with circle at end.
1008+
1009+ gtk_widget_set_has_window(GTK_WIDGET (pbar), FALSE);
1010+}
1011+
1012+GtkWidget *level_bar_new(void) {
1013+ GtkWidget *pbar;
1014+ pbar = g_object_new(TYPE_LEVEL_BAR, NULL);
1015+ return pbar;
1016+}
1017+
1018+static void level_bar_real_update (LevelBar *pbar) {
1019+ GtkWidget *widget;
1020+
1021+ g_return_if_fail (IS_LEVEL_BAR (pbar));
1022+
1023+ LevelBarPrivate __attribute__ ((unused)) *priv = pbar->priv;
1024+
1025+ widget = GTK_WIDGET(pbar);
1026+
1027+ gtk_widget_queue_draw(widget);
1028+}
1029+
1030+static void level_bar_finalize (GObject *object) {
1031+ G_OBJECT_CLASS(level_bar_parent_class)->finalize (object);
1032+}
1033+
1034+static void level_bar_get_preferred_width (GtkWidget *widget,gint *minimum, gint *natural) {
1035+ *minimum = 50;
1036+ *natural = 160;
1037+}
1038+
1039+static void level_bar_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) {
1040+ *minimum = 6;
1041+ *natural = 8;
1042+}
1043+
1044+static gboolean level_bar_draw(GtkWidget *widget, cairo_t *cr) {
1045+ // Draw level bar and optional text
1046+ LevelBar *pbar = LEVEL_BAR (widget);
1047+ LevelBarPrivate *priv = pbar->priv;
1048+ GtkStyleContext *context;
1049+ int width, height;
1050+
1051+ context = gtk_widget_get_style_context(widget);
1052+
1053+ width = gtk_widget_get_allocated_width(widget);
1054+ height = gtk_widget_get_allocated_height(widget);
1055+
1056+ // Bar thickness
1057+ gdouble bar_height = MIN(height , priv->bar_height);
1058+
1059+ // Vertical pos
1060+ gdouble y = (height - bar_height)/2;
1061+
1062+ // Pulse width
1063+ gdouble w = priv->fraction/(1.00/width);
1064+
1065+ // Debug:
1066+ // LOG_DEBUG("width=%d height=%d bar_height=%2.1f y=%2.1f w=%2.1f fraction=%2.1f\n", width, height, bar_height, y, w, priv->fraction);
1067+
1068+ gtk_style_context_save(context);
1069+ gtk_render_background(context, cr, 0, 0, width, height);
1070+ gtk_render_frame(context, cr, 0, 0, width, height);
1071+
1072+ // Render level bar with current theme and color.
1073+
1074+ // Progressbar style
1075+ gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR);
1076+
1077+ if (priv->fraction > 0.001) {
1078+
1079+ switch (priv->bar_shape) {
1080+
1081+ case SHAPE_LINE:
1082+ // Render a single line
1083+ if (priv->bar_value == VALUE_NONE) {
1084+ // No value (text) shown. Draw a line on the middle.
1085+ gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2));
1086+
1087+ } else {
1088+ // Draw a line under text.
1089+ gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height ));
1090+ }
1091+
1092+ break;
1093+
1094+ case SHAPE_LINE2:
1095+ // Render two horizontal lines + close the end.
1096+ gtk_render_line(context, cr, 0, y-1 , w, y-1);
1097+ gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height ));
1098+ gtk_render_line(context, cr, w, y - 1, w, y + (bar_height ));
1099+ break;
1100+
1101+ case SHAPE_CIRCLE:
1102+ // Draw a line on the middle + circle at the end.
1103+ gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2));
1104+ gtk_render_option(context, cr, w, y, bar_height+1, bar_height+1);
1105+ break;
1106+
1107+ default:
1108+ // case SHAPE_LEVELBAR:
1109+
1110+ // EDIT: gtk_render_activity() does not work in GTK 3.14+
1111+ // gtk_style_context_set_state(context, GTK_STATE_FLAG_ACTIVE);
1112+ // gtk_render_activity(context, cr, 0, y, w, bar_height);
1113+
1114+ // Render a filled frame (this is a typical levelbar).
1115+ gtk_render_frame(context, cr, 0, y, w, bar_height);
1116+ break;
1117+
1118+ }
1119+ }
1120+
1121+ gtk_style_context_restore(context);
1122+
1123+ cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
1124+ cairo_set_font_size(cr, priv->bar_height);
1125+
1126+ GdkRGBA color;
1127+ gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color);
1128+ gdk_cairo_set_source_rgba(cr, &color);
1129+ color.alpha = 0.9;
1130+
1131+ // Calculate total width of scale
1132+ cairo_text_extents_t extents;
1133+ cairo_text_extents(cr, "0.0", &extents);
1134+ gint total_w = 9 * (extents.x_advance + extents.width);
1135+
1136+ // Debug:
1137+ // g_print("Bar width=%d total_w=%d bearing=%3.1f advance=%3.1f char.width=%3.1f\n", width, total_w,
1138+ // extents.x_bearing, extents.x_advance, extents.width);
1139+
1140+ // Draw values
1141+ gboolean draw_all = (total_w - extents.width) < width;
1142+
1143+ // Show normalized value [0 - 1.0]?
1144+ if (priv->bar_value == VALUE_0_1) {
1145+ // Value: 0.1 0.2 0.3 0.4...0.9
1146+
1147+ gint i = 0;
1148+ for (i=0; i < 10; i++) {
1149+ gchar *s = NULL;
1150+
1151+ // Draw all or draw only each second value?
1152+ if (draw_all || (i % 2 == 0))
1153+ s = g_strdup_printf("%2.1f", (gdouble)i/10.0);
1154+
1155+ if (!s) continue;
1156+
1157+ cairo_text_extents_t extents;
1158+ cairo_text_extents(cr, s, &extents);
1159+
1160+ gdouble xx = (width/10) * i;
1161+ gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing) + 0.2;
1162+
1163+ cairo_move_to(cr, xx, yy);
1164+ cairo_show_text(cr, s);
1165+
1166+ g_free(s);
1167+ }
1168+
1169+ // Show percentage value?
1170+ } else if (priv->bar_value == VALUE_PERCENT) {
1171+ // Value: 10% . 20% . 30% . 40% . 50% ... 90%
1172+ gint i = 0;
1173+ for (i=0; i < 10; i++) {
1174+ gchar *s = NULL;
1175+ if (i % 2 == 0)
1176+ s = g_strdup_printf("%2.0f%%", (gdouble)i*10.0);
1177+ else
1178+ s = g_strdup_printf("%3s", ".");
1179+
1180+ cairo_text_extents_t extents;
1181+ cairo_text_extents(cr, s, &extents);
1182+
1183+ gdouble xx = (width/10) * i;
1184+ gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing);
1185+
1186+ cairo_move_to(cr, xx, yy);
1187+ cairo_show_text(cr, s);
1188+
1189+ g_free(s);
1190+ }
1191+ }
1192+
1193+#if 0
1194+ // Commented out by moma 30.sep.2012.
1195+
1196+ // Set text
1197+ if (priv->text) {
1198+ cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
1199+
1200+ cairo_set_font_size(cr, 0.5*height);
1201+ cairo_text_extents_t extents;
1202+ cairo_text_extents(cr, priv->text, &extents);
1203+
1204+ // Ref: http://cairographics.org/manual/cairo-cairo-scaled-font-t.html#cairo-text-extents-t
1205+ gdouble xx = width-(extents.width + extents.x_bearing)-2;
1206+ gdouble yy = height/2-(extents.height/2 + extents.y_bearing);
1207+
1208+ GdkRGBA color;
1209+ gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color);
1210+ gdk_cairo_set_source_rgba(cr, &color);
1211+ color.alpha = 0.9;
1212+
1213+ cairo_move_to(cr, xx, yy);
1214+ cairo_show_text(cr, priv->text);
1215+ }
1216+#endif
1217+
1218+ return FALSE;
1219+}
1220+
1221+void level_bar_set_fraction(LevelBar *pbar, gdouble fraction) {
1222+ // Set fraction [0.0, 1.0]
1223+ LevelBarPrivate* priv;
1224+ g_return_if_fail (IS_LEVEL_BAR (pbar));
1225+ priv = pbar->priv;
1226+
1227+ priv->fraction = CLAMP(fraction, 0.0, 1.0);
1228+ level_bar_real_update (pbar);
1229+}
1230+
1231+gdouble level_bar_get_fraction(LevelBar *pbar) {
1232+ // Get fraction
1233+ g_return_val_if_fail(IS_LEVEL_BAR (pbar), 0);
1234+ return pbar->priv->fraction;
1235+}
1236+
1237+void level_bar_set_bar_height(LevelBar *pbar, guint height) {
1238+ // Set bar height (thickness). Normally 8 pixels.
1239+ g_return_if_fail(IS_LEVEL_BAR (pbar));
1240+ LevelBarPrivate* priv = pbar->priv;
1241+ priv->bar_height = height;
1242+ // Redraw
1243+ level_bar_real_update(pbar);
1244+}
1245+
1246+guint level_bar_get_bar_height(LevelBar *pbar) {
1247+ // Get bar thickness
1248+ g_return_val_if_fail(IS_LEVEL_BAR(pbar), 0);
1249+ return pbar->priv->bar_height;
1250+}
1251+
1252+void level_bar_set_value_type(LevelBar *pbar, enum BAR_VALUE bar_value) {
1253+ // Set BAR_VALUE
1254+ g_return_if_fail(IS_LEVEL_BAR(pbar));
1255+ LevelBarPrivate* priv = pbar->priv;
1256+ priv->bar_value = bar_value;
1257+ // Redraw
1258+ level_bar_real_update(pbar);
1259+}
1260+
1261+enum BAR_VALUE level_bar_get_scale(LevelBar *pbar) {
1262+ // Get BAR_VALUE
1263+ g_return_val_if_fail(IS_LEVEL_BAR(pbar), VALUE_NONE);
1264+ LevelBarPrivate* priv = pbar->priv;
1265+ return priv->bar_value;
1266+}
1267+
1268+void level_bar_set_shape(LevelBar *pbar, enum BAR_SHAPE bar_shape) {
1269+ // Set BAR_SHAPE
1270+ g_return_if_fail(IS_LEVEL_BAR(pbar));
1271+ LevelBarPrivate* priv = pbar->priv;
1272+ priv->bar_shape = bar_shape;
1273+ // Redraw
1274+ level_bar_real_update(pbar);
1275+}
1276+
1277+enum BAR_SHAPE level_bar_get_shape(LevelBar *pbar) {
1278+ // Get BAR_SHAPE
1279+ g_return_val_if_fail(IS_LEVEL_BAR(pbar), SHAPE_LEVELBAR);
1280+ LevelBarPrivate* priv = pbar->priv;
1281+ return priv->bar_shape;
1282+}
1283+
1284+
1285
1286=== added file 'src/levelbar.h'
1287--- src/levelbar.h 1970-01-01 00:00:00 +0000
1288+++ src/levelbar.h 2015-04-11 20:15:48 +0000
1289@@ -0,0 +1,60 @@
1290+#ifndef __LEVEL_BAR_H__
1291+#define __LEVEL_BAR_H__
1292+
1293+// A simple level bar widget.
1294+
1295+#include <gtk/gtk.h>
1296+
1297+typedef enum BAR_VALUE {VALUE_NONE, VALUE_0_1/*0 - 1.0*/, VALUE_PERCENT/*0 - 100%*/} BAR_VALUE;
1298+typedef enum BAR_SHAPE {SHAPE_LEVELBAR, SHAPE_LINE, SHAPE_LINE2, SHAPE_CIRCLE} BAR_SHAPE;
1299+
1300+G_BEGIN_DECLS
1301+
1302+#define TYPE_LEVEL_BAR (level_bar_get_type ())
1303+#define LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LEVEL_BAR, LevelBar))
1304+#define LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LEVEL_BAR, LevelBarClass))
1305+#define IS_LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LEVEL_BAR))
1306+#define IS_LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LEVEL_BAR))
1307+#define LEVEL_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LEVEL_BAR, LevelBarClass))
1308+
1309+typedef struct _LevelBar LevelBar;
1310+typedef struct _LevelBarPrivate LevelBarPrivate;
1311+typedef struct _LevelBarClass LevelBarClass;
1312+
1313+struct _LevelBar {
1314+ GtkWidget parent;
1315+
1316+ /*< private >*/
1317+ LevelBarPrivate *priv;
1318+};
1319+
1320+struct _LevelBarClass {
1321+ GtkWidgetClass parent_class;
1322+
1323+ /* Padding for future expansion */
1324+ void (*_gtk_reserved1) (void);
1325+ void (*_gtk_reserved2) (void);
1326+ void (*_gtk_reserved3) (void);
1327+ void (*_gtk_reserved4) (void);
1328+};
1329+
1330+GType level_bar_get_type(void) G_GNUC_CONST;
1331+GtkWidget* level_bar_new(void);
1332+
1333+void level_bar_set_bar_height(LevelBar *pbar, guint height);
1334+void level_bar_set_fraction(LevelBar *pbar, gdouble fraction);
1335+
1336+guint level_bar_get_bar_height(LevelBar *pbar);
1337+gdouble level_bar_get_fraction(LevelBar *pbar);
1338+
1339+void level_bar_set_value_type(LevelBar *pbar, enum BAR_VALUE bar_value);
1340+enum BAR_VALUE level_bar_get_value_type(LevelBar *pbar);
1341+
1342+void level_bar_set_shape(LevelBar *pbar, enum BAR_SHAPE bar_shape);
1343+enum BAR_SHAPE level_bar_get_shape(LevelBar *pbar);
1344+
1345+G_END_DECLS
1346+
1347+#endif
1348+
1349+
1350
1351=== modified file 'src/main.c'
1352--- src/main.c 2015-02-11 16:45:04 +0000
1353+++ src/main.c 2015-04-11 20:15:48 +0000
1354@@ -25,7 +25,7 @@
1355
1356 #include <gst/pbutils/pbutils.h>
1357
1358-#include "gtklevelbar.h" // Level bar widget
1359+#include "levelbar.h" // Level bar widget
1360 #include "support.h"
1361 #include "audio-sources.h"
1362 #include "rec-window.h"
1363@@ -274,13 +274,13 @@
1364 }
1365
1366 void win_update_level_bar(gdouble norm_rms, gdouble norm_peak) {
1367- // Set pulse on gtklevelbar
1368+ // Set pulse on the levelbar
1369
1370- if (!GTK_IS_LEVEL_BAR(g_win.level_bar)) return;
1371+ if (!IS_LEVEL_BAR(g_win.level_bar)) return;
1372
1373 // Show either RMS or peak-value on the levelbar.
1374 // Notice: This value has no GUI-setting. User must change it in the dconf-editor.
1375- gtk_level_bar_set_fraction(GTK_LEVEL_BAR(g_win.level_bar),
1376+ level_bar_set_fraction(LEVEL_BAR(g_win.level_bar),
1377 (g_win.pulse_type == PULSE_RMS ? norm_rms : norm_peak));
1378 }
1379
1380@@ -810,7 +810,7 @@
1381
1382 void win_level_bar_clicked(GtkWidget *widget, GdkEvent *event, gpointer data) {
1383 // User clicked on the level bar.
1384- // Set BAR_VALUE or BAR_SHAPE. See gtklevelbar.h.value
1385+ // Set BAR_VALUE or BAR_SHAPE. See levelbar.h.
1386 GdkEventButton *ev = (GdkEventButton*)event;
1387
1388 if (ev->button == 1) {
1389@@ -827,7 +827,7 @@
1390 }
1391
1392 // Update GUI
1393- gtk_level_bar_set_value_type(GTK_LEVEL_BAR(g_win.level_bar), bar_value);
1394+ level_bar_set_value_type(LEVEL_BAR(g_win.level_bar), bar_value);
1395
1396 // Save in DConf
1397 conf_save_int_value("level-bar-value", bar_value);
1398@@ -846,7 +846,7 @@
1399 }
1400
1401 // Update GUI
1402- gtk_level_bar_set_shape(GTK_LEVEL_BAR(g_win.level_bar), bar_shape);
1403+ level_bar_set_shape(LEVEL_BAR(g_win.level_bar), bar_shape);
1404
1405 // Save in DConf
1406 conf_save_int_value("level-bar-shape", bar_shape);
1407@@ -981,7 +981,7 @@
1408 }
1409 }
1410
1411- // Gtklevelbar/pulsebar: Indicator for sound amplitude (a GtkLevelBar widget).
1412+ // Levelbar/pulsebar: Indicator for sound amplitude.
1413 // Put it in a GtkEventBox so we can catch click events.
1414
1415 GtkWidget *event_box = gtk_event_box_new();
1416@@ -992,24 +992,24 @@
1417 gtk_widget_set_events(event_box, GDK_BUTTON_PRESS_MASK);
1418 g_signal_connect(event_box, "button_press_event", G_CALLBACK(win_level_bar_clicked), NULL);
1419
1420- // Create GtkLevelBar widget and put it in the GtkEventBox
1421- g_win.level_bar = gtk_level_bar_new();
1422+ // Create a LevelBar widget and put it in the GtkEventBox
1423+ g_win.level_bar = level_bar_new();
1424 gtk_widget_show(g_win.level_bar);
1425 gtk_container_add(GTK_CONTAINER(event_box), g_win.level_bar);
1426- gtk_level_bar_set_fraction(GTK_LEVEL_BAR(g_win.level_bar), 0.0);
1427+ level_bar_set_fraction(LEVEL_BAR(g_win.level_bar), 0.0);
1428
1429 // How to draw the level bar?
1430 // Get from DConf
1431 gint bar_shape = SHAPE_CIRCLE;
1432 conf_get_int_value("level-bar-shape", &bar_shape);
1433- gtk_level_bar_set_shape(GTK_LEVEL_BAR(g_win.level_bar), bar_shape);
1434+ level_bar_set_shape(LEVEL_BAR(g_win.level_bar), bar_shape);
1435 // Notice: User can change this by RIGHT-clicking on the level-bar
1436
1437 // Type of value on the level bar?
1438 // Get from DConf
1439 gint bar_value = VALUE_NONE;
1440 conf_get_int_value("level-bar-value", &bar_value);
1441- gtk_level_bar_set_value_type(GTK_LEVEL_BAR(g_win.level_bar), bar_value);
1442+ level_bar_set_value_type(LEVEL_BAR(g_win.level_bar), bar_value);
1443 // Notice: User can change this by LEFT-clicking on the level-bar
1444
1445 // Should we show RMS or peak-value on the levelbar?
1446
1447=== modified file 'src/rec-window.h'
1448--- src/rec-window.h 2015-02-06 14:13:34 +0000
1449+++ src/rec-window.h 2015-04-11 20:15:48 +0000
1450@@ -5,12 +5,12 @@
1451 #include <gtk/gtk.h>
1452 #include <gdk/gdk.h>
1453
1454-#include "gtklevelbar.h"
1455+#include "levelbar.h"
1456
1457 // Width of the settings window
1458 #define PREF_WINDOW_WIDTH 300
1459
1460-// PULSE_TYPE: Type of pulse on the gtklevelbar.
1461+// PULSE_TYPE: Type of pulse on the levelbar.
1462 // Notice: This cannot be changed from the GUI.
1463 // Use Gsettings/dconf-editor and find "level-bar-pulse-type" in apps -> audio-recorder.
1464 typedef enum PULSE_TYPE {PULSE_PEAK, PULSE_RMS} PULSE_TYPE;
1465
1466=== modified file 'src/settings.c'
1467--- src/settings.c 2015-02-10 20:45:27 +0000
1468+++ src/settings.c 2015-04-11 20:15:48 +0000
1469@@ -354,7 +354,7 @@
1470 case COMM_PROGRAM:
1471 descr = g_strdup(item->description);
1472
1473- pixbuf = load_icon_pixbuf(item->icon_name);
1474+ pixbuf = load_icon_pixbuf(item->icon_name, 22);
1475
1476 // Translators: This is a label/help text in the [Additional settings] dialog
1477 help_text = g_strdup(_("Select both output device (speakers) and webcam/microphone."));
1478
1479=== modified file 'src/systray-icon.c'
1480--- src/systray-icon.c 2015-02-06 14:13:34 +0000
1481+++ src/systray-icon.c 2015-04-11 20:15:48 +0000
1482@@ -101,7 +101,7 @@
1483 static void systray_popup_menu_cb(GtkWidget * widget, gpointer data) {
1484 gchar *cmd = (gchar*)data;
1485
1486- LOG_SYSTRAY("%s: systray_popup_menu_cb: %s\n", INSTALLED_INDICATOR_TYPE, cmd);
1487+ LOG_SYSTRAY("systray_popup_menu_cb: %s\n", cmd);
1488
1489 if (!g_strcmp0(cmd, "start")) {
1490 rec_manager_flip_recording();
1491
1492=== modified file 'src/utility.c'
1493--- src/utility.c 2015-02-06 14:13:34 +0000
1494+++ src/utility.c 2015-04-11 20:15:48 +0000
1495@@ -923,7 +923,7 @@
1496 return value;
1497 }
1498
1499-GdkPixbuf *load_icon_pixbuf(gchar *icon_name) {
1500+GdkPixbuf *load_icon_pixbuf(gchar *icon_name, guint _size) {
1501 // Load icon pixbuf from current icon theme.
1502 GdkPixbuf *pixbuf = NULL;
1503
1504@@ -935,11 +935,11 @@
1505 GtkIconTheme *theme = gtk_icon_theme_get_default();
1506
1507 // Load icon from its theme
1508- pixbuf = gtk_icon_theme_load_icon(theme, icon_name, 22, 0, NULL);
1509+ pixbuf = gtk_icon_theme_load_icon(theme, icon_name, _size, 0, NULL);
1510
1511 // Got it?
1512 if (GDK_IS_PIXBUF(pixbuf)) {
1513- return pixbuf;
1514+ goto LBL_1;
1515 }
1516
1517 // Executable name != icon_name.
1518@@ -969,13 +969,22 @@
1519
1520 if (icon_n) {
1521 // Load icon
1522- pixbuf = gtk_icon_theme_load_icon(theme, icon_n, 22, 0, NULL);
1523+ pixbuf = gtk_icon_theme_load_icon(theme, icon_n, _size, 0, NULL);
1524 }
1525
1526 g_free(icon_n);
1527 g_free(desktop_file);
1528 g_object_unref(app_info);
1529
1530+LBL_1:
1531+
1532+ // Some icons are large. Force to _size.
1533+ if (GDK_IS_PIXBUF(pixbuf)) {
1534+ GdkPixbuf *img = gdk_pixbuf_scale_simple(pixbuf, _size, _size, GDK_INTERP_HYPER);
1535+ g_object_unref(pixbuf);
1536+ pixbuf = img;
1537+ }
1538+
1539 // Caller should g_object_unref() this value
1540 return pixbuf;
1541 }
1542
1543=== modified file 'src/utility.h'
1544--- src/utility.h 2014-10-27 17:16:32 +0000
1545+++ src/utility.h 2015-04-11 20:15:48 +0000
1546@@ -74,7 +74,7 @@
1547 gboolean str_lists_equal(GList *l1, GList *l2);
1548
1549 gchar *read_value_from_keyfile(gchar *key_file, gchar *group_name, gchar *key_name);
1550-GdkPixbuf *load_icon_pixbuf(gchar *icon_name);
1551+GdkPixbuf *load_icon_pixbuf(gchar *icon_name, guint _size);
1552
1553 void kill_frozen_instances(gchar *program_path, GPid preserve_pid);
1554 void kill_program_by_name(gchar *app_name, GPid preserve_pid);

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: