OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/bookmark_manager_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_manager_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 nodes.push_back(parent); | 510 nodes.push_back(parent); |
511 | 511 |
512 // We DeleteSoon on the old one to give any reference holders (e.g. | 512 // We DeleteSoon on the old one to give any reference holders (e.g. |
513 // the event that caused this reset) a chance to release their refs. | 513 // the event that caused this reset) a chance to release their refs. |
514 BookmarkContextMenu* old_menu = organize_menu_.release(); | 514 BookmarkContextMenu* old_menu = organize_menu_.release(); |
515 if (old_menu) | 515 if (old_menu) |
516 MessageLoop::current()->DeleteSoon(FROM_HERE, old_menu); | 516 MessageLoop::current()->DeleteSoon(FROM_HERE, old_menu); |
517 | 517 |
518 organize_menu_.reset(new BookmarkContextMenu(window_, profile_, NULL, NULL, | 518 organize_menu_.reset(new BookmarkContextMenu(window_, profile_, NULL, NULL, |
519 parent, nodes, BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU)); | 519 parent, nodes, BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU)); |
| 520 #if defined(TOOLKIT_GTK) |
520 gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->menu()); | 521 gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->menu()); |
| 522 #else |
| 523 // GTK+Views should implement this somehow. |
| 524 NOTIMPLEMENTED(); |
| 525 #endif |
521 } | 526 } |
522 | 527 |
523 void BookmarkManagerGtk::BuildLeftStore() { | 528 void BookmarkManagerGtk::BuildLeftStore() { |
524 GtkTreeIter select_iter; | 529 GtkTreeIter select_iter; |
525 bookmark_utils::AddToTreeStore(model_, | 530 bookmark_utils::AddToTreeStore(model_, |
526 model_->GetBookmarkBarNode()->id(), left_store_, &select_iter); | 531 model_->GetBookmarkBarNode()->id(), left_store_, &select_iter); |
527 gtk_tree_selection_select_iter(left_selection(), &select_iter); | 532 gtk_tree_selection_select_iter(left_selection(), &select_iter); |
528 | 533 |
529 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 534 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
530 gtk_tree_store_append(left_store_, &select_iter, NULL); | 535 gtk_tree_store_append(left_store_, &select_iter, NULL); |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 // The drag adds a ref; let it own the list. | 1109 // The drag adds a ref; let it own the list. |
1105 gtk_target_list_unref(targets); | 1110 gtk_target_list_unref(targets); |
1106 } | 1111 } |
1107 | 1112 |
1108 return FALSE; | 1113 return FALSE; |
1109 } | 1114 } |
1110 | 1115 |
1111 // static | 1116 // static |
1112 gboolean BookmarkManagerGtk::OnTreeViewButtonRelease(GtkWidget* tree_view, | 1117 gboolean BookmarkManagerGtk::OnTreeViewButtonRelease(GtkWidget* tree_view, |
1113 GdkEventButton* button, BookmarkManagerGtk* bm) { | 1118 GdkEventButton* button, BookmarkManagerGtk* bm) { |
| 1119 #if defined(TOOLKIT_GTK) |
1114 if (button->button == 3) | 1120 if (button->button == 3) |
1115 bm->organize_menu_->PopupAsContext(button->time); | 1121 bm->organize_menu_->PopupAsContext(button->time); |
| 1122 #else |
| 1123 // Implement on GTK+views. |
| 1124 NOTIMPLEMENTED(); |
| 1125 #endif |
1116 | 1126 |
1117 if (bm->delaying_mousedown_ && (tree_view == bm->right_tree_view_)) { | 1127 if (bm->delaying_mousedown_ && (tree_view == bm->right_tree_view_)) { |
1118 gtk_propagate_event(tree_view, | 1128 gtk_propagate_event(tree_view, |
1119 reinterpret_cast<GdkEvent*>(&bm->mousedown_event_)); | 1129 reinterpret_cast<GdkEvent*>(&bm->mousedown_event_)); |
1120 bm->delaying_mousedown_ = false; | 1130 bm->delaying_mousedown_ = false; |
1121 } | 1131 } |
1122 | 1132 |
1123 return FALSE; | 1133 return FALSE; |
1124 } | 1134 } |
1125 | 1135 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 } else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) { | 1183 } else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) { |
1174 if (g_browser_process->io_thread()) { | 1184 if (g_browser_process->io_thread()) { |
1175 bookmark_html_writer::WriteBookmarks( | 1185 bookmark_html_writer::WriteBookmarks( |
1176 g_browser_process->io_thread()->message_loop(), model_, | 1186 g_browser_process->io_thread()->message_loop(), model_, |
1177 path.ToWStringHack()); | 1187 path.ToWStringHack()); |
1178 } | 1188 } |
1179 } else { | 1189 } else { |
1180 NOTREACHED(); | 1190 NOTREACHED(); |
1181 } | 1191 } |
1182 } | 1192 } |
OLD | NEW |