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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 void BookmarkBarGtk::SetInstructionState() { | 504 void BookmarkBarGtk::SetInstructionState() { |
505 if (model_) | 505 if (model_) |
506 show_instructions_ = model_->GetBookmarkBarNode()->empty(); | 506 show_instructions_ = model_->GetBookmarkBarNode()->empty(); |
507 | 507 |
508 gtk_widget_set_visible(bookmark_toolbar_.get(), !show_instructions_); | 508 gtk_widget_set_visible(bookmark_toolbar_.get(), !show_instructions_); |
509 gtk_widget_set_visible(instructions_, show_instructions_); | 509 gtk_widget_set_visible(instructions_, show_instructions_); |
510 } | 510 } |
511 | 511 |
512 void BookmarkBarGtk::SetChevronState() { | 512 void BookmarkBarGtk::SetChevronState() { |
513 if (!gtk_widget_get_visible(bookmark_hbox_)) | 513 if (!GTK_WIDGET_VISIBLE(bookmark_hbox_)) |
514 return; | 514 return; |
515 | 515 |
516 if (show_instructions_) { | 516 if (show_instructions_) { |
517 gtk_widget_hide(overflow_button_); | 517 gtk_widget_hide(overflow_button_); |
518 return; | 518 return; |
519 } | 519 } |
520 | 520 |
521 int extra_space = 0; | 521 int extra_space = 0; |
522 if (gtk_widget_get_visible(overflow_button_)) | 522 if (GTK_WIDGET_VISIBLE(overflow_button_)) |
523 extra_space = overflow_button_->allocation.width; | 523 extra_space = overflow_button_->allocation.width; |
524 | 524 |
525 int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); | 525 int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); |
526 if (overflow_idx == -1) | 526 if (overflow_idx == -1) |
527 gtk_widget_hide(overflow_button_); | 527 gtk_widget_hide(overflow_button_); |
528 else | 528 else |
529 gtk_widget_show_all(overflow_button_); | 529 gtk_widget_show_all(overflow_button_); |
530 } | 530 } |
531 | 531 |
532 void BookmarkBarGtk::UpdateOtherBookmarksVisibility() { | 532 void BookmarkBarGtk::UpdateOtherBookmarksVisibility() { |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 new MenuGtk(NULL, current_context_menu_controller_->menu_model())); | 1096 new MenuGtk(NULL, current_context_menu_controller_->menu_model())); |
1097 current_context_menu_->PopupAsContext( | 1097 current_context_menu_->PopupAsContext( |
1098 gfx::Point(event->x_root, event->y_root), | 1098 gfx::Point(event->x_root, event->y_root), |
1099 event->time); | 1099 event->time); |
1100 } | 1100 } |
1101 | 1101 |
1102 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, | 1102 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, |
1103 GdkEventButton* event) { | 1103 GdkEventButton* event) { |
1104 last_pressed_coordinates_ = gfx::Point(event->x, event->y); | 1104 last_pressed_coordinates_ = gfx::Point(event->x, event->y); |
1105 | 1105 |
1106 if (event->button == 3 && gtk_widget_get_visible(bookmark_hbox_)) { | 1106 if (event->button == 3 && GTK_WIDGET_VISIBLE(bookmark_hbox_)) { |
1107 const BookmarkNode* node = GetNodeForToolButton(sender); | 1107 const BookmarkNode* node = GetNodeForToolButton(sender); |
1108 DCHECK(node); | 1108 DCHECK(node); |
1109 DCHECK(page_navigator_); | 1109 DCHECK(page_navigator_); |
1110 PopupMenuForNode(sender, node, event); | 1110 PopupMenuForNode(sender, node, event); |
1111 } | 1111 } |
1112 | 1112 |
1113 return FALSE; | 1113 return FALSE; |
1114 } | 1114 } |
1115 | 1115 |
1116 gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, | 1116 gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { | 1444 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { |
1445 GtkDestDefaults dest_defaults = | 1445 GtkDestDefaults dest_defaults = |
1446 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : | 1446 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : |
1447 GTK_DEST_DEFAULT_DROP; | 1447 GTK_DEST_DEFAULT_DROP; |
1448 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); | 1448 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); |
1449 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, | 1449 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, |
1450 NULL, 0, kDragAction); | 1450 NULL, 0, kDragAction); |
1451 ui::SetDestTargetList(overflow_button_, kDestTargetList); | 1451 ui::SetDestTargetList(overflow_button_, kDestTargetList); |
1452 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); | 1452 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); |
1453 } | 1453 } |
OLD | NEW |