keypad: better align of name-type of contacts.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Fri, 10 Aug 2012 23:53:55 +0000 (20:53 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Fri, 10 Aug 2012 23:53:55 +0000 (20:53 -0300)
provide the "name - type" from C, then use it alternatively.

data/themes/includes/keypad.edc
dialer/keypad.c

index ef8e7f5..3361ba8 100644 (file)
@@ -78,7 +78,7 @@ group {
       }
 
       part {
-         name: "elm.text.contact";
+         name: "elm.text.contact-and-type";
          type: TEXT;
          mouse_events: 0;
          scale: 1;
@@ -95,86 +95,13 @@ group {
             }
             rel2 {
                to: "elm.text.display";
-               relative: 0.5 1.0;
-               offset: -ITEM_PADDING -1;
-            }
-            text {
-               font: FONT_BOLD;
-               size: SIZE_SMALL;
-               align: 1.0 0.0;
-               ellipsis: 0.0;
-               min: 0 1;
-            }
-         }
-         description {
-            state: "show" 0.0;
-            inherit: "default" 0.0;
-            visible: 1;
-         }
-      }
-
-      part {
-         name: "text.separator";
-         type: TEXT;
-         mouse_events: 0;
-         scale: 1;
-         description {
-            state: "default" 0.0;
-            color: 255 255 255 255;
-            color_class: "light";
-            visible: 0;
-            fixed: 1 1;
-            rel1 {
-               to: "elm.text.contact";
-               relative: 1.0 0.0;
-               offset:  0 0;
-            }
-            rel2 {
-               to: "elm.text.phone.type";
-               relative: 0.0 1.0;
-               offset: -1 -1;
-            }
-            text {
-               font: FONT_BOLD;
-               size: SIZE_SMALL;
-               align: 0.5 0.0;
-               min: 0 1;
-               text: "-";
-            }
-         }
-         description {
-            state: "show" 0.0;
-            inherit: "default" 0.0;
-            visible: 1;
-         }
-      }
-
-      part {
-         name: "elm.text.phone.type";
-         type: TEXT;
-         mouse_events: 0;
-         scale: 1;
-         description {
-            state: "default" 0.0;
-            color: 255 255 255 255;
-            color_class: "light";
-            visible: 0;
-            fixed: 1 1;
-            rel1 {
-               to: "elm.text.display";
-               relative: 0.5 1.0;
-               offset:  ITEM_PADDING 0;
-            }
-            rel2 {
-               to: "elm.text.display";
                relative: 1.0 1.0;
                offset: -1 -1;
             }
             text {
                font: FONT_BOLD;
                size: SIZE_SMALL;
-               align: 0.0 0.0;
-               ellipsis: 0.0;
+               align: 0.5 0.0;
                min: 0 1;
             }
          }
@@ -196,7 +123,7 @@ group {
             max: WIDTH WIDTH; /* keep it tight centered */
             rel1 {
                relative: 0.0 1.0;
-               to_y: "elm.text.contact";
+               to_y: "elm.text.contact-and-type";
             }
             rel2 {
                relative: 1.0 0.0;
@@ -263,7 +190,7 @@ group {
          }                                                              \
       }
 
-      SEPARATOR("number", 1.0, 0, "elm.text.contact");
+      SEPARATOR("number", 1.0, 0, "elm.text.contact-and-type");
       SEPARATOR("actions", 0.0, -SEPARATOR_HEIGHT, "bg.actions");
 #undef SEPARATOR
 
@@ -563,18 +490,14 @@ group {
          signal: "show,contact";
          source: "keypad";
          action: STATE_SET "show" 0.0;
-         target: "elm.text.contact";
-         target: "elm.text.phone.type";
-         target: "text.separator";
+         target: "elm.text.contact-and-type";
       }
 
       program {
          signal: "hide,contact";
          source: "keypad";
          action: STATE_SET "default" 0.0;
-         target: "elm.text.contact";
-         target: "elm.text.phone.type";
-         target: "text.separator";
+         target: "elm.text.contact-and-type";
       }
    }
 }
index ba94706..59aa467 100644 (file)
@@ -31,6 +31,10 @@ static void _number_display(Keypad *ctx)
        const char *type;
        if (!s) {
                elm_object_part_text_set(ctx->self, "elm.text.display", "");
+               elm_object_part_text_set(ctx->self, "elm.text.contact-and-type",
+                                               "");
+               elm_object_part_text_set(ctx->self, "elm.text.contact", "");
+               elm_object_part_text_set(ctx->self, "elm.text.phone.type", "");
                elm_object_signal_emit(ctx->self, "disable,save", "keypad");
                elm_object_signal_emit(ctx->self, "disable,backspace",
                                        "keypad");
@@ -40,11 +44,23 @@ static void _number_display(Keypad *ctx)
 
        Contact_Info *info = gui_contact_search(number, &type);
        if (info) {
-               elm_object_part_text_set(ctx->self, "elm.text.contact", contact_info_full_name_get(info));
+               const char *name = contact_info_full_name_get(info);
+               char buf[1024];
+
+               snprintf(buf, sizeof(buf), "%s - %s", name, type);
+
+               elm_object_part_text_set(ctx->self, "elm.text.contact-and-type",
+                                               buf);
+               elm_object_part_text_set(ctx->self, "elm.text.contact", name);
                elm_object_part_text_set(ctx->self, "elm.text.phone.type", type);
                elm_object_signal_emit(ctx->self, "show,contact", "keypad");
-       } else
+       } else {
                elm_object_signal_emit(ctx->self, "hide,contact", "keypad");
+               elm_object_part_text_set(ctx->self, "elm.text.contact-and-type",
+                                               "");
+               elm_object_part_text_set(ctx->self, "elm.text.contact", "");
+               elm_object_part_text_set(ctx->self, "elm.text.phone.type", "");
+       }
 
        elm_object_part_text_set(ctx->self, "elm.text.display", s);
        free(s);
@@ -445,6 +461,9 @@ Evas_Object *keypad_add(Evas_Object *parent)
                                        _on_clicked, ctx);
 
        elm_object_part_text_set(obj, "elm.text.display", "");
+       elm_object_part_text_set(ctx->self, "elm.text.contact-and-type", "");
+       elm_object_part_text_set(ctx->self, "elm.text.contact", "");
+       elm_object_part_text_set(ctx->self, "elm.text.phone.type", "");
        elm_object_signal_emit(obj, "hide,contact", "keypad");
        elm_object_signal_emit(obj, "disable,save", "keypad");
        elm_object_signal_emit(obj, "disable,backspace", "keypad");