Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/browser/gtk/bookmark_manager_gtk.cc

Issue 1029004: GTK: implement extension bookmark manager drag api.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.cc ('k') | chrome/browser/gtk/bookmark_utils_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // The default width of a column in the right tree view. Since we set the 54 // The default width of a column in the right tree view. Since we set the
55 // columns to ellipsize, if we don't explicitly set a width they will be 55 // columns to ellipsize, if we don't explicitly set a width they will be
56 // wide enough to display only '...'. This will be overridden if the user 56 // wide enough to display only '...'. This will be overridden if the user
57 // resizes the column. 57 // resizes the column.
58 const int kDefaultColumnWidth = 200; 58 const int kDefaultColumnWidth = 200;
59 59
60 // The destination targets that the right tree view accepts for dragging. 60 // The destination targets that the right tree view accepts for dragging.
61 const int kDestTargetList[] = { gtk_dnd_util::CHROME_BOOKMARK_ITEM, -1 }; 61 const int kDestTargetList[] = { gtk_dnd_util::CHROME_BOOKMARK_ITEM, -1 };
62 62
63 // The source targets that the right tree view supports for dragging.
64 const int kSourceTargetMask = gtk_dnd_util::CHROME_BOOKMARK_ITEM |
65 gtk_dnd_util::TEXT_URI_LIST |
66 gtk_dnd_util::TEXT_PLAIN |
67 gtk_dnd_util::NETSCAPE_URL;
68
69 // We only have one manager open at a time. 63 // We only have one manager open at a time.
70 BookmarkManagerGtk* manager = NULL; 64 BookmarkManagerGtk* manager = NULL;
71 65
72 // Observer installed on the importer. When done importing the newly created 66 // Observer installed on the importer. When done importing the newly created
73 // folder is selected in the bookmark manager. 67 // folder is selected in the bookmark manager.
74 // This class is taken almost directly from BookmarkManagerView and should be 68 // This class is taken almost directly from BookmarkManagerView and should be
75 // kept in sync with it. 69 // kept in sync with it.
76 class ImportObserverImpl : public ImportObserver { 70 class ImportObserverImpl : public ImportObserver {
77 public: 71 public:
78 explicit ImportObserverImpl(Profile* profile) : profile_(profile) { 72 explicit ImportObserverImpl(Profile* profile) : profile_(profile) {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 g_signal_connect(right_tree_view_, "key-press-event", 546 g_signal_connect(right_tree_view_, "key-press-event",
553 G_CALLBACK(OnTreeViewKeyPress), this); 547 G_CALLBACK(OnTreeViewKeyPress), this);
554 548
555 // GDK_ACTION_MOVE is necessary to reorder bookmarks within the 549 // GDK_ACTION_MOVE is necessary to reorder bookmarks within the
556 // right tree. COPY and LINK are necessary for drags to the 550 // right tree. COPY and LINK are necessary for drags to the
557 // Gnome desktop (nautilus). 551 // Gnome desktop (nautilus).
558 gtk_drag_source_set(right_tree_view_, GDK_BUTTON1_MASK, NULL, 0, 552 gtk_drag_source_set(right_tree_view_, GDK_BUTTON1_MASK, NULL, 0,
559 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY | 553 static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY |
560 GDK_ACTION_LINK)); 554 GDK_ACTION_LINK));
561 gtk_dnd_util::SetSourceTargetListFromCodeMask( 555 gtk_dnd_util::SetSourceTargetListFromCodeMask(
562 right_tree_view_, kSourceTargetMask); 556 right_tree_view_, bookmark_utils::GetCodeMask(false));
563 557
564 // We connect to drag dest signals, but we don't actually enable the widget 558 // We connect to drag dest signals, but we don't actually enable the widget
565 // as a drag destination unless it corresponds to the contents of a folder. 559 // as a drag destination unless it corresponds to the contents of a folder.
566 // See BuildRightStore(). 560 // See BuildRightStore().
567 g_signal_connect(right_tree_view_, "drag-data-get", 561 g_signal_connect(right_tree_view_, "drag-data-get",
568 G_CALLBACK(&OnRightTreeViewDragGet), this); 562 G_CALLBACK(&OnRightTreeViewDragGet), this);
569 g_signal_connect(right_tree_view_, "drag-data-received", 563 g_signal_connect(right_tree_view_, "drag-data-received",
570 G_CALLBACK(&OnRightTreeViewDragReceived), this); 564 G_CALLBACK(&OnRightTreeViewDragReceived), this);
571 g_signal_connect(right_tree_view_, "drag-motion", 565 g_signal_connect(right_tree_view_, "drag-motion",
572 G_CALLBACK(&OnRightTreeViewDragMotion), this); 566 G_CALLBACK(&OnRightTreeViewDragMotion), this);
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 if (!bm->delaying_mousedown_) 1288 if (!bm->delaying_mousedown_)
1295 return FALSE; 1289 return FALSE;
1296 1290
1297 if (gtk_drag_check_threshold(tree_view, 1291 if (gtk_drag_check_threshold(tree_view,
1298 static_cast<gint>(bm->mousedown_event_.x), 1292 static_cast<gint>(bm->mousedown_event_.x),
1299 static_cast<gint>(bm->mousedown_event_.y), 1293 static_cast<gint>(bm->mousedown_event_.y),
1300 static_cast<gint>(event->x), 1294 static_cast<gint>(event->x),
1301 static_cast<gint>(event->y))) { 1295 static_cast<gint>(event->y))) {
1302 bm->delaying_mousedown_ = false; 1296 bm->delaying_mousedown_ = false;
1303 GtkTargetList* targets = gtk_dnd_util::GetTargetListFromCodeMask( 1297 GtkTargetList* targets = gtk_dnd_util::GetTargetListFromCodeMask(
1304 kSourceTargetMask); 1298 bookmark_utils::GetCodeMask(false));
1305 gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE, 1299 gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE,
1306 1, reinterpret_cast<GdkEvent*>(event)); 1300 1, reinterpret_cast<GdkEvent*>(event));
1307 // The drag adds a ref; let it own the list. 1301 // The drag adds a ref; let it own the list.
1308 gtk_target_list_unref(targets); 1302 gtk_target_list_unref(targets);
1309 } 1303 }
1310 1304
1311 return FALSE; 1305 return FALSE;
1312 } 1306 }
1313 1307
1314 // static 1308 // static
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 username); 1549 username);
1556 } else if (sync_service_->SetupInProgress()) { 1550 } else if (sync_service_->SetupInProgress()) {
1557 status_label = l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS); 1551 status_label = l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
1558 } else { 1552 } else {
1559 status_label = l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL); 1553 status_label = l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
1560 } 1554 }
1561 GtkWidget* sync_status_label = gtk_bin_get_child(GTK_BIN(sync_status_menu_)); 1555 GtkWidget* sync_status_label = gtk_bin_get_child(GTK_BIN(sync_status_menu_));
1562 gtk_label_set_label(GTK_LABEL(sync_status_label), 1556 gtk_label_set_label(GTK_LABEL(sync_status_label),
1563 UTF16ToUTF8(status_label).c_str()); 1557 UTF16ToUTF8(status_label).c_str());
1564 } 1558 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.cc ('k') | chrome/browser/gtk/bookmark_utils_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698