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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 if (show_instructions_) { | 513 if (show_instructions_) { |
514 gtk_widget_hide(bookmark_toolbar_.get()); | 514 gtk_widget_hide(bookmark_toolbar_.get()); |
515 gtk_widget_show_all(instructions_); | 515 gtk_widget_show_all(instructions_); |
516 } else { | 516 } else { |
517 gtk_widget_hide(instructions_); | 517 gtk_widget_hide(instructions_); |
518 gtk_widget_show(bookmark_toolbar_.get()); | 518 gtk_widget_show(bookmark_toolbar_.get()); |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 void BookmarkBarGtk::SetChevronState() { | 522 void BookmarkBarGtk::SetChevronState() { |
523 if (!GTK_WIDGET_VISIBLE(bookmark_hbox_)) | 523 if (!gtk_widget_get_visible(bookmark_hbox_)) |
524 return; | 524 return; |
525 | 525 |
526 if (show_instructions_) { | 526 if (show_instructions_) { |
527 gtk_widget_hide(overflow_button_); | 527 gtk_widget_hide(overflow_button_); |
528 return; | 528 return; |
529 } | 529 } |
530 | 530 |
531 int extra_space = 0; | 531 int extra_space = 0; |
532 if (GTK_WIDGET_VISIBLE(overflow_button_)) | 532 if (gtk_widget_get_visible(overflow_button_)) |
533 extra_space = overflow_button_->allocation.width; | 533 extra_space = overflow_button_->allocation.width; |
534 | 534 |
535 int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); | 535 int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); |
536 if (overflow_idx == -1) | 536 if (overflow_idx == -1) |
537 gtk_widget_hide(overflow_button_); | 537 gtk_widget_hide(overflow_button_); |
538 else | 538 else |
539 gtk_widget_show_all(overflow_button_); | 539 gtk_widget_show_all(overflow_button_); |
540 } | 540 } |
541 | 541 |
542 void BookmarkBarGtk::RemoveAllBookmarkButtons() { | 542 void BookmarkBarGtk::RemoveAllBookmarkButtons() { |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 new MenuGtk(NULL, current_context_menu_controller_->menu_model())); | 1094 new MenuGtk(NULL, current_context_menu_controller_->menu_model())); |
1095 current_context_menu_->PopupAsContext( | 1095 current_context_menu_->PopupAsContext( |
1096 gfx::Point(event->x_root, event->y_root), | 1096 gfx::Point(event->x_root, event->y_root), |
1097 event->time); | 1097 event->time); |
1098 } | 1098 } |
1099 | 1099 |
1100 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, | 1100 gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, |
1101 GdkEventButton* event) { | 1101 GdkEventButton* event) { |
1102 last_pressed_coordinates_ = gfx::Point(event->x, event->y); | 1102 last_pressed_coordinates_ = gfx::Point(event->x, event->y); |
1103 | 1103 |
1104 if (event->button == 3 && GTK_WIDGET_VISIBLE(bookmark_hbox_)) { | 1104 if (event->button == 3 && gtk_widget_get_visible(bookmark_hbox_)) { |
1105 const BookmarkNode* node = GetNodeForToolButton(sender); | 1105 const BookmarkNode* node = GetNodeForToolButton(sender); |
1106 DCHECK(node); | 1106 DCHECK(node); |
1107 DCHECK(page_navigator_); | 1107 DCHECK(page_navigator_); |
1108 PopupMenuForNode(sender, node, event); | 1108 PopupMenuForNode(sender, node, event); |
1109 } | 1109 } |
1110 | 1110 |
1111 return FALSE; | 1111 return FALSE; |
1112 } | 1112 } |
1113 | 1113 |
1114 gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, | 1114 gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, |
(...skipping 329 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 |