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

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

Issue 114047: Add import progress indicator dialog. (Closed)
Patch Set: code review fixes Created 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/import_lock_dialog_gtk.h"
6
7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h"
9 #include "grit/generated_resources.h"
10 #include "grit/chromium_strings.h"
11
12 // static
13 void ImportLockDialogGtk::Show(GtkWindow* parent, ImporterHost* importer_host) {
14 new ImportLockDialogGtk(parent, importer_host);
15 }
16
17 ImportLockDialogGtk::ImportLockDialogGtk(GtkWindow* parent,
18 ImporterHost* importer_host) : importer_host_(importer_host) {
19 // Build the dialog.
20 dialog_ = gtk_dialog_new_with_buttons(
21 l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_TITLE).c_str(),
22 parent,
23 (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
24 GTK_STOCK_OK,
25 GTK_RESPONSE_ACCEPT,
26 GTK_STOCK_CANCEL,
27 GTK_RESPONSE_REJECT,
28 NULL);
29
30 GtkWidget* content_area = GTK_DIALOG(dialog_)->vbox;
31 gtk_box_set_spacing(GTK_BOX(content_area), 18);
32 GtkWidget* label = gtk_label_new(
33 l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_TEXT).c_str());
34 gtk_label_set_single_line_mode(GTK_LABEL(label), FALSE);
35 gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0);
36
37 g_signal_connect(dialog_, "response",
38 G_CALLBACK(HandleOnResponseDialog), this);
39 gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE);
40 gtk_widget_show_all(dialog_);
41 }
42
43 void ImportLockDialogGtk::OnDialogResponse(GtkWidget* widget, int response) {
44 if (response == GTK_RESPONSE_ACCEPT) {
45 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
46 importer_host_.get(), &ImporterHost::OnLockViewEnd, true));
47 } else {
48 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
49 importer_host_.get(), &ImporterHost::OnLockViewEnd, false));
50 }
51 gtk_widget_destroy(dialog_);
52 delete this;
53 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/import_lock_dialog_gtk.h ('k') | chrome/browser/gtk/import_progress_dialog_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698