OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void KeywordEditorView::SetColumnValues(int model_row, GtkTreeIter* iter) { | 226 void KeywordEditorView::SetColumnValues(int model_row, GtkTreeIter* iter) { |
227 SkBitmap bitmap = table_model_->GetIcon(model_row); | 227 SkBitmap bitmap = table_model_->GetIcon(model_row); |
228 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); | 228 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); |
229 gtk_list_store_set( | 229 gtk_list_store_set( |
230 list_store_, iter, | 230 list_store_, iter, |
231 COL_FAVICON, pixbuf, | 231 COL_FAVICON, pixbuf, |
232 // Dunno why, even with COL_WEIGHT_SET to FALSE here, the weight still | 232 // Dunno why, even with COL_WEIGHT_SET to FALSE here, the weight still |
233 // has an effect. So we just set it to normal. | 233 // has an effect. So we just set it to normal. |
234 COL_WEIGHT, PANGO_WEIGHT_NORMAL, | 234 COL_WEIGHT, PANGO_WEIGHT_NORMAL, |
235 COL_WEIGHT_SET, TRUE, | 235 COL_WEIGHT_SET, TRUE, |
236 COL_TITLE, WideToUTF8(table_model_->GetText( | 236 COL_TITLE, UTF16ToUTF8(table_model_->GetText( |
237 model_row, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)).c_str(), | 237 model_row, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)).c_str(), |
238 COL_KEYWORD, WideToUTF8(table_model_->GetText( | 238 COL_KEYWORD, UTF16ToUTF8(table_model_->GetText( |
239 model_row, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)).c_str(), | 239 model_row, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)).c_str(), |
240 -1); | 240 -1); |
241 g_object_unref(pixbuf); | 241 g_object_unref(pixbuf); |
242 } | 242 } |
243 | 243 |
244 int KeywordEditorView::GetListStoreRowForModelRow(int model_row) const { | 244 int KeywordEditorView::GetListStoreRowForModelRow(int model_row) const { |
245 if (model_row < model_second_group_index_) | 245 if (model_row < model_second_group_index_) |
246 return model_row + kFirstGroupRowOffset; | 246 return model_row + kFirstGroupRowOffset; |
247 else | 247 else |
248 return model_row + kSecondGroupRowOffset; | 248 return model_row + kSecondGroupRowOffset; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 return; | 304 return; |
305 } | 305 } |
306 | 306 |
307 GtkTreeIter iter; | 307 GtkTreeIter iter; |
308 // First group title. | 308 // First group title. |
309 gtk_list_store_append(list_store_, &iter); | 309 gtk_list_store_append(list_store_, &iter); |
310 gtk_list_store_set( | 310 gtk_list_store_set( |
311 list_store_, &iter, | 311 list_store_, &iter, |
312 COL_WEIGHT, PANGO_WEIGHT_BOLD, | 312 COL_WEIGHT, PANGO_WEIGHT_BOLD, |
313 COL_WEIGHT_SET, TRUE, | 313 COL_WEIGHT_SET, TRUE, |
314 COL_TITLE, WideToUTF8(groups[0].title).c_str(), | 314 COL_TITLE, UTF16ToUTF8(groups[0].title).c_str(), |
315 COL_IS_HEADER, TRUE, | 315 COL_IS_HEADER, TRUE, |
316 -1); | 316 -1); |
317 // First group separator. | 317 // First group separator. |
318 gtk_list_store_append(list_store_, &iter); | 318 gtk_list_store_append(list_store_, &iter); |
319 gtk_list_store_set( | 319 gtk_list_store_set( |
320 list_store_, &iter, | 320 list_store_, &iter, |
321 COL_IS_HEADER, TRUE, | 321 COL_IS_HEADER, TRUE, |
322 COL_IS_SEPARATOR, TRUE, | 322 COL_IS_SEPARATOR, TRUE, |
323 -1); | 323 -1); |
324 | 324 |
325 // Blank row between groups. | 325 // Blank row between groups. |
326 gtk_list_store_append(list_store_, &iter); | 326 gtk_list_store_append(list_store_, &iter); |
327 gtk_list_store_set( | 327 gtk_list_store_set( |
328 list_store_, &iter, | 328 list_store_, &iter, |
329 COL_IS_HEADER, TRUE, | 329 COL_IS_HEADER, TRUE, |
330 -1); | 330 -1); |
331 // Second group title. | 331 // Second group title. |
332 gtk_list_store_append(list_store_, &iter); | 332 gtk_list_store_append(list_store_, &iter); |
333 gtk_list_store_set( | 333 gtk_list_store_set( |
334 list_store_, &iter, | 334 list_store_, &iter, |
335 COL_WEIGHT, PANGO_WEIGHT_BOLD, | 335 COL_WEIGHT, PANGO_WEIGHT_BOLD, |
336 COL_WEIGHT_SET, TRUE, | 336 COL_WEIGHT_SET, TRUE, |
337 COL_TITLE, WideToUTF8(groups[1].title).c_str(), | 337 COL_TITLE, UTF16ToUTF8(groups[1].title).c_str(), |
338 COL_IS_HEADER, TRUE, | 338 COL_IS_HEADER, TRUE, |
339 -1); | 339 -1); |
340 // Second group separator. | 340 // Second group separator. |
341 gtk_list_store_append(list_store_, &iter); | 341 gtk_list_store_append(list_store_, &iter); |
342 gtk_list_store_set( | 342 gtk_list_store_set( |
343 list_store_, &iter, | 343 list_store_, &iter, |
344 COL_IS_HEADER, TRUE, | 344 COL_IS_HEADER, TRUE, |
345 COL_IS_SEPARATOR, TRUE, | 345 COL_IS_SEPARATOR, TRUE, |
346 -1); | 346 -1); |
347 | 347 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 int model_row = editor->GetSelectedModelRow(); | 493 int model_row = editor->GetSelectedModelRow(); |
494 if (model_row == -1) { | 494 if (model_row == -1) { |
495 NOTREACHED(); | 495 NOTREACHED(); |
496 return; | 496 return; |
497 } | 497 } |
498 int new_index = editor->controller_->MakeDefaultTemplateURL(model_row); | 498 int new_index = editor->controller_->MakeDefaultTemplateURL(model_row); |
499 if (new_index > 0) { | 499 if (new_index > 0) { |
500 editor->SelectModelRow(new_index); | 500 editor->SelectModelRow(new_index); |
501 } | 501 } |
502 } | 502 } |
OLD | NEW |