[Xfce4-commits] <xfce4-taskbar-plugin:master> Removed duplicated files and fixed drag-and-drop spurious event generation.

Gearoid Murphy noreply at xfce.org
Sat Oct 13 19:32:02 CEST 2012


Updating branch refs/heads/master
         to 5676b08b1980a48b5d9b6d6b7fbdecfeca2fbff3 (commit)
       from 5a2d92e7b19e23087e89f9e8a0eab14d2a991766 (commit)

commit 5676b08b1980a48b5d9b6d6b7fbdecfeca2fbff3
Author: Gearoid Murphy <gearoid at murphy.com>
Date:   Sat Oct 13 18:03:31 2012 +0100

    Removed duplicated files and fixed drag-and-drop spurious event generation.

 panel-dbus.h     |   46 ----------
 panel-debug.c    |  166 ----------------------------------
 panel-debug.h    |   59 ------------
 panel-private.h  |   82 -----------------
 panel-utils.c    |  265 ------------------------------------------------------
 panel-utils.h    |   45 ---------
 panel-xfconf.c   |  163 ---------------------------------
 panel-xfconf.h   |   49 ----------
 taskbar-widget.c |   34 +++-----
 9 files changed, 13 insertions(+), 896 deletions(-)

diff --git a/panel-dbus.h b/panel-dbus.h
deleted file mode 100644
index dab8a27..0000000
--- a/panel-dbus.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008-2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PANEL_DBUS_H__
-#define __PANEL_DBUS_H__
-
-/* panel dbus names */
-#define PANEL_DBUS_NAME              "org.xfce.Panel"
-#define PANEL_DBUS_PATH              "/org/xfce/Panel"
-#define PANEL_DBUS_INTERFACE         PANEL_DBUS_NAME
-#define PANEL_DBUS_WRAPPER_PATH      PANEL_DBUS_PATH "/Wrapper/%d"
-#define PANEL_DBUS_WRAPPER_INTERFACE PANEL_DBUS_INTERFACE ".Wrapper"
-
-/* special types for dbus communication */
-#define PANEL_TYPE_DBUS_SET_PROPERTY \
-  dbus_g_type_get_struct ("GValueArray", \
-                          G_TYPE_UINT, \
-                          G_TYPE_VALUE, \
-                          G_TYPE_INVALID)
-
-#define PANEL_TYPE_DBUS_SET_SIGNAL \
-  dbus_g_type_get_collection ("GPtrArray", \
-                              PANEL_TYPE_DBUS_SET_PROPERTY)
-
-enum
-{
-  DBUS_SET_TYPE,
-  DBUS_SET_VALUE
-};
-
-#endif /* !__PANEL_DBUS_H__ */
diff --git a/panel-debug.c b/panel-debug.c
deleted file mode 100644
index 595169f..0000000
--- a/panel-debug.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2010-2011 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <glib.h>
-#include <common/panel-debug.h>
-#include <common/panel-private.h>
-
-
-
-static PanelDebugFlag panel_debug_flags = 0;
-
-
-
-/* additional debug levels */
-static const GDebugKey panel_debug_keys[] =
-{
-  /* external plugin proxy modes */
-  { "gdb", PANEL_DEBUG_GDB },
-  { "valgrind", PANEL_DEBUG_VALGRIND },
-
-  /* domains for debug messages in the code */
-  { "application", PANEL_DEBUG_APPLICATION },
-  { "applicationsmenu", PANEL_DEBUG_APPLICATIONSMENU },
-  { "base-window", PANEL_DEBUG_BASE_WINDOW },
-  { "display-layout", PANEL_DEBUG_DISPLAY_LAYOUT },
-  { "external46", PANEL_DEBUG_EXTERNAL46 },
-  { "external", PANEL_DEBUG_EXTERNAL },
-  { "main", PANEL_DEBUG_MAIN },
-  { "module-factory", PANEL_DEBUG_MODULE_FACTORY },
-  { "module", PANEL_DEBUG_MODULE },
-  { "positioning", PANEL_DEBUG_POSITIONING },
-  { "struts", PANEL_DEBUG_STRUTS },
-  { "systray", PANEL_DEBUG_SYSTRAY },
-  { "tasklist", PANEL_DEBUG_TASKLIST }
-};
-
-
-
-static PanelDebugFlag
-panel_debug_init (void)
-{
-  static volatile gsize  inited__volatile = 0;
-  const gchar           *value;
-
-  if (g_once_init_enter (&inited__volatile))
-    {
-      value = g_getenv ("PANEL_DEBUG");
-      if (value != NULL && *value != '\0')
-        {
-          panel_debug_flags = g_parse_debug_string (value, panel_debug_keys,
-                                                    G_N_ELEMENTS (panel_debug_keys));
-
-          /* always enable (unfiltered) debugging messages */
-          PANEL_SET_FLAG (panel_debug_flags, PANEL_DEBUG_YES);
-
-          /* unset gdb and valgrind in 'all' mode */
-          if (g_ascii_strcasecmp (value, "all") == 0)
-            PANEL_UNSET_FLAG (panel_debug_flags, PANEL_DEBUG_GDB | PANEL_DEBUG_VALGRIND);
-        }
-
-      g_once_init_leave (&inited__volatile, 1);
-    }
-
-  return panel_debug_flags;
-}
-
-
-
-static void
-panel_debug_print (PanelDebugFlag  domain,
-                   const gchar    *message,
-                   va_list         args)
-{
-  gchar       *string;
-  const gchar *domain_name = NULL;
-  guint        i;
-
-  /* lookup domain name */
-  for (i = 0; i < G_N_ELEMENTS (panel_debug_keys); i++)
-    {
-      if (panel_debug_keys[i].value == domain)
-        {
-          domain_name = panel_debug_keys[i].key;
-          break;
-        }
-    }
-
-  panel_assert (domain_name != NULL);
-
-  string = g_strdup_vprintf (message, args);
-  g_printerr (PACKAGE_NAME "(%s): %s\n", domain_name, string);
-  g_free (string);
-}
-
-
-
-gboolean
-panel_debug_has_domain (PanelDebugFlag domain)
-{
-  return PANEL_HAS_FLAG (panel_debug_flags, domain);
-}
-
-
-
-void
-panel_debug (PanelDebugFlag  domain,
-             const gchar    *message,
-             ...)
-{
-  va_list args;
-
-  panel_return_if_fail (domain > 0);
-  panel_return_if_fail (message != NULL);
-
-  /* leave when debug is disabled */
-  if (panel_debug_init () == 0)
-    return;
-
-  va_start (args, message);
-  panel_debug_print (domain, message, args);
-  va_end (args);
-}
-
-
-
-void
-panel_debug_filtered (PanelDebugFlag  domain,
-                      const gchar    *message,
-                      ...)
-{
-  va_list args;
-
-  panel_return_if_fail (domain > 0);
-  panel_return_if_fail (message != NULL);
-
-  /* leave when the filter does not match */
-  if (!PANEL_HAS_FLAG (panel_debug_init (), domain))
-    return;
-
-  va_start (args, message);
-  panel_debug_print (domain, message, args);
-  va_end (args);
-}
diff --git a/panel-debug.h b/panel-debug.h
deleted file mode 100644
index 9d882da..0000000
--- a/panel-debug.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PANEL_DEBUG_H__
-#define __PANEL_DEBUG_H__
-
-#define PANEL_DEBUG_BOOL(bool) ((bool) ? "true" : "false")
-
-typedef enum
-{
-  PANEL_DEBUG_YES              = 1 << 0, /* always enabled if PANEL_DEBUG is not %NULL */
-
-  /* external plugin proxy modes */
-  PANEL_DEBUG_GDB              = 1 << 1, /* run external plugins in gdb */
-  PANEL_DEBUG_VALGRIND         = 1 << 2, /* run external plugins in valgrind */
-
-  /* filter domains */
-  PANEL_DEBUG_APPLICATION      = 1 << 3,
-  PANEL_DEBUG_APPLICATIONSMENU = 1 << 4,
-  PANEL_DEBUG_BASE_WINDOW      = 1 << 5,
-  PANEL_DEBUG_DISPLAY_LAYOUT   = 1 << 6,
-  PANEL_DEBUG_EXTERNAL         = 1 << 7,
-  PANEL_DEBUG_EXTERNAL46       = 1 << 8,
-  PANEL_DEBUG_MAIN             = 1 << 9,
-  PANEL_DEBUG_MODULE           = 1 << 10,
-  PANEL_DEBUG_MODULE_FACTORY   = 1 << 11,
-  PANEL_DEBUG_POSITIONING      = 1 << 12,
-  PANEL_DEBUG_STRUTS           = 1 << 13,
-  PANEL_DEBUG_SYSTRAY          = 1 << 14,
-  PANEL_DEBUG_TASKLIST         = 1 << 15
-}
-PanelDebugFlag;
-
-gboolean panel_debug_has_domain   (PanelDebugFlag  domain);
-
-void     panel_debug              (PanelDebugFlag  domain,
-                                   const gchar    *message,
-                                   ...) G_GNUC_PRINTF (2, 3);
-
-void     panel_debug_filtered     (PanelDebugFlag  domain,
-                                   const gchar    *message,
-                                   ...) G_GNUC_PRINTF (2, 3);
-
-#endif /* !__PANEL_DEBUG_H__ */
diff --git a/panel-private.h b/panel-private.h
deleted file mode 100644
index ea97f7d..0000000
--- a/panel-private.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2008-2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PANEL_PRIVATE_H__
-#define __PANEL_PRIVATE_H__
-
-/* support macros for debugging (improved macro for better position indication) */
-/*#ifndef NDEBUG*/
-#define panel_assert(expr)                 g_assert (expr)
-#define panel_assert_not_reached()         g_assert_not_reached ()
-#define panel_return_if_fail(expr)         G_STMT_START { \
-  if (G_UNLIKELY (!(expr))) \
-    { \
-      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
-             "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
-             #expr); \
-      return; \
-    }; }G_STMT_END
-#define panel_return_val_if_fail(expr,val) G_STMT_START { \
-  if (G_UNLIKELY (!(expr))) \
-    { \
-      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
-             "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
-             #expr); \
-      return (val); \
-    }; }G_STMT_END
-/*#else
-#define panel_assert(expr)                 G_STMT_START{ (void)0; }G_STMT_END
-#define panel_assert_not_reached()         G_STMT_START{ (void)0; }G_STMT_END
-#define panel_return_if_fail(expr)         G_STMT_START{ (void)0; }G_STMT_END
-#define panel_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
-#endif*/
-
-/* handling flags */
-#define PANEL_SET_FLAG(flags,flag) G_STMT_START{ ((flags) |= (flag)); }G_STMT_END
-#define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END
-#define PANEL_HAS_FLAG(flags,flag) (((flags) & (flag)) != 0)
-
-/* relative path to the plugin directory */
-#define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel"
-
-/* relative plugin's rc filename (printf format) */
-#define PANEL_PLUGIN_RC_RELATIVE_PATH PANEL_PLUGIN_RELATIVE_PATH G_DIR_SEPARATOR_S "%s-%d.rc"
-
-/* xfconf property base (printf format) */
-#define PANEL_PLUGIN_PROPERTY_BASE "/plugins/plugin-%d"
-
-/* minimum time in seconds between automatic restarts of panel plugins
- * without asking the user what to do */
-#define PANEL_PLUGIN_AUTO_RESTART (60)
-
-/* integer swap functions */
-#define SWAP_INTEGER(a,b) G_STMT_START { gint swp = a; a = b; b = swp; } G_STMT_END
-#define TRANSPOSE_AREA(area) G_STMT_START { SWAP_INTEGER (area.width, area.height); \
-                                            SWAP_INTEGER (area.x, area.y); } G_STMT_END
-
-/* quick GList and GSList counting without traversing */
-#define LIST_HAS_ONE_ENTRY(l)           ((l) != NULL && (l)->next == NULL)
-#define LIST_HAS_ONE_OR_NO_ENTRIES(l)   ((l) == NULL || (l)->next == NULL)
-#define LIST_HAS_TWO_OR_MORE_ENTRIES(l) ((l) != NULL && (l)->next != NULL)
-
-/* make this easier to read */
-#define PANEL_GDKCOLOR_TO_DOUBLE(gdk_color) gdk_color->red / 65535.00, \
-                                            gdk_color->green / 65535.00, \
-                                            gdk_color->blue / 65535.00
-
-#endif /* !__PANEL_PRIVATE_H__ */
diff --git a/panel-utils.c b/panel-utils.c
deleted file mode 100644
index e8c5d7c..0000000
--- a/panel-utils.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (C) 2009-2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#include <libxfce4ui/libxfce4ui.h>
-#include <exo/exo.h>
-
-#include <common/panel-private.h>
-#include <common/panel-utils.h>
-
-
-
-static void
-panel_utils_help_button_clicked (GtkWidget       *button,
-                                 XfcePanelPlugin *panel_plugin)
-{
-  GtkWidget *toplevel;
-
-  panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (panel_plugin));
-  panel_return_if_fail (GTK_IS_WIDGET (button));
-
-  toplevel = gtk_widget_get_toplevel (button);
-  panel_utils_show_help (GTK_WINDOW (toplevel),
-      xfce_panel_plugin_get_name (panel_plugin),
-      "properties");
-}
-
-
-
-GtkBuilder *
-panel_utils_builder_new (XfcePanelPlugin  *panel_plugin,
-                         const gchar      *buffer,
-                         gsize             length,
-                         GObject         **dialog_return)
-{
-  GError     *error = NULL;
-  GtkBuilder *builder;
-  GObject    *dialog, *button;
-
-  panel_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (panel_plugin), NULL);
-
-  builder = gtk_builder_new ();
-  if (gtk_builder_add_from_string (builder, buffer, length, &error))
-    {
-      dialog = gtk_builder_get_object (builder, "dialog");
-      if (G_LIKELY (dialog != NULL))
-        {
-          g_object_weak_ref (G_OBJECT (dialog),
-                             (GWeakNotify) g_object_unref, builder);
-          xfce_panel_plugin_take_window (panel_plugin, GTK_WINDOW (dialog));
-
-          xfce_panel_plugin_block_menu (panel_plugin);
-          g_object_weak_ref (G_OBJECT (dialog),
-                             (GWeakNotify) xfce_panel_plugin_unblock_menu,
-                             panel_plugin);
-
-          button = gtk_builder_get_object (builder, "close-button");
-          if (G_LIKELY (button != NULL))
-            g_signal_connect_swapped (G_OBJECT (button), "clicked",
-                G_CALLBACK (gtk_widget_destroy), dialog);
-
-          button = gtk_builder_get_object (builder, "help-button");
-          if (G_LIKELY (button != NULL))
-            g_signal_connect (G_OBJECT (button), "clicked",
-                G_CALLBACK (panel_utils_help_button_clicked), panel_plugin);
-
-          if (G_LIKELY (dialog_return != NULL))
-            *dialog_return = dialog;
-
-          return builder;
-        }
-      else
-        {
-          g_set_error_literal (&error, 0, 0, "No widget with the name \"dialog\" found");
-        }
-    }
-
-  g_critical ("Faild to construct the builder for plugin %s-%d: %s.",
-              xfce_panel_plugin_get_name (panel_plugin),
-              xfce_panel_plugin_get_unique_id (panel_plugin),
-              error->message);
-  g_error_free (error);
-  g_object_unref (G_OBJECT (builder));
-
-  return NULL;
-}
-
-
-
-void
-panel_utils_show_help (GtkWindow   *parent,
-                       const gchar *page,
-                       const gchar *offset)
-{
-  GdkScreen *screen;
-  gchar     *filename;
-  gchar     *uri = NULL;
-  GError    *error = NULL;
-  gchar     *locale;
-  gboolean   exists;
-
-  panel_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
-
-  if (G_LIKELY (parent != NULL))
-    screen = gtk_window_get_screen (parent);
-  else
-    screen = gdk_screen_get_default ();
-
-  if (page == NULL)
-    page = "index";
-
-  /* get the locale of the user */
-  locale = g_strdup (setlocale (LC_MESSAGES, NULL));
-  if (G_LIKELY (locale != NULL))
-    locale = g_strdelimit (locale, "._", '\0');
-  else
-    locale = g_strdup ("C");
-
-  /* check if the help page exists on the system */
-  filename = g_strconcat (HELPDIR, G_DIR_SEPARATOR_S, locale,
-                          G_DIR_SEPARATOR_S, page, ".html", NULL);
-  exists = g_file_test (filename, G_FILE_TEST_EXISTS);
-  if (!exists)
-    {
-      g_free (filename);
-      filename = g_strconcat (HELPDIR, G_DIR_SEPARATOR_S "C"
-                              G_DIR_SEPARATOR_S, page, ".html", NULL);
-      exists = g_file_test (filename, G_FILE_TEST_EXISTS);
-    }
-
-  if (G_LIKELY (exists))
-    {
-      uri = g_strconcat ("file://", filename, offset != NULL ? "#" : NULL, offset, NULL);
-    }
-  else if (xfce_dialog_confirm (parent, "web-browser", _("_Read Online"),
-               _("You can read the user manual online. This manual may however "
-                 "not exactly match your panel version."),
-               _("The user manual is not installed on your computer")))
-    {
-      uri = g_strconcat ("http://docs.xfce.org/help.php?package=xfce4-panel&lang=",
-                         locale, "&page=", page, "&anchor=", offset, NULL);
-    }
-
-  g_free (filename);
-  g_free (locale);
-
-  /* try to run the documentation browser */
-  if (uri != NULL
-      && !exo_execute_preferred_application_on_screen ("WebBrowser", uri, NULL,
-                                                       NULL, screen, &error))
-    {
-      /* display an error message to the user */
-      xfce_dialog_show_error (parent, error, _("Failed to open the documentation browser"));
-      g_error_free (error);
-    }
-
-  g_free (uri);
-}
-
-
-
-gboolean
-panel_utils_grab_available (void)
-{
-  GdkScreen     *screen;
-  GdkWindow     *root;
-  GdkGrabStatus  grab_pointer = GDK_GRAB_FROZEN;
-  GdkGrabStatus  grab_keyboard = GDK_GRAB_FROZEN;
-  gboolean       grab_succeed = FALSE;
-  guint          i;
-  GdkEventMask   pointer_mask = GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-                                | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
-                                | GDK_POINTER_MOTION_MASK;
-
-  screen = xfce_gdk_screen_get_active (NULL);
-  root = gdk_screen_get_root_window (screen);
-
-  /* don't try to get the grab for longer then 1/4 second */
-  for (i = 0; i < (G_USEC_PER_SEC / 100 / 4); i++)
-    {
-      grab_keyboard = gdk_keyboard_grab (root, TRUE, GDK_CURRENT_TIME);
-      if (grab_keyboard == GDK_GRAB_SUCCESS)
-        {
-          grab_pointer = gdk_pointer_grab (root, TRUE, pointer_mask,
-                                           NULL, NULL, GDK_CURRENT_TIME);
-          if (grab_pointer == GDK_GRAB_SUCCESS)
-            {
-              grab_succeed = TRUE;
-              break;
-            }
-        }
-
-      g_usleep (100);
-    }
-
-  /* release the grab so the gtk_menu_popup() can take it */
-  if (grab_pointer == GDK_GRAB_SUCCESS)
-    gdk_pointer_ungrab (GDK_CURRENT_TIME);
-  if (grab_keyboard == GDK_GRAB_SUCCESS)
-    gdk_keyboard_ungrab (GDK_CURRENT_TIME);
-
-  if (!grab_succeed)
-    {
-      g_printerr (PACKAGE_NAME ": Unable to get keyboard and mouse "
-                  "grab. Menu popup failed.\n");
-    }
-
-  return grab_succeed;
-}
-
-
-
-void
-panel_utils_set_atk_info (GtkWidget   *widget,
-                          const gchar *name,
-                          const gchar *description)
-{
-  static gboolean  initialized = FALSE;
-  static gboolean  atk_enabled = TRUE;
-  AtkObject       *object;
-
-  panel_return_if_fail (GTK_IS_WIDGET (widget));
-
-  if (atk_enabled)
-    {
-      object = gtk_widget_get_accessible (widget);
-
-      if (!initialized)
-        {
-          initialized = TRUE;
-          atk_enabled = GTK_IS_ACCESSIBLE (object);
-
-          if (!atk_enabled)
-            return;
-        }
-
-      if (name != NULL)
-        atk_object_set_name (object, name);
-
-      if (description != NULL)
-        atk_object_set_description (object, description);
-    }
-}
diff --git a/panel-utils.h b/panel-utils.h
deleted file mode 100644
index 70cbd3d..0000000
--- a/panel-utils.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009-2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PANEL_BUILDER_H__
-#define __PANEL_BUILDER_H__
-
-#include <gtk/gtk.h>
-#include <libxfce4panel/libxfce4panel.h>
-
-/* Hook to make sure GtkBuilder knows are the XfceTitledDialog object */
-#define PANEL_UTILS_LINK_4UI \
-  if (xfce_titled_dialog_get_type () == 0) \
-    return;
-
-GtkBuilder *panel_utils_builder_new    (XfcePanelPlugin  *panel_plugin,
-                                        const gchar      *buffer,
-                                        gsize             length,
-                                        GObject         **dialog_return) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-
-void        panel_utils_show_help      (GtkWindow        *parent,
-                                        const gchar      *page,
-                                        const gchar      *offset);
-
-gboolean    panel_utils_grab_available (void);
-
-void        panel_utils_set_atk_info   (GtkWidget        *widget,
-                                        const gchar      *name,
-                                        const gchar      *description);
-
-#endif /* !__PANEL_BUILDER_H__ */
diff --git a/panel-xfconf.c b/panel-xfconf.c
deleted file mode 100644
index 0aee653..0000000
--- a/panel-xfconf.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2009-2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <dbus/dbus-glib.h>
-
-#include <common/panel-private.h>
-#include <common/panel-xfconf.h>
-#include <libxfce4panel/xfce-panel-macros.h>
-
-
-
-static void
-panel_properties_store_value (XfconfChannel *channel,
-                              const gchar   *xfconf_property,
-                              GType          xfconf_property_type,
-                              GObject       *object,
-                              const gchar   *object_property)
-{
-  GValue      value = { 0, };
-  GdkColor   *color;
-  guint16     alpha = 0xffff;
-#ifndef NDEBUG
-  GParamSpec *pspec;
-#endif
-
-  panel_return_if_fail (G_IS_OBJECT (object));
-  panel_return_if_fail (XFCONF_IS_CHANNEL (channel));
-
-#ifndef NDEBUG
-  /* check if the types match */
-  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), object_property);
-  panel_assert (pspec != NULL);
-  panel_assert (G_PARAM_SPEC_VALUE_TYPE (pspec) == xfconf_property_type);
-#endif
-
-  /* write the property to the xfconf channel */
-  g_value_init (&value, xfconf_property_type);
-  g_object_get_property (G_OBJECT (object), object_property, &value);
-
-  if (G_LIKELY (xfconf_property_type != GDK_TYPE_COLOR))
-    {
-      xfconf_channel_set_property (channel, xfconf_property, &value);
-    }
-  else
-    {
-      /* work around xfconf's lack of storing colors (bug #7117) and
-       * do the same as xfconf_g_property_bind_gdkcolor() does */
-      color = g_value_get_boxed (&value);
-      xfconf_channel_set_array (channel, xfconf_property,
-                                XFCONF_TYPE_UINT16, &color->red,
-                                XFCONF_TYPE_UINT16, &color->green,
-                                XFCONF_TYPE_UINT16, &color->blue,
-                                XFCONF_TYPE_UINT16, &alpha,
-                                G_TYPE_INVALID);
-    }
-
-  g_value_unset (&value);
-}
-
-
-
-XfconfChannel *
-panel_properties_get_channel (GObject *object_for_weak_ref)
-{
-  GError        *error = NULL;
-  XfconfChannel *channel;
-
-  panel_return_val_if_fail (G_IS_OBJECT (object_for_weak_ref), NULL);
-
-  if (!xfconf_init (&error))
-    {
-      g_critical ("Failed to initialize Xfconf: %s", error->message);
-      g_error_free (error);
-      return NULL;
-    }
-
-  channel = xfconf_channel_get (XFCE_PANEL_CHANNEL_NAME);
-  g_object_weak_ref (object_for_weak_ref, (GWeakNotify) xfconf_shutdown, NULL);
-
-  return channel;
-}
-
-
-
-void
-panel_properties_bind (XfconfChannel       *channel,
-                       GObject             *object,
-                       const gchar         *property_base,
-                       const PanelProperty *properties,
-                       gboolean             save_properties)
-{
-  const PanelProperty *prop;
-  gchar               *property;
-
-  panel_return_if_fail (channel == NULL || XFCONF_IS_CHANNEL (channel));
-  panel_return_if_fail (G_IS_OBJECT (object));
-  panel_return_if_fail (property_base != NULL && *property_base == '/');
-  panel_return_if_fail (properties != NULL);
-
-  if (G_LIKELY (channel == NULL))
-    channel = panel_properties_get_channel (object);
-  panel_return_if_fail (XFCONF_IS_CHANNEL (channel));
-
-  /* walk the properties array */
-  for (prop = properties; prop->property != NULL; prop++)
-    {
-      property = g_strconcat (property_base, "/", prop->property, NULL);
-
-      if (save_properties)
-        panel_properties_store_value (channel, property, prop->type, object, prop->property);
-
-      if (G_LIKELY (prop->type != GDK_TYPE_COLOR))
-        xfconf_g_property_bind (channel, property, prop->type, object, prop->property);
-      else
-        xfconf_g_property_bind_gdkcolor (channel, property, object, prop->property);
-
-      g_free (property);
-    }
-}
-
-
-
-void
-panel_properties_unbind (GObject *object)
-{
-  xfconf_g_property_unbind_all (object);
-}
-
-
-
-GType
-panel_properties_value_array_get_type (void)
-{
-  static volatile gsize type__volatile = 0;
-  GType                 type;
-
-  if (g_once_init_enter (&type__volatile))
-    {
-      type = dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE);
-      g_once_init_leave (&type__volatile, type);
-    }
-
-  return type__volatile;
-}
diff --git a/panel-xfconf.h b/panel-xfconf.h
deleted file mode 100644
index 1d3e457..0000000
--- a/panel-xfconf.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2009-2010 Nick Schermer <nick at xfce.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PANEL_XFCONF_H__
-#define __PANEL_XFCONF_H__
-
-#include <xfconf/xfconf.h>
-
-#define PANEL_PROPERTIES_TYPE_VALUE_ARRAY (panel_properties_value_array_get_type ())
-
-
-
-typedef struct _PanelProperty PanelProperty;
-struct _PanelProperty
-{
-  const gchar *property;
-  GType        type;
-};
-
-
-
-XfconfChannel *panel_properties_get_channel          (GObject             *object_for_weak_ref);
-
-void           panel_properties_bind                 (XfconfChannel       *channel,
-                                                      GObject             *object,
-                                                      const gchar         *property_base,
-                                                      const PanelProperty *properties,
-                                                      gboolean             save_properties);
-
-void           panel_properties_unbind               (GObject             *object);
-
-GType          panel_properties_value_array_get_type (void) G_GNUC_CONST;
-
-#endif /* !__PANEL_XFCONF_H__ */
diff --git a/taskbar-widget.c b/taskbar-widget.c
index 7ccf301..0703bbb 100644
--- a/taskbar-widget.c
+++ b/taskbar-widget.c
@@ -101,6 +101,9 @@ struct _XfceTaskBar
 
     /* flag to indicate in-progress drag */
     gboolean dragactive ;
+    
+    /* timestamp for filtering glitchy enter events generated during drag and drop */
+    guint dragtimestamp ;
 
     /* size of the panel plugin */
     gint size;
@@ -357,6 +360,7 @@ static void xfce_taskbar_init (XfceTaskBar *taskbar)
     //taskbar->groups = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
     taskbar->groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
     taskbar->dragactive = FALSE ;
+    taskbar->dragtimestamp = 0 ;
 }
 
 static void xfce_taskbar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
@@ -458,7 +462,6 @@ void xfce_taskbar_load_pinned_config (XfceTaskBar *taskbar)
         char *group_name = groups[group_index] ;
         const char *command_string ;
         
-        //printf("Found group: %s\n", group_name);
         
         xfce_rc_set_group (rc, group_name);
         
@@ -481,7 +484,6 @@ void xfce_taskbar_load_pinned_config (XfceTaskBar *taskbar)
             return ;
         }
         group->command = g_strdup(command_string);
-        //printf("Load the pinned command: '%s'\n", group->command);
         group->pinned = TRUE ;
         
         //add in the icon and add it to the list of groups
@@ -504,7 +506,6 @@ void xfce_taskbar_save_pinned_config (XfceTaskBar *taskbar)
     GList *gi ;
     XfceRc *rc; 
     
-    //printf("xfce_taskbar_save_pinned_config\n");
     
     sprintf(rc_path, "%s/.config/xfce4/panel/taskbar", getenv("HOME"));
     if(!xfce_mkdirhier(rc_path, 0700, NULL))
@@ -530,8 +531,6 @@ void xfce_taskbar_save_pinned_config (XfceTaskBar *taskbar)
         if(group->pinned == FALSE)
             continue ;
         
-        //printf("Saving class group: %s\n", group->window_class_name);
-        
         xfce_rc_set_group (rc, group->window_class_name);
         xfce_rc_write_entry (rc, "command",  group->command);
         
@@ -546,7 +545,6 @@ void xfce_taskbar_save_pinned_config (XfceTaskBar *taskbar)
             }
         }
     }
-    //printf("closing configuration after successful save\n");
     xfce_rc_close (rc);
 }
 
@@ -2104,11 +2102,8 @@ static void xfce_taskbar_group_button_toggle_pinned (XfceTaskBarGroup *group)
         {
             char path_buffer [64] ;
             group->command = (char *) (malloc(command_SIZE*sizeof(char)));
-            
             memset(group->command,   0, command_SIZE*sizeof(char));
-            
             sprintf(path_buffer, "/proc/%i/cmdline", pid);
-            printf("proc path: %s \n", path_buffer);
             {
                 int bytes_read ;
                 FILE *fp ;
@@ -2127,7 +2122,6 @@ static void xfce_taskbar_group_button_toggle_pinned (XfceTaskBarGroup *group)
             
             
             group->pinned = TRUE ;
-            printf("program path: %s \n", group->command);
         }
     }
     
@@ -2260,6 +2254,7 @@ static gboolean xfce_taskbar_group_button_release_event
     if(group->taskbar->dragactive == TRUE)
     {
         group->taskbar->dragactive = FALSE ;
+        group->taskbar->dragtimestamp = gtk_get_current_event_time();
         return FALSE ;
     }
     
@@ -2411,6 +2406,8 @@ static void xfce_taskbar_activate_hover_menu(GtkWidget *menu_widget, XfceTaskBar
     gtk_menu_attach_to_widget (GTK_MENU (menu_widget), group->button, NULL);
     g_object_set_data(G_OBJECT(menu_widget), "menu-source", (void *)mouse_button);
     g_signal_connect (G_OBJECT (menu_widget), "selection-done", G_CALLBACK (xfce_taskbar_group_button_menu_destroy), group);
+    g_signal_connect (GTK_WINDOW (GTK_MENU(menu_widget)->toplevel), "enter-notify-event", G_CALLBACK (hover_menu_enter), menu_widget);
+    g_signal_connect (GTK_WINDOW (GTK_MENU(menu_widget)->toplevel), "leave-notify-event", G_CALLBACK (hover_menu_leave), menu_widget);
     {
         gint x, y ;
         gboolean push_in=TRUE;
@@ -2436,7 +2433,6 @@ static gboolean xfce_taskbar_group_button_hover_timeout(gpointer group_ptr)
     GtkWidget *menu_widget;
     XfceTaskBarGroup *group = (XfceTaskBarGroup *)group_ptr ;
     
-    //printf("xfce_taskbar_group_button_hover_timeout %s\n", group->window_class_name);
     
     //Disable the hover timeout
     DISABLE_HOVER_TIMEOUT(group);
@@ -2458,19 +2454,13 @@ static gboolean xfce_taskbar_group_button_leave_event(GtkWidget *button_widget,
     {
         GList *attachlist = gtk_menu_get_for_attach_widget(button_widget);
         guint attachcount = g_list_length(attachlist);
-        panel_assert (attachcount <= 1 && "button widget should only ever have a single widget attached!");
         if(attachcount == 1)
         {
             //We;ve got a hover menu attached, trigger a timeout for destroying it
             GtkWidget *menu_widget = (GtkWidget *)(attachlist->data);
-            
             //We don't want to kill the hover menu immediately, so we wait a small time
             size_t timeout_id = (size_t)g_timeout_add(300, xfce_taskbar_hover_menu_timeout, menu_widget);
             g_object_set_data(G_OBJECT(menu_widget), "timeout_id", (void *)timeout_id);
-            
-            //We use the enter event to disable the pending timeout (if the user mouses over the hover menu)
-            g_signal_connect (GTK_WINDOW (GTK_MENU(menu_widget)->toplevel), "enter-notify-event", G_CALLBACK (hover_menu_enter), menu_widget);
-            g_signal_connect (GTK_WINDOW (GTK_MENU(menu_widget)->toplevel), "leave-notify-event", G_CALLBACK (hover_menu_leave), menu_widget);
         }
     }
     
@@ -2478,8 +2468,13 @@ static gboolean xfce_taskbar_group_button_leave_event(GtkWidget *button_widget,
 }
 
 //Triggered when the mouse enters the group button icon
-static gboolean xfce_taskbar_group_button_enter_event(GtkWidget *button, GdkEvent *event, XfceTaskBarGroup *group)
+static gboolean xfce_taskbar_group_button_enter_event(GtkWidget *button, GdkEvent *e, XfceTaskBarGroup *group)
 {
+    GdkEventCrossing *event = (GdkEventCrossing *)e ;
+    
+    if(event->time - group->taskbar->dragtimestamp < 20)
+        return TRUE ;
+    
     if(xfce_taskbar_group_visible_count(group, wnck_screen_get_active_workspace (group->taskbar->screen)) > 0)
     {
         group->hover_timeout = g_timeout_add(250, xfce_taskbar_group_button_hover_timeout, group);
@@ -2511,12 +2506,10 @@ static void xfce_taskbar_group_update_visibility(XfceTaskBarGroup *group)
     {
         if(group->pinned == FALSE)
         {
-            //printf("Hiding group %s\n", group->window_class_name);
             gtk_widget_hide(group->button);
         }
         else
         {
-            //printf("Setting group as flat button %s\n", group->window_class_name);
             gtk_button_set_relief (GTK_BUTTON (group->button), GTK_RELIEF_NONE);
             gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group->button), 0);
             gtk_widget_show(group->button);
@@ -2524,7 +2517,6 @@ static void xfce_taskbar_group_update_visibility(XfceTaskBarGroup *group)
     }
     else
     {
-        //printf("Setting group as active button %s\n", group->window_class_name);
         gtk_button_set_relief (GTK_BUTTON (group->button), GTK_RELIEF_NORMAL);
         gtk_widget_show(group->button);
     }


More information about the Xfce4-commits mailing list