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

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

Issue 155004: Fix bookmark util crash (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « no previous file | no next file » | 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_utils_gtk.h" 5 #include "chrome/browser/gtk/bookmark_utils_gtk.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/gfx/gtk_util.h" 8 #include "base/gfx/gtk_util.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 GtkWidget* floating_button = gtk_chrome_button_new(); 96 GtkWidget* floating_button = gtk_chrome_button_new();
97 bookmark_utils::ConfigureButtonForNode(node, model, floating_button); 97 bookmark_utils::ConfigureButtonForNode(node, model, floating_button);
98 gtk_container_add(GTK_CONTAINER(frame), floating_button); 98 gtk_container_add(GTK_CONTAINER(frame), floating_button);
99 gtk_widget_show(floating_button); 99 gtk_widget_show(floating_button);
100 100
101 return window; 101 return window;
102 } 102 }
103 103
104 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, 104 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model,
105 GtkWidget* button) { 105 GtkWidget* button) {
106 GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(button));
107 if (former_child)
108 gtk_container_remove(GTK_CONTAINER(button), former_child);
109
106 std::string tooltip = BuildTooltipFor(node); 110 std::string tooltip = BuildTooltipFor(node);
107 if (!tooltip.empty()) 111 if (!tooltip.empty())
108 gtk_widget_set_tooltip_text(button, tooltip.c_str()); 112 gtk_widget_set_tooltip_text(button, tooltip.c_str());
109 113
110 // We pack the button manually (rather than using gtk_button_set_*) so that 114 // We pack the button manually (rather than using gtk_button_set_*) so that
111 // we can have finer control over its label. 115 // we can have finer control over its label.
112 GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model); 116 GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model);
113 GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); 117 GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf);
114 g_object_unref(pixbuf); 118 g_object_unref(pixbuf);
115 119
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 default: { 210 default: {
207 DLOG(ERROR) << "Unsupported drag received type: " << target_type; 211 DLOG(ERROR) << "Unsupported drag received type: " << target_type;
208 } 212 }
209 } 213 }
210 } 214 }
211 215
212 return std::vector<const BookmarkNode*>(); 216 return std::vector<const BookmarkNode*>();
213 } 217 }
214 218
215 } // namespace bookmark_utils 219 } // namespace bookmark_utils
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698