[empathy] Add an EmpathyIndividualView feature for dropping files on Individuals



commit 4b17d88ae214bc8b9b74d7fd6c0c01e14f206478
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Aug 24 12:22:38 2010 +0100

    Add an EmpathyIndividualView feature for dropping files on Individuals
    
    This allows drag and drop to be enabled for the linking dialogue without
    allowing files to be dropped onto the dialogue, which wouldn't make sense.
    Helps: bgo#627715

 libempathy-gtk/empathy-individual-view.c |   16 +++++++++++-----
 libempathy-gtk/empathy-individual-view.h |    3 ++-
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 6767c3b..66ddad7 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -557,13 +557,19 @@ individual_view_drag_motion (GtkWidget *widget,
   else
     {
       /* This is a file drag, and it can only be dropped on contacts,
-         not groups.
-       */
-      FolksIndividual *individual;
+       * not groups.
+       * If we don't have FEATURE_FILE_DROP, disallow the drop completely,
+       * even if we have a valid target. */
+      FolksIndividual *individual = NULL;
       EmpathyCapabilities caps = EMPATHY_CAPABILITIES_NONE;
 
-      gtk_tree_model_get (model, &iter,
-          EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual, -1);
+      if (priv->view_features & EMPATHY_INDIVIDUAL_VIEW_FEATURE_FILE_DROP)
+        {
+          gtk_tree_model_get (model, &iter,
+              EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual,
+              -1);
+        }
+
       if (individual != NULL)
         {
           EmpathyContact *contact = NULL;
diff --git a/libempathy-gtk/empathy-individual-view.h b/libempathy-gtk/empathy-individual-view.h
index 003ff2a..4a581c3 100644
--- a/libempathy-gtk/empathy-individual-view.h
+++ b/libempathy-gtk/empathy-individual-view.h
@@ -57,7 +57,8 @@ typedef enum
   EMPATHY_INDIVIDUAL_VIEW_FEATURE_CONTACT_DROP = 1 << 4,
   EMPATHY_INDIVIDUAL_VIEW_FEATURE_CONTACT_DRAG = 1 << 5,
   EMPATHY_INDIVIDUAL_VIEW_FEATURE_CONTACT_TOOLTIP = 1 << 6,
-  EMPATHY_INDIVIDUAL_VIEW_FEATURE_ALL = (1 << 7) - 1,
+  EMPATHY_INDIVIDUAL_VIEW_FEATURE_FILE_DROP = 1 << 7,
+  EMPATHY_INDIVIDUAL_VIEW_FEATURE_ALL = (1 << 8) - 1,
 } EmpathyIndividualViewFeatureFlags;
 
 struct _EmpathyIndividualView



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]