noti: handle generic "minicontrol" tag 59/96659/2
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 9 Nov 2016 15:07:45 +0000 (16:07 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 10 Nov 2016 10:14:36 +0000 (02:14 -0800)
The tags are used to distingish if notification should be shown
in indicator's minicontrol area or not. Currently only specialized tags were handled,
like "minicontrol_music", "minicontrol_call", etc.

This patch enables handling generic tag "minicontrol", which recieves
the lowest priority. 3rd part applications should use this tag if they
want to place its icon in minicontroller area.

Change-Id: I05de96ee1a4557faa68c9acb7c9cb023e43c6c31

inc/main.h
src/modules/information/noti.c

index 9fb85aa..225a20a 100644 (file)
  *     notification_free(noti);
  * }
  * @endcode
- * @remarks If you want to post notification with icon that is related to minicontroller(play/pause/record etc),
- * you need to add tag that consists of "minicontrol_<specific_tag>" \n
+ *
+ * @remarks If you want to post notification in indicator's minicontroller area
+ * at default position set notification tag to "minicontrol" as in code example below:
+ *
+ * @code
+ * notification_set_tag(noti, "minicontrol");
+ * @endcode
+ *
+ * @remarks If you want to post notification at specific position in indicator's minicontroller
+ * area you need to add tag that consists of "minicontrol_<specific_tag>" \n
  *  <b>\<specific_tag\></b> must be established in cooperation with indicator maintainers. \n\n
  *  For now six actions/apps are supported in showing minicontrol icons:
  *  - "call" - notifies about call status(ongoing/outgoing/established)
  *  - "video" - play/pause video
  *  - "voice_recorder" - while recording voice \n\n
  *
- * e.g.
+ *
  * To notify about music playing status(play/pause) use following tag:
  * @code
  * const char *tag = "minicontrol_music";
  * notification_set_tag(noti, tag);
  * @endcode
+ *
  * \n
  *
  * @subsection update_noti Update notification icon
index be5930d..9119dfd 100644 (file)
@@ -57,13 +57,13 @@ typedef struct {
 } minictrl_prop;
 
 static minictrl_prop noti_minictrl_app_list[] = {
-               {"call", 1},
-               {"call_mute", 2},
-               {"call_speaker", 3},
-               {"music", 4},
-               {"video", 5},
-               {"voice_recorder", 6},
-               /* {"3rd_party", 7} TODO This will be handled later*/
+               {"_call", 1},
+               {"_call_mute", 2},
+               {"_call_speaker", 3},
+               {"_music", 4},
+               {"_video", 5},
+               {"_voice_recorder", 6},
+               {"", 7}, /* Handle plain "minicontrol" tag (for 3rd part apps) */
 };
 
 struct noti_status {
@@ -197,13 +197,11 @@ static void show_image_icon_all(void)
 }
 
 
-static int noti_icon_priority_get(const char *tag)
+static int noti_icon_priority_get(const char *suffix)
 {
        int i;
-       int minictrl_len = strlen("minicontrol_");
        for (i = 0; i < ARRAY_SIZE(noti_minictrl_app_list); i++){
-               if (!strcmp(tag + minictrl_len, noti_minictrl_app_list[i].name)) {
-                       _D("Sufix is is:%s", noti_minictrl_app_list[i].name);
+               if (!strcmp(suffix, noti_minictrl_app_list[i].name)) {
                        return noti_minictrl_app_list[i].priority;
                }
        }
@@ -223,9 +221,10 @@ static void _noti_minicontrol_set(struct noti_status *noti_data)
        ret_if (!tag);
 
        if (util_string_prefix_check("minicontrol", tag)){
-               int p = noti_icon_priority_get(tag);
+               int minictrl_len = strlen("minicontrol");
+               int p = noti_icon_priority_get(tag + minictrl_len);
                if(p) {
-                       _D("The icon is for minicontrol area.");
+                       _D("The icon is for minicontrol area. tag: %s, prior: %d", tag, p);
                        noti_data->icon->priority = p;
                        noti_data->icon->area = INDICATOR_ICON_AREA_MINICTRL;
                }