Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > media > main-testing-src > by-pkgid > e9de60276cedfc5ae7ca1246aa19d59c > files > 22

mozilla-thunderbird-2.0.0.19-0.2mdv2009.0.src.rpm

--- mozilla/widget/src/gtk2/nsDragService.cpp.orig	2004-02-05 02:04:20.000000000 +0100
+++ mozilla/widget/src/gtk2/nsDragService.cpp	2004-02-05 02:04:28.000000000 +0100
@@ -41,7 +41,8 @@
 #include <gtk/gtkinvisible.h>
 #include <gdk/gdkx.h>
 #include "nsCRT.h"
-
+#include "nsIPrefService.h"
+#include "nsIPrefBranch.h"
 
 static PRLogModuleInfo *sDragLm = NULL;
 
@@ -74,8 +75,13 @@
 {
     // We have to destroy the hidden widget before the event loop stops
     // running.
+    nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1");
+    PRInt32 dnd_threshold=-1;
+    PRInt32 double_click_timeout=-1;
+
     nsCOMPtr<nsIObserverService> obsServ =
         do_GetService("@mozilla.org/observer-service;1");
+
     obsServ->AddObserver(this, "quit-application", PR_FALSE);
 
     // our hidden source widget
@@ -101,6 +107,63 @@
     mTargetDragDataReceived = PR_FALSE;
     mTargetDragData = 0;
     mTargetDragDataLen = 0;
+
+    if (prefs) {
+        nsresult rv; 
+        nsCOMPtr<nsIPrefBranch> prefBranch;
+        prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
+        if (prefBranch) {
+            PRInt32 tmp = -1;
+            PRInt32 tmp1 = -1;
+            rv = prefBranch->GetIntPref("widget.gtk2.dnd.threshold", &tmp);
+            if(!NS_FAILED(rv) && tmp>0) {
+                dnd_threshold = tmp;
+            }
+
+            rv = prefBranch->GetIntPref("widget.gtk2.double_click_timeout", &tmp);
+            if(!NS_FAILED(rv) && tmp>0) {
+                double_click_timeout = tmp;
+            }
+        }
+    }
+
+
+
+    // MAKE gtk settings below 
+
+    GtkSettings* settings = gtk_settings_get_default();
+
+    /* DEBUG output */
+    {
+        gint double_click;
+        g_object_get(
+                     G_OBJECT(settings), 
+                     "gtk-double-click-time", &double_click,
+                     NULL
+                     );
+        printf("DOUBLE-CLICK: %d --> %d ",double_click, double_click_timeout);
+    }
+
+
+    {
+        gint threshold;
+        g_object_get(
+                     G_OBJECT(settings), 
+                     "gtk-dnd-drag-threshold", &threshold,
+                     NULL
+                     );
+        printf("THRESHOLD: %d --> %d ", threshold, dnd_threshold);
+    }
+    /**/
+
+
+    if(dnd_threshold>-1) {
+        gtk_settings_set_long_property(settings, "gtk-dnd-drag-threshold", dnd_threshold , "someline");
+    }
+
+    if(double_click_timeout>-1) {
+        gtk_settings_set_long_property(settings, "gtk-double-click-time", double_click_timeout, "someline");
+    }
 }
 
 nsDragService::~nsDragService()