Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3456)

Unified Diff: chrome/browser/ui/gtk/bookmark_tree_model.h

Issue 6099014: Move chrome/browser/gtk to chrome/browser/ui/gtk (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Move browser/gtk/ to browser/ui/gtk/, leave header stubs, update new header guards Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc ('k') | chrome/browser/ui/gtk/bookmark_tree_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/bookmark_tree_model.h
diff --git a/chrome/browser/ui/gtk/bookmark_tree_model.h b/chrome/browser/ui/gtk/bookmark_tree_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..ccb282dacf89ebe2bf4e003e40e5fbea547fe70e
--- /dev/null
+++ b/chrome/browser/ui/gtk/bookmark_tree_model.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_BOOKMARK_TREE_MODEL_H_
+#define CHROME_BROWSER_UI_GTK_BOOKMARK_TREE_MODEL_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+
+class BookmarkModel;
+class BookmarkNode;
+
+typedef struct _GtkCellRenderer GtkCellRenderer;
+typedef struct _GtkTreeIter GtkTreeIter;
+typedef struct _GtkTreeModel GtkTreeModel;
+typedef struct _GtkTreeStore GtkTreeStore;
+typedef struct _GtkTreeView GtkTreeView;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GtkWidget GtkWidget;
+
+namespace bookmark_utils {
+
+enum FolderTreeStoreColumns {
+ FOLDER_ICON,
+ FOLDER_NAME,
+ ITEM_ID,
+ IS_EDITABLE,
+ FOLDER_STORE_NUM_COLUMNS
+};
+
+// Make a tree store that has two columns: name and id.
+GtkTreeStore* MakeFolderTreeStore();
+
+// Copies the folders in the model's root node into a GtkTreeStore. We
+// want the user to be able to modify the tree of folders, but to be able to
+// click Cancel and discard their modifications. |selected_id| is the
+// node->id() of the BookmarkNode that should selected on
+// node->screen. |selected_iter| is an out value that points to the
+// node->representation of the node associated with |selected_id| in |store|.
+// |recursive| indicates whether to recurse into sub-directories (if false,
+// the tree store will effectively be a list). |only_folders| indicates whether
+// to include bookmarks in the tree, or to only show folders.
+void AddToTreeStore(BookmarkModel* model, int64 selected_id,
+ GtkTreeStore* store, GtkTreeIter* selected_iter);
+
+// As above, but inserts just the tree rooted at |node| as a child of |parent|.
+// If |parent| is NULL, add it at the top level.
+void AddToTreeStoreAt(const BookmarkNode* node, int64 selected_id,
+ GtkTreeStore* store, GtkTreeIter* selected_iter,
+ GtkTreeIter* parent);
+
+// Makes a tree view for the store. This will take ownership of |store| and the
+// returned widget has a floating reference.
+GtkWidget* MakeTreeViewForStore(GtkTreeStore* store);
+
+// A helper method for getting pointer back to the GtkCellRendererText used for
+// the folder names.
+GtkCellRenderer* GetCellRendererText(GtkTreeView* tree_view);
+
+// Commits changes to a GtkTreeStore built from BuildTreeStoreFrom() back
+// into the BookmarkModel it was generated from. Returns the BookmarkNode that
+// represented by |selected|.
+const BookmarkNode* CommitTreeStoreDifferencesBetween(
+ BookmarkModel* model, GtkTreeStore* tree_store,
+ GtkTreeIter* selected);
+
+// Returns the id field of the row pointed to by |iter|.
+int64 GetIdFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter);
+
+// Returns the title field in utf8 of the row pointed to by |iter|.
+string16 GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter);
+
+} // namespace bookmark_utils
+
+#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_TREE_MODEL_H_
« no previous file with comments | « chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc ('k') | chrome/browser/ui/gtk/bookmark_tree_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698