OLD | NEW |
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_custom_menu_item.h" | 5 #include "chrome/browser/ui/gtk/gtk_custom_menu_item.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "chrome/browser/ui/gtk/gtk_custom_menu.h" | 8 #include "chrome/browser/ui/gtk/gtk_custom_menu.h" |
9 | 9 |
10 // This method was autogenerated by the program glib-genmarshall, which | 10 // This method was autogenerated by the program glib-genmarshall, which |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 item_class->deselect = gtk_custom_menu_item_deselect; | 142 item_class->deselect = gtk_custom_menu_item_deselect; |
143 | 143 |
144 menu_item_class->activate = gtk_custom_menu_item_activate; | 144 menu_item_class->activate = gtk_custom_menu_item_activate; |
145 | 145 |
146 custom_menu_item_signals[BUTTON_PUSHED] = | 146 custom_menu_item_signals[BUTTON_PUSHED] = |
147 g_signal_new("button-pushed", | 147 g_signal_new("button-pushed", |
148 G_TYPE_FROM_CLASS(gobject_class), | 148 G_TYPE_FROM_CLASS(gobject_class), |
149 G_SIGNAL_RUN_FIRST, | 149 G_SIGNAL_RUN_FIRST, |
150 0, | 150 0, |
151 NULL, NULL, | 151 NULL, NULL, |
152 gtk_marshal_NONE__INT, | 152 g_cclosure_marshal_VOID__INT, |
153 G_TYPE_NONE, 1, GTK_TYPE_INT); | 153 G_TYPE_NONE, 1, G_TYPE_INT); |
154 custom_menu_item_signals[TRY_BUTTON_PUSHED] = | 154 custom_menu_item_signals[TRY_BUTTON_PUSHED] = |
155 g_signal_new("try-button-pushed", | 155 g_signal_new("try-button-pushed", |
156 G_TYPE_FROM_CLASS(gobject_class), | 156 G_TYPE_FROM_CLASS(gobject_class), |
157 G_SIGNAL_RUN_LAST, | 157 G_SIGNAL_RUN_LAST, |
158 0, | 158 0, |
159 NULL, NULL, | 159 NULL, NULL, |
160 chrome_marshall_BOOLEAN__INT, | 160 chrome_marshall_BOOLEAN__INT, |
161 G_TYPE_BOOLEAN, 1, GTK_TYPE_INT); | 161 G_TYPE_BOOLEAN, 1, G_TYPE_INT); |
162 } | 162 } |
163 | 163 |
164 static void gtk_custom_menu_item_finalize(GObject *object) { | 164 static void gtk_custom_menu_item_finalize(GObject *object) { |
165 GtkCustomMenuItem* item = GTK_CUSTOM_MENU_ITEM(object); | 165 GtkCustomMenuItem* item = GTK_CUSTOM_MENU_ITEM(object); |
166 g_list_free(item->all_widgets); | 166 g_list_free(item->all_widgets); |
167 g_list_free(item->button_widgets); | 167 g_list_free(item->button_widgets); |
168 | 168 |
169 G_OBJECT_CLASS(gtk_custom_menu_item_parent_class)->finalize(object); | 169 G_OBJECT_CLASS(gtk_custom_menu_item_parent_class)->finalize(object); |
170 } | 170 } |
171 | 171 |
172 static gint gtk_custom_menu_item_expose(GtkWidget* widget, | 172 static gint gtk_custom_menu_item_expose(GtkWidget* widget, |
173 GdkEventExpose* event) { | 173 GdkEventExpose* event) { |
174 if (gtk_widget_get_visible(widget) && | 174 if (gtk_widget_get_visible(widget) && |
175 GTK_WIDGET_MAPPED(widget) && | 175 gtk_widget_get_mapped(widget) && |
176 gtk_bin_get_child(GTK_BIN(widget))) { | 176 gtk_bin_get_child(GTK_BIN(widget))) { |
177 // We skip the drawing in the GtkMenuItem class it draws the highlighted | 177 // We skip the drawing in the GtkMenuItem class it draws the highlighted |
178 // background and we don't want that. | 178 // background and we don't want that. |
179 gtk_container_propagate_expose(GTK_CONTAINER(widget), | 179 gtk_container_propagate_expose(GTK_CONTAINER(widget), |
180 gtk_bin_get_child(GTK_BIN(widget)), | 180 gtk_bin_get_child(GTK_BIN(widget)), |
181 event); | 181 event); |
182 } | 182 } |
183 | 183 |
184 return FALSE; | 184 return FALSE; |
185 } | 185 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 gpointer callback_data) { | 479 gpointer callback_data) { |
480 // Even though we're filtering |all_widgets| on GTK_IS_BUTTON(), this isn't | 480 // Even though we're filtering |all_widgets| on GTK_IS_BUTTON(), this isn't |
481 // equivalent to |button_widgets| because we also want the button-labels. | 481 // equivalent to |button_widgets| because we also want the button-labels. |
482 for (GList* i = menu_item->all_widgets; i && GTK_IS_BUTTON(i->data); | 482 for (GList* i = menu_item->all_widgets; i && GTK_IS_BUTTON(i->data); |
483 i = g_list_next(i)) { | 483 i = g_list_next(i)) { |
484 if (GTK_IS_BUTTON(i->data)) { | 484 if (GTK_IS_BUTTON(i->data)) { |
485 callback(GTK_WIDGET(i->data), callback_data); | 485 callback(GTK_WIDGET(i->data), callback_data); |
486 } | 486 } |
487 } | 487 } |
488 } | 488 } |
OLD | NEW |