OLD | NEW |
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/options_window.h" | 5 #include "chrome/browser/options_window.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // connecting switch-page signal, otherwise we'll immediately get a | 164 // connecting switch-page signal, otherwise we'll immediately get a |
165 // signal switching to page 0 and overwrite our last_selected_page_ | 165 // signal switching to page 0 and overwrite our last_selected_page_ |
166 // value. | 166 // value. |
167 gtk_widget_show_all(gtk_bin_get_child(GTK_BIN(dialog_))); | 167 gtk_widget_show_all(gtk_bin_get_child(GTK_BIN(dialog_))); |
168 | 168 |
169 if (Browser* b = BrowserList::GetLastActive()) { | 169 if (Browser* b = BrowserList::GetLastActive()) { |
170 gtk_util::CenterOverWindow(GTK_WINDOW(dialog_), | 170 gtk_util::CenterOverWindow(GTK_WINDOW(dialog_), |
171 b->window()->GetNativeHandle()); | 171 b->window()->GetNativeHandle()); |
172 } | 172 } |
173 | 173 |
| 174 // Now that we're centered over the browser, we add our dialog to its own |
| 175 // window group. We don't do anything with the response and we don't want the |
| 176 // options window's modal dialogs to be associated with the main browser |
| 177 // window because gtk grabs work on a per window group basis. |
| 178 gtk_window_group_add_window(gtk_window_group_new(), GTK_WINDOW(dialog_)); |
| 179 g_object_unref(gtk_window_get_group(GTK_WINDOW(dialog_))); |
| 180 |
174 g_signal_connect(notebook_, "switch-page", G_CALLBACK(OnSwitchPage), this); | 181 g_signal_connect(notebook_, "switch-page", G_CALLBACK(OnSwitchPage), this); |
175 | 182 |
176 // We only have one button and don't do any special handling, so just hook it | 183 // We only have one button and don't do any special handling, so just hook it |
177 // directly to gtk_widget_destroy. | 184 // directly to gtk_widget_destroy. |
178 g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL); | 185 g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
179 | 186 |
180 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); | 187 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); |
181 | 188 |
182 gtk_widget_show(dialog_); | 189 gtk_widget_show(dialog_); |
183 } | 190 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 260 |
254 // Create the options window. | 261 // Create the options window. |
255 options_window = new OptionsWindowGtk(profile); | 262 options_window = new OptionsWindowGtk(profile); |
256 | 263 |
257 // Resume accessibility events. | 264 // Resume accessibility events. |
258 profile->ResumeAccessibilityEvents(); | 265 profile->ResumeAccessibilityEvents(); |
259 } | 266 } |
260 options_window->ShowOptionsPage(page, highlight_group); | 267 options_window->ShowOptionsPage(page, highlight_group); |
261 } | 268 } |
262 #endif // !defined(OS_CHROMEOS) | 269 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |