aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-contact-widget.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-07-09 01:33:16 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-07-09 01:33:16 +0800
commit12afeccfc91485fa8211aa02149d90c6515f3aec (patch)
treee73579c84c9d98bd92f03f777a5defc821307388 /libempathy-gtk/empathy-contact-widget.c
parentd39d45baf208b349203c9f67f60b4be7506f9b8f (diff)
downloadgsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.tar
gsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.tar.gz
gsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.tar.bz2
gsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.tar.lz
gsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.tar.xz
gsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.tar.zst
gsoc2013-empathy-12afeccfc91485fa8211aa02149d90c6515f3aec.zip
empathy-contact-widget: remove tabs (Guillaume Desmottes)
svn path=/trunk/; revision=1216
Diffstat (limited to 'libempathy-gtk/empathy-contact-widget.c')
-rw-r--r--libempathy-gtk/empathy-contact-widget.c740
1 files changed, 376 insertions, 364 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 96eac0b28..707830ea2 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -47,52 +47,52 @@
typedef struct
{
- EmpathyContactFactory *factory;
- EmpathyContactManager *manager;
- EmpathyContact *contact;
- EmpathyContactWidgetFlags flags;
- GtkCellRenderer *renderer;
- guint widget_id_timeout;
-
- GtkWidget *vbox_contact_widget;
-
- /* Contact */
- GtkWidget *vbox_contact;
- GtkWidget *widget_avatar;
- GtkWidget *widget_account;
- GtkWidget *widget_id;
- GtkWidget *widget_alias;
- GtkWidget *label_alias;
- GtkWidget *entry_alias;
- GtkWidget *hbox_presence;
- GtkWidget *image_state;
- GtkWidget *label_status;
- GtkWidget *table_contact;
- GtkWidget *vbox_avatar;
-
- /* Groups */
- GtkWidget *vbox_groups;
- GtkWidget *entry_group;
- GtkWidget *button_group;
- GtkWidget *treeview_groups;
-
- /* Details */
- GtkWidget *vbox_details;
- GtkWidget *table_details;
- GtkWidget *hbox_details_requested;
-
- /* Client */
- GtkWidget *vbox_client;
- GtkWidget *table_client;
- GtkWidget *hbow_client_requested;
+ EmpathyContactFactory *factory;
+ EmpathyContactManager *manager;
+ EmpathyContact *contact;
+ EmpathyContactWidgetFlags flags;
+ GtkCellRenderer *renderer;
+ guint widget_id_timeout;
+
+ GtkWidget *vbox_contact_widget;
+
+ /* Contact */
+ GtkWidget *vbox_contact;
+ GtkWidget *widget_avatar;
+ GtkWidget *widget_account;
+ GtkWidget *widget_id;
+ GtkWidget *widget_alias;
+ GtkWidget *label_alias;
+ GtkWidget *entry_alias;
+ GtkWidget *hbox_presence;
+ GtkWidget *image_state;
+ GtkWidget *label_status;
+ GtkWidget *table_contact;
+ GtkWidget *vbox_avatar;
+
+ /* Groups */
+ GtkWidget *vbox_groups;
+ GtkWidget *entry_group;
+ GtkWidget *button_group;
+ GtkWidget *treeview_groups;
+
+ /* Details */
+ GtkWidget *vbox_details;
+ GtkWidget *table_details;
+ GtkWidget *hbox_details_requested;
+
+ /* Client */
+ GtkWidget *vbox_client;
+ GtkWidget *table_client;
+ GtkWidget *hbow_client_requested;
} EmpathyContactWidget;
typedef struct
{
- EmpathyContactWidget *information;
- const gchar *name;
- gboolean found;
- GtkTreeIter found_iter;
+ EmpathyContactWidget *information;
+ const gchar *name;
+ gboolean found;
+ GtkTreeIter found_iter;
} FindName;
static void contact_widget_destroy_cb (GtkWidget *widget,
@@ -146,27 +146,27 @@ static void contact_widget_client_update (EmpathyContactWidget *information);
enum
{
- COL_NAME,
- COL_ENABLED,
- COL_EDITABLE,
- COL_COUNT
+ COL_NAME,
+ COL_ENABLED,
+ COL_EDITABLE,
+ COL_COUNT
};
GtkWidget *
empathy_contact_widget_new (EmpathyContact *contact,
EmpathyContactWidgetFlags flags)
{
- EmpathyContactWidget *information;
- GladeXML *glade;
- gchar *filename;
+ EmpathyContactWidget *information;
+ GladeXML *glade;
+ gchar *filename;
- information = g_slice_new0 (EmpathyContactWidget);
- information->flags = flags;
- information->factory = empathy_contact_factory_new ();
+ information = g_slice_new0 (EmpathyContactWidget);
+ information->flags = flags;
+ information->factory = empathy_contact_factory_new ();
- filename = empathy_file_lookup ("empathy-contact-widget.glade",
+ filename = empathy_file_lookup ("empathy-contact-widget.glade",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
+ glade = empathy_glade_get_file (filename,
"vbox_contact_widget",
NULL,
"vbox_contact_widget", &information->vbox_contact_widget,
@@ -188,9 +188,9 @@ empathy_contact_widget_new (EmpathyContact *contact,
"table_client", &information->table_client,
"hbox_client_requested", &information->hbow_client_requested,
NULL);
- g_free (filename);
+ g_free (filename);
- empathy_glade_connect (glade,
+ empathy_glade_connect (glade,
information,
"vbox_contact_widget", "destroy", contact_widget_destroy_cb,
"entry_group", "changed", contact_widget_entry_group_changed_cb,
@@ -198,56 +198,55 @@ empathy_contact_widget_new (EmpathyContact *contact,
"button_group", "clicked", contact_widget_button_group_clicked_cb,
NULL);
- g_object_unref (glade);
+ g_object_unref (glade);
- g_object_set_data (G_OBJECT (information->vbox_contact_widget),
+ g_object_set_data (G_OBJECT (information->vbox_contact_widget),
"EmpathyContactWidget",
- information);
+ information);
- /* Create widgets */
- contact_widget_contact_setup (information);
- contact_widget_groups_setup (information);
- contact_widget_details_setup (information);
- contact_widget_client_setup (information);
+ /* Create widgets */
+ contact_widget_contact_setup (information);
+ contact_widget_groups_setup (information);
+ contact_widget_details_setup (information);
+ contact_widget_client_setup (information);
- contact_widget_set_contact (information, contact);
+ contact_widget_set_contact (information, contact);
- gtk_widget_show (information->vbox_contact_widget);
+ gtk_widget_show (information->vbox_contact_widget);
- return information->vbox_contact_widget;
+ return information->vbox_contact_widget;
}
EmpathyContact *
empathy_contact_widget_get_contact (GtkWidget *widget)
{
- EmpathyContactWidget *information;
+ EmpathyContactWidget *information;
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
- if (!information)
+ information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
+ if (!information)
{
return NULL;
}
- return information->contact;
+ return information->contact;
}
void
empathy_contact_widget_set_contact (GtkWidget *widget,
EmpathyContact *contact)
{
- EmpathyContactWidget *information;
+ EmpathyContactWidget *information;
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (EMPATHY_IS_CONTACT (contact));
- information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
- if (!information) {
- return;
- }
+ information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
+ if (!information)
+ return;
- contact_widget_set_contact (information, contact);
+ contact_widget_set_contact (information, contact);
}
void
@@ -256,48 +255,48 @@ empathy_contact_widget_set_account_filter (
EmpathyAccountChooserFilterFunc filter,
gpointer user_data)
{
- EmpathyContactWidget *information;
- EmpathyAccountChooser *chooser;
+ EmpathyContactWidget *information;
+ EmpathyAccountChooser *chooser;
- g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
- information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
- if (!information)
- return;
+ information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
+ if (!information)
+ return;
- chooser = EMPATHY_ACCOUNT_CHOOSER (information->widget_account);
- if (chooser)
+ chooser = EMPATHY_ACCOUNT_CHOOSER (information->widget_account);
+ if (chooser)
{
empathy_account_chooser_set_filter (chooser, filter, user_data);
}
}
-
+
static void
contact_widget_destroy_cb (GtkWidget *widget,
EmpathyContactWidget *information)
{
- contact_widget_remove_contact (information);
+ contact_widget_remove_contact (information);
- if (information->widget_id_timeout != 0)
+ if (information->widget_id_timeout != 0)
{
g_source_remove (information->widget_id_timeout);
}
- if (information->factory)
+ if (information->factory)
{
g_object_unref (information->factory);
- }
- if (information->manager)
+ }
+ if (information->manager)
{
g_object_unref (information->manager);
- }
+ }
- g_slice_free (EmpathyContactWidget, information);
+ g_slice_free (EmpathyContactWidget, information);
}
static void
contact_widget_remove_contact (EmpathyContactWidget *information)
{
- if (information->contact)
+ if (information->contact)
{
g_signal_handlers_disconnect_by_func (information->contact,
contact_widget_name_notify_cb, information);
@@ -315,42 +314,42 @@ contact_widget_remove_contact (EmpathyContactWidget *information)
static void
contact_widget_set_contact (EmpathyContactWidget *information,
- EmpathyContact *contact)
+ EmpathyContact *contact)
{
- if (contact == information->contact)
- return;
+ if (contact == information->contact)
+ return;
- contact_widget_remove_contact (information);
- if (contact)
+ contact_widget_remove_contact (information);
+ if (contact)
{
information->contact = g_object_ref (contact);
}
- /* Update information for widgets */
- contact_widget_contact_update (information);
- contact_widget_groups_update (information);
- contact_widget_details_update (information);
- contact_widget_client_update (information);
+ /* Update information for widgets */
+ contact_widget_contact_update (information);
+ contact_widget_groups_update (information);
+ contact_widget_details_update (information);
+ contact_widget_client_update (information);
}
static gboolean
contact_widget_id_activate_timeout (EmpathyContactWidget *self)
{
- contact_widget_change_contact (self);
- return FALSE;
+ contact_widget_change_contact (self);
+ return FALSE;
}
static void
contact_widget_id_changed_cb (GtkEntry *entry,
EmpathyContactWidget *self)
{
- if (self->widget_id_timeout != 0)
- {
+ if (self->widget_id_timeout != 0)
+ {
g_source_remove (self->widget_id_timeout);
}
- self->widget_id_timeout =
- g_timeout_add_seconds (ID_CHANGED_TIMEOUT,
+ self->widget_id_timeout =
+ g_timeout_add_seconds (ID_CHANGED_TIMEOUT,
(GSourceFunc) contact_widget_id_activate_timeout, self);
}
@@ -500,89 +499,102 @@ widget_avatar_button_press_event_cb (GtkWidget *widget,
static void
contact_widget_contact_setup (EmpathyContactWidget *information)
{
- 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 ();
-
- 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);
- }
+ 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 ();
+
+ 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 account label/chooser */
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT) {
- information->widget_account = empathy_account_chooser_new ();
-
- g_signal_connect (information->widget_account, "changed",
- G_CALLBACK (contact_widget_account_changed_cb),
- information);
- } else {
- information->widget_account = gtk_label_new (NULL);
- 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);
-
- /* 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);
- 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);
- 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);
- gtk_widget_show (information->widget_alias);
+ gtk_box_pack_start (GTK_BOX (information->vbox_avatar),
+ information->widget_avatar,
+ FALSE, FALSE,
+ 6);
+ gtk_widget_show (information->widget_avatar);
+
+ /* Setup account label/chooser */
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
+ {
+ information->widget_account = empathy_account_chooser_new ();
+
+ g_signal_connect (information->widget_account, "changed",
+ G_CALLBACK (contact_widget_account_changed_cb),
+ information);
+ }
+ else
+ {
+ information->widget_account = gtk_label_new (NULL);
+ 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);
+
+ /* 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);
+ 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);
+ 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);
+ gtk_widget_show (information->widget_alias);
}
static void
contact_widget_contact_update (EmpathyContactWidget *information)
{
- McAccount *account = NULL;
- const gchar *id = NULL;
+ McAccount *account = NULL;
+ const gchar *id = NULL;
- /* Connect and get info from new contact */
- if (information->contact)
+ /* 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);
@@ -598,8 +610,8 @@ contact_widget_contact_update (EmpathyContactWidget *information)
id = empathy_contact_get_id (information->contact);
}
- /* Update account widget */
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
+ /* Update account widget */
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
{
if (account)
{
@@ -621,20 +633,20 @@ contact_widget_contact_update (EmpathyContactWidget *information)
name = mc_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)
+ /* Update id widget */
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
{
- gtk_entry_set_text (GTK_ENTRY (information->widget_id), id ? 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)
+ /* Update other widgets */
+ if (information->contact)
{
contact_widget_name_notify_cb (information);
contact_widget_presence_notify_cb (information);
@@ -657,15 +669,15 @@ contact_widget_contact_update (EmpathyContactWidget *information)
static void
contact_widget_change_contact (EmpathyContactWidget *information)
{
- EmpathyContact *contact;
- McAccount *account;
+ EmpathyContact *contact;
+ McAccount *account;
- account = empathy_account_chooser_get_account (
+ account = empathy_account_chooser_get_account (
EMPATHY_ACCOUNT_CHOOSER (information->widget_account));
- if (!account)
- return;
+ if (!account)
+ return;
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
{
const gchar *id;
@@ -678,11 +690,11 @@ contact_widget_change_contact (EmpathyContactWidget *information)
}
else
{
- contact = empathy_contact_factory_get_user (information->factory,
+ contact = empathy_contact_factory_get_user (information->factory,
account);
- }
+ }
- if (contact)
+ if (contact)
{
empathy_contact_run_until_ready (contact,
EMPATHY_CONTACT_READY_HANDLE |
@@ -695,9 +707,9 @@ contact_widget_change_contact (EmpathyContactWidget *information)
static void
contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
- EmpathyContactWidget *information)
+ EmpathyContactWidget *information)
{
- if (information->contact && empathy_contact_is_user (information->contact))
+ if (information->contact && empathy_contact_is_user (information->contact))
{
McAccount *account;
const gchar *data;
@@ -717,16 +729,16 @@ static void
contact_widget_account_changed_cb (GtkComboBox *widget,
EmpathyContactWidget *information)
{
- contact_widget_change_contact (information);
+ contact_widget_change_contact (information);
}
static gboolean
contact_widget_id_focus_out_cb (GtkWidget *widget,
- GdkEventFocus *event,
+ GdkEventFocus *event,
EmpathyContactWidget *information)
{
- contact_widget_change_contact (information);
- return FALSE;
+ contact_widget_change_contact (information);
+ return FALSE;
}
static gboolean
@@ -734,7 +746,7 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
GdkEventFocus *event,
EmpathyContactWidget *information)
{
- if (information->contact)
+ if (information->contact)
{
const gchar *alias;
@@ -743,13 +755,13 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
information->contact, alias);
}
- return FALSE;
+ return FALSE;
}
static void
contact_widget_name_notify_cb (EmpathyContactWidget *information)
{
- if (GTK_IS_ENTRY (information->widget_alias))
+ if (GTK_IS_ENTRY (information->widget_alias))
{
gtk_entry_set_text (GTK_ENTRY (information->widget_alias),
empathy_contact_get_name (information->contact));
@@ -764,30 +776,30 @@ contact_widget_name_notify_cb (EmpathyContactWidget *information)
static void
contact_widget_presence_notify_cb (EmpathyContactWidget *information)
{
- gtk_label_set_text (GTK_LABEL (information->label_status),
+ gtk_label_set_text (GTK_LABEL (information->label_status),
empathy_contact_get_status (information->contact));
- gtk_image_set_from_icon_name (GTK_IMAGE (information->image_state),
- empathy_icon_name_for_contact (information->contact),
+ gtk_image_set_from_icon_name (GTK_IMAGE (information->image_state),
+ empathy_icon_name_for_contact (information->contact),
GTK_ICON_SIZE_BUTTON);
}
static void
contact_widget_avatar_notify_cb (EmpathyContactWidget *information)
{
- EmpathyAvatar *avatar = NULL;
-
- if (information->contact) {
- avatar = empathy_contact_get_avatar (information->contact);
- }
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR) {
- g_signal_handlers_block_by_func (information->widget_avatar,
- contact_widget_avatar_changed_cb,
- information);
- empathy_avatar_chooser_set (
+ EmpathyAvatar *avatar = NULL;
+
+ if (information->contact) {
+ avatar = empathy_contact_get_avatar (information->contact);
+ }
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR) {
+ g_signal_handlers_block_by_func (information->widget_avatar,
+ contact_widget_avatar_changed_cb,
+ information);
+ empathy_avatar_chooser_set (
EMPATHY_AVATAR_CHOOSER (information->widget_avatar), avatar);
- g_signal_handlers_unblock_by_func (information->widget_avatar,
+ g_signal_handlers_unblock_by_func (information->widget_avatar,
contact_widget_avatar_changed_cb, information);
- }
+ }
else
{
empathy_avatar_image_set (
@@ -798,7 +810,7 @@ contact_widget_avatar_notify_cb (EmpathyContactWidget *information)
static void
contact_widget_groups_setup (EmpathyContactWidget *information)
{
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_GROUPS)
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_GROUPS)
{
information->manager = empathy_contact_manager_new ();
contact_widget_model_setup (information);
@@ -808,7 +820,7 @@ contact_widget_groups_setup (EmpathyContactWidget *information)
static void
contact_widget_groups_update (EmpathyContactWidget *information)
{
- if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_GROUPS &&
+ if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_GROUPS &&
information->contact)
{
g_signal_connect_swapped (information->contact, "notify::groups",
@@ -826,97 +838,97 @@ contact_widget_groups_update (EmpathyContactWidget *information)
static void
contact_widget_model_setup (EmpathyContactWidget *information)
{
- GtkTreeView *view;
- GtkListStore *store;
- GtkTreeSelection *selection;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
- view = GTK_TREE_VIEW (information->treeview_groups);
+ view = GTK_TREE_VIEW (information->treeview_groups);
- store = gtk_list_store_new (COL_COUNT,
+ store = gtk_list_store_new (COL_COUNT,
G_TYPE_STRING, /* name */
- G_TYPE_BOOLEAN, /* enabled */
- G_TYPE_BOOLEAN); /* editable */
+ G_TYPE_BOOLEAN, /* enabled */
+ G_TYPE_BOOLEAN); /* editable */
- gtk_tree_view_set_model (view, GTK_TREE_MODEL (store));
+ gtk_tree_view_set_model (view, GTK_TREE_MODEL (store));
- selection = gtk_tree_view_get_selection (view);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+ selection = gtk_tree_view_get_selection (view);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- contact_widget_model_populate_columns (information);
+ contact_widget_model_populate_columns (information);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
COL_NAME, GTK_SORT_ASCENDING);
- g_object_unref (store);
+ g_object_unref (store);
}
static void
contact_widget_model_populate_columns (EmpathyContactWidget *information)
{
- GtkTreeView *view;
- GtkTreeModel *model;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
- guint col_offset;
+ GtkTreeView *view;
+ GtkTreeModel *model;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ guint col_offset;
- view = GTK_TREE_VIEW (information->treeview_groups);
- model = gtk_tree_view_get_model (view);
+ view = GTK_TREE_VIEW (information->treeview_groups);
+ model = gtk_tree_view_get_model (view);
- renderer = gtk_cell_renderer_toggle_new ();
- g_signal_connect (renderer, "toggled",
+ renderer = gtk_cell_renderer_toggle_new ();
+ g_signal_connect (renderer, "toggled",
G_CALLBACK (contact_widget_cell_toggled), information);
- column = gtk_tree_view_column_new_with_attributes (_("Select"), renderer,
+ column = gtk_tree_view_column_new_with_attributes (_("Select"), renderer,
"active", COL_ENABLED, NULL);
- gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (column, 50);
- gtk_tree_view_append_column (view, column);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 50);
+ gtk_tree_view_append_column (view, column);
- renderer = gtk_cell_renderer_text_new ();
- col_offset = gtk_tree_view_insert_column_with_attributes (view,
+ renderer = gtk_cell_renderer_text_new ();
+ col_offset = gtk_tree_view_insert_column_with_attributes (view,
-1, _("Group"),
- renderer,
- "text", COL_NAME,
- /* "editable", COL_EDITABLE, */
- NULL);
+ renderer,
+ "text", COL_NAME,
+ /* "editable", COL_EDITABLE, */
+ NULL);
- g_object_set_data (G_OBJECT (renderer),
+ g_object_set_data (G_OBJECT (renderer),
"column", GINT_TO_POINTER (COL_NAME));
- column = gtk_tree_view_get_column (view, col_offset - 1);
- gtk_tree_view_column_set_sort_column_id (column, COL_NAME);
- gtk_tree_view_column_set_resizable (column,FALSE);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
+ column = gtk_tree_view_get_column (view, col_offset - 1);
+ gtk_tree_view_column_set_sort_column_id (column, COL_NAME);
+ gtk_tree_view_column_set_resizable (column,FALSE);
+ gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
- if (information->renderer)
+ if (information->renderer)
{
g_object_unref (information->renderer);
}
- information->renderer = g_object_ref (renderer);
+ information->renderer = g_object_ref (renderer);
}
static void
contact_widget_groups_populate_data (EmpathyContactWidget *information)
{
- GtkTreeView *view;
- GtkListStore *store;
- GtkTreeIter iter;
- GList *my_groups, *l;
- GList *all_groups;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GList *my_groups, *l;
+ GList *all_groups;
- view = GTK_TREE_VIEW (information->treeview_groups);
- store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
- gtk_list_store_clear (store);
+ view = GTK_TREE_VIEW (information->treeview_groups);
+ store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
+ gtk_list_store_clear (store);
- all_groups = empathy_contact_list_get_all_groups (
+ all_groups = empathy_contact_list_get_all_groups (
EMPATHY_CONTACT_LIST (information->manager));
- my_groups = empathy_contact_list_get_groups (
+ my_groups = empathy_contact_list_get_groups (
EMPATHY_CONTACT_LIST (information->manager),
- information->contact);
+ information->contact);
- for (l = all_groups; l; l = l->next)
+ for (l = all_groups; l; l = l->next)
{
const gchar *group_str;
gboolean enabled;
@@ -934,48 +946,48 @@ contact_widget_groups_populate_data (EmpathyContactWidget *information)
-1);
}
- g_list_foreach (all_groups, (GFunc) g_free, NULL);
- g_list_foreach (my_groups, (GFunc) g_free, NULL);
- g_list_free (all_groups);
- g_list_free (my_groups);
+ g_list_foreach (all_groups, (GFunc) g_free, NULL);
+ g_list_foreach (my_groups, (GFunc) g_free, NULL);
+ g_list_free (all_groups);
+ g_list_free (my_groups);
}
static void
contact_widget_groups_notify_cb (EmpathyContactWidget *information)
{
- /* FIXME: not implemented */
+ /* FIXME: not implemented */
}
static gboolean
contact_widget_model_find_name (EmpathyContactWidget *information,
- const gchar *name,
- GtkTreeIter *iter)
+ const gchar *name,
+ GtkTreeIter *iter)
{
- GtkTreeView *view;
- GtkTreeModel *model;
- FindName data;
+ GtkTreeView *view;
+ GtkTreeModel *model;
+ FindName data;
- if (G_STR_EMPTY (name))
- return FALSE;
+ if (G_STR_EMPTY (name))
+ return FALSE;
- data.information = information;
- data.name = name;
- data.found = FALSE;
+ data.information = information;
+ data.name = name;
+ data.found = FALSE;
- view = GTK_TREE_VIEW (information->treeview_groups);
- model = gtk_tree_view_get_model (view);
+ view = GTK_TREE_VIEW (information->treeview_groups);
+ model = gtk_tree_view_get_model (view);
- gtk_tree_model_foreach (model,
+ gtk_tree_model_foreach (model,
(GtkTreeModelForeachFunc) contact_widget_model_find_name_foreach,
- &data);
+ &data);
- if (data.found == TRUE)
+ if (data.found == TRUE)
{
*iter = data.found_iter;
return TRUE;
}
- return FALSE;
+ return FALSE;
}
static gboolean
@@ -984,16 +996,16 @@ contact_widget_model_find_name_foreach (GtkTreeModel *model,
GtkTreeIter *iter,
FindName *data)
{
- gchar *name;
+ gchar *name;
- gtk_tree_model_get (model, iter,
+ gtk_tree_model_get (model, iter,
COL_NAME, &name,
-1);
- if (!name)
- return FALSE;
+ if (!name)
+ return FALSE;
- if (data->name && strcmp (data->name, name) == 0)
+ if (data->name && strcmp (data->name, name) == 0)
{
data->found = TRUE;
data->found_iter = *iter;
@@ -1003,9 +1015,9 @@ contact_widget_model_find_name_foreach (GtkTreeModel *model,
return TRUE;
}
- g_free (name);
+ g_free (name);
- return FALSE;
+ return FALSE;
}
static void
@@ -1013,58 +1025,58 @@ contact_widget_cell_toggled (GtkCellRendererToggle *cell,
gchar *path_string,
EmpathyContactWidget *information)
{
- GtkTreeView *view;
- GtkTreeModel *model;
- GtkListStore *store;
- GtkTreePath *path;
- GtkTreeIter iter;
- gboolean enabled;
- gchar *group;
-
- view = GTK_TREE_VIEW (information->treeview_groups);
- model = gtk_tree_view_get_model (view);
- store = GTK_LIST_STORE (model);
-
- path = gtk_tree_path_new_from_string (path_string);
-
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ GtkTreeView *view;
+ GtkTreeModel *model;
+ GtkListStore *store;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gboolean enabled;
+ gchar *group;
+
+ view = GTK_TREE_VIEW (information->treeview_groups);
+ model = gtk_tree_view_get_model (view);
+ store = GTK_LIST_STORE (model);
+
+ path = gtk_tree_path_new_from_string (path_string);
+
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
COL_ENABLED, &enabled,
- COL_NAME, &group,
- -1);
+ COL_NAME, &group,
+ -1);
- gtk_list_store_set (store, &iter, COL_ENABLED, !enabled, -1);
- gtk_tree_path_free (path);
+ gtk_list_store_set (store, &iter, COL_ENABLED, !enabled, -1);
+ gtk_tree_path_free (path);
- if (group)
+ if (group)
{
- if (enabled)
+ if (enabled)
{
empathy_contact_list_remove_from_group (
EMPATHY_CONTACT_LIST (information->manager), information->contact,
group);
- }
+ }
else
{
- empathy_contact_list_add_to_group (
+ empathy_contact_list_add_to_group (
EMPATHY_CONTACT_LIST (information->manager), information->contact,
group);
- }
+ }
- g_free (group);
- }
+ g_free (group);
+ }
}
static void
contact_widget_entry_group_changed_cb (GtkEditable *editable,
EmpathyContactWidget *information)
{
- GtkTreeIter iter;
- const gchar *group;
+ GtkTreeIter iter;
+ const gchar *group;
- group = gtk_entry_get_text (GTK_ENTRY (information->entry_group));
+ group = gtk_entry_get_text (GTK_ENTRY (information->entry_group));
- if (contact_widget_model_find_name (information, group, &iter))
+ if (contact_widget_model_find_name (information, group, &iter))
{
gtk_widget_set_sensitive (GTK_WIDGET (information->button_group), FALSE);
}
@@ -1072,37 +1084,37 @@ contact_widget_entry_group_changed_cb (GtkEditable *editable,
{
gtk_widget_set_sensitive (GTK_WIDGET (information->button_group),
!G_STR_EMPTY (group));
- }
+ }
}
static void
contact_widget_entry_group_activate_cb (GtkEntry *entry,
EmpathyContactWidget *information)
{
- gtk_widget_activate (GTK_WIDGET (information->button_group));
+ gtk_widget_activate (GTK_WIDGET (information->button_group));
}
static void
contact_widget_button_group_clicked_cb (GtkButton *button,
- EmpathyContactWidget *information)
+ EmpathyContactWidget *information)
{
- GtkTreeView *view;
- GtkListStore *store;
- GtkTreeIter iter;
- const gchar *group;
+ GtkTreeView *view;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ const gchar *group;
- view = GTK_TREE_VIEW (information->treeview_groups);
- store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
+ view = GTK_TREE_VIEW (information->treeview_groups);
+ store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
- group = gtk_entry_get_text (GTK_ENTRY (information->entry_group));
+ group = gtk_entry_get_text (GTK_ENTRY (information->entry_group));
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
COL_NAME, group,
- COL_ENABLED, TRUE,
- -1);
+ COL_ENABLED, TRUE,
+ -1);
- empathy_contact_list_add_to_group (
+ empathy_contact_list_add_to_group (
EMPATHY_CONTACT_LIST (information->manager), information->contact,
group);
}
@@ -1110,25 +1122,25 @@ contact_widget_button_group_clicked_cb (GtkButton *button,
static void
contact_widget_details_setup (EmpathyContactWidget *information)
{
- /* FIXME: Needs new telepathy spec */
- gtk_widget_hide (information->vbox_details);
+ /* FIXME: Needs new telepathy spec */
+ gtk_widget_hide (information->vbox_details);
}
static void
contact_widget_details_update (EmpathyContactWidget *information)
{
- /* FIXME: Needs new telepathy spec */
+ /* FIXME: Needs new telepathy spec */
}
static void
contact_widget_client_setup (EmpathyContactWidget *information)
{
- /* FIXME: Needs new telepathy spec */
- gtk_widget_hide (information->vbox_client);
+ /* FIXME: Needs new telepathy spec */
+ gtk_widget_hide (information->vbox_client);
}
static void
contact_widget_client_update (EmpathyContactWidget *information)
{
- /* FIXME: Needs new telepathy spec */
+ /* FIXME: Needs new telepathy spec */
}