| 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 #ifndef CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ |
| 6 #define CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/basictypes.h" |
| 9 | 10 |
| 10 class BookmarkModel; | 11 class BookmarkModel; |
| 11 class BookmarkNode; | 12 class BookmarkNode; |
| 12 | 13 |
| 13 typedef struct _GtkTreeIter GtkTreeIter; | 14 typedef struct _GtkTreeIter GtkTreeIter; |
| 14 typedef struct _GtkTreeModel GtkTreeModel; | 15 typedef struct _GtkTreeModel GtkTreeModel; |
| 15 typedef struct _GtkTreeStore GtkTreeStore; | 16 typedef struct _GtkTreeStore GtkTreeStore; |
| 16 typedef struct _GdkPixbuf GdkPixbuf; | 17 typedef struct _GdkPixbuf GdkPixbuf; |
| 17 | 18 |
| 18 namespace bookmark_utils { | 19 namespace bookmark_utils { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 | 30 |
| 30 // Copies the folders in the model's root node into a GtkTreeStore. We | 31 // Copies the folders in the model's root node into a GtkTreeStore. We |
| 31 // want the user to be able to modify the tree of folders, but to be able to | 32 // want the user to be able to modify the tree of folders, but to be able to |
| 32 // click Cancel and discard their modifications. |selected_id| is the | 33 // click Cancel and discard their modifications. |selected_id| is the |
| 33 // node->id() of the BookmarkNode that should selected on | 34 // node->id() of the BookmarkNode that should selected on |
| 34 // node->screen. |selected_iter| is an out value that points to the | 35 // node->screen. |selected_iter| is an out value that points to the |
| 35 // node->representation of the node associated with |selected_id| in |store|. | 36 // node->representation of the node associated with |selected_id| in |store|. |
| 36 // |recursive| indicates whether to recurse into sub-directories (if false, | 37 // |recursive| indicates whether to recurse into sub-directories (if false, |
| 37 // the tree store will effectively be a list). |only_folders| indicates whether | 38 // the tree store will effectively be a list). |only_folders| indicates whether |
| 38 // to include bookmarks in the tree, or to only show folders. | 39 // to include bookmarks in the tree, or to only show folders. |
| 39 void AddToTreeStore(BookmarkModel* model, int selected_id, | 40 void AddToTreeStore(BookmarkModel* model, int64 selected_id, |
| 40 GtkTreeStore* store, GtkTreeIter* selected_iter); | 41 GtkTreeStore* store, GtkTreeIter* selected_iter); |
| 41 | 42 |
| 42 // As above, but inserts just the tree rooted at |node| as a child of |parent|. | 43 // As above, but inserts just the tree rooted at |node| as a child of |parent|. |
| 43 // If |parent| is NULL, add it at the top level. | 44 // If |parent| is NULL, add it at the top level. |
| 44 void AddToTreeStoreAt(const BookmarkNode* node, int selected_id, | 45 void AddToTreeStoreAt(const BookmarkNode* node, int64 selected_id, |
| 45 GtkTreeStore* store, GtkTreeIter* selected_iter, | 46 GtkTreeStore* store, GtkTreeIter* selected_iter, |
| 46 GtkTreeIter* parent); | 47 GtkTreeIter* parent); |
| 47 | 48 |
| 48 // Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back | 49 // Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back |
| 49 // into the BookmarkModel it was generated from. Returns the BookmarkNode that | 50 // into the BookmarkModel it was generated from. Returns the BookmarkNode that |
| 50 // represented by |selected|. | 51 // represented by |selected|. |
| 51 const BookmarkNode* CommitTreeStoreDifferencesBetween( | 52 const BookmarkNode* CommitTreeStoreDifferencesBetween( |
| 52 BookmarkModel* model, GtkTreeStore* tree_store, | 53 BookmarkModel* model, GtkTreeStore* tree_store, |
| 53 GtkTreeIter* selected); | 54 GtkTreeIter* selected); |
| 54 | 55 |
| 55 // Returns the id field of the row pointed to by |iter|. | 56 // Returns the id field of the row pointed to by |iter|. |
| 56 int GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); | 57 int64 GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); |
| 57 | 58 |
| 58 // Returns the title field of the row pointed to by |iter|. | 59 // Returns the title field of the row pointed to by |iter|. |
| 59 std::wstring GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); | 60 std::wstring GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); |
| 60 | 61 |
| 61 } // namespace bookmark_utils | 62 } // namespace bookmark_utils |
| 62 | 63 |
| 63 #endif // CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ | 64 #endif // CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ |
| OLD | NEW |