| 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/bookmark_tree_model.h" | 5 #include "chrome/browser/gtk/bookmark_tree_model.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 12 #include "chrome/browser/gtk/bookmark_utils_gtk.h" | 12 #include "chrome/browser/gtk/bookmark_utils_gtk.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node, | 16 void AddSingleNodeToTreeStore(GtkTreeStore* store, const BookmarkNode* node, |
| 17 GtkTreeIter *iter, GtkTreeIter* parent) { | 17 GtkTreeIter *iter, GtkTreeIter* parent) { |
| 18 gtk_tree_store_append(store, iter, parent); | 18 gtk_tree_store_append(store, iter, parent); |
| 19 // TODO(estade): we should show the folder open icon when it's expanded. | 19 // It would be easy to show a different icon when the folder is open (as they |
| 20 // do on Windows, for example), using pixbuf-expander-closed and |
| 21 // pixbuf-expander-open. Unfortunately there is no GTK_STOCK_OPEN_DIRECTORY |
| 22 // (and indeed, Nautilus does not render an expanded directory any |
| 23 // differently). |
| 20 gtk_tree_store_set(store, iter, | 24 gtk_tree_store_set(store, iter, |
| 21 bookmark_utils::FOLDER_ICON, | 25 bookmark_utils::FOLDER_ICON, |
| 22 bookmark_utils::GetFolderIcon(), | 26 bookmark_utils::GetFolderIcon(true), |
| 23 bookmark_utils::FOLDER_NAME, | 27 bookmark_utils::FOLDER_NAME, |
| 24 WideToUTF8(node->GetTitle()).c_str(), | 28 WideToUTF8(node->GetTitle()).c_str(), |
| 25 bookmark_utils::ITEM_ID, node->id(), | 29 bookmark_utils::ITEM_ID, node->id(), |
| 26 -1); | 30 -1); |
| 27 } | 31 } |
| 28 | 32 |
| 29 // Helper function for CommitTreeStoreDifferencesBetween() which recursively | 33 // Helper function for CommitTreeStoreDifferencesBetween() which recursively |
| 30 // merges changes back from a GtkTreeStore into a tree of BookmarkNodes. This | 34 // merges changes back from a GtkTreeStore into a tree of BookmarkNodes. This |
| 31 // function only works on non-root nodes; our caller handles that special case. | 35 // function only works on non-root nodes; our caller handles that special case. |
| 32 void RecursiveResolve(BookmarkModel* bb_model, const BookmarkNode* bb_node, | 36 void RecursiveResolve(BookmarkModel* bb_model, const BookmarkNode* bb_node, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ret_val = UTF8ToWide(utf8str); | 193 ret_val = UTF8ToWide(utf8str); |
| 190 g_value_unset(&value); | 194 g_value_unset(&value); |
| 191 } else { | 195 } else { |
| 192 NOTREACHED() << "Impossible type mismatch"; | 196 NOTREACHED() << "Impossible type mismatch"; |
| 193 } | 197 } |
| 194 | 198 |
| 195 return ret_val; | 199 return ret_val; |
| 196 } | 200 } |
| 197 | 201 |
| 198 } // namespace bookmark_utils | 202 } // namespace bookmark_utils |
| OLD | NEW |