ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/apps/extra.git/commit/?id=d11e1a00d38864203f618747673a7cbfb347ed16

commit d11e1a00d38864203f618747673a7cbfb347ed16
Author: Andy Williams <a...@andywilliams.me>
Date:   Tue Jan 10 12:17:55 2017 +0000

    General refactoring
---
 src/bin/extra_main.c | 22 ++++++++++------------
 src/lib/extra.c      |  2 +-
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/bin/extra_main.c b/src/bin/extra_main.c
index 8306cf1..51772d7 100644
--- a/src/bin/extra_main.c
+++ b/src/bin/extra_main.c
@@ -155,7 +155,7 @@ _download_done(void)
 }
 
 static void
-extra_win_show(Extra_Theme *theme)
+extra_theme_show(Extra_Theme *theme)
 {
    char title[1024], author[1024];
    char *preview;
@@ -174,7 +174,7 @@ extra_win_show(Extra_Theme *theme)
 
    elm_progressbar_value_set(ui.theme_ui.progress, 0.0);
 
-   preview = extra_theme_preview_get(_selected_theme);
+   preview = extra_theme_preview_get(theme);
    if (preview)
      {
         elm_image_file_set(ui.theme_ui.screenshot, preview, NULL);
@@ -184,10 +184,12 @@ extra_win_show(Extra_Theme *theme)
      {
         _preview_progress.progress_cb = _download_progress_cb;
         _preview_progress.done_cb = _download_done;
-        extra_theme_preview_download(&_preview_progress, _selected_theme);
+        extra_theme_preview_download(&_preview_progress, theme);
         evas_object_hide(ui.theme_ui.screenshot);
         evas_object_show(ui.theme_ui.progress);
      }
+
+   elm_object_disabled_set(ui.theme_ui.install, extra_theme_installed(theme));
 }
 
 static void
@@ -232,10 +234,7 @@ _theme_content_get(void *data, Evas_Object *obj, const 
char *source)
 static void
 _theme_select(void *data, Evas_Object *obj EINA_UNUSED, void *event_info 
EINA_UNUSED)
 {
-   extra_win_show(data);
-
-   elm_object_disabled_set(ui.theme_ui.install, 
extra_theme_installed(_selected_theme));
-
+   extra_theme_show(data);
 }
 
 static void
@@ -251,6 +250,8 @@ _extra_win_theme_list_refresh()
    Extra_Theme *theme;
    Eina_List *item;
 
+   elm_genlist_clear(ui.theme_list);
+
    EINA_LIST_FOREACH(extra_themes_list(), item, theme)
      _extra_win_theme_add(theme);
 }
@@ -262,7 +263,6 @@ _extra_win_sync_done_cb()
 
    _extra_win_progress_popup_del();
 
-   elm_genlist_clear(ui.theme_list);
    _extra_win_theme_list_refresh();
 
    first = eina_list_data_get(extra_themes_list());
@@ -277,7 +277,7 @@ extra_win_sync(void)
    _sync_progress.progress_cb = _extra_win_progress_popup_cb;
    _sync_progress.done_cb = _extra_win_sync_done_cb;
 
-   _extra_win_progress_popup_show("Downloading themes");
+   _extra_win_progress_popup_show("Updating themes");
 
    extra_sync(&_sync_progress);
 }
@@ -287,9 +287,8 @@ _extra_win_download_done_cb()
 {
    _extra_win_progress_popup_del();
 
-   elm_genlist_clear(ui.theme_list);
    _extra_win_theme_list_refresh();
-   _theme_select(_selected_theme, NULL, NULL);
+   extra_theme_show(_selected_theme);
 
    _extra_win_ask_for_default(_selected_theme);
 }
@@ -311,7 +310,6 @@ _extra_win_install_click_cb(void *data EINA_UNUSED,
                            void *event_info EINA_UNUSED)
 {
    _extra_win_install_execute();
-
 }
 
 
diff --git a/src/lib/extra.c b/src/lib/extra.c
index 9b6715b..6054fc5 100644
--- a/src/lib/extra.c
+++ b/src/lib/extra.c
@@ -507,9 +507,9 @@ _extra_theme_cache_load()
              eina_strbuf_append_length(buf, line->start, line->length);
           }
 
+        eina_file_close(cache);
         _fill_themes(buf);
         eina_strbuf_free(buf);
-        eina_file_close(cache);
      }
    else
      INF("No theme cache found");

-- 


Reply via email to