summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/bookmark_editor_gtk.h
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 00:35:09 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 00:35:09 +0000
commit140aea057fa118579380f685f362f2533862b03f (patch)
tree627c15d8adda34f2c602589e0bac815bbdc7d4d9 /chrome/browser/gtk/bookmark_editor_gtk.h
parent57e3074163dc21bc3bc8cd37dc05f191532d836a (diff)
downloadchromium_src-140aea057fa118579380f685f362f2533862b03f.zip
chromium_src-140aea057fa118579380f685f362f2533862b03f.tar.gz
chromium_src-140aea057fa118579380f685f362f2533862b03f.tar.bz2
Port the folder selector portion of the BookmarkEditor to GTK.
Mirrors the BookmarkEditorView method, where the contents of BookmarkModel are copied to a temporary model so changes can be discarded if the user hits Cancel. In the GTK version, we copy not into another BookmarkModel, but into a GtkTreeStore, which serves as a model to the GtkTreeView on screen. Also ports the unit tests. http://crbug.com/11250 Review URL: http://codereview.chromium.org/99361 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15257 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_editor_gtk.h')
-rw-r--r--chrome/browser/gtk/bookmark_editor_gtk.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/chrome/browser/gtk/bookmark_editor_gtk.h b/chrome/browser/gtk/bookmark_editor_gtk.h
index 1dbdbe8..b6669a0 100644
--- a/chrome/browser/gtk/bookmark_editor_gtk.h
+++ b/chrome/browser/gtk/bookmark_editor_gtk.h
@@ -13,6 +13,16 @@
// GTK version of the bookmark editor dialog.
class BookmarkEditorGtk : public BookmarkEditor,
public BookmarkModelObserver {
+ FRIEND_TEST(BookmarkEditorGtkTest, ChangeParent);
+ FRIEND_TEST(BookmarkEditorGtkTest, ChangeParentAndURL);
+ FRIEND_TEST(BookmarkEditorGtkTest, ChangeURLToExistingURL);
+ FRIEND_TEST(BookmarkEditorGtkTest, EditTitleKeepsPosition);
+ FRIEND_TEST(BookmarkEditorGtkTest, EditURLKeepsPosition);
+ FRIEND_TEST(BookmarkEditorGtkTest, ModelsMatch);
+ FRIEND_TEST(BookmarkEditorGtkTest, MoveToNewParent);
+ FRIEND_TEST(BookmarkEditorGtkTest, NewURL);
+ FRIEND_TEST(BookmarkEditorGtkTest, ChangeURLNoTree);
+ FRIEND_TEST(BookmarkEditorGtkTest, ChangeTitleNoTree);
public:
BookmarkEditorGtk(GtkWindow* window,
Profile* profile,
@@ -60,8 +70,20 @@ class BookmarkEditorGtk : public BookmarkEditor,
// Returns the title the user has input.
std::wstring GetInputTitle() const;
+ // Invokes ApplyEdits with the selected node.
+ //
+ // TODO(erg): This was copied from the windows version. Both should be
+ // cleaned up so that we don't overload ApplyEdits.
void ApplyEdits();
+ // Applies the edits done by the user. |selected_parent| gives the parent of
+ // the URL being edited.
+ void ApplyEdits(GtkTreeIter* selected_parent);
+
+ // Adds a new group parented on |parent| and sets |child| to point to this
+ // new group.
+ void AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child);
+
static void OnResponse(GtkDialog* dialog, int response_id,
BookmarkEditorGtk* window);
@@ -72,6 +94,8 @@ class BookmarkEditorGtk : public BookmarkEditor,
static void OnWindowDestroy(GtkWidget* widget, BookmarkEditorGtk* dialog);
static void OnEntryChanged(GtkEditable* entry, BookmarkEditorGtk* dialog);
+ static void OnNewFolderClicked(GtkWidget* button, BookmarkEditorGtk* dialog);
+
// Profile the entry is from.
Profile* profile_;
@@ -81,7 +105,16 @@ class BookmarkEditorGtk : public BookmarkEditor,
GtkWidget* url_entry_;
GtkWidget* close_button_;
GtkWidget* ok_button_;
- GtkWidget* folder_tree_;
+ GtkWidget* new_folder_button_;
+ GtkWidget* tree_view_;
+
+ // Helper object that manages the currently selected item in |tree_view_|.
+ GtkTreeSelection* tree_selection_;
+
+ // Our local copy of the bookmark data that we make from the BookmarkModel
+ // that we can modify as much as we want and still discard when the user
+ // clicks Cancel.
+ GtkTreeStore* tree_store_;
// TODO(erg): BookmarkEditorView has an EditorTreeModel object here; convert
// that into a GObject that implements the interface GtkTreeModel.