Merge lp://qastaging/~3v1n0/bamf/lib-factory-xids-matching into lp://qastaging/bamf/0.4

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 480
Merged at revision: 462
Proposed branch: lp://qastaging/~3v1n0/bamf/lib-factory-xids-matching
Merge into: lp://qastaging/bamf/0.4
Diff against target: 892 lines (+410/-120)
9 files modified
lib/libbamf/Makefile.am (+1/-0)
lib/libbamf/bamf-application-private.h (+30/-0)
lib/libbamf/bamf-application.c (+71/-8)
lib/libbamf/bamf-factory.c (+157/-44)
lib/libbamf/bamf-factory.h (+17/-0)
lib/libbamf/bamf-matcher.c (+68/-38)
lib/libbamf/bamf-view-private.h (+2/-0)
lib/libbamf/bamf-view.c (+62/-29)
lib/libbamf/bamf-window.c (+2/-1)
To merge this branch: bzr merge lp://qastaging/~3v1n0/bamf/lib-factory-xids-matching
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+103591@code.qastaging.launchpad.net

Commit message

BamfFactory: be more smart to re-associate a dbus path to a view using windows xid

Description of the change

BamfFactory has been improved adding the new bamf_factory_view_for_path_type that allows to get a view from a path with the defined type. This allows to avoid (when the type is known) to create a temporary view, only to query via dbus the type of the object.

Also now the factory now has been improved to re-associate the opened views to the new ones using the related windows xids. So basically when a new application has been opened, we initially try to re-associate it to the opened view with the same desktop file; if that check fails we fallback to the children windows xid comparison (if a view has at least a xid that matches the ones of the new application, then we consider them the same).

So, thanks to this both applications with .desktop files associated and applications with no desktop file can be re-used avoiding memory duplication and double launcher icon instances.

Tests covered by: lp:~3v1n0/unity/launcher-double-icons-tests

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :
Download full text (3.6 KiB)

It seems to be working fine, although it seems to be causing some assertions:

(bamfdaemon:26376): GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed

Backtrace:

#0 g_log (log_domain=0x7ffff632370e "GLib", log_level=G_LOG_LEVEL_CRITICAL,
    format=0x7ffff632cb2a "%s: assertion `%s' failed")
    at /build/buildd/glib2.0-2.32.1/./glib/gmessages.c:788
#1 0x00007ffff63014f2 in g_str_has_prefix (str=0x0,
    prefix=0x43e931 "libreoffice")
    at /build/buildd/glib2.0-2.32.1/./glib/gstrfuncs.c:2771
#2 0x000000000042f265 in is_open_office_window (window=0x7ac1e0,
    self=<optimized out>)
    at /home/miso-work/unity/source/bamf/src/bamf-matcher.c:1378
#3 handle_window_opened (screen=<optimized out>, window=0x7ac1e0,
    self=0x7861b0) at /home/miso-work/unity/source/bamf/src/bamf-matcher.c:2081
#4 0x00007ffff67b6354 in g_cclosure_marshal_VOID__OBJECTv (closure=0x7b2630,
    return_value=<optimized out>, instance=0x777a80, args=<optimized out>,
    marshal_data=<optimized out>, n_params=<optimized out>,
    param_types=0x79bf50)
    at /build/buildd/glib2.0-2.32.1/./gobject/gmarshal.c:1312
#5 0x00007ffff67b2eca in _g_closure_invoke_va (closure=0x7b2630,
    return_value=0x0, instance=0x777a80, args=0x7fffffffd348, n_params=1,
    param_types=<optimized out>)
    at /build/buildd/glib2.0-2.32.1/./gobject/gclosure.c:840
#6 0x00007ffff67cb741 in g_signal_emit_valist (instance=0x777a80,
    signal_id=<optimized out>, detail=0, var_args=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /build/buildd/glib2.0-2.32.1/./gobject/gsignal.c:3207
#7 0x00007ffff67cc242 in g_signal_emit (instance=<optimized out>,
    signal_id=<optimized out>, detail=<optimized out>)
    at /build/buildd/glib2.0-2.32.1/./gobject/gsignal.c:3352
#8 0x00007ffff67b6354 in g_cclosure_marshal_VOID__OBJECTv (closure=0x7b2590,
    return_value=<optimized out>, instance=0x79a390, args=<optimized out>,
    marshal_data=<optimized out>, n_params=<optimized out>,
    param_types=0x7b0f30)
    at /build/buildd/glib2.0-2.32.1/./gobject/gmarshal.c:1312
#9 0x00007ffff67b2eca in _g_closure_invoke_va (closure=0x7b2590,
    return_value=0x0, instance=0x79a390, args=0x7fffffffd718, n_params=1,
    param_types=<optimized out>)
    at /build/buildd/glib2.0-2.32.1/./gobject/gclosure.c:840
#10 0x00007ffff67cb741 in g_signal_emit_valist (instance=0x79a390,
    signal_id=<optimized out>, detail=0, var_args=<optimized out>)
    at /build/buildd/glib2.0-2.32.1/./gobject/gsignal.c:3207
#11 0x00007ffff67cc242 in g_signal_emit (instance=<optimized out>,
    signal_id=<optimized out>, detail=<optimized out>)
    at /build/buildd/glib2.0-2.32.1/./gobject/gsignal.c:3352
#12 0x00007ffff787e339 in ?? () from /usr/lib/libwnck-3.so.0
#13 0x00007ffff787ea24 in ?? () from /usr/lib/libwnck-3.so.0
#14 0x00007ffff62e4c9a in g_main_dispatch (context=0x666a80)
    at /build/buildd/glib2.0-2.32.1/./glib/gmain.c:2515
#15 g_main_context_dispatch (context=0x666a80)
    at /build/buildd/glib2.0-2.32.1/./glib/gmain.c:3052
#16 0x00007ffff62e5060 in g_main_context_iterate (dispatch=1,
    block=<optimized out>, context=0x666a80, self=<optimized out>)
    at ...

Read more...

Revision history for this message
Michal Hruby (mhr3) wrote :

And unity also just complained about:

ERROR 2012-04-26 10:42:25 unity <unknown>:0 on_view_proxy_destroyed: assertion `BAMF_IS_VIEW (view)' failed

Revision history for this message
Michal Hruby (mhr3) wrote :

And one more thing - wouldn't it be better to use an enum in the bamf_factory_view_for_path_type() method?

479. By Marco Trevisan (Treviño)

libbamf, bamfview: disconect to the destroyed signal when needed

480. By Marco Trevisan (Treviño)

BamfFactory: use BamfFactoryViewType instead of strings comparisons when possible.

This cleans the code and is for sure more safe.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ok, updated ;)

Revision history for this message
Michal Hruby (mhr3) wrote :

Looking good to me, do we want to have this in SRU1?

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Well... I'd like to.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches