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

Unified Diff: chrome/browser/gtk/keyword_editor_view.h

Issue 147243: Finish the gtk search engine manager. (Closed)
Patch Set: add period Created 11 years, 6 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 | « no previous file | chrome/browser/gtk/keyword_editor_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/keyword_editor_view.h
diff --git a/chrome/browser/gtk/keyword_editor_view.h b/chrome/browser/gtk/keyword_editor_view.h
index bac83115d314ba8835517ba9333aaabcafc72404..0ee4fee571839fab14cf403dc2fe375f3e23b591 100644
--- a/chrome/browser/gtk/keyword_editor_view.h
+++ b/chrome/browser/gtk/keyword_editor_view.h
@@ -7,13 +7,17 @@
#include <gtk/gtk.h>
+#include "app/table_model_observer.h"
#include "base/basictypes.h"
#include "chrome/browser/search_engines/edit_search_engine_controller.h"
#include "chrome/browser/search_engines/template_url_model.h"
+class KeywordEditorController;
class Profile;
+class TemplateURLTableModel;
-class KeywordEditorView : public TemplateURLModelObserver,
+class KeywordEditorView : public TableModelObserver,
+ public TemplateURLModelObserver,
public EditSearchEngineControllerDelegate {
public:
virtual ~KeywordEditorView();
@@ -33,6 +37,35 @@ class KeywordEditorView : public TemplateURLModelObserver,
// Enable buttons based on selection state.
void EnableControls();
+ // Set the column values for |row| of |table_model_| in the |list_store_| at
+ // |iter|.
+ void SetColumnValues(int row, GtkTreeIter* iter);
+
+ // Get the row number in the GtkListStore corresponding to |model_row|.
+ int GetListStoreRowForModelRow(int model_row) const;
+
+ // Get the row number in the TemplateURLTableModel corresponding to |path|.
+ int GetModelRowForPath(GtkTreePath* path) const;
+
+ // Get the row number in the TemplateURLTableModel corresponding to |iter|.
+ int GetModelRowForIter(GtkTreeIter* iter) const;
+
+ // Get the row number in the TemplateURLTableModel of the current selection,
+ // or -1 if no row is selected.
+ int GetSelectedModelRow() const;
+
+ // Select the row in the |tree_| corresponding to |model_row|.
+ void SelectModelRow(int model_row);
+
+ // Add the values from |row| of |table_model_|.
+ void AddNodeToList(int row);
+
+ // TableModelObserver implementation.
+ virtual void OnModelChanged();
+ virtual void OnItemsChanged(int start, int length);
+ virtual void OnItemsAdded(int start, int length);
+ virtual void OnItemsRemoved(int start, int length);
+
// TemplateURLModelObserver notification.
virtual void OnTemplateURLModelChanged();
@@ -43,11 +76,28 @@ class KeywordEditorView : public TemplateURLModelObserver,
static void OnResponse(GtkDialog* dialog, int response_id,
KeywordEditorView* window);
+ // Callback checking whether a row should be drawn as a separator.
+ static gboolean OnCheckRowIsSeparator(GtkTreeModel* model,
+ GtkTreeIter* iter,
+ gpointer user_data);
+
+ // Callback checking whether a row may be selected. We use some rows in the
+ // table as headers/separators for the groups, which should not be selectable.
+ static gboolean OnSelectionFilter(GtkTreeSelection* selection,
+ GtkTreeModel* model,
+ GtkTreePath* path,
+ gboolean path_currently_selected,
+ gpointer user_data);
+
// Callback for when user selects something.
static void OnSelectionChanged(GtkTreeSelection *selection,
KeywordEditorView* editor);
- // Callbacks for buttons modifying the table.
+ // Callbacks for user actions modifying the table.
+ static void OnRowActivated(GtkTreeView* tree_view,
+ GtkTreePath* path,
+ GtkTreeViewColumn* column,
+ KeywordEditorView* editor);
static void OnAddButtonClicked(GtkButton* button,
KeywordEditorView* editor);
static void OnEditButtonClicked(GtkButton* button,
@@ -74,9 +124,15 @@ class KeywordEditorView : public TemplateURLModelObserver,
// The profile.
Profile* profile_;
- // Model containing TemplateURLs. We listen for changes on this and propagate
- // them to the table model.
- TemplateURLModel* url_model_;
+ scoped_ptr<KeywordEditorController> controller_;
+
+ TemplateURLTableModel* table_model_;
+
+ // We store our own index of the start of the second group within the model,
+ // as when OnItemsRemoved is called the value in the model is already updated
+ // but we need the old value to know which row to remove from the
+ // |list_store_|.
+ int model_second_group_index_;
DISALLOW_COPY_AND_ASSIGN(KeywordEditorView);
};
« no previous file with comments | « no previous file | chrome/browser/gtk/keyword_editor_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698