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

Side by Side Diff: chrome/browser/ui/gtk/gtk_floating_container.cc

Issue 7227027: GTK: More 2.18 goodness. Move from macros to real accessor functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove views/ Created 9 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 | « chrome/browser/ui/gtk/gtk_expanded_container.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gtk_floating_container.h" 5 #include "chrome/browser/ui/gtk/gtk_floating_container.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gtk/gtkmarshal.h> 8 #include <gtk/gtkmarshal.h>
9 #include <gtk/gtkprivate.h> 9 #include <gtk/gtkprivate.h>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Handle the other case where it's in our |floating_children| list. 140 // Handle the other case where it's in our |floating_children| list.
141 GtkFloatingContainer* floating = GTK_FLOATING_CONTAINER(container); 141 GtkFloatingContainer* floating = GTK_FLOATING_CONTAINER(container);
142 GList* children = floating->floating_children; 142 GList* children = floating->floating_children;
143 gboolean removed_child = false; 143 gboolean removed_child = false;
144 while (children) { 144 while (children) {
145 GtkFloatingContainerChild* child = 145 GtkFloatingContainerChild* child =
146 reinterpret_cast<GtkFloatingContainerChild*>(children->data); 146 reinterpret_cast<GtkFloatingContainerChild*>(children->data);
147 147
148 if (child->widget == widget) { 148 if (child->widget == widget) {
149 removed_child = true; 149 removed_child = true;
150 gboolean was_visible = GTK_WIDGET_VISIBLE(widget); 150 gboolean was_visible = gtk_widget_get_visible(GTK_WIDGET(widget));
151 151
152 gtk_widget_unparent(widget); 152 gtk_widget_unparent(widget);
153 153
154 floating->floating_children = 154 floating->floating_children =
155 g_list_remove_link(floating->floating_children, children); 155 g_list_remove_link(floating->floating_children, children);
156 g_list_free(children); 156 g_list_free(children);
157 g_free(child); 157 g_free(child);
158 158
159 if (was_visible && GTK_WIDGET_VISIBLE(container)) 159 if (was_visible && gtk_widget_get_visible(GTK_WIDGET(container)))
160 gtk_widget_queue_resize(GTK_WIDGET(container)); 160 gtk_widget_queue_resize(GTK_WIDGET(container));
161 161
162 break; 162 break;
163 } 163 }
164 children = children->next; 164 children = children->next;
165 } 165 }
166 166
167 g_return_if_fail(removed_child); 167 g_return_if_fail(removed_child);
168 } 168 }
169 } 169 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // to be. 229 // to be.
230 GtkFloatingContainer* container = GTK_FLOATING_CONTAINER(widget); 230 GtkFloatingContainer* container = GTK_FLOATING_CONTAINER(widget);
231 GList* children = container->floating_children; 231 GList* children = container->floating_children;
232 GtkAllocation child_allocation; 232 GtkAllocation child_allocation;
233 GtkRequisition child_requisition; 233 GtkRequisition child_requisition;
234 while (children) { 234 while (children) {
235 GtkFloatingContainerChild* child = 235 GtkFloatingContainerChild* child =
236 reinterpret_cast<GtkFloatingContainerChild*>(children->data); 236 reinterpret_cast<GtkFloatingContainerChild*>(children->data);
237 children = children->next; 237 children = children->next;
238 238
239 if (GTK_WIDGET_VISIBLE(child->widget)) { 239 if (gtk_widget_get_visible(GTK_WIDGET(child->widget))) {
240 gtk_widget_size_request(child->widget, &child_requisition); 240 gtk_widget_size_request(child->widget, &child_requisition);
241 child_allocation.x = allocation->x + child->x; 241 child_allocation.x = allocation->x + child->x;
242 child_allocation.y = allocation->y + child->y; 242 child_allocation.y = allocation->y + child->y;
243 child_allocation.width = std::max(1, std::min(child_requisition.width, 243 child_allocation.width = std::max(1, std::min(child_requisition.width,
244 allocation->width)); 244 allocation->width));
245 child_allocation.height = std::max(1, std::min(child_requisition.height, 245 child_allocation.height = std::max(1, std::min(child_requisition.height,
246 allocation->height)); 246 allocation->height));
247 gtk_widget_size_allocate(child->widget, &child_allocation); 247 gtk_widget_size_allocate(child->widget, &child_allocation);
248 } 248 }
249 } 249 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 child_info->x = 0; 311 child_info->x = 0;
312 child_info->y = 0; 312 child_info->y = 0;
313 313
314 gtk_widget_set_parent(widget, GTK_WIDGET(container)); 314 gtk_widget_set_parent(widget, GTK_WIDGET(container));
315 315
316 container->floating_children = 316 container->floating_children =
317 g_list_append(container->floating_children, child_info); 317 g_list_append(container->floating_children, child_info);
318 } 318 }
319 319
320 G_END_DECLS 320 G_END_DECLS
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_expanded_container.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698