Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: ui/base/gtk/gtk_signal_registrar.cc

Issue 10961016: [gtk] re-acquire input grab on bubbles when another widget (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/gtk/gtk_signal_registrar.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/gtk/gtk_signal_registrar.h" 5 #include "ui/base/gtk/gtk_signal_registrar.h"
6 6
7 #include <glib-object.h> 7 #include <glib-object.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/gtk/g_object_destructor_filo.h" 10 #include "ui/base/gtk/g_object_destructor_filo.h"
11 11
12 namespace ui { 12 namespace ui {
13 13
14 GtkSignalRegistrar::GtkSignalRegistrar() { 14 GtkSignalRegistrar::GtkSignalRegistrar() {
15 } 15 }
16 16
17 GtkSignalRegistrar::~GtkSignalRegistrar() { 17 GtkSignalRegistrar::~GtkSignalRegistrar() {
18 for (HandlerMap::iterator list_iter = handler_lists_.begin(); 18 for (HandlerMap::iterator list_iter = handler_lists_.begin();
19 list_iter != handler_lists_.end(); ++list_iter) { 19 list_iter != handler_lists_.end(); ++list_iter) {
20 GObject* object = list_iter->first; 20 GObject* object = list_iter->first;
21 GObjectDestructorFILO::GetInstance()->Disconnect( 21 GObjectDestructorFILO::GetInstance()->Disconnect(
22 object, WeakNotifyThunk, this); 22 object, WeakNotifyThunk, this);
23 23
24 HandlerList& handlers = list_iter->second; 24 HandlerList& handlers = list_iter->second;
25 for (HandlerList::iterator ids_iter = handlers.begin(); 25 for (HandlerList::iterator ids_iter = handlers.begin();
26 ids_iter != handlers.end(); ids_iter++) { 26 ids_iter != handlers.end(); ++ids_iter) {
27 g_signal_handler_disconnect(list_iter->first, *ids_iter); 27 g_signal_handler_disconnect(object, *ids_iter);
28 } 28 }
29 } 29 }
30 } 30 }
31 31
32 glong GtkSignalRegistrar::Connect(gpointer instance, 32 glong GtkSignalRegistrar::Connect(gpointer instance,
33 const gchar* detailed_signal, 33 const gchar* detailed_signal,
34 GCallback signal_handler, 34 GCallback signal_handler,
35 gpointer data) { 35 gpointer data) {
36 return ConnectInternal(instance, detailed_signal, signal_handler, data, 36 return ConnectInternal(instance, detailed_signal, signal_handler, data,
37 false); 37 false);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 HandlerMap::iterator iter = handler_lists_.find(where_the_object_was); 71 HandlerMap::iterator iter = handler_lists_.find(where_the_object_was);
72 if (iter == handler_lists_.end()) { 72 if (iter == handler_lists_.end()) {
73 NOTREACHED(); 73 NOTREACHED();
74 return; 74 return;
75 } 75 }
76 // The signal handlers will be disconnected automatically. Just erase the 76 // The signal handlers will be disconnected automatically. Just erase the
77 // handler id list. 77 // handler id list.
78 handler_lists_.erase(iter); 78 handler_lists_.erase(iter);
79 } 79 }
80 80
81 void GtkSignalRegistrar::DisconnectAll(gpointer instance) {
82 GObject* object = G_OBJECT(instance);
83 HandlerMap::iterator iter = handler_lists_.find(object);
84 if (iter == handler_lists_.end())
85 return;
86
87 GObjectDestructorFILO::GetInstance()->Disconnect(
88 object, WeakNotifyThunk, this);
89 HandlerList& handlers = iter->second;
90 for (HandlerList::iterator ids_iter = handlers.begin();
91 ids_iter != handlers.end(); ++ids_iter) {
92 g_signal_handler_disconnect(object, *ids_iter);
93 }
94
95 handler_lists_.erase(iter);
96 }
97
81 } // namespace ui 98 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/gtk/gtk_signal_registrar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698