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

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

Issue 7744055: bookmarks: Fix an obvious typo in IDS_BOOMARK_*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | 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 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 : public ui::SimpleMenuModel::Delegate { 97 : public ui::SimpleMenuModel::Delegate {
98 public: 98 public:
99 explicit ContextMenuController(BookmarkEditorGtk* editor) 99 explicit ContextMenuController(BookmarkEditorGtk* editor)
100 : editor_(editor), 100 : editor_(editor),
101 running_menu_for_root_(false) { 101 running_menu_for_root_(false) {
102 menu_model_.reset(new ui::SimpleMenuModel(this)); 102 menu_model_.reset(new ui::SimpleMenuModel(this));
103 menu_model_->AddItemWithStringId(COMMAND_EDIT, IDS_EDIT); 103 menu_model_->AddItemWithStringId(COMMAND_EDIT, IDS_EDIT);
104 menu_model_->AddItemWithStringId(COMMAND_DELETE, IDS_DELETE); 104 menu_model_->AddItemWithStringId(COMMAND_DELETE, IDS_DELETE);
105 menu_model_->AddItemWithStringId( 105 menu_model_->AddItemWithStringId(
106 COMMAND_NEW_FOLDER, 106 COMMAND_NEW_FOLDER,
107 IDS_BOOMARK_EDITOR_NEW_FOLDER_MENU_ITEM); 107 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM);
108 #if defined(TOOLKIT_VIEWS) 108 #if defined(TOOLKIT_VIEWS)
109 menu_.reset(new views::Menu2(menu_model_.get())); 109 menu_.reset(new views::Menu2(menu_model_.get()));
110 #else 110 #else
111 menu_.reset(new MenuGtk(NULL, menu_model_.get())); 111 menu_.reset(new MenuGtk(NULL, menu_model_.get()));
112 #endif 112 #endif
113 } 113 }
114 virtual ~ContextMenuController() {} 114 virtual ~ContextMenuController() {}
115 115
116 void RunMenu(const gfx::Point& point, guint32 event_time) { 116 void RunMenu(const gfx::Point& point, guint32 event_time) {
117 const BookmarkNode* selected_node = GetSelectedNode(); 117 const BookmarkNode* selected_node = GetSelectedNode();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 bb_model_->RemoveObserver(this); 292 bb_model_->RemoveObserver(this);
293 } 293 }
294 294
295 void BookmarkEditorGtk::Init(GtkWindow* parent_window) { 295 void BookmarkEditorGtk::Init(GtkWindow* parent_window) {
296 bb_model_ = profile_->GetBookmarkModel(); 296 bb_model_ = profile_->GetBookmarkModel();
297 DCHECK(bb_model_); 297 DCHECK(bb_model_);
298 bb_model_->AddObserver(this); 298 bb_model_->AddObserver(this);
299 299
300 dialog_ = gtk_dialog_new_with_buttons( 300 dialog_ = gtk_dialog_new_with_buttons(
301 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_TITLE).c_str(), 301 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_TITLE).c_str(),
302 parent_window, 302 parent_window,
303 GTK_DIALOG_MODAL, 303 GTK_DIALOG_MODAL,
304 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, 304 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
305 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, 305 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
306 NULL); 306 NULL);
307 gtk_dialog_set_has_separator(GTK_DIALOG(dialog_), FALSE); 307 gtk_dialog_set_has_separator(GTK_DIALOG(dialog_), FALSE);
308 308
309 if (show_tree_) { 309 if (show_tree_) {
310 GtkWidget* action_area = GTK_DIALOG(dialog_)->action_area; 310 GtkWidget* action_area = GTK_DIALOG(dialog_)->action_area;
311 new_folder_button_ = gtk_button_new_with_label( 311 new_folder_button_ = gtk_button_new_with_label(
312 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON).c_str()); 312 l10n_util::GetStringUTF8(
313 IDS_BOOKMARK_EDITOR_NEW_FOLDER_BUTTON).c_str());
313 g_signal_connect(new_folder_button_, "clicked", 314 g_signal_connect(new_folder_button_, "clicked",
314 G_CALLBACK(OnNewFolderClickedThunk), this); 315 G_CALLBACK(OnNewFolderClickedThunk), this);
315 gtk_container_add(GTK_CONTAINER(action_area), new_folder_button_); 316 gtk_container_add(GTK_CONTAINER(action_area), new_folder_button_);
316 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(action_area), 317 gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(action_area),
317 new_folder_button_, TRUE); 318 new_folder_button_, TRUE);
318 } 319 }
319 320
320 gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT); 321 gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT);
321 322
322 // The GTK dialog content area layout (overview) 323 // The GTK dialog content area layout (overview)
(...skipping 25 matching lines...) Expand all
348 349
349 GtkWidget* vbox = gtk_vbox_new(FALSE, 12); 350 GtkWidget* vbox = gtk_vbox_new(FALSE, 12);
350 351
351 name_entry_ = gtk_entry_new(); 352 name_entry_ = gtk_entry_new();
352 std::string title; 353 std::string title;
353 GURL url; 354 GURL url;
354 if (details_.type == EditDetails::EXISTING_NODE) { 355 if (details_.type == EditDetails::EXISTING_NODE) {
355 title = UTF16ToUTF8(details_.existing_node->GetTitle()); 356 title = UTF16ToUTF8(details_.existing_node->GetTitle());
356 url = details_.existing_node->url(); 357 url = details_.existing_node->url();
357 } else if (details_.type == EditDetails::NEW_FOLDER) { 358 } else if (details_.type == EditDetails::NEW_FOLDER) {
358 title = l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME); 359 title = l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME);
359 } else if (details_.type == EditDetails::NEW_URL) { 360 } else if (details_.type == EditDetails::NEW_URL) {
360 string16 title16; 361 string16 title16;
361 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_, 362 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_,
362 &url, &title16); 363 &url, &title16);
363 title = UTF16ToUTF8(title16); 364 title = UTF16ToUTF8(title16);
364 } 365 }
365 gtk_entry_set_text(GTK_ENTRY(name_entry_), title.c_str()); 366 gtk_entry_set_text(GTK_ENTRY(name_entry_), title.c_str());
366 g_signal_connect(name_entry_, "changed", 367 g_signal_connect(name_entry_, "changed",
367 G_CALLBACK(OnEntryChangedThunk), this); 368 G_CALLBACK(OnEntryChangedThunk), this);
368 gtk_entry_set_activates_default(GTK_ENTRY(name_entry_), TRUE); 369 gtk_entry_set_activates_default(GTK_ENTRY(name_entry_), TRUE);
369 370
370 GtkWidget* table; 371 GtkWidget* table;
371 if (details_.type != EditDetails::NEW_FOLDER) { 372 if (details_.type != EditDetails::NEW_FOLDER) {
372 url_entry_ = gtk_entry_new(); 373 url_entry_ = gtk_entry_new();
373 gtk_entry_set_text(GTK_ENTRY(url_entry_), url.spec().c_str()); 374 gtk_entry_set_text(GTK_ENTRY(url_entry_), url.spec().c_str());
374 g_signal_connect(url_entry_, "changed", 375 g_signal_connect(url_entry_, "changed",
375 G_CALLBACK(OnEntryChangedThunk), this); 376 G_CALLBACK(OnEntryChangedThunk), this);
376 gtk_entry_set_activates_default(GTK_ENTRY(url_entry_), TRUE); 377 gtk_entry_set_activates_default(GTK_ENTRY(url_entry_), TRUE);
377 table = gtk_util::CreateLabeledControlsGroup(NULL, 378 table = gtk_util::CreateLabeledControlsGroup(NULL,
378 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NAME_LABEL).c_str(), 379 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NAME_LABEL).c_str(),
379 name_entry_, 380 name_entry_,
380 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_URL_LABEL).c_str(), 381 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_URL_LABEL).c_str(),
381 url_entry_, 382 url_entry_,
382 NULL); 383 NULL);
383 384
384 } else { 385 } else {
385 url_entry_ = NULL; 386 url_entry_ = NULL;
386 table = gtk_util::CreateLabeledControlsGroup(NULL, 387 table = gtk_util::CreateLabeledControlsGroup(NULL,
387 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NAME_LABEL).c_str(), 388 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NAME_LABEL).c_str(),
388 name_entry_, 389 name_entry_,
389 NULL); 390 NULL);
390 } 391 }
391 392
392 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); 393 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
393 394
394 if (show_tree_) { 395 if (show_tree_) {
395 GtkTreeIter selected_iter; 396 GtkTreeIter selected_iter;
396 int64 selected_id = 0; 397 int64 selected_id = 0;
397 if (details_.type == EditDetails::EXISTING_NODE) 398 if (details_.type == EditDetails::EXISTING_NODE)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // other changes have been committed. 582 // other changes have been committed.
582 bookmark_utils::DeleteBookmarkFolders(bb_model_, deletes_); 583 bookmark_utils::DeleteBookmarkFolders(bb_model_, deletes_);
583 } 584 }
584 585
585 void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) { 586 void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) {
586 gtk_tree_store_append(tree_store_, child, parent); 587 gtk_tree_store_append(tree_store_, child, parent);
587 gtk_tree_store_set( 588 gtk_tree_store_set(
588 tree_store_, child, 589 tree_store_, child,
589 bookmark_utils::FOLDER_ICON, GtkThemeService::GetFolderIcon(true), 590 bookmark_utils::FOLDER_ICON, GtkThemeService::GetFolderIcon(true),
590 bookmark_utils::FOLDER_NAME, 591 bookmark_utils::FOLDER_NAME,
591 l10n_util::GetStringUTF8(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME).c_str(), 592 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME).c_str(),
592 bookmark_utils::ITEM_ID, static_cast<int64>(0), 593 bookmark_utils::ITEM_ID, static_cast<int64>(0),
593 bookmark_utils::IS_EDITABLE, TRUE, 594 bookmark_utils::IS_EDITABLE, TRUE,
594 -1); 595 -1);
595 } 596 }
596 597
597 void BookmarkEditorGtk::OnSelectionChanged(GtkWidget* selection) { 598 void BookmarkEditorGtk::OnSelectionChanged(GtkWidget* selection) {
598 if (!gtk_tree_selection_get_selected(tree_selection_, NULL, NULL)) 599 if (!gtk_tree_selection_get_selected(tree_selection_, NULL, NULL))
599 gtk_widget_set_sensitive(new_folder_button_, FALSE); 600 gtk_widget_set_sensitive(new_folder_button_, FALSE);
600 else 601 else
601 gtk_widget_set_sensitive(new_folder_button_, TRUE); 602 gtk_widget_set_sensitive(new_folder_button_, TRUE);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 GTK_TREE_MODEL(tree_store_), &new_item_iter); 680 GTK_TREE_MODEL(tree_store_), &new_item_iter);
680 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); 681 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path);
681 682
682 // Make the folder name editable. 683 // Make the folder name editable.
683 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, 684 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path,
684 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), 685 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0),
685 TRUE); 686 TRUE);
686 687
687 gtk_tree_path_free(path); 688 gtk_tree_path_free(path);
688 } 689 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/global_bookmark_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698