#include <telepathy-glib/interfaces.h>
#include <libempathy/empathy-tp-contact-factory.h>
-#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-location.h>
#include <libempathy/empathy-time.h>
typedef struct
{
- EmpathyContactManager *manager;
EmpathyContact *contact;
EmpathyContactWidgetFlags flags;
guint widget_id_timeout;
gtk_widget_show (information->image_state);
}
-static void
-contact_widget_favourites_changed_cb (EmpathyContactManager *manager,
- EmpathyContact *contact,
- gboolean is_favourite,
- EmpathyContactWidget *information)
-{
- if (contact != information->contact)
- return;
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (
- information->favourite_checkbox), is_favourite);
-}
-
static void
contact_widget_remove_contact (EmpathyContactWidget *information)
{
contact_widget_presence_notify_cb (information);
contact_widget_avatar_notify_cb (information);
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_FAVOURITE)
- {
- FolksPersona *persona = empathy_contact_get_persona (
- information->contact);
-
- if (persona != NULL && FOLKS_IS_FAVOURITE_DETAILS (persona))
- {
- gboolean is_favourite = folks_favourite_details_get_is_favourite (
- FOLKS_FAVOURITE_DETAILS (persona));
- contact_widget_favourites_changed_cb (information->manager,
- information->contact, is_favourite, information);
- }
- }
-
gtk_widget_show (information->label_alias);
gtk_widget_show (information->widget_alias);
gtk_widget_show (information->hbox_presence);
return FALSE;
}
-static void
-favourite_toggled_cb (GtkToggleButton *button,
- EmpathyContactWidget *information)
-{
- FolksPersona *persona = empathy_contact_get_persona (information->contact);
-
- if (persona != NULL && FOLKS_IS_FAVOURITE_DETAILS (persona))
- {
- gboolean active = gtk_toggle_button_get_active (button);
- folks_favourite_details_set_is_favourite (
- FOLKS_FAVOURITE_DETAILS (persona), active);
- }
-}
-
static void
contact_widget_contact_setup (EmpathyContactWidget *information)
{
gtk_label_set_selectable (GTK_LABEL (information->label_status), FALSE);
}
gtk_widget_show (information->widget_alias);
-
- /* 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_grid_attach (GTK_GRID (information->grid_contact),
- information->favourite_checkbox, 0, 3, 1, 1);
-
- 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);
- }
}
static void
g_source_remove (information->widget_id_timeout);
}
- if (information->fav_sig_id != 0)
- g_signal_handler_disconnect (information->manager, information->fav_sig_id);
-
- g_object_unref (information->manager);
-
g_slice_free (EmpathyContactWidget, information);
}
"EmpathyContactWidget",
information);
- information->manager = empathy_contact_manager_dup_singleton ();
-
/* Create widgets */
contact_widget_contact_setup (information);
contact_widget_details_setup (information);
EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP = 1 << 5,
EMPATHY_CONTACT_WIDGET_SHOW_LOCATION = 1 << 6,
EMPATHY_CONTACT_WIDGET_NO_SET_ALIAS = 1 << 7,
- EMPATHY_CONTACT_WIDGET_EDIT_FAVOURITE = 1 << 8,
- EMPATHY_CONTACT_WIDGET_SHOW_DETAILS = 1 << 9,
- EMPATHY_CONTACT_WIDGET_EDIT_DETAILS = 1 << 10,
+ EMPATHY_CONTACT_WIDGET_SHOW_DETAILS = 1 << 8,
+ EMPATHY_CONTACT_WIDGET_EDIT_DETAILS = 1 << 9,
} EmpathyContactWidgetFlags;
GtkWidget * empathy_contact_widget_new (EmpathyContact *contact,