| 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_tree_model.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // It would be easy to show a different icon when the folder is open (as they | 23 // It would be easy to show a different icon when the folder is open (as they |
| 24 // do on Windows, for example), using pixbuf-expander-closed and | 24 // do on Windows, for example), using pixbuf-expander-closed and |
| 25 // pixbuf-expander-open. Unfortunately there is no GTK_STOCK_OPEN_DIRECTORY | 25 // pixbuf-expander-open. Unfortunately there is no GTK_STOCK_OPEN_DIRECTORY |
| 26 // (and indeed, Nautilus does not render an expanded directory any | 26 // (and indeed, Nautilus does not render an expanded directory any |
| 27 // differently). | 27 // differently). |
| 28 gtk_tree_store_set(store, | 28 gtk_tree_store_set(store, |
| 29 iter, | 29 iter, |
| 30 FOLDER_ICON, | 30 FOLDER_ICON, |
| 31 GtkThemeService::GetFolderIcon(true).ToGdkPixbuf(), | 31 GtkThemeService::GetFolderIcon(true).ToGdkPixbuf(), |
| 32 FOLDER_NAME, | 32 FOLDER_NAME, |
| 33 UTF16ToUTF8(node->GetTitle()).c_str(), | 33 base::UTF16ToUTF8(node->GetTitle()).c_str(), |
| 34 ITEM_ID, | 34 ITEM_ID, |
| 35 node->id(), | 35 node->id(), |
| 36 // We don't want to use node->is_folder() because that | 36 // We don't want to use node->is_folder() because that |
| 37 // would let the | 37 // would let the |
| 38 // user edit "Bookmarks Bar" and "Other Bookmarks". | 38 // user edit "Bookmarks Bar" and "Other Bookmarks". |
| 39 IS_EDITABLE, | 39 IS_EDITABLE, |
| 40 node->type() == BookmarkNode::FOLDER, | 40 node->type() == BookmarkNode::FOLDER, |
| 41 -1); | 41 -1); |
| 42 } | 42 } |
| 43 | 43 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 return ret_val; | 227 return ret_val; |
| 228 } | 228 } |
| 229 | 229 |
| 230 base::string16 GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter) { | 230 base::string16 GetTitleFromTreeIter(GtkTreeModel* model, GtkTreeIter* iter) { |
| 231 GValue value = { 0, }; | 231 GValue value = { 0, }; |
| 232 base::string16 ret_val; | 232 base::string16 ret_val; |
| 233 gtk_tree_model_get_value(model, iter, FOLDER_NAME, &value); | 233 gtk_tree_model_get_value(model, iter, FOLDER_NAME, &value); |
| 234 if (G_VALUE_HOLDS_STRING(&value)) { | 234 if (G_VALUE_HOLDS_STRING(&value)) { |
| 235 const gchar* utf8str = g_value_get_string(&value); | 235 const gchar* utf8str = g_value_get_string(&value); |
| 236 ret_val = UTF8ToUTF16(utf8str); | 236 ret_val = base::UTF8ToUTF16(utf8str); |
| 237 g_value_unset(&value); | 237 g_value_unset(&value); |
| 238 } else { | 238 } else { |
| 239 NOTREACHED() << "Impossible type mismatch"; | 239 NOTREACHED() << "Impossible type mismatch"; |
| 240 } | 240 } |
| 241 | 241 |
| 242 return ret_val; | 242 return ret_val; |
| 243 } | 243 } |
| OLD | NEW |