EmpathyIndividualViewPriv *priv = GET_PRIV (self);
EmpathyLiveSearch *live = EMPATHY_LIVE_SEARCH (priv->search_widget);
const gchar *str;
- const gchar *p;
- gchar *dup_str = NULL;
- gboolean visible;
GList *personas, *l;
g_assert (live != NULL);
personas = folks_individual_get_personas (individual);
for (l = personas; l; l = l->next)
{
+ const gchar *p;
+ gchar *dup_str = NULL;
+ gboolean visible;
+
str = folks_persona_get_uid (l->data);
p = strstr (str, "@");
if (p != NULL)
if (priv->tooltip_widget != NULL)
{
DEBUG ("Tooltip destroyed");
- g_object_unref (priv->tooltip_widget);
- priv->tooltip_widget = NULL;
+ tp_clear_object (&priv->tooltip_widget);
}
}
/* Avoid an infinite loop. See GNOME bug #574377 */
if (running > 0)
- {
- return FALSE;
- }
+ return FALSE;
+
running++;
/* Don't show the tooltip if there's already a popup menu */
if (gtk_menu_get_for_attach_widget (GTK_WIDGET (view)) != NULL)
- {
- goto OUT;
- }
+ goto OUT;
if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view), &x, &y,
keyboard_mode, &model, &path, &iter))
- {
- goto OUT;
- }
+ goto OUT;
gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (view), tooltip, path);
gtk_tree_path_free (path);
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual,
-1);
if (individual == NULL)
- {
- goto OUT;
- }
+ goto OUT;
contact = empathy_contact_dup_from_folks_individual (individual);
g_object_unref (individual);
if (contact == NULL)
goto OUT;
- if (!priv->tooltip_widget)
+ if (priv->tooltip_widget == NULL)
{
priv->tooltip_widget = empathy_contact_widget_new (contact,
EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP |
gtk_widget_show (priv->tooltip_widget);
}
else
- {
- empathy_contact_widget_set_contact (priv->tooltip_widget, contact);
- }
+ empathy_contact_widget_set_contact (priv->tooltip_widget, contact);
gtk_tooltip_set_custom (tooltip, priv->tooltip_widget);
ret = TRUE;
return ret;
}
+static void
+groups_change_group_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ FolksGroups *groups = FOLKS_GROUPS (source);
+ GError *error = NULL;
+
+ folks_groups_change_group_finish (groups, result, &error);
+ if (error != NULL)
+ {
+ g_warning ("failed to change group: %s", error->message);
+ g_clear_error (&error);
+ }
+}
+
static void
individual_view_handle_drag (EmpathyIndividualView *self,
FolksIndividual *individual,
}
if (new_group != NULL)
- folks_groups_change_group (FOLKS_GROUPS (individual), new_group, TRUE);
+ folks_groups_change_group (FOLKS_GROUPS (individual), new_group, TRUE,
+ groups_change_group_cb, NULL);
if (old_group != NULL && action == GDK_ACTION_MOVE)
- folks_groups_change_group (FOLKS_GROUPS (individual), old_group, FALSE);
+ folks_groups_change_group (FOLKS_GROUPS (individual), old_group, FALSE,
+ groups_change_group_cb, NULL);
}
static gboolean
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual, -1);
- if (!individual)
- {
- return FALSE;
- }
+ if (individual == NULL)
+ return FALSE;
contact = empathy_contact_dup_from_folks_individual (individual);
empathy_send_file_from_uri_list (contact, sel_data);
g_object_unref (individual);
+ tp_clear_object (&contact);
return TRUE;
}
is_row = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
x, y, &path, NULL, NULL, NULL);
- cleanup &= (!dm);
+ cleanup &= (dm == NULL);
if (is_row)
{
cleanup &= (dm && gtk_tree_path_compare (dm->path, path) != 0);
- is_different = (!dm || (dm
+ is_different = ((dm == NULL) || ((dm != NULL)
&& gtk_tree_path_compare (dm->path, path) != 0));
}
else
- {
- cleanup &= FALSE;
- }
+ cleanup &= FALSE;
if (path == NULL)
{
not groups.
*/
FolksIndividual *individual;
+ EmpathyCapabilities caps = EMPATHY_CAPABILITIES_NONE;
+
gtk_tree_model_get (model, &iter,
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual, -1);
+ if (individual != NULL)
+ {
+ EmpathyContact *contact = NULL;
+
+ contact = empathy_contact_dup_from_folks_individual (individual);
+ caps = empathy_contact_get_capabilities (contact);
+
+ tp_clear_object (&contact);
+ }
+
if (individual != NULL &&
folks_individual_is_online (individual) &&
- (folks_individual_get_capabilities (individual) &
- FOLKS_CAPABILITIES_FLAGS_FILE_TRANSFER))
+ (caps & EMPATHY_CAPABILITIES_FT))
{
gdk_drag_status (context, GDK_ACTION_COPY, time_);
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
}
if (!is_different && !cleanup)
- {
- return retval;
- }
+ return retval;
if (dm)
{
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- return;
- }
+ return;
path = gtk_tree_model_get_path (model, &iter);
priv->drag_row = gtk_tree_row_reference_new (model, path);
priv = GET_PRIV (widget);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
- if (!priv->drag_row)
- {
- return;
- }
+ if (priv->drag_row == NULL)
+ return;
src_path = gtk_tree_row_reference_get_path (priv->drag_row);
- if (!src_path)
- {
- return;
- }
+ if (src_path == NULL)
+ return;
if (!gtk_tree_model_get_iter (model, &iter, src_path))
{
individual =
empathy_individual_view_dup_selected (EMPATHY_INDIVIDUAL_VIEW (widget));
- if (!individual)
- {
- return;
- }
+ if (individual == NULL)
+ return;
individual_id = folks_individual_get_id (individual);
GtkTreeIter iter;
if (!(priv->individual_features & EMPATHY_CONTACT_FEATURE_CHAT))
- {
- return;
- }
+ return;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual, -1);
- if (!individual)
+ if (individual == NULL)
return;
contact = empathy_contact_dup_from_folks_individual (individual);
-
if (contact != NULL)
{
DEBUG ("Starting a chat");
}
g_object_unref (individual);
+ tp_clear_object (&contact);
}
static void
g_object_set (cell, "cell-background-gdk", &color, NULL);
}
else
- {
- g_object_set (cell, "cell-background-gdk", NULL, NULL);
- }
+ g_object_set (cell, "cell-background-gdk", NULL, NULL);
}
static void
NULL);
}
else
- {
- g_object_set (cell, "visible", FALSE, NULL);
- }
+ g_object_set (cell, "visible", FALSE, NULL);
individual_view_cell_set_background (view, cell, is_group, is_active);
}
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- return NULL;
- }
+ return NULL;
gtk_tree_model_get (model, &iter,
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual, -1);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- return 0;
- }
+ return 0;
gtk_tree_model_get (model, &iter,
EMPATHY_INDIVIDUAL_STORE_COL_FLAGS, &flags, -1);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- return NULL;
- }
+ return NULL;
gtk_tree_model_get (model, &iter,
EMPATHY_INDIVIDUAL_STORE_COL_IS_GROUP, &is_group,
if (!(priv->view_features & (EMPATHY_INDIVIDUAL_VIEW_FEATURE_GROUPS_RENAME |
EMPATHY_INDIVIDUAL_VIEW_FEATURE_GROUPS_REMOVE)))
- {
- return NULL;
- }
+ return NULL;
group = empathy_individual_view_get_selected_group (view, &is_fake_group);
if (!group || is_fake_group)
g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (view), NULL);
individual = empathy_individual_view_dup_selected (view);
- if (!individual)
- {
- return NULL;
- }
+ if (individual == NULL)
+ return NULL;
+
flags = empathy_individual_view_get_flags (view);
menu = empathy_individual_menu_new (individual, priv->individual_features);
{
/* create the menu if required, or just add a separator */
- if (!menu)
- {
- menu = gtk_menu_new ();
- }
+ if (menu == NULL)
+ menu = gtk_menu_new ();
else
{
item = gtk_separator_menu_item_new ();