ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=f1d55e70e8b7c23f5c1cca7b8a869dfe76a82f51

commit f1d55e70e8b7c23f5c1cca7b8a869dfe76a82f51
Author: Andy Williams <a...@andywilliams.me>
Date:   Tue May 19 22:28:05 2015 +0100

    Create helper for opening URLs
---
 src/bin/edi_main.c          | 15 +++++++++++++++
 src/bin/edi_private.h       |  2 ++
 src/bin/screens/edi_about.c | 12 +-----------
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c
index 18c1451..24322ad 100644
--- a/src/bin/edi_main.c
+++ b/src/bin/edi_main.c
@@ -909,6 +909,21 @@ edi_close()
    elm_exit();
 }
 
+void
+edi_open_url(const char *url)
+{
+   const char *format;
+   char *cmd;
+
+   format = "xdg-open \"%s\"";
+
+   cmd = malloc(sizeof(char) * (strlen(format) + strlen(url) - 1));
+   sprintf(cmd, format, url);
+   ecore_exe_run(cmd, NULL);
+
+   free(cmd);
+}
+
 static Eina_Bool
 _edi_log_init()
 {
diff --git a/src/bin/edi_private.h b/src/bin/edi_private.h
index 294a520..e6b3ddf 100644
--- a/src/bin/edi_private.h
+++ b/src/bin/edi_private.h
@@ -33,6 +33,8 @@ Evas_Object *edi_open(const char *path);
 
 void edi_close();
 
+void edi_open_url();
+
 // TODO remove this once our filepanel is updating gracefully
 void _edi_filepanel_reload();
 
diff --git a/src/bin/screens/edi_about.c b/src/bin/screens/edi_about.c
index addbbe8..3337bea 100644
--- a/src/bin/screens/edi_about.c
+++ b/src/bin/screens/edi_about.c
@@ -16,17 +16,7 @@ _edi_about_exit(void *data, Evas_Object *obj EINA_UNUSED, 
void *event_info EINA_
 static void
 _edi_about_url_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info 
EINA_UNUSED)
 {
-   const char *url, *format;
-   char *cmd;
-
-   url = (const char *)data;
-   format = "xdg-open \"%s\"";
-
-   cmd = malloc(sizeof(char) * (strlen(format) + strlen(url) - 1));
-   sprintf(cmd, format, url);
-   ecore_exe_run(cmd, NULL);
-
-   free(cmd);
+   edi_open_url((const char *)data);
 }
 
 Evas_Object *

-- 


Reply via email to