OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 void BookmarkBubbleGtk::OnFolderChanged(GtkWidget* widget) { | 226 void BookmarkBubbleGtk::OnFolderChanged(GtkWidget* widget) { |
227 int index = gtk_combo_box_get_active(GTK_COMBO_BOX(folder_combo_)); | 227 int index = gtk_combo_box_get_active(GTK_COMBO_BOX(folder_combo_)); |
228 if (index == folder_combo_model_->GetItemCount() - 1) { | 228 if (index == folder_combo_model_->GetItemCount() - 1) { |
229 content::RecordAction( | 229 content::RecordAction( |
230 UserMetricsAction("BookmarkBubble_EditFromCombobox")); | 230 UserMetricsAction("BookmarkBubble_EditFromCombobox")); |
231 // GTK doesn't handle having the combo box destroyed from the changed | 231 // GTK doesn't handle having the combo box destroyed from the changed |
232 // signal. Since showing the editor also closes the bubble, delay this | 232 // signal. Since showing the editor also closes the bubble, delay this |
233 // so that GTK can unwind. Specifically gtk_menu_shell_button_release | 233 // so that GTK can unwind. Specifically gtk_menu_shell_button_release |
234 // will run, and we need to keep the combo box alive until then. | 234 // will run, and we need to keep the combo box alive until then. |
235 MessageLoop::current()->PostTask( | 235 base::MessageLoop::current()->PostTask( |
236 FROM_HERE, | 236 FROM_HERE, |
237 base::Bind(&BookmarkBubbleGtk::ShowEditor, factory_.GetWeakPtr())); | 237 base::Bind(&BookmarkBubbleGtk::ShowEditor, factory_.GetWeakPtr())); |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 void BookmarkBubbleGtk::OnEditClicked(GtkWidget* widget) { | 241 void BookmarkBubbleGtk::OnEditClicked(GtkWidget* widget) { |
242 content::RecordAction(UserMetricsAction("BookmarkBubble_Edit")); | 242 content::RecordAction(UserMetricsAction("BookmarkBubble_Edit")); |
243 ShowEditor(); | 243 ShowEditor(); |
244 } | 244 } |
245 | 245 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(folder_combo_), | 337 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(folder_combo_), |
338 IsSeparator, NULL, NULL); | 338 IsSeparator, NULL, NULL); |
339 g_object_unref(store); | 339 g_object_unref(store); |
340 | 340 |
341 GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); | 341 GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); |
342 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(folder_combo_), renderer, TRUE); | 342 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(folder_combo_), renderer, TRUE); |
343 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(folder_combo_), renderer, | 343 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(folder_combo_), renderer, |
344 "text", COLUMN_NAME, | 344 "text", COLUMN_NAME, |
345 NULL); | 345 NULL); |
346 } | 346 } |
OLD | NEW |