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

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

Issue 7012005: Revert "Revert 84829 - Initial implementation of "Synced Bookmarks" folder." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced folder now visible if it has children. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/gtk/bookmarks/bookmark_editor_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 url_entry_ = NULL; 307 url_entry_ = NULL;
308 table = gtk_util::CreateLabeledControlsGroup(NULL, 308 table = gtk_util::CreateLabeledControlsGroup(NULL,
309 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NAME_LABEL).c_str(), 309 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NAME_LABEL).c_str(),
310 name_entry_, 310 name_entry_,
311 NULL); 311 NULL);
312 } 312 }
313 313
314 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); 314 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
315 315
316 if (show_tree_) { 316 if (show_tree_) {
317 GtkTreeIter selected_iter; 317 GtkTreeIter* selected_iter = NULL;
Elliot Glaysher 2011/05/18 21:39:29 I am pretty sure the memory handling here is incor
Yaron 2011/05/18 23:29:01 Done.
318 int64 selected_id = 0; 318 int64 selected_id = 0;
319 if (details_.type == EditDetails::EXISTING_NODE) 319 if (details_.type == EditDetails::EXISTING_NODE)
320 selected_id = details_.existing_node->parent()->id(); 320 selected_id = details_.existing_node->parent()->id();
321 else if (parent_) 321 else if (parent_)
322 selected_id = parent_->id(); 322 selected_id = parent_->id();
323 tree_store_ = bookmark_utils::MakeFolderTreeStore(); 323 tree_store_ = bookmark_utils::MakeFolderTreeStore();
324 bookmark_utils::AddToTreeStore(bb_model_, selected_id, tree_store_, 324 bookmark_utils::AddToTreeStore(bb_model_, selected_id, tree_store_,
325 &selected_iter); 325 selected_iter);
326 tree_view_ = bookmark_utils::MakeTreeViewForStore(tree_store_); 326 tree_view_ = bookmark_utils::MakeTreeViewForStore(tree_store_);
327 gtk_widget_set_size_request(tree_view_, kTreeWidth, kTreeHeight); 327 gtk_widget_set_size_request(tree_view_, kTreeWidth, kTreeHeight);
328 tree_selection_ = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view_)); 328 tree_selection_ = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view_));
329 g_signal_connect(tree_view_, "button-press-event", 329 g_signal_connect(tree_view_, "button-press-event",
330 G_CALLBACK(OnTreeViewButtonPressEventThunk), this); 330 G_CALLBACK(OnTreeViewButtonPressEventThunk), this);
331 331
332 GtkTreePath* path = NULL; 332 GtkTreePath* path = NULL;
333 if (selected_id) { 333 if (selected_id && selected_iter != NULL) {
334 path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store_), 334 path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store_),
335 &selected_iter); 335 selected_iter);
336 } else { 336 } else {
337 // We don't have a selected parent (Probably because we're making a new 337 // We don't have a selected parent (Probably because we're making a new
338 // bookmark). Select the first item in the list. 338 // bookmark). Select the first item in the list.
339 path = gtk_tree_path_new_from_string("0"); 339 path = gtk_tree_path_new_from_string("0");
340 } 340 }
341 341
342 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); 342 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path);
343 gtk_tree_selection_select_path(tree_selection_, path); 343 gtk_tree_selection_select_path(tree_selection_, path);
344 gtk_tree_path_free(path); 344 gtk_tree_path_free(path);
345 345
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 GTK_TREE_MODEL(tree_store_), &new_item_iter); 575 GTK_TREE_MODEL(tree_store_), &new_item_iter);
576 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); 576 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path);
577 577
578 // Make the folder name editable. 578 // Make the folder name editable.
579 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, 579 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path,
580 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), 580 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0),
581 TRUE); 581 TRUE);
582 582
583 gtk_tree_path_free(path); 583 gtk_tree_path_free(path);
584 } 584 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698