Merge lp://qastaging/~3v1n0/bamf/libreoffice-fixes into lp://qastaging/bamf/0.4
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Mikkel Kamstrup Erlandsen | ||||||||||||||||
Approved revision: | 443 | ||||||||||||||||
Merged at revision: | 424 | ||||||||||||||||
Proposed branch: | lp://qastaging/~3v1n0/bamf/libreoffice-fixes | ||||||||||||||||
Merge into: | lp://qastaging/bamf/0.4 | ||||||||||||||||
Diff against target: |
805 lines (+327/-147) 8 files modified
configure.in (+1/-1) 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 (+35/-7) src/bamf-legacy-window.h (+2/-0) src/bamf-matcher.c (+234/-136) src/bamf-view.c (+7/-1) |
||||||||||||||||
To merge this branch: | bzr merge lp://qastaging/~3v1n0/bamf/libreoffice-fixes | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mikkel Kamstrup Erlandsen (community) | Approve | ||
Review via email:
|
Commit message
Fixed LibreOffice and OpenOffice compatibility, remapping windows to their real type
Description of the change
When a window can be mapped as a LibreOffice / OpenOffice application we look for the right hint for the given window, we set that hint by default (if valid) and we connect to the window's name-changed event.
So, every time the window name changes, we check again for the window type and if it has changed (i.e. we moved from writer to start-center), then we simulate a window open/close event that cause the window to be re-mapped to
the proper application.
This works very well and allows to change the application type on run-time.
Also, every recognized libreoffice window that doesn't match any main application, is now considered as a "Standard" libreoffice application window, using the libreoffice-
This allows to correctly match not only the start center, but also dialog windows such as the restore window that shows up after a crash.
I also tried to introduce matching based on window class names (using libreoffice-writer, libreoffice-calc ... values), but since these parameters get updated only after the window name change, this check could be confusing (also if theoretically more secure).
The splash screen and the toolbars are now ignored, and so don't respect the rules above.
I've also included some optimizations, fixes (memleaks) and code cleanup.
Firstly - I LOVE you for getting rid of all the 'key = g_new (gint, 1);' that just gross in so many ways :-) Now for some comments:
8 - icon = g_icon_to_string (gicon);
9 +
10 + if (gicon)
11 + icon = g_icon_to_string (gicon);
The function you're updating here, bamf_applicatio n_setup_ icon_and_ name(), seems to leak self->priv->icon right at the end if it's set before we assign it. Can you plug that while you're here?
30 void screen_ inject_ window (BamfLegacyScreen *self, guint xid)
31 +bamf_legacy_
It's not totally clear to me what this function is intended to do. Can you add a short docstring? (I assume most ppl wont bother to dig out of the revision history like me ;-))
94 +void window_ reopen (BamfLegacyWindow *self)
95 +bamf_legacy_
Same as the last new function :-)
101 + g_object_weak_ref (G_OBJECT (self), (GWeakNotify) handle_ destroy_ notify,
102 + GUINT_TO_POINTER (xid));
It's not very clear what the magic behind this weak ref is, could you add an explanatory comment?
373 + g_list_free_full (possible_apps, g_free);
The introduction of g_list_free_full() is nice, but requires glib >=2.28. Please add that check to configure.in.
423 + if (!g_hash_ table_lookup (registered_pids, key))
424 + {
425 + g_hash_table_insert (registered_pids, key, g_strdup (window_hint));
426 + }
Only updating if we don't already know the pid seems like it could cause things to go askew? If that's not the case I think this logic requires a comment in the code.
628 static void dispose (GObject *object)
629 +bamf_matcher_
This function does not look like it's safe to run N times on the same object. That is the contract of dispose(). Fx. looking at this block makes me suspicious:
642 + g_array_free (priv-> bad_prefixes, TRUE); table_destroy (priv-> desktop_ id_table) ; table_destroy (priv-> desktop_ file_table) ; table_destroy (priv-> desktop_ class_table) ; table_destroy (priv-> registered_ pids);
643 + g_array_free (priv->known_pids, TRUE);
644 + g_hash_
645 + g_hash_
646 + g_hash_
647 + g_hash_
You must add NULL-ification and NULL-checking on all members. If you don't want that override finalize() instead which is guaranteed to run only once.
695 + GObject *old_object = dbus_g_ connection_ lookup_ g_object (bus, path); connection_ unregister_ g_object (bus, old_object);
696 + if (G_IS_OBJECT (old_object))
697 + {
698 + dbus_g_
699 + }
The commit message for this chunk mentions that you log a g_critical()when you replace an object. I don't see that critical being logged - is that intentional?