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

Side by Side Diff: chrome/browser/gtk/options/cookies_view.cc

Issue 164125: Gtk Cookie Manager polish. (Closed)
Patch Set: Created 11 years, 4 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 | « no previous file | no next file » | 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 #include "chrome/browser/gtk/options/cookies_view.h" 5 #include "chrome/browser/gtk/options/cookies_view.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "base/gfx/gtk_util.h" 11 #include "base/gfx/gtk_util.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/time_format.h" 14 #include "base/time_format.h"
15 #include "chrome/browser/cookies_table_model.h" 15 #include "chrome/browser/cookies_table_model.h"
16 #include "chrome/common/gtk_tree.h" 16 #include "chrome/common/gtk_tree.h"
17 #include "chrome/common/gtk_util.h" 17 #include "chrome/common/gtk_util.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 20
21 namespace { 21 namespace {
22 22
23 // Initial size for dialog. 23 // Initial size for dialog.
24 const int kDialogDefaultWidth = 450; 24 const int kDialogDefaultWidth = 550;
25 const int kDialogDefaultHeight = 550; 25 const int kDialogDefaultHeight = 550;
26 const int kSiteColumnInitialSize = 300;
26 27
27 // Delay after entering filter text before filtering occurs. 28 // Delay after entering filter text before filtering occurs.
28 const int kSearchFilterDelayMs = 500; 29 const int kSearchFilterDelayMs = 500;
29 30
30 // Response ids for our custom buttons. 31 // Response ids for our custom buttons.
31 enum { 32 enum {
32 RESPONSE_REMOVE = 1, 33 RESPONSE_REMOVE = 1,
33 RESPONSE_REMOVE_ALL 34 RESPONSE_REMOVE_ALL
34 }; 35 };
35 36
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 list_store_ = gtk_list_store_new(COL_COUNT, 159 list_store_ = gtk_list_store_new(COL_COUNT,
159 GDK_TYPE_PIXBUF, 160 GDK_TYPE_PIXBUF,
160 G_TYPE_STRING, 161 G_TYPE_STRING,
161 G_TYPE_STRING); 162 G_TYPE_STRING);
162 list_sort_ = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(list_store_)); 163 list_sort_ = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(list_store_));
163 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_sort_), 164 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_sort_),
164 COL_SITE, CompareSite, this, NULL); 165 COL_SITE, CompareSite, this, NULL);
165 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_sort_), 166 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_sort_),
166 COL_COOKIE_NAME, CompareCookieName, this, 167 COL_COOKIE_NAME, CompareCookieName, this,
167 NULL); 168 NULL);
169 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list_sort_),
170 COL_SITE, GTK_SORT_ASCENDING);
168 tree_ = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_sort_)); 171 tree_ = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_sort_));
169 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_), TRUE); 172 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_), TRUE);
170 gtk_container_add(GTK_CONTAINER(scroll_window), tree_); 173 gtk_container_add(GTK_CONTAINER(scroll_window), tree_);
171 174
172 GtkTreeViewColumn* site_column = gtk_tree_view_column_new(); 175 GtkTreeViewColumn* site_column = gtk_tree_view_column_new();
173 GtkCellRenderer* pixbuf_renderer = gtk_cell_renderer_pixbuf_new(); 176 GtkCellRenderer* pixbuf_renderer = gtk_cell_renderer_pixbuf_new();
174 gtk_tree_view_column_pack_start(site_column, pixbuf_renderer, FALSE); 177 gtk_tree_view_column_pack_start(site_column, pixbuf_renderer, FALSE);
175 gtk_tree_view_column_add_attribute(site_column, pixbuf_renderer, "pixbuf", 178 gtk_tree_view_column_add_attribute(site_column, pixbuf_renderer, "pixbuf",
176 COL_ICON); 179 COL_ICON);
177 GtkCellRenderer* site_renderer = gtk_cell_renderer_text_new(); 180 GtkCellRenderer* site_renderer = gtk_cell_renderer_text_new();
178 gtk_tree_view_column_pack_start(site_column, site_renderer, TRUE); 181 gtk_tree_view_column_pack_start(site_column, site_renderer, TRUE);
179 gtk_tree_view_column_add_attribute(site_column, site_renderer, "text", 182 gtk_tree_view_column_add_attribute(site_column, site_renderer, "text",
180 COL_SITE); 183 COL_SITE);
181 gtk_tree_view_column_set_title( 184 gtk_tree_view_column_set_title(
182 site_column, l10n_util::GetStringUTF8( 185 site_column, l10n_util::GetStringUTF8(
183 IDS_COOKIES_DOMAIN_COLUMN_HEADER).c_str()); 186 IDS_COOKIES_DOMAIN_COLUMN_HEADER).c_str());
184 gtk_tree_view_column_set_sort_column_id(site_column, COL_SITE); 187 gtk_tree_view_column_set_sort_column_id(site_column, COL_SITE);
188 gtk_tree_view_column_set_sizing(site_column, GTK_TREE_VIEW_COLUMN_FIXED);
189 gtk_tree_view_column_set_resizable(site_column, TRUE);
190 gtk_tree_view_column_set_fixed_width(site_column, kSiteColumnInitialSize);
185 gtk_tree_view_append_column(GTK_TREE_VIEW(tree_), site_column); 191 gtk_tree_view_append_column(GTK_TREE_VIEW(tree_), site_column);
186 192
187 GtkTreeViewColumn* name_column = gtk_tree_view_column_new_with_attributes( 193 GtkTreeViewColumn* name_column = gtk_tree_view_column_new_with_attributes(
188 l10n_util::GetStringUTF8( 194 l10n_util::GetStringUTF8(
189 IDS_COOKIES_NAME_COLUMN_HEADER).c_str(), 195 IDS_COOKIES_NAME_COLUMN_HEADER).c_str(),
190 gtk_cell_renderer_text_new(), 196 gtk_cell_renderer_text_new(),
191 "text", COL_COOKIE_NAME, 197 "text", COL_COOKIE_NAME,
192 NULL); 198 NULL);
193 gtk_tree_view_column_set_sort_column_id(name_column, COL_COOKIE_NAME); 199 gtk_tree_view_column_set_sort_column_id(name_column, COL_COOKIE_NAME);
194 gtk_tree_view_append_column(GTK_TREE_VIEW(tree_), name_column); 200 gtk_tree_view_append_column(GTK_TREE_VIEW(tree_), name_column);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 window->EnableControls(); 500 window->EnableControls();
495 } 501 }
496 502
497 // static 503 // static
498 void CookiesView::OnFilterClearButtonClicked(GtkButton* button, 504 void CookiesView::OnFilterClearButtonClicked(GtkButton* button,
499 CookiesView* window) { 505 CookiesView* window) {
500 gtk_entry_set_text(GTK_ENTRY(window->filter_entry_), ""); 506 gtk_entry_set_text(GTK_ENTRY(window->filter_entry_), "");
501 window->filter_update_factory_.RevokeAll(); 507 window->filter_update_factory_.RevokeAll();
502 window->UpdateFilterResults(); 508 window->UpdateFilterResults();
503 } 509 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698