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

Unified Diff: chrome/browser/gtk/bookmark_manager_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/bookmark_manager_gtk.h ('k') | chrome/browser/gtk/bookmark_tree_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_manager_gtk.cc
diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc
index 390fda22872dddf6f9b2df01d67b0017822c2c0a..65167db0f6c326f1931b303f2115e90c20a25c39 100644
--- a/chrome/browser/gtk/bookmark_manager_gtk.cc
+++ b/chrome/browser/gtk/bookmark_manager_gtk.cc
@@ -446,6 +446,11 @@ GtkWidget* BookmarkManagerGtk::MakeLeftPane() {
g_signal_connect(left_tree_view_, "key-press-event",
G_CALLBACK(OnTreeViewKeyPress), this);
+ GtkCellRenderer* cell_renderer_text = bookmark_utils::GetCellRendererText(
+ GTK_TREE_VIEW(left_tree_view_));
+ g_signal_connect(cell_renderer_text, "edited",
+ G_CALLBACK(OnFolderNameEdited), this);
+
// The left side is only a drag destination (not a source).
gtk_drag_dest_set(left_tree_view_, GTK_DEST_DEFAULT_DROP,
NULL, 0, GDK_ACTION_MOVE);
@@ -627,6 +632,7 @@ void BookmarkManagerGtk::BuildLeftStore() {
l10n_util::GetStringUTF8(
IDS_BOOKMARK_TREE_RECENTLY_BOOKMARKED_NODE_TITLE).c_str(),
bookmark_utils::ITEM_ID, kRecentID,
+ bookmark_utils::IS_EDITABLE, FALSE,
-1);
GdkPixbuf* search_icon = gtk_widget_render_icon(
@@ -639,6 +645,7 @@ void BookmarkManagerGtk::BuildLeftStore() {
l10n_util::GetStringUTF8(
IDS_BOOKMARK_TREE_SEARCH_NODE_TITLE).c_str(),
bookmark_utils::ITEM_ID, kSearchID,
+ bookmark_utils::IS_EDITABLE, FALSE,
-1);
g_object_unref(search_icon);
}
@@ -1308,6 +1315,20 @@ gboolean BookmarkManagerGtk::OnTreeViewKeyPress(
}
// static
+void BookmarkManagerGtk::OnFolderNameEdited(GtkCellRendererText* render,
+ gchar* path, gchar* new_folder_name, BookmarkManagerGtk* bm) {
+ // A folder named was edited in place. Sync the change to the bookmark
+ // model.
+ GtkTreeIter iter;
+ GtkTreePath* tree_path = gtk_tree_path_new_from_string(path);
+ gboolean rv = gtk_tree_model_get_iter(GTK_TREE_MODEL(bm->left_store_),
+ &iter, tree_path);
+ DCHECK(rv);
+ bm->model_->SetTitle(bm->GetNodeAt(GTK_TREE_MODEL(bm->left_store_), &iter),
+ UTF8ToWide(new_folder_name));
+}
+
+// static
void BookmarkManagerGtk::OnImportItemActivated(
GtkMenuItem* menuitem, BookmarkManagerGtk* bm) {
SelectFileDialog::FileTypeInfo file_type_info;
« no previous file with comments | « chrome/browser/gtk/bookmark_manager_gtk.h ('k') | chrome/browser/gtk/bookmark_tree_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698