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

Side by Side Diff: chrome/browser/gtk/bookmark_editor_gtk.cc

Issue 210036: Make it possible to edit bookmark folder names inline. This (Closed)
Patch Set: comments 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 | « no previous file | chrome/browser/gtk/bookmark_manager_gtk.h » ('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 #include "chrome/browser/gtk/bookmark_editor_gtk.h" 5 #include "chrome/browser/gtk/bookmark_editor_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 bookmark_utils::ApplyEditsWithPossibleGroupChange( 308 bookmark_utils::ApplyEditsWithPossibleGroupChange(
309 bb_model_, new_parent, node_, new_title, new_url, handler_.get()); 309 bb_model_, new_parent, node_, new_title, new_url, handler_.get());
310 } 310 }
311 311
312 void BookmarkEditorGtk::AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child) { 312 void BookmarkEditorGtk::AddNewGroup(GtkTreeIter* parent, GtkTreeIter* child) {
313 gtk_tree_store_append(tree_store_, child, parent); 313 gtk_tree_store_append(tree_store_, child, parent);
314 gtk_tree_store_set( 314 gtk_tree_store_set(
315 tree_store_, child, 315 tree_store_, child,
316 bookmark_utils::FOLDER_ICON, 316 bookmark_utils::FOLDER_ICON, GtkThemeProvider::GetFolderIcon(true),
317 GtkThemeProvider::GetFolderIcon(true),
318 bookmark_utils::FOLDER_NAME, 317 bookmark_utils::FOLDER_NAME,
319 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME).c_str(), 318 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME).c_str(),
320 bookmark_utils::ITEM_ID, static_cast<int64>(0), 319 bookmark_utils::ITEM_ID, static_cast<int64>(0),
320 bookmark_utils::IS_EDITABLE, TRUE,
321 -1); 321 -1);
322 } 322 }
323 323
324 // static 324 // static
325 void BookmarkEditorGtk::OnSelectionChanged(GtkTreeSelection* selection, 325 void BookmarkEditorGtk::OnSelectionChanged(GtkTreeSelection* selection,
326 BookmarkEditorGtk* dialog) { 326 BookmarkEditorGtk* dialog) {
327 if (!gtk_tree_selection_get_selected(dialog->tree_selection_, NULL, NULL)) 327 if (!gtk_tree_selection_get_selected(dialog->tree_selection_, NULL, NULL))
328 gtk_widget_set_sensitive(dialog->new_folder_button_, FALSE); 328 gtk_widget_set_sensitive(dialog->new_folder_button_, FALSE);
329 else 329 else
330 gtk_widget_set_sensitive(dialog->new_folder_button_, TRUE); 330 gtk_widget_set_sensitive(dialog->new_folder_button_, TRUE);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 "is clicked"; 387 "is clicked";
388 return; 388 return;
389 } 389 }
390 390
391 GtkTreeIter new_item_iter; 391 GtkTreeIter new_item_iter;
392 dialog->AddNewGroup(&iter, &new_item_iter); 392 dialog->AddNewGroup(&iter, &new_item_iter);
393 393
394 GtkTreePath* path = gtk_tree_model_get_path( 394 GtkTreePath* path = gtk_tree_model_get_path(
395 GTK_TREE_MODEL(dialog->tree_store_), &new_item_iter); 395 GTK_TREE_MODEL(dialog->tree_store_), &new_item_iter);
396 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(dialog->tree_view_), path); 396 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(dialog->tree_view_), path);
397 gtk_tree_selection_select_path(dialog->tree_selection_, path); 397
398 // Make the folder name editable.
399 gtk_tree_view_set_cursor(GTK_TREE_VIEW(dialog->tree_view_), path,
400 gtk_tree_view_get_column(GTK_TREE_VIEW(dialog->tree_view_), 0),
401 TRUE);
402
398 gtk_tree_path_free(path); 403 gtk_tree_path_free(path);
399 } 404 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_manager_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698