KnotsPlayer::~KnotsPlayer()
{
#if defined(Q_WS_MAEMO_5)
    osso_deinitialize( _ossoContext );
#endif
    delete _properties;
}
Exemple #2
0
int deinitializeApp() {
	
	//Cleanup the gobject mainloop
	if (mainLoopObj != NULL) {
		g_main_loop_unref(mainLoopObj);
		mainLoopObj = NULL;
	}
	
	//Clean up the osso stuff
	if (ossoAppContext != NULL) {
		osso_rpc_unset_cb_f(ossoAppContext, DBUS_FMRADIO_SERVICE, DBUS_FMRADIO_PATH, DBUS_FMRADIO_INTERFACE, dbus_req_handler, NULL);
		
		//Cleanup the osso context itself
		osso_deinitialize(ossoAppContext);
		ossoAppContext = NULL;
	}
	
	if (radioObj != NULL) {
		radio_close(radioObj);
		free(radioObj);
	}
	
	if(fileExists(LOCKFILE)) {
		remove(LOCKFILE);
	}

	return 1;
}
Exemple #3
0
void blanking_deinit(void)
{
	if (!osso_ctx)
		return;
	blanking_control(FALSE);
	osso_deinitialize(osso_ctx);
	osso_ctx = NULL;
}
static void launcher_navigator_applet_finalize(GObject *object)
{
    LauncherNavigatorAppletPrivate *info = LAUNCHER_NAVIGATOR_APPLET_GET_PRIVATE(object);

    osso_deinitialize(info->osso);

    LOG_CLOSE();

    G_OBJECT_CLASS(g_type_class_peek_parent(G_OBJECT_GET_CLASS(object)))->finalize(object);
}
NS_IMETHODIMP
nsNativeAppSupportQt::Stop(bool* aResult)
{
  NS_ENSURE_ARG(aResult);
  *aResult = true;

#if (MOZ_PLATFORM_MAEMO == 5)
  if (m_osso_context) {
    osso_deinitialize(m_osso_context);
    m_osso_context = nsnull;
  }
#endif

  return NS_OK;
}
Exemple #6
0
void terminateEgl()
{
    eglMakeCurrent(ctx.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    eglDestroySurface(ctx.dpy, ctx.surface);
    eglDestroyContext(ctx.dpy, ctx.context);
    eglTerminate(ctx.dpy);
    nativeDestroyWindow(ctx.nativeDisplay, ctx.win);
    nativeDestroyDisplay(ctx.nativeDisplay);

#if defined(HAVE_LIBOSSO)
    if (ossoContext)
    {
        osso_deinitialize(ossoContext);
        ossoContext = 0;
    }
#endif
}
void switcher_button_dispose(GObject *gobject)
{
    SwitcherButton *self = SWITCHER_BUTTON(gobject);

    if (self->priv->gconfClient)
    {
        gconf_client_notify_remove(self->priv->gconfClient, self->priv->gconfNotifyCurrent);
        gconf_client_notify_remove(self->priv->gconfClient, self->priv->gconfNotifyLang0);
        gconf_client_notify_remove(self->priv->gconfClient, self->priv->gconfNotifyLang1);

        if (self->priv->model == N800 || self->priv->model == N810)
            gconf_client_remove_dir(self->priv->gconfClient, GCONF_DIR_2008, 0);
        else if (self->priv->model == N770)
            gconf_client_remove_dir(self->priv->gconfClient, GCONF_DIR_2006, 0);

        gconf_client_notify_remove(self->priv->gconfClient, self->priv->gconfNotifyLock);
        gconf_client_remove_dir(self->priv->gconfClient, GCONF_LOCK_DIR, 0);

        g_object_unref(self->priv->gconfClient);
        self->priv->gconfClient = 0;
    }

    if (self->priv->menu)
    {
        g_object_unref(self->priv->menu);
        g_object_unref(self->priv->menuItemCopy);
        g_object_unref(self->priv->menuItemBlock);
        self->priv->menu = 0;
    }

    if (self->priv->osso)
    {
        osso_deinitialize(self->priv->osso);
        self->priv->osso = 0;
    }

    G_OBJECT_CLASS(switcher_button_parent_class)->dispose(gobject);
}
static void
hcp_program_finalize (GObject *object)
{
  HCPProgram *program;
  
  g_return_if_fail (object);
  g_return_if_fail (HCP_IS_PROGRAM (object));

  program = HCP_PROGRAM (object);

  if (program->al != NULL) 
  {
    g_object_unref (program->al);
    program->al = NULL;
  }

  if (program->osso)
  {
      osso_deinitialize (program->osso);
  }

  G_OBJECT_CLASS (hcp_program_parent_class)->finalize (object);
}
NS_IMETHODIMP
nsNativeAppSupportUnix::Stop(bool *aResult)
{
  NS_ENSURE_ARG(aResult);
  *aResult = true;

#if (MOZ_PLATFORM_MAEMO == 5)
  if (m_osso_context) {
    // Disable the accelerometer when closing
    OssoRequestAccelerometer(m_osso_context, false);

    // Remove the MCE callback filter
    DBusConnection *connnection = (DBusConnection*)osso_get_sys_dbus_connection(m_osso_context);
    dbus_connection_remove_filter(connnection, OssoModeControlCallback, nullptr);

    osso_hw_unset_event_cb(m_osso_context, nullptr);
    osso_rpc_unset_default_cb_f(m_osso_context, OssoDbusCallback, nullptr);
    osso_deinitialize(m_osso_context);
    m_osso_context = nullptr;
  }
#endif
  return NS_OK;
}
Exemple #10
0
/*---------------------------------------------------------------------*/
int
main( int argc, char *argv[] ) {
   /* Initialize the GTK. */
   gtk_init( &argc, &argv );

   /* read the user configuration */
   hop_read_param();
   
   /* Create the main GUI */
   make_hop_gui();

   /* Initialize dbus */
   osso_init();
   
   /* Prepare the data structure for subprocess I/O */
   init_hop_io();

   /* Add signal listener to button */
   run_hop();

   /* Begin the main application */
   gtk_widget_show_all( GTK_WIDGET( win ) );

   /* Connect signal to X in the upper corner */
   g_signal_connect( G_OBJECT( win ), "delete_event",
		     G_CALLBACK( cleanup ), NULL );

   gtk_main();

   /* We are done */
   kill_hop();
   osso_deinitialize( osso_context );
   
   /* Exit */
   return 0;
}
Exemple #11
0
/*****************************************************************************
 * Destroy: destroy omapfb video thread output method
 *****************************************************************************
 * Terminate an output method created by Create
 *****************************************************************************/
static void Destroy( vlc_object_t *p_this )
{
    vout_thread_t *p_vout = (vout_thread_t *)p_this;

    CloseDisplay( p_vout );

    if( p_vout->p_sys->b_embed )
    {
        vout_ReleaseWindow( p_vout->p_sys->owner_window );
        if( p_vout->b_fullscreen )
            XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
        XCloseDisplay( p_vout->p_sys->p_display );
    }

#ifdef HAVE_OSSO
    if ( p_vout->p_sys->p_octx != NULL ) {
        msg_Dbg( p_vout, "Deinitializing osso context" );
        osso_deinitialize( p_vout->p_sys->p_octx );
    }
#endif

    /* Destroy structure */
    free( p_vout->p_sys );
}
Exemple #12
0
/**
 * Deinitialize OSSO context and remove registred SDL timer
 **/
static void OssoDeinitialize(void)
{
	SDL_RemoveTimer(timer);
	osso_deinitialize(osso);
}
void ZLMaemoCommunicationManager::shutdown() {
	osso_deinitialize(myContext);
	myContext = 0;
}
Exemple #14
0
int main (int argc, char **argv)
{
struct timeval timer;
gchar buffer[PATH_MAX];

GUI *appGUI = NULL;
CHART *chr = NULL;
STATISTICS *sts = NULL;
TEST *tst = NULL;
OPTIONS *opt = NULL;
#ifdef MAEMO
osso_context_t *osso_context = NULL;

    /* initialize maemo application */
    osso_context = osso_initialize(APP_NAME, APP_VER, TRUE, NULL);
    
    if (osso_context == NULL) {
        fprintf (stderr, "osso_initialize failed.\n");
        exit (1);
    }
#endif

    appGUI = g_new0 (GUI, 1);
    g_return_val_if_fail (appGUI != NULL, -1);

    chr = g_new0 (CHART, 1);
    g_return_val_if_fail (chr != NULL, -1);
    sts = g_new0 (STATISTICS, 1);
    g_return_val_if_fail (sts != NULL, -1);
    tst = g_new0 (TEST, 1);
    g_return_val_if_fail (tst != NULL, -1);

    opt = g_new0 (OPTIONS, 1);
    g_return_val_if_fail (opt != NULL, -1);

    /* register modules */
    appGUI->chr = chr;
    appGUI->sts = sts;
    appGUI->tst = tst;
    appGUI->opt = opt;

    /* default values */
    appGUI->old_kana_type = -1;
    appGUI->chr->chart_window = NULL;
    appGUI->tst->any_key = FALSE;
    appGUI->tst->test_state = FALSE;
    appGUI->sts->active_tab = -1;
    appGUI->opt->active_tab = -1;

    /* preferences update */

    g_snprintf (buffer, PATH_MAX, "%s%c%s", g_get_home_dir(), G_DIR_SEPARATOR, CONFIG_DIRNAME);

    if (g_file_test(buffer, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) != TRUE) {
        prefs_read_config (CONFIG_FILENAME_OLD, CONFIG_DIRNAME_OLD);
        prefs_write_config (CONFIG_FILENAME, CONFIG_DIRNAME);
        if (g_file_test(prefs_get_config_filename (STATS_FILENAME_OLD, CONFIG_DIRNAME_OLD), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) == TRUE) {
            stats_read_list (STATS_FILENAME_OLD, CONFIG_DIRNAME_OLD, appGUI);
        }
        stats_write_list (STATS_FILENAME, CONFIG_DIRNAME, appGUI);
    }

    prefs_read_config (CONFIG_FILENAME, CONFIG_DIRNAME);
    stats_read_list (STATS_FILENAME, CONFIG_DIRNAME, appGUI);

    /* init */
#ifdef MAEMO
    hildon_gtk_init (&argc, &argv);
#else
    gtk_init (&argc, &argv);
#endif
    setlocale (LC_ALL, "");

#if defined(WIN32) || defined(WIN64)
    /* Set the locale directory as subdirectory of application path */
    char WINLOCALEDIR[MAX_PATH];
    strcpy(WINLOCALEDIR, g_path_get_dirname(argv[0]));
    strcat(WINLOCALEDIR, "\\share\\locale");

    bindtextdomain (PACKAGE, WINLOCALEDIR);
#else
    bindtextdomain (PACKAGE, LOCALEDIR);
#endif
    bind_textdomain_codeset (PACKAGE, "UTF-8");
    textdomain (PACKAGE);

    /* set seed */
    gettimeofday(&timer, NULL);

#if defined(WIN32) || defined(WIN64)
    srand((long)time(NULL));
#else
    srand48(timer.tv_usec + getpid());
#endif

#ifdef MAEMO
    show_splash_screen ();
#endif
    gui_create_window (appGUI);
    gtk_main ();

    stats_write_list (STATS_FILENAME, CONFIG_DIRNAME, appGUI);
    stats_free_list (appGUI);

    prefs_write_config (CONFIG_FILENAME, CONFIG_DIRNAME);

    g_free (opt);
    g_free (tst);
    g_free (sts);
    g_free (chr);
    g_free (appGUI);
#ifdef MAEMO
    /* deinitialize OSSO */
    osso_deinitialize (osso_context);
#endif
    return 0;
}
Exemple #15
0
/*---------------------------------------------------------------------*/
void cleanup() {
   kill_hop();
   osso_deinitialize( osso_context );
   gtk_main_quit();
}
Exemple #16
0
int
main(int argc,
     char* argv[])
{
    // Init Gtk
    Gtk::Main mainLoop(&argc, &argv);
    
    // Init Hildon
    Hildon::init();

    Glib::set_application_name(APP_NAME);
    
    // Init osso context
    osso_context_t* ossoContext = osso_initialize("wmgui-maemo",
                                                  APP_VERSION,
                                                  true,
                                                  NULL);

    if (!ossoContext) {
        std::cerr << "Initializing osso context failed" << std::endl;
        exit(1);
    }

    if (!Glib::thread_supported()) {
        Glib::thread_init(NULL);
    }

    gdk_threads_init();
    gdk_threads_enter();

    // Parse Options
    int c = 0;
    while ((c = getopt(argc, argv, OPTSTRING)) != -1) {
        switch (c) {
            case 'h': {
                std::cout << USAGE;
                return 0;
                break;
            }
            case '?': {
                exit(1);
                break;
            }
            default: {
                std::cout << "Unknown command-line option: -" << c << std::endl;
                break;
            }
        }
    }

    // Get Wiimote handler
    WiimoteHandler* wiimoteHandler = WiimoteHandler::GetInstance();
    if (!wiimoteHandler) {
        std::cerr << "Didn't get wiimote handler" << std::endl;
        exit(1);
    }

    // BDADDR
    char* strAddr = NULL;
    bdaddr_t* bdAddr = wiimoteHandler->GetBdAddr();
    if (!bdAddr) {
        std::cerr << "Didn't get bdaddr pointer from wiimote handler" << std::endl;
        exit(1);
    }

    if (optind < argc) {
        if (str2ba(argv[optind], bdAddr)) {
            std::cout << "Invalid bdaddr" << std::endl;
            bacpy(bdAddr, BDADDR_ANY);
        }
        optind++;
        if (optind < argc) {
            std::cerr << "Invalid command-line" << std::endl;
            std::cerr << USAGE;
            exit(1);
        }
    } else if ((strAddr = getenv (WIIMOTE_BDADDR)) != NULL) {
        if (str2ba (strAddr, bdAddr)) {
            std::cout << "Invalid address in " << WIIMOTE_BDADDR << std::endl;
            bacpy(bdAddr, BDADDR_ANY);
        }
    } else {
        bacpy(bdAddr, BDADDR_ANY);
    }

    // Create our window
    MainWindow mainWindow;
    Hildon::Program::get_instance()->add_window(mainWindow);

    // Start cwiid background search for Wiimotes
    cwiid_start_background_seach(&WiimoteHandler::CWiidBackgrounSearchCallback);

    // Run Gtk main loop
    mainLoop.run(mainWindow);

    // Clean-up
    cwiid_stop_background_searh();
    WiimoteHandler::Release();
    osso_deinitialize(ossoContext);
    gdk_threads_leave();

    return 0;
}