Merge lp:~3v1n0/ubuntu/precise/bamf/libreoffice-fixes into lp:ubuntu/precise/bamf
- Precise (12.04)
- libreoffice-fixes
- Merge into precise
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Merged at revision: | 52 |
Proposed branch: | lp:~3v1n0/ubuntu/precise/bamf/libreoffice-fixes |
Merge into: | lp:ubuntu/precise/bamf |
Diff against target: |
1607 lines (+633/-191) 24 files modified
Makefile.in (+2/-0) configure (+125/-9) configure.in (+16/-1) data/Makefile.in (+2/-0) debian/changelog (+13/-0) doc/Makefile.in (+2/-0) doc/reference/Makefile.in (+2/-0) doc/reference/libbamf/Makefile.in (+2/-0) lib/libbamf/Makefile.in (+2/-0) lib/libbamf/bamf-matcher.c (+2/-4) src/Makefile.in (+2/-0) src/bamf-application.c (+15/-2) src/bamf-legacy-screen.c (+31/-0) src/bamf-legacy-screen.h (+2/-0) src/bamf-legacy-window.c (+38/-7) src/bamf-legacy-window.h (+2/-0) src/bamf-matcher.c (+245/-146) src/bamf-view.c (+7/-3) tests/bamfdaemon/Makefile.am (+31/-1) tests/bamfdaemon/Makefile.in (+29/-2) tests/bamfdaemon/test-application.c (+1/-13) tests/functional/Makefile.in (+2/-0) tests/libbamf/Makefile.am (+31/-1) tests/libbamf/Makefile.in (+29/-2) |
To merge this branch: | bzr merge lp:~3v1n0/ubuntu/precise/bamf/libreoffice-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Pending | ||
Review via email: mp+85966@code.launchpad.net |
Commit message
Description of the change
Mainly fixing bug #842566 that caused libreoffice windows not to be mapped in the unity launcher or alt+tab.
Plus more extra fixes including memory leaks.
Read more on the main branch merge proposal: http://
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile.in' |
2 | --- Makefile.in 2011-09-22 15:15:28 +0000 |
3 | +++ Makefile.in 2011-12-15 22:03:33 +0000 |
4 | @@ -125,6 +125,7 @@ |
5 | CYGPATH_W = @CYGPATH_W@ |
6 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
7 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
8 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
9 | DBUS_LIBS = @DBUS_LIBS@ |
10 | DEFS = @DEFS@ |
11 | DEPDIR = @DEPDIR@ |
12 | @@ -205,6 +206,7 @@ |
13 | WARN_CFLAGS = @WARN_CFLAGS@ |
14 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
15 | WNCK_LIBS = @WNCK_LIBS@ |
16 | +XVFB = @XVFB@ |
17 | X_CFLAGS = @X_CFLAGS@ |
18 | X_LIBS = @X_LIBS@ |
19 | abs_builddir = @abs_builddir@ |
20 | |
21 | === modified file 'configure' |
22 | --- configure 2011-09-26 13:51:22 +0000 |
23 | +++ configure 2011-12-15 22:03:33 +0000 |
24 | @@ -621,6 +621,10 @@ |
25 | BAMFDAEMON_CFLAGS |
26 | GTK_LIBS |
27 | GTK_CFLAGS |
28 | +DBUS_LAUNCH |
29 | +XVFB |
30 | +ENABLE_HEADLESS_TESTS_FALSE |
31 | +ENABLE_HEADLESS_TESTS_TRUE |
32 | GTK_DOC_USE_REBASE_FALSE |
33 | GTK_DOC_USE_REBASE_TRUE |
34 | GTK_DOC_USE_LIBTOOL_FALSE |
35 | @@ -803,6 +807,7 @@ |
36 | enable_gtk_doc |
37 | enable_gtk_doc_html |
38 | enable_gtk_doc_pdf |
39 | +enable_headless_tests |
40 | enable_gtktest |
41 | ' |
42 | ac_precious_vars='build_alias |
43 | @@ -1468,6 +1473,9 @@ |
44 | --enable-gtk-doc use gtk-doc to build documentation [[default=no]] |
45 | --enable-gtk-doc-html build documentation in html format [[default=yes]] |
46 | --enable-gtk-doc-pdf build documentation in pdf format [[default=no]] |
47 | + --enable-headless-tests=[no/yes] |
48 | + enable headless test suite (requires Xvfb) |
49 | + [default=no] |
50 | --disable-gtktest do not try to compile and run a test GTK+ program |
51 | |
52 | Optional Packages: |
53 | @@ -12683,12 +12691,12 @@ |
54 | pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" |
55 | elif test -n "$PKG_CONFIG"; then |
56 | if test -n "$PKG_CONFIG" && \ |
57 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0\""; } >&5 |
58 | - ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0") 2>&5 |
59 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0\""; } >&5 |
60 | + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0") 2>&5 |
61 | ac_status=$? |
62 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
63 | test $ac_status = 0; }; then |
64 | - pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0" 2>/dev/null` |
65 | + pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0" 2>/dev/null` |
66 | test "x$?" != "x0" && pkg_failed=yes |
67 | else |
68 | pkg_failed=yes |
69 | @@ -12700,12 +12708,12 @@ |
70 | pkg_cv_GLIB_LIBS="$GLIB_LIBS" |
71 | elif test -n "$PKG_CONFIG"; then |
72 | if test -n "$PKG_CONFIG" && \ |
73 | - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0\""; } >&5 |
74 | - ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0") 2>&5 |
75 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0\""; } >&5 |
76 | + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0") 2>&5 |
77 | ac_status=$? |
78 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 |
79 | test $ac_status = 0; }; then |
80 | - pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0" 2>/dev/null` |
81 | + pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0" 2>/dev/null` |
82 | test "x$?" != "x0" && pkg_failed=yes |
83 | else |
84 | pkg_failed=yes |
85 | @@ -12726,14 +12734,14 @@ |
86 | _pkg_short_errors_supported=no |
87 | fi |
88 | if test $_pkg_short_errors_supported = yes; then |
89 | - GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0" 2>&1` |
90 | + GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0" 2>&1` |
91 | else |
92 | - GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0" 2>&1` |
93 | + GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0" 2>&1` |
94 | fi |
95 | # Put the nasty error message in config.log where it belongs |
96 | echo "$GLIB_PKG_ERRORS" >&5 |
97 | |
98 | - as_fn_error $? "Package requirements (glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0) were not met: |
99 | + as_fn_error $? "Package requirements (glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0) were not met: |
100 | |
101 | $GLIB_PKG_ERRORS |
102 | |
103 | @@ -13948,6 +13956,108 @@ |
104 | |
105 | |
106 | |
107 | +########################### |
108 | +# Headless tests |
109 | +########################### |
110 | +# Check whether --enable-headless-tests was given. |
111 | +if test "${enable_headless_tests+set}" = set; then : |
112 | + enableval=$enable_headless_tests; |
113 | +else |
114 | + enable_headless_tests=no |
115 | +fi |
116 | + |
117 | + |
118 | + if test "x$enable_headless_tests" != "xno"; then |
119 | + ENABLE_HEADLESS_TESTS_TRUE= |
120 | + ENABLE_HEADLESS_TESTS_FALSE='#' |
121 | +else |
122 | + ENABLE_HEADLESS_TESTS_TRUE='#' |
123 | + ENABLE_HEADLESS_TESTS_FALSE= |
124 | +fi |
125 | + |
126 | + |
127 | +if test "x$enable_headless_tests" = "xyes"; then |
128 | + # Extract the first word of "Xvfb", so it can be a program name with args. |
129 | +set dummy Xvfb; ac_word=$2 |
130 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 |
131 | +$as_echo_n "checking for $ac_word... " >&6; } |
132 | +if ${ac_cv_path_XVFB+:} false; then : |
133 | + $as_echo_n "(cached) " >&6 |
134 | +else |
135 | + case $XVFB in |
136 | + [\\/]* | ?:[\\/]*) |
137 | + ac_cv_path_XVFB="$XVFB" # Let the user override the test with a path. |
138 | + ;; |
139 | + *) |
140 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
141 | +for as_dir in $PATH |
142 | +do |
143 | + IFS=$as_save_IFS |
144 | + test -z "$as_dir" && as_dir=. |
145 | + for ac_exec_ext in '' $ac_executable_extensions; do |
146 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then |
147 | + ac_cv_path_XVFB="$as_dir/$ac_word$ac_exec_ext" |
148 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
149 | + break 2 |
150 | + fi |
151 | +done |
152 | + done |
153 | +IFS=$as_save_IFS |
154 | + |
155 | + ;; |
156 | +esac |
157 | +fi |
158 | +XVFB=$ac_cv_path_XVFB |
159 | +if test -n "$XVFB"; then |
160 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XVFB" >&5 |
161 | +$as_echo "$XVFB" >&6; } |
162 | +else |
163 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
164 | +$as_echo "no" >&6; } |
165 | +fi |
166 | + |
167 | + |
168 | + # Extract the first word of "dbus-launch", so it can be a program name with args. |
169 | +set dummy dbus-launch; ac_word=$2 |
170 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 |
171 | +$as_echo_n "checking for $ac_word... " >&6; } |
172 | +if ${ac_cv_path_DBUS_LAUNCH+:} false; then : |
173 | + $as_echo_n "(cached) " >&6 |
174 | +else |
175 | + case $DBUS_LAUNCH in |
176 | + [\\/]* | ?:[\\/]*) |
177 | + ac_cv_path_DBUS_LAUNCH="$DBUS_LAUNCH" # Let the user override the test with a path. |
178 | + ;; |
179 | + *) |
180 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
181 | +for as_dir in $PATH |
182 | +do |
183 | + IFS=$as_save_IFS |
184 | + test -z "$as_dir" && as_dir=. |
185 | + for ac_exec_ext in '' $ac_executable_extensions; do |
186 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then |
187 | + ac_cv_path_DBUS_LAUNCH="$as_dir/$ac_word$ac_exec_ext" |
188 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
189 | + break 2 |
190 | + fi |
191 | +done |
192 | + done |
193 | +IFS=$as_save_IFS |
194 | + |
195 | + ;; |
196 | +esac |
197 | +fi |
198 | +DBUS_LAUNCH=$ac_cv_path_DBUS_LAUNCH |
199 | +if test -n "$DBUS_LAUNCH"; then |
200 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBUS_LAUNCH" >&5 |
201 | +$as_echo "$DBUS_LAUNCH" >&6; } |
202 | +else |
203 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
204 | +$as_echo "no" >&6; } |
205 | +fi |
206 | + |
207 | + |
208 | +fi |
209 | |
210 | # |
211 | # Gnome/GTK checks |
212 | @@ -14647,6 +14757,10 @@ |
213 | as_fn_error $? "conditional \"GTK_DOC_USE_REBASE\" was never defined. |
214 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
215 | fi |
216 | +if test -z "${ENABLE_HEADLESS_TESTS_TRUE}" && test -z "${ENABLE_HEADLESS_TESTS_FALSE}"; then |
217 | + as_fn_error $? "conditional \"ENABLE_HEADLESS_TESTS\" was never defined. |
218 | +Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
219 | +fi |
220 | |
221 | : "${CONFIG_STATUS=./config.status}" |
222 | ac_write_fail=0 |
223 | @@ -16910,4 +17024,6 @@ |
224 | Build Environment |
225 | Install Prefix: ${prefix} |
226 | GTK+ Version: ${with_gtk} |
227 | + Headless tests: ${enable_headless_tests} |
228 | + |
229 | EOF |
230 | |
231 | === modified file 'configure.in' |
232 | --- configure.in 2011-09-26 13:51:22 +0000 |
233 | +++ configure.in 2011-12-15 22:03:33 +0000 |
234 | @@ -56,7 +56,7 @@ |
235 | # |
236 | # glib |
237 | # |
238 | -PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16.0 gio-2.0 gio-unix-2.0) |
239 | +PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28.0 gio-2.0 gio-unix-2.0) |
240 | |
241 | # |
242 | # dbus |
243 | @@ -114,6 +114,19 @@ |
244 | ########################### |
245 | GTK_DOC_CHECK(1.0) |
246 | |
247 | +########################### |
248 | +# Headless tests |
249 | +########################### |
250 | +AC_ARG_ENABLE([headless-tests], |
251 | + AS_HELP_STRING([--enable-headless-tests=@<:@no/yes@:>@],[enable headless test suite (requires Xvfb) @<:@default=no@:>@]),, |
252 | + [enable_headless_tests=no]) |
253 | + |
254 | +AM_CONDITIONAL([ENABLE_HEADLESS_TESTS],[test "x$enable_headless_tests" != "xno"]) |
255 | + |
256 | +if test "x$enable_headless_tests" = "xyes"; then |
257 | + AC_PATH_PROG([XVFB],[Xvfb]) |
258 | + AC_PATH_PROG([DBUS_LAUNCH],[dbus-launch]) |
259 | +fi |
260 | |
261 | # |
262 | # Gnome/GTK checks |
263 | @@ -157,4 +170,6 @@ |
264 | Build Environment |
265 | Install Prefix: ${prefix} |
266 | GTK+ Version: ${with_gtk} |
267 | + Headless tests: ${enable_headless_tests} |
268 | + |
269 | EOF |
270 | |
271 | === modified file 'data/Makefile.in' |
272 | --- data/Makefile.in 2011-09-22 15:15:28 +0000 |
273 | +++ data/Makefile.in 2011-12-15 22:03:33 +0000 |
274 | @@ -93,6 +93,7 @@ |
275 | CYGPATH_W = @CYGPATH_W@ |
276 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
277 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
278 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
279 | DBUS_LIBS = @DBUS_LIBS@ |
280 | DEFS = @DEFS@ |
281 | DEPDIR = @DEPDIR@ |
282 | @@ -173,6 +174,7 @@ |
283 | WARN_CFLAGS = @WARN_CFLAGS@ |
284 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
285 | WNCK_LIBS = @WNCK_LIBS@ |
286 | +XVFB = @XVFB@ |
287 | X_CFLAGS = @X_CFLAGS@ |
288 | X_LIBS = @X_LIBS@ |
289 | abs_builddir = @abs_builddir@ |
290 | |
291 | === modified file 'debian/changelog' |
292 | --- debian/changelog 2011-09-26 13:51:22 +0000 |
293 | +++ debian/changelog 2011-12-15 22:03:33 +0000 |
294 | @@ -1,3 +1,16 @@ |
295 | +bamf (0.2.104-0ubuntu2) UNRELEASED; urgency=low |
296 | + |
297 | + * Importing trunk revision 424 fixing various LibreOffice related bugs: |
298 | + - Unity acts not as a dock for LibreOffice but as a launcher |
299 | + (LP: #741995) |
300 | + - Libreoffice and unity integration broken (LP: #842566) |
301 | + - Libreoffice Calc icon does not appear when opened via Writer |
302 | + (LP: #861355) |
303 | + - Alt-tab and launcher shows floating toolbars in LibreOffice as |
304 | + additional windows (LP: #840000) |
305 | + |
306 | + -- Marco Trevisan (Treviño) <3v1n0@ubuntu.com> Thu, 15 Dec 2011 22:05:02 +0100 |
307 | + |
308 | bamf (0.2.104-0ubuntu1) oneiric; urgency=low |
309 | |
310 | * New upstream release. |
311 | |
312 | === modified file 'doc/Makefile.in' |
313 | --- doc/Makefile.in 2011-09-22 15:15:28 +0000 |
314 | +++ doc/Makefile.in 2011-12-15 22:03:33 +0000 |
315 | @@ -109,6 +109,7 @@ |
316 | CYGPATH_W = @CYGPATH_W@ |
317 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
318 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
319 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
320 | DBUS_LIBS = @DBUS_LIBS@ |
321 | DEFS = @DEFS@ |
322 | DEPDIR = @DEPDIR@ |
323 | @@ -189,6 +190,7 @@ |
324 | WARN_CFLAGS = @WARN_CFLAGS@ |
325 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
326 | WNCK_LIBS = @WNCK_LIBS@ |
327 | +XVFB = @XVFB@ |
328 | X_CFLAGS = @X_CFLAGS@ |
329 | X_LIBS = @X_LIBS@ |
330 | abs_builddir = @abs_builddir@ |
331 | |
332 | === modified file 'doc/reference/Makefile.in' |
333 | --- doc/reference/Makefile.in 2011-09-22 15:15:28 +0000 |
334 | +++ doc/reference/Makefile.in 2011-12-15 22:03:33 +0000 |
335 | @@ -109,6 +109,7 @@ |
336 | CYGPATH_W = @CYGPATH_W@ |
337 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
338 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
339 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
340 | DBUS_LIBS = @DBUS_LIBS@ |
341 | DEFS = @DEFS@ |
342 | DEPDIR = @DEPDIR@ |
343 | @@ -189,6 +190,7 @@ |
344 | WARN_CFLAGS = @WARN_CFLAGS@ |
345 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
346 | WNCK_LIBS = @WNCK_LIBS@ |
347 | +XVFB = @XVFB@ |
348 | X_CFLAGS = @X_CFLAGS@ |
349 | X_LIBS = @X_LIBS@ |
350 | abs_builddir = @abs_builddir@ |
351 | |
352 | === modified file 'doc/reference/libbamf/Makefile.in' |
353 | --- doc/reference/libbamf/Makefile.in 2011-09-22 15:15:28 +0000 |
354 | +++ doc/reference/libbamf/Makefile.in 2011-12-15 22:03:33 +0000 |
355 | @@ -76,6 +76,7 @@ |
356 | CYGPATH_W = @CYGPATH_W@ |
357 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
358 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
359 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
360 | DBUS_LIBS = @DBUS_LIBS@ |
361 | DEFS = @DEFS@ |
362 | DEPDIR = @DEPDIR@ |
363 | @@ -156,6 +157,7 @@ |
364 | WARN_CFLAGS = @WARN_CFLAGS@ |
365 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
366 | WNCK_LIBS = @WNCK_LIBS@ |
367 | +XVFB = @XVFB@ |
368 | X_CFLAGS = @X_CFLAGS@ |
369 | X_LIBS = @X_LIBS@ |
370 | abs_builddir = @abs_builddir@ |
371 | |
372 | === modified file 'lib/libbamf/Makefile.in' |
373 | --- lib/libbamf/Makefile.in 2011-09-22 15:15:28 +0000 |
374 | +++ lib/libbamf/Makefile.in 2011-12-15 22:03:33 +0000 |
375 | @@ -163,6 +163,7 @@ |
376 | CYGPATH_W = @CYGPATH_W@ |
377 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
378 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
379 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
380 | DBUS_LIBS = @DBUS_LIBS@ |
381 | DEFS = @DEFS@ |
382 | DEPDIR = @DEPDIR@ |
383 | @@ -243,6 +244,7 @@ |
384 | WARN_CFLAGS = @WARN_CFLAGS@ |
385 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
386 | WNCK_LIBS = @WNCK_LIBS@ |
387 | +XVFB = @XVFB@ |
388 | X_CFLAGS = @X_CFLAGS@ |
389 | X_LIBS = @X_LIBS@ |
390 | abs_builddir = @abs_builddir@ |
391 | |
392 | === modified file 'lib/libbamf/bamf-matcher.c' |
393 | --- lib/libbamf/bamf-matcher.c 2011-03-17 17:51:00 +0000 |
394 | +++ lib/libbamf/bamf-matcher.c 2011-12-15 22:03:33 +0000 |
395 | @@ -128,8 +128,7 @@ |
396 | view = bamf_factory_view_for_path (bamf_factory_get_default (), path); |
397 | g_object_ref (view); |
398 | |
399 | - if (!bamf_view_is_sticky (view)) |
400 | - g_signal_emit (matcher, matcher_signals[VIEW_OPENED],0, view); |
401 | + g_signal_emit (matcher, matcher_signals[VIEW_OPENED], 0, view); |
402 | } |
403 | |
404 | static void |
405 | @@ -145,8 +144,7 @@ |
406 | if (!BAMF_IS_VIEW (view)) |
407 | return; |
408 | |
409 | - if (!bamf_view_is_sticky (view)) |
410 | - g_signal_emit (matcher, matcher_signals[VIEW_CLOSED],0, view); |
411 | + g_signal_emit (matcher, matcher_signals[VIEW_CLOSED], 0, view); |
412 | |
413 | g_object_unref (view); |
414 | } |
415 | |
416 | === modified file 'src/Makefile.in' |
417 | --- src/Makefile.in 2011-09-22 15:15:28 +0000 |
418 | +++ src/Makefile.in 2011-12-15 22:03:33 +0000 |
419 | @@ -129,6 +129,7 @@ |
420 | CYGPATH_W = @CYGPATH_W@ |
421 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
422 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
423 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
424 | DBUS_LIBS = @DBUS_LIBS@ |
425 | DEFS = @DEFS@ |
426 | DEPDIR = @DEPDIR@ |
427 | @@ -209,6 +210,7 @@ |
428 | WARN_CFLAGS = @WARN_CFLAGS@ |
429 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
430 | WNCK_LIBS = @WNCK_LIBS@ |
431 | +XVFB = @XVFB@ |
432 | X_CFLAGS = @X_CFLAGS@ |
433 | X_LIBS = @X_LIBS@ |
434 | abs_builddir = @abs_builddir@ |
435 | |
436 | === modified file 'src/bamf-application.c' |
437 | --- src/bamf-application.c 2011-09-08 20:09:28 +0000 |
438 | +++ src/bamf-application.c 2011-12-15 22:03:33 +0000 |
439 | @@ -145,7 +145,9 @@ |
440 | gicon = g_app_info_get_icon (G_APP_INFO (desktop)); |
441 | |
442 | name = g_strdup (g_app_info_get_display_name (G_APP_INFO (desktop))); |
443 | - icon = g_icon_to_string (gicon); |
444 | + |
445 | + if (gicon) |
446 | + icon = g_icon_to_string (gicon); |
447 | |
448 | if (g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, STUB_KEY, NULL)) { |
449 | /* This will error to return false, which is okay as it seems |
450 | @@ -227,7 +229,12 @@ |
451 | } |
452 | |
453 | if (icon) |
454 | - self->priv->icon = icon; |
455 | + { |
456 | + if (self->priv->icon) |
457 | + g_free (self->priv->icon); |
458 | + |
459 | + self->priv->icon = icon; |
460 | + } |
461 | |
462 | if (name) |
463 | bamf_view_set_name (BAMF_VIEW (self), name); |
464 | @@ -611,6 +618,12 @@ |
465 | priv->app_type = NULL; |
466 | } |
467 | |
468 | + if (priv->icon) |
469 | + { |
470 | + g_free (priv->icon); |
471 | + priv->icon = NULL; |
472 | + } |
473 | + |
474 | if (priv->wmclass) |
475 | { |
476 | g_free (priv->wmclass); |
477 | |
478 | === modified file 'src/bamf-legacy-screen.c' |
479 | --- src/bamf-legacy-screen.c 2011-08-04 14:56:07 +0000 |
480 | +++ src/bamf-legacy-screen.c 2011-12-15 22:03:33 +0000 |
481 | @@ -160,6 +160,7 @@ |
482 | handle_window_opened (WnckScreen *screen, WnckWindow *window, BamfLegacyScreen *legacy) |
483 | { |
484 | BamfLegacyWindow *legacy_window; |
485 | + g_return_if_fail (WNCK_IS_WINDOW (window)); |
486 | |
487 | legacy_window = bamf_legacy_window_new (window); |
488 | |
489 | @@ -171,6 +172,36 @@ |
490 | g_signal_emit (legacy, legacy_screen_signals[WINDOW_OPENED], 0, legacy_window); |
491 | } |
492 | |
493 | +/* This function allows to push into the screen a window by its xid. |
494 | + * If the window is already known, it's just ignored, otherwise it gets added |
495 | + * to the windows list. The BamfLegacyScreen should automatically update its |
496 | + * windows list when they are added/removed from the screen, but if a child |
497 | + * BamfLegacyWindow is closed, then it could be possible to re-add it. */ |
498 | +void |
499 | +bamf_legacy_screen_inject_window (BamfLegacyScreen *self, guint xid) |
500 | +{ |
501 | + g_return_if_fail (BAMF_IS_LEGACY_SCREEN (self)); |
502 | + BamfLegacyWindow *window; |
503 | + GList *l; |
504 | + |
505 | + for (l = self->priv->windows; l; l = l->next) |
506 | + { |
507 | + window = l->data; |
508 | + |
509 | + if (bamf_legacy_window_get_xid (window) == xid) |
510 | + { |
511 | + return; |
512 | + } |
513 | + } |
514 | + |
515 | + WnckWindow *legacy_window = wnck_window_get(xid); |
516 | + |
517 | + if (WNCK_IS_WINDOW (legacy_window)) |
518 | + { |
519 | + handle_window_opened(NULL, legacy_window, self); |
520 | + } |
521 | +} |
522 | + |
523 | void |
524 | bamf_legacy_screen_set_state_file (BamfLegacyScreen *self, |
525 | const char *file) |
526 | |
527 | === modified file 'src/bamf-legacy-screen.h' |
528 | --- src/bamf-legacy-screen.h 2010-05-25 10:32:24 +0000 |
529 | +++ src/bamf-legacy-screen.h 2011-12-15 22:03:33 +0000 |
530 | @@ -67,4 +67,6 @@ |
531 | |
532 | BamfLegacyScreen * bamf_legacy_screen_get_default (void); |
533 | |
534 | +void bamf_legacy_screen_inject_window (BamfLegacyScreen *screen, guint xid); |
535 | + |
536 | #endif |
537 | |
538 | === modified file 'src/bamf-legacy-window.c' |
539 | --- src/bamf-legacy-window.c 2011-09-26 13:51:22 +0000 |
540 | +++ src/bamf-legacy-window.c 2011-12-15 22:03:33 +0000 |
541 | @@ -215,6 +215,9 @@ |
542 | |
543 | window = self->priv->legacy_window; |
544 | |
545 | + if (!window) |
546 | + return NULL; |
547 | + |
548 | if (wnck_window_get_icon_is_fallback (window)) |
549 | return NULL; |
550 | |
551 | @@ -325,13 +328,41 @@ |
552 | { |
553 | g_return_if_fail (BAMF_IS_LEGACY_WINDOW (self)); |
554 | g_return_if_fail (WNCK_IS_WINDOW (window)); |
555 | - |
556 | + |
557 | + if (self->priv->legacy_window == window) |
558 | + { |
559 | + self->priv->is_closed = TRUE; |
560 | + g_signal_emit (self, legacy_window_signals[CLOSED], 0); |
561 | + } |
562 | +} |
563 | + |
564 | +static void |
565 | +handle_destroy_notify (gpointer *data, BamfLegacyWindow *self_was_here) |
566 | +{ |
567 | + BamfLegacyScreen *screen = bamf_legacy_screen_get_default (); |
568 | + bamf_legacy_screen_inject_window (screen, GPOINTER_TO_UINT (data)); |
569 | +} |
570 | + |
571 | +/* This utility function allows to set a BamfLegacyWindow as closed, notifying |
572 | + * all its owners, and to reopen it once the current window has been destroyed. |
573 | + * This allows to remap particular windows to different applications. */ |
574 | +void |
575 | +bamf_legacy_window_reopen (BamfLegacyWindow *self) |
576 | +{ |
577 | + g_return_if_fail (BAMF_IS_LEGACY_WINDOW (self)); |
578 | + g_return_if_fail (WNCK_IS_WINDOW (self->priv->legacy_window)); |
579 | + |
580 | + guint xid = bamf_legacy_window_get_xid (self); |
581 | + |
582 | + /* Adding a weak ref to this object, causes to get notified after the object |
583 | + * destruction, so once this BamfLegacyWindow has been closed and drestroyed |
584 | + * the handle_destroy_notify() function will be called, and that will |
585 | + * provide to iniject another window like this one to the BamfLegacyScreen */ |
586 | + g_object_weak_ref (G_OBJECT (self), (GWeakNotify) handle_destroy_notify, |
587 | + GUINT_TO_POINTER (xid)); |
588 | + |
589 | self->priv->is_closed = TRUE; |
590 | - |
591 | - if (window == self->priv->legacy_window) |
592 | - { |
593 | - g_signal_emit (self, legacy_window_signals[CLOSED], 0); |
594 | - } |
595 | + g_signal_emit (self, legacy_window_signals[CLOSED], 0); |
596 | } |
597 | |
598 | static void |
599 | @@ -378,7 +409,7 @@ |
600 | screen = wnck_screen_get_default (); |
601 | |
602 | priv->closed_id = g_signal_connect (G_OBJECT (screen), "window-closed", |
603 | - (GCallback) handle_window_closed, self); |
604 | + (GCallback) handle_window_closed, self); |
605 | } |
606 | |
607 | static void |
608 | |
609 | === modified file 'src/bamf-legacy-window.h' |
610 | --- src/bamf-legacy-window.h 2011-09-26 13:51:22 +0000 |
611 | +++ src/bamf-legacy-window.h 2011-12-15 22:03:33 +0000 |
612 | @@ -112,6 +112,8 @@ |
613 | |
614 | BamfLegacyWindow * bamf_legacy_window_get_transient (BamfLegacyWindow *self); |
615 | |
616 | +void bamf_legacy_window_reopen (BamfLegacyWindow *self); |
617 | + |
618 | BamfLegacyWindow * bamf_legacy_window_new (WnckWindow *legacy_window); |
619 | |
620 | #endif |
621 | |
622 | === modified file 'src/bamf-matcher.c' |
623 | --- src/bamf-matcher.c 2011-09-26 13:51:22 +0000 |
624 | +++ src/bamf-matcher.c 2011-12-15 22:03:33 +0000 |
625 | @@ -14,6 +14,7 @@ |
626 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
627 | * |
628 | * Authored by: Jason Smith <jason.smith@canonical.com> |
629 | + * Marco Trevisan (Treviño) <3v1n0@ubuntu.com> |
630 | * |
631 | */ |
632 | |
633 | @@ -65,7 +66,6 @@ |
634 | GHashTable * desktop_id_table; |
635 | GHashTable * desktop_file_table; |
636 | GHashTable * desktop_class_table; |
637 | - GHashTable * exec_list; |
638 | GHashTable * registered_pids; |
639 | GList * views; |
640 | GList * monitors; |
641 | @@ -135,12 +135,12 @@ |
642 | } |
643 | } |
644 | |
645 | -static void bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view); |
646 | +static void bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view, gboolean unref); |
647 | |
648 | static void |
649 | on_view_closed (BamfView *view, BamfMatcher *self) |
650 | { |
651 | - bamf_matcher_unregister_view (self, view); |
652 | + bamf_matcher_unregister_view (self, view, TRUE); |
653 | } |
654 | |
655 | static void |
656 | @@ -168,7 +168,7 @@ |
657 | } |
658 | |
659 | static void |
660 | -bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view) |
661 | +bamf_matcher_unregister_view (BamfMatcher *self, BamfView *view, gboolean unref) |
662 | { |
663 | const char * path; |
664 | char * type; |
665 | @@ -181,8 +181,11 @@ |
666 | g_signal_handlers_disconnect_by_func (G_OBJECT (view), on_view_closed, self); |
667 | g_signal_handlers_disconnect_by_func (G_OBJECT (view), on_view_active_changed, self); |
668 | |
669 | - self->priv->views = g_list_remove (self->priv->views, view); |
670 | - g_object_unref (view); |
671 | + if (unref) |
672 | + { |
673 | + self->priv->views = g_list_remove (self->priv->views, view); |
674 | + g_object_unref (view); |
675 | + } |
676 | |
677 | g_free (type); |
678 | } |
679 | @@ -191,7 +194,7 @@ |
680 | get_open_office_window_hint (BamfMatcher * self, BamfLegacyWindow * window) |
681 | { |
682 | const gchar *name; |
683 | - char *exec; |
684 | + char *exec = NULL; |
685 | GHashTable *desktopFileTable; |
686 | GList *list; |
687 | |
688 | @@ -199,18 +202,44 @@ |
689 | g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (window), NULL); |
690 | |
691 | name = bamf_legacy_window_get_name (window); |
692 | + const gchar *class = bamf_legacy_window_get_class_name (window); |
693 | + BamfWindowType type = bamf_legacy_window_get_window_type (window); |
694 | |
695 | - if (name == NULL) |
696 | + if (name == NULL && class == NULL) |
697 | return NULL; |
698 | |
699 | - if (g_str_has_suffix (name, "OpenOffice.org Writer")) |
700 | + if (g_str_has_suffix (name, "LibreOffice Writer")) |
701 | + { |
702 | + exec = "libreoffice -writer %U"; |
703 | + } |
704 | + else if (g_str_has_suffix (name, "LibreOffice Calc")) |
705 | + { |
706 | + exec = "libreoffice -calc %U"; |
707 | + } |
708 | + else if (g_str_has_suffix (name, "LibreOffice Impress")) |
709 | + { |
710 | + exec = "libreoffice -impress %U"; |
711 | + } |
712 | + else if (g_str_has_suffix (name, "LibreOffice Math")) |
713 | + { |
714 | + exec = "libreoffice -math %U"; |
715 | + } |
716 | + else if (g_str_has_suffix (name, "LibreOffice Draw")) |
717 | + { |
718 | + exec = "libreoffice -draw %U"; |
719 | + } |
720 | + else if (g_strcmp0 (class, "libreoffice-startcenter") == 0) |
721 | + { |
722 | + exec = "libreoffice %U"; |
723 | + } |
724 | + else if (g_strcmp0 (name, "LibreOffice") == 0 && type == BAMF_WINDOW_NORMAL) |
725 | + { |
726 | + exec = "libreoffice %U"; |
727 | + } |
728 | + else if (g_str_has_suffix (name, "OpenOffice.org Writer")) |
729 | { |
730 | exec = "ooffice -writer %F"; |
731 | } |
732 | - else if (g_str_has_suffix (name, "OpenOffice.org Math")) |
733 | - { |
734 | - exec = "ooffice -math %F"; |
735 | - } |
736 | else if (g_str_has_suffix (name, "OpenOffice.org Calc")) |
737 | { |
738 | exec = "ooffice -calc %F"; |
739 | @@ -219,41 +248,63 @@ |
740 | { |
741 | exec = "ooffice -impress %F"; |
742 | } |
743 | + else if (g_str_has_suffix (name, "OpenOffice.org Math")) |
744 | + { |
745 | + exec = "ooffice -math %F"; |
746 | + } |
747 | else if (g_str_has_suffix (name, "OpenOffice.org Draw")) |
748 | { |
749 | exec = "ooffice -draw %F"; |
750 | } |
751 | - else if (g_str_has_suffix (name, "LibreOffice Writer")) |
752 | - { |
753 | - exec = "libreoffice -writer %U"; |
754 | - } |
755 | - else if (g_str_has_suffix (name, "LibreOffice Math")) |
756 | - { |
757 | - exec = "libreoffice -math %U"; |
758 | - } |
759 | - else if (g_str_has_suffix (name, "LibreOffice Calc")) |
760 | - { |
761 | - exec = "libreoffice -calc %U"; |
762 | - } |
763 | - else if (g_str_has_suffix (name, "LibreOffice Impress")) |
764 | - { |
765 | - exec = "libreoffice -impress %U"; |
766 | - } |
767 | - else if (g_str_has_suffix (name, "LibreOffice Draw")) |
768 | - { |
769 | - exec = "libreoffice -draw %U"; |
770 | + else if (g_strcmp0 (name, "OpenOffice.org") == 0 && type == BAMF_WINDOW_NORMAL) |
771 | + { |
772 | + exec = "ooffice %F"; |
773 | } |
774 | else |
775 | { |
776 | - return NULL; |
777 | + if (type != BAMF_WINDOW_NORMAL || bamf_legacy_window_get_transient (window)) |
778 | + { |
779 | + /* Child windows can generally easily be recognized by their class */ |
780 | + if (g_strcmp0 (class, "libreoffice-writer") == 0) |
781 | + { |
782 | + exec = "libreoffice -writer %U"; |
783 | + } |
784 | + else if (g_strcmp0 (class, "libreoffice-calc") == 0) |
785 | + { |
786 | + exec = "libreoffice -calc %U"; |
787 | + } |
788 | + else if (g_strcmp0 (class, "libreoffice-impress") == 0) |
789 | + { |
790 | + exec = "libreoffice -impress %U"; |
791 | + } |
792 | + else if (g_strcmp0 (class, "libreoffice-math") == 0) |
793 | + { |
794 | + exec = "libreoffice -math %U"; |
795 | + } |
796 | + else if (g_strcmp0 (class, "libreoffice-draw") == 0) |
797 | + { |
798 | + exec = "libreoffice -draw %U"; |
799 | + } |
800 | + } |
801 | + |
802 | + if (!exec) |
803 | + { |
804 | + /* By default fallback to the main launcher */ |
805 | + if (g_str_has_prefix (class, "OpenOffice")) |
806 | + { |
807 | + exec = "ooffice %F"; |
808 | + } |
809 | + else |
810 | + { |
811 | + exec = "libreoffice %U"; |
812 | + } |
813 | + } |
814 | } |
815 | |
816 | desktopFileTable = self->priv->desktop_file_table; |
817 | list = g_hash_table_lookup (desktopFileTable, exec); |
818 | |
819 | - g_return_val_if_fail (list, NULL); |
820 | - |
821 | - return (char *) list->data; |
822 | + return (list ? (char *) list->data : NULL); |
823 | } |
824 | |
825 | /* Attempts to return the binary name for a particular execution string */ |
826 | @@ -266,7 +317,7 @@ |
827 | gboolean regexFail; |
828 | GRegex *regex; |
829 | |
830 | - g_return_val_if_fail (execString && strlen (execString) > 0, g_strdup (execString)); |
831 | + g_return_val_if_fail ((execString && execString[0] != '\0'), g_strdup (execString)); |
832 | |
833 | exec = g_utf8_casefold (execString, -1); |
834 | parts = g_strsplit (exec, " ", 0); |
835 | @@ -328,7 +379,7 @@ |
836 | { |
837 | GArray *arr = g_array_new (FALSE, TRUE, sizeof (char *)); |
838 | |
839 | - char *str = "^gsku$"; |
840 | + char *str = "^gksu(do)?$"; |
841 | g_array_append_val (arr, str); |
842 | |
843 | str = "^sudo$"; |
844 | @@ -542,22 +593,22 @@ |
845 | GHashTable *desktop_id_table, |
846 | GHashTable *desktop_class_table) |
847 | { |
848 | - GAppInfo *desktop_file; |
849 | + GDesktopAppInfo *desktop_file; |
850 | char *exec; |
851 | char *path; |
852 | GString *desktop_id; /* is ok... really */ |
853 | |
854 | g_return_if_fail (BAMF_IS_MATCHER (self)); |
855 | |
856 | - desktop_file = G_APP_INFO (g_desktop_app_info_new_from_filename (file)); |
857 | + desktop_file = g_desktop_app_info_new_from_filename (file); |
858 | |
859 | if (!G_IS_APP_INFO (desktop_file)) |
860 | return; |
861 | - |
862 | - if (g_app_info_should_show (desktop_file) == FALSE) |
863 | + |
864 | + if (!g_desktop_app_info_get_show_in (desktop_file, g_getenv ("XDG_CURRENT_DESKTOP"))) |
865 | return; |
866 | |
867 | - exec = g_strdup (g_app_info_get_commandline (desktop_file)); |
868 | + exec = g_strdup (g_app_info_get_commandline (G_APP_INFO (desktop_file))); |
869 | |
870 | if (!exec) |
871 | return; |
872 | @@ -582,7 +633,7 @@ |
873 | g_free (path); |
874 | |
875 | desktop_id = g_string_truncate (desktop_id, desktop_id->len - 8); /* remove last 8 characters for .desktop */ |
876 | - |
877 | + |
878 | insert_data_into_tables (self, file, exec, desktop_id->str, desktop_file_table, desktop_id_table); |
879 | insert_desktop_file_class_into_table (self, file, desktop_class_table); |
880 | |
881 | @@ -617,7 +668,6 @@ |
882 | info = g_file_enumerator_next_file (enumerator, NULL, NULL); |
883 | for (; info; info = g_file_enumerator_next_file (enumerator, NULL, NULL)) |
884 | { |
885 | - |
886 | name = g_file_info_get_name (info); |
887 | path = g_build_filename (directory, name, NULL); |
888 | |
889 | @@ -937,7 +987,10 @@ |
890 | if (!g_str_has_suffix (path, ".desktop") && |
891 | filetype != G_FILE_TYPE_DIRECTORY && |
892 | type != G_FILE_MONITOR_EVENT_DELETED) |
893 | - goto out; |
894 | + { |
895 | + g_free(path); |
896 | + return; |
897 | + } |
898 | |
899 | if (type == G_FILE_MONITOR_EVENT_DELETED || |
900 | type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) |
901 | @@ -994,7 +1047,7 @@ |
902 | self->priv->desktop_id_table, |
903 | self->priv->desktop_class_table); |
904 | |
905 | - g_list_free_full (dirs, (GDestroyNotify) g_free); |
906 | + g_list_free_full (dirs, g_free); |
907 | } |
908 | } |
909 | else if (filetype != G_FILE_TYPE_UNKNOWN) |
910 | @@ -1003,7 +1056,6 @@ |
911 | } |
912 | } |
913 | |
914 | -out: |
915 | g_free (path); |
916 | } |
917 | |
918 | @@ -1097,15 +1149,18 @@ |
919 | fill_desktop_file_table (self, directories, *desktop_file_table, |
920 | *desktop_id_table, *desktop_class_table); |
921 | |
922 | - g_list_free_full (directories, (GDestroyNotify) g_free); |
923 | + g_list_free_full (directories, g_free); |
924 | } |
925 | |
926 | static gboolean |
927 | is_open_office_window (BamfMatcher * self, BamfLegacyWindow * window) |
928 | { |
929 | - return g_str_has_prefix (bamf_legacy_window_get_class_name (window), "OpenOffice") || |
930 | - g_str_has_prefix (bamf_legacy_window_get_class_name (window), "LibreOffice") || |
931 | - g_str_has_prefix (bamf_legacy_window_get_class_name (window), "libreoffice"); |
932 | + const char *class_name = bamf_legacy_window_get_class_name (window); |
933 | + |
934 | + return (g_str_has_prefix (class_name, "LibreOffice") || |
935 | + g_str_has_prefix (class_name, "libreoffice") || |
936 | + g_str_has_prefix (class_name, "OpenOffice") || |
937 | + g_str_has_prefix (class_name, "openoffice")); |
938 | } |
939 | |
940 | static char * |
941 | @@ -1297,7 +1352,7 @@ |
942 | |
943 | if (trimmed) |
944 | { |
945 | - if (strlen (trimmed) > 0) |
946 | + if (trimmed[0] != '\0') |
947 | { |
948 | table_list = g_hash_table_lookup (priv->desktop_file_table, trimmed); |
949 | |
950 | @@ -1370,7 +1425,7 @@ |
951 | hint = get_window_hint (self, window, _NET_WM_DESKTOP_FILE); |
952 | const char *window_class = bamf_legacy_window_get_class_name (window); |
953 | |
954 | - if (hint && strlen (hint) > 0 && !is_web_app_window(self, window)) |
955 | + if (hint && hint[0] != '\0' && !is_web_app_window(self, window)) |
956 | { |
957 | desktop_files = g_list_prepend (desktop_files, hint); |
958 | /* whew, hard work, didn't even have to make a copy! */ |
959 | @@ -1568,13 +1623,7 @@ |
960 | g_object_unref (best); |
961 | } |
962 | |
963 | - for (l = possible_apps; l; l = l->next) |
964 | - { |
965 | - char *str = l->data; |
966 | - g_free (str); |
967 | - } |
968 | - |
969 | - g_list_free (possible_apps); |
970 | + g_list_free_full (possible_apps, g_free); |
971 | |
972 | bamf_view_add_child (BAMF_VIEW (best), BAMF_VIEW (bamf_window)); |
973 | } |
974 | @@ -1589,7 +1638,7 @@ |
975 | GHashTable *registered_pids; |
976 | char *window_hint = NULL; |
977 | gint i, pid; |
978 | - gint *key; |
979 | + gpointer key; |
980 | |
981 | g_return_if_fail (BAMF_IS_MATCHER (self)); |
982 | g_return_if_fail (BAMF_IS_LEGACY_WINDOW (window)); |
983 | @@ -1603,9 +1652,7 @@ |
984 | |
985 | if (pid > 0) |
986 | { |
987 | - key = g_new (gint, 1); |
988 | - *key = pid; |
989 | - |
990 | + gpointer key = GINT_TO_POINTER (pid); |
991 | const char* result = g_hash_table_lookup (registered_pids, key); |
992 | if (result && g_str_has_prefix (result, "/home/")) |
993 | { |
994 | @@ -1617,48 +1664,45 @@ |
995 | } |
996 | |
997 | window_hint = get_window_hint (self, window, _NET_WM_DESKTOP_FILE); |
998 | - if (window_hint && strlen (window_hint) > 0) |
999 | + if (window_hint) |
1000 | { |
1001 | - /* already set, make sure we know about this |
1002 | - * fact for future windows of this applications */ |
1003 | - pid = bamf_legacy_window_get_pid (window); |
1004 | - |
1005 | - if (pid > 0) |
1006 | + if (window_hint[0] != '\0') |
1007 | { |
1008 | - key = g_new (gint, 1); |
1009 | - *key = pid; |
1010 | + /* already set, make sure we know about this |
1011 | + * fact for future windows of this applications */ |
1012 | + pid = bamf_legacy_window_get_pid (window); |
1013 | |
1014 | - if (!g_hash_table_lookup (registered_pids, key)) |
1015 | + if (pid > 0) |
1016 | { |
1017 | - g_hash_table_insert (registered_pids, key, g_strdup (window_hint)); |
1018 | + key = GINT_TO_POINTER (pid); |
1019 | + |
1020 | + if (!g_hash_table_lookup (registered_pids, key)) |
1021 | + { |
1022 | + g_hash_table_insert (registered_pids, key, g_strdup (window_hint)); |
1023 | + } |
1024 | } |
1025 | + |
1026 | + g_free (window_hint); |
1027 | + return; |
1028 | } |
1029 | |
1030 | g_free (window_hint); |
1031 | - return; |
1032 | - } |
1033 | - |
1034 | - if (is_open_office_window (self, window)) |
1035 | - { |
1036 | - window_hint = get_open_office_window_hint (self, window); |
1037 | - } |
1038 | - else |
1039 | - { |
1040 | - pids = pid_parent_tree (self, bamf_legacy_window_get_pid (window)); |
1041 | - |
1042 | - for (i = 0; i < pids->len; i++) |
1043 | - { |
1044 | - pid = g_array_index (pids, gint, i); |
1045 | - |
1046 | - key = g_new (gint, 1); |
1047 | - *key = pid; |
1048 | - |
1049 | - window_hint = g_hash_table_lookup (registered_pids, key); |
1050 | - if (window_hint != NULL && strlen (window_hint) > 0) |
1051 | - break; |
1052 | - } |
1053 | - g_array_free (pids, TRUE); |
1054 | - } |
1055 | + window_hint = NULL; |
1056 | + } |
1057 | + |
1058 | + pids = pid_parent_tree (self, bamf_legacy_window_get_pid (window)); |
1059 | + |
1060 | + for (i = 0; i < pids->len; i++) |
1061 | + { |
1062 | + pid = g_array_index (pids, gint, i); |
1063 | + key = GINT_TO_POINTER (pid); |
1064 | + |
1065 | + window_hint = g_hash_table_lookup (registered_pids, key); |
1066 | + if (window_hint != NULL && window_hint[0] != '\0') |
1067 | + break; |
1068 | + } |
1069 | + |
1070 | + g_array_free (pids, TRUE); |
1071 | |
1072 | if (window_hint) |
1073 | set_window_hint (self, window, _NET_WM_DESKTOP_FILE, window_hint); |
1074 | @@ -1689,24 +1733,31 @@ |
1075 | bamf_matcher_setup_window_state (self, bamfwindow); |
1076 | } |
1077 | |
1078 | -static gboolean |
1079 | -open_office_window_setup_timer (OpenOfficeTimeoutArgs *args) |
1080 | +static void |
1081 | +on_open_office_window_name_changed (BamfLegacyWindow *window, BamfMatcher* self) |
1082 | { |
1083 | - if (bamf_legacy_window_is_closed (args->window)) |
1084 | - { |
1085 | - g_object_unref (args->window); |
1086 | - return FALSE; |
1087 | - } |
1088 | - |
1089 | - args->count++; |
1090 | - if (args->count > 20 || get_open_office_window_hint (args->matcher, args->window)) |
1091 | + g_return_if_fail (BAMF_IS_MATCHER (self)); |
1092 | + g_return_if_fail (BAMF_IS_LEGACY_WINDOW (window)); |
1093 | + |
1094 | + char *old_hint; |
1095 | + const char *new_hint; |
1096 | + |
1097 | + old_hint = get_window_hint (self, window, _NET_WM_DESKTOP_FILE); |
1098 | + new_hint = get_open_office_window_hint (self, window); |
1099 | + |
1100 | + if (new_hint && g_strcmp0 (new_hint, old_hint) != 0) |
1101 | { |
1102 | - g_object_unref (args->window); |
1103 | - handle_raw_window (args->matcher, args->window); |
1104 | - return FALSE; |
1105 | + bamf_legacy_window_reopen (window); |
1106 | } |
1107 | - |
1108 | - return TRUE; |
1109 | + |
1110 | + g_free (old_hint); |
1111 | +} |
1112 | + |
1113 | +static void |
1114 | +on_open_office_window_closed (BamfLegacyWindow *window, BamfMatcher* self) |
1115 | +{ |
1116 | + g_signal_handlers_disconnect_by_func (window, on_open_office_window_name_changed, self); |
1117 | + g_object_unref (window); |
1118 | } |
1119 | |
1120 | static void |
1121 | @@ -1723,24 +1774,35 @@ |
1122 | bamf_matcher_register_view (self, BAMF_VIEW (bamfwindow)); |
1123 | g_object_unref (bamfwindow); |
1124 | |
1125 | - return; |
1126 | + return; |
1127 | } |
1128 | |
1129 | - if (is_open_office_window (self, window) && get_open_office_window_hint (self, window) == NULL) |
1130 | + if (is_open_office_window (self, window)) |
1131 | { |
1132 | - OpenOfficeTimeoutArgs* args = (OpenOfficeTimeoutArgs*) g_malloc0 (sizeof (OpenOfficeTimeoutArgs)); |
1133 | - args->matcher = self; |
1134 | - args->window = window; |
1135 | - |
1136 | + BamfWindowType win_type = bamf_legacy_window_get_window_type (window); |
1137 | + |
1138 | + if (win_type == BAMF_WINDOW_SPLASHSCREEN || win_type == BAMF_WINDOW_TOOLBAR) |
1139 | + { |
1140 | + return; |
1141 | + } |
1142 | + |
1143 | + char *old_hint = get_window_hint (self, window, _NET_WM_DESKTOP_FILE); |
1144 | + const char *new_hint = get_open_office_window_hint (self, window); |
1145 | + |
1146 | + if (new_hint && g_strcmp0 (old_hint, new_hint) != 0) |
1147 | + { |
1148 | + set_window_hint (self, window, _NET_WM_DESKTOP_FILE, new_hint); |
1149 | + } |
1150 | + |
1151 | g_object_ref (window); |
1152 | - /* we have an open office window who is not ready to match yet */ |
1153 | - g_timeout_add (100, (GSourceFunc) open_office_window_setup_timer, args); |
1154 | - } |
1155 | - else |
1156 | - { |
1157 | - /* we have a window who is ready to be matched */ |
1158 | - handle_raw_window (self, window); |
1159 | - } |
1160 | + g_signal_connect (window, "name-changed", (GCallback) on_open_office_window_name_changed, self); |
1161 | + g_signal_connect (window, "closed", (GCallback) on_open_office_window_closed, self); |
1162 | + |
1163 | + g_free (old_hint); |
1164 | + } |
1165 | + |
1166 | + /* we have a window who is ready to be matched */ |
1167 | + handle_raw_window (self, window); |
1168 | } |
1169 | |
1170 | static void |
1171 | @@ -1805,14 +1867,7 @@ |
1172 | } |
1173 | } |
1174 | |
1175 | - for (l = possible_apps; l; l = l->next) |
1176 | - { |
1177 | - char *str = l->data; |
1178 | - g_free (str); |
1179 | - } |
1180 | - |
1181 | - |
1182 | - g_list_free (possible_apps); |
1183 | + g_list_free_full (possible_apps, g_free); |
1184 | |
1185 | if (best) |
1186 | bamf_view_add_child (BAMF_VIEW (best), BAMF_VIEW (indicator)); |
1187 | @@ -1846,20 +1901,16 @@ |
1188 | const char * desktopFile, |
1189 | gint pid) |
1190 | { |
1191 | - gint *key; |
1192 | + gpointer key; |
1193 | BamfLegacyScreen *screen; |
1194 | GList *glist_item; |
1195 | GList *windows; |
1196 | - char *dup; |
1197 | |
1198 | g_return_if_fail (BAMF_IS_MATCHER (self)); |
1199 | g_return_if_fail (desktopFile); |
1200 | |
1201 | - key = g_new (gint, 1); |
1202 | - *key = pid; |
1203 | - |
1204 | - dup = g_strdup (desktopFile); |
1205 | - g_hash_table_insert (self->priv->registered_pids, key, dup); |
1206 | + key = GINT_TO_POINTER (pid); |
1207 | + g_hash_table_insert (self->priv->registered_pids, key, g_strdup (desktopFile)); |
1208 | |
1209 | /* fixme, this is a bit heavy */ |
1210 | |
1211 | @@ -2216,8 +2267,8 @@ |
1212 | |
1213 | priv->known_pids = g_array_new (FALSE, TRUE, sizeof (gint)); |
1214 | priv->bad_prefixes = g_array_new (FALSE, TRUE, sizeof (GRegex *)); |
1215 | - priv->registered_pids = |
1216 | - g_hash_table_new ((GHashFunc) g_int_hash, (GEqualFunc) g_int_equal); |
1217 | + priv->registered_pids = g_hash_table_new_full (g_direct_hash, g_direct_equal, |
1218 | + NULL, g_free); |
1219 | |
1220 | prefixstrings = prefix_strings (self); |
1221 | for (i = 0; i < prefixstrings->len; i++) |
1222 | @@ -2251,13 +2302,61 @@ |
1223 | } |
1224 | |
1225 | static void |
1226 | +bamf_matcher_finalize (GObject *object) |
1227 | +{ |
1228 | + BamfMatcher *self = (BamfMatcher *) object; |
1229 | + BamfMatcherPrivate *priv = self->priv; |
1230 | + GList *l; |
1231 | + int i; |
1232 | + |
1233 | + for (i = 0; i < priv->bad_prefixes->len; i++) |
1234 | + { |
1235 | + GRegex *regex = g_array_index (priv->bad_prefixes, GRegex *, i); |
1236 | + g_regex_unref (regex); |
1237 | + } |
1238 | + |
1239 | + g_array_free (priv->bad_prefixes, TRUE); |
1240 | + g_array_free (priv->known_pids, TRUE); |
1241 | + g_hash_table_destroy (priv->desktop_id_table); |
1242 | + g_hash_table_destroy (priv->desktop_file_table); |
1243 | + g_hash_table_destroy (priv->desktop_class_table); |
1244 | + g_hash_table_destroy (priv->registered_pids); |
1245 | + |
1246 | + for (l = priv->views; l; l = l->next) |
1247 | + { |
1248 | + bamf_matcher_unregister_view (self, (BamfView*)l->data, FALSE); |
1249 | + } |
1250 | + g_list_free_full (priv->views, g_object_unref); |
1251 | + priv->views = NULL; |
1252 | + |
1253 | + for (l = priv->monitors; l; l = l->next) |
1254 | + { |
1255 | + g_signal_handlers_disconnect_by_func (G_OBJECT (l->data), |
1256 | + (GCallback) on_monitor_changed, self); |
1257 | + } |
1258 | + g_list_free_full (priv->monitors, g_object_unref); |
1259 | + priv->monitors = NULL; |
1260 | + |
1261 | + g_list_free_full (priv->favorites, g_free); |
1262 | + priv->favorites = NULL; |
1263 | + |
1264 | + priv->active_app = NULL; |
1265 | + priv->active_win = NULL; |
1266 | + |
1267 | + G_OBJECT_CLASS (bamf_matcher_parent_class)->finalize (object); |
1268 | +} |
1269 | + |
1270 | +static void |
1271 | bamf_matcher_class_init (BamfMatcherClass * klass) |
1272 | { |
1273 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); |
1274 | g_type_class_add_private (klass, sizeof (BamfMatcherPrivate)); |
1275 | |
1276 | dbus_g_object_type_install_info (BAMF_TYPE_MATCHER, |
1277 | &dbus_glib_bamf_matcher_object_info); |
1278 | |
1279 | + object_class->finalize = bamf_matcher_finalize; |
1280 | + |
1281 | matcher_signals [VIEW_OPENED] = |
1282 | g_signal_new ("view-opened", |
1283 | G_OBJECT_CLASS_TYPE (klass), |
1284 | @@ -2293,7 +2392,7 @@ |
1285 | bamf_marshal_VOID__STRING_STRING, |
1286 | G_TYPE_NONE, 2, |
1287 | G_TYPE_STRING, G_TYPE_STRING); |
1288 | - |
1289 | + |
1290 | matcher_signals [FAVORITES_CHANGED] = |
1291 | g_signal_new ("favorites-changed", |
1292 | G_OBJECT_CLASS_TYPE (klass), |
1293 | |
1294 | === modified file 'src/bamf-view.c' |
1295 | --- src/bamf-view.c 2011-08-04 14:56:07 +0000 |
1296 | +++ src/bamf-view.c 2011-12-15 22:03:33 +0000 |
1297 | @@ -462,8 +462,6 @@ |
1298 | path = g_strdup_printf ("%s/%s", BAMF_DBUS_PATH, stable_name); |
1299 | g_free (stable_name); |
1300 | |
1301 | - g_print ("Export Path: %s\n", path); |
1302 | - |
1303 | BAMF_VIEW_GET_CLASS (view)->names = g_list_prepend (BAMF_VIEW_GET_CLASS (view)->names, path); |
1304 | |
1305 | view->priv->path = path; |
1306 | @@ -472,8 +470,14 @@ |
1307 | |
1308 | g_return_val_if_fail (bus, NULL); |
1309 | |
1310 | + GObject *old_object = dbus_g_connection_lookup_g_object (bus, path); |
1311 | + if (G_IS_OBJECT (old_object)) |
1312 | + { |
1313 | + g_critical ("BAMF has already registered an object on path \"%s`, this should never happen!", path); |
1314 | + dbus_g_connection_unregister_g_object (bus, old_object); |
1315 | + } |
1316 | + |
1317 | dbus_g_connection_register_g_object (bus, path, G_OBJECT (view)); |
1318 | - |
1319 | g_signal_emit (view, view_signals[EXPORTED], 0); |
1320 | } |
1321 | |
1322 | |
1323 | === modified file 'tests/bamfdaemon/Makefile.am' |
1324 | --- tests/bamfdaemon/Makefile.am 2010-11-18 18:28:10 +0000 |
1325 | +++ tests/bamfdaemon/Makefile.am 2011-12-15 22:03:33 +0000 |
1326 | @@ -77,8 +77,13 @@ |
1327 | -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions \ |
1328 | $(NULL) |
1329 | |
1330 | -#run make test as part of make check |
1331 | +# Run tests as part of make check |
1332 | +if ENABLE_HEADLESS_TESTS |
1333 | +check-local: test-headless |
1334 | +else |
1335 | check-local: test |
1336 | +endif |
1337 | + |
1338 | test: |
1339 | @gtester -k -o=test-bamf-results.xml ./test-bamf |
1340 | |
1341 | @@ -98,3 +103,28 @@ |
1342 | |
1343 | clean-generic: |
1344 | rm -f test-bamf-results.xml test-bamf-results.html |
1345 | + |
1346 | +# START HEADLESS TESTS |
1347 | +if ENABLE_HEADLESS_TESTS |
1348 | +DISPLAY = :27 |
1349 | +LOG_PATH = headless-logs |
1350 | +test-headless: |
1351 | + set -e; \ |
1352 | + export DISPLAY=$(DISPLAY); \ |
1353 | + rm -rf $(LOG_PATH); \ |
1354 | + mkdir $(LOG_PATH); \ |
1355 | + $(XVFB) $(DISPLAY) -screen 0 1024x768x8 > $(LOG_PATH)/Xvfb.out 2>&1 & \ |
1356 | + sleep 1; \ |
1357 | + \ |
1358 | + $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \ |
1359 | + source $(LOG_PATH)/sessionbus.sh; \ |
1360 | + sleep 1; \ |
1361 | + \ |
1362 | + make test; \ |
1363 | + sleep 1; \ |
1364 | + \ |
1365 | + kill `grep DBUS_SESSION_BUS_PID $(LOG_PATH)/sessionbus.sh | grep -oE '[0-9]+'`; \ |
1366 | + pkill Xvfb; |
1367 | + |
1368 | +endif |
1369 | +# END HEADLESS TESTS |
1370 | |
1371 | === modified file 'tests/bamfdaemon/Makefile.in' |
1372 | --- tests/bamfdaemon/Makefile.in 2011-09-22 15:15:28 +0000 |
1373 | +++ tests/bamfdaemon/Makefile.in 2011-12-15 22:03:33 +0000 |
1374 | @@ -112,6 +112,7 @@ |
1375 | CYGPATH_W = @CYGPATH_W@ |
1376 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
1377 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
1378 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
1379 | DBUS_LIBS = @DBUS_LIBS@ |
1380 | DEFS = @DEFS@ |
1381 | DEPDIR = @DEPDIR@ |
1382 | @@ -192,6 +193,7 @@ |
1383 | WARN_CFLAGS = @WARN_CFLAGS@ |
1384 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
1385 | WNCK_LIBS = @WNCK_LIBS@ |
1386 | +XVFB = @XVFB@ |
1387 | X_CFLAGS = @X_CFLAGS@ |
1388 | X_LIBS = @X_LIBS@ |
1389 | abs_builddir = @abs_builddir@ |
1390 | @@ -326,6 +328,10 @@ |
1391 | -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions \ |
1392 | $(NULL) |
1393 | |
1394 | + |
1395 | +# START HEADLESS TESTS |
1396 | +@ENABLE_HEADLESS_TESTS_TRUE@DISPLAY = :27 |
1397 | +@ENABLE_HEADLESS_TESTS_TRUE@LOG_PATH = headless-logs |
1398 | all: all-am |
1399 | |
1400 | .SUFFIXES: |
1401 | @@ -875,8 +881,10 @@ |
1402 | tags uninstall uninstall-am |
1403 | |
1404 | |
1405 | -#run make test as part of make check |
1406 | -check-local: test |
1407 | +# Run tests as part of make check |
1408 | +@ENABLE_HEADLESS_TESTS_TRUE@check-local: test-headless |
1409 | +@ENABLE_HEADLESS_TESTS_FALSE@check-local: test |
1410 | + |
1411 | test: |
1412 | @gtester -k -o=test-bamf-results.xml ./test-bamf |
1413 | |
1414 | @@ -896,6 +904,25 @@ |
1415 | |
1416 | clean-generic: |
1417 | rm -f test-bamf-results.xml test-bamf-results.html |
1418 | +@ENABLE_HEADLESS_TESTS_TRUE@test-headless: |
1419 | +@ENABLE_HEADLESS_TESTS_TRUE@ set -e; \ |
1420 | +@ENABLE_HEADLESS_TESTS_TRUE@ export DISPLAY=$(DISPLAY); \ |
1421 | +@ENABLE_HEADLESS_TESTS_TRUE@ rm -rf $(LOG_PATH); \ |
1422 | +@ENABLE_HEADLESS_TESTS_TRUE@ mkdir $(LOG_PATH); \ |
1423 | +@ENABLE_HEADLESS_TESTS_TRUE@ $(XVFB) $(DISPLAY) -screen 0 1024x768x8 > $(LOG_PATH)/Xvfb.out 2>&1 & \ |
1424 | +@ENABLE_HEADLESS_TESTS_TRUE@ sleep 1; \ |
1425 | +@ENABLE_HEADLESS_TESTS_TRUE@ \ |
1426 | +@ENABLE_HEADLESS_TESTS_TRUE@ $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \ |
1427 | +@ENABLE_HEADLESS_TESTS_TRUE@ source $(LOG_PATH)/sessionbus.sh; \ |
1428 | +@ENABLE_HEADLESS_TESTS_TRUE@ sleep 1; \ |
1429 | +@ENABLE_HEADLESS_TESTS_TRUE@ \ |
1430 | +@ENABLE_HEADLESS_TESTS_TRUE@ make test; \ |
1431 | +@ENABLE_HEADLESS_TESTS_TRUE@ sleep 1; \ |
1432 | +@ENABLE_HEADLESS_TESTS_TRUE@ \ |
1433 | +@ENABLE_HEADLESS_TESTS_TRUE@ kill `grep DBUS_SESSION_BUS_PID $(LOG_PATH)/sessionbus.sh | grep -oE '[0-9]+'`; \ |
1434 | +@ENABLE_HEADLESS_TESTS_TRUE@ pkill Xvfb; |
1435 | + |
1436 | +# END HEADLESS TESTS |
1437 | |
1438 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
1439 | # Otherwise a system limit (for SysV at least) may be exceeded. |
1440 | |
1441 | === modified file 'tests/bamfdaemon/test-application.c' |
1442 | --- tests/bamfdaemon/test-application.c 2010-05-25 10:32:24 +0000 |
1443 | +++ tests/bamfdaemon/test-application.c 2011-12-15 22:03:33 +0000 |
1444 | @@ -401,24 +401,12 @@ |
1445 | bamf_view_add_child (BAMF_VIEW (application), BAMF_VIEW (window)); |
1446 | |
1447 | g_assert (signal_seen); |
1448 | - g_assert (g_strcmp0 (signal_window, path) == 0); |
1449 | + g_assert_cmpstr (signal_window, ==, path); |
1450 | |
1451 | signal_seen = FALSE; |
1452 | |
1453 | g_object_unref (window); |
1454 | g_object_unref (test); |
1455 | - |
1456 | - test = bamf_legacy_window_test_new (20, "Window X", "class", "exec"); |
1457 | - window = bamf_window_new (BAMF_LEGACY_WINDOW (test)); |
1458 | - |
1459 | - bamf_view_add_child (BAMF_VIEW (application), BAMF_VIEW (window)); |
1460 | - |
1461 | - g_assert (!signal_seen); |
1462 | - |
1463 | - path = bamf_view_export_on_bus (BAMF_VIEW (window)); |
1464 | - |
1465 | - g_assert (signal_seen); |
1466 | - g_assert (g_strcmp0 (signal_window, path) == 0); |
1467 | } |
1468 | |
1469 | static void |
1470 | |
1471 | === modified file 'tests/functional/Makefile.in' |
1472 | --- tests/functional/Makefile.in 2011-09-22 15:15:28 +0000 |
1473 | +++ tests/functional/Makefile.in 2011-12-15 22:03:33 +0000 |
1474 | @@ -115,6 +115,7 @@ |
1475 | CYGPATH_W = @CYGPATH_W@ |
1476 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
1477 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
1478 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
1479 | DBUS_LIBS = @DBUS_LIBS@ |
1480 | DEFS = @DEFS@ |
1481 | DEPDIR = @DEPDIR@ |
1482 | @@ -195,6 +196,7 @@ |
1483 | WARN_CFLAGS = @WARN_CFLAGS@ |
1484 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
1485 | WNCK_LIBS = @WNCK_LIBS@ |
1486 | +XVFB = @XVFB@ |
1487 | X_CFLAGS = @X_CFLAGS@ |
1488 | X_LIBS = @X_LIBS@ |
1489 | abs_builddir = @abs_builddir@ |
1490 | |
1491 | === modified file 'tests/libbamf/Makefile.am' |
1492 | --- tests/libbamf/Makefile.am 2011-06-17 12:19:14 +0000 |
1493 | +++ tests/libbamf/Makefile.am 2011-12-15 22:03:33 +0000 |
1494 | @@ -33,8 +33,13 @@ |
1495 | $(GTK_LIBS) \ |
1496 | $(DBUS_LIBS) |
1497 | |
1498 | -#run make test as part of make check |
1499 | +# Run tests as part of make check |
1500 | +if ENABLE_HEADLESS_TESTS |
1501 | +check-local: test-headless |
1502 | +else |
1503 | check-local: test |
1504 | +endif |
1505 | + |
1506 | test: |
1507 | @gtester -k -o=test-libbamf-results.xml ./test-libbamf |
1508 | |
1509 | @@ -54,3 +59,28 @@ |
1510 | |
1511 | clean-generic: |
1512 | rm -f test-libbamf-results.xml test-libbamf-results.html |
1513 | + |
1514 | +# START HEADLESS TESTS |
1515 | +if ENABLE_HEADLESS_TESTS |
1516 | +DISPLAY = :27 |
1517 | +LOG_PATH = headless-logs |
1518 | +test-headless: |
1519 | + set -e; \ |
1520 | + export DISPLAY=$(DISPLAY); \ |
1521 | + rm -rf $(LOG_PATH); \ |
1522 | + mkdir $(LOG_PATH); \ |
1523 | + $(XVFB) $(DISPLAY) -screen 0 1024x768x8 > $(LOG_PATH)/Xvfb.out 2>&1 & \ |
1524 | + sleep 1; \ |
1525 | + \ |
1526 | + $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \ |
1527 | + source $(LOG_PATH)/sessionbus.sh; \ |
1528 | + sleep 1; \ |
1529 | + \ |
1530 | + make test; \ |
1531 | + sleep 1; \ |
1532 | + \ |
1533 | + kill `grep DBUS_SESSION_BUS_PID $(LOG_PATH)/sessionbus.sh | grep -oE '[0-9]+'`; \ |
1534 | + pkill Xvfb; |
1535 | + |
1536 | +endif |
1537 | +# END HEADLESS TESTS |
1538 | |
1539 | === modified file 'tests/libbamf/Makefile.in' |
1540 | --- tests/libbamf/Makefile.in 2011-09-22 15:15:28 +0000 |
1541 | +++ tests/libbamf/Makefile.in 2011-12-15 22:03:33 +0000 |
1542 | @@ -96,6 +96,7 @@ |
1543 | CYGPATH_W = @CYGPATH_W@ |
1544 | DBUS_CFLAGS = @DBUS_CFLAGS@ |
1545 | DBUS_GLIB_BIN = @DBUS_GLIB_BIN@ |
1546 | +DBUS_LAUNCH = @DBUS_LAUNCH@ |
1547 | DBUS_LIBS = @DBUS_LIBS@ |
1548 | DEFS = @DEFS@ |
1549 | DEPDIR = @DEPDIR@ |
1550 | @@ -176,6 +177,7 @@ |
1551 | WARN_CFLAGS = @WARN_CFLAGS@ |
1552 | WNCK_CFLAGS = @WNCK_CFLAGS@ |
1553 | WNCK_LIBS = @WNCK_LIBS@ |
1554 | +XVFB = @XVFB@ |
1555 | X_CFLAGS = @X_CFLAGS@ |
1556 | X_LIBS = @X_LIBS@ |
1557 | abs_builddir = @abs_builddir@ |
1558 | @@ -262,6 +264,10 @@ |
1559 | $(GTK_LIBS) \ |
1560 | $(DBUS_LIBS) |
1561 | |
1562 | + |
1563 | +# START HEADLESS TESTS |
1564 | +@ENABLE_HEADLESS_TESTS_TRUE@DISPLAY = :27 |
1565 | +@ENABLE_HEADLESS_TESTS_TRUE@LOG_PATH = headless-logs |
1566 | all: all-am |
1567 | |
1568 | .SUFFIXES: |
1569 | @@ -571,8 +577,10 @@ |
1570 | tags uninstall uninstall-am |
1571 | |
1572 | |
1573 | -#run make test as part of make check |
1574 | -check-local: test |
1575 | +# Run tests as part of make check |
1576 | +@ENABLE_HEADLESS_TESTS_TRUE@check-local: test-headless |
1577 | +@ENABLE_HEADLESS_TESTS_FALSE@check-local: test |
1578 | + |
1579 | test: |
1580 | @gtester -k -o=test-libbamf-results.xml ./test-libbamf |
1581 | |
1582 | @@ -592,6 +600,25 @@ |
1583 | |
1584 | clean-generic: |
1585 | rm -f test-libbamf-results.xml test-libbamf-results.html |
1586 | +@ENABLE_HEADLESS_TESTS_TRUE@test-headless: |
1587 | +@ENABLE_HEADLESS_TESTS_TRUE@ set -e; \ |
1588 | +@ENABLE_HEADLESS_TESTS_TRUE@ export DISPLAY=$(DISPLAY); \ |
1589 | +@ENABLE_HEADLESS_TESTS_TRUE@ rm -rf $(LOG_PATH); \ |
1590 | +@ENABLE_HEADLESS_TESTS_TRUE@ mkdir $(LOG_PATH); \ |
1591 | +@ENABLE_HEADLESS_TESTS_TRUE@ $(XVFB) $(DISPLAY) -screen 0 1024x768x8 > $(LOG_PATH)/Xvfb.out 2>&1 & \ |
1592 | +@ENABLE_HEADLESS_TESTS_TRUE@ sleep 1; \ |
1593 | +@ENABLE_HEADLESS_TESTS_TRUE@ \ |
1594 | +@ENABLE_HEADLESS_TESTS_TRUE@ $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \ |
1595 | +@ENABLE_HEADLESS_TESTS_TRUE@ source $(LOG_PATH)/sessionbus.sh; \ |
1596 | +@ENABLE_HEADLESS_TESTS_TRUE@ sleep 1; \ |
1597 | +@ENABLE_HEADLESS_TESTS_TRUE@ \ |
1598 | +@ENABLE_HEADLESS_TESTS_TRUE@ make test; \ |
1599 | +@ENABLE_HEADLESS_TESTS_TRUE@ sleep 1; \ |
1600 | +@ENABLE_HEADLESS_TESTS_TRUE@ \ |
1601 | +@ENABLE_HEADLESS_TESTS_TRUE@ kill `grep DBUS_SESSION_BUS_PID $(LOG_PATH)/sessionbus.sh | grep -oE '[0-9]+'`; \ |
1602 | +@ENABLE_HEADLESS_TESTS_TRUE@ pkill Xvfb; |
1603 | + |
1604 | +# END HEADLESS TESTS |
1605 | |
1606 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
1607 | # Otherwise a system limit (for SysV at least) may be exceeded. |