| 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 <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 593 |
| 594 void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { | 594 void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { |
| 595 organize_is_for_left_ = left; | 595 organize_is_for_left_ = left; |
| 596 const BookmarkNode* parent = GetFolder(); | 596 const BookmarkNode* parent = GetFolder(); |
| 597 std::vector<const BookmarkNode*> nodes; | 597 std::vector<const BookmarkNode*> nodes; |
| 598 if (!left) | 598 if (!left) |
| 599 nodes = GetRightSelection(); | 599 nodes = GetRightSelection(); |
| 600 else if (parent) | 600 else if (parent) |
| 601 nodes.push_back(parent); | 601 nodes.push_back(parent); |
| 602 | 602 |
| 603 #if defined(TOOLKIT_GTK) |
| 603 // We DeleteSoon on the old one to give any reference holders (e.g. | 604 // We DeleteSoon on the old one to give any reference holders (e.g. |
| 604 // the event that caused this reset) a chance to release their refs. | 605 // the event that caused this reset) a chance to release their refs. |
| 605 BookmarkContextMenu* old_menu = organize_menu_.release(); | 606 BookmarkContextMenu* old_menu = organize_menu_.release(); |
| 606 if (old_menu) | 607 if (old_menu) |
| 607 MessageLoop::current()->DeleteSoon(FROM_HERE, old_menu); | 608 MessageLoop::current()->DeleteSoon(FROM_HERE, old_menu); |
| 608 | 609 |
| 609 organize_menu_.reset(new BookmarkContextMenu(window_, profile_, NULL, NULL, | 610 organize_menu_.reset(new BookmarkContextMenu(window_, profile_, NULL, NULL, |
| 610 parent, nodes, BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU, | 611 parent, nodes, BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU, |
| 611 NULL)); | 612 NULL)); |
| 612 #if defined(TOOLKIT_GTK) | |
| 613 gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->menu()); | 613 gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->menu()); |
| 614 #else | 614 #else |
| 615 // GTK+Views should implement this somehow. | 615 // GTK+Views should implement this somehow. |
| 616 NOTIMPLEMENTED(); | 616 NOTIMPLEMENTED(); |
| 617 #endif | 617 #endif |
| 618 } | 618 } |
| 619 | 619 |
| 620 void BookmarkManagerGtk::BuildLeftStore() { | 620 void BookmarkManagerGtk::BuildLeftStore() { |
| 621 GtkTreeIter select_iter; | 621 GtkTreeIter select_iter; |
| 622 bookmark_utils::AddToTreeStore(model_, | 622 bookmark_utils::AddToTreeStore(model_, |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 default: | 1299 default: |
| 1300 break; | 1300 break; |
| 1301 } | 1301 } |
| 1302 } else if (key->keyval == GDK_Delete) { | 1302 } else if (key->keyval == GDK_Delete) { |
| 1303 command = IDS_BOOKMARK_BAR_REMOVE; | 1303 command = IDS_BOOKMARK_BAR_REMOVE; |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 if (command == -1) | 1306 if (command == -1) |
| 1307 return FALSE; | 1307 return FALSE; |
| 1308 | 1308 |
| 1309 #if defined(TOOLKIT_GTK) |
| 1309 if (bm->organize_menu_.get() && | 1310 if (bm->organize_menu_.get() && |
| 1310 bm->organize_menu_->IsCommandEnabled(command)) { | 1311 bm->organize_menu_->IsCommandEnabled(command)) { |
| 1311 bm->organize_menu_->ExecuteCommand(command); | 1312 bm->organize_menu_->ExecuteCommand(command); |
| 1312 return TRUE; | 1313 return TRUE; |
| 1313 } | 1314 } |
| 1315 #else |
| 1316 NOTIMPLEMENTED(); |
| 1317 #endif |
| 1314 | 1318 |
| 1315 return FALSE; | 1319 return FALSE; |
| 1316 } | 1320 } |
| 1317 | 1321 |
| 1318 // static | 1322 // static |
| 1319 void BookmarkManagerGtk::OnFolderNameEdited(GtkCellRendererText* render, | 1323 void BookmarkManagerGtk::OnFolderNameEdited(GtkCellRendererText* render, |
| 1320 gchar* path, gchar* new_folder_name, BookmarkManagerGtk* bm) { | 1324 gchar* path, gchar* new_folder_name, BookmarkManagerGtk* bm) { |
| 1321 // A folder named was edited in place. Sync the change to the bookmark | 1325 // A folder named was edited in place. Sync the change to the bookmark |
| 1322 // model. | 1326 // model. |
| 1323 GtkTreeIter iter; | 1327 GtkTreeIter iter; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 modifier & gtk_accelerator_get_default_mod_mask()); | 1443 modifier & gtk_accelerator_get_default_mod_mask()); |
| 1440 // The only accelerator we have registered is ctrl+w, so any other value is a | 1444 // The only accelerator we have registered is ctrl+w, so any other value is a |
| 1441 // non-fatal error. | 1445 // non-fatal error. |
| 1442 DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); | 1446 DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); |
| 1443 DCHECK_EQ(modifier, GDK_CONTROL_MASK); | 1447 DCHECK_EQ(modifier, GDK_CONTROL_MASK); |
| 1444 | 1448 |
| 1445 gtk_widget_destroy(bookmark_manager->window_); | 1449 gtk_widget_destroy(bookmark_manager->window_); |
| 1446 | 1450 |
| 1447 return TRUE; | 1451 return TRUE; |
| 1448 } | 1452 } |
| OLD | NEW |