static void contact_widget_contact_setup (EmpathyContactWidget *information) { /* Setup account label/chooser */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { information->widget_account = empathy_account_chooser_new (); g_signal_connect_swapped (information->widget_account, "changed", G_CALLBACK (contact_widget_change_contact), information); } else { information->widget_account = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_account), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_account), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_account, 1, 2, 0, 1); gtk_widget_show (information->widget_account); /* Set up avatar chooser/display */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR) { information->widget_avatar = empathy_avatar_chooser_new (); g_signal_connect (information->widget_avatar, "changed", G_CALLBACK (contact_widget_avatar_changed_cb), information); if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { g_signal_connect (information->widget_account, "changed", G_CALLBACK (update_avatar_chooser_account_cb), information->widget_avatar); update_avatar_chooser_account_cb ( EMPATHY_ACCOUNT_CHOOSER (information->widget_account), EMPATHY_AVATAR_CHOOSER (information->widget_avatar)); } } else { information->widget_avatar = empathy_avatar_image_new (); g_signal_connect (information->widget_avatar, "popup-menu", G_CALLBACK (widget_avatar_popup_menu_cb), information); g_signal_connect (information->widget_avatar, "button-press-event", G_CALLBACK (widget_avatar_button_press_event_cb), information); } gtk_box_pack_start (GTK_BOX (information->vbox_avatar), information->widget_avatar, FALSE, FALSE, 6); gtk_widget_show (information->widget_avatar); /* Setup id label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID) { information->widget_id = gtk_entry_new (); g_signal_connect (information->widget_id, "focus-out-event", G_CALLBACK (contact_widget_id_focus_out_cb), information); g_signal_connect (information->widget_id, "changed", G_CALLBACK (contact_widget_id_changed_cb), information); } else { information->widget_id = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_id), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_id), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_id, 1, 2, 1, 2); gtk_widget_show (information->widget_id); /* Setup alias label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ALIAS) { information->widget_alias = gtk_entry_new (); g_signal_connect (information->widget_alias, "focus-out-event", G_CALLBACK (contact_widget_entry_alias_focus_event_cb), information); /* Make return activate the window default (the Close button) */ gtk_entry_set_activates_default (GTK_ENTRY (information->widget_alias), TRUE); } else { information->widget_alias = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_alias), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_alias), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_alias, 1, 2, 2, 3); if (information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) { gtk_label_set_selectable (GTK_LABEL (information->label_status), FALSE); } gtk_widget_show (information->widget_alias); }
static void contact_widget_contact_setup (EmpathyContactWidget *information) { /* Setup label_status as a KludgeLabel */ information->label_status = empathy_kludge_label_new (""); gtk_label_set_line_wrap_mode (GTK_LABEL (information->label_status), PANGO_WRAP_WORD_CHAR); gtk_label_set_line_wrap (GTK_LABEL (information->label_status), TRUE); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) gtk_label_set_selectable (GTK_LABEL (information->label_status), TRUE); gtk_box_pack_start (GTK_BOX (information->hbox_presence), information->label_status, TRUE, TRUE, 0); gtk_widget_show (information->label_status); /* Setup account label/chooser */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { information->widget_account = empathy_account_chooser_new (); g_signal_connect_swapped (information->widget_account, "changed", G_CALLBACK (contact_widget_change_contact), information); } else { /* Pack the protocol icon with the account name in an hbox */ information->widget_account = gtk_hbox_new (FALSE, 6); information->label_account = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->label_account), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->label_account), 0, 0.5); gtk_widget_show (information->label_account); information->image_account = gtk_image_new (); gtk_widget_show (information->image_account); gtk_box_pack_start (GTK_BOX (information->widget_account), information->image_account, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (information->widget_account), information->label_account, FALSE, TRUE, 0); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_account, 1, 2, 0, 1); gtk_widget_show (information->widget_account); /* Set up avatar chooser/display */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR) { information->widget_avatar = empathy_avatar_chooser_new (); g_signal_connect (information->widget_avatar, "changed", G_CALLBACK (contact_widget_avatar_changed_cb), information); if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) { g_signal_connect (information->widget_account, "changed", G_CALLBACK (update_avatar_chooser_account_cb), information->widget_avatar); update_avatar_chooser_account_cb ( EMPATHY_ACCOUNT_CHOOSER (information->widget_account), EMPATHY_AVATAR_CHOOSER (information->widget_avatar)); } } else { information->widget_avatar = empathy_avatar_image_new (); g_signal_connect (information->widget_avatar, "popup-menu", G_CALLBACK (widget_avatar_popup_menu_cb), information); g_signal_connect (information->widget_avatar, "button-press-event", G_CALLBACK (widget_avatar_button_press_event_cb), information); } gtk_box_pack_start (GTK_BOX (information->vbox_avatar), information->widget_avatar, FALSE, FALSE, 6); gtk_widget_show (information->widget_avatar); /* Setup id label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID) { information->widget_id = gtk_entry_new (); g_signal_connect (information->widget_id, "focus-out-event", G_CALLBACK (contact_widget_id_focus_out_cb), information); g_signal_connect (information->widget_id, "changed", G_CALLBACK (contact_widget_id_changed_cb), information); } else { information->widget_id = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_id), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_id), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_id, 1, 2, 1, 2); gtk_widget_show (information->widget_id); /* Setup alias label/entry */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ALIAS) { information->widget_alias = gtk_entry_new (); if (!(information->flags & EMPATHY_CONTACT_WIDGET_NO_SET_ALIAS)) g_signal_connect (information->widget_alias, "focus-out-event", G_CALLBACK (contact_widget_entry_alias_focus_event_cb), information); /* Make return activate the window default (the Close button) */ gtk_entry_set_activates_default (GTK_ENTRY (information->widget_alias), TRUE); } else { information->widget_alias = gtk_label_new (NULL); if (!(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP)) { gtk_label_set_selectable (GTK_LABEL (information->widget_alias), TRUE); } gtk_misc_set_alignment (GTK_MISC (information->widget_alias), 0, 0.5); } gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->widget_alias, 1, 2, 2, 3); if (information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) { gtk_label_set_selectable (GTK_LABEL (information->label_status), FALSE); } gtk_widget_show (information->widget_alias); #if HAVE_FAVOURITE_CONTACTS /* Favorite */ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_FAVOURITE) { information->favourite_checkbox = gtk_check_button_new_with_label ( _("Favorite")); g_signal_connect (information->favourite_checkbox, "toggled", G_CALLBACK (favourite_toggled_cb), information); gtk_table_attach_defaults (GTK_TABLE (information->table_contact), information->favourite_checkbox, 0, 2, 3, 4); information->fav_sig_id = g_signal_connect (information->manager, "favourites-changed", G_CALLBACK (contact_widget_favourites_changed_cb), information); gtk_widget_show (information->favourite_checkbox); } #endif }