lib/notification/E_Notify.h
Go to the documentation of this file.
00001 #ifndef E_NOTIFY_H 00002 #define E_NOTIFY_H 00003 00004 #include <Eina.h> 00005 #include <Evas.h> 00006 #include <E_DBus.h> 00007 00015 /* notifications */ 00016 typedef struct E_Notification_Image E_Notification_Image; 00017 typedef struct E_Notification E_Notification; 00018 typedef struct E_Notification_Action E_Notification_Action; 00019 00020 typedef enum E_Notification_Urgency E_Notification_Urgency; 00021 typedef enum E_Notification_Hint_Type E_Notification_Hint_Type; 00022 typedef enum E_Notification_Closed_Reason E_Notification_Closed_Reason; 00023 00024 /* method returns */ 00025 typedef struct E_Notification_Return_Notify E_Notification_Return_Notify; 00026 typedef struct E_Notification_Return_Get_Capabilities E_Notification_Return_Get_Capabilities; 00027 typedef struct E_Notification_Return_Get_Server_Information E_Notification_Return_Get_Server_Information; 00028 00029 00030 /* signal events */ 00031 typedef struct E_Notification_Event_Action_Invoked E_Notification_Event_Action_Invoked; 00032 typedef struct E_Notification_Event_Notification_Closed E_Notification_Event_Notification_Closed; 00033 00034 /* enums */ 00035 00036 enum E_Notification_Urgency 00037 { 00038 E_NOTIFICATION_URGENCY_LOW, 00039 E_NOTIFICATION_URGENCY_NORMAL, 00040 E_NOTIFICATION_URGENCY_CRITICAL 00041 }; 00042 00043 enum E_Notification_Closed_Reason 00044 { 00045 E_NOTIFICATION_CLOSED_EXPIRED, 00046 E_NOTIFICATION_CLOSED_DISMISSED, 00047 E_NOTIFICATION_CLOSED_REQUESTED, 00048 E_NOTIFICATION_CLOSED_UNDEFINED 00049 }; 00050 00051 enum E_Notification_Hint_Type 00052 { 00053 E_NOTIFICATION_HINT_URGENCY = (1 << 0), 00054 E_NOTIFICATION_HINT_CATEGORY = (1 << 1), 00055 E_NOTIFICATION_HINT_DESKTOP = (1 << 2), 00056 E_NOTIFICATION_HINT_SOUND_FILE = (1 << 3), 00057 E_NOTIFICATION_HINT_TRANSIENT = (1 << 4), 00058 E_NOTIFICATION_HINT_RESIDENT = (1 << 5), 00059 E_NOTIFICATION_HINT_ACTION_ICONS = (1 << 6), 00060 E_NOTIFICATION_HINT_SUPPRESS_SOUND = 0x10, 00061 E_NOTIFICATION_HINT_XY = 0x20, 00062 E_NOTIFICATION_HINT_IMAGE_DATA = 0x40 00063 }; 00064 00065 /* client method returns */ 00066 struct E_Notification_Return_Notify 00067 { 00068 unsigned int notification_id; 00069 E_Notification *notification; 00070 }; 00071 00072 struct E_Notification_Return_Get_Capabilities 00073 { 00074 Eina_List *capabilities; 00075 }; 00076 00077 struct E_Notification_Return_Get_Server_Information 00078 { 00079 const char *name; 00080 const char *vendor; 00081 const char *version; 00082 const char *spec_version; 00083 }; 00084 00085 /* signals */ 00086 struct E_Notification_Event_Notification_Closed 00087 { 00088 unsigned int notification_id; 00089 E_Notification_Closed_Reason reason; 00090 }; 00091 00092 struct E_Notification_Event_Action_Invoked 00093 { 00094 unsigned int notification_id; 00095 char *action_id; 00096 }; 00097 00098 #ifdef __cplusplus 00099 extern "C" { 00100 #endif 00101 00102 EAPI int e_notification_init(void); 00103 EAPI int e_notification_shutdown(void); 00104 00105 /* client */ 00106 EAPI void e_notification_send(E_Notification *n, E_DBus_Callback_Func func, void *data); 00107 EAPI void e_notification_get_capabilities(E_DBus_Callback_Func func, void *data); 00108 EAPI void e_notification_get_server_information(E_DBus_Callback_Func func, void *data); 00109 00110 00111 /* Notifications */ 00112 00113 EAPI E_Notification *e_notification_new(void); 00114 EAPI void e_notification_ref(E_Notification *n); 00115 EAPI void e_notification_unref(E_Notification *n); 00116 EAPI void e_notification_free(E_Notification *n); 00117 00118 EAPI E_Notification *e_notification_full_new(const char *app_name, 00119 unsigned int replaces_id, 00120 const char *app_icon, 00121 const char *summary, 00122 const char *body, 00123 int expire_timeout); 00124 00125 /* notification mutators */ 00126 EAPI void e_notification_id_set(E_Notification *note, unsigned int id); 00127 EAPI void e_notification_app_name_set(E_Notification *n, const char *app_name); 00128 EAPI void e_notification_app_icon_set(E_Notification *n, const char *app_icon); 00129 EAPI void e_notification_summary_set(E_Notification *n, const char *summary); 00130 EAPI void e_notification_body_set(E_Notification *n, const char *body); 00131 EAPI void e_notification_replaces_id_set(E_Notification *n, int replaces_id); 00132 EAPI void e_notification_timeout_set(E_Notification *n, int timeout); 00133 EAPI void e_notification_closed_set(E_Notification *note, unsigned char closed); 00134 00135 /* notification accessors */ 00136 EAPI unsigned int e_notification_id_get(E_Notification *note); 00137 EAPI const char *e_notification_app_name_get(E_Notification *n); 00138 EAPI const char *e_notification_app_icon_get(E_Notification *n); 00139 EAPI const char *e_notification_summary_get(E_Notification *n); 00140 EAPI const char *e_notification_body_get(E_Notification *n); 00141 EAPI int e_notification_replaces_id_get(E_Notification *note); 00142 EAPI int e_notification_timeout_get(E_Notification *note); 00143 EAPI unsigned char e_notification_closed_get(E_Notification *note); 00144 00145 /* actions */ 00146 EAPI void e_notification_action_add(E_Notification *n, const char *action_id, const char *action_name); 00147 EAPI Eina_List *e_notification_actions_get(E_Notification *n); 00148 EAPI const char *e_notification_action_id_get(E_Notification_Action *a); 00149 EAPI const char *e_notification_action_name_get(E_Notification_Action *a); 00150 00151 /* hint mutators */ 00152 EAPI void e_notification_hint_transient_set(E_Notification *n, Eina_Bool transient); 00153 EAPI void e_notification_hint_resident_set(E_Notification *n, Eina_Bool resident); 00154 EAPI void e_notification_hint_action_icons_set(E_Notification *n, Eina_Bool action_icons); 00155 EAPI void e_notification_hint_image_path_set(E_Notification *n, const char *path); 00156 EAPI void e_notification_hint_urgency_set(E_Notification *n, char urgency); 00157 EAPI void e_notification_hint_category_set(E_Notification *n, const char *category); 00158 EAPI void e_notification_hint_desktop_set(E_Notification *n, const char *desktop); 00159 EAPI void e_notification_hint_sound_file_set(E_Notification *n, const char *sound_file); 00160 EAPI void e_notification_hint_suppress_sound_set(E_Notification *n, char suppress_sound); 00161 EAPI void e_notification_hint_xy_set(E_Notification *n, int x, int y); 00162 EAPI void e_notification_hint_image_data_set(E_Notification *n, E_Notification_Image *image); 00163 00164 /* hint accessors */ 00165 EAPI char e_notification_hint_urgency_get(E_Notification *n); 00166 EAPI const char *e_notification_hint_category_get(E_Notification *n); 00167 EAPI const char *e_notification_hint_desktop_get(E_Notification *n); 00168 EAPI const char *e_notification_hint_sound_file_get(E_Notification *n); 00169 EAPI const char *e_notification_hint_image_path_get(E_Notification *n); 00170 EAPI char e_notification_hint_suppress_sound_get(E_Notification *n); 00171 EAPI int e_notification_hint_xy_get(E_Notification *n, int *x, int *y); 00172 EAPI E_Notification_Image *e_notification_hint_image_data_get(E_Notification *n); 00173 /* icon_data is deprecated, we do not support setting it */ 00174 EAPI E_Notification_Image *e_notification_hint_icon_data_get(E_Notification *n); 00175 00176 /* image hint */ 00177 EAPI E_Notification_Image *e_notification_image_new(void); 00178 EAPI void e_notification_image_free(E_Notification_Image *img); 00179 EAPI Eina_Bool e_notification_image_init(E_Notification_Image *img, Evas_Object *obj) EINA_WARN_UNUSED_RESULT; 00180 EAPI Evas_Object *e_notification_image_evas_object_add(Evas *evas, E_Notification_Image *img); 00181 00182 #ifdef __cplusplus 00183 } 00184 #endif 00185 00190 #endif