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

Side by Side Diff: chrome/browser/gtk/gtk_theme_provider.cc

Issue 2345002: GTK: More signal macro usage. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 7 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
« no previous file with comments | « chrome/browser/gtk/gtk_theme_provider.h ('k') | chrome/browser/gtk/tabs/tab_gtk.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/gtk_theme_provider.h" 5 #include "chrome/browser/gtk/gtk_theme_provider.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 fake_window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)), 203 fake_window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)),
204 fake_frame_(meta_frames_new()) { 204 fake_frame_(meta_frames_new()) {
205 fake_label_.Own(gtk_label_new("")); 205 fake_label_.Own(gtk_label_new(""));
206 fake_entry_.Own(gtk_entry_new()); 206 fake_entry_.Own(gtk_entry_new());
207 207
208 // Only realized widgets receive style-set notifications, which we need to 208 // Only realized widgets receive style-set notifications, which we need to
209 // broadcast new theme images and colors. Only realized widgets have style 209 // broadcast new theme images and colors. Only realized widgets have style
210 // properties, too, which we query for some colors. 210 // properties, too, which we query for some colors.
211 gtk_widget_realize(fake_frame_); 211 gtk_widget_realize(fake_frame_);
212 gtk_widget_realize(fake_window_); 212 gtk_widget_realize(fake_window_);
213 signals_.Connect(fake_frame_, "style-set", G_CALLBACK(&OnStyleSet), this); 213 signals_.Connect(fake_frame_, "style-set",
214 G_CALLBACK(&OnStyleSetThunk), this);
214 } 215 }
215 216
216 GtkThemeProvider::~GtkThemeProvider() { 217 GtkThemeProvider::~GtkThemeProvider() {
217 profile()->GetPrefs()->RemovePrefObserver(prefs::kUsesSystemTheme, this); 218 profile()->GetPrefs()->RemovePrefObserver(prefs::kUsesSystemTheme, this);
218 gtk_widget_destroy(fake_window_); 219 gtk_widget_destroy(fake_window_);
219 gtk_widget_destroy(fake_frame_); 220 gtk_widget_destroy(fake_frame_);
220 fake_label_.Destroy(); 221 fake_label_.Destroy();
221 fake_entry_.Destroy(); 222 fake_entry_.Destroy();
222 223
223 // We have to call this because FreePlatformCached() in ~BrowserThemeProvider 224 // We have to call this because FreePlatformCached() in ~BrowserThemeProvider
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 GTK_CHROME_BUTTON(*it), use_gtk_); 527 GTK_CHROME_BUTTON(*it), use_gtk_);
527 } 528 }
528 } 529 }
529 530
530 void GtkThemeProvider::FreePlatformCaches() { 531 void GtkThemeProvider::FreePlatformCaches() {
531 BrowserThemeProvider::FreePlatformCaches(); 532 BrowserThemeProvider::FreePlatformCaches();
532 FreePerDisplaySurfaces(); 533 FreePerDisplaySurfaces();
533 STLDeleteValues(&gtk_images_); 534 STLDeleteValues(&gtk_images_);
534 } 535 }
535 536
536 // static
537 void GtkThemeProvider::OnStyleSet(GtkWidget* widget, 537 void GtkThemeProvider::OnStyleSet(GtkWidget* widget,
538 GtkStyle* previous_style, 538 GtkStyle* previous_style) {
539 GtkThemeProvider* provider) {
540 GdkPixbuf* default_folder_icon = default_folder_icon_; 539 GdkPixbuf* default_folder_icon = default_folder_icon_;
541 GdkPixbuf* default_bookmark_icon = default_bookmark_icon_; 540 GdkPixbuf* default_bookmark_icon = default_bookmark_icon_;
542 default_folder_icon_ = NULL; 541 default_folder_icon_ = NULL;
543 default_bookmark_icon_ = NULL; 542 default_bookmark_icon_ = NULL;
544 543
545 if (provider->profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) { 544 if (profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) {
546 provider->ClearAllThemeData(); 545 ClearAllThemeData();
547 provider->LoadGtkValues(); 546 LoadGtkValues();
548 provider->NotifyThemeChanged(NULL); 547 NotifyThemeChanged(NULL);
549 } 548 }
550 549
551 // Free the old icons only after the theme change notification has gone 550 // Free the old icons only after the theme change notification has gone
552 // through. 551 // through.
553 if (default_folder_icon) 552 if (default_folder_icon)
554 g_object_unref(default_folder_icon); 553 g_object_unref(default_folder_icon);
555 if (default_bookmark_icon) 554 if (default_bookmark_icon)
556 g_object_unref(default_bookmark_icon); 555 g_object_unref(default_bookmark_icon);
557 } 556 }
558 557
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 cairo_set_line_width(cr, 1.0); 953 cairo_set_line_width(cr, 1.0);
955 cairo_move_to(cr, start_x, widget->allocation.y); 954 cairo_move_to(cr, start_x, widget->allocation.y);
956 cairo_line_to(cr, start_x, 955 cairo_line_to(cr, start_x,
957 widget->allocation.y + widget->allocation.height); 956 widget->allocation.y + widget->allocation.height);
958 cairo_stroke(cr); 957 cairo_stroke(cr);
959 cairo_destroy(cr); 958 cairo_destroy(cr);
960 cairo_pattern_destroy(pattern); 959 cairo_pattern_destroy(pattern);
961 960
962 return TRUE; 961 return TRUE;
963 } 962 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/gtk_theme_provider.h ('k') | chrome/browser/gtk/tabs/tab_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698