diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 10:09:05 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 10:09:05 +0000 |
commit | d992e7610c3f05f0042250b1180165075ebf2f44 (patch) | |
tree | b72d88e83dad4e07a5e909aa3a70f35dd3d0f1a4 /chrome/browser/gtk/bookmark_bubble_gtk.cc | |
parent | 386c889899593445683c2013ba3894f310995a91 (diff) | |
download | chromium_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/bookmark_bubble_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/bookmark_bubble_gtk.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.cc b/chrome/browser/gtk/bookmark_bubble_gtk.cc index b875f4f..ae07e3d 100644 --- a/chrome/browser/gtk/bookmark_bubble_gtk.cc +++ b/chrome/browser/gtk/bookmark_bubble_gtk.cc @@ -10,6 +10,7 @@ #include "app/resource_bundle.h" #include "base/basictypes.h" #include "base/logging.h" +#include "base/message_loop.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -18,6 +19,7 @@ #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" #include "chrome/common/gtk_util.h" +#include "chrome/common/notification_service.h" #include "grit/generated_resources.h" namespace { @@ -98,6 +100,15 @@ void BookmarkBubbleGtk::Show(GtkWindow* transient_toplevel, void BookmarkBubbleGtk::InfoBubbleClosing(InfoBubbleGtk* info_bubble, bool closed_by_escape) { + if (closed_by_escape) { + remove_bookmark_ = newly_bookmarked_; + apply_edits_ = false; + } + + NotificationService::current()->Notify( + NotificationType::BOOKMARK_BUBBLE_HIDDEN, + Source<Profile>(profile_->GetOriginalProfile()), + NotificationService::NoDetails()); } BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* transient_toplevel, @@ -112,6 +123,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* transient_toplevel, name_entry_(NULL), folder_combo_(NULL), bubble_(NULL), + factory_(this), newly_bookmarked_(newly_bookmarked), apply_edits_(true), remove_bookmark_(false) { @@ -211,12 +223,11 @@ BookmarkBubbleGtk::~BookmarkBubbleGtk() { } } -gboolean BookmarkBubbleGtk::HandleDestroy() { +void BookmarkBubbleGtk::HandleDestroy() { // We are self deleting, we have a destroy signal setup to catch when we // destroyed (via the InfoBubble being destroyed), and delete ourself. content_ = NULL; // We are being destroyed. delete this; - return FALSE; // Propagate. } void BookmarkBubbleGtk::HandleNameActivate() { @@ -227,7 +238,12 @@ void BookmarkBubbleGtk::HandleFolderChanged() { size_t cur_folder = gtk_combo_box_get_active(GTK_COMBO_BOX(folder_combo_)); if (cur_folder == folder_nodes_.size()) { UserMetrics::RecordAction(L"BookmarkBubble_EditFromCombobox", profile_); - ShowEditor(); + // GTK doesn't handle having the combo box destroyed from the changed + // signal. Since showing the editor also closes the bubble, delay this + // so that GTK can unwind. Specifically gtk_menu_shell_button_release + // will run, and we need to keep the combo box alive until then. + MessageLoop::current()->PostTask(FROM_HERE, + factory_.NewRunnableMethod(&BookmarkBubbleGtk::ShowEditor)); } } |