int main( int argc, char **argv ) { new CScene; new TextureMgr; GtkWidget* table; GdkGLConfig* GLconf; GdkGLContext* GLContext; GtkWidget* v_box; gtk_init( &argc, &argv ); gtk_gl_init( &argc, &argv ); da = gtk_drawing_area_new(); GLconf = gdk_gl_config_new_by_mode( (GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE) ); if( !( GLconf ) || !( gtk_widget_set_gl_capability( da, GLconf, NULL, TRUE, GDK_GL_RGBA_TYPE ) ) ) g_assert_not_reached(); g_signal_connect_after( G_OBJECT( da ), "realize", G_CALLBACK( realize_main ), NULL ); g_signal_connect( da, "configure_event", G_CALLBACK( configure ), NULL ); g_signal_connect( da, "expose_event", G_CALLBACK( expose ), NULL ); gtk_widget_show( da ); gtk_widget_realize( da ); //GLContext = gtk_widget_get_gl_context( da ); g_signal_connect_after( G_OBJECT( da ), "realize", G_CALLBACK( realize_sub ), NULL ); g_signal_connect( da, "configure_event", G_CALLBACK( configure ), NULL ); g_signal_connect( da, "expose_event", G_CALLBACK( expose ), NULL ); g_signal_connect( G_OBJECT( da ), "motion_notify_event", G_CALLBACK( mouse_motion_cb ), (gpointer)Window ); g_signal_connect( G_OBJECT( da ), "button_press_event", G_CALLBACK( mouse_click_cb ), (gpointer)Window ); g_signal_connect( G_OBJECT( da ), "button_release_event", G_CALLBACK( mouse_click_cb ), (gpointer)Window ); g_signal_connect( G_OBJECT( da ), "scroll_event", G_CALLBACK( mouse_scroll_cb ), (gpointer)Window ); g_signal_connect( G_OBJECT( da ), "key_press_event", G_CALLBACK( keyPress ), (gpointer)Window ); gtk_widget_show ( da ); Window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); /// WINDOW gtk_window_set_default_size( GTK_WINDOW(Window), 800, 500 ); gtk_window_set_title (GTK_WINDOW (Window), "Stilewski's Plant Generator"); gtk_window_set_position (GTK_WINDOW (Window), GTK_WIN_POS_CENTER); g_signal_connect_swapped( Window, "destroy", G_CALLBACK( gtk_main_quit ), NULL ); v_box = gtk_vbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( Window ), v_box ); gtk_box_pack_start( GTK_BOX( v_box ), construct_menu(), TRUE, TRUE, 0 ); /// MAIN MENU table = gtk_table_new( 16, 16, FALSE ); /// TABLE gtk_table_set_col_spacing( GTK_TABLE(table), 11, 8 ); gtk_table_set_row_spacing( GTK_TABLE(table), 13, 8 ); gtk_table_attach_defaults( GTK_TABLE(table), da, 0, 12, 0, 14 ); /// DRAWING AREA gtk_table_attach_defaults( GTK_TABLE(table), construct_side_panel(), 12, 16, 0, 16 ); /// SIDE PANEL gtk_table_attach_defaults( GTK_TABLE(table), construct_bottom_panel(), 0, 12, 14, 16 ); /// BOTTOM PANEL gtk_box_pack_start( GTK_BOX( v_box ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( v_box ), construct_statusbar(), TRUE, TRUE, 0 ); /// STATUS BAR gtk_widget_set_events ( da, GDK_EXPOSURE_MASK | GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_KEY_PRESS_MASK ); gtk_toggle_button_set_mode( GTK_TOGGLE_BUTTON( checkBoxRandom ), TRUE ); gtk_widget_show( Window ); plant = new CPlant(); InitGL(); gtk_widget_show_all( Window ); g_timeout_add( 1000 / 60, applyChanges, da ); gtk_main(); }
int main (int argc, char **argv) { MyApp *app; GOptionContext *context; GError *error = NULL; bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); context = g_option_context_new (N_("- Manage your mobile phone")); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) { g_error ("Couldn't parse options: %s", error->message); g_error_free (error); g_option_context_free (context); return 1; } g_option_context_free (context); if (version != FALSE) { g_print (_("gnome-phone-manager version %s\n"), VERSION); return 0; } if (bdaddr_ident != NULL) { phonemgr_utils_tell_driver (bdaddr_ident); return 0; } if (bdaddr_config != NULL) { phonemgr_utils_write_gnokii_config (bdaddr_config); return 0; } gconf_init (argc, argv, NULL); app = g_new0 (MyApp, 1); /* Setup the D-Bus object */ app->object = g_object_new (phonemgr_object_get_type (), NULL); app->client = gconf_client_get_default (); gconf_client_add_dir (app->client, CONFBASE, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); /* Setup the listener */ app->listener = phonemgr_listener_new (debug); initialise_connection (app); ui_init (app); construct_menu (app); tray_icon_init (app); reconnect_phone (app); gtk_main (); tray_icon_hide (app); ui_hide (app); free_connection (app); g_object_unref (app->listener); g_object_unref (app->client); g_object_unref (app->object); g_free (app); return 0; }