| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/continue_window.h" | 5 #include "remoting/host/continue_window.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "remoting/host/chromoting_host.h" | 11 #include "remoting/host/chromoting_host.h" |
| 12 #include "remoting/host/ui_strings.h" |
| 12 #include "ui/base/gtk/gtk_signal.h" | 13 #include "ui/base/gtk/gtk_signal.h" |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 | 16 |
| 16 class ContinueWindowLinux : public remoting::ContinueWindow { | 17 class ContinueWindowLinux : public remoting::ContinueWindow { |
| 17 public: | 18 public: |
| 18 ContinueWindowLinux(); | 19 ContinueWindowLinux(); |
| 19 virtual ~ContinueWindowLinux(); | 20 virtual ~ContinueWindowLinux(); |
| 20 | 21 |
| 21 virtual void Show(remoting::ChromotingHost* host) OVERRIDE; | 22 virtual void Show(remoting::ChromotingHost* host) OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 continue_window_(NULL) { | 38 continue_window_(NULL) { |
| 38 } | 39 } |
| 39 | 40 |
| 40 ContinueWindowLinux::~ContinueWindowLinux() { | 41 ContinueWindowLinux::~ContinueWindowLinux() { |
| 41 } | 42 } |
| 42 | 43 |
| 43 void ContinueWindowLinux::CreateWindow() { | 44 void ContinueWindowLinux::CreateWindow() { |
| 44 if (continue_window_) return; | 45 if (continue_window_) return; |
| 45 | 46 |
| 46 continue_window_ = gtk_dialog_new_with_buttons( | 47 continue_window_ = gtk_dialog_new_with_buttons( |
| 47 kTitle, | 48 ui_strings::productName.c_str(), |
| 48 NULL, | 49 NULL, |
| 49 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), | 50 static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), |
| 50 kCancelButtonText, GTK_RESPONSE_CANCEL, | 51 ui_strings::stopSharingButtonText.c_str(), GTK_RESPONSE_CANCEL, |
| 51 kDefaultButtonText, GTK_RESPONSE_OK, | 52 ui_strings::continueButtonText.c_str(), GTK_RESPONSE_OK, |
| 52 NULL); | 53 NULL); |
| 53 | 54 |
| 54 gtk_dialog_set_default_response(GTK_DIALOG(continue_window_), | 55 gtk_dialog_set_default_response(GTK_DIALOG(continue_window_), |
| 55 GTK_RESPONSE_OK); | 56 GTK_RESPONSE_OK); |
| 56 gtk_window_set_resizable(GTK_WINDOW(continue_window_), FALSE); | 57 gtk_window_set_resizable(GTK_WINDOW(continue_window_), FALSE); |
| 57 | 58 |
| 58 // Set always-on-top, otherwise this window tends to be obscured by the | 59 // Set always-on-top, otherwise this window tends to be obscured by the |
| 59 // DisconnectWindow. | 60 // DisconnectWindow. |
| 60 gtk_window_set_keep_above(GTK_WINDOW(continue_window_), TRUE); | 61 gtk_window_set_keep_above(GTK_WINDOW(continue_window_), TRUE); |
| 61 | 62 |
| 62 g_signal_connect(continue_window_, "response", | 63 g_signal_connect(continue_window_, "response", |
| 63 G_CALLBACK(OnResponseThunk), this); | 64 G_CALLBACK(OnResponseThunk), this); |
| 64 | 65 |
| 65 GtkWidget* content_area = | 66 GtkWidget* content_area = |
| 66 gtk_dialog_get_content_area(GTK_DIALOG(continue_window_)); | 67 gtk_dialog_get_content_area(GTK_DIALOG(continue_window_)); |
| 67 | 68 |
| 68 GtkWidget* text_label = gtk_label_new(kMessage); | 69 GtkWidget* text_label = gtk_label_new(ui_strings::continuePrompt.c_str()); |
| 69 gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE); | 70 gtk_label_set_line_wrap(GTK_LABEL(text_label), TRUE); |
| 70 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc. | 71 // TODO(lambroslambrou): Fix magic numbers, as in disconnect_window_linux.cc. |
| 71 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); | 72 gtk_misc_set_padding(GTK_MISC(text_label), 12, 12); |
| 72 gtk_container_add(GTK_CONTAINER(content_area), text_label); | 73 gtk_container_add(GTK_CONTAINER(content_area), text_label); |
| 73 | 74 |
| 74 gtk_widget_show_all(content_area); | 75 gtk_widget_show_all(content_area); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void ContinueWindowLinux::Show(remoting::ChromotingHost* host) { | 78 void ContinueWindowLinux::Show(remoting::ChromotingHost* host) { |
| 78 host_ = host; | 79 host_ = host; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 95 host_->Shutdown(NULL); | 96 host_->Shutdown(NULL); |
| 96 } | 97 } |
| 97 Hide(); | 98 Hide(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 ContinueWindow* ContinueWindow::Create() { | 101 ContinueWindow* ContinueWindow::Create() { |
| 101 return new ContinueWindowLinux(); | 102 return new ContinueWindowLinux(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace remoting | 105 } // namespace remoting |
| OLD | NEW |