summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/info_bubble_gtk.cc
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 10:09:05 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-11 10:09:05 +0000
commitd992e7610c3f05f0042250b1180165075ebf2f44 (patch)
treeb72d88e83dad4e07a5e909aa3a70f35dd3d0f1a4 /chrome/browser/gtk/info_bubble_gtk.cc
parent386c889899593445683c2013ba3894f310995a91 (diff)
downloadchromium_src-d992e7610c3f05f0042250b1180165075ebf2f44.zip
chromium_src-d992e7610c3f05f0042250b1180165075ebf2f44.tar.gz
chromium_src-d992e7610c3f05f0042250b1180165075ebf2f44.tar.bz2
Final touches on the Linux BookmarkBubble.
- Implement "close on escape" with a top level accelerator. - Fix an invalid read when opening the editor from the folder combo. - Clean up some signal handlers (returning bool from a void function, etc). BUG=11738 Review URL: http://codereview.chromium.org/118493 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/info_bubble_gtk.cc')
-rw-r--r--chrome/browser/gtk/info_bubble_gtk.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/gtk/info_bubble_gtk.cc b/chrome/browser/gtk/info_bubble_gtk.cc
index e171e3b..5708818 100644
--- a/chrome/browser/gtk/info_bubble_gtk.cc
+++ b/chrome/browser/gtk/info_bubble_gtk.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/gtk/info_bubble_gtk.h"
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "app/gfx/path.h"
@@ -129,12 +130,14 @@ InfoBubbleGtk* InfoBubbleGtk::Show(GtkWindow* transient_toplevel,
InfoBubbleGtk::InfoBubbleGtk()
: delegate_(NULL),
window_(NULL),
+ accel_group_(gtk_accel_group_new()),
screen_x_(0),
screen_y_(0) {
}
InfoBubbleGtk::~InfoBubbleGtk() {
+ g_object_unref(accel_group_);
}
void InfoBubbleGtk::Init(GtkWindow* transient_toplevel,
@@ -156,6 +159,12 @@ void InfoBubbleGtk::Init(GtkWindow* transient_toplevel,
// Make sure that our window can be focused.
GTK_WIDGET_SET_FLAGS(window_, GTK_CAN_FOCUS);
+ // Attach our accelerator group to the window with an escape accelerator.
+ gtk_accel_group_connect(accel_group_, GDK_Escape,
+ static_cast<GdkModifierType>(0), static_cast<GtkAccelFlags>(0),
+ g_cclosure_new(G_CALLBACK(&HandleEscapeThunk), this, NULL));
+ gtk_window_add_accel_group(GTK_WINDOW(window_), accel_group_);
+
GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
kTopMargin, kBottomMargin,
@@ -207,6 +216,11 @@ void InfoBubbleGtk::Close(bool closed_by_escape) {
// |this| has been deleted, see HandleDestroy.
}
+gboolean InfoBubbleGtk::HandleEscape() {
+ Close(true); // Close by escape.
+ return TRUE;
+}
+
gboolean InfoBubbleGtk::HandleConfigure(GdkEventConfigure* event) {
// If the window is moved someplace besides where we want it, move it back.
// TODO(deanm): In the end, I will probably remove this code and just let