| OLD | NEW |
| 1 // Copyright (c) 2011 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/theme_service_gtk.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
| 11 #include "ui/base/models/table_model.h" | 11 #include "ui/base/models/table_model.h" |
| 12 #include "ui/gfx/gtk_util.h" | 12 #include "ui/gfx/gtk_util.h" |
| 13 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
| 14 | 14 |
| 15 namespace gtk_tree { | 15 namespace gtk_tree { |
| 16 | 16 |
| 17 gint GetRowNumForPath(GtkTreePath* path) { | 17 gint GetRowNumForPath(GtkTreePath* path) { |
| 18 gint* indices = gtk_tree_path_get_indices(path); | 18 gint* indices = gtk_tree_path_get_indices(path); |
| 19 if (!indices) { | 19 if (!indices) { |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 -1); | 377 -1); |
| 378 return node; | 378 return node; |
| 379 } | 379 } |
| 380 | 380 |
| 381 void TreeAdapter::FillRow(GtkTreeIter* iter, ui::TreeModelNode* node) { | 381 void TreeAdapter::FillRow(GtkTreeIter* iter, ui::TreeModelNode* node) { |
| 382 GdkPixbuf* pixbuf = NULL; | 382 GdkPixbuf* pixbuf = NULL; |
| 383 int icon_index = tree_model_->GetIconIndex(node); | 383 int icon_index = tree_model_->GetIconIndex(node); |
| 384 if (icon_index >= 0 && icon_index < static_cast<int>(pixbufs_.size())) | 384 if (icon_index >= 0 && icon_index < static_cast<int>(pixbufs_.size())) |
| 385 pixbuf = pixbufs_[icon_index]; | 385 pixbuf = pixbufs_[icon_index]; |
| 386 else | 386 else |
| 387 pixbuf = GtkThemeService::GetFolderIcon(true)->ToGdkPixbuf(); | 387 pixbuf = ThemeServiceGtk::GetFolderIcon(true)->ToGdkPixbuf(); |
| 388 gtk_tree_store_set(tree_store_, iter, | 388 gtk_tree_store_set(tree_store_, iter, |
| 389 COL_ICON, pixbuf, | 389 COL_ICON, pixbuf, |
| 390 COL_TITLE, UTF16ToUTF8(node->GetTitle()).c_str(), | 390 COL_TITLE, UTF16ToUTF8(node->GetTitle()).c_str(), |
| 391 COL_NODE_PTR, node, | 391 COL_NODE_PTR, node, |
| 392 -1); | 392 -1); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void TreeAdapter::Fill(GtkTreeIter* parent_iter, | 395 void TreeAdapter::Fill(GtkTreeIter* parent_iter, |
| 396 ui::TreeModelNode* parent_node) { | 396 ui::TreeModelNode* parent_node) { |
| 397 if (parent_iter) | 397 if (parent_iter) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 void TreeAdapter::TreeNodeChanged(ui::TreeModel* model, | 467 void TreeAdapter::TreeNodeChanged(ui::TreeModel* model, |
| 468 ui::TreeModelNode* node) { | 468 ui::TreeModelNode* node) { |
| 469 delegate_->OnAnyModelUpdateStart(); | 469 delegate_->OnAnyModelUpdateStart(); |
| 470 GtkTreeIter iter; | 470 GtkTreeIter iter; |
| 471 if (GetTreeIter(node, &iter)) | 471 if (GetTreeIter(node, &iter)) |
| 472 FillRow(&iter, node); | 472 FillRow(&iter, node); |
| 473 delegate_->OnAnyModelUpdate(); | 473 delegate_->OnAnyModelUpdate(); |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace gtk_tree | 476 } // namespace gtk_tree |
| OLD | NEW |