| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/gtk/keyword_editor_view.h" | 5 #include "chrome/browser/gtk/keyword_editor_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/gtk_util.h" | 7 #include "app/gfx/gtk_util.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/gtk/edit_search_engine_dialog.h" | 10 #include "chrome/browser/gtk/edit_search_engine_dialog.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 0); | 183 0); |
| 184 | 184 |
| 185 controller_->url_model()->AddObserver(this); | 185 controller_->url_model()->AddObserver(this); |
| 186 table_model_->SetObserver(this); | 186 table_model_->SetObserver(this); |
| 187 table_model_->Reload(); | 187 table_model_->Reload(); |
| 188 | 188 |
| 189 EnableControls(); | 189 EnableControls(); |
| 190 | 190 |
| 191 // Set the size of the dialog. | 191 // Set the size of the dialog. |
| 192 gtk_widget_realize(dialog_); | 192 gtk_widget_realize(dialog_); |
| 193 int width = 1, height = 1; | 193 gtk_util::SetWindowSizeFromResources(GTK_WINDOW(dialog_), |
| 194 gtk_util::GetWidgetSizeFromResources( | 194 IDS_SEARCHENGINES_DIALOG_WIDTH_CHARS, |
| 195 dialog_, | 195 IDS_SEARCHENGINES_DIALOG_HEIGHT_LINES, |
| 196 IDS_SEARCHENGINES_DIALOG_WIDTH_CHARS, | 196 true); |
| 197 IDS_SEARCHENGINES_DIALOG_HEIGHT_LINES, | |
| 198 &width, &height); | |
| 199 gtk_window_set_default_size(GTK_WINDOW(dialog_), width, height); | |
| 200 | 197 |
| 201 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this); | 198 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this); |
| 202 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); | 199 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this); |
| 203 } | 200 } |
| 204 | 201 |
| 205 void KeywordEditorView::EnableControls() { | 202 void KeywordEditorView::EnableControls() { |
| 206 bool can_edit = false; | 203 bool can_edit = false; |
| 207 bool can_make_default = false; | 204 bool can_make_default = false; |
| 208 bool can_remove = false; | 205 bool can_remove = false; |
| 209 int model_row = GetSelectedModelRow(); | 206 int model_row = GetSelectedModelRow(); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 int model_row = editor->GetSelectedModelRow(); | 483 int model_row = editor->GetSelectedModelRow(); |
| 487 if (model_row == -1) { | 484 if (model_row == -1) { |
| 488 NOTREACHED(); | 485 NOTREACHED(); |
| 489 return; | 486 return; |
| 490 } | 487 } |
| 491 int new_index = editor->controller_->MakeDefaultTemplateURL(model_row); | 488 int new_index = editor->controller_->MakeDefaultTemplateURL(model_row); |
| 492 if (new_index > 0) { | 489 if (new_index > 0) { |
| 493 editor->SelectModelRow(new_index); | 490 editor->SelectModelRow(new_index); |
| 494 } | 491 } |
| 495 } | 492 } |
| OLD | NEW |