Commit 70c42b98 authored by François Grisez's avatar François Grisez
Browse files

Add a methode to the LinphoneStatusIcon interface to set the description to display in the tooltip

parent 8c80a991
......@@ -1560,7 +1560,8 @@ static void linphone_gtk_init_status_icon(void) {
GtkWidget *menu = create_icon_menu();
LinphoneStatusIconParams *params = linphone_status_icon_params_new();
linphone_status_icon_params_set_menu(params, menu);
linphone_status_icon_params_set_title(params, _("Linphone - a video internet phone"));
linphone_status_icon_params_set_title(params, _("Linphone"));
linphone_status_icon_params_set_description(params, _("A video internet phone"));
linphone_status_icon_params_set_on_click_cb(params, handle_icon_click, NULL);
g_object_unref(G_OBJECT(menu));
......
......@@ -35,6 +35,7 @@ static const _LinphoneStatusIconDesc *_linphone_status_icon_impls[];
struct _LinphoneStatusIconParams {
char *title;
char *desc;
GtkWidget *menu;
LinphoneStatusIconOnClickCallback on_click_cb;
void *user_data;
......@@ -65,6 +66,12 @@ void linphone_status_icon_params_set_title(LinphoneStatusIconParams *obj, const
else obj->title = NULL;
}
void linphone_status_icon_params_set_description(LinphoneStatusIconParams *obj, const char *desc) {
if(obj->desc) g_free(obj->desc);
if(desc) obj->desc = g_strdup(desc);
else obj->desc = NULL;
}
void linphone_status_icon_params_set_menu(LinphoneStatusIconParams *obj, GtkWidget *menu) {
if(obj->menu) g_object_unref(obj->menu);
if(menu) obj->menu = g_object_ref(menu);
......@@ -273,7 +280,9 @@ static void _linphone_status_icon_impl_gtk_init(LinphoneStatusIcon *si) {
static void _linphone_status_icon_impl_gtk_start(LinphoneStatusIcon *si) {
GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
#if GTK_CHECK_VERSION(2,20,2)
gtk_status_icon_set_name(icon, si->params->title);
char *name = g_strdup_printf("%s - %s", si->params->title, si->params->desc);
gtk_status_icon_set_name(icon, name);
g_free(name);
#endif
gtk_status_icon_set_visible(icon,TRUE);
}
......@@ -404,7 +413,7 @@ static void _linphone_status_icon_impl_sn_menu_called_cb(BcStatusNotifier *sn, i
static void _linphone_status_icon_impl_sn_start(LinphoneStatusIcon *si) {
BcStatusNotifier *sn = (BcStatusNotifier *)si->data;
BcStatusNotifierParams *params;
BcStatusNotifierToolTip *tooltip = bc_status_notifier_tool_tip_new("linphone", "Linphone", NULL);
BcStatusNotifierToolTip *tooltip = bc_status_notifier_tool_tip_new("linphone", si->params->title, si->params->desc);
BcStatusNotifierSignalsVTable vtable = {NULL};
vtable.activate_called_cb = _linphone_status_icon_impl_sn_activated_cb;
......@@ -414,7 +423,7 @@ static void _linphone_status_icon_impl_sn_start(LinphoneStatusIcon *si) {
bc_status_notifier_params_set_dbus_prefix(params, "org.kde");
bc_status_notifier_params_set_category(params, BcStatusNotifierCategoryCommunications);
bc_status_notifier_params_set_id(params, "linphone");
bc_status_notifier_params_set_title(params, "Linphone");
bc_status_notifier_params_set_title(params, si->params->title);
bc_status_notifier_params_set_icon_name(params, "linphone");
bc_status_notifier_params_set_tool_tip(params, tooltip);
bc_status_notifier_params_set_vtable(params, &vtable, si);
......
......@@ -31,6 +31,7 @@ LinphoneStatusIconParams *linphone_status_icon_params_ref(LinphoneStatusIconPara
void linphone_status_icon_params_unref(LinphoneStatusIconParams *obj);
void linphone_status_icon_params_set_title(LinphoneStatusIconParams *obj, const char *title);
void linphone_status_icon_params_set_description(LinphoneStatusIconParams *obj, const char *desc);
void linphone_status_icon_params_set_menu(LinphoneStatusIconParams *obj, GtkWidget *menu);
void linphone_status_icon_params_set_on_click_cb(LinphoneStatusIconParams* obj, LinphoneStatusIconOnClickCallback cb, void *user_data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment