| 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 #include "base/basictypes.h" |
| 10 | 10 |
| 11 class BookmarkModel; | 11 class BookmarkModel; |
| 12 class BookmarkNode; | 12 class BookmarkNode; |
| 13 | 13 |
| 14 typedef struct _GtkTreeIter GtkTreeIter; | 14 typedef struct _GtkTreeIter GtkTreeIter; |
| 15 typedef struct _GtkTreeModel GtkTreeModel; | 15 typedef struct _GtkTreeModel GtkTreeModel; |
| 16 typedef struct _GtkTreeStore GtkTreeStore; | 16 typedef struct _GtkTreeStore GtkTreeStore; |
| 17 typedef struct _GdkPixbuf GdkPixbuf; | 17 typedef struct _GdkPixbuf GdkPixbuf; |
| 18 typedef struct _GtkWidget GtkWidget; |
| 18 | 19 |
| 19 namespace bookmark_utils { | 20 namespace bookmark_utils { |
| 20 | 21 |
| 21 enum FolderTreeStoreColumns { | 22 enum FolderTreeStoreColumns { |
| 22 FOLDER_ICON, | 23 FOLDER_ICON, |
| 23 FOLDER_NAME, | 24 FOLDER_NAME, |
| 24 ITEM_ID, | 25 ITEM_ID, |
| 25 FOLDER_STORE_NUM_COLUMNS | 26 FOLDER_STORE_NUM_COLUMNS |
| 26 }; | 27 }; |
| 27 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 // to include bookmarks in the tree, or to only show folders. | 40 // to include bookmarks in the tree, or to only show folders. |
| 40 void AddToTreeStore(BookmarkModel* model, int64 selected_id, | 41 void AddToTreeStore(BookmarkModel* model, int64 selected_id, |
| 41 GtkTreeStore* store, GtkTreeIter* selected_iter); | 42 GtkTreeStore* store, GtkTreeIter* selected_iter); |
| 42 | 43 |
| 43 // As above, but inserts just the tree rooted at |node| as a child of |parent|. | 44 // As above, but inserts just the tree rooted at |node| as a child of |parent|. |
| 44 // If |parent| is NULL, add it at the top level. | 45 // If |parent| is NULL, add it at the top level. |
| 45 void AddToTreeStoreAt(const BookmarkNode* node, int64 selected_id, | 46 void AddToTreeStoreAt(const BookmarkNode* node, int64 selected_id, |
| 46 GtkTreeStore* store, GtkTreeIter* selected_iter, | 47 GtkTreeStore* store, GtkTreeIter* selected_iter, |
| 47 GtkTreeIter* parent); | 48 GtkTreeIter* parent); |
| 48 | 49 |
| 50 // Makes a tree view for the store. This will take ownership of |store| and the |
| 51 // returned widget has a floating reference. |
| 52 GtkWidget* MakeTreeViewForStore(GtkTreeStore* store); |
| 53 |
| 49 // Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back | 54 // Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back |
| 50 // into the BookmarkModel it was generated from. Returns the BookmarkNode that | 55 // into the BookmarkModel it was generated from. Returns the BookmarkNode that |
| 51 // represented by |selected|. | 56 // represented by |selected|. |
| 52 const BookmarkNode* CommitTreeStoreDifferencesBetween( | 57 const BookmarkNode* CommitTreeStoreDifferencesBetween( |
| 53 BookmarkModel* model, GtkTreeStore* tree_store, | 58 BookmarkModel* model, GtkTreeStore* tree_store, |
| 54 GtkTreeIter* selected); | 59 GtkTreeIter* selected); |
| 55 | 60 |
| 56 // Returns the id field of the row pointed to by |iter|. | 61 // Returns the id field of the row pointed to by |iter|. |
| 57 int64 GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); | 62 int64 GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); |
| 58 | 63 |
| 59 // Returns the title field of the row pointed to by |iter|. | 64 // Returns the title field of the row pointed to by |iter|. |
| 60 std::wstring GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); | 65 std::wstring GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter); |
| 61 | 66 |
| 62 } // namespace bookmark_utils | 67 } // namespace bookmark_utils |
| 63 | 68 |
| 64 #endif // CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ | 69 #endif // CHROME_BROWSER_GTK_BOOKMARK_TREE_MODEL_H_ |
| OLD | NEW |