tasn pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=152d18c2decff1fcbed4390a125d6283a5f48a5d

commit 152d18c2decff1fcbed4390a125d6283a5f48a5d
Author: Tom Hacohen <t...@stosb.com>
Date:   Wed May 20 16:31:04 2015 +0100

    Fix usage of the now removed eo_error_set().
    
    This API has been removed from Eo.
---
 src/bin/test_application_server.c |  2 +-
 src/lib/elm_app_client.c          | 18 +++++++++------
 src/lib/elm_app_client.eo         |  1 +
 src/lib/elm_app_client_view.c     | 46 ++++++++++++++++++++-------------------
 src/lib/elm_app_client_view.eo    | 19 ++++++----------
 src/lib/elm_app_server.c          | 17 ++++++++++-----
 src/lib/elm_app_server.eo         |  1 +
 src/lib/elm_app_server_view.c     | 44 +++++++++++++++++++++----------------
 src/lib/elm_app_server_view.eo    | 16 ++++----------
 src/lib/elm_glview.c              | 10 +++++++--
 src/lib/elm_glview.eo             |  1 +
 src/lib/elm_inwin.c               |  2 +-
 src/lib/elm_widget.c              |  2 +-
 src/lib/elm_win.c                 | 16 +++++++++-----
 14 files changed, 106 insertions(+), 89 deletions(-)

diff --git a/src/bin/test_application_server.c 
b/src/bin/test_application_server.c
index 126a285..227755f 100644
--- a/src/bin/test_application_server.c
+++ b/src/bin/test_application_server.c
@@ -101,7 +101,7 @@ _create_view_cb(Elm_App_Server *app_server, const 
Eina_Value *args EINA_UNUSED,
      }
 
    view = eo_add(ELM_APP_SERVER_VIEW_CLASS, app_server,
-                        elm_app_server_view_constructor(NULL));
+                        elm_app_server_view_id_set(NULL));
 
    eo_do(view, id = elm_app_server_view_id_get());
    eo_do(app_server, pkg = elm_app_server_package_get());
diff --git a/src/lib/elm_app_client.c b/src/lib/elm_app_client.c
index c5bb560..5c4bd31 100644
--- a/src/lib/elm_app_client.c
+++ b/src/lib/elm_app_client.c
@@ -38,7 +38,7 @@ _sub_path_process(Elm_App_Client *eo, Eldbus_Message_Iter 
*obj_iter, Elm_App_Cli
           continue;
 
         view = eo_add(ELM_APP_CLIENT_VIEW_CLASS, eo,
-                             elm_app_client_view_constructor(obj_path));
+                             elm_app_client_view_path_set(obj_path));
         eina_hash_add(data->views, obj_path, view);
         if (!loading_list)
           eo_do(eo, eo_event_callback_call(ELM_APP_CLIENT_EVENT_VIEW_CREATED, 
view));
@@ -160,7 +160,7 @@ _elm_app_client_constructor(Eo *eo, Elm_App_Client_Data 
*data, const char *pkg)
    Eldbus_Object *obj;
    char *path;
 
-   EINA_SAFETY_ON_NULL_GOTO(pkg, error);
+   EINA_SAFETY_ON_NULL_RETURN(pkg);
 
    data->views = eina_hash_string_small_new(NULL);
 
@@ -177,10 +177,6 @@ _elm_app_client_constructor(Eo *eo, Elm_App_Client_Data 
*data, const char *pkg)
                                           eo, EINA_FALSE);
 
    free(path);
-
-   return;
-error:
-   eo_error_set(eo);
 }
 
 static void
@@ -220,7 +216,7 @@ _create_view_cb(void *data, const Eldbus_Message *msg, 
Eldbus_Pending *pending)
    if (!view)
      {
         view = eo_add(ELM_APP_CLIENT_VIEW_CLASS, eo,
-                             elm_app_client_view_constructor(view_path));
+                             elm_app_client_view_path_set(view_path));
         eina_hash_add(cdata->views, view_path, view);
         eo_do(eo, eo_event_callback_call(ELM_APP_CLIENT_EVENT_VIEW_CREATED,
                                          view));
@@ -305,6 +301,14 @@ _elm_app_client_view_open_cancel(Eo *eo EINA_UNUSED, 
Elm_App_Client_Data *_pd EI
    eldbus_pending_cancel(pending);
 }
 
+EOLIAN static Eo *
+_elm_app_client_eo_base_finalize(Eo *obj, Elm_App_Client_Data *data)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(data->views, NULL);
+
+   return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
 EOLIAN static void
 _elm_app_client_eo_base_destructor(Eo *eo, Elm_App_Client_Data *data)
 {
diff --git a/src/lib/elm_app_client.eo b/src/lib/elm_app_client.eo
index 32de834..76e15f4 100644
--- a/src/lib/elm_app_client.eo
+++ b/src/lib/elm_app_client.eo
@@ -50,6 +50,7 @@ class Elm_App_Client (Eo.Base)
    }
    implements {
       Eo.Base.destructor;
+      Eo.Base.finalize;
    }
    constructors {
       .constructor;
diff --git a/src/lib/elm_app_client_view.c b/src/lib/elm_app_client_view.c
index 2cc8c4f..3ad1399 100644
--- a/src/lib/elm_app_client_view.c
+++ b/src/lib/elm_app_client_view.c
@@ -13,6 +13,7 @@ typedef struct
 {
    Eldbus_Proxy *view_proxy;
    Elm_App_View_State state;
+   Eina_Stringshare *path;
 } Elm_App_Client_View_Data;
 
 static const char *_string_prop_get(const Eina_Value *v)
@@ -126,26 +127,25 @@ elm_app_client_view_internal_state_set(Eo *eo, 
Elm_App_View_State state)
                                     (void *)(uintptr_t)cdata->state));
 }
 
-EOLIAN static void
-_elm_app_client_view_constructor(Eo *eo, Elm_App_Client_View_Data *data, const 
char *path)
+EOLIAN static Eo *
+_elm_app_client_view_eo_base_finalize(Eo *eo, Elm_App_Client_View_Data *data)
 {
    Elm_App_Client *parent = NULL;
-   const char *package = path;
+   const char *package = data->path;
    Eldbus_Connection *conn;
    Eldbus_Object *obj;
 
-   EINA_SAFETY_ON_NULL_GOTO(path, error);
-   eo_do_super(eo, MY_CLASS, eo_constructor());
-
    eo_do(eo, parent = eo_parent_get());
-   EINA_SAFETY_ON_TRUE_GOTO((!parent) ||
-                            (!eo_isa(parent, ELM_APP_CLIENT_CLASS)), error);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL((!parent) ||
+                            (!eo_isa(parent, ELM_APP_CLIENT_CLASS)), NULL);
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(data->path, NULL);
 
    eo_do(parent, package = elm_app_client_package_get());
 
    eldbus_init();
    conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
-   obj = eldbus_object_get(conn, package, path);
+   obj = eldbus_object_get(conn, package, data->path);
    data->view_proxy = eldbus_proxy_get(obj,
                                        "org.enlightenment.ApplicationView1");
    eldbus_proxy_properties_monitor(data->view_proxy, EINA_TRUE);
@@ -156,10 +156,7 @@ _elm_app_client_view_constructor(Eo *eo, 
Elm_App_Client_View_Data *data, const c
                                    ELDBUS_PROXY_EVENT_PROPERTY_LOADED,
                                    _props_loaded, eo);
 
-   return;
-
-error:
-   eo_error_set(eo);
+   return eo_do_super_ret(eo, MY_CLASS, eo, eo_finalize());
 }
 
 static void
@@ -272,6 +269,18 @@ _elm_app_client_view_window_get(Eo *eo EINA_UNUSED, 
Elm_App_Client_View_Data *da
    return _int_prop_get(v);
 }
 
+EOLIAN static void
+_elm_app_client_view_path_set(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data 
*data, const char *path)
+{
+   if (eo_finalized_get())
+     {
+        ERR("Can't set id after object has been created.");
+        return;
+     }
+
+   data->path = eina_stringshare_add(path);
+}
+
 EOLIAN static const char*
 _elm_app_client_view_path_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data 
*data)
 {
@@ -305,16 +314,9 @@ _elm_app_client_view_eo_base_destructor(Eo *eo, 
Elm_App_Client_View_Data *data)
    eldbus_connection_unref(conn);
    eldbus_shutdown();
 
-   eo_do_super(eo, MY_CLASS, eo_destructor());
-}
+   eina_stringshare_del(data->path);
 
-EOLIAN static Eo *
-_elm_app_client_view_eo_base_constructor(Eo *obj, Elm_App_Client_View_Data 
*_pd EINA_UNUSED)
-{
-   eo_error_set(obj);
-   ERR("Only custom constructor can be used with '%s' class", MY_CLASS_NAME);
-
-   return NULL;
+   eo_do_super(eo, MY_CLASS, eo_destructor());
 }
 
 #include "elm_app_client_view.eo.c"
diff --git a/src/lib/elm_app_client_view.eo b/src/lib/elm_app_client_view.eo
index 783bb1c..df84dd5 100644
--- a/src/lib/elm_app_client_view.eo
+++ b/src/lib/elm_app_client_view.eo
@@ -38,12 +38,17 @@ class Elm_App_Client_View (Eo.Base)
             pixels: const(ubyte)*; /*@ uchar array, with all bytes of icon */
          }
       }
+      path_set {
+        params {
+            path: const(char) *;
+        }
+      }
       @property path {
          get {
             /*@ Get DBus path of view */
          }
          values {
-            ret: const(char)*; /*@ DBus path of view */
+            ret: Eina_Stringshare *; /*@ DBus path of view */
          }
       }
       @property package {
@@ -78,13 +83,6 @@ class Elm_App_Client_View (Eo.Base)
             ret: const(char)*; /*@ title of view */
          }
       }
-      constructor {
-         /*@ Class constructor of elm_app_client_view */
-         legacy: null;
-         params {
-            @in path: const(char)*; /*@ DBus path of view */
-         }
-      }
       pause {
          /*@ Pause view */
          params {
@@ -108,11 +106,8 @@ class Elm_App_Client_View (Eo.Base)
       }
    }
    implements {
-      Eo.Base.constructor;
       Eo.Base.destructor;
-   }
-   constructors {
-      .constructor;
+      Eo.Base.finalize;
    }
    events {
       state,changed; /*@ State of view changed. */
diff --git a/src/lib/elm_app_server.c b/src/lib/elm_app_server.c
index e5dc559..361b8a3 100644
--- a/src/lib/elm_app_server.c
+++ b/src/lib/elm_app_server.c
@@ -202,8 +202,8 @@ _elm_app_server_constructor(Eo *obj, Elm_App_Server_Data 
*data, const char *pkg,
 
    data->create_view_cb = create_view_cb;
 
-   EINA_SAFETY_ON_NULL_GOTO(data->create_view_cb, error);
-   EINA_SAFETY_ON_TRUE_GOTO(!pkg, error);
+   EINA_SAFETY_ON_NULL_RETURN(data->create_view_cb);
+   EINA_SAFETY_ON_TRUE_RETURN(!pkg);
 
    data->views = eina_hash_string_small_new(NULL);
    data->PID = getpid();
@@ -256,7 +256,7 @@ _elm_app_server_constructor(Eo *obj, Elm_App_Server_Data 
*data, const char *pkg,
              progress = elm_app_server_view_props_progress_get(view_eet_props);
 
              view = eo_add(ELM_APP_SERVER_VIEW_CLASS, obj,
-                                  elm_app_server_view_constructor(view_id));
+                                  elm_app_server_view_id_set(view_id));
              if (!view)
                continue;
 
@@ -277,9 +277,6 @@ free_views_eet:
    app_server_views_eet_shutdown();
 
    return;
-
-error:
-   eo_error_set(obj);
 }
 
 EOLIAN static void
@@ -417,6 +414,14 @@ _elm_app_server_view_add(Eo *obj EINA_UNUSED, 
Elm_App_Server_Data *data, Elm_App
    _view_append(data, view);
 }
 
+EOLIAN static Eo *
+_elm_app_server_eo_base_finalize(Eo *obj, Elm_App_Server_Data *data)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(data->pkg, NULL);
+
+   return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
+}
+
 EOLIAN static void
 _elm_app_server_eo_base_destructor(Eo *obj, Elm_App_Server_Data *data)
 {
diff --git a/src/lib/elm_app_server.eo b/src/lib/elm_app_server.eo
index 225430e..23d566c 100644
--- a/src/lib/elm_app_server.eo
+++ b/src/lib/elm_app_server.eo
@@ -88,6 +88,7 @@ class Elm_App_Server (Eo.Base)
    }
    implements {
       Eo.Base.destructor;
+      Eo.Base.finalize;
    }
    constructors {
       .constructor;
diff --git a/src/lib/elm_app_server_view.c b/src/lib/elm_app_server_view.c
index 36694c4..df735e9 100644
--- a/src/lib/elm_app_server_view.c
+++ b/src/lib/elm_app_server_view.c
@@ -299,16 +299,18 @@ _elm_app_server_view_path_get(Eo *obj EINA_UNUSED, 
Elm_App_Server_View_Data *dat
 }
 
 EOLIAN static void
-_elm_app_server_view_constructor(Eo *obj, Elm_App_Server_View_Data *data, 
const char *id)
+_elm_app_server_view_id_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data 
*data, const char *id)
 {
    Elm_App_Server *server = NULL;
-   const char *server_path = NULL;
-   char view_path[PATH_MAX];
 
-   eo_do_super(obj, MY_CLASS, eo_constructor());
+   if (eo_finalized_get())
+     {
+        ERR("Can't set id after object has been created.");
+        return;
+     }
 
    eo_do(obj, server = eo_parent_get());
-   EINA_SAFETY_ON_TRUE_GOTO(!server || !eo_isa(server, ELM_APP_SERVER_CLASS), 
error);
+   EINA_SAFETY_ON_TRUE_RETURN(!server || !eo_isa(server, 
ELM_APP_SERVER_CLASS));
 
    if (!id)
      {
@@ -334,8 +336,24 @@ _elm_app_server_view_constructor(Eo *obj, 
Elm_App_Server_View_Data *data, const
         if (valid)
           data->id = eina_stringshare_add(id);
      }
+}
+
+EOLIAN static Eo *
+_elm_app_server_view_eo_base_finalize(Eo *obj, Elm_App_Server_View_Data *data)
+{
+   const char *server_path = NULL;
+   char view_path[PATH_MAX];
+   Elm_App_Server *server = NULL;
 
-   EINA_SAFETY_ON_NULL_GOTO(data->id, error);
+   eo_do(obj, server = eo_parent_get());
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(!server || !eo_isa(server, 
ELM_APP_SERVER_CLASS), NULL);
+
+
+   if (!data->id)
+     {
+        ERR("Failed");
+        return NULL;
+     }
 
    eo_do(server, server_path = elm_app_server_path_get());
    snprintf(view_path, sizeof(view_path), "%s/%s", server_path, data->id);
@@ -350,10 +368,7 @@ _elm_app_server_view_constructor(Eo *obj, 
Elm_App_Server_View_Data *data, const
    data->title = eina_stringshare_add("");
    data->icon_name = eina_stringshare_add("");
 
-   return;
-
-error:
-   eo_error_set(obj);
+   return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
 }
 
 EOLIAN static void
@@ -370,13 +385,4 @@ _elm_app_server_view_eo_base_destructor(Eo *obj, 
Elm_App_Server_View_Data *data)
    eo_do_super(obj, MY_CLASS, eo_destructor());
 }
 
-EOLIAN static Eo *
-_elm_app_server_view_eo_base_constructor(Eo *obj, Elm_App_Server_View_Data 
*_pd EINA_UNUSED)
-{
-   eo_error_set(obj);
-   ERR("Only custom constructor can be used with '%s' class", MY_CLASS_NAME);
-
-   return NULL;
-}
-
 #include "elm_app_server_view.eo.c"
diff --git a/src/lib/elm_app_server_view.eo b/src/lib/elm_app_server_view.eo
index 11c465f..9464296 100644
--- a/src/lib/elm_app_server_view.eo
+++ b/src/lib/elm_app_server_view.eo
@@ -47,10 +47,12 @@ class Elm_App_Server_View (Eo.Base)
          }
       }
       @property id {
+         set {
+         }
          get {
          }
          values {
-            ret: Eina_Stringshare *;
+            ret: const(char) *;
          }
       }
       @property state {
@@ -81,13 +83,6 @@ class Elm_App_Server_View (Eo.Base)
             pixels: const(ubyte)*;
          }
       }
-      constructor {
-         /*@ Class constructor of elm_app_server_view */
-         legacy: null;
-         params {
-            @in id: const(char)* @nullable; /*@ identifier of view */
-         }
-      }
       pause {
       }
       resume {
@@ -98,11 +93,8 @@ class Elm_App_Server_View (Eo.Base)
       }
    }
    implements {
-      Eo.Base.constructor;
       Eo.Base.destructor;
-   }
-   constructors {
-      .constructor;
+      Eo.Base.finalize;
    }
    events {
       resumed; /*@ Called when view must be resumed */
diff --git a/src/lib/elm_glview.c b/src/lib/elm_glview.c
index 8799f00..559d698 100644
--- a/src/lib/elm_glview.c
+++ b/src/lib/elm_glview.c
@@ -316,12 +316,18 @@ _elm_glview_version_constructor(Eo *obj, Elm_Glview_Data 
*sd,
          evas_obj_type_set(MY_CLASS_NAME_LEGACY),
          evas_obj_smart_callbacks_descriptions_set(_smart_callbacks),
          elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_ANIMATION));
+}
 
+EOLIAN static Eo *
+_elm_glview_eo_base_finalize(Eo *obj, Elm_Glview_Data *sd)
+{
    if (!sd->evasgl)
      {
-        eo_error_set(obj);
-        return;
+        ERR("Failed");
+        return NULL;
      }
+
+   return eo_do_super_ret(obj, MY_CLASS, obj, eo_finalize());
 }
 
 EOLIAN static Evas_GL_API*
diff --git a/src/lib/elm_glview.eo b/src/lib/elm_glview.eo
index 6ce08a1..866e82d 100644
--- a/src/lib/elm_glview.eo
+++ b/src/lib/elm_glview.eo
@@ -209,6 +209,7 @@ class Elm.Glview (Elm.Widget)
    }
    implements {
       class.constructor;
+      Eo.Base.finalize;
       Evas.Object_Smart.add;
       Evas.Object_Smart.del;
       Evas.Object_Smart.resize;
diff --git a/src/lib/elm_inwin.c b/src/lib/elm_inwin.c
index 760d988..69c0f05 100644
--- a/src/lib/elm_inwin.c
+++ b/src/lib/elm_inwin.c
@@ -110,7 +110,7 @@ _elm_inwin_eo_base_constructor(Eo *obj, void *_pd 
EINA_UNUSED)
 
    if (parent && !eo_isa(parent, ELM_WIN_CLASS))
      {
-        eo_error_set(obj);  /* *has* to have a parent window */
+        ERR("Failed");
         return NULL;
      }
 
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 3b1cda0..1fe8a99 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -4249,7 +4249,7 @@ _elm_widget_item_eo_base_constructor(Eo *eo_item, 
Elm_Widget_Item_Data *item)
 
    if (!_elm_widget_is(widget))
      {
-        eo_error_set(eo_item);
+        ERR("Failed");
         return NULL;
      }
 
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 1bd208d..4a84e38 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3160,7 +3160,7 @@ _cb_deled(void *_data,
    return EO_CALLBACK_CONTINUE;
 }
 
-static void
+static Eo *
 _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, 
Elm_Win_Type type)
 {
    sd->obj = obj; // in ctor
@@ -3501,8 +3501,7 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, 
const char *name, Elm_Win_
    if (!tmp_sd.ee)
      {
         ERR("Cannot create window.");
-        eo_error_set(obj);
-        return;
+        return NULL;
      }
 
    eo_do(obj, eo_parent_set(ecore_evas_get(tmp_sd.ee)));
@@ -3660,7 +3659,7 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, 
const char *name, Elm_Win_
 #endif
 
    /* do not append to list; all windows render as black rects */
-   if (type == ELM_WIN_FAKE) return;
+   if (type == ELM_WIN_FAKE) return obj;
    _elm_win_list = eina_list_append(_elm_win_list, obj);
    _elm_win_count++;
 
@@ -3739,13 +3738,18 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, 
const char *name, Elm_Win_
 
    eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_ADD, _cb_added, sd),
          eo_event_callback_add(EO_EV_CALLBACK_DEL, _cb_deled, sd));
+
+   return obj;
 }
 
 EOLIAN static Eo *
 _elm_win_eo_base_finalize(Eo *obj, Elm_Win_Data *_pd)
 {
-   _elm_win_finalize_internal(obj, _pd, _pd->name, _pd->type);
-   eo_do_super(obj, MY_CLASS, obj = eo_finalize());
+   obj = _elm_win_finalize_internal(obj, _pd, _pd->name, _pd->type);
+   if (obj)
+     {
+        eo_do_super(obj, MY_CLASS, obj = eo_finalize());
+     }
    return obj;
 }
 

-- 


Reply via email to