Exemple #1
0
void eim_config_init (Eim *e) {
#ifdef CORE_DEBUG
  printf("TRACE: eim_initialize\n");
#endif
  assert (e);

  int nb_account = 0;
  int i;
  
  /* read config file to get account properties */
  if (ecore_config_init ("eim") == ECORE_CONFIG_ERR_FAIL) {
    printf("WARNING: config file not available\n");
    /* load default config and save it*/
    _eim_load_default_config ();
    ecore_config_save ();
  }
  
  /* here we can load each configuration */
  ecore_config_load();
  nb_account = ecore_config_int_get(EIM_CONFIG_NB_ACCOUNT);
  for (i = 0; i < nb_account; i++) {
    ecore_list_append (e->account_properties, 
		       account_properties_new_from_config (i));
  }
}
static void conf_win_clicked_cb(Ewl_Widget * w, void * event, void * data)
{
    Ewl_Stock_Type response;

    response = ewl_stock_type_get(EWL_STOCK(w));

    if (response == EWL_STOCK_OK || response == EWL_STOCK_APPLY) {
        ecore_config_boolean_set("/graphic/animations", config.animations);
        ecore_config_boolean_set("/graphic/shadows", config.shadows);
        ecore_config_boolean_set("/graphic/gl", config.gl);
        ecore_config_int_set("velocity", config.velocity);
        ecore_config_int_set("frame_rate", config.frame_rate);
        ecore_config_int_set("lazy", config.lazy);

        if (ecore_config_save() != ECORE_CONFIG_ERR_SUCC)
            fprintf(stderr,
                    _("Elitaire Error: Could not save configuration.\n"));
    }

    if (response == EWL_STOCK_OK || response == EWL_STOCK_CANCEL) {
        ewl_widget_destroy(EWL_WIDGET(data));
        conf_win = NULL;
    }
}
Exemple #3
0
/**
 * @param argc: Number of command line arguments supplied.
 * @param argv: Char* array containing the command line arguments supplied.
 * @return: To the system, normally 0.
 * @brief: The first function once enotes is called.
 */
int
main(int argc, char *argv[])
{
	int             note_count;

	/* IPC Check */
	ecore_ipc_init();
	dml("IPC Initiated Successfully", 1);

	/* loading will increment this if there are notes if not we may need to
	 * create a blank one */
	note_count = 0;

	if ((ecore_config_init("enotes")) == ECORE_CONFIG_ERR_FAIL) {
		ecore_ipc_shutdown();
		return (-1);
	}
	ecore_app_args_set(argc, (const char **) argv);

	ecore_config_app_describe("E-Notes - Sticky Notes for Enlightenment\n\
Copyright (c) Thomas Fletcher\n\
Usage: enotes [options]");

	/* Read the Usage and Configurations */
	main_config = mainconfig_new();
	if (read_configuration(main_config) != ECORE_CONFIG_PARSE_CONTINUE) {
		ecore_config_shutdown();
		ecore_ipc_shutdown();
		ecore_shutdown();
		mainconfig_free(main_config);
		return (-1);
	}

	dml("Successfully Read Configurations and Usage", 1);

	process_note_storage_locations();

	if (find_server() != 0) {
		if (remotecmd != NULL)
			send_to_server(remotecmd);
		else
			send_to_server("DEFNOTE");
	} else {
		dml("Server wasn't found.. Creating one", 1);
		/* Setup Server */
		setup_server();

		/* Initialise the E-Libs */
		ecore_init();
		ecore_x_init(NULL);
		ecore_app_args_set(argc, (const char **) argv);
		if (!ecore_evas_init()) {
			mainconfig_free(main_config);
			return -1;
		}
		ewl_init(&argc, argv);
		edje_init();

		dml("Efl Successfully Initiated", 1);

		autoload();
		/* create autosave timer */
		update_autosave();

		if (remotecmd != NULL)
			handle_ipc_message(remotecmd);

		/* Begin the Control Centre */
		if (main_config->controlcentre == 1) {
			setup_cc();
			dml("Control Centre Setup", 1);
		} else {
			dml("No Control Centre - Displaying Notice", 1);
			if (get_note_count() == 0)
				new_note();
		}

		if (main_config->welcome == 1) {
			open_welcome();
		}

		/* Begin the main loop */
		dml("Starting Main Loop", 1);
		ecore_main_loop_begin();

		dml("Main Loop Ended", 1);

		/* Save Controlcentre Settings */
		set_cc_pos();

		autosave();
		if (autosave_timer)
			ecore_timer_del(autosave_timer);

		/* Save and Free the Configuration */
		ecore_config_save();
		dml("Configuration Saved", 1);
		mainconfig_free(main_config);
		dml("Configuration Structure Free'd", 1);

		/* Shutdown the E-Libs */
		edje_shutdown();
		ecore_evas_shutdown();
		ecore_x_shutdown();
		ecore_shutdown();
		dml("Efl Shutdown", 1);
	}

	/* End IPC */
	ecore_ipc_shutdown();
	dml("IPC Shutdown", 1);

	dml("Leaving.", 1);
	return (0);
}