| 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_EDITOR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 FRIEND_TEST(BookmarkEditorGtkTest, EditURLKeepsPosition); | 26 FRIEND_TEST(BookmarkEditorGtkTest, EditURLKeepsPosition); |
| 27 FRIEND_TEST(BookmarkEditorGtkTest, ModelsMatch); | 27 FRIEND_TEST(BookmarkEditorGtkTest, ModelsMatch); |
| 28 FRIEND_TEST(BookmarkEditorGtkTest, MoveToNewParent); | 28 FRIEND_TEST(BookmarkEditorGtkTest, MoveToNewParent); |
| 29 FRIEND_TEST(BookmarkEditorGtkTest, NewURL); | 29 FRIEND_TEST(BookmarkEditorGtkTest, NewURL); |
| 30 FRIEND_TEST(BookmarkEditorGtkTest, ChangeURLNoTree); | 30 FRIEND_TEST(BookmarkEditorGtkTest, ChangeURLNoTree); |
| 31 FRIEND_TEST(BookmarkEditorGtkTest, ChangeTitleNoTree); | 31 FRIEND_TEST(BookmarkEditorGtkTest, ChangeTitleNoTree); |
| 32 public: | 32 public: |
| 33 BookmarkEditorGtk(GtkWindow* window, | 33 BookmarkEditorGtk(GtkWindow* window, |
| 34 Profile* profile, | 34 Profile* profile, |
| 35 const BookmarkNode* parent, | 35 const BookmarkNode* parent, |
| 36 const BookmarkNode* node, | 36 const EditDetails& details, |
| 37 BookmarkEditor::Configuration configuration, | 37 BookmarkEditor::Configuration configuration, |
| 38 BookmarkEditor::Handler* handler); | 38 BookmarkEditor::Handler* handler); |
| 39 | 39 |
| 40 virtual ~BookmarkEditorGtk(); | 40 virtual ~BookmarkEditorGtk(); |
| 41 | 41 |
| 42 void Show(); | 42 void Show(); |
| 43 void Close(); | 43 void Close(); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 void Init(GtkWindow* parent_window); | 46 void Init(GtkWindow* parent_window); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void ApplyEdits(); | 83 void ApplyEdits(); |
| 84 | 84 |
| 85 // Applies the edits done by the user. |selected_parent| gives the parent of | 85 // Applies the edits done by the user. |selected_parent| gives the parent of |
| 86 // the URL being edited. | 86 // the URL being edited. |
| 87 void ApplyEdits(GtkTreeIter* selected_parent); | 87 void ApplyEdits(GtkTreeIter* selected_parent); |
| 88 | 88 |
| 89 // Adds a new group parented on |parent| and sets |child| to point to this | 89 // Adds a new group parented on |parent| and sets |child| to point to this |
| 90 // new group. | 90 // new group. |
| 91 void AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child); | 91 void AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child); |
| 92 | 92 |
| 93 // Returns true if editing a folder. | |
| 94 bool IsEditingFolder() const; | |
| 95 | |
| 96 static void OnSelectionChanged(GtkTreeSelection* treeselection, | 93 static void OnSelectionChanged(GtkTreeSelection* treeselection, |
| 97 BookmarkEditorGtk* dialog); | 94 BookmarkEditorGtk* dialog); |
| 98 | 95 |
| 99 static void OnResponse(GtkDialog* dialog, int response_id, | 96 static void OnResponse(GtkDialog* dialog, int response_id, |
| 100 BookmarkEditorGtk* window); | 97 BookmarkEditorGtk* window); |
| 101 | 98 |
| 102 static gboolean OnWindowDeleteEvent(GtkWidget* widget, | 99 static gboolean OnWindowDeleteEvent(GtkWidget* widget, |
| 103 GdkEvent* event, | 100 GdkEvent* event, |
| 104 BookmarkEditorGtk* dialog); | 101 BookmarkEditorGtk* dialog); |
| 105 | 102 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 125 // that we can modify as much as we want and still discard when the user | 122 // that we can modify as much as we want and still discard when the user |
| 126 // clicks Cancel. | 123 // clicks Cancel. |
| 127 GtkTreeStore* tree_store_; | 124 GtkTreeStore* tree_store_; |
| 128 | 125 |
| 129 // TODO(erg): BookmarkEditorView has an EditorTreeModel object here; convert | 126 // TODO(erg): BookmarkEditorView has an EditorTreeModel object here; convert |
| 130 // that into a GObject that implements the interface GtkTreeModel. | 127 // that into a GObject that implements the interface GtkTreeModel. |
| 131 | 128 |
| 132 // Initial parent to select. Is only used if node_ is NULL. | 129 // Initial parent to select. Is only used if node_ is NULL. |
| 133 const BookmarkNode* parent_; | 130 const BookmarkNode* parent_; |
| 134 | 131 |
| 135 // Node being edited. Is NULL if creating a new node. | 132 // Details about the node we're editing. |
| 136 const BookmarkNode* node_; | 133 const EditDetails details_; |
| 137 | 134 |
| 138 // Mode used to create nodes from. | 135 // Mode used to create nodes from. |
| 139 BookmarkModel* bb_model_; | 136 BookmarkModel* bb_model_; |
| 140 | 137 |
| 141 // If true, we're running the menu for the bookmark bar or other bookmarks | 138 // If true, we're running the menu for the bookmark bar or other bookmarks |
| 142 // nodes. | 139 // nodes. |
| 143 bool running_menu_for_root_; | 140 bool running_menu_for_root_; |
| 144 | 141 |
| 145 // Is the tree shown? | 142 // Is the tree shown? |
| 146 bool show_tree_; | 143 bool show_tree_; |
| 147 | 144 |
| 148 scoped_ptr<BookmarkEditor::Handler> handler_; | 145 scoped_ptr<BookmarkEditor::Handler> handler_; |
| 149 | 146 |
| 150 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk); | 147 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk); |
| 151 }; | 148 }; |
| 152 | 149 |
| 153 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 150 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
| OLD | NEW |