| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" | 15 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_utils.h" | 17 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 18 #include "chrome/browser/history/history.h" | 18 #include "chrome/browser/history/history.h" |
| 19 #include "chrome/browser/net/url_fixer_upper.h" | 19 #include "chrome/browser/net/url_fixer_upper.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" | 21 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" |
| 22 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 22 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 23 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 23 #include "chrome/browser/ui/gtk/gtk_util.h" | 24 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 24 #include "chrome/browser/ui/gtk/menu_gtk.h" | 25 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 25 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | |
| 26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 27 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "grit/locale_settings.h" | 29 #include "grit/locale_settings.h" |
| 30 #include "ui/base/gtk/gtk_hig_constants.h" | 30 #include "ui/base/gtk/gtk_hig_constants.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "ui/base/models/simple_menu_model.h" | 32 #include "ui/base/models/simple_menu_model.h" |
| 33 #include "ui/gfx/gtk_util.h" | 33 #include "ui/gfx/gtk_util.h" |
| 34 #include "ui/gfx/image/image.h" | 34 #include "ui/gfx/image/image.h" |
| 35 #include "ui/gfx/point.h" | 35 #include "ui/gfx/point.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 // Remove the folders that were removed. This has to be done after all the | 567 // Remove the folders that were removed. This has to be done after all the |
| 568 // other changes have been committed. | 568 // other changes have been committed. |
| 569 bookmark_utils::DeleteBookmarkFolders(bb_model_, deletes_); | 569 bookmark_utils::DeleteBookmarkFolders(bb_model_, deletes_); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) { | 572 void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) { |
| 573 gtk_tree_store_append(tree_store_, child, parent); | 573 gtk_tree_store_append(tree_store_, child, parent); |
| 574 gtk_tree_store_set( | 574 gtk_tree_store_set( |
| 575 tree_store_, child, | 575 tree_store_, child, |
| 576 bookmark_utils::FOLDER_ICON, | 576 bookmark_utils::FOLDER_ICON, |
| 577 ThemeServiceGtk::GetFolderIcon(true)->ToGdkPixbuf(), | 577 GtkThemeService::GetFolderIcon(true)->ToGdkPixbuf(), |
| 578 bookmark_utils::FOLDER_NAME, | 578 bookmark_utils::FOLDER_NAME, |
| 579 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME).c_str(), | 579 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME).c_str(), |
| 580 bookmark_utils::ITEM_ID, static_cast<int64>(0), | 580 bookmark_utils::ITEM_ID, static_cast<int64>(0), |
| 581 bookmark_utils::IS_EDITABLE, TRUE, | 581 bookmark_utils::IS_EDITABLE, TRUE, |
| 582 -1); | 582 -1); |
| 583 } | 583 } |
| 584 | 584 |
| 585 void BookmarkEditorGtk::OnSelectionChanged(GtkWidget* selection) { | 585 void BookmarkEditorGtk::OnSelectionChanged(GtkWidget* selection) { |
| 586 if (!gtk_tree_selection_get_selected(tree_selection_, NULL, NULL)) | 586 if (!gtk_tree_selection_get_selected(tree_selection_, NULL, NULL)) |
| 587 gtk_widget_set_sensitive(new_folder_button_, FALSE); | 587 gtk_widget_set_sensitive(new_folder_button_, FALSE); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 GTK_TREE_MODEL(tree_store_), &new_item_iter); | 667 GTK_TREE_MODEL(tree_store_), &new_item_iter); |
| 668 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); | 668 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); |
| 669 | 669 |
| 670 // Make the folder name editable. | 670 // Make the folder name editable. |
| 671 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, | 671 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, |
| 672 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), | 672 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), |
| 673 TRUE); | 673 TRUE); |
| 674 | 674 |
| 675 gtk_tree_path_free(path); | 675 gtk_tree_path_free(path); |
| 676 } | 676 } |
| OLD | NEW |