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

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

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/update_recommended_dialog.h ('k') | chrome/browser/gtk/view_id_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/update_recommended_dialog.h"
6
7 #include <gtk/gtk.h>
8
9 #include "app/l10n_util.h"
10 #include "chrome/browser/browser_list.h"
11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/gtk/gtk_util.h"
13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/common/pref_names.h"
15 #include "grit/chromium_strings.h"
16 #include "grit/generated_resources.h"
17
18 static const int kMessageWidth = 400;
19
20 // static
21 void UpdateRecommendedDialog::Show(GtkWindow* parent) {
22 new UpdateRecommendedDialog(parent);
23 }
24
25 UpdateRecommendedDialog::UpdateRecommendedDialog(GtkWindow* parent) {
26 dialog_ = gtk_dialog_new_with_buttons(
27 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str(),
28 parent,
29 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
30 l10n_util::GetStringUTF8(IDS_NOT_NOW).c_str(),
31 GTK_RESPONSE_REJECT,
32 l10n_util::GetStringUTF8(IDS_RESTART_AND_UPDATE).c_str(),
33 GTK_RESPONSE_ACCEPT,
34 NULL);
35
36 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
37
38 // Add the message text.
39 std::string text(
40 l10n_util::GetStringFUTF8(IDS_UPDATE_RECOMMENDED,
41 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
42 GtkWidget* label = gtk_label_new(text.c_str());
43 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
44 gtk_widget_set_size_request(label, kMessageWidth, -1);
45 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), label,
46 FALSE, FALSE, 0);
47
48 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE);
49
50 gtk_widget_show_all(dialog_);
51 }
52
53 UpdateRecommendedDialog::~UpdateRecommendedDialog() {
54 }
55
56 void UpdateRecommendedDialog::OnResponse(GtkWidget* sender, gint response_id) {
57 gtk_widget_destroy(dialog_);
58
59 if (response_id == GTK_RESPONSE_ACCEPT) {
60 // Set the flag to restore the last session on shutdown.
61 PrefService* pref_service = g_browser_process->local_state();
62 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true);
63
64 BrowserList::CloseAllBrowsersAndExit();
65 }
66
67 delete this;
68 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/update_recommended_dialog.h ('k') | chrome/browser/gtk/view_id_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698