Exemplo n.º 1
0
KnotsPlayer::KnotsPlayer( QObject *parent )
    : QObject( parent )
    , _status( Stopped )
    , _tickPeriod( KOneSecond )
    , _tickCount( 0 )
    , _properties( 0 )
{
    _properties = new KnotsPlayerProperties;
    _propertiesUpdateTimer = new QTimer();
    _backlightTimer = new QTimer();

    Knots::instance().setPlayer( this );

    _propertiesUpdateTimer->setSingleShot(false);

    connect(_propertiesUpdateTimer, SIGNAL(timeout()), this, SLOT( updateTimeout()));

    connect(_backlightTimer, SIGNAL(timeout()), this, SLOT(onBacklightTimer()));

    connect( _properties, SIGNAL(propertiesUpdated()), this, SLOT(networkPropertiesUpdated()));

    connect( &Knots::instance().serverConnection(), SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));

    connect( this, SIGNAL(stateChanged(KnotsPlayer::PlayingState)), Knots::instance().mainWindow(), SLOT(onPlayerStateChange(KnotsPlayer::PlayingState)));

#if defined(Q_WS_MAEMO_5)
    _ossoContext = osso_initialize("QtKnots","1.0",true, 0);
#endif

}
Exemplo n.º 2
0
/**
 * Initialize OSSO context, needed for calling OSSO functions.
 * Create SDL timer for calling OssoKeepBacklightAlive every 50s.
 **/
static void OssoInitialize(void)
{
	char *application;

	if (FullGameName.empty()) {
		application = strdup("org.stratagus");
	} else {
		application = (char *)calloc(FullGameName.size() + 15, 1);
		strcpy(application, "org.stratagus.");
		for (int i = 0; i < FullGameName.size(); i++) {
			application[i + 14] = tolower(FullGameName[i]);
		}
	}

	osso = osso_initialize(application, VERSION, TRUE, NULL);

	free(application);

	if (!osso) {
		fprintf(stderr, "Couldn't initialize OSSO\n");
		exit(OSSO_ERROR);
	}

	timer = SDL_AddTimer(50000, OssoKeepBacklightAlive, NULL);

	if (!timer) {
		fprintf(stderr, "Couldn't initialize SDL_AddTimer: %s\n", SDL_GetError());
		exit(1);
	}
}
Exemplo n.º 3
0
int 
dbus_init(processor_config_t *config)
{
	int ret = -1;

	LOG_DEBUG("Initing dbus..\n");
	
#ifdef CONFIG_MAEMOEXTS_ENABLED
	osso_return_t result;
	ASSERT_TRUE(osso_context = osso_initialize("org.p2pship.p2pship_libosso",
						   "0.0.1", TRUE, NULL), err);
	
	/* Add handler for session bus D-BUS messages */
	result = osso_rpc_set_cb_f(osso_context, 
				   "org.p2pship.p2pship_libosso", 
				   "/org/p2pship/p2pship_libosso", 
				   "org.p2pship.p2pship_libosso",
				   dbus_req_handler, osso_context);
	
	ASSERT_TRUE(result == OSSO_OK, err);
#endif
	ASSERT_TRUE(1, err);
	ret = 0;
 err:
	return ret;
}
static void launcher_navigator_applet_init(LauncherNavigatorApplet *applet)
{
    LauncherNavigatorAppletPrivate *info = LAUNCHER_NAVIGATOR_APPLET_GET_PRIVATE(applet);

    ULOG_OPEN("launcher-statusbar-applet");

    g_return_if_fail(info);

    info->icon = gtk_image_new_from_pixbuf(NULL);
    info->button = gtk_toggle_button_new();

    set_applet_icon("qgn_grid_tasknavigator_others", info);
    
    gtk_widget_set_name (info->button, "hildon-navigator-button-one");

    gtk_container_add(GTK_CONTAINER(info->button),
                      GTK_WIDGET(info->icon));

    gtk_container_add(GTK_CONTAINER(applet), info->button);

    /* Signal for icon (button) */
    g_signal_connect(G_OBJECT(info->button), "button-press-event",
                     G_CALLBACK(applet_icon_pressed), info);

    /* Initialize osso */
    info->osso = osso_initialize("org.telescope.LauncherApplet", "0.1", TRUE, NULL);
    if (!info->osso)
        ULOG_WARN("%s: error while initializing osso\n", __FUNCTION__);

    gtk_widget_show_all(GTK_WIDGET(applet));
}
Exemplo n.º 5
0
/*---------------------------------------------------------------------*/
int
osso_init() {
   osso_return_t result;
   AppData *appdata;
   
   /* Initialize maemo application */
   osso_context = osso_initialize( "hop_launcher", HOP_RELEASE, TRUE, NULL );

   /* Check that initialization was ok */
   if( osso_context == NULL ) {
      return OSSO_ERROR;
   }
   
   /* Create AppData */
   appdata = g_new0( AppData, 1 );
   appdata->program = program;
   appdata->window = win;
   appdata->osso_context = osso_context;

   /* Add handler for session bus D-BUS messages */
   result = osso_rpc_set_cb_f( appdata->osso_context, 
                               OSSO_HOP_SERVICE, 
                               OSSO_HOP_OBJECT, 
                               OSSO_HOP_IFACE,
                               dbus_req_handler, appdata );

   if( result != OSSO_OK ) {
      g_print( "Error setting D-BUS callback (%d)\n", result );
      return OSSO_ERROR;
   }

   return OSSO_OK;
}
Exemplo n.º 6
0
int main(int argc, char *argv[]) {
  GtkWidget *main_window;

  gtk_set_locale();
  gtk_init(&argc, &argv);

  main_window = create_main_window();

#ifdef USE_HILDON
  HildonProgram *app = HILDON_PROGRAM(hildon_program_get_instance());
  g_set_application_name("SmallBASIC");
  output.osso = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
  hildon_program_add_window(app, HILDON_WINDOW(main_window));
#endif

  drawing_area_init(main_window);
  gtk_widget_show_all(GTK_WIDGET(main_window));
  g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(destroy_event), NULL);

  // prepare runtime flags
  opt_graphics = 1;
  opt_quiet = 1;
  opt_interactive = 0;
  opt_nosave = 1;
  opt_ide = IDE_NONE;           // for sberr.c
  opt_command[0] = 0;
  opt_pref_width = 0;
  opt_pref_height = 0;
  opt_pref_bpp = 0;

  if (argc == 2 && access(argv[1], R_OK) == 0) {
    sbasic_main(argv[1]);
  }

  GtkWidget *dialog = create_opendialog();
  while (1) {
    gtk_widget_show(dialog);
    gtk_window_set_title(GTK_WINDOW(dialog), "Open BAS File");
    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
      char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
      const char *p = strrchr(filename, '/');
      gtk_window_set_title(GTK_WINDOW(main_window), p ? p + 1 : filename);
      gtk_widget_hide(dialog);
      sbasic_main(filename);
      g_free(filename);
    } else {
      break;
    }
  }
  gtk_widget_destroy(dialog);
  om_cleanup();
  return 0;
}
Exemplo n.º 7
0
void ZLMaemoCommunicationManager::init() {
	myContext = osso_initialize(ZLibrary::ApplicationName().c_str(), "0.0", false, 0);
	osso_rpc_set_cb_f_with_free(
		myContext,
		("com.nokia." + ZLibrary::ApplicationName()).c_str(),
		("com/nokia/" + ZLibrary::ApplicationName()).c_str(),
		("com.nokia." + ZLibrary::ApplicationName()).c_str(),
		::onMessageReceived,
		this,
		(osso_rpc_retval_free_f*)osso_rpc_free_val
	);
}
Exemplo n.º 8
0
void blanking_init(void)
{
	/* It's enough to initialize it once for a process. */
	if (osso_ctx)
		return;
	osso_ctx = osso_initialize(PACKAGE, VERSION, 0, NULL);
	if (!osso_ctx)
		g_warning("osso_initialize failed, screen may go black");
        is_blanking_prohibited = FALSE;
        /* Default policy is to allow user to control blanking */
        blanking_control(TRUE);
}
Exemplo n.º 9
0
NS_IMETHODIMP
nsNativeAppSupportQt::Start(bool* aRetVal)
{
  NS_ASSERTION(gAppData, "gAppData must not be null.");

#ifdef MOZ_ENABLE_QMSYSTEM2
  connect(&mActivity, SIGNAL(activityChanged(MeeGo::QmActivity::Activity)), this, SLOT(activityChanged(MeeGo::QmActivity::Activity)));
  connect(&mDeviceMode, SIGNAL(deviceModeChanged(MeeGo::QmDeviceMode::DeviceMode)), this, SLOT(deviceModeChanged(MeeGo::QmDeviceMode::DeviceMode)));
  connect(&mDisplayState, SIGNAL(displayStateChanged(MeeGo::QmDisplayState::DisplayState)), this, SLOT(displayStateChanged(MeeGo::QmDisplayState::DisplayState)));
  // Init states withing next event loop iteration
  QTimer::singleShot(0, this, SLOT(RefreshStates()));
#endif

  *aRetVal = true;
#ifdef MOZ_ENABLE_LIBCONIC
  g_type_init();
#endif

#if (MOZ_PLATFORM_MAEMO == 5)
  /* Initialize maemo application

     The initalization name will be of the form "Vendor.Name".
     If a Vendor isn't given, then we will just use "Name".

     Note that this value must match your X-Osso-Service name
     defined in your desktop file.  If it doesn't, the OSSO
     system will happily kill your process.
  */
  nsCAutoString applicationName;
  if (gAppData->vendor) {
      applicationName.Append(gAppData->vendor);
      applicationName.Append(".");
  }
  applicationName.Append(gAppData->name);
  ToLowerCase(applicationName);

  m_osso_context = osso_initialize(applicationName.get(),
                                   gAppData->version ? gAppData->version : "1.0",
                                   true,
                                   nsnull);

  /* Check that initilialization was ok */
  if (m_osso_context == nsnull) {
      return NS_ERROR_FAILURE;
  }
#endif

  return NS_OK;
}
Exemplo n.º 10
0
Arquivo: omapfb.c Projeto: Kafay/vlc
/*****************************************************************************
 * Create: allocates omapfb video thread output method
 *****************************************************************************
 * This function allocates and initializes a FB vout method.
 *****************************************************************************/
static int Create( vlc_object_t *p_this )
{
    vout_thread_t *p_vout = (vout_thread_t *)p_this;
    vout_sys_t    *p_sys;

    if( p_vout->fmt_in.i_chroma != VLC_CODEC_I420 &&
        p_vout->fmt_in.i_chroma != VLC_CODEC_YV12 )
        return VLC_EGENERIC;

    /* Allocate instance and initialize some members */
    p_vout->p_sys = p_sys = calloc( 1, sizeof( vout_sys_t ) );
    if( p_vout->p_sys == NULL )
        return VLC_ENOMEM;

    p_vout->pf_init = Init;
    p_vout->pf_end = End;
    p_vout->pf_manage = Manage;
    p_vout->pf_render = NULL;
    p_vout->pf_display = DisplayVideo;
    p_vout->pf_control = Control;

    p_sys->b_embed = var_CreateGetInteger( p_vout, "omap-embedded" );
    p_sys->b_video_enabled = true;

    if( OpenDisplay( p_vout ) )
    {
        free( p_vout->p_sys );
        return VLC_EGENERIC;
    }

    if( InitWindow( p_vout ) )
    {
        free( p_vout->p_sys );
        return VLC_EGENERIC;
    }

#ifdef HAVE_OSSO
    p_vout->p_sys->i_backlight_on_counter = i_backlight_on_interval;
    p_vout->p_sys->p_octx = osso_initialize( "vlc", VERSION, 0, NULL );
    if ( p_vout->p_sys->p_octx == NULL ) {
        msg_Err( p_vout, "Could not get osso context" );
    } else {
        msg_Dbg( p_vout, "Initialized osso context" );
    }
#endif

    return VLC_SUCCESS;
}
Exemplo n.º 11
0
int main (int argc, char *argv[])
{
	osso_context_t* ctx = NULL;
	gtk_init (&argc, &argv);
	main_window = create_main_window ();
	ctx = osso_initialize("org.maemo.mpuzzle", "1.7", TRUE, NULL);
	if (ctx == NULL) {
		g_print("Failed to init LibOSSO\n");
		return 0;
	}
	g_print("LibOSSO Init done\n");
				
	gtk_widget_show_all (main_window);
	gtk_main ();
	return 0;
}
Exemplo n.º 12
0
static void 
hcp_program_init_rpc (HCPProgram *program)
{
  g_return_if_fail (program);
  g_return_if_fail (HCP_IS_PROGRAM (program));

  program->osso = osso_initialize (HCP_APP_NAME, HCP_APP_VERSION, TRUE, NULL);
  
  if (!program->osso)
  {
    g_warning ("Error initializing osso -- check that D-BUS is running");
    exit(-1);
  }

  osso_rpc_set_default_cb_f (program->osso,
                     (osso_rpc_cb_f *) hcp_program_rpc_handler,
                     program);
}
Exemplo n.º 13
0
int initializeApp() {
	osso_return_t result;	//Return value from libosso calls
	
	osso_hw_state_t stateFlags;	//Stuct to indicate which hwStates we want to watch for
	
	
	//Setup stateFlags to monitor only inactivity (since we want to exit and free up memory if system goes inactive)
	stateFlags.system_inactivity_ind = TRUE;
	
	
	//Define signal handlers for abort/kill to clean things up incase somethign bad happens
    (void) signal(SIGINT,sig_leave);
    (void) signal(SIGTERM, sig_leave);



	
	//****************** GObject loop setup ***************//
	
	mainLoopObj = g_main_loop_new(NULL, FALSE);		//Create the main loop for the app
	
	//****************** Done GObject loop setup **********//
	
	ossoAppContext = osso_initialize(DBUS_FMRADIO_SERVICE, "1.0", FALSE, NULL);
	
	if (ossoAppContext == NULL) {
		printf("Failed to initialize libosso!\r\n");
		return 0;
	}
	
	//Set up DBUS listening
	result = osso_rpc_set_cb_f(ossoAppContext, DBUS_FMRADIO_SERVICE, DBUS_FMRADIO_PATH, DBUS_FMRADIO_INTERFACE, dbus_req_handler, NULL);
	
	//Setup inactivity monitor
	//Okay got the libosso setup, so establish the callback for the hardware state changes
	result = osso_hw_set_event_cb(ossoAppContext, &stateFlags, systemActivityChange, NULL);
	
	//Create the radio Obj
	radioObj = (RadioDescriptor *) malloc(sizeof(RadioDescriptor));
	radioObj->radio_fd = -1;
	radio_open(radioObj);
	
	return 1;
}
Exemplo n.º 14
0
void
gui_mode(int argc,
	 char *argv[]) {

  osso_context_t *osso_context;
  char *versionstring;
  AppData *appdata = g_new(AppData, 1);
  appdata->runmode = GUI;


  gtk_init(&argc, &argv);

  /* register OSSO service */
  osso_context = osso_initialize(NAME, VERSION, TRUE, NULL);
  if (! osso_context)
    fprintf(stderr, "Could not initialize OSSO.");

  appdata->playlist = playlist_new();
  appdata->decoder = decoder_new();
  appdata->stream = NULL;
  appdata->gui = gui_new(appdata->playlist);

  versionstring = g_strconcat(FULLNAME, " ", VERSION, NULL);
  gui_set_title(appdata->gui, "", versionstring, "");
  g_free(versionstring);

  /* setup callbacks */
  playlist_set_play_cb(appdata->playlist, play_cb, (void *) appdata);

  /* setup GUI callbacks */
  gui_set_open_cb(appdata->gui, open_cb, (void *) appdata);
  gui_set_volume_cb(appdata->gui, volume_cb, (void *) appdata);
  gui_set_seek_cb(appdata->gui, seek_cb, (void *) appdata);
  gui_set_control_cb(appdata->gui, control_cb, (void *) appdata);

  g_timeout_add(500, (GSourceFunc) status_cb, appdata);

  gui_run();

}
Exemplo n.º 15
0
void switcher_button_init(SwitcherButton *self)
{
    self->priv = SWITCHER_BUTTON_GET_PRIVATE(self);

    self->priv->osso = osso_initialize("layoutswitcher", VERSION, 0, 0);

    self->priv->model = tabletModel();

    switch (self->priv->model)
    {
        case N800:
            printf("800\n");
            break;
        case N810:
            printf("810\n");
            break;
        case N900:
            printf("900\n");
            break;
        case N770:
            printf("770\n");
            break;
    }

    self->priv->locked = 0;

    self->priv->theme = gtk_icon_theme_get_default();
    self->priv->lock = gtk_icon_theme_load_icon(self->priv->theme, "layoutswitcher-lock", 40, (GtkIconLookupFlags)0, 0);

    self->priv->icon0 = 0;
    self->priv->icon1 = 0;

    self->priv->gconfClient = gconf_client_get_default();

	if (self->priv->model == N800 || self->priv->model == N810)
	{
		gconf_client_add_dir(self->priv->gconfClient, GCONF_DIR_2008, GCONF_CLIENT_PRELOAD_NONE, 0);

		self->priv->gconfNotifyCurrent = gconf_client_notify_add(self->priv->gconfClient,
				GCONF_CURRENT_2008, switcher_button_on_current_changed, self, 0, 0);
		self->priv->gconfNotifyLang0 = gconf_client_notify_add(self->priv->gconfClient,
				GCONF_LANG0_2008, switcher_button_on_language_changed, self, 0, 0);
		self->priv->gconfNotifyLang1 = gconf_client_notify_add(self->priv->gconfClient,
				GCONF_LANG1_2008, switcher_button_on_language_changed, self, 0, 0);
	}
	else if (self->priv->model == N770)
	{
		gconf_client_add_dir(self->priv->gconfClient, GCONF_DIR_2006, GCONF_CLIENT_PRELOAD_NONE, 0);

		self->priv->gconfNotifyCurrent = gconf_client_notify_add(self->priv->gconfClient,
				GCONF_CURRENT_2006, switcher_button_on_current_changed, self, 0, 0);
		self->priv->gconfNotifyLang0 = gconf_client_notify_add(self->priv->gconfClient,
				GCONF_LANG0_2006, switcher_button_on_language_changed, self, 0, 0);
		self->priv->gconfNotifyLang1 = gconf_client_notify_add(self->priv->gconfClient,
				GCONF_LANG1_2006, switcher_button_on_language_changed, self, 0, 0);
	}

    gconf_client_add_dir(self->priv->gconfClient, GCONF_LOCK_DIR, GCONF_CLIENT_PRELOAD_NONE, 0);
    self->priv->gconfNotifyLock = gconf_client_notify_add(self->priv->gconfClient,
        GCONF_LOCK_ENTRY, switcher_button_on_lock_changed, self, 0, 0);

    self->priv->menu = gtk_menu_new();
    self->priv->menuItemCopy = gtk_menu_item_new_with_label("Copy text");
    self->priv->menuItemBlock= gtk_check_menu_item_new_with_label("Block keyboard");
    g_signal_connect(G_OBJECT(self->priv->menuItemCopy), "activate", G_CALLBACK(switcher_button_on_copy_menu), self);
    g_signal_connect(G_OBJECT(self->priv->menuItemBlock), "activate", G_CALLBACK(switcher_button_on_block_menu), self);
    gtk_menu_shell_append(GTK_MENU_SHELL(self->priv->menu), self->priv->menuItemCopy);
    gtk_menu_shell_append(GTK_MENU_SHELL(self->priv->menu), self->priv->menuItemBlock);
    gtk_widget_show_all(self->priv->menu);

    g_signal_connect(G_OBJECT(self), "clicked", G_CALLBACK(switcher_button_on_click), 0);

    if (self->priv->model == N770)
    {
        g_signal_connect(G_OBJECT(self), "tap-and-hold", G_CALLBACK(switcher_button_on_tap_and_hold), 0);
        gtk_widget_tap_and_hold_setup(GTK_WIDGET(self), 0, 0, 0);
    }
    else
    {
    //    g_signal_connect(G_OBJECT(self), "tap-and-hold", G_CALLBACK(switcher_button_on_tap_and_hold), 0);
        gtk_widget_tap_and_hold_setup(GTK_WIDGET(self), self->priv->menu, 0, 0);
    }

    g_signal_connect_after(G_OBJECT(self), "expose-event", G_CALLBACK(switcher_button_on_expose), 0);

    switcher_button_update_languages(self);
}
Exemplo n.º 16
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;
}
Exemplo n.º 17
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;
}
Exemplo n.º 18
0
bool initializeEgl(int width, int height, const EGLint* configAttrs, const EGLint* contextAttrs)
{
    EGLint configCount = 0;

#if defined(HAVE_LIBOSSO)
    ossoContext = osso_initialize("com.nokia.memperf", "1.0", FALSE, NULL);
    if (!ossoContext)
    {
        printf("Warning: osso_initialize failed\n");
    }
#endif

    ctx.dpy = eglGetDisplay(ctx.nativeDisplay);
    ASSERT_EGL();

    eglInitialize(ctx.dpy, NULL, NULL);
    eglChooseConfig(ctx.dpy, configAttrs, &ctx.config, 1, &configCount);
    ASSERT_EGL();

    if (!configCount)
    {
        printf("Config not found\n");
        goto out_error;
    }

    if (options.verbose)
    {
        printf("Config attributes:\n");
        dumpConfig(ctx.dpy, ctx.config);
    }

    if (!nativeCreateWindow(ctx.nativeDisplay, ctx.dpy, ctx.config, __FILE__,
                            width, height, &ctx.win))
    {
        printf("Unable to create a window\n");
        goto out_error;
    }

    ctx.context = eglCreateContext(ctx.dpy, ctx.config, EGL_NO_CONTEXT, contextAttrs);
    ASSERT_EGL();
    if (!ctx.context)
    {
        printf("Unable to create a context\n");
        goto out_error;
    }

    ctx.surface = eglCreateWindowSurface(ctx.dpy, ctx.config, ctx.win, NULL);
    ASSERT_EGL();
    if (!ctx.surface)
    {
        printf("Unable to create a surface\n");
        goto out_error;
    }

    eglMakeCurrent(ctx.dpy, ctx.surface, ctx.surface, ctx.context);
    ASSERT_EGL();

    eglSwapInterval(ctx.dpy, 0);
    return true;

out_error:
    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);
    return false;
}
Exemplo n.º 19
0
int main(int argc, char *argv[])
#endif
{
	int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1;
	char *opt_user_arg = NULL, *opt_login_arg = NULL;
	char *opt_session_arg = NULL, *opt_config_dir_arg = NULL;
#ifdef ENABLE_HILDON
	char *plugin_search_paths[4];
#else
    char *plugin_search_paths[3];
#endif

#if HAVE_SIGNAL_H
	int sig_indx;	/* for setting up signal catching */
	sigset_t sigset;
	void (*prev_sig_disp)();
#endif
	int opt, opt_user = 0;
	int i;
	gboolean gui_check;
	gchar *gaimrc, *accountsxml;

	struct option long_options[] = {
		{"acct", no_argument, NULL, 'a'},
		/*{"away", optional_argument, NULL, 'w'}, */
		{"help", no_argument, NULL, 'h'},
		/*{"login", optional_argument, NULL, 'l'}, */
		{"loginwin", no_argument, NULL, 'n'},
		{"user", required_argument, NULL, 'u'},
		{"config", required_argument, NULL, 'c'},
		{"debug", no_argument, NULL, 'd'},
		{"version", no_argument, NULL, 'v'},
		{"session", required_argument, NULL, 's'},
		{0, 0, 0, 0}
	};

#ifdef DEBUG
	opt_debug = 1;
#endif
#ifndef _WIN32
	br_set_locate_fallback_func(gaim_find_binary_location, argv[0]);
#endif
#ifdef ENABLE_NLS
	bindtextdomain(PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(PACKAGE, "UTF-8");
	textdomain(PACKAGE);
#endif

#if HAVE_SIGNAL_H
	/* Let's not violate any PLA's!!!! */
	/* jseymour: whatever the fsck that means */
	/* Robot101: for some reason things like gdm like to block     *
	 * useful signals like SIGCHLD, so we unblock all the ones we  *
	 * declare a handler for. thanks JSeymour and Vann.            */
	if (sigemptyset(&sigset)) {
		char errmsg[BUFSIZ];
		snprintf(errmsg, BUFSIZ, "Warning: couldn't initialise empty signal set");
		perror(errmsg);
	}
	for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) {
		if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) {
			char errmsg[BUFSIZ];
			snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d for catching",
				catch_sig_list[sig_indx]);
			perror(errmsg);
		}
		if(sigaddset(&sigset, catch_sig_list[sig_indx])) {
			char errmsg[BUFSIZ];
			snprintf(errmsg, BUFSIZ, "Warning: couldn't include signal %d for unblocking",
				catch_sig_list[sig_indx]);
			perror(errmsg);
		}
	}
	for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) {
		if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) {
			char errmsg[BUFSIZ];
			snprintf(errmsg, BUFSIZ, "Warning: couldn't set signal %d to ignore",
				ignore_sig_list[sig_indx]);
			perror(errmsg);
		}
	}

	if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) {
		char errmsg[BUFSIZ];
		snprintf(errmsg, BUFSIZ, "Warning: couldn't unblock signals");
		perror(errmsg);
	}		
#endif

	for (i = 0; i < argc; i++) {
		/* --login option */
		if (strstr(argv[i], "--l") == argv[i]) {
			char *equals;
			opt_login = 1;
			if ((equals = strchr(argv[i], '=')) != NULL) {
				/* --login=NAME */
				opt_login_arg = g_strdup(equals + 1);
				if (strlen(opt_login_arg) == 0) {
					g_free(opt_login_arg);
					opt_login_arg = NULL;
				}
			} else if (i + 1 < argc && argv[i + 1][0] != '-') {
				/* --login NAME */
				opt_login_arg = g_strdup(argv[i + 1]);
				strcpy(argv[i + 1], " ");
			}
			strcpy(argv[i], " ");
		}
		/* -l option */
		else if (strstr(argv[i], "-l") == argv[i]) {
			opt_login = 1;
			if (strlen(argv[i]) > 2) {
				/* -lNAME */
				opt_login_arg = g_strdup(argv[i] + 2);
			} else if (i + 1 < argc && argv[i + 1][0] != '-') {
				/* -l NAME */
				opt_login_arg = g_strdup(argv[i + 1]);
				strcpy(argv[i + 1], " ");
			}
			strcpy(argv[i], " ");
		}
		/* --away option */
		else if (strstr(argv[i], "--aw") == argv[i]) {
			char *equals;
			opt_away = 1;
			if ((equals = strchr(argv[i], '=')) != NULL) {
				/* --away=MESG */
				opt_away_arg = g_strdup(equals + 1);
				if (strlen(opt_away_arg) == 0) {
					g_free(opt_away_arg);
					opt_away_arg = NULL;
				}
			} else if (i + 1 < argc && argv[i + 1][0] != '-') {
				/* --away MESG */
				opt_away_arg = g_strdup(argv[i + 1]);
				strcpy(argv[i + 1], " ");
			}
			strcpy(argv[i], " ");
		}
		/* -w option */
		else if (strstr(argv[i], "-w") == argv[i]) {
			opt_away = 1;
			if (strlen(argv[i]) > 2) {
				/* -wMESG */
				opt_away_arg = g_strdup(argv[i] + 2);
			} else if (i + 1 < argc && argv[i + 1][0] != '-') {
				/* -w MESG */
				opt_away_arg = g_strdup(argv[i + 1]);
				strcpy(argv[i + 1], " ");
			}
			strcpy(argv[i], " ");
		}
	}
	/*
	   if (opt_login) {
	   printf ("--login given with arg %s\n",
	   opt_login_arg ? opt_login_arg : "NULL");
	   exit(0);
	   }
	 */

	gui_check = gtk_init_check(&argc, &argv);

	/* scan command-line options */
	opterr = 1;
	while ((opt = getopt_long(argc, argv,
#ifndef _WIN32
				  "adhu:c:vns:", 
#else
				  "adhu:c:vn", 
#endif
				  long_options, NULL)) != -1) {
		switch (opt) {
		case 'u':	/* set user */
			opt_user = 1;
			opt_user_arg = g_strdup(optarg);
			break;
		case 'a':	/* account editor */
			opt_acct = 1;
			break;
		case 'd':	/* debug */
			opt_debug = 1;
			break;
		case 'c':	/* use specified config dir */
			set_gaim_user_dir(optarg);
			opt_config_dir_arg = g_strdup(optarg);
			break;
		case 's':	/* use existing session ID */
			opt_session_arg = g_strdup(optarg);
			break;
		case 'v':	/* version */
			opt_version = 1;
			break;
		case 'h':	/* help */
			opt_help = 1;
			break;
		case 'n':       /* don't autologin */
			opt_nologin = 1;
			break;
		case '?':
		default:
			show_usage(1, argv[0]);
			return 0;
			break;
		}
	}

	/* show help message */
	if (opt_help) {
		show_usage(0, argv[0]);
		return 0;
	}
	/* show version message */
	if (opt_version) {
		printf("Gaim %s\n",VERSION);
		return 0;
	}

	if (!gui_check) {
		char *display = gdk_get_display();

		g_warning("cannot open display: %s", display ? display : "unset");
		g_free(display);

		return 1;
	}

#ifdef _WIN32
        wgaim_init(hint);
#endif
	gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops());
	gaim_eventloop_set_ui_ops(gaim_gtk_eventloop_get_ui_ops());
#ifdef ENABLE_HILDON
    app = hildon_app_new();
    hildon_app_set_two_part_title(HILDON_APP(app), TRUE);
    hildon_app_set_title(HILDON_APP(app), _("Gaim"));
    hildon_app_set_autoregistration(HILDON_APP(app), TRUE);
    /* I will catch the key events here to change views */
    g_signal_connect(G_OBJECT(app), "key_press_event", G_CALLBACK(app_key_press_cb), app);
    g_signal_connect(G_OBJECT(app), "key_press_event", G_CALLBACK(app_key_press_cb), app);
    g_signal_connect(G_OBJECT(app), "delete_event", G_CALLBACK(app_delete_event_proxy), app);

    gtk_widget_show_all( GTK_WIDGET( app ) );
    /* register with osso initialize */
    context = osso_initialize("org.maemo." PACKAGE, PACKAGE_VERSION, FALSE, NULL);
    osso_application_set_top_cb(context, osso_top_callback, (gpointer)app);
#endif    
	if (!gaim_core_init(GAIM_GTK_UI)) {
		fprintf(stderr,
				"Initialization of the Gaim core failed. Dumping core.\n"
				"Please report this!\n");
		abort();
	}

	plugin_search_paths[0] = g_strdup(LIBDIR);
	plugin_search_paths[1] = gaim_user_dir();
	plugin_search_paths[2] = g_build_filename(gaim_user_dir(), "plugins", NULL);
#ifdef ENABLE_HILDON
    plugin_search_paths[3] = g_strdup("/var/lib/install/etc/gaim/plugins");
#endif
	gaim_plugins_set_search_paths(sizeof(plugin_search_paths) /
								  sizeof(*plugin_search_paths),
								  plugin_search_paths);

	g_free(plugin_search_paths[0]);
	g_free(plugin_search_paths[2]);

	gaim_plugins_probe(NULL);

	/* XXX - Remove this check.  Maybe in 2005.  --KingAnt, 25 Jul 2004 */
	gaimrc = g_build_filename(gaim_home_dir(), ".gaimrc", NULL);
	accountsxml = g_build_filename(gaim_user_dir(), "accounts.xml", NULL);
	if (g_file_test(gaimrc, G_FILE_TEST_EXISTS) &&
		!g_file_test(accountsxml, G_FILE_TEST_EXISTS)) {
		gaim_notify_error(NULL, NULL, _("Unable to load preferences"), _("Gaim was not able to load your preferences because they are stored in an old format that is no longer used.  Please reconfigure your settings using the Preferences window."));
	}
	g_free(gaimrc);
	g_free(accountsxml);

	gaim_accounts_load();

	gaim_set_blist(gaim_blist_new());
	gaim_blist_load();

	gaim_prefs_load();

	gaim_prefs_update_old();
	gaim_gtk_prefs_update_old();

	/* load plugins we had when we quit */
	gaim_plugins_load_saved("/gaim/gtk/plugins/loaded");

	gaim_pounces_load();
	gaim_status_load();

	ui_main();

#ifdef USE_SM
	session_init(argv[0], opt_session_arg, opt_config_dir_arg);
#endif
	if (opt_session_arg != NULL) {
		g_free(opt_session_arg);
		opt_session_arg = NULL;
	}
	
	if (opt_config_dir_arg != NULL) {
		g_free(opt_config_dir_arg);
		opt_config_dir_arg = NULL;
	}

	/* set the default username */
	if (opt_user_arg != NULL) {
		set_first_user(opt_user_arg);
		g_free(opt_user_arg);
		opt_user_arg = NULL;
	}

#ifndef GAIM_SMALL_SCREEN
	if (gaim_prefs_get_bool("/gaim/gtk/debug/enabled"))
		gaim_gtk_debug_window_show();
#endif
	/* deal with --login */
	if (opt_login) {
		dologin_ret = dologin_named(opt_login_arg);
		if (opt_login_arg != NULL) {
			g_free(opt_login_arg);
			opt_login_arg = NULL;
		}
	}

	if (!opt_acct && !opt_nologin)
		gaim_accounts_auto_login(GAIM_GTK_UI);

	if (opt_acct) {
		gaim_gtk_accounts_window_show();
	} else if ((dologin_ret == -1) && !gaim_connections_get_all())
		show_login();

#ifdef HAVE_STARTUP_NOTIFICATION
	startup_notification_complete();
#endif
	gtk_main();
	gaim_sound_shutdown();
#ifdef _WIN32
	wgaim_cleanup();
#endif

#ifdef ENABLE_HILDON
    gtk_widget_destroy(app);
#endif
	return 0;

}
NS_IMETHODIMP
nsNativeAppSupportUnix::Start(bool *aRetVal)
{
  NS_ASSERTION(gAppData, "gAppData must not be null.");

// The dbus library is used by both nsWifiScannerDBus and BluetoothDBusService,
// from diffrent threads. This could lead to race conditions if the dbus is not
// initialized before making any other library calls.
#ifdef MOZ_ENABLE_DBUS
  dbus_threads_init_default();
#endif

#if (MOZ_WIDGET_GTK == 2)
  if (gtk_major_version < MIN_GTK_MAJOR_VERSION ||
      (gtk_major_version == MIN_GTK_MAJOR_VERSION && gtk_minor_version < MIN_GTK_MINOR_VERSION)) {
    GtkWidget* versionErrDialog = gtk_message_dialog_new(NULL,
                     GtkDialogFlags(GTK_DIALOG_MODAL |
                                    GTK_DIALOG_DESTROY_WITH_PARENT),
                     GTK_MESSAGE_ERROR,
                     GTK_BUTTONS_OK,
                     UNSUPPORTED_GTK_MSG,
                     gtk_major_version,
                     gtk_minor_version,
                     MIN_GTK_MAJOR_VERSION,
                     MIN_GTK_MINOR_VERSION);
    gtk_dialog_run(GTK_DIALOG(versionErrDialog));
    gtk_widget_destroy(versionErrDialog);
    exit(0);
  }
#endif

#if (MOZ_PLATFORM_MAEMO == 5)
  /* zero state out. */
  memset(&m_hw_state, 0, sizeof(osso_hw_state_t));

  /* Initialize maemo application
     
     The initalization name will be of the form "Vendor.Name".
     If a Vendor isn't given, then we will just use "Name".
     
     Note that this value must match your X-Osso-Service name
     defined in your desktop file.  If it doesn't, the OSSO
     system will happily kill your process.
  */
  nsAutoCString applicationName;
  if (gAppData->vendor) {
      applicationName.Append(gAppData->vendor);
      applicationName.Append(".");
  }
  applicationName.Append(gAppData->name);
  ToLowerCase(applicationName);

  m_osso_context = osso_initialize(applicationName.get(), 
                                   gAppData->version ? gAppData->version : "1.0",
                                   true,
                                   nullptr);

  /* Check that initilialization was ok */
  if (m_osso_context == nullptr) {
      return NS_ERROR_FAILURE;
  }

  osso_hw_set_event_cb(m_osso_context, nullptr, OssoHardwareCallback, &m_hw_state);
  osso_hw_set_display_event_cb(m_osso_context, OssoDisplayCallback, m_osso_context);
  osso_rpc_set_default_cb_f(m_osso_context, OssoDbusCallback, nullptr);

  // Setup an MCE callback to monitor orientation
  DBusConnection *connnection = (DBusConnection*)osso_get_sys_dbus_connection(m_osso_context);
  dbus_bus_add_match(connnection, MCE_MATCH_RULE, nullptr);
  dbus_connection_add_filter(connnection, OssoModeControlCallback, nullptr, nullptr);
#endif

  *aRetVal = true;

#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)

  PRLibrary *gnomeuiLib = PR_LoadLibrary("libgnomeui-2.so.0");
  if (!gnomeuiLib)
    return NS_OK;

  PRLibrary *gnomeLib = PR_LoadLibrary("libgnome-2.so.0");
  if (!gnomeLib) {
    PR_UnloadLibrary(gnomeuiLib);
    return NS_OK;
  }

  _gnome_program_init_fn gnome_program_init =
    (_gnome_program_init_fn)PR_FindFunctionSymbol(gnomeLib, "gnome_program_init");
  _gnome_program_get_fn gnome_program_get =
    (_gnome_program_get_fn)PR_FindFunctionSymbol(gnomeLib, "gnome_program_get"); 
 _libgnomeui_module_info_get_fn libgnomeui_module_info_get = (_libgnomeui_module_info_get_fn)PR_FindFunctionSymbol(gnomeuiLib, "libgnomeui_module_info_get");
  if (!gnome_program_init || !gnome_program_get || !libgnomeui_module_info_get) {
    PR_UnloadLibrary(gnomeuiLib);
    PR_UnloadLibrary(gnomeLib);
    return NS_OK;
  }

#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */

#ifdef ACCESSIBILITY
  // We will load gail, atk-bridge by ourself later
  // We can't run atk-bridge init here, because gail get the control
  // Set GNOME_ACCESSIBILITY to 0 can avoid this
  static const char *accEnv = "GNOME_ACCESSIBILITY";
  const char *accOldValue = getenv(accEnv);
  setenv(accEnv, "0", 1);
#endif

#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
  if (!gnome_program_get()) {
    gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(), gArgc, gArgv, NULL);
  }
#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */

#ifdef ACCESSIBILITY
  if (accOldValue) { 
    setenv(accEnv, accOldValue, 1);
  } else {
    unsetenv(accEnv);
  }
#endif

  // Careful! These libraries cannot be unloaded after this point because
  // gnome_program_init causes atexit handlers to be registered. Strange
  // crashes will occur if these libraries are unloaded.

  // TODO GTK3 - see Bug 694570 - Stop using libgnome and libgnomeui on Linux
#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
  gnome_client_set_restart_command = (_gnome_client_set_restart_command_fn)
    PR_FindFunctionSymbol(gnomeuiLib, "gnome_client_set_restart_command");

  _gnome_master_client_fn gnome_master_client = (_gnome_master_client_fn)
    PR_FindFunctionSymbol(gnomeuiLib, "gnome_master_client");

  GnomeClient *client = gnome_master_client();
  g_signal_connect(client, "save-yourself", G_CALLBACK(save_yourself_cb), NULL);
  g_signal_connect(client, "die", G_CALLBACK(die_cb), NULL);

  // Set the correct/requested restart command in any case.

  // Is there a request to suppress default binary launcher?
  nsAutoCString path;
  char* argv1 = getenv("MOZ_APP_LAUNCHER");

  if(!argv1) {
    // Tell the desktop the command for restarting us so that we can be part of XSMP session restore
    NS_ASSERTION(gDirServiceProvider, "gDirServiceProvider is NULL! This shouldn't happen!");
    nsCOMPtr<nsIFile> executablePath;
    nsresult rv;

    bool dummy;
    rv = gDirServiceProvider->GetFile(XRE_EXECUTABLE_FILE, &dummy, getter_AddRefs(executablePath));

    if (NS_SUCCEEDED(rv)) {
      // Strip off the -bin suffix to get the shell script we should run; this is what Breakpad does
      nsAutoCString leafName;
      rv = executablePath->GetNativeLeafName(leafName);
      if (NS_SUCCEEDED(rv) && StringEndsWith(leafName, NS_LITERAL_CSTRING("-bin"))) {
        leafName.SetLength(leafName.Length() - strlen("-bin"));
        executablePath->SetNativeLeafName(leafName);
      }

      executablePath->GetNativePath(path);
      argv1 = (char*)(path.get());
    }
  }

  if (argv1) {
    gnome_client_set_restart_command(client, 1, &argv1);
  }
#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */

  return NS_OK;
}