コード例 #1
0
ファイル: storage.c プロジェクト: playya/Enlightenment
/**
 * @brief: Automatically saves all open notes into the storage.
 */
void
autosave(void)
{
	int             x, y, w, h;
	Note           *note;
	Evas_List      *tmp = gbl_notes;
	NoteStor       *n;

	dml("Autosaving", 1);

	while (tmp != NULL) {
		note = evas_list_data(tmp);
		ecore_evas_geometry_get(note->win, &x, &y, &w, &h);
		n = alloc_note_stor();
		n->width = w;
		n->height = h;
		n->x = x;
		n->y = y;
		n->shaded = note->shaded;
		n->content = strdup(get_content_by_note(tmp));
		append_note_stor(n);
		free_note_stor(n);
		tmp = evas_list_next(tmp);
	}

	dml("Autosaved Notes", 1);

	return;
}
コード例 #2
0
short SqlciStats::displayChildQryStats(SqlciEnv * sqlci_env)
{
  Lng32 retcode = 0;


  // do not display, if stats display is set to off.
  if (statsDisplay_ == FALSE)
    return 0;

  Lng32 newStrLen = 
    strlen("GET STATISTICS FOR QID CURRENT") + 10;
  char * newStr = new char[newStrLen+1];
  strcpy(newStr, "GET STATISTICS FOR QID CURRENT ;");
  
  NABoolean savedShowshape = sqlci_env->showShape();
  sqlci_env->showShape() = FALSE;
  statsDisplay_ = FALSE;
  DML dml(newStr, DML_DESCRIBE_TYPE, "__MXCI_GET_CHILDQRY_STATS__");
  retcode = dml.process(sqlci_env);
  delete [] newStr;
  sqlci_env->showShape() = savedShowshape;

  statsDisplay_ = TRUE;

  return (short) retcode;
}
コード例 #3
0
ファイル: storage.c プロジェクト: playya/Enlightenment
void
process_note_storage_locations()
{
	DIR            *p;
	char           *f = malloc(PATH_MAX);

	sprintf(f, "%s/.e/apps/enotes/notes", getenv("HOME"));
	if ((p = opendir(f)) == NULL) {
		dml("Note Storage Location Doesn't Exist; Creating...", 1);
		if (mkdir(f, (mode_t) 0755) == -1)
			dml("Unable to Create Storage Location.  Expect problems!", 1);
	} else {
		dml("Note Storage Location Found", 1);
		closedir(p);
	}

	free(f);
	return;
}
コード例 #4
0
short SqlciStats::displayStats(SqlciEnv * sqlci_env)
{
  Lng32 retcode = 0;

  if (statsStatus_ != STATS_AVAILABLE)
    return 0;
  // do not display, if stats display is set to off.
  if (statsDisplay_ == FALSE)
    return 0;

  Lng32 newStrLen = 
    strlen("GET STATISTICS , options ") +
    (statsOptions_ ? strlen(statsOptions_) : 0) +
    10;
  char * newStr = new char[newStrLen+1];
  strcpy(newStr, "GET STATISTICS ");
  if (statsOptions_)
    {
      strcat(newStr, ", options '");
      strcat(newStr, statsOptions_);
      strcat(newStr, "'");
    }
  strcat(newStr, ";");

  NABoolean savedShowshape = sqlci_env->showShape();
  sqlci_env->showShape() = FALSE;
  statsDisplay_ = FALSE;
  DML dml(newStr, DML_DESCRIBE_TYPE, "__MXCI_GET_STATS__");
  retcode = dml.process(sqlci_env);
  delete [] newStr;
  sqlci_env->showShape() = savedShowshape;

  statsDisplay_ = TRUE;

  return (short) retcode;
}
コード例 #5
0
ファイル: main.c プロジェクト: playya/Enlightenment
/**
 * @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);
}
コード例 #6
0
ファイル: controlcentre.c プロジェクト: playya/Enlightenment
void
setup_cc_with_pos(int x, int y)
{
	ControlCentre  *cc;
	char           *edjefn = malloc(PATH_MAX);
	char           *fontpath = malloc(PATH_MAX);
	Evas_Coord      edje_w, edje_h;
	CCPos          *pos;

	cc = malloc(sizeof(ControlCentre));
	controlcentre = cc;

	pos = get_cc_pos();

	if (x >= 0 || y >= 0) {
		pos->x = x;
		pos->y = y;
	}

	/* Setup the Window */
	if (!strcmp(main_config->render_method, "gl")) {
#ifdef HAVE_ECORE_EVAS_GL
		cc->win =
			ecore_evas_gl_x11_new(NULL, 0, pos->x, pos->y,
					      pos->width, pos->height);
#else
		dml("GL not in Ecore_Evas module.  Falling back on software!",
		    1);
		free(main_config->render_method);
		main_config->render_method = strdup("software");
		cc->win =
			ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y,
						    pos->width, pos->height);
#endif
	} else
		cc->win =
			ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y,
						    pos->width, pos->height);

	ecore_evas_title_set(cc->win, "Enotes");
	ecore_evas_name_class_set(cc->win, "Enotes", "Enotes");

	if (main_config->ontop == 1)
		ecore_evas_layer_set(cc->win, 7);
	else
		ecore_evas_layer_set(cc->win, 2);

	if (main_config->sticky == 1)
		ecore_evas_sticky_set(cc->win, 1);
	else
		ecore_evas_sticky_set(cc->win, 0);

	ecore_evas_borderless_set(cc->win, 1);
	ecore_evas_shaped_set(cc->win, 1);
	if (pos->x != 0 && pos->y != 0)
		ecore_evas_resize(cc->win, pos->x, pos->y);
	ecore_evas_show(cc->win);

//      if(main_config->ontop==1)

	/* Moving the damn thing */
	ecore_evas_move(cc->win, pos->x, pos->y);

	/* Setup the Canvas, Render-Method and Font Path */
	cc->evas = ecore_evas_get(cc->win);
	evas_output_method_set(cc->evas,
			       evas_render_method_lookup(main_config->
							 render_method));
	snprintf(fontpath, PATH_MAX, "%s/fonts", PACKAGE_DATA_DIR);
	evas_font_path_append(cc->evas, fontpath);
	free(fontpath);

	/* Draggable Setup */
	cc->dragger = esmart_draggies_new(cc->win);
	evas_object_name_set(cc->dragger, "dragger");
	evas_object_move(cc->dragger, 0, 0);
	evas_object_layer_set(cc->dragger, 0);
	evas_object_color_set(cc->dragger, 255, 255, 255, 0);
	esmart_draggies_button_set(cc->dragger, 1);
	evas_object_show(cc->dragger);

	/* Setup the EDJE */
	cc->edje = edje_object_add(cc->evas);
	snprintf(edjefn, PATH_MAX, CC_EDJE, PACKAGE_DATA_DIR,
		 main_config->theme);
	edje_object_file_set(cc->edje, edjefn, CC_PART);
	free(edjefn);
	evas_object_move(cc->edje, 0, 0);
	evas_object_layer_set(cc->edje, 1);
	evas_object_name_set(cc->edje, "edje");
	evas_object_pass_events_set(cc->edje, 0);
	evas_object_show(cc->edje);
	if (pos->shaded)
		edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO",
					"");
	else
		edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO",
					"");

	/* EDJE and ECORE min, max and resizing */
	edje_object_size_max_get(cc->edje, &edje_w, &edje_h);
	ecore_evas_size_max_set(cc->win, edje_w, edje_h);
	edje_object_size_min_get(cc->edje, &edje_w, &edje_h);
	ecore_evas_size_min_set(cc->win, edje_w, edje_h);
	ecore_evas_resize(cc->win, (int) edje_w, (int) edje_h);
	evas_object_resize(cc->edje, edje_w, edje_h);
	evas_object_resize(cc->dragger, edje_w, edje_h);

	/* Ecore Callbacks */
	ecore_evas_callback_resize_set(cc->win, cc_resize);
	ecore_evas_callback_destroy_set(cc->win, cc_close_win);
	ecore_evas_callback_delete_request_set(cc->win, cc_close_win);

	/* Edje Callbacks */
	edje_object_signal_callback_add(cc->edje,
					EDJE_SIGNAL_CC_MINIMIZE, "",
					(void *) cc_minimize, cc->win);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_CLOSE, "",
					(void *) cc_close, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SAVELOAD, "",
					(void *) cc_saveload, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SETTINGS, "",
					(void *) cc_settings, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "",
					(void *) cc_newnote, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "",
					(void *) cc_shade, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "",
					(void *) cc_unshade, NULL);

	free(pos);
	return;
}