static void contact_widget_contact_update (EmpathyContactWidget *information) { EmpathyAccount *account = NULL; const gchar *id = NULL; /* Connect and get info from new contact */ if (information->contact) { g_signal_connect_swapped (information->contact, "notify::name", G_CALLBACK (contact_widget_name_notify_cb), information); g_signal_connect_swapped (information->contact, "notify::presence", G_CALLBACK (contact_widget_presence_notify_cb), information); g_signal_connect_swapped (information->contact, "notify::presence-message", G_CALLBACK (contact_widget_presence_notify_cb), information); g_signal_connect_swapped (information->contact, "notify::avatar", G_CALLBACK (contact_widget_avatar_notify_cb), information); account = empathy_contact_get_account (information->contact); id = empathy_contact_get_id (information->contact); } /* Update account widget */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { if (account) { g_signal_handlers_block_by_func (information->widget_account, contact_widget_change_contact, information); empathy_account_chooser_set_account ( EMPATHY_ACCOUNT_CHOOSER (information->widget_account), account); g_signal_handlers_unblock_by_func (information->widget_account, contact_widget_change_contact, information); } } else { if (account) { const gchar *name; name = empathy_account_get_display_name (account); gtk_label_set_label (GTK_LABEL (information->widget_account), name); } } /* Update id widget */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID) gtk_entry_set_text (GTK_ENTRY (information->widget_id), id ? id : ""); else gtk_label_set_label (GTK_LABEL (information->widget_id), id ? id : ""); /* Update other widgets */ if (information->contact) { contact_widget_name_notify_cb (information); contact_widget_presence_notify_cb (information); contact_widget_avatar_notify_cb (information); gtk_widget_show (information->label_alias); gtk_widget_show (information->widget_alias); gtk_widget_show (information->hbox_presence); gtk_widget_show (information->widget_avatar); } else { gtk_widget_hide (information->label_alias); gtk_widget_hide (information->widget_alias); gtk_widget_hide (information->hbox_presence); gtk_widget_hide (information->widget_avatar); } }
static void contact_widget_contact_update (EmpathyContactWidget *information) { TpAccount *account = NULL; const gchar *id = NULL; /* Connect and get info from new contact */ if (information->contact) { g_signal_connect_swapped (information->contact, "notify::name", G_CALLBACK (contact_widget_name_notify_cb), information); g_signal_connect_swapped (information->contact, "notify::presence", G_CALLBACK (contact_widget_presence_notify_cb), information); g_signal_connect_swapped (information->contact, "notify::presence-message", G_CALLBACK (contact_widget_presence_notify_cb), information); g_signal_connect_swapped (information->contact, "notify::avatar", G_CALLBACK (contact_widget_avatar_notify_cb), information); account = empathy_contact_get_account (information->contact); id = empathy_contact_get_id (information->contact); } /* Update account widget */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { if (account) { g_signal_handlers_block_by_func (information->widget_account, contact_widget_change_contact, information); empathy_account_chooser_set_account ( EMPATHY_ACCOUNT_CHOOSER (information->widget_account), account); g_signal_handlers_unblock_by_func (information->widget_account, contact_widget_change_contact, information); } } else { if (account) { const gchar *name; name = tp_account_get_display_name (account); gtk_label_set_label (GTK_LABEL (information->label_account), name); name = tp_account_get_icon_name (account); gtk_image_set_from_icon_name (GTK_IMAGE (information->image_account), name, GTK_ICON_SIZE_MENU); } } /* Update id widget */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID) gtk_entry_set_text (GTK_ENTRY (information->widget_id), id ? id : ""); else gtk_label_set_label (GTK_LABEL (information->widget_id), id ? id : ""); /* Update other widgets */ if (information->contact) { contact_widget_name_notify_cb (information); contact_widget_presence_notify_cb (information); contact_widget_avatar_notify_cb (information); #if HAVE_FAVOURITE_CONTACTS if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_FAVOURITE) { gboolean is_favourite; is_favourite = empathy_contact_list_is_favourite ( EMPATHY_CONTACT_LIST (information->manager), information->contact); contact_widget_favourites_changed_cb (information->manager, information->contact, is_favourite, information); } #endif gtk_widget_show (information->label_alias); gtk_widget_show (information->widget_alias); gtk_widget_show (information->hbox_presence); gtk_widget_show (information->widget_avatar); } else { gtk_widget_hide (information->label_alias); gtk_widget_hide (information->widget_alias); gtk_widget_hide (information->hbox_presence); gtk_widget_hide (information->widget_avatar); } }