Author: jasper
Date: 2007-02-19 19:27:53 +0000 (Mon, 19 Feb 2007)
New Revision: 24997

Modified:
   xfce4-panel/branches/4_5_nick/panel/panel-config.c
   xfce4-panel/branches/4_5_nick/panel/panel-item-manager.c
   xfce4-panel/branches/4_5_nick/panel/panel-properties.c
Log:
Backport features from trunk:
* Unhide panel when dragging over it.
* Check for NULL strings in DBG messages to prevent crashes on Solaris.


Modified: xfce4-panel/branches/4_5_nick/panel/panel-config.c
===================================================================
--- xfce4-panel/branches/4_5_nick/panel/panel-config.c  2007-02-19 13:21:19 UTC 
(rev 24996)
+++ xfce4-panel/branches/4_5_nick/panel/panel-config.c  2007-02-19 19:27:53 UTC 
(rev 24997)
@@ -376,7 +376,7 @@
                     ++i;
                 }
 
-                if (name != NULL)
+                if (name != NULL && value != NULL)
                 {
                     DBG ("Add item: name=\"%s\", id=\"%s\"", name, value);
 

Modified: xfce4-panel/branches/4_5_nick/panel/panel-item-manager.c
===================================================================
--- xfce4-panel/branches/4_5_nick/panel/panel-item-manager.c    2007-02-19 
13:21:19 UTC (rev 24996)
+++ xfce4-panel/branches/4_5_nick/panel/panel-item-manager.c    2007-02-19 
19:27:53 UTC (rev 24997)
@@ -300,6 +300,13 @@
     else
     {
         dirs = xfce_resource_dirs (XFCE_RESOURCE_DATA);
+
+        if (G_UNLIKELY(!dirs))
+        {
+            dirs    = g_new (gchar*, 2);
+            dirs[0] = g_strdup (DATADIR);
+            dirs[1] = NULL;
+        }
     }
 
     for (d = dirs; *d != NULL || !datadir_used; ++d)
@@ -345,9 +352,12 @@
                 {
                     DBG (" + klass \"%s\": "
                          "name=%s, comment=%s, icon=%s, external=%d, path=%s",
-                         klass->plugin_name,
-                         klass->name, klass->comment, klass->icon,
-                         klass->is_external, klass->file);
+                         klass->plugin_name ? klass->plugin_name : "(null)",
+                         klass->name        ? klass->name        : "(null)", 
+                         klass->comment     ? klass->comment     : "(null)", 
+                         klass->icon        ? klass->icon        : "(null)",
+                         klass->is_external, 
+                         klass->file        ? klass->file        : "(null)");
 
                     g_hash_table_insert (plugin_klasses,
                                          klass->plugin_name, klass);

Modified: xfce4-panel/branches/4_5_nick/panel/panel-properties.c
===================================================================
--- xfce4-panel/branches/4_5_nick/panel/panel-properties.c      2007-02-19 
13:21:19 UTC (rev 24996)
+++ xfce4-panel/branches/4_5_nick/panel/panel-properties.c      2007-02-19 
19:27:53 UTC (rev 24997)
@@ -40,6 +40,7 @@
 
 #include "panel-properties.h"
 #include "panel-private.h"
+#include "panel-dnd.h"
 
 #define HIDDEN_SIZE     3
 #define OPAQUE          0xffffffff
@@ -756,7 +757,76 @@
     return FALSE;
 }
 
+static gboolean
+drag_motion (Panel          *panel, 
+             GdkDragContext *context,
+             int             x, 
+             int             y, 
+             guint           time, 
+             gpointer        user_data)
+{
+    PanelPrivate *priv;
+
+    priv = panel->priv;
+
+    if (!priv->hidden || priv->block_autohide)
+        return TRUE;
+
+    if (priv->hide_timeout)
+    {
+        g_source_remove (priv->hide_timeout);
+        priv->hide_timeout = 0;
+    }
+
+    if (!priv->unhide_timeout)
+    {
+        priv->unhide_timeout =
+            g_timeout_add (UNHIDE_TIMEOUT,
+                           (GSourceFunc) _unhide_timeout, panel);
+    }
+
+    return TRUE;
+}
+
+
 static void
+drag_leave (Panel          *panel,
+            GdkDragContext *drag_context,
+            guint           time,
+            gpointer        user_data)
+{
+    int    x, y, w, h, px, py;
+    PanelPrivate *priv;
+
+    priv = panel->priv;
+
+    if (priv->hidden || priv->block_autohide)
+        return;
+
+    /* check if pointer is inside the window */
+    gdk_display_get_pointer (gdk_display_get_default (), NULL, &px, &py, NULL);
+    gtk_window_get_position (GTK_WINDOW (panel), &x, &y);
+    gtk_window_get_size (GTK_WINDOW (panel), &w, &h);
+
+    if (px < x || px > x + w || py < y || py > y + h)
+    {
+        if (priv->unhide_timeout)
+        {
+            g_source_remove (priv->unhide_timeout);
+            priv->unhide_timeout = 0;
+        }
+
+        if (!priv->hide_timeout)
+        {
+            priv->hide_timeout =
+                g_timeout_add (HIDE_TIMEOUT,
+                               (GSourceFunc) _hide_timeout, panel);
+        }
+    }
+}
+
+
+static void
 panel_enter (Panel            *panel,
              GdkEventCrossing *event)
 {
@@ -872,6 +942,10 @@
 
     g_signal_connect (G_OBJECT (panel), "move-end",
                       G_CALLBACK (panel_move_end), NULL);
+
+    panel_dnd_set_dest (GTK_WIDGET (panel));
+    g_signal_connect (panel, "drag-motion", G_CALLBACK (drag_motion), NULL);
+    g_signal_connect (panel, "drag-leave", G_CALLBACK (drag_leave), NULL);
 }
 
 void

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to