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

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

Issue 28105: Implement accelerators in the gtk port. (Closed)
Patch Set: Fixes for evanm Created 11 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_window_gtk.h" 5 #include "chrome/browser/gtk/browser_window_gtk.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/base_paths_linux.h" 8 #include "base/base_paths_linux.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 gtk_window_set_title(window_, "Chromium"); 133 gtk_window_set_title(window_, "Chromium");
134 gtk_window_set_default_size(window_, 640, 480); 134 gtk_window_set_default_size(window_, 640, 480);
135 g_signal_connect(G_OBJECT(window_), "destroy", 135 g_signal_connect(G_OBJECT(window_), "destroy",
136 G_CALLBACK(MainWindowDestroyed), this); 136 G_CALLBACK(MainWindowDestroyed), this);
137 g_signal_connect(G_OBJECT(window_), "configure-event", 137 g_signal_connect(G_OBJECT(window_), "configure-event",
138 G_CALLBACK(MainWindowConfigured), this); 138 G_CALLBACK(MainWindowConfigured), this);
139 g_signal_connect(G_OBJECT(window_), "window-state-event", 139 g_signal_connect(G_OBJECT(window_), "window-state-event",
140 G_CALLBACK(MainWindowStateChanged), this); 140 G_CALLBACK(MainWindowStateChanged), this);
141 bounds_ = GetInitialWindowBounds(window_); 141 bounds_ = GetInitialWindowBounds(window_);
142 142
143 GtkAccelGroup* accel_group = gtk_accel_group_new();
144 gtk_window_add_accel_group(window_, accel_group);
145
143 GdkPixbuf* images[9] = { 146 GdkPixbuf* images[9] = {
144 LoadThemeImage(IDR_CONTENT_TOP_LEFT_CORNER), 147 LoadThemeImage(IDR_CONTENT_TOP_LEFT_CORNER),
145 LoadThemeImage(IDR_CONTENT_TOP_CENTER), 148 LoadThemeImage(IDR_CONTENT_TOP_CENTER),
146 LoadThemeImage(IDR_CONTENT_TOP_RIGHT_CORNER), 149 LoadThemeImage(IDR_CONTENT_TOP_RIGHT_CORNER),
147 LoadThemeImage(IDR_CONTENT_LEFT_SIDE), 150 LoadThemeImage(IDR_CONTENT_LEFT_SIDE),
148 NULL, 151 NULL,
149 LoadThemeImage(IDR_CONTENT_RIGHT_SIDE), 152 LoadThemeImage(IDR_CONTENT_RIGHT_SIDE),
150 LoadThemeImage(IDR_CONTENT_BOTTOM_LEFT_CORNER), 153 LoadThemeImage(IDR_CONTENT_BOTTOM_LEFT_CORNER),
151 LoadThemeImage(IDR_CONTENT_BOTTOM_CENTER), 154 LoadThemeImage(IDR_CONTENT_BOTTOM_CENTER),
152 LoadThemeImage(IDR_CONTENT_BOTTOM_RIGHT_CORNER) 155 LoadThemeImage(IDR_CONTENT_BOTTOM_RIGHT_CORNER)
153 }; 156 };
154 content_area_ninebox_.reset(new NineBox(images)); 157 content_area_ninebox_.reset(new NineBox(images));
155 158
156 // This vbox is intended to surround the "content": toolbar+page. 159 // This vbox is intended to surround the "content": toolbar+page.
157 // When we add the tab strip, it should go in a vbox surrounding this one. 160 // When we add the tab strip, it should go in a vbox surrounding this one.
158 vbox_ = gtk_vbox_new(FALSE, 0); 161 vbox_ = gtk_vbox_new(FALSE, 0);
159 gtk_widget_set_app_paintable(vbox_, TRUE); 162 gtk_widget_set_app_paintable(vbox_, TRUE);
160 gtk_widget_set_double_buffered(vbox_, FALSE); 163 gtk_widget_set_double_buffered(vbox_, FALSE);
161 g_signal_connect(G_OBJECT(vbox_), "expose-event", 164 g_signal_connect(G_OBJECT(vbox_), "expose-event",
162 G_CALLBACK(&OnContentAreaExpose), this); 165 G_CALLBACK(&OnContentAreaExpose), this);
163 166
164 toolbar_.reset(new BrowserToolbarGtk(browser_.get())); 167 toolbar_.reset(new BrowserToolbarGtk(browser_.get()));
165 toolbar_->Init(browser_->profile()); 168 toolbar_->Init(browser_->profile(), accel_group);
166 toolbar_->AddToolbarToBox(vbox_); 169 toolbar_->AddToolbarToBox(vbox_);
167 170
168 contents_container_.reset(new TabContentsContainerGtk()); 171 contents_container_.reset(new TabContentsContainerGtk());
169 contents_container_->AddContainerToBox(vbox_); 172 contents_container_->AddContainerToBox(vbox_);
170 173
171 // Note that calling this the first time is necessary to get the 174 // Note that calling this the first time is necessary to get the
172 // proper control layout. 175 // proper control layout.
173 // TODO(port): make this a pref. 176 // TODO(port): make this a pref.
174 SetCustomFrame(false); 177 SetCustomFrame(false);
175 178
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 void BrowserWindowGtk::SetCustomFrame(bool custom_frame) { 392 void BrowserWindowGtk::SetCustomFrame(bool custom_frame) {
390 custom_frame_ = custom_frame; 393 custom_frame_ = custom_frame;
391 if (custom_frame_) { 394 if (custom_frame_) {
392 gtk_container_set_border_width(GTK_CONTAINER(vbox_), 2); 395 gtk_container_set_border_width(GTK_CONTAINER(vbox_), 2);
393 // TODO(port): all the crazy blue title bar, etc. 396 // TODO(port): all the crazy blue title bar, etc.
394 NOTIMPLEMENTED(); 397 NOTIMPLEMENTED();
395 } else { 398 } else {
396 gtk_container_set_border_width(GTK_CONTAINER(vbox_), 0); 399 gtk_container_set_border_width(GTK_CONTAINER(vbox_), 0);
397 } 400 }
398 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698