aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-07-09 01:33:37 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-07-09 01:33:37 +0800
commit1b16114ce2fe6665b20c7d091a16f51b1521f5d5 (patch)
tree0c87bed89a0f3c0a767a3c1bc45bd298bfbce8dd
parent231b08de20361a1483e6457a2fdbcd4796cf8f79 (diff)
downloadgsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.tar
gsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.tar.gz
gsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.tar.bz2
gsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.tar.lz
gsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.tar.xz
gsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.tar.zst
gsoc2013-empathy-1b16114ce2fe6665b20c7d091a16f51b1521f5d5.zip
Fix some coding style
svn path=/trunk/; revision=1218
-rw-r--r--libempathy-gtk/empathy-contact-widget.c92
-rw-r--r--libempathy/empathy-contact.c170
-rw-r--r--libempathy/empathy-contact.h6
3 files changed, 115 insertions, 153 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 707830ea2..81b8fb096 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -226,9 +226,7 @@ empathy_contact_widget_get_contact (GtkWidget *widget)
information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
if (!information)
- {
return NULL;
- }
return information->contact;
}
@@ -266,9 +264,7 @@ empathy_contact_widget_set_account_filter (
chooser = EMPATHY_ACCOUNT_CHOOSER (information->widget_account);
if (chooser)
- {
empathy_account_chooser_set_filter (chooser, filter, user_data);
- }
}
static void
@@ -321,9 +317,7 @@ contact_widget_set_contact (EmpathyContactWidget *information,
contact_widget_remove_contact (information);
if (contact)
- {
information->contact = g_object_ref (contact);
- }
/* Update information for widgets */
contact_widget_contact_update (information);
@@ -379,9 +373,7 @@ save_avatar_menu_activate_cb (GtkWidget *widget,
splitted = g_strsplit (avatar->format, "/", 2);
if (splitted[0] != NULL && splitted[1] != NULL)
- {
ext = g_strdup (splitted[1]);
- }
g_strfreev (splitted);
}
@@ -637,13 +629,9 @@ contact_widget_contact_update (EmpathyContactWidget *information)
/* 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)
@@ -675,7 +663,7 @@ contact_widget_change_contact (EmpathyContactWidget *information)
account = empathy_account_chooser_get_account (
EMPATHY_ACCOUNT_CHOOSER (information->widget_account));
if (!account)
- return;
+ return;
if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
{
@@ -683,16 +671,16 @@ contact_widget_change_contact (EmpathyContactWidget *information)
id = gtk_entry_get_text (GTK_ENTRY (information->widget_id));
if (G_STR_EMPTY (id))
- return;
+ return;
contact = empathy_contact_factory_get_from_id (information->factory,
account, id);
}
else
{
- contact = empathy_contact_factory_get_user (information->factory,
- account);
- }
+ contact = empathy_contact_factory_get_user (information->factory,
+ account);
+ }
if (contact)
{
@@ -762,15 +750,11 @@ static void
contact_widget_name_notify_cb (EmpathyContactWidget *information)
{
if (GTK_IS_ENTRY (information->widget_alias))
- {
gtk_entry_set_text (GTK_ENTRY (information->widget_alias),
empathy_contact_get_name (information->contact));
- }
else
- {
gtk_label_set_label (GTK_LABEL (information->widget_alias),
empathy_contact_get_name (information->contact));
- }
}
static void
@@ -788,23 +772,22 @@ 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 (
- EMPATHY_AVATAR_CHOOSER (information->widget_avatar), avatar);
- g_signal_handlers_unblock_by_func (information->widget_avatar,
- contact_widget_avatar_changed_cb, information);
- }
- else
+ 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,
+ contact_widget_avatar_changed_cb, information);
+ }
+ else
empathy_avatar_image_set (
EMPATHY_AVATAR_IMAGE (information->widget_avatar), avatar);
- }
}
static void
@@ -830,9 +813,7 @@ contact_widget_groups_update (EmpathyContactWidget *information)
gtk_widget_show (information->vbox_groups);
}
else
- {
gtk_widget_hide (information->vbox_groups);
- }
}
static void
@@ -902,9 +883,7 @@ contact_widget_model_populate_columns (EmpathyContactWidget *information)
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
if (information->renderer)
- {
g_object_unref (information->renderer);
- }
information->renderer = g_object_ref (renderer);
}
@@ -968,7 +947,7 @@ contact_widget_model_find_name (EmpathyContactWidget *information,
FindName data;
if (G_STR_EMPTY (name))
- return FALSE;
+ return FALSE;
data.information = information;
data.name = name;
@@ -1003,7 +982,7 @@ contact_widget_model_find_name_foreach (GtkTreeModel *model,
-1);
if (!name)
- return FALSE;
+ return FALSE;
if (data->name && strcmp (data->name, name) == 0)
{
@@ -1050,21 +1029,20 @@ contact_widget_cell_toggled (GtkCellRendererToggle *cell,
if (group)
{
- 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 (information->manager), information->contact,
- group);
+ 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 (information->manager), information->contact,
+ group);
+ }
+ g_free (group);
}
-
- g_free (group);
- }
}
static void
@@ -1077,14 +1055,10 @@ contact_widget_entry_group_changed_cb (GtkEditable *editable,
group = gtk_entry_get_text (GTK_ENTRY (information->entry_group));
if (contact_widget_model_find_name (information, group, &iter))
- {
gtk_widget_set_sensitive (GTK_WIDGET (information->button_group), FALSE);
- }
else
- {
gtk_widget_set_sensitive (GTK_WIDGET (information->button_group),
!G_STR_EMPTY (group));
- }
}
static void
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 7a73b2bbb..6aed12acc 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -199,14 +199,10 @@ contact_finalize (GObject *object)
g_free (priv->presence_message);
if (priv->avatar)
- {
empathy_avatar_unref (priv->avatar);
- }
if (priv->account)
- {
g_object_unref (priv->account);
- }
G_OBJECT_CLASS (empathy_contact_parent_class)->finalize (object);
}
@@ -221,42 +217,43 @@ contact_get_property (GObject *object,
priv = GET_PRIV (object);
- switch (param_id) {
- case PROP_ID:
- g_value_set_string (value, priv->id);
- break;
- case PROP_NAME:
- g_value_set_string (value,
- empathy_contact_get_name (EMPATHY_CONTACT (object)));
- break;
- case PROP_AVATAR:
- g_value_set_boxed (value, priv->avatar);
- break;
- case PROP_ACCOUNT:
- g_value_set_object (value, priv->account);
- break;
- case PROP_PRESENCE:
- g_value_set_uint (value, priv->presence);
- break;
- case PROP_PRESENCE_MESSAGE:
- g_value_set_string (value, priv->presence_message);
- break;
- case PROP_HANDLE:
- g_value_set_uint (value, priv->handle);
- break;
- case PROP_CAPABILITIES:
- g_value_set_flags (value, priv->capabilities);
- break;
- case PROP_IS_USER:
- g_value_set_boolean (value, priv->is_user);
- break;
- case PROP_READY:
- g_value_set_flags (value, priv->ready);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
+ switch (param_id)
+ {
+ case PROP_ID:
+ g_value_set_string (value, priv->id);
+ break;
+ case PROP_NAME:
+ g_value_set_string (value,
+ empathy_contact_get_name (EMPATHY_CONTACT (object)));
+ break;
+ case PROP_AVATAR:
+ g_value_set_boxed (value, priv->avatar);
+ break;
+ case PROP_ACCOUNT:
+ g_value_set_object (value, priv->account);
+ break;
+ case PROP_PRESENCE:
+ g_value_set_uint (value, priv->presence);
+ break;
+ case PROP_PRESENCE_MESSAGE:
+ g_value_set_string (value, priv->presence_message);
+ break;
+ case PROP_HANDLE:
+ g_value_set_uint (value, priv->handle);
+ break;
+ case PROP_CAPABILITIES:
+ g_value_set_flags (value, priv->capabilities);
+ break;
+ case PROP_IS_USER:
+ g_value_set_boolean (value, priv->is_user);
+ break;
+ case PROP_READY:
+ g_value_set_flags (value, priv->ready);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
}
static void
@@ -269,47 +266,48 @@ contact_set_property (GObject *object,
priv = GET_PRIV (object);
- switch (param_id) {
- case PROP_ID:
- empathy_contact_set_id (EMPATHY_CONTACT (object),
+ switch (param_id)
+ {
+ case PROP_ID:
+ empathy_contact_set_id (EMPATHY_CONTACT (object),
g_value_get_string (value));
- break;
- case PROP_NAME:
- empathy_contact_set_name (EMPATHY_CONTACT (object),
+ break;
+ case PROP_NAME:
+ empathy_contact_set_name (EMPATHY_CONTACT (object),
g_value_get_string (value));
- break;
- case PROP_AVATAR:
- empathy_contact_set_avatar (EMPATHY_CONTACT (object),
+ break;
+ case PROP_AVATAR:
+ empathy_contact_set_avatar (EMPATHY_CONTACT (object),
g_value_get_boxed (value));
- break;
- case PROP_ACCOUNT:
- empathy_contact_set_account (EMPATHY_CONTACT (object),
+ break;
+ case PROP_ACCOUNT:
+ empathy_contact_set_account (EMPATHY_CONTACT (object),
MC_ACCOUNT (g_value_get_object (value)));
- break;
- case PROP_PRESENCE:
- empathy_contact_set_presence (EMPATHY_CONTACT (object),
+ break;
+ case PROP_PRESENCE:
+ empathy_contact_set_presence (EMPATHY_CONTACT (object),
g_value_get_uint (value));
- break;
- case PROP_PRESENCE_MESSAGE:
- empathy_contact_set_presence_message (EMPATHY_CONTACT (object),
+ break;
+ case PROP_PRESENCE_MESSAGE:
+ empathy_contact_set_presence_message (EMPATHY_CONTACT (object),
g_value_get_string (value));
- break;
- case PROP_HANDLE:
- empathy_contact_set_handle (EMPATHY_CONTACT (object),
+ break;
+ case PROP_HANDLE:
+ empathy_contact_set_handle (EMPATHY_CONTACT (object),
g_value_get_uint (value));
- break;
- case PROP_CAPABILITIES:
- empathy_contact_set_capabilities (EMPATHY_CONTACT (object),
+ break;
+ case PROP_CAPABILITIES:
+ empathy_contact_set_capabilities (EMPATHY_CONTACT (object),
g_value_get_flags (value));
- break;
- case PROP_IS_USER:
- empathy_contact_set_is_user (EMPATHY_CONTACT (object),
+ break;
+ case PROP_IS_USER:
+ empathy_contact_set_is_user (EMPATHY_CONTACT (object),
g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
}
static void
@@ -378,9 +376,7 @@ empathy_contact_set_id (EmpathyContact *contact,
g_object_notify (G_OBJECT (contact), "id");
if (G_STR_EMPTY (priv->name))
- {
g_object_notify (G_OBJECT (contact), "name");
- }
}
contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_ID);
@@ -397,9 +393,7 @@ empathy_contact_get_name (EmpathyContact *contact)
priv = GET_PRIV (contact);
if (G_STR_EMPTY (priv->name))
- {
return empathy_contact_get_id (contact);
- }
return priv->name;
}
@@ -457,9 +451,7 @@ empathy_contact_set_avatar (EmpathyContact *contact,
}
if (avatar)
- {
priv->avatar = empathy_avatar_ref (avatar);
- }
g_object_notify (G_OBJECT (contact), "avatar");
}
@@ -491,9 +483,7 @@ empathy_contact_set_account (EmpathyContact *contact,
return;
if (priv->account)
- {
g_object_unref (priv->account);
- }
priv->account = g_object_ref (account);
g_object_notify (G_OBJECT (contact), "account");
@@ -687,7 +677,7 @@ empathy_contact_can_voip (EmpathyContact *contact)
priv = GET_PRIV (contact);
return priv->capabilities & (EMPATHY_CAPABILITIES_AUDIO |
- EMPATHY_CAPABILITIES_VIDEO);
+ EMPATHY_CAPABILITIES_VIDEO);
}
EmpathyContactReady
@@ -721,7 +711,7 @@ empathy_contact_equal (gconstpointer v1,
id_b = empathy_contact_get_id (EMPATHY_CONTACT (v2));
return empathy_account_equal (account_a, account_b) &&
- !tp_strdiff (id_a, id_b);
+ !tp_strdiff (id_a, id_b);
}
guint
@@ -733,10 +723,11 @@ empathy_contact_hash (gconstpointer key)
priv = GET_PRIV (EMPATHY_CONTACT (key));
- if (priv->hash == 0) {
- priv->hash = empathy_account_hash (priv->account) ^
- g_str_hash (priv->id);
- }
+ if (priv->hash == 0)
+ {
+ priv->hash = empathy_account_hash (priv->account) ^
+ g_str_hash (priv->id);
+ }
return priv->hash;
}
@@ -753,9 +744,8 @@ contact_is_ready_func (GObject *contact,
/* When the name is NULL, empathy_contact_get_name() fallback to the id.
* When the caller want to wait the name to be ready, it also want to wait
* the id to be ready in case of fallback. */
- if ((ready & EMPATHY_CONTACT_READY_NAME) && G_STR_EMPTY (priv->name)) {
- ready |= EMPATHY_CONTACT_READY_ID;
- }
+ if ((ready & EMPATHY_CONTACT_READY_NAME) && G_STR_EMPTY (priv->name))
+ ready |= EMPATHY_CONTACT_READY_ID;
return (priv->ready & ready) == ready;
}
@@ -837,9 +827,7 @@ empathy_contact_load_avatar_data (EmpathyContact *contact,
g_clear_error (&error);
}
else
- {
DEBUG ("Avatar saved to %s", filename);
- }
}
g_free (filename);
}
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index 23398b226..da018fd95 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -121,9 +121,9 @@ gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact,
#define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ())
GType empathy_avatar_get_type (void) G_GNUC_CONST;
EmpathyAvatar * empathy_avatar_new (guchar *data,
- gsize len,
- gchar *format,
- gchar *token);
+ gsize len,
+ gchar *format,
+ gchar *token);
EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar);
void empathy_avatar_unref (EmpathyAvatar *avatar);