void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op),
void *user_data, uid_t uid);
+/**
+ * @brief Sets the default button to display highlight on the notification.
+ * @since_tizen 3.0
+ * @remarks If you want to default button is off, you set that index is zero
+ * @param[in] noti The notification handle
+ * @param[in] index The notification button index
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_button_index_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_default_button(noti, NOTIFICATION_BUTTON_1);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+
+ ...
+
+}
+ * @endcode
+ */
+int notification_set_default_button(notification_h noti, notification_button_index_e index);
+
+/**
+ * @brief Gets the default button to display highlight on the notification.
+ * @since_tizen 3.0
+ * @param[in] noti The notification handle
+ * @param[out] index The notification button index
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Notification handle should be created by notification_create().
+ * @see #notification_button_index_e
+ * @par Sample code:
+ * @code
+#include <notification.h>
+...
+{
+ notification_h noti = NULL;
+ notification_button_index_e index;
+ int noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ if(noti == NULL) {
+ return;
+ }
+
+ noti_err = notification_set_default_button(noti, &index);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ notification_free(noti);
+ return;
+ }
+
+ ...
+
+}
+ * @endcode
+ */
+int notification_get_default_button(notification_h noti, notification_button_index_e *index);
+
/**
* @brief This function translate localized texts
* @param[in] noti The notification handle that is created by notification_create()
char *tag;
bool ongoing_flag;
bool auto_remove;
+ notification_button_index_e default_button_index;
uid_t uid;
};
NOTIFICATION_DATA_TYPE_TAG,
NOTIFICATION_DATA_TYPE_ONGOING_FLAG,
NOTIFICATION_DATA_TYPE_AUTO_REMOVE,
+ NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON,
NOTIFICATION_DATA_TYPE_UID,
} notification_data_type_e;
noti->display_applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR;
noti->auto_remove = true;
noti->ongoing_flag = false;
+ noti->default_button_index = 0;
if (getuid() >= REGULAR_UID_MIN) {
noti->caller_pkgname = notification_get_pkgname_by_pid();
new_noti->ongoing_flag = noti->ongoing_flag;
new_noti->auto_remove = noti->auto_remove;
+ new_noti->default_button_index = noti->default_button_index;
new_noti->uid = noti->uid;
new_noti->app_icon_path = NULL;
progress_percentage DOUBLE default 0, \
ongoing_flag INTEGER default 0, \
auto_remove INTEGER default 1, \
+ default_button_index INTEGER default 0, \
uid INTEGER \
); \
create table if not exists noti_group_data ( \
progress_percentage DOUBLE default 0, \
ongoing_flag INTEGER default 0, \
auto_remove INTEGER default 1, \
+ default_button_index INTEGER default 0, \
uid INTEGER, \
template_name TEXT, \
UNIQUE (caller_pkgname, template_name) \
return noti;
}
+
+int notification_set_default_button(notification_h noti, notification_button_index_e index)
+{
+ if (noti == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ if (index < 0 && index > NOTIFICATION_BUTTON_6)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ noti->default_button_index = index;
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
+int notification_get_default_button(notification_h noti, notification_button_index_e *index)
+{
+ if (noti == NULL || index == NULL)
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+
+ *index = noti->default_button_index;
+
+ return NOTIFICATION_ERROR_NONE;
+}
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TAG, g_variant_new_string((const gchar *)noti->tag));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_ONGOING_FLAG, g_variant_new_int32(noti->ongoing_flag));
-
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_AUTO_REMOVE, g_variant_new_int32(noti->auto_remove));
+ g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, g_variant_new_int32(noti->default_button_index));
g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_UID, g_variant_new_int32(noti->uid));
result_body = g_variant_builder_end(&builder);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TAG, "&s", &tag);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_ONGOING_FLAG, "i", ¬i->ongoing_flag);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_AUTO_REMOVE, "i", ¬i->auto_remove);
+ _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, "i", ¬i->default_button_index);
_variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_UID, "i", ¬i->uid);
noti->caller_pkgname = _dup_string(caller_pkgname);
"b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, "
"sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, "
"flags_for_property, flag_simmode, display_applist, "
- "progress_size, progress_percentage, ongoing_flag, auto_remove, uid) values ("
+ "progress_size, progress_percentage, ongoing_flag, auto_remove, default_button_index, uid) values ("
"%d, "
"%d, "
"'%s', '%s', "
"'%s', '%s', "
"%d, '%s', %d, '%s', %d, %d, %d, %d,"
"%d, %d, %d, "
- "$progress_size, $progress_percentage, %d, %d, %d)",
+ "$progress_size, $progress_percentage, %d, %d, %d, %d)",
noti->type,
noti->layout,
NOTIFICATION_CHECK_STR(noti->caller_pkgname),
noti->flags_for_property, flag_simmode, noti->display_applist,
noti->ongoing_flag,
noti->auto_remove,
+ noti->default_button_index,
noti->uid);
/* Free decoded data */
"flags_for_property = %d, flag_simmode = %d, "
"display_applist = %d, "
"progress_size = $progress_size, progress_percentage = $progress_percentage, "
- "ongoing_flag = %d, auto_remove = %d "
+ "ongoing_flag = %d, auto_remove = %d, default_button_index = %d "
"where priv_id = %d ",
noti->type,
noti->layout,
noti->led_on_ms,
noti->led_off_ms,
noti->flags_for_property, flag_simmode, noti->display_applist,
- noti->ongoing_flag, noti->auto_remove,
+ noti->ongoing_flag, noti->auto_remove, noti->default_button_index,
noti->priv_id);
/* Free decoded data */
noti->ongoing_flag = sqlite3_column_int(stmt, col++);
noti->auto_remove = sqlite3_column_int(stmt, col++);
+ noti->default_button_index = sqlite3_column_int(stmt, col++);
noti->app_icon_path = NULL;
noti->app_name = NULL;