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

Unified Diff: remoting/host/disconnect_window_linux.cc

Issue 7635012: Host process i18n and Linux implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change UIStrings to UiStrings. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/disconnect_window_linux.cc
diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc
index 280c43dec5a4e15d959b07ef47d51e5b12cd7175..25296cd7de8e8ac46379345a49f66ff4b53fc726 100644
--- a/remoting/host/disconnect_window_linux.cc
+++ b/remoting/host/disconnect_window_linux.cc
@@ -9,8 +9,19 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "remoting/host/chromoting_host.h"
+#include "remoting/host/ui_strings.h"
#include "ui/base/gtk/gtk_signal.h"
+namespace {
+// The width in pixels at which the message will wrap. Given that the message
+// contains an un-splittable email address, it's unlikely that a fixed width
+// is going to look aesthetically pleasing in all languages.
+// TODO(jamiewalch): Replace this with a layout that only uses a single line,
+// and which is docked at the top or bottom of the host screen, as in our
+// UI mocks.
+const int kMessageWidth = 300;
+}
+
namespace remoting {
class DisconnectWindowLinux : public DisconnectWindow {
@@ -25,11 +36,11 @@ class DisconnectWindowLinux : public DisconnectWindow {
private:
CHROMEGTK_CALLBACK_1(DisconnectWindowLinux, void, OnResponse, int);
- void CreateWindow();
+ void CreateWindow(UiStrings* ui_strings);
ChromotingHost* host_;
GtkWidget* disconnect_window_;
- GtkWidget* user_label_;
+ GtkWidget* message_;
DISALLOW_COPY_AND_ASSIGN(DisconnectWindowLinux);
};
@@ -42,16 +53,17 @@ DisconnectWindowLinux::DisconnectWindowLinux()
DisconnectWindowLinux::~DisconnectWindowLinux() {
}
-void DisconnectWindowLinux::CreateWindow() {
+void DisconnectWindowLinux::CreateWindow(UiStrings* ui_strings) {
if (disconnect_window_) return;
- std::string disconnect_button(kDisconnectButton);
- disconnect_button += kDisconnectKeysLinux;
+ std::string buttonLabel = ui_strings->disconnectButtonText + " (" +
Sergey Ulanov 2011/08/13 01:11:36 Whole string must be localizible, and not some par
Jamie 2011/08/13 01:34:03 Unfortunately on Windows we need to remove the sho
Sergey Ulanov 2011/08/13 01:37:26 Then I think the right solution in this case is to
Jamie 2011/08/13 02:20:15 Done.
+ ui_strings->disconnectButtonShortcut + ")";
+
disconnect_window_ = gtk_dialog_new_with_buttons(
- kTitle,
+ ui_strings->productName.c_str(),
NULL,
GTK_DIALOG_NO_SEPARATOR,
- disconnect_button.c_str(), GTK_RESPONSE_OK,
+ buttonLabel.c_str(), GTK_RESPONSE_OK,
NULL);
GtkWindow* window = GTK_WINDOW(disconnect_window_);
@@ -69,27 +81,27 @@ void DisconnectWindowLinux::CreateWindow() {
GtkWidget* content_area =
gtk_dialog_get_content_area(GTK_DIALOG(disconnect_window_));
- GtkWidget* username_row = gtk_hbox_new(FALSE, 0);
+ GtkWidget* message_row = gtk_hbox_new(FALSE, 0);
// TODO(lambroslambrou): Replace the magic number with an appropriate
// constant from a header file (such as chrome/browser/ui/gtk/gtk_util.h
// but check_deps disallows its #inclusion here).
- gtk_container_set_border_width(GTK_CONTAINER(username_row), 12);
- gtk_container_add(GTK_CONTAINER(content_area), username_row);
-
- GtkWidget* share_label = gtk_label_new(kSharingWith);
- gtk_container_add(GTK_CONTAINER(username_row), share_label);
+ gtk_container_set_border_width(GTK_CONTAINER(message_row), 12);
+ gtk_container_add(GTK_CONTAINER(content_area), message_row);
- user_label_ = gtk_label_new(NULL);
- gtk_container_add(GTK_CONTAINER(username_row), user_label_);
+ message_ = gtk_label_new(NULL);
+ gtk_widget_set_size_request(message_, kMessageWidth, -1);
+ gtk_label_set_line_wrap(GTK_LABEL(message_), true);
+ gtk_container_add(GTK_CONTAINER(message_row), message_);
gtk_widget_show_all(content_area);
}
void DisconnectWindowLinux::Show(ChromotingHost* host,
- const std::string& username) {
+ const std::string& /* unused */) {
host_ = host;
- CreateWindow();
- gtk_label_set_text(GTK_LABEL(user_label_), username.c_str());
+ CreateWindow(host->ui_strings());
+ gtk_label_set_text(GTK_LABEL(message_),
+ host->ui_strings()->disconnectMessage.c_str());
gtk_window_present(GTK_WINDOW(disconnect_window_));
}

Powered by Google App Engine
This is Rietveld 408576698