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

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

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/ui/gtk/update_recommended_dialog.h"
6
7 #include <gtk/gtk.h>
8
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/lifetime/application_lifetime.h"
11 #include "chrome/browser/ui/gtk/gtk_util.h"
12 #include "grit/chromium_strings.h"
13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h"
15
16 static const int kMessageWidth = 400;
17
18 // static
19 void UpdateRecommendedDialog::Show(GtkWindow* parent) {
20 new UpdateRecommendedDialog(parent);
21 }
22
23 UpdateRecommendedDialog::UpdateRecommendedDialog(GtkWindow* parent) {
24 dialog_ = gtk_dialog_new_with_buttons(
25 l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str(),
26 parent,
27 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
28 l10n_util::GetStringUTF8(IDS_NOT_NOW).c_str(),
29 GTK_RESPONSE_REJECT,
30 l10n_util::GetStringUTF8(IDS_RELAUNCH_AND_UPDATE).c_str(),
31 GTK_RESPONSE_ACCEPT,
32 NULL);
33
34 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
35
36 // Add the message text.
37 std::string text(
38 l10n_util::GetStringFUTF8(IDS_UPDATE_RECOMMENDED,
39 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
40 GtkWidget* label = gtk_label_new(text.c_str());
41 gtk_util::SetLabelWidth(label, kMessageWidth);
42
43 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_));
44 gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0);
45
46 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE);
47
48 gtk_widget_show_all(dialog_);
49 }
50
51 UpdateRecommendedDialog::~UpdateRecommendedDialog() {
52 }
53
54 void UpdateRecommendedDialog::OnResponse(GtkWidget* dialog, int response_id) {
55 gtk_widget_destroy(dialog_);
56
57 if (response_id == GTK_RESPONSE_ACCEPT)
58 chrome::AttemptRestart();
59
60 delete this;
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698