| 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 "views/controls/combobox/native_combobox_gtk.h" | 5 #include "views/controls/combobox/native_combobox_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Get the menu item's label. | 174 // Get the menu item's label. |
| 175 std::string name; | 175 std::string name; |
| 176 GList* children = gtk_container_get_children(GTK_CONTAINER(menu_item)); | 176 GList* children = gtk_container_get_children(GTK_CONTAINER(menu_item)); |
| 177 for (GList* l = g_list_first(children); l != NULL; l = g_list_next(l)) { | 177 for (GList* l = g_list_first(children); l != NULL; l = g_list_next(l)) { |
| 178 GtkWidget* child = static_cast<GtkWidget*>(l->data); | 178 GtkWidget* child = static_cast<GtkWidget*>(l->data); |
| 179 if (GTK_IS_CELL_VIEW(child)) { | 179 if (GTK_IS_CELL_VIEW(child)) { |
| 180 GtkCellView* cell_view = GTK_CELL_VIEW(child); | 180 GtkCellView* cell_view = GTK_CELL_VIEW(child); |
| 181 GtkTreePath* path = gtk_cell_view_get_displayed_row(cell_view); | 181 GtkTreePath* path = gtk_cell_view_get_displayed_row(cell_view); |
| 182 GtkTreeModel* model = NULL; | 182 GtkTreeModel* model = NULL; |
| 183 #if GTK_CHECK_VERSION(2, 16, 0) | |
| 184 model = gtk_cell_view_get_model(cell_view); | 183 model = gtk_cell_view_get_model(cell_view); |
| 185 #else | |
| 186 g_object_get(cell_view, "model", &model, NULL); | |
| 187 #endif | |
| 188 GtkTreeIter iter; | 184 GtkTreeIter iter; |
| 189 if (model && gtk_tree_model_get_iter(model, &iter, path)) { | 185 if (model && gtk_tree_model_get_iter(model, &iter, path)) { |
| 190 GValue value = { 0 }; | 186 GValue value = { 0 }; |
| 191 gtk_tree_model_get_value(model, &iter, 0, &value); | 187 gtk_tree_model_get_value(model, &iter, 0, &value); |
| 192 name = g_value_get_string(&value); | 188 name = g_value_get_string(&value); |
| 193 break; | 189 break; |
| 194 } | 190 } |
| 195 } | 191 } |
| 196 } | 192 } |
| 197 | 193 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 224 | 220 |
| 225 // static | 221 // static |
| 226 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 222 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 227 Combobox* combobox) { | 223 Combobox* combobox) { |
| 228 if (Widget::IsPureViews()) | 224 if (Widget::IsPureViews()) |
| 229 return new NativeComboboxViews(combobox); | 225 return new NativeComboboxViews(combobox); |
| 230 return new NativeComboboxGtk(combobox); | 226 return new NativeComboboxGtk(combobox); |
| 231 } | 227 } |
| 232 | 228 |
| 233 } // namespace views | 229 } // namespace views |
| OLD | NEW |