OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 9 #include <set> |
10 | 10 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 title = UTF16ToUTF8(details_.title); | 353 title = UTF16ToUTF8(details_.title); |
354 } | 354 } |
355 gtk_entry_set_text(GTK_ENTRY(name_entry_), title.c_str()); | 355 gtk_entry_set_text(GTK_ENTRY(name_entry_), title.c_str()); |
356 g_signal_connect(name_entry_, "changed", | 356 g_signal_connect(name_entry_, "changed", |
357 G_CALLBACK(OnEntryChangedThunk), this); | 357 G_CALLBACK(OnEntryChangedThunk), this); |
358 gtk_entry_set_activates_default(GTK_ENTRY(name_entry_), TRUE); | 358 gtk_entry_set_activates_default(GTK_ENTRY(name_entry_), TRUE); |
359 | 359 |
360 GtkWidget* table; | 360 GtkWidget* table; |
361 if (details_.GetNodeType() != BookmarkNode::FOLDER) { | 361 if (details_.GetNodeType() != BookmarkNode::FOLDER) { |
362 url_entry_ = gtk_entry_new(); | 362 url_entry_ = gtk_entry_new(); |
363 PrefService* prefs = profile_ ? | 363 PrefService* prefs = |
364 components::UserPrefs::Get(profile_) : | 364 profile_ ? user_prefs::UserPrefs::Get(profile_) : NULL; |
365 NULL; | |
366 gtk_entry_set_text( | 365 gtk_entry_set_text( |
367 GTK_ENTRY(url_entry_), | 366 GTK_ENTRY(url_entry_), |
368 UTF16ToUTF8(chrome::FormatBookmarkURLForDisplay(url, prefs)).c_str()); | 367 UTF16ToUTF8(chrome::FormatBookmarkURLForDisplay(url, prefs)).c_str()); |
369 g_signal_connect(url_entry_, "changed", | 368 g_signal_connect(url_entry_, "changed", |
370 G_CALLBACK(OnEntryChangedThunk), this); | 369 G_CALLBACK(OnEntryChangedThunk), this); |
371 gtk_entry_set_activates_default(GTK_ENTRY(url_entry_), TRUE); | 370 gtk_entry_set_activates_default(GTK_ENTRY(url_entry_), TRUE); |
372 table = gtk_util::CreateLabeledControlsGroup(NULL, | 371 table = gtk_util::CreateLabeledControlsGroup(NULL, |
373 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NAME_LABEL).c_str(), | 372 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NAME_LABEL).c_str(), |
374 name_entry_, | 373 name_entry_, |
375 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_URL_LABEL).c_str(), | 374 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_URL_LABEL).c_str(), |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 GTK_TREE_MODEL(tree_store_), &new_item_iter); | 668 GTK_TREE_MODEL(tree_store_), &new_item_iter); |
670 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); | 669 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); |
671 | 670 |
672 // Make the folder name editable. | 671 // Make the folder name editable. |
673 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, | 672 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, |
674 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), | 673 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), |
675 TRUE); | 674 TRUE); |
676 | 675 |
677 gtk_tree_path_free(path); | 676 gtk_tree_path_free(path); |
678 } | 677 } |
OLD | NEW |