[e_info] improve otput readability for '-prop' option
authorSergey Sizonov <s.sizonov@samsung.com>
Tue, 16 May 2017 10:44:19 +0000 (13:44 +0300)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 25 May 2017 23:26:07 +0000 (08:26 +0900)
Change-Id: I293d2628daf3548762cdf37e4e7758ac7352cba3
Signed-off-by: Sergey Sizonov <s.sizonov@samsung.com>
src/bin/e_info_client.c
src/bin/e_info_server.c

index fef1e2aa84234ccc71433acb04281756f55d8a91..6d7e04f024eeac385500f826fdae3f71d6f0f6d9 100644 (file)
@@ -1310,13 +1310,14 @@ _e_info_client_proc_dlog_switch(int argc, char **argv)
 #define PROP_USAGE \
    "0x<win_id> | -id win_id | -pid pid | -name \"win_name\" [property_name [property_value]]\n" \
    "Example:\n" \
-   "\tenlightenment_info -prop                     : Get all properties for a window specified via a touch\n" \
-   "\tenlightenment_info -prop Hidden              : Get the \"Hidden\" property for a window specified via a touch\n" \
-   "\tenlightenment_info -prop 0xb88ffaa0 Layer    : Get the \"Layer\" property for specified window\n" \
-   "\tenlightenment_info -prop 0xb88ffaa0 Hidden 1 : Set the \"Hidden\" property for specified window\n" \
-   "\tenlightenment_info -prop -pid 2502 Hidden 0  : Set the \"Hidden\" property for all windows belonged to a process\n" \
-   "\tenlightenment_info -prop -name err           : Get all properties for windows whose names contain an \"err\" substring\n" \
-   "\tenlightenment_info -prop -name \"\"            : Get all properties for all windows\n"
+   "\tenlightenment_info -prop                        : Get all properties for a window specified via a touch\n" \
+   "\tenlightenment_info -prop Hidden                 : Get the \"Hidden\" property for a window specified via a touch\n" \
+   "\tenlightenment_info -prop 0xb88ffaa0 Layer       : Get the \"Layer\" property for specified window\n" \
+   "\tenlightenment_info -prop 0xb88ffaa0 Hidden TRUE : Set the \"Hidden\" property for specified window\n" \
+   "\tenlightenment_info -prop -pid 2502 Hidden FALSE : Set the \"Hidden\" property for all windows belonged to a process\n" \
+   "\tenlightenment_info -prop -name err              : Get all properties for windows whose names contain an \"err\" substring\n" \
+   "\tenlightenment_info -prop -name \"\"               : Get all properties for all windows\n" \
+   "\tenlightenment_info -prop -name \"\" Hidden TRUE   : Set the \"Hidden\" property for all windows\n"
 
 /* property value can consist of several lines separated by '\n', which we got to print nicely */
 static void
@@ -1324,7 +1325,7 @@ _parse_property(const char *prop_name, const char *prop_value)
 {
    char *begin, *end;  /* current line */
 
-   /* process a simple case */
+   /* process a single line property value */
    if (!strchr(prop_value, '\n'))
      {
         printf("%27s : %s\n", prop_name, prop_value);
@@ -1361,6 +1362,7 @@ _cb_window_prop_get(const Eldbus_Message *msg)
    const char *name = NULL, *text = NULL;
    Eldbus_Message_Iter *array, *ec;
    Eina_Bool res;
+   int first_delimiter = 1;
 
    res = eldbus_message_error_get(msg, &name, &text);
    EINA_SAFETY_ON_TRUE_GOTO(res, finish);
@@ -1368,7 +1370,6 @@ _cb_window_prop_get(const Eldbus_Message *msg)
    res = eldbus_message_arguments_get(msg, "a(ss)", &array);
    EINA_SAFETY_ON_FALSE_GOTO(res, finish);
 
-   printf("--------------------------------------[ window prop ]-----------------------------------------------------\n");
    while (eldbus_message_iter_get_and_next(array, 'r', &ec))
      {
         const char *title = NULL;
@@ -1384,12 +1385,16 @@ _cb_window_prop_get(const Eldbus_Message *msg)
              continue;
           }
 
-        if (title && !strncmp(title, "[WINDOW PROP]", sizeof("[WINDOW PROP]")))
-          printf("---------------------------------------------------------------------------------------------------------\n");
+        if (title && !strncmp(title, "delimiter", sizeof("delimiter")))
+          {
+             if (first_delimiter)
+               first_delimiter = 0;
+             else
+               printf("---------------------------------------------------------------------------------------------------------\n");
+          }
         else
           _parse_property(title, value);
      }
-   printf("----------------------------------------------------------------------------------------------------------\n");
 
    return;
 
index dccd6038e38b785ae8a075a4d99287080489ed59..a564fd55635405943fa9f06e211179b2ef60ba52 100755 (executable)
@@ -1847,8 +1847,6 @@ _msg_fill_out_window_props(const Eldbus_Message *msg, Eldbus_Message_Iter *iter,
    Eldbus_Message_Iter* struct_of_ec;
    int idx;
 
-   __WINDOW_PROP_ARG_APPEND("[WINDOW PROP]", "[WINDOW PROP]");
-
    /* accordingly to -prop option rules (if user's provided some property name) */
    if (strlen(property_name))
      {
@@ -1881,7 +1879,7 @@ _msg_fill_out_window_props(const Eldbus_Message *msg, Eldbus_Message_Iter *iter,
                return eldbus_message_error_new(msg, FAIL_TO_SET_PROPERTY,
                        "get_window_prop: this property isn't setable");
           }
-        else
+        else /* if wanna get property */
           {
              if (win_properties[idx].get_prop)
                {
@@ -1899,8 +1897,12 @@ _msg_fill_out_window_props(const Eldbus_Message *msg, Eldbus_Message_Iter *iter,
                        "get_window_prop: this property isn't getable");
           }
      }
-   else
+   else /* if user wanna get all properties */
      {
+       /* to improve readability, if user wanna get properties for several windows, some
+        * delimiter being used */
+        __WINDOW_PROP_ARG_APPEND("delimiter", "");
+
         for (idx = 0; idx < win_property_size; ++idx)
           {
              if (win_properties[idx].get_prop)
@@ -1922,6 +1924,7 @@ _msg_fill_out_window_props(const Eldbus_Message *msg, Eldbus_Message_Iter *iter,
 #undef __WINDOW_PROP_ARG_APPEND
 }
 
+/* create the reply message and look for window(s) an user wanna get/set property(ies) for */
 static Eldbus_Message *
 _msg_window_prop_append(const Eldbus_Message *msg, uint32_t mode, const char *value,
         const char *property_name, const char *property_value)
@@ -1968,6 +1971,8 @@ _msg_window_prop_append(const Eldbus_Message *msg, uint32_t mode, const char *va
         ec = evas_object_data_get(o, "E_Client");
         if (!ec) continue;
 
+        /* here we're dealing with evas objects which are e_client */
+
         if (mode == WINDOW_ID_MODE)
           {
              Ecore_Window win = e_client_util_win_get(ec);