| 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 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" | 14 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_model.h" | 15 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_utils.h" | 16 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 17 #include "chrome/browser/history/history.h" | 17 #include "chrome/browser/history/history.h" |
| 18 #include "chrome/browser/net/url_fixer_upper.h" | 18 #include "chrome/browser/net/url_fixer_upper.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" | 20 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" |
| 21 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 21 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 23 #include "chrome/browser/ui/gtk/gtk_util.h" | 22 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 23 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 #include "grit/locale_settings.h" | 27 #include "grit/locale_settings.h" |
| 28 #include "ui/base/gtk/gtk_hig_constants.h" | 28 #include "ui/base/gtk/gtk_hig_constants.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/models/simple_menu_model.h" | 30 #include "ui/base/models/simple_menu_model.h" |
| 31 #include "ui/gfx/gtk_util.h" | 31 #include "ui/gfx/gtk_util.h" |
| 32 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
| 33 #include "ui/gfx/point.h" | 33 #include "ui/gfx/point.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // Remove the folders that were removed. This has to be done after all the | 587 // Remove the folders that were removed. This has to be done after all the |
| 588 // other changes have been committed. | 588 // other changes have been committed. |
| 589 bookmark_utils::DeleteBookmarkFolders(bb_model_, deletes_); | 589 bookmark_utils::DeleteBookmarkFolders(bb_model_, deletes_); |
| 590 } | 590 } |
| 591 | 591 |
| 592 void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) { | 592 void BookmarkEditorGtk::AddNewFolder(GtkTreeIter* parent, GtkTreeIter* child) { |
| 593 gtk_tree_store_append(tree_store_, child, parent); | 593 gtk_tree_store_append(tree_store_, child, parent); |
| 594 gtk_tree_store_set( | 594 gtk_tree_store_set( |
| 595 tree_store_, child, | 595 tree_store_, child, |
| 596 bookmark_utils::FOLDER_ICON, | 596 bookmark_utils::FOLDER_ICON, |
| 597 GtkThemeService::GetFolderIcon(true)->ToGdkPixbuf(), | 597 ThemeServiceGtk::GetFolderIcon(true)->ToGdkPixbuf(), |
| 598 bookmark_utils::FOLDER_NAME, | 598 bookmark_utils::FOLDER_NAME, |
| 599 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME).c_str(), | 599 l10n_util::GetStringUTF8(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME).c_str(), |
| 600 bookmark_utils::ITEM_ID, static_cast<int64>(0), | 600 bookmark_utils::ITEM_ID, static_cast<int64>(0), |
| 601 bookmark_utils::IS_EDITABLE, TRUE, | 601 bookmark_utils::IS_EDITABLE, TRUE, |
| 602 -1); | 602 -1); |
| 603 } | 603 } |
| 604 | 604 |
| 605 void BookmarkEditorGtk::OnSelectionChanged(GtkWidget* selection) { | 605 void BookmarkEditorGtk::OnSelectionChanged(GtkWidget* selection) { |
| 606 if (!gtk_tree_selection_get_selected(tree_selection_, NULL, NULL)) | 606 if (!gtk_tree_selection_get_selected(tree_selection_, NULL, NULL)) |
| 607 gtk_widget_set_sensitive(new_folder_button_, FALSE); | 607 gtk_widget_set_sensitive(new_folder_button_, FALSE); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 GTK_TREE_MODEL(tree_store_), &new_item_iter); | 687 GTK_TREE_MODEL(tree_store_), &new_item_iter); |
| 688 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); | 688 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(tree_view_), path); |
| 689 | 689 |
| 690 // Make the folder name editable. | 690 // Make the folder name editable. |
| 691 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, | 691 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_view_), path, |
| 692 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), | 692 gtk_tree_view_get_column(GTK_TREE_VIEW(tree_view_), 0), |
| 693 TRUE); | 693 TRUE); |
| 694 | 694 |
| 695 gtk_tree_path_free(path); | 695 gtk_tree_path_free(path); |
| 696 } | 696 } |
| OLD | NEW |