summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-07-05 09:38:43 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-07-05 09:38:43 +0000
commit5adb2747b8b9d24962be7d6a260582adc65edccb (patch)
tree746859f897364b0db18b09719207f37b8329e8b1 /src/bin
parent2f9e9628ccf19d78fcb0f1887e3a9320775209a3 (diff)
make min size 1x1 for warning fix, add 2 todo's and make configs
versioned finally. :) SVN revision: 73336
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/config.c25
-rw-r--r--src/bin/config.h1
-rw-r--r--src/bin/media.c6
3 files changed, 28 insertions, 4 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index a060b53..789dbd0 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -3,6 +3,8 @@
3#include <Elementary.h> 3#include <Elementary.h>
4#include "config.h" 4#include "config.h"
5 5
6#define CONF_VER 1
7
6#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;} 8#define LIM(v, min, max) {if (v >= max) v = max; else if (v <= min) v = min;}
7 9
8static Eet_Data_Descriptor *edd_base = NULL; 10static Eet_Data_Descriptor *edd_base = NULL;
@@ -43,6 +45,8 @@ config_init(void)
43 edd_base = eet_data_descriptor_stream_new(&eddc); 45 edd_base = eet_data_descriptor_stream_new(&eddc);
44 46
45 EET_DATA_DESCRIPTOR_ADD_BASIC 47 EET_DATA_DESCRIPTOR_ADD_BASIC
48 (edd_base, Config, "version", version, EET_T_INT);
49 EET_DATA_DESCRIPTOR_ADD_BASIC
46 (edd_base, Config, "font.name", font.name, EET_T_STRING); 50 (edd_base, Config, "font.name", font.name, EET_T_STRING);
47 EET_DATA_DESCRIPTOR_ADD_BASIC 51 EET_DATA_DESCRIPTOR_ADD_BASIC
48 (edd_base, Config, "font.size", font.size, EET_T_INT); 52 (edd_base, Config, "font.size", font.size, EET_T_INT);
@@ -146,7 +150,18 @@ config_load(const char *key)
146 eet_close(ef); 150 eet_close(ef);
147 if (config) 151 if (config)
148 { 152 {
149 LIM(config->font.size, 3, 400); 153 if (config->version < CONF_VER)
154 {
155 // currently no upgrade path so reset config.
156 config_del(config);
157 config = NULL;
158 }
159 else
160 {
161 LIM(config->font.size, 3, 400);
162 LIM(config->scrollback, 0, 200000);
163 LIM(config->vidmod, 0, 3)
164 }
150 } 165 }
151 } 166 }
152 if (!config) 167 if (!config)
@@ -207,6 +222,7 @@ config_load(const char *key)
207 config = calloc(1, sizeof(Config)); 222 config = calloc(1, sizeof(Config));
208 if (config) 223 if (config)
209 { 224 {
225 config->version = CONF_VER;
210 config->font.bitmap = EINA_TRUE; 226 config->font.bitmap = EINA_TRUE;
211 config->font.name = eina_stringshare_add("nexus.pcf"); 227 config->font.name = eina_stringshare_add("nexus.pcf");
212 config->font.size = 10; 228 config->font.size = 10;
@@ -252,6 +268,13 @@ config_del(Config *config)
252 eina_stringshare_del(config->theme); 268 eina_stringshare_del(config->theme);
253 eina_stringshare_del(config->background); 269 eina_stringshare_del(config->background);
254 eina_stringshare_del(config->wordsep); 270 eina_stringshare_del(config->wordsep);
271 eina_stringshare_del(config->helper.email);
272 eina_stringshare_del(config->helper.url.general);
273 eina_stringshare_del(config->helper.url.video);
274 eina_stringshare_del(config->helper.url.image);
275 eina_stringshare_del(config->helper.local.general);
276 eina_stringshare_del(config->helper.local.video);
277 eina_stringshare_del(config->helper.local.image);
255 278
256 eina_stringshare_del(config->config_key); /* not in eet */ 279 eina_stringshare_del(config->config_key); /* not in eet */
257 free(config); 280 free(config);
diff --git a/src/bin/config.h b/src/bin/config.h
index aeaabc3..d225888 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -7,6 +7,7 @@ typedef struct _Config Config;
7 7
8struct _Config 8struct _Config
9{ 9{
10 int version;
10 struct { 11 struct {
11 const char *name; 12 const char *name;
12 int size; 13 int size;
diff --git a/src/bin/media.c b/src/bin/media.c
index 0117426..2148259 100644
--- a/src/bin/media.c
+++ b/src/bin/media.c
@@ -141,7 +141,7 @@ _type_img_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_
141 } 141 }
142 else 142 else
143 { 143 {
144 int iw, ih; 144 int iw = 1, ih = 1;
145 145
146 if (sd->mode == MEDIA_BG) 146 if (sd->mode == MEDIA_BG)
147 { 147 {
@@ -225,7 +225,7 @@ _type_scale_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Eva
225 } 225 }
226 else 226 else
227 { 227 {
228 int iw, ih; 228 int iw = 1, ih = 1;
229 229
230 if (sd->mode == MEDIA_BG) 230 if (sd->mode == MEDIA_BG)
231 { 231 {
@@ -529,7 +529,7 @@ _type_mov_calc(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_
529 } 529 }
530 else 530 else
531 { 531 {
532 int iw = 0, ih = 0; 532 int iw = 1, ih = 1;
533 double ratio; 533 double ratio;
534 534
535 ratio = emotion_object_ratio_get(sd->o_img); 535 ratio = emotion_object_ratio_get(sd->o_img);