Enlightenment CVS committal
Author : rephorm
Project : e17
Module : apps/elicit
Dir : e17/apps/elicit/src
Modified Files:
Elicit.h Makefile.am config.h.in elicit.c util.c
Log Message:
The start of some conf stuff using ecore_config.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/Elicit.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Elicit.h 6 Feb 2004 06:38:00 -0000 1.2
+++ Elicit.h 6 Feb 2004 19:13:32 -0000 1.3
@@ -1,18 +1,28 @@
+#ifndef ELICIT_H
+#define ELICIT_H
+
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_X.h>
#include <Ecore_Evas.h>
+#include <Ecore_Config.h>
#include <Edje.h>
#include <X11/Xlib.h>
#include <Imlib2.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+#include <sys/stat.h>
#include "config.h"
-#define DATADIR PACKAGE_DATA_DIR
+#define DATADIR PACKAGE_DATA_DIR"/data"
+
+typedef struct _Elicit Elicit;
#include "callbacks.h"
#include "util.h"
+#include "conf.h"
-typedef struct _Elicit Elicit;
struct _Elicit
{
@@ -42,4 +52,5 @@
};
+#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 6 Feb 2004 06:32:58 -0000 1.1
+++ Makefile.am 6 Feb 2004 19:13:32 -0000 1.2
@@ -8,7 +8,8 @@
elicit_SOURCES = \
elicit.c Elicit.h \
callbacks.c callbacks.h \
- util.c util.h
+ util.c util.h \
+ conf.c conf.h
elicit_LDADD = @edje_libs@ @ecore_libs@ @edb_libs@ @evas_libs@ \
@esmart_libs@
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/config.h.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- config.h.in 6 Feb 2004 06:32:58 -0000 1.1
+++ config.h.in 6 Feb 2004 19:13:32 -0000 1.2
@@ -1,56 +1,76 @@
-/* src/config.h.in. Generated automatically from configure.in by autoheader. */
+/* src/config.h.in. Generated from configure.in by autoheader. */
-/* Define to empty if the keyword does not work. */
-#undef const
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
-/* Define if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
-/* Name of package */
-#undef PACKAGE
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
-/* Version number of package */
-#undef VERSION
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
-/* Define if using the dmalloc debugging malloc package */
-#undef WITH_DMALLOC
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
-/* Locale-specific data directory */
-#undef PACKAGE_LOCALE_DIR
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
-/* Locale-specific data directory */
-#undef PACKAGE_LOCALE_DIR
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
-/* Shared data directory */
-#undef PACKAGE_DATA_DIR
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
-/* Shared data directory */
-#undef PACKAGE_DATA_DIR
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
-/* Shared data directory */
-#undef PACKAGE_DATA_DIR
+/* Name of package */
+#undef PACKAGE
/* Installation directory for user executables */
#undef PACKAGE_BIN_DIR
-/* Installation directory for user executables */
-#undef PACKAGE_BIN_DIR
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
-/* Installation directory for user executables */
-#undef PACKAGE_BIN_DIR
+/* Shared data directory */
+#undef PACKAGE_DATA_DIR
/* Installation directory for libraries */
#undef PACKAGE_LIB_DIR
-/* Installation directory for libraries */
-#undef PACKAGE_LIB_DIR
+/* Locale-specific data directory */
+#undef PACKAGE_LOCALE_DIR
-/* Installation directory for libraries */
-#undef PACKAGE_LIB_DIR
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
/* Source code directory */
#undef PACKAGE_SOURCE_DIR
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/elicit.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- elicit.c 6 Feb 2004 06:32:58 -0000 1.4
+++ elicit.c 6 Feb 2004 19:13:32 -0000 1.5
@@ -6,6 +6,7 @@
void pick_color();
void shoot();
void elicit_ui_update_text(Elicit *el);
+void elicit_ui_theme_set(Elicit *el, char *name);
int timer_color(void *data);
/* variables */
@@ -72,6 +73,7 @@
ecore_main_loop_begin();
/* shutdown the subsystems (when event loop exits, app is done) */
+ elicit_config_shutdown(el);
ecore_evas_shutdown();
ecore_shutdown();
edje_shutdown();
@@ -89,26 +91,16 @@
Evas_Object *o;
double mw, mh;
+ elicit_config_init(el);
+
ecore_evas_borderless_set(el->ee, 1);
ecore_evas_shaped_set(el->ee, 1);
el->gui = edje_object_add(el->evas);
- if (!edje_object_file_set(el->gui, DATADIR"/themes/winter.eet", "elicit"))
- {
- fprintf(stderr, "can't load theme eet: %s, %s\n", DATADIR"/themes/elicit.eet",
"elicit");
- return 0;
- }
evas_object_name_set(el->gui, "gui");
evas_object_move(el->gui, 0, 0);
evas_object_show(el->gui);
-
- edje_object_size_min_get(el->gui, &mw, &mh);
- ecore_evas_size_min_set(el->ee, mw, mh);
- ecore_evas_resize(el->ee, mw, mh);
- evas_object_resize(el->gui, mw, mh);
-
-
/* create the swatch and shot objects */
el->shot = evas_object_image_add(el->evas);
evas_object_name_set(el->shot, "shot");
@@ -119,6 +111,18 @@
evas_object_name_set(el->swatch, "swatch");
evas_object_show(el->swatch);
+ elicit_ui_theme_set(el, elicit_config_theme_get(el));
+#if 0
+ if (!edje_object_file_set(el->gui, DATADIR"/themes/winter.eet", "elicit"))
+ {
+ fprintf(stderr, "can't load theme eet: %s, %s\n", DATADIR"/themes/elicit.eet",
"elicit");
+ return 0;
+ }
+ edje_object_size_min_get(el->gui, &mw, &mh);
+ ecore_evas_size_min_set(el->ee, mw, mh);
+ ecore_evas_resize(el->ee, mw, mh);
+ evas_object_resize(el->gui, mw, mh);
+
/* swallow them */
edje_object_part_swallow(el->gui, "shot", el->shot);
edje_object_part_swallow(el->gui, "swatch", el->swatch);
@@ -131,7 +135,8 @@
edje_object_signal_callback_add(el->gui, "elicit,quit", "*", elicit_cb_exit, el);
edje_object_signal_callback_add(el->gui, "elicit,color,*", "*", elicit_cb_colors,
el);
edje_object_signal_callback_add(el->gui, "elicit,zoom,*", "*", elicit_cb_colors,
el);
-
+#endif
+
/* some defaults */
/* FIXME: use a config db */
el->zoom = 4;
@@ -141,6 +146,48 @@
return 0;
}
+void
+elicit_ui_theme_set(Elicit *el, char *theme)
+{
+ double mw, mh;
+
+ /* set the theme */
+ if (!edje_object_file_set(el->gui, elicit_theme_find(theme), "elicit"))
+ {
+ printf("Error: can't set theme to %s\n", theme);
+ return;
+ }
+
+ /* set the default window size */
+ edje_object_size_min_get(el->gui, &mw, &mh);
+ ecore_evas_size_min_set(el->ee, mw, mh);
+ if (mw != 0 && mh != 0)
+ {
+ evas_object_resize(el->gui, mw, mh);
+ ecore_evas_resize(el->ee, mw, mh);
+ }
+ else
+ {
+ /* arbitrary default size if theme doesn't set a min size */
+ evas_object_resize(el->gui, 255, 255);
+ ecore_evas_resize(el->ee, 255, 255);
+ }
+
+ /* swallow and update */
+ edje_object_part_swallow(el->gui, "shot", el->shot);
+ edje_object_part_swallow(el->gui, "swatch", el->swatch);
+ elicit_ui_update_text(el);
+
+ /* set up edje callbacks */
+ edje_object_signal_callback_add(el->gui, "elicit,pick,*", "*", elicit_cb_pick, el);
+ edje_object_signal_callback_add(el->gui, "mouse,move", "*", elicit_cb_pick, el);
+ edje_object_signal_callback_add(el->gui, "mouse,move", "*", elicit_cb_shoot, el);
+ edje_object_signal_callback_add(el->gui, "elicit,shoot,*", "*", elicit_cb_shoot,
el);
+ edje_object_signal_callback_add(el->gui, "elicit,quit", "*", elicit_cb_exit, el);
+ edje_object_signal_callback_add(el->gui, "elicit,color,*", "*", elicit_cb_colors,
el);
+ edje_object_signal_callback_add(el->gui, "elicit,zoom,*", "*", elicit_cb_colors,
el);
+
+}
void
elicit_ui_update_text(Elicit *el)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- util.c 6 Feb 2004 07:22:14 -0000 1.2
+++ util.c 6 Feb 2004 19:13:32 -0000 1.3
@@ -226,3 +226,20 @@
return 0;
}
+char *
+elicit_theme_find(const char *name)
+{
+ static char eet[PATH_MAX + 1];
+ struct stat st;
+
+ snprintf(eet, sizeof(eet),
+ "%s/.e/apps/"PACKAGE"/""themes/%s.eet",
+ getenv("HOME"), name);
+
+ if (!stat(eet, &st))
+ return eet;
+
+ snprintf(eet, sizeof(eet), DATADIR"/themes/%s.eet", name);
+
+ return stat(eet, &st) ? NULL : eet;
+}
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs