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

Side by Side Diff: chrome/browser/gtk/task_manager_gtk.h

Issue 196040: Gtk: Allow all columns in task manager to be sortable. (Closed)
Patch Set: Delete dead code Created 11 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/gtk/task_manager_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_TASK_MANAGER_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_
6 #define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ 6 #define CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "chrome/browser/task_manager.h" 12 #include "chrome/browser/task_manager.h"
13 #include "grit/generated_resources.h"
13 14
14 class TaskManagerGtk : public TaskManagerModelObserver { 15 class TaskManagerGtk : public TaskManagerModelObserver {
15 public: 16 public:
16 TaskManagerGtk(); 17 TaskManagerGtk();
17 virtual ~TaskManagerGtk(); 18 virtual ~TaskManagerGtk();
18 19
19 // TaskManagerModelObserver 20 // TaskManagerModelObserver
20 virtual void OnModelChanged(); 21 virtual void OnModelChanged();
21 virtual void OnItemsChanged(int start, int length); 22 virtual void OnItemsChanged(int start, int length);
22 virtual void OnItemsAdded(int start, int length); 23 virtual void OnItemsAdded(int start, int length);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 // Opens the context menu used to select the task manager columns. 59 // Opens the context menu used to select the task manager columns.
59 void ShowContextMenu(); 60 void ShowContextMenu();
60 61
61 // Activates the tab associated with the focused row. 62 // Activates the tab associated with the focused row.
62 void ActivateFocusedTab(); 63 void ActivateFocusedTab();
63 64
64 // Opens about:memory in a new foreground tab. 65 // Opens about:memory in a new foreground tab.
65 void OnLinkActivated(); 66 void OnLinkActivated();
66 67
68 // Compare implementation used for sorting columns.
69 gint CompareImpl(GtkTreeModel* tree_model, GtkTreeIter* a,
70 GtkTreeIter* b, int id);
71
67 // response signal handler that notifies us of dialog responses. 72 // response signal handler that notifies us of dialog responses.
68 static void OnResponse(GtkDialog* dialog, gint response_id, 73 static void OnResponse(GtkDialog* dialog, gint response_id,
69 TaskManagerGtk* task_manager); 74 TaskManagerGtk* task_manager);
70 75
71 // realize signal handler to set the page column's initial size. 76 // realize signal handler to set the page column's initial size.
72 static void OnTreeViewRealize(GtkTreeView* treeview, 77 static void OnTreeViewRealize(GtkTreeView* treeview,
73 TaskManagerGtk* task_manager); 78 TaskManagerGtk* task_manager);
74 79
75 // changed signal handler that is sent when the treeview selection changes. 80 // changed signal handler that is sent when the treeview selection changes.
76 static void OnSelectionChanged(GtkTreeSelection* selection, 81 static void OnSelectionChanged(GtkTreeSelection* selection,
77 TaskManagerGtk* task_manager); 82 TaskManagerGtk* task_manager);
78 83
79 // button-press-event handler that activates a process on double-click. 84 // button-press-event handler that activates a process on double-click.
80 static gboolean OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event, 85 static gboolean OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event,
81 TaskManagerGtk* task_manager); 86 TaskManagerGtk* task_manager);
82 87
83 // button-release-event handler that opens the right-click context menu. 88 // button-release-event handler that opens the right-click context menu.
84 static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event, 89 static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event,
85 TaskManagerGtk* task_manager); 90 TaskManagerGtk* task_manager);
86 91
87 // Handles an accelerator being pressed. 92 // Handles an accelerator being pressed.
88 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, 93 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
89 GObject* acceleratable, 94 GObject* acceleratable,
90 guint keyval, 95 guint keyval,
91 GdkModifierType modifier, 96 GdkModifierType modifier,
92 TaskManagerGtk* task_manager); 97 TaskManagerGtk* task_manager);
93 98
99 // Page sorting callback.
100 static gint ComparePage(GtkTreeModel* model, GtkTreeIter* a,
101 GtkTreeIter* b, gpointer task_manager) {
102 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
103 CompareImpl(model, a, b, IDS_TASK_MANAGER_PAGE_COLUMN);
104 }
105
106 // Physical memory sorting callback.
107 static gint ComparePhysicalMemory(GtkTreeModel* model, GtkTreeIter* a,
108 GtkTreeIter* b, gpointer task_manager) {
109 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
110 CompareImpl(model, a, b, IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN);
111 }
112
113 // Shared memory sorting callback.
114 static gint CompareSharedMemory(GtkTreeModel* model, GtkTreeIter* a,
115 GtkTreeIter* b, gpointer task_manager) {
116 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
117 CompareImpl(model, a, b, IDS_TASK_MANAGER_SHARED_MEM_COLUMN);
118 }
119
120 // Private memory sorting callback.
121 static gint ComparePrivateMemory(GtkTreeModel* model, GtkTreeIter* a,
122 GtkTreeIter* b, gpointer task_manager) {
123 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
124 CompareImpl(model, a, b, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN);
125 }
126
127 // CPU sorting callback.
128 static gint CompareCPU(GtkTreeModel* model, GtkTreeIter* a,
129 GtkTreeIter* b, gpointer task_manager) {
130 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
131 CompareImpl(model, a, b, IDS_TASK_MANAGER_CPU_COLUMN);
132 }
133
134 // Network sorting callback.
135 static gint CompareNetwork(GtkTreeModel* model, GtkTreeIter* a,
136 GtkTreeIter* b, gpointer task_manager) {
137 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
138 CompareImpl(model, a, b, IDS_TASK_MANAGER_NET_COLUMN);
139 }
140
141 // Process ID sorting callback.
142 static gint CompareProcessID(GtkTreeModel* model, GtkTreeIter* a,
143 GtkTreeIter* b, gpointer task_manager) {
144 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
145 CompareImpl(model, a, b, IDS_TASK_MANAGER_PROCESS_ID_COLUMN);
146 }
147
148 // Goats Teleported sorting callback.
149 static gint CompareGoatsTeleported(GtkTreeModel* model, GtkTreeIter* a,
150 GtkTreeIter* b, gpointer task_manager) {
151 return reinterpret_cast<TaskManagerGtk*>(task_manager)->
152 CompareImpl(model, a, b, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN);
153 }
154
94 // The task manager. 155 // The task manager.
95 TaskManager* task_manager_; 156 TaskManager* task_manager_;
96 157
97 // Our model. 158 // Our model.
98 TaskManagerModel* model_; 159 TaskManagerModel* model_;
99 160
100 // The task manager dialog window. 161 // The task manager dialog window.
101 GtkWidget* dialog_; 162 GtkWidget* dialog_;
102 163
103 // The treeview that contains the process list. 164 // The treeview that contains the process list.
104 GtkWidget* treeview_; 165 GtkWidget* treeview_;
105 166
106 // The list of processes. 167 // The list of processes.
107 GtkListStore* process_list_; 168 GtkListStore* process_list_;
169 GtkTreeModel* process_list_sort_;
108 170
109 // The number of processes in |process_list_|. 171 // The number of processes in |process_list_|.
110 int process_count_; 172 int process_count_;
111 173
112 // The context menu controller. 174 // The context menu controller.
113 scoped_ptr<ContextMenuController> menu_controller_; 175 scoped_ptr<ContextMenuController> menu_controller_;
114 176
115 GtkAccelGroup* accel_group_; 177 GtkAccelGroup* accel_group_;
116 178
117 // An open task manager window. There can only be one open at a time. This 179 // An open task manager window. There can only be one open at a time. This
118 // is reset to NULL when the window is closed. 180 // is reset to NULL when the window is closed.
119 static TaskManagerGtk* instance_; 181 static TaskManagerGtk* instance_;
120 182
121 DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk); 183 DISALLOW_COPY_AND_ASSIGN(TaskManagerGtk);
122 }; 184 };
123 185
124 #endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_ 186 #endif // CHROME_BROWSER_GTK_TASK_MANAGER_GTK_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/gtk/task_manager_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698