elm_code: Move the 'default' font name and size into the theme.

This can still be overridden by the standard method calls
devs/eunue/scrollable
Andy Williams 6 years ago
parent b67c13810b
commit 94afabf216
  1. 4
      data/elementary/themes/edc/elm/code.edc
  2. 4
      src/bin/elementary/test_code.c
  3. 6
      src/lib/elementary/elm_code_widget.c

@ -1,5 +1,9 @@
/* simple layout to pack our scrolling content into an elm_layout */
group { name: "elm/code/layout/default";
data {
item: "font.name" "Mono";
item: "font.size" "10";
}
parts {
part { name: "elm.swallow.content"; type: SWALLOW;
description { state: "default" 0.0;

@ -60,7 +60,6 @@ _elm_code_test_welcome_setup(Evas_Object *parent)
code = elm_code_create();
widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code));
elm_obj_code_widget_font_set(widget, NULL, 12);
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _elm_code_test_line_done_cb, NULL);
efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_clicked_cb, code);
@ -123,7 +122,6 @@ _elm_code_test_syntax_setup(Evas_Object *parent)
code = elm_code_create();
widget = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code));
elm_obj_code_widget_font_set(widget, NULL, 14);
elm_obj_code_widget_editable_set(widget, EINA_TRUE);
elm_obj_code_widget_syntax_enabled_set(widget, EINA_TRUE);
elm_obj_code_widget_code_get(widget)->file->mime = "text/x-csrc";
@ -172,7 +170,6 @@ _elm_code_test_diff_inline_setup(Evas_Object *parent)
code = elm_code_create();
diff = efl_add(ELM_CODE_WIDGET_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code));
elm_obj_code_widget_font_set(diff, NULL, 14);
evas_object_size_hint_weight_set(diff, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(diff, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -194,7 +191,6 @@ _elm_code_test_diff_setup(Evas_Object *parent)
elm_code_file_open(code, PACKAGE_DATA_DIR "/testdiff.diff");
diff = elm_code_diff_widget_add(parent, code);
elm_code_diff_widget_font_set(diff, NULL, 14);
return diff;
}

@ -2243,6 +2243,7 @@ EOLIAN static void
_elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
{
Evas_Object *background, *gridrows, *scroller;
const char *fontname, *fontsize;
efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
elm_object_focus_allow_set(obj, EINA_TRUE);
@ -2265,6 +2266,11 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
evas_object_show(background);
elm_object_part_content_set(scroller, "elm.swallow.background", background);
fontname = edje_object_data_get(elm_layout_edje_get(obj), "font.name");
fontsize = edje_object_data_get(elm_layout_edje_get(obj), "font.size");
if (fontname && fontsize)
_elm_code_widget_font_set(obj, pd, fontname, atoi(fontsize));
gridrows = elm_box_add(scroller);
evas_object_size_hint_weight_set(gridrows, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(gridrows, EVAS_HINT_FILL, 0.0);

Loading…
Cancel
Save