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

Side by Side Diff: chrome/browser/gtk/options/fonts_languages_window_gtk.cc

Issue 1727012: GTK: Put options dialogs in a different window group. (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
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/fonts_languages_window.h" 5 #include "chrome/browser/fonts_languages_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"
11 #include "chrome/browser/gtk/gtk_util.h" 11 #include "chrome/browser/gtk/gtk_util.h"
12 #include "chrome/browser/profile.h" 12 #include "chrome/browser/profile.h"
13 #include "chrome/browser/gtk/options/fonts_page_gtk.h" 13 #include "chrome/browser/gtk/options/fonts_page_gtk.h"
14 #include "chrome/browser/gtk/options/languages_page_gtk.h" 14 #include "chrome/browser/gtk/options/languages_page_gtk.h"
15 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 17
18 /////////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////////
19 // FontsLanguagesWindowGtk 19 // FontsLanguagesWindowGtk
20 // 20 //
21 // The contents of the Options dialog window. 21 // The contents of the Options dialog window.
22 22
23 class FontsLanguagesWindowGtk { 23 class FontsLanguagesWindowGtk {
24 public: 24 public:
25 explicit FontsLanguagesWindowGtk(Profile* profile); 25 explicit FontsLanguagesWindowGtk(Profile* profile);
26 ~FontsLanguagesWindowGtk(); 26 ~FontsLanguagesWindowGtk();
27 27
28 // Shows the tab corresponding to the specified |page|. 28 // Shows the tab corresponding to the specified |page|.
29 void ShowTabPage(FontsLanguagesPage page); 29 void ShowTabPage(gfx::NativeWindow window, FontsLanguagesPage page);
30 30
31 private: 31 private:
32 static void OnWindowDestroy(GtkWidget* widget, 32 static void OnWindowDestroy(GtkWidget* widget,
33 FontsLanguagesWindowGtk* window); 33 FontsLanguagesWindowGtk* window);
34 34
35 // The fonts and languages dialog. 35 // The fonts and languages dialog.
36 GtkWidget *dialog_; 36 GtkWidget *dialog_;
37 37
38 // The container of the option pages. 38 // The container of the option pages.
39 GtkWidget *notebook_; 39 GtkWidget *notebook_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // directly to gtk_widget_destroy. 103 // directly to gtk_widget_destroy.
104 g_signal_connect_swapped(dialog_, "response", G_CALLBACK(gtk_widget_destroy), 104 g_signal_connect_swapped(dialog_, "response", G_CALLBACK(gtk_widget_destroy),
105 dialog_); 105 dialog_);
106 106
107 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); 107 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
108 } 108 }
109 109
110 FontsLanguagesWindowGtk::~FontsLanguagesWindowGtk() { 110 FontsLanguagesWindowGtk::~FontsLanguagesWindowGtk() {
111 } 111 }
112 112
113 void FontsLanguagesWindowGtk::ShowTabPage(FontsLanguagesPage page) { 113 void FontsLanguagesWindowGtk::ShowTabPage(gfx::NativeWindow window,
114 FontsLanguagesPage page) {
115 // Center our dialog over whoever displayed us.
116 gtk_util::CenterOverWindow(GTK_WINDOW(dialog_), window);
117
114 // Bring options window to front if it already existed and isn't already 118 // Bring options window to front if it already existed and isn't already
115 // in front. 119 // in front.
116 gtk_window_present(GTK_WINDOW(dialog_)); 120 gtk_window_present(GTK_WINDOW(dialog_));
117 121
118 // If the page is out of bounds, reset to the first tab. 122 // If the page is out of bounds, reset to the first tab.
119 if (page < 0 || page >= gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook_))) 123 if (page < 0 || page >= gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook_)))
120 page = FONTS_ENCODING_PAGE; 124 page = FONTS_ENCODING_PAGE;
121 125
122 // Switch the tab to the selected |page|. 126 // Switch the tab to the selected |page|.
123 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_), page); 127 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook_), page);
(...skipping 11 matching lines...) Expand all
135 139
136 void ShowFontsLanguagesWindow(gfx::NativeWindow window, 140 void ShowFontsLanguagesWindow(gfx::NativeWindow window,
137 FontsLanguagesPage page, 141 FontsLanguagesPage page,
138 Profile* profile) { 142 Profile* profile) {
139 DCHECK(profile); 143 DCHECK(profile);
140 // If there's already an existing fonts and language window, activate it and 144 // If there's already an existing fonts and language window, activate it and
141 // switch to the specified page. 145 // switch to the specified page.
142 if (!instance_) 146 if (!instance_)
143 instance_ = new FontsLanguagesWindowGtk(profile); 147 instance_ = new FontsLanguagesWindowGtk(profile);
144 148
145 instance_->ShowTabPage(page); 149 instance_->ShowTabPage(window, page);
146 } 150 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/content_settings_window_gtk.cc ('k') | chrome/browser/gtk/options/options_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698