OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/gtk_tree.h" | 5 #include "chrome/browser/ui/gtk/gtk_tree.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 9 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 -1); | 378 -1); |
379 return node; | 379 return node; |
380 } | 380 } |
381 | 381 |
382 void TreeAdapter::FillRow(GtkTreeIter* iter, ui::TreeModelNode* node) { | 382 void TreeAdapter::FillRow(GtkTreeIter* iter, ui::TreeModelNode* node) { |
383 GdkPixbuf* pixbuf = NULL; | 383 GdkPixbuf* pixbuf = NULL; |
384 int icon_index = tree_model_->GetIconIndex(node); | 384 int icon_index = tree_model_->GetIconIndex(node); |
385 if (icon_index >= 0 && icon_index < static_cast<int>(pixbufs_.size())) | 385 if (icon_index >= 0 && icon_index < static_cast<int>(pixbufs_.size())) |
386 pixbuf = pixbufs_[icon_index]; | 386 pixbuf = pixbufs_[icon_index]; |
387 else | 387 else |
388 pixbuf = GtkThemeService::GetFolderIcon(true)->ToGdkPixbuf(); | 388 pixbuf = GtkThemeService::GetFolderIcon(true).ToGdkPixbuf(); |
389 gtk_tree_store_set(tree_store_, iter, | 389 gtk_tree_store_set(tree_store_, iter, |
390 COL_ICON, pixbuf, | 390 COL_ICON, pixbuf, |
391 COL_TITLE, UTF16ToUTF8(node->GetTitle()).c_str(), | 391 COL_TITLE, UTF16ToUTF8(node->GetTitle()).c_str(), |
392 COL_NODE_PTR, node, | 392 COL_NODE_PTR, node, |
393 -1); | 393 -1); |
394 } | 394 } |
395 | 395 |
396 void TreeAdapter::Fill(GtkTreeIter* parent_iter, | 396 void TreeAdapter::Fill(GtkTreeIter* parent_iter, |
397 ui::TreeModelNode* parent_node) { | 397 ui::TreeModelNode* parent_node) { |
398 if (parent_iter) | 398 if (parent_iter) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 void TreeAdapter::TreeNodeChanged(ui::TreeModel* model, | 468 void TreeAdapter::TreeNodeChanged(ui::TreeModel* model, |
469 ui::TreeModelNode* node) { | 469 ui::TreeModelNode* node) { |
470 delegate_->OnAnyModelUpdateStart(); | 470 delegate_->OnAnyModelUpdateStart(); |
471 GtkTreeIter iter; | 471 GtkTreeIter iter; |
472 if (GetTreeIter(node, &iter)) | 472 if (GetTreeIter(node, &iter)) |
473 FillRow(&iter, node); | 473 FillRow(&iter, node); |
474 delegate_->OnAnyModelUpdate(); | 474 delegate_->OnAnyModelUpdate(); |
475 } | 475 } |
476 | 476 |
477 } // namespace gtk_tree | 477 } // namespace gtk_tree |
OLD | NEW |