summaryrefslogtreecommitdiff
path: root/src/bin/options_font.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-06-17 20:24:23 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-06-17 20:24:23 +0000
commit652df62d45e187b7b445e741c85c3458b367100d (patch)
tree809b78f370a7b4a9658d3a655615980dfc983c65 /src/bin/options_font.c
parent35e7dbbf4e0839233f6a8f3e29eab46cc0c50133 (diff)
options infrastructure refactor.
There is no global config option anymore, we have option instances that are set to the termio and media for future queries. The idea is that we can later have different configuration per termio, like multiple windows or tabs with different font size, background, etc. It's just a refactor. It would be better to define if things like background is up to the whole terminal and then save to a different config entry... or just save the global and copy it for next termio, defining the other instances as 'temporary'. Anyway: policy to be defined. SVN revision: 72315
Diffstat (limited to 'src/bin/options_font.c')
-rw-r--r--src/bin/options_font.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/bin/options_font.c b/src/bin/options_font.c
index 42f07c4..08b8f2f 100644
--- a/src/bin/options_font.c
+++ b/src/bin/options_font.c
@@ -41,25 +41,28 @@ static void
41_cb_op_font_sel(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 41_cb_op_font_sel(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
42{ 42{
43 Font *f = data; 43 Font *f = data;
44 Config *config = termio_config_get(f->term);
44 if ((config->font.name) && (!strcmp(f->name, config->font.name))) 45 if ((config->font.name) && (!strcmp(f->name, config->font.name)))
45 return; 46 return;
46 if (config->font.name) eina_stringshare_del(config->font.name); 47 if (config->font.name) eina_stringshare_del(config->font.name);
47 config->font.name = eina_stringshare_add(f->name); 48 config->font.name = eina_stringshare_add(f->name);
48 config->font.bitmap = f->bitmap; 49 config->font.bitmap = f->bitmap;
49 _update_sizing(f->term); 50 _update_sizing(f->term);
50 config_save(); 51 config_save(config, NULL);
51} 52}
52 53
53static void 54static void
54_cb_op_fontsize_sel(void *data, Evas_Object *obj, void *event __UNUSED__) 55_cb_op_fontsize_sel(void *data, Evas_Object *obj, void *event __UNUSED__)
55{ 56{
56 int size = elm_slider_value_get(obj) + 0.5; 57 Evas_Object *term = data;
58 Config *config = termio_config_get(term);
59 int size = elm_slider_value_get(obj) + 0.5;
57 60
58 if (config->font.size == size) return; 61 if (config->font.size == size) return;
59 config->font.size = size; 62 config->font.size = size;
60 _update_sizing(data); 63 _update_sizing(term);
61 elm_genlist_realized_items_update(op_fontlist); 64 elm_genlist_realized_items_update(op_fontlist);
62 config_save(); 65 config_save(config, NULL);
63} 66}
64 67
65static int 68static int
@@ -84,6 +87,7 @@ _cb_op_font_preview_eval(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
84 Evas_Object *o; 87 Evas_Object *o;
85 Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh; 88 Evas_Coord ox, oy, ow, oh, vx, vy, vw, vh;
86 char buf[4096]; 89 char buf[4096];
90 Config *config = termio_config_get(f->term);
87 91
88 if (!evas_object_visible_get(obj)) return; 92 if (!evas_object_visible_get(obj)) return;
89 if (edje_object_part_swallow_get(obj, "terminology.content")) return; 93 if (edje_object_part_swallow_get(obj, "terminology.content")) return;
@@ -116,13 +120,16 @@ static Evas_Object *
116_cb_op_font_content_get(void *data, Evas_Object *obj, const char *part) 120_cb_op_font_content_get(void *data, Evas_Object *obj, const char *part)
117{ 121{
118 Font *f = data; 122 Font *f = data;
123 Config *config = termio_config_get(f->term);
124
119 if ((!strcmp(part, "elm.swallow.icon")) || 125 if ((!strcmp(part, "elm.swallow.icon")) ||
120 (!strcmp(part, "elm.swallow.end"))) 126 (!strcmp(part, "elm.swallow.end")))
121 { 127 {
122 Evas_Object *o; 128 Evas_Object *o;
123 129
124 o = edje_object_add(evas_object_evas_get(obj)); 130 o = edje_object_add(evas_object_evas_get(obj));
125 edje_object_file_set(o, config->theme, "terminology/fontpreview"); 131 edje_object_file_set(o, config_theme_path_get(config),
132 "terminology/fontpreview");
126 evas_object_size_hint_min_set(o, 133 evas_object_size_hint_min_set(o,
127 40 * elm_config_scale_get(), 134 40 * elm_config_scale_get(),
128 40 * elm_config_scale_get()); 135 40 * elm_config_scale_get());
@@ -186,6 +193,7 @@ options_font(Evas_Object *opbox, Evas_Object *term)
186 Font *f; 193 Font *f;
187 Elm_Object_Item *it, *sel_it = NULL, *grp_it = NULL; 194 Elm_Object_Item *it, *sel_it = NULL, *grp_it = NULL;
188 Elm_Genlist_Item_Class *it_class, *it_group; 195 Elm_Genlist_Item_Class *it_class, *it_group;
196 Config *config = termio_config_get(term);
189 197
190 options_font_clear(); 198 options_font_clear();
191 199