summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-02 08:30:24 +0000
committersuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-02 08:30:24 +0000
commit2278050814810fb79661792acff847fb2b806e17 (patch)
treee1a1c24e5f795a95a0671bf215d8dec613190395 /chrome
parent13c0fb1a4d5d83149dbccd2001f7828dbdb5473b (diff)
downloadchromium_src-2278050814810fb79661792acff847fb2b806e17.zip
chromium_src-2278050814810fb79661792acff847fb2b806e17.tar.gz
chromium_src-2278050814810fb79661792acff847fb2b806e17.tar.bz2
[Linux] Make bookmark bar shrinkable when there is no bookmark.
BUG=none TEST=Where there is no bookmark, an instruction will be displayed in the bookmark bar, which should be shrinkable when resizing the browser window. Review URL: http://codereview.chromium.org/552211 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc10
-rw-r--r--chrome/browser/gtk/bookmark_bar_instructions_gtk.cc11
2 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index f2f6c73..cd82de8 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -213,7 +213,7 @@ void BookmarkBarGtk::Init(Profile* profile) {
instructions_gtk_.reset(new BookmarkBarInstructionsGtk(this, profile));
gtk_container_add(GTK_CONTAINER(instructions_), instructions_gtk_->widget());
gtk_box_pack_start(GTK_BOX(bookmark_hbox_), instructions_,
- FALSE, FALSE, 0);
+ TRUE, TRUE, 0);
gtk_drag_dest_set(instructions_,
GtkDestDefaults(GTK_DEST_DEFAULT_DROP | GTK_DEST_DEFAULT_MOTION),
@@ -273,7 +273,7 @@ void BookmarkBarGtk::Init(Profile* profile) {
ResourceBundle::GetSharedInstance().GetPixbufNamed(IDR_WARNING)));
g_signal_connect(G_OBJECT(sync_error_button_), "button-press-event",
G_CALLBACK(OnSyncErrorButtonPressed), this);
- gtk_box_pack_start(GTK_BOX(bookmark_hbox_), sync_error_button_ ,
+ gtk_box_pack_start(GTK_BOX(bookmark_hbox_), sync_error_button_,
FALSE, FALSE, 0);
gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight);
@@ -313,9 +313,11 @@ void BookmarkBarGtk::Show(bool animate) {
// Maybe show the instructions
if (show_instructions_) {
+ gtk_widget_hide(bookmark_toolbar_.get());
gtk_widget_show(instructions_);
} else {
gtk_widget_hide(instructions_);
+ gtk_widget_show(bookmark_toolbar_.get());
}
}
@@ -497,9 +499,11 @@ void BookmarkBarGtk::CreateAllBookmarkButtons() {
void BookmarkBarGtk::SetInstructionState() {
show_instructions_ = (model_->GetBookmarkBarNode()->GetChildCount() == 0);
if (show_instructions_) {
- gtk_widget_show_all(instructions_);
+ gtk_widget_hide(bookmark_toolbar_.get());
+ gtk_widget_show(instructions_);
} else {
gtk_widget_hide(instructions_);
+ gtk_widget_show(bookmark_toolbar_.get());
}
}
diff --git a/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc b/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
index 271dd59..1384ac6 100644
--- a/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_instructions_gtk.cc
@@ -25,8 +25,11 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate,
gtk_label_new(l10n_util::GetStringUTF8(IDS_BOOKMARKS_NO_ITEMS).c_str());
instructions_label_ = gtk_label_new(
l10n_util::GetStringUTF8(IDS_BOOKMARKS_NO_ITEMS).c_str());
- gtk_util::CenterWidgetInHBox(instructions_hbox_, instructions_label_,
- false, 1);
+ gtk_label_set_ellipsize(GTK_LABEL(instructions_label_), PANGO_ELLIPSIZE_END);
+ gtk_widget_set_size_request(instructions_label_, 0, -1);
+ gtk_misc_set_alignment(GTK_MISC(instructions_label_), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(instructions_hbox_), instructions_label_,
+ true, true, 1);
instructions_link_ = gtk_chrome_link_button_new(
l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_IMPORT_LINK).c_str());
@@ -38,7 +41,9 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate,
gtk_util::ForceFontSizePixels(
GTK_CHROME_LINK_BUTTON(instructions_link_)->label, 13.4);
gtk_util::CenterWidgetInHBox(instructions_hbox_, instructions_link_,
- false, 1);
+ true, 1);
+
+ gtk_widget_show_all(instructions_hbox_);
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
NotificationService::AllSources());