#include <gtk/gtk.h>
#include <glade/glade.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <libmissioncontrol/mc-account.h>
#include <telepathy-glib/util.h>
/* Client */
GtkWidget *vbox_client;
GtkWidget *table_client;
- GtkWidget *hbow_client_requested;
+ GtkWidget *hbox_client_requested;
} EmpathyContactWidget;
typedef struct
information = g_slice_new0 (EmpathyContactWidget);
information->flags = flags;
- information->factory = empathy_contact_factory_new ();
+ information->factory = empathy_contact_factory_dup_singleton ();
filename = empathy_file_lookup ("empathy-contact-widget.glade",
"libempathy-gtk");
"hbox_details_requested", &information->hbox_details_requested,
"vbox_client", &information->vbox_client,
"table_client", &information->table_client,
- "hbox_client_requested", &information->hbow_client_requested,
+ "hbox_client_requested", &information->hbox_client_requested,
NULL);
g_free (filename);
}
static void
-contact_widget_contact_setup (EmpathyContactWidget *information)
+update_avatar_chooser_account_cb (EmpathyAccountChooser *account_chooser,
+ EmpathyAvatarChooser *avatar_chooser)
{
- 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);
- }
- else
- {
- information->widget_avatar = empathy_avatar_image_new ();
+ McAccount *account;
- 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);
+ account = empathy_account_chooser_get_account (account_chooser);
+ g_object_set (avatar_chooser, "account", account, NULL);
+}
+static void
+contact_widget_contact_setup (EmpathyContactWidget *information)
+{
/* Setup account label/chooser */
if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
{
else
{
information->widget_account = gtk_label_new (NULL);
- if (!information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) {
+ 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);
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)
{
else
{
information->widget_id = gtk_label_new (NULL);
- if (!information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) {
+ 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);
else
{
information->widget_alias = gtk_label_new (NULL);
- if (!information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP) {
+ 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);
const gchar *id;
id = gtk_entry_get_text (GTK_ENTRY (information->widget_id));
- if (G_STR_EMPTY (id))
+ if (EMP_STR_EMPTY (id))
return;
contact = empathy_contact_factory_get_from_id (information->factory,
{
if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_GROUPS)
{
- information->manager = empathy_contact_manager_new ();
+ information->manager = empathy_contact_manager_dup_singleton ();
contact_widget_model_setup (information);
}
}
GtkTreeModel *model;
FindName data;
- if (G_STR_EMPTY (name))
+ if (EMP_STR_EMPTY (name))
return FALSE;
data.information = information;
gtk_widget_set_sensitive (GTK_WIDGET (information->button_group), FALSE);
else
gtk_widget_set_sensitive (GTK_WIDGET (information->button_group),
- !G_STR_EMPTY (group));
+ !EMP_STR_EMPTY (group));
}
static void