| OLD | NEW |
| 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 "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 void BookmarkBarGtk::SetInstructionState() { | 508 void BookmarkBarGtk::SetInstructionState() { |
| 509 if (model_) | 509 if (model_) |
| 510 show_instructions_ = model_->bookmark_bar_node()->empty(); | 510 show_instructions_ = model_->bookmark_bar_node()->empty(); |
| 511 | 511 |
| 512 gtk_widget_set_visible(bookmark_toolbar_.get(), !show_instructions_); | 512 gtk_widget_set_visible(bookmark_toolbar_.get(), !show_instructions_); |
| 513 gtk_widget_set_visible(instructions_, show_instructions_); | 513 gtk_widget_set_visible(instructions_, show_instructions_); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void BookmarkBarGtk::SetChevronState() { | 516 void BookmarkBarGtk::SetChevronState() { |
| 517 if (!GTK_WIDGET_VISIBLE(bookmark_hbox_)) | 517 if (!gtk_widget_get_visible(bookmark_hbox_)) |
| 518 return; | 518 return; |
| 519 | 519 |
| 520 if (show_instructions_) { | 520 if (show_instructions_) { |
| 521 gtk_widget_hide(overflow_button_); | 521 gtk_widget_hide(overflow_button_); |
| 522 return; | 522 return; |
| 523 } | 523 } |
| 524 | 524 |
| 525 int extra_space = 0; | 525 int extra_space = 0; |
| 526 if (GTK_WIDGET_VISIBLE(overflow_button_)) | 526 if (gtk_widget_get_visible(overflow_button_)) |
| 527 extra_space = overflow_button_->allocation.width; | 527 extra_space = overflow_button_->allocation.width; |
| 528 | 528 |
| 529 int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); | 529 int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); |
| 530 if (overflow_idx == -1) | 530 if (overflow_idx == -1) |
| 531 gtk_widget_hide(overflow_button_); | 531 gtk_widget_hide(overflow_button_); |
| 532 else | 532 else |
| 533 gtk_widget_show_all(overflow_button_); | 533 gtk_widget_show_all(overflow_button_); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void BookmarkBarGtk::UpdateOtherBookmarksVisibility() { | 536 void BookmarkBarGtk::UpdateOtherBookmarksVisibility() { |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 new MenuGtk(NULL, current_context_menu_controller_->menu_model())); | 1100 new MenuGtk(NULL, current_context_menu_controller_->menu_model())); |
| 1101 current_context_menu_->PopupAsContext( | 1101 current_context_menu_->PopupAsContext( |
| 1102 gfx::Point(event->x_root, event->y_root), | 1102 gfx::Point(event->x_root, event->y_root), |
| 1103 event->time); | 1103 event->time); |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, | 1106 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, |
| 1107 GdkEventButton* event) { | 1107 GdkEventButton* event) { |
| 1108 last_pressed_coordinates_ = gfx::Point(event->x, event->y); | 1108 last_pressed_coordinates_ = gfx::Point(event->x, event->y); |
| 1109 | 1109 |
| 1110 if (event->button == 3 && GTK_WIDGET_VISIBLE(bookmark_hbox_)) { | 1110 if (event->button == 3 && gtk_widget_get_visible(bookmark_hbox_)) { |
| 1111 const BookmarkNode* node = GetNodeForToolButton(sender); | 1111 const BookmarkNode* node = GetNodeForToolButton(sender); |
| 1112 DCHECK(node); | 1112 DCHECK(node); |
| 1113 DCHECK(page_navigator_); | 1113 DCHECK(page_navigator_); |
| 1114 PopupMenuForNode(sender, node, event); | 1114 PopupMenuForNode(sender, node, event); |
| 1115 } | 1115 } |
| 1116 | 1116 |
| 1117 return FALSE; | 1117 return FALSE; |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, | 1120 gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1447 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
| 1448 GtkDestDefaults dest_defaults = | 1448 GtkDestDefaults dest_defaults = |
| 1449 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1449 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
| 1450 GTK_DEST_DEFAULT_DROP; | 1450 GTK_DEST_DEFAULT_DROP; |
| 1451 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1451 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
| 1452 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1452 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
| 1453 NULL, 0, kDragAction); | 1453 NULL, 0, kDragAction); |
| 1454 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1454 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
| 1455 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1455 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
| 1456 } | 1456 } |
| OLD | NEW |