Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc

Issue 7310016: GTK: Now that we depend on gtk 2.18+, replace this pattern: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // The event box won't stay below its children's GdkWindows unless we 444 // The event box won't stay below its children's GdkWindows unless we
445 // toggle the above-child property here. If the event box doesn't stay 445 // toggle the above-child property here. If the event box doesn't stay
446 // below its children then events will be routed to it rather than the 446 // below its children then events will be routed to it rather than the
447 // children. 447 // children.
448 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), TRUE); 448 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), TRUE);
449 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), FALSE); 449 gtk_event_box_set_above_child(GTK_EVENT_BOX(event_box_.get()), FALSE);
450 } 450 }
451 } 451 }
452 } 452 }
453 453
454 if (sync_ui_util::ShouldShowSyncErrorButton(sync_service_)) { 454 gtk_widget_set_visible(
455 gtk_widget_show(sync_error_button_); 455 sync_error_button_,
456 } else { 456 sync_ui_util::ShouldShowSyncErrorButton(sync_service_));
457 gtk_widget_hide(sync_error_button_);
458 }
459 457
460 // Maybe show the instructions 458 // Maybe show the instructions
461 if (show_instructions_) { 459 gtk_widget_set_visible(bookmark_toolbar_.get(), !show_instructions_);
462 gtk_widget_hide(bookmark_toolbar_.get()); 460 gtk_widget_set_visible(instructions_, show_instructions_);
463 gtk_widget_show(instructions_);
464 } else {
465 gtk_widget_hide(instructions_);
466 gtk_widget_show(bookmark_toolbar_.get());
467 }
468 461
469 SetChevronState(); 462 SetChevronState();
470 } 463 }
471 464
472 void BookmarkBarGtk::Hide(BookmarkBar::State old_state, 465 void BookmarkBarGtk::Hide(BookmarkBar::State old_state,
473 BookmarkBar::AnimateChangeType animate_type) { 466 BookmarkBar::AnimateChangeType animate_type) {
474 UpdateDetachedState(old_state); 467 UpdateDetachedState(old_state);
475 468
476 // After coming out of fullscreen, the browser window sets the bookmark bar 469 // After coming out of fullscreen, the browser window sets the bookmark bar
477 // to the "hidden" state, which means we need to show our minimum height. 470 // to the "hidden" state, which means we need to show our minimum height.
(...skipping 24 matching lines...) Expand all
502 } 495 }
503 496
504 bookmark_utils::ConfigureButtonForNode(model_->other_node(), 497 bookmark_utils::ConfigureButtonForNode(model_->other_node(),
505 model_, other_bookmarks_button_, theme_service_); 498 model_, other_bookmarks_button_, theme_service_);
506 499
507 SetInstructionState(); 500 SetInstructionState();
508 SetChevronState(); 501 SetChevronState();
509 } 502 }
510 503
511 void BookmarkBarGtk::SetInstructionState() { 504 void BookmarkBarGtk::SetInstructionState() {
512 show_instructions_ = model_->GetBookmarkBarNode()->empty(); 505 if (model_)
513 if (show_instructions_) { 506 show_instructions_ = model_->GetBookmarkBarNode()->empty();
514 gtk_widget_hide(bookmark_toolbar_.get()); 507
515 gtk_widget_show_all(instructions_); 508 gtk_widget_set_visible(bookmark_toolbar_.get(), !show_instructions_);
516 } else { 509 gtk_widget_set_visible(instructions_, show_instructions_);
517 gtk_widget_hide(instructions_);
518 gtk_widget_show(bookmark_toolbar_.get());
519 }
520 } 510 }
521 511
522 void BookmarkBarGtk::SetChevronState() { 512 void BookmarkBarGtk::SetChevronState() {
523 if (!GTK_WIDGET_VISIBLE(bookmark_hbox_)) 513 if (!GTK_WIDGET_VISIBLE(bookmark_hbox_))
524 return; 514 return;
525 515
526 if (show_instructions_) { 516 if (show_instructions_) {
527 gtk_widget_hide(overflow_button_); 517 gtk_widget_hide(overflow_button_);
528 return; 518 return;
529 } 519 }
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 method_factory_.NewRunnableMethod( 1413 method_factory_.NewRunnableMethod(
1424 &BookmarkBarGtk::PaintEventBox)); 1414 &BookmarkBarGtk::PaintEventBox));
1425 } 1415 }
1426 } 1416 }
1427 1417
1428 void BookmarkBarGtk::OnThrobbingWidgetDestroy(GtkWidget* widget) { 1418 void BookmarkBarGtk::OnThrobbingWidgetDestroy(GtkWidget* widget) {
1429 SetThrobbingWidget(NULL); 1419 SetThrobbingWidget(NULL);
1430 } 1420 }
1431 1421
1432 void BookmarkBarGtk::OnStateChanged() { 1422 void BookmarkBarGtk::OnStateChanged() {
1433 if (sync_ui_util::ShouldShowSyncErrorButton(sync_service_)) { 1423 gtk_widget_set_visible(
1434 gtk_widget_show(sync_error_button_); 1424 sync_error_button_,
1435 } else { 1425 sync_ui_util::ShouldShowSyncErrorButton(sync_service_));
1436 gtk_widget_hide(sync_error_button_);
1437 }
1438 } 1426 }
1439 1427
1440 void BookmarkBarGtk::ShowImportDialog() { 1428 void BookmarkBarGtk::ShowImportDialog() {
1441 browser_->OpenImportSettingsDialog(); 1429 browser_->OpenImportSettingsDialog();
1442 } 1430 }
1443 1431
1444 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() { 1432 void BookmarkBarGtk::OnEditBookmarksEnabledChanged() {
1445 GtkDestDefaults dest_defaults = 1433 GtkDestDefaults dest_defaults =
1446 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL : 1434 *edit_bookmarks_enabled_ ? GTK_DEST_DEFAULT_ALL :
1447 GTK_DEST_DEFAULT_DROP; 1435 GTK_DEST_DEFAULT_DROP;
1448 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction); 1436 gtk_drag_dest_set(overflow_button_, dest_defaults, NULL, 0, kDragAction);
1449 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults, 1437 gtk_drag_dest_set(other_bookmarks_button_, dest_defaults,
1450 NULL, 0, kDragAction); 1438 NULL, 0, kDragAction);
1451 ui::SetDestTargetList(overflow_button_, kDestTargetList); 1439 ui::SetDestTargetList(overflow_button_, kDestTargetList);
1452 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList); 1440 ui::SetDestTargetList(other_bookmarks_button_, kDestTargetList);
1453 } 1441 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698