Changeset 1641
- Timestamp:
- 04/03/07 00:16:12 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-menu-box.c
r987 r1641 1 1 /* 2 2 * libmokoui -- OpenMoko Application Framework UI Library 3 * 3 * 4 4 * Authored by Michael 'Mickey' Lauer <mlauer@vanille-media.de> 5 * 5 * 6 6 * Copyright (C) 2006-2007 OpenMoko Inc. 7 * 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU Lesser Public License as published by 10 10 * the Free Software Foundation; version 2 of the license. 11 * 11 * 12 12 * This program is distributed in the hope that it will be useful, 13 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 15 * GNU Lesser Public License for more details. 16 * 16 * 17 17 * Current Version: $Rev$ ($Date$) [$Author$] 18 18 */ … … 86 86 } 87 87 88 void moko_menu_box_clear(MokoMenuBox *f) /* Destruction */88 void moko_menu_box_clear(MokoMenuBox* f) /* Destruction */ 89 89 { 90 90 /* destruct your widgets here */ … … 142 142 } 143 143 144 static void cb_menu_size_request( GtkWidget* widget, GtkRequisition* requisition, MokoMenuBox* self ) 145 { 146 // force popup menus to open with a certain width as per designer's request. See bug #130 147 GtkAllocation* a = &( GTK_WIDGET(self) )->allocation; 148 moko_debug( "size request of menu = %d / %d -- forcing width to %d", requisition->width, requisition->height, a->width / 2.5 ); 149 if ( requisition->width != a->width / 2.5 ) 150 requisition->width = a->width / 2.5; 151 } 152 144 153 void moko_menu_box_set_application_menu(MokoMenuBox* self, GtkMenu* menu) 145 154 { … … 156 165 GtkWidget* appitem = gtk_image_menu_item_new_with_label( g_get_application_name() ); 157 166 GtkWidget* appicon = gtk_image_new_from_stock( "openmoko-application-menu-icon", GTK_ICON_SIZE_MENU ); 158 gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM (appitem), appicon );167 gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(appitem), appicon ); 159 168 gtk_widget_set_name( GTK_WIDGET(appitem), "transparent" ); 160 169 priv->appitem = appitem; 161 priv->appmenu = GTK_WIDGET (menu); 162 gtk_menu_item_set_submenu( GTK_MENU_ITEM (appitem), GTK_WIDGET (menu) ); 163 gtk_menu_shell_append( GTK_MENU_SHELL (priv->menubar_l), appitem ); 170 priv->appmenu = GTK_WIDGET(menu); 171 g_signal_connect( G_OBJECT(menu), "size-request", G_CALLBACK(cb_menu_size_request), self ); 172 gtk_menu_item_set_submenu( GTK_MENU_ITEM(appitem), GTK_WIDGET(menu) ); 173 gtk_menu_shell_append( GTK_MENU_SHELL(priv->menubar_l), appitem ); 164 174 165 175 //FIXME hack to popup the first menu if user clicks on menubar … … 178 188 gtk_widget_set_name( priv->menubar_r, "mokomenubox-filter-menubar" ); 179 189 gtk_box_pack_end( GTK_BOX(self), priv->menubar_r, TRUE, TRUE, 0 ); 180 190 181 191 filtitem = gtk_image_menu_item_new_with_label( "Filter Menu" ); 182 192 GtkWidget* filticon = gtk_image_new_from_stock( "openmoko-filter-menu-icon", GTK_ICON_SIZE_MENU ); 183 gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM (filtitem), filticon );193 gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(filtitem), filticon ); 184 194 gtk_widget_set_name( filtitem, "transparent" ); 185 195 priv->filteritem = filtitem; 186 priv->filtermenu = GTK_WIDGET (menu); 187 gtk_menu_shell_append( GTK_MENU_SHELL (priv->menubar_r), priv->filteritem ); 188 gtk_menu_item_set_submenu( GTK_MENU_ITEM (priv->filteritem), priv->filtermenu ); 196 priv->filtermenu = GTK_WIDGET(menu); 197 g_signal_connect( G_OBJECT(menu), "size-request", G_CALLBACK(cb_menu_size_request), self ); 198 gtk_menu_shell_append( GTK_MENU_SHELL(priv->menubar_r), priv->filteritem ); 199 gtk_menu_item_set_submenu( GTK_MENU_ITEM(priv->filteritem), priv->filtermenu ); 189 200 } 190 201 priv->filtermenu = GTK_WIDGET (menu);
Note: See TracChangeset
for help on using the changeset viewer.
