diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 21:08:08 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 21:08:08 +0000 |
commit | 6f926fd60310acd3bac1ecc36dcb4394633b9a41 (patch) | |
tree | 562b204fdba8e602d1210e07f36acc9212c83a34 /chrome/browser/gtk/process_singleton_dialog.cc | |
parent | 77c2af208b64e6b8c128efe79c05932d63d33571 (diff) | |
download | chromium_src-6f926fd60310acd3bac1ecc36dcb4394633b9a41.zip chromium_src-6f926fd60310acd3bac1ecc36dcb4394633b9a41.tar.gz chromium_src-6f926fd60310acd3bac1ecc36dcb4394633b9a41.tar.bz2 |
Gtk: Add error dialog when profile was in use on a different computer.
BUG=17549
TEST=see bug
Review URL: http://codereview.chromium.org/173222
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/process_singleton_dialog.cc')
-rw-r--r-- | chrome/browser/gtk/process_singleton_dialog.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/gtk/process_singleton_dialog.cc b/chrome/browser/gtk/process_singleton_dialog.cc new file mode 100644 index 0000000..f63e789 --- /dev/null +++ b/chrome/browser/gtk/process_singleton_dialog.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/gtk/process_singleton_dialog.h" + +#include "app/l10n_util.h" +#include "base/message_loop.h" +#include "chrome/common/gtk_util.h" +#include "grit/chromium_strings.h" + +// static +void ProcessSingletonDialog::ShowAndRun(const std::string& message) { + ProcessSingletonDialog dialog(message); +} + +ProcessSingletonDialog::ProcessSingletonDialog(const std::string& message) { + dialog_ = gtk_message_dialog_new( + NULL, + static_cast<GtkDialogFlags>(0), + GTK_MESSAGE_ERROR, + GTK_BUTTONS_NONE, + "%s", + message.c_str()); + gtk_window_set_title(GTK_WINDOW(dialog_), + l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); + gtk_dialog_add_button(GTK_DIALOG(dialog_), GTK_STOCK_QUIT, + GTK_RESPONSE_REJECT); + gtk_util::SetWindowIcon(GTK_WINDOW(dialog_)); + + g_signal_connect(G_OBJECT(dialog_), "response", + G_CALLBACK(OnResponse), this); + + gtk_widget_show_all(dialog_); + MessageLoop::current()->Run(); +} + +// static +void ProcessSingletonDialog::OnResponse(GtkWidget* widget, int response, + ProcessSingletonDialog* dialog) { + gtk_widget_destroy(dialog->dialog_); + MessageLoop::current()->Quit(); +} |