1 /* 2 * this file is part of the oxygen gtk engine 3 * Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or(at your option ) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free 17 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 18 * MA 02110-1301, USA. 19 */ 20 21 #include "oxygenmenuitemengine.h" 22 #include <iostream> 23 24 namespace Oxygen 25 { 26 27 //_______________________________________________________________ registerMenu(GtkWidget * parent)28 bool MenuItemEngine::registerMenu( GtkWidget* parent ) 29 { 30 31 // check widget 32 if( !GTK_IS_MENU( parent ) ) return false; 33 34 // keep track of added children 35 bool found( false ); 36 37 // get children 38 GList* children( gtk_container_get_children( GTK_CONTAINER( parent ) ) ); 39 for( GList *child = g_list_first( children ); child; child = g_list_next( child ) ) 40 { 41 if( !GTK_IS_MENU_ITEM( child->data ) ) continue; 42 GtkWidget* widget( gtk_bin_get_child( GTK_BIN( child->data ) ) ); 43 if( registerWidget( widget ) ) found = true; 44 } 45 46 // free list of children 47 if( children ) g_list_free( children ); 48 49 return found; 50 51 } 52 53 } 54