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