#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include <libempathy/empathy-debug.h>
-/* Flashing delay for icons (milliseconds). */
-#define FLASH_TIMEOUT 500
-
/* Active users are those which have recently changed state
* (e.g. online, offline or from normal to a busy state).
*/
G_DEFINE_TYPE (EmpathyContactListView, empathy_contact_list_view, GTK_TYPE_TREE_VIEW);
-static void
-contact_list_view_tooltip_destroy_cb (GtkWidget *widget,
- EmpathyContactListView *view)
-{
- EmpathyContactListViewPriv *priv = GET_PRIV (view);
-
- DEBUG ("Tooltip destroyed");
- if (priv->tooltip_widget) {
- g_object_unref (priv->tooltip_widget);
- priv->tooltip_widget = NULL;
- }
-}
-
static gboolean
contact_list_view_query_tooltip_cb (EmpathyContactListView *view,
gint x,
GtkTreeIter iter;
GtkTreePath *path;
+ /* FIXME: We need GTK version >= 2.12.10. See GNOME bug #504087 */
+ if (gtk_check_version (2, 12, 10)) {
+ return FALSE;
+ }
+
if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view), &x, &y,
keyboard_mode,
&model, &path, &iter)) {
if (!priv->tooltip_widget) {
priv->tooltip_widget = empathy_contact_widget_new (contact,
- EMPATHY_CONTACT_WIDGET_EDIT_NONE);
- g_object_ref (priv->tooltip_widget);
- g_signal_connect (priv->tooltip_widget, "destroy",
- G_CALLBACK (contact_list_view_tooltip_destroy_cb),
- view);
-
+ EMPATHY_CONTACT_WIDGET_EDIT_NONE);
+ g_object_add_weak_pointer (G_OBJECT (priv->tooltip_widget),
+ (gpointer) &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);
g_object_unref (contact);
GtkTreeModel *model;
GtkTreeIter iter;
- if (!(priv->contact_features & EMPATHY_CONTACT_FEATURE_CHAT)) {
- return;
- }
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
-
+ model = GTK_TREE_MODEL (priv->store);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
-1);
- if (contact) {
+ if (!contact) {
+ return;
+ }
+
+ /* There is no event for the contact, default action is starting a chat */
+ if (priv->contact_features & EMPATHY_CONTACT_FEATURE_CHAT) {
empathy_dispatcher_chat_with_contact (contact);
- g_object_unref (contact);
}
+
+ g_object_unref (contact);
}
static void
EmpathyContactListFeatureFlags features)
{
EmpathyContactListViewPriv *priv = GET_PRIV (view);
+ gboolean has_tooltip;
g_return_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view));
G_N_ELEMENTS (drag_types_dest),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
} else {
- /* FIXME: URI could still be droped depending on FT feature */
+ /* FIXME: URI could still be droped depending on FT feature */
gtk_drag_dest_unset (GTK_WIDGET (view));
}
/* Update has-tooltip */
- gtk_widget_set_has_tooltip (GTK_WIDGET (view),
- features & EMPATHY_CONTACT_LIST_FEATURE_CONTACT_TOOLTIP);
+ has_tooltip = (features & EMPATHY_CONTACT_LIST_FEATURE_CONTACT_TOOLTIP) != 0;
+ gtk_widget_set_has_tooltip (GTK_WIDGET (view), has_tooltip);
}
static void
g_object_unref (priv->store);
}
- if (priv->tooltip_widget) {
- g_object_unref (priv->tooltip_widget);
- }
-
G_OBJECT_CLASS (empathy_contact_list_view_parent_class)->finalize (object);
}
dialog = gtk_dialog_new_with_buttons (window_title, parent,
GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
GTK_STOCK_DELETE, GTK_RESPONSE_YES,
- GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
NULL);
gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);