Merge lp:~canonical-dx-team/unity/unity.fix-691651 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 794
Proposed branch: lp:~canonical-dx-team/unity/unity.fix-691651
Merge into: lp:unity
Diff against target: 95 lines (+38/-0)
2 files modified
src/PanelMenuView.cpp (+35/-0)
src/PanelMenuView.h (+3/-0)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.fix-691651
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+47564@code.launchpad.net

Description of the change

Hooked up the "name-changed" signal so window-titles of maximized windows get correctly updated, when a tab-focus occurs. This also correctly disconnects a registered callback from the old-view before connecting it to the new-view.

NOTE: This branch needs libbamf (rev 377) to work.

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
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-01-25 15:35:00 +0000
+++ src/PanelMenuView.cpp 2011-01-26 17:51:31 +0000
@@ -43,6 +43,10 @@
43 BamfView *new_view,43 BamfView *new_view,
44 PanelMenuView *self);44 PanelMenuView *self);
4545
46static void on_name_changed (BamfView* bamf_view,
47 gchar* old_name,
48 gchar* new_name,
49 PanelMenuView* self);
4650
47PanelMenuView::PanelMenuView (int padding)51PanelMenuView::PanelMenuView (int padding)
48: _matcher (NULL),52: _matcher (NULL),
@@ -68,6 +72,8 @@
68 _layout = _menu_layout;72 _layout = _menu_layout;
6973
70 _padding = padding;74 _padding = padding;
75 _name_changed_callback_instance = NULL;
76 _name_changed_callback_id = 0;
7177
72 _window_buttons = new WindowButtons ();78 _window_buttons = new WindowButtons ();
73 _window_buttons->NeedRedraw ();79 _window_buttons->NeedRedraw ();
@@ -574,11 +580,19 @@
574}580}
575581
576void582void
583PanelMenuView::OnNameChanged (gchar* new_name, gchar* old_name)
584{
585 Refresh ();
586 FullRedraw ();
587}
588
589void
577PanelMenuView::OnActiveWindowChanged (BamfView *old_view,590PanelMenuView::OnActiveWindowChanged (BamfView *old_view,
578 BamfView *new_view)591 BamfView *new_view)
579{592{
580 _is_maximized = false;593 _is_maximized = false;
581594
595
582 if (BAMF_IS_WINDOW (new_view))596 if (BAMF_IS_WINDOW (new_view))
583 {597 {
584 BamfWindow *window = BAMF_WINDOW (new_view);598 BamfWindow *window = BAMF_WINDOW (new_view);
@@ -587,6 +601,18 @@
587601
588 if (_decor_map.find (xid) == _decor_map.end ())602 if (_decor_map.find (xid) == _decor_map.end ())
589 _decor_map[xid] = true;603 _decor_map[xid] = true;
604
605 // first see if we need to remove and old callback
606 if (_name_changed_callback_id != 0)
607 g_signal_handler_disconnect (_name_changed_callback_instance,
608 _name_changed_callback_id);
609
610 // register callback for new view and store handler-id
611 _name_changed_callback_instance = G_OBJECT (new_view);
612 _name_changed_callback_id = g_signal_connect (_name_changed_callback_instance,
613 "name-changed",
614 (GCallback) on_name_changed,
615 this);
590 }616 }
591617
592 Refresh ();618 Refresh ();
@@ -771,3 +797,12 @@
771{797{
772 self->OnActiveWindowChanged (old_view, new_view);798 self->OnActiveWindowChanged (old_view, new_view);
773}799}
800
801static void
802on_name_changed (BamfView* bamf_view,
803 gchar* old_name,
804 gchar* new_name,
805 PanelMenuView* self)
806{
807 self->OnNameChanged (new_name, old_name);
808}
774809
=== modified file 'src/PanelMenuView.h'
--- src/PanelMenuView.h 2011-01-20 12:48:09 +0000
+++ src/PanelMenuView.h 2011-01-26 17:51:31 +0000
@@ -65,6 +65,7 @@
65 void OnEntryRefreshed (PanelIndicatorObjectEntryView *view);65 void OnEntryRefreshed (PanelIndicatorObjectEntryView *view);
66 void OnActiveChanged (PanelIndicatorObjectEntryView *view, bool is_active);66 void OnActiveChanged (PanelIndicatorObjectEntryView *view, bool is_active);
67 void OnActiveWindowChanged (BamfView *old_view, BamfView *new_view);67 void OnActiveWindowChanged (BamfView *old_view, BamfView *new_view);
68 void OnNameChanged (gchar* new_name, gchar* old_name);
6869
69 void OnSpreadInitiate (std::list <guint32> &);70 void OnSpreadInitiate (std::list <guint32> &);
70 void OnSpreadTerminate (std::list <guint32> &);71 void OnSpreadTerminate (std::list <guint32> &);
@@ -111,5 +112,7 @@
111112
112 std::map<guint32, bool> _decor_map;113 std::map<guint32, bool> _decor_map;
113 int _padding;114 int _padding;
115 gpointer _name_changed_callback_instance;
116 gulong _name_changed_callback_id;
114};117};
115#endif118#endif