summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/download_shelf_gtk.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 19:55:30 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 19:55:30 +0000
commitd995479a4149e65e23f5651a79cf605711ea081d (patch)
treebcb9e82f68beff680aca8f4eec794705d248b102 /chrome/browser/gtk/download_shelf_gtk.cc
parentaf62bb4afd0dba5e607643f818a08a2aec642a80 (diff)
downloadchromium_src-d995479a4149e65e23f5651a79cf605711ea081d.zip
chromium_src-d995479a4149e65e23f5651a79cf605711ea081d.tar.gz
chromium_src-d995479a4149e65e23f5651a79cf605711ea081d.tar.bz2
GTK Themes: Set bg/text colors for the download shelf.
(This does not change the button image.) Review URL: http://codereview.chromium.org/155365 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/download_shelf_gtk.cc')
-rw-r--r--chrome/browser/gtk/download_shelf_gtk.cc25
1 files changed, 18 insertions, 7 deletions
diff --git a/chrome/browser/gtk/download_shelf_gtk.cc b/chrome/browser/gtk/download_shelf_gtk.cc
index ceb8979..a0f523c 100644
--- a/chrome/browser/gtk/download_shelf_gtk.cc
+++ b/chrome/browser/gtk/download_shelf_gtk.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/gtk/custom_button.h"
#include "chrome/browser/gtk/download_item_gtk.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
+#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/slide_animator_gtk.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/gtk_util.h"
@@ -38,9 +39,6 @@ const int kLeftPadding = 2;
// Padding between the right side of the shelf and the close button.
const int kRightPadding = 10;
-// The background color of the shelf.
-const GdkColor kBackgroundColor = GDK_COLOR_RGB(230, 237, 244);
-
// Border color (the top pixel of the shelf).
const GdkColor kBorderColor = GDK_COLOR_RGB(214, 214, 214);
@@ -74,14 +72,13 @@ DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent)
// Subtract 1 from top spacing to account for top border.
gtk_alignment_set_padding(GTK_ALIGNMENT(padding),
kTopBottomPadding - 1, kTopBottomPadding, kLeftPadding, kRightPadding);
- GtkWidget* padding_bg = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(padding_bg), padding);
+ padding_bg_ = gtk_event_box_new();
+ gtk_container_add(GTK_CONTAINER(padding_bg_), padding);
gtk_container_add(GTK_CONTAINER(padding), hbox_.get());
- gtk_widget_modify_bg(padding_bg, GTK_STATE_NORMAL, &kBackgroundColor);
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), top_border, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), padding_bg, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), padding_bg_, FALSE, FALSE, 0);
// Put the shelf in an event box so it gets its own window, which makes it
// easier to get z-ordering right.
@@ -120,6 +117,10 @@ DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent)
SlideAnimatorGtk::UP,
kShelfAnimationDurationMs,
false, NULL));
+
+ GtkThemeProperties properties(browser->profile());
+ UserChangedTheme(&properties);
+
gtk_widget_show_all(shelf_.get());
// Stick ourselves at the bottom of the parent browser.
@@ -169,6 +170,16 @@ int DownloadShelfGtk::GetHeight() const {
return slide_widget_->widget()->allocation.height;
}
+void DownloadShelfGtk::UserChangedTheme(GtkThemeProperties* properties) {
+ GdkColor color = properties->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR);
+ gtk_widget_modify_bg(padding_bg_, GTK_STATE_NORMAL, &color);
+
+ for (std::vector<DownloadItemGtk*>::iterator it = download_items_.begin();
+ it != download_items_.end(); ++it) {
+ (*it)->UserChangedTheme(properties);
+ }
+}
+
void DownloadShelfGtk::RemoveDownloadItem(DownloadItemGtk* download_item) {
DCHECK(download_item);
std::vector<DownloadItemGtk*>::iterator i =