[Xfce4-commits] <xfce4-panel:devel> * Split DBus code into a client and service part. * Stop using signals for DBus but add separate methodes. * Fix id / display_name switch in panel plugin creation. * Add tasklist plugin from trunk.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:22:04 CEST 2009
Updating branch refs/heads/devel
to cf347e250a175fcd8f21251420086447c37f817e (commit)
from 6266b69241cd867f8c048703c183e15aaab684ca (commit)
commit cf347e250a175fcd8f21251420086447c37f817e
Author: Nick Schermer <nick at xfce.org>
Date: Sun Jun 15 18:14:59 2008 +0200
* Split DBus code into a client and service part.
* Stop using signals for DBus but add separate methodes.
* Fix id / display_name switch in panel plugin creation.
* Add tasklist plugin from trunk.
AUTHORS | 4 +
configure.in.in | 14 +-
libxfce4panel/xfce-arrow-button.c | 8 +-
libxfce4panel/xfce-arrow-button.h | 3 +-
libxfce4panel/xfce-hvbox.h | 2 +-
libxfce4panel/xfce-panel-convenience.h | 2 +-
libxfce4panel/xfce-panel-macros.h | 6 +-
panel/Makefile.am | 14 +-
panel/main.c | 83 ++--
panel/panel-dbus-client.c | 194 ++++++++
.../panel-dbus-client.h | 23 +-
panel/panel-dbus-infos.xml | 103 -----
panel/panel-dbus-service-infos.xml | 65 +++
panel/{panel-dbus.c => panel-dbus-service.c} | 153 +++----
panel/{panel-dbus.h => panel-dbus-service.h} | 21 +-
panel/panel-glue.c | 114 +++---
panel/panel-module.c | 36 +-
panel/panel-window.c | 254 ++++++------
plugins/Makefile.am | 3 +-
plugins/clock/clock-dialog.c | 45 +-
plugins/clock/clock.c | 63 ++--
plugins/clock/clock.h | 12 +-
plugins/launcher/launcher-dialog.c | 7 +-
plugins/{tasklist => tasklist.new}/Makefile.am | 0
plugins/{tasklist => tasklist.new}/tasklist-box.c | 0
plugins/{tasklist => tasklist.new}/tasklist-box.h | 0
.../{tasklist => tasklist.new}/tasklist-plugin.c | 0
.../{tasklist => tasklist.new}/tasklist-plugin.h | 0
.../tasklist.desktop.in.in | 0
plugins/tasklist/.svn/all-wcprops | 41 ++
plugins/{clock => tasklist}/.svn/dir-prop-base | 0
plugins/tasklist/.svn/entries | 105 +++++
plugins/{clock => tasklist}/.svn/format | 0
.../.svn/prop-base/Makefile.am.svn-base | 0
.../.svn/prop-base/tasklist-dialogs.c.svn-base} | 0
.../.svn/prop-base/tasklist-dialogs.h.svn-base} | 0
.../.svn/prop-base/tasklist.c.svn-base} | 0
.../.svn/prop-base/tasklist.h.svn-base} | 0
.../text-base/Makefile.am.svn-base} | 18 +-
.../.svn/text-base/tasklist-dialogs.c.svn-base | 232 ++++++++++
.../.svn/text-base/tasklist-dialogs.h.svn-base} | 17 +-
.../tasklist/.svn/text-base/tasklist.c.svn-base | 477 ++++++++++++++++++++
.../text-base/tasklist.desktop.in.in.svn-base} | 6 +-
.../tasklist/.svn/text-base/tasklist.h.svn-base | 63 +++
plugins/tasklist/Makefile.am | 16 +-
plugins/tasklist/tasklist-dialogs.c | 232 ++++++++++
plugins/tasklist/tasklist-dialogs.h | 25 +
plugins/tasklist/tasklist.c | 473 +++++++++++++++++++
plugins/tasklist/tasklist.desktop.in.in | 6 +-
plugins/tasklist/tasklist.h | 64 +++
wrapper/main.c | 24 +-
51 files changed, 2438 insertions(+), 590 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index e69de29..8616d83 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -0,0 +1,4 @@
+Maintainers
+===========
+Jasper Huijsmans <jasper at xfce.org>
+Nick Schermer <nick at xfce.org>
diff --git a/configure.in.in b/configure.in.in
index 68eef2d..6b3dcbb 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -108,6 +108,7 @@ XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.5.0])
XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.1.11])
XDT_CHECK_PACKAGE([DBUS], [dbus-glib-1], [0.34])
XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.0.0])
+XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [2.12])
dnl ***********************************
dnl *** Check for optional packages ***
@@ -122,11 +123,13 @@ dnl *** Check for gtk-doc ***
dnl *************************
GTK_DOC_CHECK([1.0])
-dnl *************************************
-dnl *** Disable deprecated components ***
-dnl *************************************
-AC_DEFINE([XFCE_DISABLE_DEPRECATED], [1], [Define to 1 to disable deprecated Xfce components])
-AC_DEFINE([G_DISABLE_DEPRECATED], [1], [Define to 1 to disable deprecated Glib components])
+dnl *********************************************************
+dnl *** Disable deprecated components and single includes ***
+dnl *********************************************************
+PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DXFCE_DISABLE_DEPRECATED -DPANGO_DISABLE_SINGLE_INCLUDES"
+PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES"
+PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
+PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES"
dnl ***********************************
dnl *** Check for debugging support ***
@@ -236,5 +239,6 @@ plugins/Makefile
plugins/clock/Makefile
plugins/launcher/Makefile
plugins/systray/Makefile
+plugins/tasklist/Makefile
po/Makefile.in
])
diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index 0eaadb4..27457b4 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -151,7 +151,7 @@ xfce_arrow_button_set_property (GObject *object,
case PROP_ARROW_TYPE:
xfce_arrow_button_set_arrow_type (button, g_value_get_enum (value));
break;
-
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -173,7 +173,7 @@ xfce_arrow_button_get_property (GObject *object,
case PROP_ARROW_TYPE:
g_value_set_enum (value, xfce_arrow_button_get_arrow_type (button));
break;
-
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -216,7 +216,7 @@ xfce_arrow_button_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
gint size;
-
+
/* calculate the requested arrow size */
size = ARROW_WIDTH + ARROW_PADDING + 2 * MAX (widget->style->xthickness, widget->style->ythickness);
@@ -237,7 +237,7 @@ xfce_arrow_button_add (GtkContainer *container,
static GType
xfce_arrow_button_child_type (GtkContainer *container)
{
- return GTK_TYPE_NONE;
+ return GTK_TYPE_WIDGET;
}
diff --git a/libxfce4panel/xfce-arrow-button.h b/libxfce4panel/xfce-arrow-button.h
index e1d9c16..2385126 100644
--- a/libxfce4panel/xfce-arrow-button.h
+++ b/libxfce4panel/xfce-arrow-button.h
@@ -23,8 +23,7 @@
#ifndef __XFCE_ARROW_BUTTON_H__
#define __XFCE_ARROW_BUTTON_H__
-#include <gtk/gtkenums.h>
-#include <gtk/gtktogglebutton.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
diff --git a/libxfce4panel/xfce-hvbox.h b/libxfce4panel/xfce-hvbox.h
index 47d7c96..0b8987a 100644
--- a/libxfce4panel/xfce-hvbox.h
+++ b/libxfce4panel/xfce-hvbox.h
@@ -27,7 +27,7 @@
#ifndef __XFCE_HVBOX_H__
#define __XFCE_HVBOX_H__
-#include <gtk/gtkbox.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
diff --git a/libxfce4panel/xfce-panel-convenience.h b/libxfce4panel/xfce-panel-convenience.h
index 879be1c..8a9440b 100644
--- a/libxfce4panel/xfce-panel-convenience.h
+++ b/libxfce4panel/xfce-panel-convenience.h
@@ -25,7 +25,7 @@
#ifndef __XFCE_PANEL_CONVENIENCE_H__
#define __XFCE_PANEL_CONVENIENCE_H__
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
diff --git a/libxfce4panel/xfce-panel-macros.h b/libxfce4panel/xfce-panel-macros.h
index 2fb4204..5d28807 100644
--- a/libxfce4panel/xfce-panel-macros.h
+++ b/libxfce4panel/xfce-panel-macros.h
@@ -65,12 +65,12 @@ G_BEGIN_DECLS
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL XFCE_PANEL_PLUGIN_REGISTER
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
-/* parameter flags */
+/* parameter flags */
#define PANEL_PARAM_READABLE G_PARAM_READABLE | PANEL_PARAM_STATIC_STRINGS
#define PANEL_PARAM_READWRITE G_PARAM_READWRITE | PANEL_PARAM_STATIC_STRINGS
#define PANEL_PARAM_WRITABLE G_PARAM_WRITABLE | PANEL_PARAM_STATIC_STRINGS
-/* slice allocator */
+/* slice allocator (deprecated) */
#define panel_slice_alloc(block_size) (g_slice_alloc ((block_size)))
#define panel_slice_alloc0(block_size) (g_slice_alloc0 ((block_size)))
#define panel_slice_free1(block_size, mem_block) G_STMT_START{ g_slice_free1 ((block_size), (mem_block)); }G_STMT_END
@@ -78,7 +78,7 @@ G_BEGIN_DECLS
#define panel_slice_new0(type) (g_slice_new0 (type))
#define panel_slice_free(type, ptr) G_STMT_START{ g_slice_free (type, (ptr)); }G_STMT_END
-/* debug macros */
+/* debug macros (deprecated) */
#define _panel_assert(expr) panel_assert (expr)
#define _panel_assert_not_reached() panel_assert_not_reached ()
#define _panel_return_if_fail(expr) panel_return_if_fail (expr)
diff --git a/panel/Makefile.am b/panel/Makefile.am
index 014dbe3..10e18e2 100644
--- a/panel/Makefile.am
+++ b/panel/Makefile.am
@@ -16,15 +16,17 @@ bin_PROGRAMS = \
xfce4-panel
xfce4_panel_built_sources = \
- panel-dbus-infos.h
+ panel-dbus-service-infos.h
xfce4_panel_SOURCES = \
$(xfce4_panel_built_sources) \
main.c \
panel-application.c \
panel-application.h \
- panel-dbus.c \
- panel-dbus.h \
+ panel-dbus-client.c \
+ panel-dbus-client.h \
+ panel-dbus-service.c \
+ panel-dbus-service.h \
panel-dialogs.c \
panel-dialogs.h \
panel-glue.c \
@@ -80,11 +82,11 @@ DISTCLEANFILES = \
BUILT_SOURCES = \
$(xfce4_panel_built_sources)
-panel-dbus-infos.h: $(srcdir)/panel-dbus-infos.xml Makefile
- dbus-binding-tool --prefix=panel_dbus_service --mode=glib-server $(srcdir)/panel-dbus-infos.xml > panel-dbus-infos.h
+panel-dbus-service-infos.h: $(srcdir)/panel-dbus-service-infos.xml Makefile
+ dbus-binding-tool --prefix=panel_dbus_service --mode=glib-server $(srcdir)/panel-dbus-service-infos.xml > panel-dbus-service-infos.h
endif
EXTRA_DIST = \
- panel-dbus-infos.h
+ panel-dbus-service-infos.xml
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/panel/main.c b/panel/main.c
index 32de449..86617a4 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -31,7 +31,9 @@
#include <panel/panel-private.h>
#include <panel/panel-application.h>
-#include <panel/panel-dbus.h>
+#include <panel/panel-dbus-service.h>
+#include <panel/panel-dbus-client.h>
+
static gboolean opt_customize = FALSE;
@@ -59,32 +61,6 @@ static const GOptionEntry option_entries[] =
-static gint
-send_signal (guint signal_id)
-{
- GError *error = NULL;
-
- if (panel_dbus_client_send_signal (signal_id, &error))
- {
- /* stop any running startup notification */
- gdk_notify_startup_complete ();
-
- return EXIT_SUCCESS;
- }
- else
- {
- /* print warning */
- g_critical ("Failed to send D-BUS message: %s", error ? error->message : "");
-
- /* cleanup */
- g_error_free (error);
-
- return EXIT_FAILURE;
- }
-}
-
-
-
gint
main (gint argc, gchar **argv)
{
@@ -92,6 +68,7 @@ main (gint argc, gchar **argv)
GError *error = NULL;
GObject *dbus_service;
extern gboolean dbus_quit_with_restart;
+ gboolean result;
/* set translation domain */
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -138,15 +115,33 @@ main (gint argc, gchar **argv)
return EXIT_SUCCESS;
}
else if (opt_customize)
- return send_signal (SIGNAL_CUSTOMIZE);
+ {
+ /* send a signal to the running instance to show the preferences dialog */
+ result = panel_dbus_client_display_preferences_dialog (NULL, &error);
+
+ goto dbus_return;
+ }
else if (opt_add)
- return send_signal (SIGNAL_ADD);
+ {
+ /* send a signal to the running instance to show the add items dialog */
+ result = panel_dbus_client_display_items_dialog (NULL, &error);
+
+ goto dbus_return;
+ }
else if (opt_save)
- return send_signal (SIGNAL_SAVE);
- else if (G_UNLIKELY (opt_restart))
- return send_signal (SIGNAL_RESTART);
- else if (G_UNLIKELY (opt_quit))
- return send_signal (SIGNAL_QUIT);
+ {
+ /* send a save signal to the running instance */
+ result = panel_dbus_client_save (&error);
+
+ goto dbus_return;
+ }
+ else if (opt_restart || opt_quit)
+ {
+ /* send a terminate signal to the running instance */
+ result = panel_dbus_client_terminate (opt_restart, &error);
+
+ goto dbus_return;
+ }
/* create a new application */
application = panel_application_get ();
@@ -162,7 +157,7 @@ main (gint argc, gchar **argv)
/* destroy all the opened dialogs */
panel_application_destroy_dialogs (application);
-
+
/* save the configuration */
panel_application_save (application);
@@ -174,10 +169,26 @@ main (gint argc, gchar **argv)
{
/* message */
g_message (_("Restarting..."));
-
+
/* spawn ourselfs again */
g_spawn_command_line_async (argv[0], NULL);
}
return EXIT_SUCCESS;
+
+ dbus_return:
+
+ /* stop any running startup notification */
+ gdk_notify_startup_complete ();
+
+ if (G_UNLIKELY (error != NULL))
+ {
+ /* print warning */
+ g_critical ("Failed to send D-BUS message: %s", error ? error->message : "No error message");
+
+ /* cleanup */
+ g_error_free (error);
+ }
+
+ return result ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/panel/panel-dbus-client.c b/panel/panel-dbus-client.c
new file mode 100644
index 0000000..132fc9a
--- /dev/null
+++ b/panel/panel-dbus-client.c
@@ -0,0 +1,194 @@
+/* $Id$ */
+/*
+ * This program 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 program 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 General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4panel/libxfce4panel.h>
+
+#include <panel/panel-private.h>
+#include <panel/panel-dbus-client.h>
+#include <panel/panel-dbus-service.h>
+
+
+
+static gboolean
+panel_dbus_client_send_message (DBusMessage *message,
+ GError **error)
+{
+ DBusConnection *connection;
+ DBusMessage *result;
+ DBusError derror;
+
+ dbus_error_init (&derror);
+
+ /* try to connect to the session bus */
+ connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
+ if (G_UNLIKELY (connection == NULL))
+ {
+ dbus_set_g_error (error, &derror);
+ dbus_error_free (&derror);
+ return FALSE;
+ }
+
+ /* send the message */
+ result = dbus_connection_send_with_reply_and_block (connection, message, -1, &derror);
+
+ /* check if no reply was received */
+ if (result == NULL)
+ {
+ /* handle error */
+ if (dbus_error_has_name (&derror, DBUS_ERROR_NAME_HAS_NO_OWNER))
+ g_message (_("No running panel instance found."));
+ else
+ dbus_set_g_error (error, &derror);
+
+ dbus_error_free (&derror);
+ return FALSE;
+ }
+
+ /* but maybe we received an error */
+ if (G_UNLIKELY (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR))
+ {
+ dbus_set_error_from_message (&derror, result);
+ dbus_set_g_error (error, &derror);
+ dbus_message_unref (result);
+ dbus_error_free (&derror);
+
+ return FALSE;
+ }
+
+ /* it seems everything worked */
+ dbus_message_unref (result);
+
+ return TRUE;
+}
+
+
+
+static gboolean
+panel_dbus_client_display_dialog (GdkScreen *screen,
+ const gchar *methode_name,
+ GError **error)
+{
+ gchar *display_name;
+ DBusMessage *message;
+ gboolean result;
+
+ /* fallback to default screen if no other is specified */
+ if (G_LIKELY (screen == NULL))
+ screen = gdk_screen_get_default ();
+
+ /* determine the display name for the screen */
+ display_name = gdk_screen_make_display_name (screen);
+
+ /* generate the message */
+ message = dbus_message_new_method_call (PANEL_DBUS_SERVICE_INTERFACE, PANEL_DBUS_SERVICE_PATH,
+ PANEL_DBUS_SERVICE_INTERFACE, methode_name);
+ dbus_message_set_auto_start (message, FALSE);
+ dbus_message_append_args (message, DBUS_TYPE_STRING, &display_name, DBUS_TYPE_INVALID);
+
+ /* send the message */
+ result = panel_dbus_client_send_message (message, error);
+
+ /* release the message */
+ dbus_message_unref (message);
+
+ /* cleanup */
+ g_free (display_name);
+
+ return result;
+}
+
+
+
+gboolean
+panel_dbus_client_display_preferences_dialog (GdkScreen *screen,
+ GError **error)
+{
+ panel_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), FALSE);
+ panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ return panel_dbus_client_display_dialog (screen, "DisplayPreferencesDialog", error);
+}
+
+
+
+gboolean
+panel_dbus_client_display_items_dialog (GdkScreen *screen,
+ GError **error)
+{
+ panel_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), FALSE);
+ panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ return panel_dbus_client_display_dialog (screen, "DisplayItemsDialog", error);
+}
+
+
+
+gboolean
+panel_dbus_client_save (GError **error)
+{
+ DBusMessage *message;
+ gboolean result;
+
+ panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* generate the message */
+ message = dbus_message_new_method_call (PANEL_DBUS_SERVICE_INTERFACE, PANEL_DBUS_SERVICE_PATH,
+ PANEL_DBUS_SERVICE_INTERFACE, "Save");
+ dbus_message_set_auto_start (message, FALSE);
+
+ /* send the message */
+ result = panel_dbus_client_send_message (message, error);
+
+ /* release the message */
+ dbus_message_unref (message);
+
+ return result;
+}
+
+
+
+gboolean
+panel_dbus_client_terminate (gboolean restart,
+ GError **error)
+{
+ DBusMessage *message;
+ gboolean result;
+
+ panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* generate the message */
+ message = dbus_message_new_method_call (PANEL_DBUS_SERVICE_INTERFACE, PANEL_DBUS_SERVICE_PATH,
+ PANEL_DBUS_SERVICE_INTERFACE, "Terminate");
+ dbus_message_set_auto_start (message, FALSE);
+ dbus_message_append_args (message, DBUS_TYPE_BOOLEAN, &restart, DBUS_TYPE_INVALID);
+
+ /* send the message */
+ result = panel_dbus_client_send_message (message, error);
+
+ /* release the message */
+ dbus_message_unref (message);
+
+ return result;
+}
diff --git a/plugins/clock/.svn/text-base/clock-dialog.h.svn-base b/panel/panel-dbus-client.h
similarity index 52%
copy from plugins/clock/.svn/text-base/clock-dialog.h.svn-base
copy to panel/panel-dbus-client.h
index 7545070..a949ba7 100644
--- a/plugins/clock/.svn/text-base/clock-dialog.h.svn-base
+++ b/panel/panel-dbus-client.h
@@ -1,7 +1,5 @@
/* $Id$ */
/*
- * Copyright (c) 2007 Nick Schermer <nick at xfce.org>
- *
* This program 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)
@@ -17,15 +15,24 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __CLOCK_DIALOG_H__
-#define __CLOCK_DIALOG_H__
+#ifndef __PANEL_DBUS_CLIENT_H__
+#define __PANEL_DBUS_CLIENT_H__
+
+#include <glib.h>
+#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+gboolean panel_dbus_client_display_preferences_dialog (GdkScreen *screen,
+ GError **error);
-G_BEGIN_DECLS
+gboolean panel_dbus_client_display_items_dialog (GdkScreen *screen,
+ GError **error);
-void xfce_clock_dialog_show (ClockPlugin *clock) G_GNUC_INTERNAL;
+gboolean panel_dbus_client_save (GError **error);
+
+gboolean panel_dbus_client_terminate (gboolean restart,
+ GError **error);
G_END_DECLS
-#endif /* !__CLOCK_DIALOG_H__ */
+#endif /* !__PANEL_DBUS_CLIENT_H__ */
+
diff --git a/panel/panel-dbus-infos.xml b/panel/panel-dbus-infos.xml
deleted file mode 100644
index 68e8887..0000000
--- a/panel/panel-dbus-infos.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- $Id$
-
- This program 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 program 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 General Public License along with
- this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307 USA
--->
-
-<node name="/org/xfce/Panel">
-
- <interface name="org.xfce.Panel">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="panel_dbus_service" />
-
- <!--
- CustomizePanel (display : STRING) : VOID
-
- display : The display on which to show the dialog or ""
- to use the default screen of the panel.
- -->
- <method name="CustomizePanel">
- <arg direction="in" name="display" type="s" />
- </method>
-
- <!--
- AddItems (display : STRING) : VOID
-
- display : The display on which to show the dialog or ""
- to use the default screen of the panel.
- -->
- <method name="AddItems" />
- <arg direction="in" name="display" type="s" />
- </method>
-
- <!--
- Save () : VOID
-
- Tells the panel to save its configuration, including all the plugins.
- -->
- <method name="Save" />
-
- <!--
- Terminate (restart : BOOLEAN) : VOID
-
- restart : Whether the panel should restart after termination.
- -->
- <method name="Terminate">
- <arg direction="in" name="restart" type="b" />
- </method>
- </interface>
-
- <interface name="org.xfce.Panel.Plugin">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="panel_dbus_service" />
-
- <!--
- RegisterPlugin (id : INT) : VOID
-
- id : The window id of the GtkPlug. This is used to
- embed the window in a GtkSocket.
- -->
- <method name="RegisterPlugin">
- <arg direction="in" name="id" type="i" />
- </method>
-
- <!--
- PropertyChanged (size : INT, screen-position : UINT, orientation : UINT, sensitive : BOOLEAN, expand : BOOLEAN) : VOID
-
- size : The size of the plugin.
- screen-position : The screen-position of the panel on which the
- plugin is embedded.
- orientation : The orientation of the panel on which the
- plugin is embedded.
- sensitive : Whether the plugin should be sensitive. A plugin
- is insensitive during panel editing.
- expand : Whether the plugin expands on the panel.
- -->
- <signal name="PropertyChanged">
- <arg direction="in" name="size" type="i" />
- <arg direction="in" name="screen-position" type="u" />
- <arg direction="in" name="orientation" type="u" />
- <arg direction="in" name="sensitive" type="b" />
- <arg direction="in" name="expand" type="b" />
- </signal>
-
- <!--
- Save () : VOID
-
- Tells the plugin to save its configuration.
- -->
- <method name="Save" />
- </interface>
-</node>
diff --git a/panel/panel-dbus-service-infos.xml b/panel/panel-dbus-service-infos.xml
new file mode 100644
index 0000000..d38acf8
--- /dev/null
+++ b/panel/panel-dbus-service-infos.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ $Id$
+
+ This program 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 program 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 General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place, Suite 330, Boston, MA 02111-1307 USA
+-->
+
+<node name="/org/xfce/Panel">
+
+ <interface name="org.xfce.Panel">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="panel_dbus_service" />
+
+ <!--
+ DisplayPreferencesDialog (display : STRING) : VOID
+
+ display : The display on which to show the dialog or ""
+ to use the default screen of the panel.
+ -->
+ <method name="DisplayPreferencesDialog">
+ <arg name="display" direction="in" type="s" />
+ </method>
+
+ <!--
+ DisplayItemsDialog (display : STRING) : VOID
+
+ display : The display on which to show the dialog or ""
+ to use the default screen of the panel.
+ -->
+ <method name="DisplayItemsDialog">
+ <arg name="display" direction="in" type="s" />
+ </method>
+
+ <!--
+ Save () : VOID
+
+ Tells the panel to save its configuration, including all the plugins.
+ -->
+ <method name="Save">
+ </method>
+
+ <!--
+ Terminate (restart : BOOLEAN) : VOID
+
+ restart : Whether the panel should restart after termination.
+ -->
+ <method name="Terminate">
+ <arg name="restart" direction="in" type="b" />
+ </method>
+
+ </interface>
+
+</node>
diff --git a/panel/panel-dbus.c b/panel/panel-dbus-service.c
similarity index 52%
rename from panel/panel-dbus.c
rename to panel/panel-dbus-service.c
index 471d98e..e42df9b 100644
--- a/panel/panel-dbus.c
+++ b/panel/panel-dbus-service.c
@@ -26,24 +26,18 @@
#include <libxfce4panel/libxfce4panel.h>
#include <panel/panel-private.h>
-#include <panel/panel-dbus.h>
+#include <panel/panel-dbus-service.h>
#include <panel/panel-application.h>
#include <panel/panel-preferences-dialog.h>
#include <panel/panel-item-dialog.h>
-#define PANEL_DBUS_PATH "/org/xfce/Panel"
-#define PANEL_DBUS_INTERFACE "org.xfce.Panel"
-
-
-
static void panel_dbus_service_class_init (PanelDBusServiceClass *klass);
static void panel_dbus_service_init (PanelDBusService *service);
static void panel_dbus_service_finalize (GObject *object);
-static gboolean panel_dbus_service_signal (PanelDBusService *service,
- guint32 signal_id,
- GError **error);
+
+
struct _PanelDBusServiceClass
{
@@ -95,11 +89,11 @@ panel_dbus_service_init (PanelDBusService *service)
if (G_LIKELY (service->connection != NULL))
{
/* register the /org/xfce/Panel object */
- dbus_g_connection_register_g_object (service->connection, PANEL_DBUS_PATH, G_OBJECT (service));
+ dbus_g_connection_register_g_object (service->connection, PANEL_DBUS_SERVICE_PATH, G_OBJECT (service));
/* request the org.xfce.Mousepad name for Mousepad */
dbus_bus_request_name (dbus_g_connection_get_connection (service->connection),
- PANEL_DBUS_INTERFACE, DBUS_NAME_FLAG_REPLACE_EXISTING, NULL);
+ PANEL_DBUS_SERVICE_INTERFACE, DBUS_NAME_FLAG_REPLACE_EXISTING, NULL);
}
else
{
@@ -128,132 +122,91 @@ panel_dbus_service_finalize (GObject *object)
static gboolean
-panel_dbus_service_signal (PanelDBusService *service,
- guint32 signal_id,
- GError **error)
+panel_dbus_service_display_preferences_dialog (PanelDBusService *service,
+ const gchar *display,
+ GError **error)
{
- PanelApplication *application;
-
panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- if (signal_id == SIGNAL_CUSTOMIZE)
- {
- /* show the prefernces dialog */
- panel_preferences_dialog_show (NULL);
- }
- else if (signal_id == SIGNAL_ADD)
- {
- /* show the items dialog */
- panel_item_dialog_show ();
- }
- else if (signal_id == SIGNAL_SAVE)
- {
- /* save the configuration */
- application = panel_application_get ();
- panel_application_save (application);
- g_object_unref (G_OBJECT (application));
- }
- else if (signal_id == SIGNAL_RESTART || signal_id == SIGNAL_QUIT)
- {
- /* set restart boolean */
- dbus_quit_with_restart = !!(signal_id == SIGNAL_RESTART);
+ g_message ("Show preferences dialog on display %s", display);
- /* quit */
- gtk_main_quit ();
- }
+ /* show the prefernces dialog */
+ panel_preferences_dialog_show (NULL);
return TRUE;
}
-GObject *
-panel_dbus_service_new (void)
+static gboolean
+panel_dbus_service_display_items_dialog (PanelDBusService *service,
+ const gchar *display,
+ GError **error)
{
- return g_object_new (PANEL_TYPE_DBUS_SERVICE, NULL);
+ panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
+ panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ g_message ("Show items dialog on display %s", display);
+
+ /* show the items dialog */
+ panel_item_dialog_show ();
+
+ return TRUE;
}
static gboolean
-panel_dbus_client_send (DBusMessage *message,
- GError **error)
+panel_dbus_service_save (PanelDBusService *service,
+ GError **error)
{
- DBusConnection *connection;
- DBusMessage *result;
- DBusError derror;
-
- dbus_error_init (&derror);
-
- /* try to connect to the session bus */
- connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
- if (G_UNLIKELY (connection == NULL))
- {
- dbus_set_g_error (error, &derror);
- dbus_error_free (&derror);
- return FALSE;
- }
+ PanelApplication *application;
- /* send the message */
- result = dbus_connection_send_with_reply_and_block (connection, message, -1, &derror);
+ panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
+ panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- /* check if no reply was received */
- if (result == NULL)
- {
- /* handle error */
- if (dbus_error_has_name (&derror, DBUS_ERROR_NAME_HAS_NO_OWNER))
- g_message (_("No running panel instance found."));
- else
- dbus_set_g_error (error, &derror);
-
- dbus_error_free (&derror);
- return FALSE;
- }
+ /* get the current application */
+ application = panel_application_get ();
- /* but maybe we received an error */
- if (G_UNLIKELY (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR))
- {
- dbus_set_error_from_message (&derror, result);
- dbus_set_g_error (error, &derror);
- dbus_message_unref (result);
- dbus_error_free (&derror);
- return FALSE;
- }
+ /* save the configuration */
+ panel_application_save (application);
- /* it seems everything worked */
- dbus_message_unref (result);
+ /* release the application */
+ g_object_unref (G_OBJECT (application));
return TRUE;
}
-gboolean
-panel_dbus_client_send_signal (guint32 signal_id,
- GError **error)
+static gboolean
+panel_dbus_service_terminate (PanelDBusService *service,
+ gboolean restart,
+ GError **error)
{
- DBusMessage *message;
-
+ panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
panel_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- /* generate the message */
- message = dbus_message_new_method_call (PANEL_DBUS_INTERFACE, PANEL_DBUS_PATH, PANEL_DBUS_INTERFACE, "Signal");
- dbus_message_set_auto_start (message, FALSE);
- dbus_message_append_args (message, DBUS_TYPE_UINT32, &signal_id, DBUS_TYPE_INVALID);
+ /* set restart boolean */
+ dbus_quit_with_restart = restart;
+
+ /* quit */
+ gtk_main_quit ();
+
+ return TRUE;
+}
- /* send the message */
- panel_dbus_client_send (message, error);
- /* unref the message */
- dbus_message_unref (message);
- /* we return false if an error was set */
- return (error != NULL);
+GObject *
+panel_dbus_service_new (void)
+{
+ return g_object_new (PANEL_TYPE_DBUS_SERVICE, NULL);
}
/* include the dbus glue generated by dbus-binding-tool */
-#include <panel/panel-dbus-infos.h>
+#include <panel/panel-dbus-service-infos.h>
diff --git a/panel/panel-dbus.h b/panel/panel-dbus-service.h
similarity index 83%
rename from panel/panel-dbus.h
rename to panel/panel-dbus-service.h
index 416f9a7..8e8f25c 100644
--- a/panel/panel-dbus.h
+++ b/panel/panel-dbus-service.h
@@ -15,22 +15,16 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef __PANEL_DBUS_H__
-#define __PANEL_DBUS_H__
+#ifndef __PANEL_DBUS_SERVICE_H__
+#define __PANEL_DBUS_SERVICE_H__
-#include <gtk/gtk.h>
+#include <glib.h>
typedef struct _PanelDBusServiceClass PanelDBusServiceClass;
typedef struct _PanelDBusService PanelDBusService;
-enum
-{
- SIGNAL_CUSTOMIZE,
- SIGNAL_ADD,
- SIGNAL_SAVE,
- SIGNAL_RESTART,
- SIGNAL_QUIT
-};
+#define PANEL_DBUS_SERVICE_PATH "/org/xfce/Panel"
+#define PANEL_DBUS_SERVICE_INTERFACE "org.xfce.Panel"
#define PANEL_TYPE_DBUS_SERVICE (panel_dbus_service_get_type ())
#define PANEL_DBUS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANEL_TYPE_DBUS_SERVICE, PanelDBusService))
@@ -43,10 +37,7 @@ GType panel_dbus_service_get_type (void) G_GNUC_CONST;
GObject *panel_dbus_service_new (void);
-gboolean panel_dbus_client_send_signal (guint32 signal_id,
- GError **error);
-
G_END_DECLS
-#endif /* !__PANEL_DBUS_H__ */
+#endif /* !__PANEL_DBUS_SERVICE_H__ */
diff --git a/panel/panel-glue.c b/panel/panel-glue.c
index 661b852..935c0b4 100644
--- a/panel/panel-glue.c
+++ b/panel/panel-glue.c
@@ -33,7 +33,7 @@
#include <panel/panel-item-dialog.h>
#include <panel/panel-preferences-dialog.h>
#include <panel/panel-dialogs.h>
-#include <panel/panel-dbus.h>
+#include <panel/panel-dbus-service.h>
@@ -41,10 +41,10 @@ static void
panel_glue_popup_menu_quit (gpointer boolean)
{
extern gboolean dbus_quit_with_restart;
-
+
/* restart or quit */
dbus_quit_with_restart = !!(GPOINTER_TO_UINT (boolean));
-
+
/* quit main loop */
gtk_main_quit ();
}
@@ -57,10 +57,10 @@ panel_glue_popup_menu_deactivate (GtkMenu *menu,
{
panel_return_if_fail (GTK_IS_MENU (menu));
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* thaw autohide block */
panel_window_thaw_autohide (window);
-
+
/* destroy the menu */
g_object_unref (G_OBJECT (menu));
}
@@ -73,84 +73,84 @@ panel_glue_popup_menu (PanelWindow *window)
GtkWidget *menu;
GtkWidget *item;
GtkWidget *image;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* freeze autohide */
panel_window_freeze_autohide (window);
-
+
/* create menu */
menu = gtk_menu_new ();
-
+
/* sink the menu and add unref on deactivate */
g_object_ref_sink (G_OBJECT (menu));
g_signal_connect (G_OBJECT (menu), "deactivate", G_CALLBACK (panel_glue_popup_menu_deactivate), window);
-
+
/* label */
item = gtk_image_menu_item_new_with_label (_("Xfce Panel"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_set_sensitive (item, FALSE);
gtk_widget_show (item);
-
+
/* separator */
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
/* add new items */
item = gtk_image_menu_item_new_with_mnemonic (_("Add _New Items"));
g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (panel_item_dialog_show), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (image);
-
+
/* customize panel */
item = gtk_image_menu_item_new_with_mnemonic (_("_Customize Panels"));
g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (panel_preferences_dialog_show), window);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
image = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (image);
-
+
/* separator */
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
/* quit item */
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);
g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (panel_glue_popup_menu_quit), GUINT_TO_POINTER (0));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
/* restart item */
item = gtk_image_menu_item_new_with_mnemonic (_("_Restart"));
g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (panel_glue_popup_menu_quit), GUINT_TO_POINTER (1));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
image = gtk_image_new_from_stock (GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (image);
-
+
/* separator */
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
/* about item */
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (panel_dialogs_show_about), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
-
+
/* popup the menu */
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
0, gtk_get_current_event_time ());
}
@@ -160,56 +160,56 @@ XfceScreenPosition
panel_glue_get_screen_position (PanelWindow *window)
{
gboolean horizontal;
-
+
panel_return_val_if_fail (PANEL_IS_WINDOW (window), XFCE_SCREEN_POSITION_NONE);
-
+
/* whether the panel is horizontal */
horizontal = !!(panel_window_get_orientation (window) == GTK_ORIENTATION_HORIZONTAL);
-
+
/* return the screen position */
switch (panel_window_get_snap_edge (window))
{
case PANEL_SNAP_EGDE_NONE:
- return horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
+ return horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_FLOATING_V;
-
+
case PANEL_SNAP_EGDE_NW:
- return horizontal ? XFCE_SCREEN_POSITION_NW_H :
+ return horizontal ? XFCE_SCREEN_POSITION_NW_H :
XFCE_SCREEN_POSITION_NW_V;
-
+
case PANEL_SNAP_EGDE_NE:
- return horizontal ? XFCE_SCREEN_POSITION_NE_H :
+ return horizontal ? XFCE_SCREEN_POSITION_NE_H :
XFCE_SCREEN_POSITION_NE_V;
-
+
case PANEL_SNAP_EGDE_SW:
- return horizontal ? XFCE_SCREEN_POSITION_SW_H :
+ return horizontal ? XFCE_SCREEN_POSITION_SW_H :
XFCE_SCREEN_POSITION_SW_V;
case PANEL_SNAP_EGDE_SE:
- return horizontal ? XFCE_SCREEN_POSITION_SE_H :
+ return horizontal ? XFCE_SCREEN_POSITION_SE_H :
XFCE_SCREEN_POSITION_SE_V;
-
+
case PANEL_SNAP_EGDE_W:
case PANEL_SNAP_EGDE_WC:
return horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_W;
-
+
case PANEL_SNAP_EGDE_E:
case PANEL_SNAP_EGDE_EC:
- return horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
+ return horizontal ? XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_E;
-
+
case PANEL_SNAP_EGDE_S:
case PANEL_SNAP_EGDE_SC:
- return horizontal ? XFCE_SCREEN_POSITION_S :
+ return horizontal ? XFCE_SCREEN_POSITION_S :
XFCE_SCREEN_POSITION_FLOATING_V;
-
+
case PANEL_SNAP_EGDE_N:
case PANEL_SNAP_EGDE_NC:
- return horizontal ? XFCE_SCREEN_POSITION_N :
+ return horizontal ? XFCE_SCREEN_POSITION_N :
XFCE_SCREEN_POSITION_FLOATING_V;
}
-
+
return XFCE_SCREEN_POSITION_NONE;
}
@@ -220,7 +220,7 @@ panel_glue_set_orientation_foreach (GtkWidget *widget,
gpointer user_data)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
-
+
/* set the new plugin orientation */
xfce_panel_plugin_provider_set_orientation (XFCE_PANEL_PLUGIN_PROVIDER (widget),
GPOINTER_TO_INT (user_data));
@@ -233,7 +233,7 @@ panel_glue_set_size_foreach (GtkWidget *widget,
gpointer user_data)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
-
+
/* set the new plugin size */
xfce_panel_plugin_provider_set_size (XFCE_PANEL_PLUGIN_PROVIDER (widget),
GPOINTER_TO_INT (user_data));
@@ -246,7 +246,7 @@ panel_glue_set_screen_position_foreach (GtkWidget *widget,
gpointer user_data)
{
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN_PROVIDER (widget));
-
+
/* set the new plugin screen position */
xfce_panel_plugin_provider_set_screen_position (XFCE_PANEL_PLUGIN_PROVIDER (widget),
GPOINTER_TO_INT (user_data));
@@ -259,18 +259,18 @@ panel_glue_set_orientation (PanelWindow *window,
GtkOrientation orienation)
{
GtkWidget *itembar;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* set the size of the window */
panel_window_set_orientation (window, orienation);
-
+
/* get the itembar */
itembar = gtk_bin_get_child (GTK_BIN (window));
-
+
/* send the new orientation to all plugins */
gtk_container_foreach (GTK_CONTAINER (itembar), panel_glue_set_orientation_foreach, GINT_TO_POINTER (orienation));
-
+
/* screen position also changed */
panel_glue_set_screen_position (window);
}
@@ -282,34 +282,34 @@ panel_glue_set_size (PanelWindow *window,
gint size)
{
GtkWidget *itembar;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
/* set the size of the window */
panel_window_set_size (window, size);
-
+
/* get the itembar */
itembar = gtk_bin_get_child (GTK_BIN (window));
-
+
/* send the new size to all plugins */
gtk_container_foreach (GTK_CONTAINER (itembar), panel_glue_set_size_foreach, GINT_TO_POINTER (size));
}
-void
+void
panel_glue_set_screen_position (PanelWindow *window)
{
XfceScreenPosition screen_position;
GtkWidget *itembar;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* get the screen position */
screen_position = panel_glue_get_screen_position (window);
/* get the itembar */
itembar = gtk_bin_get_child (GTK_BIN (window));
-
+
/* send the new size to all plugins */
gtk_container_foreach (GTK_CONTAINER (itembar), panel_glue_set_screen_position_foreach, GINT_TO_POINTER (screen_position));
}
diff --git a/panel/panel-module.c b/panel/panel-module.c
index f470452..5c3c3c0 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -39,7 +39,7 @@ static void panel_module_dispose (GObject *object);
static void panel_module_finalize (GObject *object);
static gboolean panel_module_load (GTypeModule *type_module);
static void panel_module_unload (GTypeModule *type_module);
-static void panel_module_item_finalized (gpointer user_data,
+static void panel_module_item_finalized (gpointer user_data,
GObject *item);
@@ -119,12 +119,12 @@ panel_module_init (PanelModule *module)
-static void
+static void
panel_module_dispose (GObject *object)
{
- /* Do nothing to avoid problems with dispose in GTypeModule when
+ /* Do nothing to avoid problems with dispose in GTypeModule when
* types are registered.
- *
+ *
* For us this is not a problem since the modules are released when
* everything is destroyed. So we really want that last unref before
* closing the application. */
@@ -176,11 +176,11 @@ panel_module_load (GTypeModule *type_module)
return FALSE;
}
-
+
/* run the register function if available */
if (g_module_symbol (module->library, "xfce_panel_plugin_register_types", (gpointer) ®ister_func))
(*register_func) (type_module);
-
+
return TRUE;
}
@@ -252,12 +252,12 @@ panel_module_new_from_desktop_file (const gchar *filename,
/* read library location from the desktop file */
module_name = xfce_rc_read_entry (rc, "X-XFCE-Module", NULL);
directory = xfce_rc_read_entry (rc, "X-XFCE-Module-Path", NULL);
-
+
if (G_LIKELY (module_name != NULL && directory != NULL))
{
/* build the module path */
path = g_module_build_path (directory, module_name);
-
+
/* test if the module exists */
if (G_LIKELY (g_file_test (path, G_FILE_TEST_EXISTS)))
{
@@ -294,7 +294,7 @@ panel_module_new_from_desktop_file (const gchar *filename,
/* whether the plugin is unique */
module->is_unique = xfce_rc_read_bool_entry (rc, "X-XFCE-Unique", FALSE);
-
+
/* whether to run the plugin external */
module->run_in_wrapper = xfce_rc_read_bool_entry (rc, "X-XFCE-External", TRUE);
}
@@ -334,11 +334,11 @@ panel_module_create_plugin (PanelModule *module,
panel_return_val_if_fail (name != NULL, NULL);
panel_return_val_if_fail (id != NULL, NULL);
panel_return_val_if_fail (exo_str_is_equal (name, G_TYPE_MODULE (module)->name), NULL);
-
+
/* return null if the module is not usable (unique and already used) */
if (G_UNLIKELY (panel_module_is_usable (module) == FALSE))
return NULL;
-
+
/* whether we're going to start the module external */
external = !!(use_wrapper == FORCE_EXTERNAL || (use_wrapper == FROM_DESKTOP_FILE && module->run_in_wrapper));
@@ -356,9 +356,9 @@ panel_module_create_plugin (PanelModule *module,
{
/* debug check */
panel_return_val_if_fail (module->construct_func != NULL, NULL);
-
+
/* create a new panel plugin */
- plugin = (*module->construct_func) (name, module->name, id, screen);
+ plugin = (*module->construct_func) (name, id, module->name, screen);
}
else
{
@@ -371,10 +371,10 @@ panel_module_create_plugin (PanelModule *module,
{
/* increase count */
module->use_count++;
-
+
/* handle module use count and unloading */
g_object_weak_ref (G_OBJECT (plugin), panel_module_item_finalized, module);
-
+
/* emit unique-changed if the plugin is unique */
if (module->is_unique)
panel_module_factory_emit_unique_changed (module);
@@ -395,7 +395,7 @@ panel_module_get_internal_name (PanelModule *module)
{
panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
-
+
return G_TYPE_MODULE (module)->name;
}
@@ -406,7 +406,7 @@ panel_module_get_library_filename (PanelModule *module)
{
panel_return_val_if_fail (PANEL_IS_MODULE (module), NULL);
panel_return_val_if_fail (G_IS_TYPE_MODULE (module), NULL);
-
+
return module->filename;
}
@@ -451,7 +451,7 @@ gboolean
panel_module_is_valid (PanelModule *module)
{
panel_return_val_if_fail (PANEL_IS_MODULE (module), FALSE);
-
+
return g_file_test (module->filename, G_FILE_TEST_EXISTS);
}
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 099a5ce..04cb7f7 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -119,19 +119,19 @@ struct _PanelWindowClass
struct _PanelWindow
{
GtkWindow __parent__;
-
+
/* last allocated size, for recentering */
GtkAllocation prev_allocation;
/* snapping edge of the window */
PanelWindowSnapEdge snap_edge;
-
+
/* whether we should apply struts for this screen position */
gint struts_possible;
-
+
/* the last used struts for this window */
gulong struts[N_STRUTS];
-
+
/* the last calculated panel working area */
GdkRectangle working_area;
@@ -155,7 +155,7 @@ struct _PanelWindow
AutohideStatus autohide_status;
guint autohide_timer;
gint autohide_block;
-
+
/* the window we use to show during autohide */
GtkWidget *autohide_window;
@@ -220,7 +220,7 @@ panel_window_class_init (PanelWindowClass *klass)
GTK_TYPE_ORIENTATION,
GTK_ORIENTATION_HORIZONTAL,
EXO_PARAM_READABLE));
-
+
/* initialize the atoms */
cardinal_atom = panel_atom_intern ("CARDINAL");
net_wm_strut_atom = panel_atom_intern ("_NET_WM_STRUT");
@@ -238,7 +238,7 @@ panel_window_init (PanelWindow *window)
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DOCK);
-
+
/* init vars */
window->is_composited = FALSE;
window->drag_motion = FALSE;
@@ -261,13 +261,13 @@ panel_window_init (PanelWindow *window)
/* connect signal to monitor the compositor changes */
g_signal_connect (G_OBJECT (window), "composited-changed", G_CALLBACK (panel_window_set_colormap), NULL);
-
+
/* set the colormap */
panel_window_set_colormap (window);
/* get the window screen */
screen = gtk_window_get_screen (GTK_WINDOW (window));
-
+
/* connect screen update signals */
g_signal_connect_swapped (G_OBJECT (screen), "size-changed", G_CALLBACK (panel_window_screen_changed), window);
#if GTK_CHECK_VERSION (2,14,0)
@@ -303,11 +303,11 @@ static void
panel_window_finalize (GObject *object)
{
PanelWindow *window = PANEL_WINDOW (object);
-
+
/* stop the autohide timeout */
if (window->autohide_timer != 0)
g_source_remove (window->autohide_timer);
-
+
/* destroy autohide window */
if (window->autohide_window != NULL)
gtk_widget_destroy (window->autohide_window);
@@ -322,7 +322,7 @@ panel_window_realize (GtkWidget *widget)
{
/* realize the window */
(*GTK_WIDGET_CLASS (panel_window_parent_class)->realize) (widget);
-
+
/* initialize the working area */
panel_window_working_area (PANEL_WINDOW (widget), -1, -1, &PANEL_WINDOW (widget)->working_area);
}
@@ -416,7 +416,7 @@ panel_window_motion_notify_snap (gint value,
*return_value = tmp;
return SNAP_END;
}
-
+
/* set value as return value */
*return_value = value;
@@ -443,7 +443,7 @@ panel_window_motion_notify (GtkWidget *widget,
{
/* get the pointer position and current screen */
gdk_display_get_pointer (gtk_widget_get_display (widget), &screen, &window_x, &window_y, NULL);
-
+
/* make sure the window is on the correct screen */
gtk_window_set_screen (GTK_WINDOW (widget), screen);
@@ -469,7 +469,7 @@ panel_window_motion_notify (GtkWidget *widget,
/* try to find snapping edges */
snap_horizontal = panel_window_motion_notify_snap (clamp_x, window_width, area.x, area.x + area.width, &snap_x);
snap_vertical = panel_window_motion_notify_snap (clamp_y, window_height, area.y, area.y + area.height, &snap_y);
-
+
/* detect the snap mode */
if (snap_horizontal == SNAP_START)
window->snap_edge = PANEL_SNAP_EGDE_W + snap_vertical;
@@ -514,7 +514,7 @@ panel_window_button_press_event (GtkWidget *widget,
/* get the modifiers */
modifiers = event->state & gtk_accelerator_get_default_mod_mask ();
-
+
if (event->button == 1
&& event->window == widget->window
&& window->locked == FALSE
@@ -541,7 +541,7 @@ panel_window_button_press_event (GtkWidget *widget,
{
/* popup the panel menu */
panel_glue_popup_menu (window);
-
+
return TRUE;
}
@@ -563,10 +563,10 @@ panel_window_button_release_event (GtkWidget *widget,
/* release the pointer */
gdk_pointer_ungrab (event->time);
-
+
/* update working area, struts and reallocate */
panel_window_screen_changed (widget, gtk_window_get_screen (GTK_WINDOW (widget)));
-
+
/* update the plugins */
panel_glue_set_screen_position (window);
@@ -582,8 +582,8 @@ static gboolean
panel_window_autohide_timeout (gpointer user_data)
{
PanelWindow *window = PANEL_WINDOW (user_data);
-
- panel_return_val_if_fail (window->autohide_status != DISABLED
+
+ panel_return_val_if_fail (window->autohide_status != DISABLED
&& window->autohide_status != BLOCKED, FALSE);
/* change status */
@@ -591,7 +591,7 @@ panel_window_autohide_timeout (gpointer user_data)
window->autohide_status = HIDDEN;
else if (window->autohide_status == POPUP_QUEUED)
window->autohide_status = VISIBLE;
-
+
gtk_widget_queue_resize (GTK_WIDGET (window));
return FALSE;
@@ -612,16 +612,16 @@ panel_window_autohide_queue (PanelWindow *window,
AutohideStatus status)
{
guint delay;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* stop a running autohide timeout */
if (window->autohide_timer != 0)
g_source_remove (window->autohide_timer);
-
+
/* set new autohide status */
window->autohide_status = status;
-
+
/* leave when the autohide is disabled */
if (status == DISABLED || status == BLOCKED)
{
@@ -637,7 +637,7 @@ panel_window_autohide_queue (PanelWindow *window,
delay = POPDOWN_DELAY * 3;
else
delay = POPUP_DELAY;
-
+
/* schedule a new timeout */
window->autohide_timer = g_timeout_add_full (G_PRIORITY_LOW, delay,
panel_window_autohide_timeout, window,
@@ -653,10 +653,10 @@ panel_window_autohide_enter_notify_event (GtkWidget *widget,
PanelWindow *window)
{
panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
-
+
/* queue a hide timeout */
panel_window_autohide_queue (window, POPUP_QUEUED);
-
+
return TRUE;
}
@@ -668,16 +668,16 @@ panel_window_autohide_leave_notify_event (GtkWidget *widget,
PanelWindow *window)
{
panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
-
+
/* stop a running autohide timeout */
if (window->autohide_timer != 0)
g_source_remove (window->autohide_timer);
-
+
/* update the status */
if (window->autohide_status == POPUP_QUEUED)
window->autohide_status = HIDDEN;
-
- return TRUE;
+
+ return TRUE;
}
@@ -686,23 +686,23 @@ static GtkWidget *
panel_window_autohide_window (PanelWindow *window)
{
GtkWidget *popup;
-
+
/* create window */
popup = gtk_window_new (GTK_WINDOW_POPUP);
-
+
/* connect signals to monitor enter/leave events */
g_signal_connect (G_OBJECT (popup), "enter-notify-event", G_CALLBACK (panel_window_autohide_enter_notify_event), window);
g_signal_connect (G_OBJECT (popup), "leave-notify-event", G_CALLBACK (panel_window_autohide_leave_notify_event), window);
-
+
/* put the window offscreen */
gtk_window_move (GTK_WINDOW (popup), OFFSCREEN, OFFSCREEN);
-
+
/* set window opacity */
_window_set_opacity (GTK_WINDOW (popup), window->leave_opacity);
-
+
/* show the window */
gtk_widget_show (popup);
-
+
return popup;
}
@@ -713,7 +713,7 @@ panel_window_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
{
PanelWindow *window = PANEL_WINDOW (widget);
-
+
/* ignore event when entered from an inferior */
if (event->detail == GDK_NOTIFY_INFERIOR)
return FALSE;
@@ -740,7 +740,7 @@ panel_window_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event)
{
PanelWindow *window = PANEL_WINDOW (widget);
-
+
/* ignore event when left towards an inferior */
if (event->detail == GDK_NOTIFY_INFERIOR)
return FALSE;
@@ -802,8 +802,8 @@ panel_window_size_request (GtkWidget *widget,
if (window->horizontal)
{
/* calculate the panel width (fits content, fits on the screen, and extands to user size) */
- requisition->width = CLAMP (child_requisition.width,
- window->working_area.width * window->length,
+ requisition->width = CLAMP (child_requisition.width,
+ window->working_area.width * window->length,
window->working_area.width);
/* set height based on user setting */
@@ -812,8 +812,8 @@ panel_window_size_request (GtkWidget *widget,
else
{
/* calculate the panel width (fits content, fits on the screen, and extands to user size) */
- requisition->height = CLAMP (child_requisition.height,
- window->working_area.height * window->length,
+ requisition->height = CLAMP (child_requisition.height,
+ window->working_area.height * window->length,
window->working_area.height);
/* set width based on user setting */
@@ -850,7 +850,7 @@ panel_window_size_allocate (GtkWidget *widget,
gint root_x, root_y;
gint width = HIDDEN_PANEL_SIZE, height = HIDDEN_PANEL_SIZE;
gint hidden_root_x, hidden_root_y;
-
+
if (GTK_WIDGET_REALIZED (widget))
{
/* set the widget allocation */
@@ -864,7 +864,7 @@ panel_window_size_allocate (GtkWidget *widget,
&& window->autohide_window != NULL
&& window->snap_edge != PANEL_SNAP_EGDE_NONE)
{
- if (window->autohide_status == VISIBLE
+ if (window->autohide_status == VISIBLE
|| window->autohide_status == POPDOWN_QUEUED
|| window->autohide_status == POPDOWN_QUEUED_SLOW
|| window->autohide_status == BLOCKED)
@@ -886,14 +886,14 @@ panel_window_size_allocate (GtkWidget *widget,
case PANEL_SNAP_EGDE_WC:
height = allocation->height;
break;
-
+
case PANEL_SNAP_EGDE_NC:
case PANEL_SNAP_EGDE_SC:
case PANEL_SNAP_EGDE_N:
case PANEL_SNAP_EGDE_S:
width = allocation->width;
break;
-
+
default:
if (window->horizontal)
width = allocation->width;
@@ -901,14 +901,14 @@ panel_window_size_allocate (GtkWidget *widget,
height = allocation->height;
break;
}
-
+
/* get coordinates for the hidden window */
panel_window_calculate_position (window, width, height, &hidden_root_x, &hidden_root_y);
-
+
/* position the hidden window */
gtk_window_move (GTK_WINDOW (window->autohide_window), hidden_root_x, hidden_root_y);
gtk_window_resize (GTK_WINDOW (window->autohide_window), width, height);
-
+
/* put the panel window offscreen */
root_x = root_y = OFFSCREEN;
}
@@ -921,7 +921,7 @@ panel_window_size_allocate (GtkWidget *widget,
{
/* set the child allocation */
child_allocation = *allocation;
-
+
/* change to allocation to keep the handles free */
if (window->locked == FALSE)
{
@@ -944,12 +944,12 @@ panel_window_size_allocate (GtkWidget *widget,
/* allocate the child */
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child_allocation);
}
-
+
/* update struts if possible */
if (window->struts_possible != 0)
panel_window_struts_update (window, root_x, root_y, allocation->width, allocation->height);
}
-
+
/* update previous allocation */
window->prev_allocation = *allocation;
}
@@ -962,13 +962,13 @@ panel_window_screen_changed (GtkWidget *widget,
{
GdkScreen *screen;
PanelWindow *window = PANEL_WINDOW (widget);
-
+
panel_return_if_fail (PANEL_IS_WINDOW (widget));
panel_return_if_fail (GDK_IS_SCREEN (previous_screen));
-
+
/* get the new screen */
screen = gtk_window_get_screen (GTK_WINDOW (widget));
-
+
if (screen != previous_screen)
{
/* disconnect old screen changed handles */
@@ -983,10 +983,10 @@ panel_window_screen_changed (GtkWidget *widget,
/* update the panel working area */
panel_window_working_area (window, -1, -1, &window->working_area);
-
+
/* check if struts are needed on the next resize */
window->struts_possible = -1;
-
+
/* queue a resize */
gtk_widget_queue_resize (widget);
}
@@ -1194,42 +1194,42 @@ panel_window_working_area (PanelWindow *window,
gint n_monitors;
GdkRectangle geometry;
gint i;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
panel_return_if_fail (GDK_IS_WINDOW (GTK_WIDGET (window)->window));
-
+
/* get valid coordinates if not set */
if (root_x == -1 && root_y == -1)
gtk_window_get_position (GTK_WINDOW (window), &root_x, &root_y);
-
+
/* get panel screen */
screen = gtk_window_get_screen (GTK_WINDOW (window));
-
+
/* get the monitor number */
monitor_num = gdk_screen_get_monitor_at_point (screen, root_x, root_y);
-
+
/* get the root monitor geometry */
gdk_screen_get_monitor_geometry (screen, monitor_num, dest);
-
+
if (window->span_monitors)
{
/* get the number of monitors */
n_monitors = gdk_screen_get_n_monitors (screen);
-
+
/* only try to extend when there are more then 2 monitors */
if (G_LIKELY (n_monitors > 1))
{
/* TODO: loop for > 2 monitors */
-
+
for (i = 0; i < n_monitors; i++)
{
/* skip the origional monitor */
if (i == monitor_num)
continue;
-
+
/* get the monitor geometry */
gdk_screen_get_monitor_geometry (screen, i, &geometry);
-
+
/* try to extend the dest geometry from the root coordinate's point of view */
if (window->horizontal
&& root_y >= geometry.y
@@ -1269,23 +1269,23 @@ panel_window_struts_are_possible (PanelWindow *window,
gint n_monitors;
gint i;
GdkRectangle geometry;
-
+
panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
-
+
/* never set struts when we don't snap or when autohide is enabled */
if (window->snap_edge == PANEL_SNAP_EGDE_NONE || window->autohide_status != DISABLED)
return FALSE;
-
+
/* always set struts on the following condition */
if ((window->horizontal && y == 0) || (!window->horizontal && x == 0))
return TRUE;
-
+
/* get panel screen */
screen = gtk_window_get_screen (GTK_WINDOW (window));
-
+
/* get the number of monitors */
n_monitors = gdk_screen_get_n_monitors (screen);
-
+
if (G_LIKELY (n_monitors == 1))
{
/* don't set the struts when we're not at a screen edge */
@@ -1299,13 +1299,13 @@ panel_window_struts_are_possible (PanelWindow *window,
{
/* get the monitor geometry */
gdk_screen_get_monitor_geometry (screen, i, &geometry);
-
+
if (window->horizontal
- && x >= geometry.x
+ && x >= geometry.x
&& x + width <= geometry.x + geometry.width
&& y + height < geometry.y + geometry.height)
return FALSE;
-
+
if (window->horizontal == FALSE
&& y >= geometry.y
&& y + height <= geometry.y + geometry.height
@@ -1335,20 +1335,20 @@ panel_window_struts_update (PanelWindow *window,
panel_return_if_fail (GDK_IS_WINDOW (GTK_WIDGET (window)->window));
panel_return_if_fail (N_STRUTS == 12);
panel_return_if_fail (cardinal_atom != GDK_NONE);
-
+
if (G_UNLIKELY (window->struts_possible == -1))
{
/* check whether struts are possible, skip to apply if not */
window->struts_possible = panel_window_struts_are_possible (window, x, y, width, height);
-
+
/* struts are not possible, reset them only this time */
if (window->struts_possible == 0)
goto reset_only;
}
-
+
/* get the panel window screen */
screen = gtk_window_get_screen (GTK_WINDOW (window));
-
+
if (window->horizontal)
{
if (snap_edge_is_top (window->snap_edge))
@@ -1357,8 +1357,8 @@ panel_window_struts_update (PanelWindow *window,
struts[STRUT_TOP] = y + height;
struts[STRUT_TOP_START_X] = x;
struts[STRUT_TOP_END_X] = x + width;
-
-
+
+
}
else if (snap_edge_is_bottom (window->snap_edge))
{
@@ -1385,32 +1385,32 @@ panel_window_struts_update (PanelWindow *window,
struts[STRUT_RIGHT_END_Y] = y + height;
}
}
-
+
reset_only:
-
+
for (i = 0; i < N_STRUTS; i++)
{
/* check if we need to update */
if (struts[i] != window->struts[i])
update_struts = TRUE;
-
+
/* store new strut */
window->struts[i] = struts[i];
}
-
+
if (update_struts)
{
/* don't crash on x errors */
gdk_error_trap_push ();
-
+
/* set the wm strut partial */
gdk_property_change (GTK_WIDGET (window)->window, net_wm_strut_partial_atom,
cardinal_atom, 32, GDK_PROP_MODE_REPLACE, (guchar *) &struts, 12);
-
+
/* set the wm strut */
gdk_property_change (GTK_WIDGET (window)->window, net_wm_strut_atom,
cardinal_atom, 32, GDK_PROP_MODE_REPLACE, (guchar *) &struts, 4);
-
+
/* release the trap push */
gdk_error_trap_pop ();
@@ -1418,7 +1418,7 @@ panel_window_struts_update (PanelWindow *window,
gint n = -1;
const gchar *names1[] = { "left", "right", "top", "bottom" };
const gchar *names2[] = { "y", "y", "x", "x" };
-
+
if (struts[STRUT_LEFT] != 0)
n = STRUT_LEFT;
else if (struts[STRUT_RIGHT] != 0)
@@ -1427,7 +1427,7 @@ panel_window_struts_update (PanelWindow *window,
n = STRUT_TOP;
else if (struts[STRUT_BOTTOM] != 0)
n = STRUT_BOTTOM;
-
+
if (n == -1)
g_print ("Struts: All set to zero\n");
else
@@ -1447,22 +1447,22 @@ panel_window_set_colormap (PanelWindow *window)
gboolean restore;
GtkWidget *widget = GTK_WIDGET (window);
gint root_x, root_y;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* whether the widget was previously visible */
restore = GTK_WIDGET_REALIZED (widget);
-
+
/* unrealize the window if needed */
if (restore)
{
/* store the window position */
gtk_window_get_position (GTK_WINDOW (window), &root_x, &root_y);
-
+
/* reset the struts */
if (window->struts_possible == 1)
panel_window_struts_update (window, 0, 0, 0, 0);
-
+
/* hide the widget */
gtk_widget_hide (widget);
gtk_widget_unrealize (widget);
@@ -1470,35 +1470,35 @@ panel_window_set_colormap (PanelWindow *window)
/* set bool */
window->is_composited = gtk_widget_is_composited (widget);
-
+
/* get the screen */
screen = gtk_window_get_screen (GTK_WINDOW (window));
/* try to get the rgba colormap */
if (window->is_composited)
colormap = gdk_screen_get_rgba_colormap (screen);
-
+
/* get the default colormap */
if (colormap == NULL)
{
colormap = gdk_screen_get_rgb_colormap (screen);
window->is_composited = FALSE;
}
-
+
/* set the colormap */
if (G_LIKELY (colormap))
gtk_widget_set_colormap (widget, colormap);
-
+
/* restore the window */
if (restore)
{
/* restore the position */
gtk_window_move (GTK_WINDOW (window), root_x, root_y);
-
+
/* show the widget again */
gtk_widget_realize (widget);
gtk_widget_show (widget);
-
+
/* set the struts again */
if (window->struts_possible == 1)
panel_window_struts_update (window, root_x, root_y, widget->allocation.width, widget->allocation.height);
@@ -1514,9 +1514,9 @@ panel_window_get_position (PanelWindow *window,
{
/* get the window position */
gtk_window_get_position (GTK_WINDOW (window), root_x, root_y);
-
+
/* check if the coordinates of the hidden window should be used */
- if (window->autohide_window
+ if (window->autohide_window
&& ((root_x && *root_x == OFFSCREEN) || (root_y && *root_y == OFFSCREEN)))
gtk_window_get_position (GTK_WINDOW (window->autohide_window), root_x, root_y);
}
@@ -1612,13 +1612,13 @@ panel_window_set_orientation (PanelWindow *window,
GtkOrientation orientation)
{
gboolean horizontal;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
/* whether the orientation is horizontal */
horizontal = !!(orientation == GTK_ORIENTATION_HORIZONTAL);
- if (G_LIKELY (window->horizontal != horizontal))
+ if (G_LIKELY ((gboolean) window->horizontal != horizontal))
{
/* set new orientation */
window->horizontal = horizontal;
@@ -1703,7 +1703,7 @@ panel_window_get_xoffset (PanelWindow *window)
/* get the panel window position */
panel_window_get_position (window, &root_x, NULL);
-
+
return root_x;
}
@@ -1775,7 +1775,7 @@ panel_window_set_autohide (PanelWindow *window,
gboolean autohide)
{
AutohideStatus status;
-
+
panel_return_if_fail (PANEL_IS_WINDOW (window));
if (G_LIKELY (panel_window_get_autohide (window) != autohide))
@@ -1788,10 +1788,10 @@ panel_window_set_autohide (PanelWindow *window,
/* create popup window if needed */
if (window->autohide_window == NULL)
window->autohide_window = panel_window_autohide_window (window);
-
+
/* get the correct status */
status = window->autohide_block == 0 ? POPDOWN_QUEUED_SLOW : BLOCKED;
-
+
/* queue a popdown */
panel_window_autohide_queue (window, status);
}
@@ -1799,7 +1799,7 @@ panel_window_set_autohide (PanelWindow *window,
{
/* disable autohiding */
panel_window_autohide_queue (window, DISABLED);
-
+
/* destroy the autohide window */
if (window->autohide_window)
{
@@ -1812,15 +1812,15 @@ panel_window_set_autohide (PanelWindow *window,
-void
+void
panel_window_freeze_autohide (PanelWindow *window)
{
panel_return_if_fail (PANEL_IS_WINDOW (window));
panel_return_if_fail (window->autohide_block >= 0);
-
+
/* increase autohide block counter */
window->autohide_block++;
-
+
/* block autohide */
if (window->autohide_status != DISABLED && window->autohide_block == 1)
panel_window_autohide_queue (window, BLOCKED);
@@ -1828,15 +1828,15 @@ panel_window_freeze_autohide (PanelWindow *window)
-void
+void
panel_window_thaw_autohide (PanelWindow *window)
{
panel_return_if_fail (PANEL_IS_WINDOW (window));
panel_return_if_fail (window->autohide_block > 0);
-
+
/* decrease autohide block counter */
window->autohide_block--;
-
+
/* queue an autohide when needed */
if (window->autohide_status != DISABLED && window->autohide_block == 0)
panel_window_autohide_queue (window, POPDOWN_QUEUED);
@@ -1935,7 +1935,7 @@ panel_window_set_leave_opacity (PanelWindow *window,
/* update the panel window opacity */
_window_set_opacity (GTK_WINDOW (window), value);
-
+
/* set the autohide window opacity if created */
if (window->autohide_window)
_window_set_opacity (GTK_WINDOW (window->autohide_window), value);
@@ -1944,26 +1944,26 @@ panel_window_set_leave_opacity (PanelWindow *window,
-gboolean
+gboolean
panel_window_get_span_monitors (PanelWindow *window)
{
panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
-
+
return window->span_monitors;
}
-void
+void
panel_window_set_span_monitors (PanelWindow *window,
gboolean span_monitors)
{
panel_return_if_fail (PANEL_IS_WINDOW (window));
-
+
if (window->span_monitors != span_monitors)
{
window->span_monitors = span_monitors;
-
+
gtk_widget_queue_resize (GTK_WIDGET (window));
}
}
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 2f94915..e424c33 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -3,6 +3,7 @@
SUBDIRS = \
clock \
launcher \
- systray
+ systray \
+ tasklist
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/clock/clock-dialog.c b/plugins/clock/clock-dialog.c
index 070d25f..fece971 100644
--- a/plugins/clock/clock-dialog.c
+++ b/plugins/clock/clock-dialog.c
@@ -61,7 +61,7 @@ static void
xfce_clock_dialog_reload_settings (XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
if (G_LIKELY (clock->widget))
{
/* save the settings */
@@ -82,7 +82,7 @@ xfce_clock_dialog_mode_changed (GtkComboBox *combo,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* set the new mode */
clock->mode = gtk_combo_box_get_active (combo);
@@ -110,7 +110,7 @@ xfce_clock_dialog_show_frame_toggled (GtkToggleButton *button,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* set frame mode */
clock->show_frame = gtk_toggle_button_get_active (button);
@@ -126,7 +126,7 @@ xfce_clock_dialog_tooltip_format_changed (GtkComboBox *combo,
{
gint index;
GtkWidget *entry;
-
+
panel_return_if_fail (XFCE_IS_CLOCK (clock));
/* stop running timeout */
@@ -143,7 +143,7 @@ xfce_clock_dialog_tooltip_format_changed (GtkComboBox *combo,
entry = g_object_get_data (G_OBJECT (combo), I_("entry"));
/* set one of the default formats */
- if (index < G_N_ELEMENTS (tooltip_formats))
+ if (index < (gint) G_N_ELEMENTS (tooltip_formats))
{
/* hide the entry */
gtk_widget_hide (entry);
@@ -174,7 +174,7 @@ xfce_clock_dialog_tooltip_entry_changed (GtkEntry *entry,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* cleanup old format */
g_free (clock->tooltip_format);
@@ -192,7 +192,7 @@ xfce_clock_dialog_show_seconds_toggled (GtkToggleButton *button,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* whether we show seconds */
clock->show_seconds = gtk_toggle_button_get_active (button);
@@ -207,7 +207,7 @@ xfce_clock_dialog_show_military_toggled (GtkToggleButton *button,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* whether we show a 24h clock */
clock->show_military = gtk_toggle_button_get_active (button);
@@ -222,7 +222,7 @@ xfce_clock_dialog_show_meridiem_toggled (GtkToggleButton *button,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* whether we show am/pm */
clock->show_meridiem = gtk_toggle_button_get_active (button);
@@ -237,7 +237,7 @@ xfce_clock_dialog_flash_separators_toggled (GtkToggleButton *button,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* whether flash the separators */
clock->flash_separators = gtk_toggle_button_get_active (button);
@@ -252,7 +252,7 @@ xfce_clock_dialog_true_binary_toggled (GtkToggleButton *button,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* whether we this is a true binary clock */
clock->true_binary = gtk_toggle_button_get_active (button);
@@ -270,7 +270,7 @@ xfce_clock_dialog_digital_format_changed (GtkComboBox *combo,
GtkWidget *entry;
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* get index of selected item */
index = gtk_combo_box_get_active (combo);
@@ -278,7 +278,7 @@ xfce_clock_dialog_digital_format_changed (GtkComboBox *combo,
entry = g_object_get_data (G_OBJECT (combo), I_("entry"));
/* set one of the default formats */
- if (index < G_N_ELEMENTS (digital_formats))
+ if (index < (gint) G_N_ELEMENTS (digital_formats))
{
/* hide the entry */
gtk_widget_hide (entry);
@@ -309,7 +309,7 @@ xfce_clock_dialog_digital_entry_changed (GtkEntry *entry,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* cleanup old format */
g_free (clock->digital_format);
@@ -399,7 +399,7 @@ xfce_clock_dialog_response (GtkWidget *dialog,
XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* destroy the dialog */
gtk_widget_destroy (dialog);
@@ -408,6 +408,9 @@ xfce_clock_dialog_response (GtkWidget *dialog,
/* unblock the plugin menu */
xfce_panel_plugin_unblock_menu (XFCE_PANEL_PLUGIN (clock));
+
+ /* save the settings */
+ xfce_clock_save (XFCE_PANEL_PLUGIN (clock));
}
@@ -417,7 +420,7 @@ xfce_clock_dialog_options (XfceClock *clock)
{
GtkWidget *button, *bin, *vbox, *combo, *entry;
gboolean has_active;
-
+
panel_return_if_fail (XFCE_IS_CLOCK (clock));
/* get the frame bin */
@@ -477,7 +480,7 @@ xfce_clock_dialog_options (XfceClock *clock)
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_digital_format_changed), clock);
gtk_widget_show (combo);
- entry = gtk_entry_new_with_max_length (BUFFER_SIZE-1);
+ entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (combo), I_("entry"), entry);
if (!has_active)
@@ -498,7 +501,7 @@ xfce_clock_dialog_show (XfceClock *clock)
GtkWidget *frame, *bin, *vbox, *combo;
GtkWidget *button, *entry;
gboolean has_active;
-
+
panel_return_if_fail (XFCE_IS_CLOCK (clock));
/* block the right-click menu */
@@ -514,7 +517,7 @@ xfce_clock_dialog_show (XfceClock *clock)
gtk_window_set_icon_name (GTK_WINDOW (dialog), "xfce4-settings");
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (xfce_clock_dialog_response), clock);
-
+
/* let the plugin take the dialg window */
xfce_panel_plugin_take_window (XFCE_PANEL_PLUGIN (clock), GTK_WINDOW (dialog));
@@ -532,7 +535,7 @@ xfce_clock_dialog_show (XfceClock *clock)
vbox = gtk_vbox_new (FALSE, 8);
gtk_container_add (GTK_CONTAINER (bin), vbox);
gtk_widget_show (vbox);
-
+
combo = gtk_combo_box_new_text ();
gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
@@ -566,7 +569,7 @@ xfce_clock_dialog_show (XfceClock *clock)
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_tooltip_format_changed), clock);
gtk_widget_show (combo);
- entry = gtk_entry_new_with_max_length (BUFFER_SIZE-1);
+ entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (combo), I_("entry"), entry);
if (!has_active)
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 9dfe9f1..6221bb2 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -41,7 +41,6 @@
static void xfce_clock_class_init (XfceClockClass *klass);
static void xfce_clock_init (XfceClock *clock);
static void xfce_clock_finalize (GObject *object);
-static void xfce_clock_save (XfcePanelPlugin *plugin);
static void xfce_clock_size_changed (XfcePanelPlugin *plugin,
gint size);
static void xfce_clock_configure_plugin (XfcePanelPlugin *plugin);
@@ -72,12 +71,12 @@ xfce_clock_class_init (XfceClockClass *klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_clock_finalize;
-
+
plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
plugin_class->save = xfce_clock_save;
plugin_class->size_changed = xfce_clock_size_changed;
plugin_class->configure_plugin = xfce_clock_configure_plugin;
-
+
#if !GTK_CHECK_VERSION (2,12,0)
/* allocate share tooltip */
shared_tooltips = gtk_tooltips_new ();
@@ -96,7 +95,7 @@ xfce_clock_init (XfceClock *clock)
clock->mode = XFCE_CLOCK_MODE_DIGITAL;
clock->tooltip_format = NULL;
clock->digital_format = NULL;
-
+
/* read the user settings */
xfce_clock_load (clock);
@@ -105,7 +104,7 @@ xfce_clock_init (XfceClock *clock)
gtk_container_add (GTK_CONTAINER (clock), clock->frame);
gtk_frame_set_shadow_type (GTK_FRAME (clock->frame), clock->show_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
gtk_widget_show (clock->frame);
-
+
/* set the clock mode (create clock widget) */
xfce_clock_widget_update_mode (clock);
@@ -117,7 +116,7 @@ xfce_clock_init (XfceClock *clock)
/* start the tooltip timer */
xfce_clock_tooltip_timer (clock);
-
+
/* show the properties dialog */
xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (clock));
}
@@ -128,37 +127,39 @@ static void
xfce_clock_finalize (GObject *object)
{
XfceClock *clock = XFCE_CLOCK (object);
-
+
/* stop running timeouts */
if (G_LIKELY (clock->widget_timer_id != 0))
g_source_remove (clock->widget_timer_id);
if (G_LIKELY (clock->tooltip_timer_id != 0))
g_source_remove (clock->tooltip_timer_id);
-
+
/* cleanup */
g_free (clock->tooltip_format);
g_free (clock->digital_format);
-
+
(*G_OBJECT_CLASS (xfce_clock_parent_class)->finalize) (object);
}
-static void
+void
xfce_clock_save (XfcePanelPlugin *plugin)
{
XfceClock *clock = XFCE_CLOCK (plugin);
gchar *filename;
XfceRc *rc;
+ panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (clock));
+
/* config filename */
filename = xfce_panel_plugin_save_location (plugin, TRUE);
if (G_LIKELY (filename))
{
/* open rc file */
rc = xfce_rc_simple_open (filename, FALSE);
-
+
/* cleanup */
g_free (filename);
@@ -187,13 +188,13 @@ xfce_clock_save (XfcePanelPlugin *plugin)
-static void
+static void
xfce_clock_size_changed (XfcePanelPlugin *plugin,
gint size)
{
XfceClock *clock = XFCE_CLOCK (plugin);
GtkOrientation orientation;
-
+
/* set the frame border */
gtk_container_set_border_width (GTK_CONTAINER (clock->frame), size > 26 ? 1 : 0);
@@ -228,7 +229,7 @@ xfce_clock_load (XfceClock *clock)
const gchar *value;
XfceRc *rc;
gboolean succeed = FALSE;
-
+
panel_return_if_fail (XFCE_IS_CLOCK (clock));
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (clock));
@@ -239,7 +240,7 @@ xfce_clock_load (XfceClock *clock)
{
/* open rc file (readonly) */
rc = xfce_rc_simple_open (filename, TRUE);
-
+
/* cleanup */
g_free (filename);
@@ -267,12 +268,12 @@ xfce_clock_load (XfceClock *clock)
/* close the rc file */
xfce_rc_close (rc);
-
+
/* loading succeeded */
succeed = TRUE;
}
}
-
+
if (succeed == FALSE)
{
/* fallback to defaults */
@@ -425,7 +426,7 @@ xfce_clock_util_strdup_strftime (const gchar *format,
gchar *converted, *result;
gsize length;
gchar buffer[BUFFER_SIZE];
-
+
/* return null */
if (G_UNLIKELY (format == NULL))
return NULL;
@@ -461,7 +462,7 @@ xfce_clock_tooltip_timer_update (gpointer user_data)
/* stop running this timeout */
if (clock->tooltip_format == NULL)
return FALSE;
-
+
/* get the local time */
xfce_clock_util_get_localtime (&tm);
@@ -471,10 +472,10 @@ xfce_clock_tooltip_timer_update (gpointer user_data)
#if GTK_CHECK_VERSION (2,12,0)
/* set the tooltip */
gtk_widget_set_tooltip_text (GTK_WIDGET (clock), string);
-#else
+#else
/* set the tooltip */
if (G_LIKELY (shared_tooltips))
- gtk_tooltips_set_tip (shared_tooltips, GTK_WIDGET (clock), string, NULL);
+ gtk_tooltips_set_tip (shared_tooltips, GTK_WIDGET (clock), string, NULL);
#endif
/* cleanup */
@@ -506,7 +507,7 @@ void
xfce_clock_tooltip_timer (XfceClock *clock)
{
guint interval;
-
+
panel_return_if_fail (XFCE_IS_CLOCK (clock));
/* stop a running timeout */
@@ -515,7 +516,7 @@ xfce_clock_tooltip_timer (XfceClock *clock)
g_source_remove (clock->tooltip_timer_id);
clock->tooltip_timer_id = 0;
}
-
+
/* start a new timeout if there is a format string */
if (clock->tooltip_format != NULL)
{
@@ -537,7 +538,7 @@ xfce_clock_tooltip_timer (XfceClock *clock)
#if GTK_CHECK_VERSION (2,12,0)
/* unset the tooltip */
gtk_widget_set_tooltip_text (GTK_WIDGET (clock), NULL);
-#else
+#else
/* unset the tooltip */
if (G_LIKELY (shared_tooltips))
gtk_tooltips_set_tip (shared_tooltips, GTK_WIDGET (clock), NULL, NULL);
@@ -552,8 +553,8 @@ xfce_clock_widget_timer_sync (gpointer user_data)
{
XfceClock *clock = XFCE_CLOCK (user_data);
- if (G_LIKELY (clock->widget
- && clock->update_func != NULL
+ if (G_LIKELY (clock->widget
+ && clock->update_func != NULL
&& clock->widget_interval > 0))
{
/* start the clock update timeout */
@@ -580,7 +581,7 @@ xfce_clock_widget_timer (XfceClock *clock)
guint interval;
panel_return_if_fail (XFCE_IS_CLOCK (clock));
-
+
/* stop a running timeout */
if (clock->widget_timer_id != 0)
{
@@ -595,7 +596,7 @@ xfce_clock_widget_timer (XfceClock *clock)
/* start the sync timeout (use precision timer) */
clock->widget_timer_id = g_timeout_add (interval, xfce_clock_widget_timer_sync, clock);
-
+
/* manual update if reasonable */
if (interval >= CLOCK_INTERVAL_SECOND)
(*clock->update_func) (GTK_WIDGET (clock->widget));
@@ -609,7 +610,7 @@ xfce_clock_widget_update_properties (XfceClock *clock)
{
panel_return_if_fail (XFCE_IS_CLOCK (clock));
panel_return_if_fail (clock->widget != NULL);
-
+
/* leave when there is no widget */
if (clock->widget == NULL)
return;
@@ -668,7 +669,7 @@ void
xfce_clock_widget_update_mode (XfceClock *clock)
{
GtkWidget *widget = NULL;
-
+
panel_return_if_fail (XFCE_IS_CLOCK (clock));
/* stop runing timeout */
@@ -733,7 +734,7 @@ xfce_panel_plugin_register_types (XfcePanelModule *panel_module)
xfce_clock_binary_register_type (panel_module);
xfce_clock_digital_register_type (panel_module);
xfce_clock_lcd_register_type (panel_module);
-
+
g_message ("Clock types registered");
}
diff --git a/plugins/clock/clock.h b/plugins/clock/clock.h
index e6fdff0..bc84188 100644
--- a/plugins/clock/clock.h
+++ b/plugins/clock/clock.h
@@ -73,22 +73,22 @@ struct _XfceClockClass
struct _XfceClock
{
XfcePanelPlugin __parent__;
-
+
GtkWidget *frame;
GtkWidget *widget;
-
+
/* active clock */
XfceClockMode mode;
-
+
/* widget timer update */
GSourceFunc update_func;
guint widget_interval;
guint widget_timer_id;
-
+
/* tooltip timer update */
guint tooltip_interval;
guint tooltip_timer_id;
-
+
/* settings */
gchar *tooltip_format;
gchar *digital_format;
@@ -106,6 +106,8 @@ GType xfce_clock_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
void xfce_clock_register_type (XfcePanelModule *panel_module) G_GNUC_INTERNAL;
+void xfce_clock_save (XfcePanelPlugin *plugin);
+
void xfce_clock_util_get_localtime (struct tm *tm) G_GNUC_INTERNAL;
gchar *xfce_clock_util_strdup_strftime (const gchar *format,
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index bfe4cfe..d191137 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -840,7 +840,7 @@ launcher_dialog_tree_update_row (LauncherDialog *ld,
case COLUMN_NAME:
/* build name */
name = ld->entry->name ? ld->entry->name : _("Unnamed");
-
+
/* set new name */
gtk_list_store_set (ld->store, &iter,
COLUMN_NAME, name,
@@ -914,8 +914,7 @@ launcher_dialog_tree_button_clicked (GtkWidget *button,
GtkTreePath *path;
GtkTreeIter iter_a;
GtkTreeIter iter_b;
- guint position;
- gint list_length;
+ gint position, list_length;
GList *li;
GdkPixbuf *icon = NULL;
LauncherEntry *entry;
@@ -1336,7 +1335,7 @@ launcher_dialog_add_tree (LauncherDialog *ld)
{
/* load icon */
icon = launcher_utility_load_pixbuf (gtk_widget_get_screen (ld->treeview), entry->icon, LAUNCHER_TREE_ICON_SIZE);
-
+
/* build name */
name = entry->name ? entry->name : _("Unnamed");
diff --git a/plugins/tasklist/Makefile.am b/plugins/tasklist.new/Makefile.am
similarity index 100%
copy from plugins/tasklist/Makefile.am
copy to plugins/tasklist.new/Makefile.am
diff --git a/plugins/tasklist/tasklist-box.c b/plugins/tasklist.new/tasklist-box.c
similarity index 100%
rename from plugins/tasklist/tasklist-box.c
rename to plugins/tasklist.new/tasklist-box.c
diff --git a/plugins/tasklist/tasklist-box.h b/plugins/tasklist.new/tasklist-box.h
similarity index 100%
rename from plugins/tasklist/tasklist-box.h
rename to plugins/tasklist.new/tasklist-box.h
diff --git a/plugins/tasklist/tasklist-plugin.c b/plugins/tasklist.new/tasklist-plugin.c
similarity index 100%
rename from plugins/tasklist/tasklist-plugin.c
rename to plugins/tasklist.new/tasklist-plugin.c
diff --git a/plugins/tasklist/tasklist-plugin.h b/plugins/tasklist.new/tasklist-plugin.h
similarity index 100%
rename from plugins/tasklist/tasklist-plugin.h
rename to plugins/tasklist.new/tasklist-plugin.h
diff --git a/plugins/tasklist/tasklist.desktop.in.in b/plugins/tasklist.new/tasklist.desktop.in.in
similarity index 100%
copy from plugins/tasklist/tasklist.desktop.in.in
copy to plugins/tasklist.new/tasklist.desktop.in.in
diff --git a/plugins/tasklist/.svn/all-wcprops b/plugins/tasklist/.svn/all-wcprops
new file mode 100644
index 0000000..c6749ff
--- /dev/null
+++ b/plugins/tasklist/.svn/all-wcprops
@@ -0,0 +1,41 @@
+K 25
+svn:wc:ra_dav:version-url
+V 59
+/svn/xfce/!svn/ver/26626/xfce4-panel/trunk/plugins/tasklist
+END
+tasklist-dialogs.c
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/xfce/!svn/ver/26151/xfce4-panel/trunk/plugins/tasklist/tasklist-dialogs.c
+END
+tasklist.c
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/xfce/!svn/ver/26626/xfce4-panel/trunk/plugins/tasklist/tasklist.c
+END
+tasklist.desktop.in.in
+K 25
+svn:wc:ra_dav:version-url
+V 82
+/svn/xfce/!svn/ver/25077/xfce4-panel/trunk/plugins/tasklist/tasklist.desktop.in.in
+END
+tasklist-dialogs.h
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/xfce/!svn/ver/26151/xfce4-panel/trunk/plugins/tasklist/tasklist-dialogs.h
+END
+tasklist.h
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/xfce/!svn/ver/26196/xfce4-panel/trunk/plugins/tasklist/tasklist.h
+END
+Makefile.am
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/xfce/!svn/ver/26151/xfce4-panel/trunk/plugins/tasklist/Makefile.am
+END
diff --git a/plugins/clock/.svn/dir-prop-base b/plugins/tasklist/.svn/dir-prop-base
similarity index 100%
copy from plugins/clock/.svn/dir-prop-base
copy to plugins/tasklist/.svn/dir-prop-base
diff --git a/plugins/tasklist/.svn/entries b/plugins/tasklist/.svn/entries
new file mode 100644
index 0000000..9befafc
--- /dev/null
+++ b/plugins/tasklist/.svn/entries
@@ -0,0 +1,105 @@
+8
+
+dir
+27067
+https://svn.xfce.org/svn/xfce/xfce4-panel/trunk/plugins/tasklist
+https://svn.xfce.org/svn/xfce
+
+
+
+2008-02-18T12:42:14.286349Z
+26626
+nick
+has-props
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+a0aa69c2-05f4-0310-b83c-d5d913b14636
+
+tasklist-dialogs.c
+file
+
+
+
+
+2008-06-15T12:56:00.000000Z
+f4dd58d0524ca5cc68d23ca4173997d5
+2007-10-20T10:33:12.393658Z
+26151
+nick
+has-props
+
+tasklist.c
+file
+
+
+
+
+2008-06-15T12:56:00.000000Z
+29dc6c90bd905757307790fed32ba3b7
+2008-02-18T12:42:14.286349Z
+26626
+nick
+has-props
+
+tasklist.desktop.in.in
+file
+
+
+
+
+2008-06-15T12:56:00.000000Z
+3983a8f3b117100e4e15d908345aa800
+2007-03-03T19:26:06.502344Z
+25077
+nick
+
+tasklist-dialogs.h
+file
+
+
+
+
+2008-06-15T12:56:00.000000Z
+088c89f1102afb320f664786053068bf
+2007-10-20T10:33:12.393658Z
+26151
+nick
+has-props
+
+tasklist.h
+file
+
+
+
+
+2008-06-15T12:56:00.000000Z
+c79ba6779946d02f19fa40dc8852ca2d
+2007-10-25T18:23:36.706614Z
+26196
+nick
+has-props
+
+Makefile.am
+file
+
+
+
+
+2008-06-15T12:56:00.000000Z
+4d19a72f6c0d13b2836336fafe78501c
+2007-10-20T10:33:12.393658Z
+26151
+nick
+has-props
+
diff --git a/plugins/clock/.svn/format b/plugins/tasklist/.svn/format
similarity index 100%
copy from plugins/clock/.svn/format
copy to plugins/tasklist/.svn/format
diff --git a/plugins/clock/.svn/prop-base/Makefile.am.svn-base b/plugins/tasklist/.svn/prop-base/Makefile.am.svn-base
similarity index 100%
copy from plugins/clock/.svn/prop-base/Makefile.am.svn-base
copy to plugins/tasklist/.svn/prop-base/Makefile.am.svn-base
diff --git a/plugins/clock/.svn/prop-base/Makefile.am.svn-base b/plugins/tasklist/.svn/prop-base/tasklist-dialogs.c.svn-base
similarity index 100%
copy from plugins/clock/.svn/prop-base/Makefile.am.svn-base
copy to plugins/tasklist/.svn/prop-base/tasklist-dialogs.c.svn-base
diff --git a/plugins/clock/.svn/prop-base/Makefile.am.svn-base b/plugins/tasklist/.svn/prop-base/tasklist-dialogs.h.svn-base
similarity index 100%
copy from plugins/clock/.svn/prop-base/Makefile.am.svn-base
copy to plugins/tasklist/.svn/prop-base/tasklist-dialogs.h.svn-base
diff --git a/plugins/clock/.svn/prop-base/Makefile.am.svn-base b/plugins/tasklist/.svn/prop-base/tasklist.c.svn-base
similarity index 100%
copy from plugins/clock/.svn/prop-base/Makefile.am.svn-base
copy to plugins/tasklist/.svn/prop-base/tasklist.c.svn-base
diff --git a/plugins/clock/.svn/prop-base/Makefile.am.svn-base b/plugins/tasklist/.svn/prop-base/tasklist.h.svn-base
similarity index 100%
copy from plugins/clock/.svn/prop-base/Makefile.am.svn-base
copy to plugins/tasklist/.svn/prop-base/tasklist.h.svn-base
diff --git a/plugins/tasklist/Makefile.am b/plugins/tasklist/.svn/text-base/Makefile.am.svn-base
similarity index 83%
copy from plugins/tasklist/Makefile.am
copy to plugins/tasklist/.svn/text-base/Makefile.am.svn-base
index bd7ad92..f330f63 100644
--- a/plugins/tasklist/Makefile.am
+++ b/plugins/tasklist/.svn/text-base/Makefile.am.svn-base
@@ -2,9 +2,9 @@
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_builddir) \
- -DBINDIR=\"$(bindir)\" \
-DG_LOG_DOMAIN=\"libtasklist\" \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
plugindir = \
@@ -14,15 +14,16 @@ plugin_LTLIBRARIES = \
libtasklist.la
libtasklist_la_SOURCES = \
- tasklist-box.c \
- tasklist-box.h \
- tasklist-plugin.c \
- tasklist-plugin.h
+ tasklist.c \
+ tasklist.h \
+ tasklist-dialogs.c \
+ tasklist-dialogs.h
libtasklist_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
- $(LIBXFCE4UI_CFLAGS) \
+ $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
libtasklist_la_LDFLAGS = \
@@ -39,7 +40,8 @@ libtasklist_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
- $(LIBXFCE4UI_LIBS)
+ $(LIBXFCEGUI4_LIBS) \
+ $(LIBWNCK_LIBS)
libtasklist_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la
diff --git a/plugins/tasklist/.svn/text-base/tasklist-dialogs.c.svn-base b/plugins/tasklist/.svn/text-base/tasklist-dialogs.c.svn-base
new file mode 100644
index 0000000..05368b7
--- /dev/null
+++ b/plugins/tasklist/.svn/text-base/tasklist-dialogs.c.svn-base
@@ -0,0 +1,232 @@
+/* $Id$
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "tasklist.h"
+#include "tasklist-dialogs.h"
+
+
+
+/* prototypes */
+static void tasklist_all_workspaces_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_grouping_changed (GtkComboBox *cb,
+ TasklistPlugin *tasklist);
+static void tasklist_expand_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_flat_buttons_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_show_handle_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_width_changed (GtkSpinButton *sb,
+ TasklistPlugin *tasklist);
+static void tasklist_dialog_response (GtkWidget *dlg,
+ gint reponse,
+ TasklistPlugin *tasklist);
+
+
+
+static void
+tasklist_all_workspaces_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->all_workspaces = gtk_toggle_button_get_active (tb);
+
+ wnck_tasklist_set_include_all_workspaces (WNCK_TASKLIST (tasklist->list),
+ tasklist->all_workspaces);
+}
+
+
+
+static void
+tasklist_grouping_changed (GtkComboBox *cb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->grouping = gtk_combo_box_get_active (cb);
+
+ wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist->list),
+ tasklist->grouping);
+}
+
+
+
+static void
+tasklist_expand_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->expand = gtk_toggle_button_get_active (tb);
+
+ xfce_panel_plugin_set_expand (tasklist->panel_plugin, tasklist->expand);
+}
+
+
+
+static void
+tasklist_flat_buttons_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->flat_buttons = gtk_toggle_button_get_active (tb);
+
+ wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->list),
+ tasklist->flat_buttons ?
+ GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
+}
+
+
+
+static void
+tasklist_show_handle_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->show_handles = gtk_toggle_button_get_active (tb);
+
+ if (tasklist->show_handles)
+ gtk_widget_show (tasklist->handle);
+ else
+ gtk_widget_hide (tasklist->handle);
+}
+
+
+
+static void
+tasklist_width_changed (GtkSpinButton *sb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->width = gtk_spin_button_get_value_as_int (sb);
+
+ gtk_widget_queue_resize (GTK_WIDGET (tasklist->panel_plugin));
+}
+
+
+
+static void
+tasklist_dialog_response (GtkWidget *dlg,
+ gint reponse,
+ TasklistPlugin *tasklist)
+{
+ g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), NULL);
+
+ gtk_widget_destroy (dlg);
+ xfce_panel_plugin_unblock_menu (tasklist->panel_plugin);
+ tasklist_plugin_write (tasklist);
+}
+
+
+
+void
+tasklist_dialogs_configure (TasklistPlugin *tasklist)
+{
+ GtkWidget *dlg, *mainvbox, *vbox, *frame, *cb,
+ *hbox, *label, *spin;
+
+ xfce_panel_plugin_block_menu (tasklist->panel_plugin);
+
+ dlg = xfce_titled_dialog_new_with_buttons (_("Task List"), NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_window_set_screen (GTK_WINDOW (dlg), gtk_widget_get_screen (GTK_WIDGET (tasklist->panel_plugin)));
+
+ g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), dlg);
+
+ gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
+ gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
+
+ g_signal_connect (G_OBJECT (dlg), "response",
+ G_CALLBACK (tasklist_dialog_response), tasklist);
+
+ gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
+
+ mainvbox = gtk_vbox_new (FALSE, 8);
+ gtk_container_set_border_width (GTK_CONTAINER (mainvbox), 5);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), mainvbox,
+ TRUE, TRUE, 0);
+
+ /* Size */
+ vbox = gtk_vbox_new (FALSE, 8);
+
+ frame = xfce_create_framebox_with_content (_("Appearance"), vbox);
+ gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new (FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Minimum Width:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ /* an arbitrary max of 4000 should be future proof, right? */
+ spin = gtk_spin_button_new_with_range (100, 4000, 10);
+ gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), tasklist->width);
+ g_signal_connect (G_OBJECT (spin), "value-changed",
+ G_CALLBACK (tasklist_width_changed), tasklist);
+
+ if (tasklist_using_xinerama (tasklist->panel_plugin))
+ {
+ cb = gtk_check_button_new_with_mnemonic (_("Use all available space"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->expand);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_expand_toggled), tasklist);
+ }
+
+ cb = gtk_check_button_new_with_mnemonic (_("Use flat buttons"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->flat_buttons);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_flat_buttons_toggled), tasklist);
+
+ cb = gtk_check_button_new_with_mnemonic (_("Show handle"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_handles);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_show_handle_toggled), tasklist);
+
+ /* Tasks */
+ vbox = gtk_vbox_new (FALSE, 8);
+
+ frame = xfce_create_framebox_with_content (_("Task List"), vbox);
+ gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
+
+ cb = gtk_check_button_new_with_mnemonic (_("Show tasks from _all workspaces"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->all_workspaces);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_all_workspaces_toggled), tasklist);
+
+ cb = gtk_combo_box_new_text ();
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+
+ /* keep order in sync with WnckTasklistGroupingType */
+ gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Never group tasks"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Automatically group tasks"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Always group tasks"));
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (cb), tasklist->grouping);
+
+ g_signal_connect (G_OBJECT (cb), "changed",
+ G_CALLBACK (tasklist_grouping_changed), tasklist);
+
+ gtk_widget_show_all (dlg);
+}
diff --git a/plugins/launcher/.svn/text-base/launcher-dialog.h.svn-base b/plugins/tasklist/.svn/text-base/tasklist-dialogs.h.svn-base
similarity index 50%
copy from plugins/launcher/.svn/text-base/launcher-dialog.h.svn-base
copy to plugins/tasklist/.svn/text-base/tasklist-dialogs.h.svn-base
index d7dcc25..fc6491d 100644
--- a/plugins/launcher/.svn/text-base/launcher-dialog.h.svn-base
+++ b/plugins/tasklist/.svn/text-base/tasklist-dialogs.h.svn-base
@@ -1,11 +1,10 @@
/* $Id$
*
- * Copyright © 2005-2007 Jasper Huijsmans <jasper at xfce.org>
- * Copyright (c) 2006-2007 Nick Schermer <nick at xfce.org>
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
*
* This program 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
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -13,14 +12,14 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef __XFCE_PANEL_LAUNCHER_DIALOG_H__
-#define __XFCE_PANEL_LAUNCHER_DIALOG_H__
+#ifndef __TASKLIST_DIALOGS_H__
+#define __TASKLIST_DIALOGS_H__
-void launcher_dialog_show (LauncherPlugin *launcher) G_GNUC_INTERNAL;
+void tasklist_dialogs_configure (TasklistPlugin *tasklist) G_GNUC_INTERNAL;
-#endif /* !__XFCE_PANEL_LAUNCHER_DIALOG_H__ */
+#endif /* !__TASKLIST_DIALOGS_H__ */
diff --git a/plugins/tasklist/.svn/text-base/tasklist.c.svn-base b/plugins/tasklist/.svn/text-base/tasklist.c.svn-base
new file mode 100644
index 0000000..6b4e330
--- /dev/null
+++ b/plugins/tasklist/.svn/text-base/tasklist.c.svn-base
@@ -0,0 +1,477 @@
+/* $Id$
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2007 Nick Schermer <nick at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <libwnck/libwnck.h>
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4panel/xfce-hvbox.h>
+
+#include "tasklist.h"
+#include "tasklist-dialogs.h"
+
+#define TASKLIST_HANDLE_SIZE (8)
+
+
+/* prototypes */
+static gboolean tasklist_handle_exposed (GtkWidget *widget,
+ GdkEventExpose *event,
+ TasklistPlugin *tasklist);
+static GdkPixbuf *tasklist_icon_loader (const gchar *name,
+ gint size,
+ guint flags,
+ TasklistPlugin *tasklist);
+static TasklistPlugin *tasklist_plugin_new (XfcePanelPlugin *panel_plugin);
+static void tasklist_plugin_screen_changed (TasklistPlugin *tasklist,
+ GdkScreen *previous_screen);
+static void tasklist_plugin_orientation_changed (TasklistPlugin *tasklist,
+ GtkOrientation orientation);
+static gboolean tasklist_plugin_size_changed (TasklistPlugin *tasklist,
+ guint size);
+static void tasklist_plugin_size_request (TasklistPlugin *tasklist,
+ GtkRequisition *requisition);
+static void tasklist_plugin_read (TasklistPlugin *tasklist);
+static void tasklist_plugin_free (TasklistPlugin *tasklist);
+static void tasklist_plugin_construct (XfcePanelPlugin *panel_plugin);
+
+
+
+/* register with the panel */
+XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (tasklist_plugin_construct);
+
+
+
+gboolean
+tasklist_using_xinerama (XfcePanelPlugin *panel_plugin)
+{
+ return (gdk_screen_get_n_monitors (gtk_widget_get_screen (GTK_WIDGET (panel_plugin))) > 1);
+}
+
+
+
+static gboolean
+tasklist_handle_exposed (GtkWidget *widget,
+ GdkEventExpose *event,
+ TasklistPlugin *tasklist)
+{
+ GtkOrientation orientation;
+ gint x, y, w, h;
+
+ if (GTK_WIDGET_DRAWABLE (widget))
+ {
+ /* get the panel orientation */
+ orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
+
+ /* set sizes */
+ x = widget->allocation.x;
+ y = widget->allocation.y;
+ w = widget->allocation.width;
+ h = widget->allocation.height;
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ y += widget->style->ythickness;
+ h -= 2 * widget->style->ythickness;
+ }
+ else
+ {
+ x += widget->style->xthickness;
+ w -= 2 * widget->style->xthickness;
+ }
+
+ gtk_paint_handle (widget->style, widget->window,
+ GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
+ &(event->area), widget, "handlebox",
+ x, y, w, h, orientation);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+static GdkPixbuf *
+tasklist_icon_loader (const gchar *name,
+ gint size,
+ guint flags,
+ TasklistPlugin *tasklist)
+{
+ GdkPixbuf *pixbuf = NULL;
+ gchar *base = NULL;
+ const gchar *p;
+
+ /* do nothing on invalid names */
+ if (G_UNLIKELY (name == NULL || *name == '\0'))
+ return NULL;
+
+ if (g_path_is_absolute (name))
+ {
+ if (g_file_test (name, G_FILE_TEST_EXISTS))
+ {
+ /* directly load the file */
+ pixbuf = gdk_pixbuf_new_from_file_at_size (name, size, size, NULL);
+ }
+ else
+ {
+ /* get the base name */
+ base = g_path_get_basename (name);
+
+ /* use this function to try again */
+ pixbuf = tasklist_icon_loader (base, size, flags, tasklist);
+
+ /* cleanup */
+ g_free (base);
+ }
+ }
+ else
+ {
+ /* strip prefix */
+ p = strrchr (name, '.');
+ if (G_UNLIKELY (p))
+ base = g_strndup (name, p - name);
+
+ /* load the icon */
+ pixbuf = gtk_icon_theme_load_icon (tasklist->icon_theme, base ? base : name, size, 0, NULL);
+
+ /* cleanup */
+ g_free (base);
+ }
+
+ return pixbuf;
+}
+
+
+
+static TasklistPlugin *
+tasklist_plugin_new (XfcePanelPlugin *panel_plugin)
+{
+ TasklistPlugin *tasklist;
+ GdkScreen *screen;
+ gint screen_n;
+
+ /* allocate structure */
+ tasklist = panel_slice_new0 (TasklistPlugin);
+
+ /* init data */
+ tasklist->panel_plugin = panel_plugin;
+
+ /* read settings */
+ tasklist_plugin_read (tasklist);
+
+ /* create hvbox */
+ tasklist->box = xfce_hvbox_new (xfce_panel_plugin_get_orientation (panel_plugin), FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (panel_plugin), tasklist->box);
+ gtk_widget_show (tasklist->box);
+
+ /* create handle */
+ tasklist->handle = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
+ gtk_widget_set_size_request (tasklist->handle, TASKLIST_HANDLE_SIZE, TASKLIST_HANDLE_SIZE);
+ gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->handle, FALSE, FALSE, 0);
+ g_signal_connect (tasklist->handle, "expose-event", G_CALLBACK (tasklist_handle_exposed), tasklist);
+ if (tasklist->show_handles)
+ gtk_widget_show (tasklist->handle);
+
+ /* get the current screen number */
+ screen = gtk_widget_get_screen (GTK_WIDGET (panel_plugin));
+ screen_n = gdk_screen_get_number (screen);
+
+ /* set the icon theme */
+ tasklist->icon_theme = gtk_icon_theme_get_for_screen (screen);
+
+ /* create tasklist */
+ tasklist->list = wnck_tasklist_new (wnck_screen_get (screen_n));
+ gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->list, FALSE, FALSE, 0);
+ gtk_widget_show (tasklist->list);
+
+ /* set the tasklist settings */
+ wnck_tasklist_set_include_all_workspaces (WNCK_TASKLIST (tasklist->list), tasklist->all_workspaces);
+ wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist->list), tasklist->grouping);
+ wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->list), tasklist->flat_buttons ? GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
+ wnck_tasklist_set_icon_loader (WNCK_TASKLIST (tasklist->list), (WnckLoadIconFunction) tasklist_icon_loader, tasklist, NULL);
+
+ return tasklist;
+}
+
+
+
+static void
+tasklist_plugin_screen_changed (TasklistPlugin *tasklist,
+ GdkScreen *previous_screen)
+{
+ GdkScreen *screen;
+ WnckScreen *wnck_screen;
+
+ /* get the new screen */
+ screen = gtk_widget_get_screen (GTK_WIDGET (tasklist->panel_plugin));
+ if (G_UNLIKELY (screen == NULL))
+ screen = gdk_screen_get_default ();
+
+ /* get the wnck screen */
+ wnck_screen = wnck_screen_get (gdk_screen_get_number (screen));
+
+ /* set the new tasklist screen */
+ wnck_tasklist_set_screen (WNCK_TASKLIST (tasklist->list), wnck_screen);
+
+ /* set the icon theme */
+ tasklist->icon_theme = gtk_icon_theme_get_for_screen (screen);
+}
+
+
+
+static void
+tasklist_plugin_orientation_changed (TasklistPlugin *tasklist,
+ GtkOrientation orientation)
+{
+ /* set the new orientation of the hvbox */
+ xfce_hvbox_set_orientation (XFCE_HVBOX (tasklist->box), orientation);
+
+ /* redraw the handle */
+ gtk_widget_queue_draw (tasklist->handle);
+}
+
+
+
+gboolean
+tasklist_plugin_size_changed (TasklistPlugin *tasklist,
+ guint size)
+{
+ /* size is handled in the size_request function */
+ return TRUE;
+}
+
+
+
+static void
+tasklist_plugin_size_request (TasklistPlugin *tasklist,
+ GtkRequisition *requisition)
+{
+ const gint *size_hints;
+ gint length;
+ gint size;
+ GtkOrientation orientation;
+
+ /* get the size hints */
+ size_hints = wnck_tasklist_get_size_hint_list (WNCK_TASKLIST (tasklist->list), &length);
+
+ /* check for pairs of 2 */
+ if (G_LIKELY (length > 0))
+ {
+ /* get the first size */
+ size = size_hints[0];
+
+ /* add the handle size */
+ if (tasklist->show_handles)
+ size += TASKLIST_HANDLE_SIZE;
+
+ /* use the requested size when it is bigger then the prefered size */
+ if (tasklist->width > size)
+ size = tasklist->width;
+
+ /* get plugin orientation */
+ orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
+
+ /* set the panel size */
+ requisition->width = requisition->height = xfce_panel_plugin_get_size (tasklist->panel_plugin);
+
+ /* set the requested plugin size */
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ requisition->width = size;
+ else
+ requisition->height = size;
+
+ /* save the requested size */
+ tasklist->req_size = size;
+ }
+}
+
+
+static void
+tasklist_plugin_size_allocate (TasklistPlugin *tasklist,
+ GtkAllocation *allocation)
+{
+ GtkOrientation orientation;
+ gint a_size, p_size;
+
+ /* get orientation */
+ orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
+
+ /* get plugin size */
+ p_size = xfce_panel_plugin_get_size (tasklist->panel_plugin);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ a_size = MIN (tasklist->req_size, allocation->width);
+ else
+ a_size = MIN (tasklist->req_size, allocation->height);
+
+ if (tasklist->show_handles)
+ a_size -= TASKLIST_HANDLE_SIZE;
+
+ /* force the size request of the taskbar */
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_widget_set_size_request (GTK_WIDGET (tasklist->list), a_size, p_size);
+ else
+ gtk_widget_set_size_request (GTK_WIDGET (tasklist->list), p_size, a_size);
+}
+
+
+static void
+tasklist_plugin_read (TasklistPlugin *tasklist)
+{
+ gchar *file;
+ XfceRc *rc;
+
+ /* set defaults */
+ tasklist->grouping = WNCK_TASKLIST_AUTO_GROUP;
+ tasklist->all_workspaces = FALSE;
+ tasklist->expand = TRUE;
+ tasklist->flat_buttons = TRUE;
+ tasklist->show_handles = TRUE;
+ tasklist->width = 300;
+
+ /* get rc file name */
+ file = xfce_panel_plugin_lookup_rc_file (tasklist->panel_plugin);
+
+ if (G_LIKELY (file))
+ {
+ /* open the file, readonly */
+ rc = xfce_rc_simple_open (file, TRUE);
+
+ /* cleanup */
+ g_free (file);
+
+ if (G_LIKELY (rc))
+ {
+ /* read settings */
+ tasklist->grouping = xfce_rc_read_int_entry (rc, "grouping", tasklist->grouping);
+ tasklist->all_workspaces = xfce_rc_read_bool_entry (rc, "all_workspaces", tasklist->all_workspaces);
+ tasklist->flat_buttons = xfce_rc_read_bool_entry (rc, "flat_buttons", tasklist->flat_buttons);
+ tasklist->show_handles = xfce_rc_read_bool_entry (rc, "show_handles", tasklist->show_handles);
+ tasklist->width = xfce_rc_read_int_entry (rc, "width",tasklist->width);
+
+ /* only set expand flag if xinerama is used */
+ if (tasklist_using_xinerama (tasklist->panel_plugin))
+ tasklist->expand = xfce_rc_read_bool_entry (rc, "expand", tasklist->expand);
+
+ /* close the rc file */
+ xfce_rc_close (rc);
+ }
+ }
+}
+
+
+
+void
+tasklist_plugin_write (TasklistPlugin *tasklist)
+{
+ gchar *file;
+ XfceRc *rc;
+
+ /* get rc file name, create it if needed */
+ file = xfce_panel_plugin_save_location (tasklist->panel_plugin, TRUE);
+
+ if (G_LIKELY (file))
+ {
+ /* open the file, writable */
+ rc = xfce_rc_simple_open (file, FALSE);
+
+ /* cleanup */
+ g_free (file);
+
+ if (G_LIKELY (rc))
+ {
+ /* write settings */
+ xfce_rc_write_int_entry (rc, "grouping", tasklist->grouping);
+ xfce_rc_write_int_entry (rc, "width", tasklist->width);
+ xfce_rc_write_bool_entry (rc, "all_workspaces", tasklist->all_workspaces);
+ xfce_rc_write_bool_entry (rc, "expand", tasklist->expand);
+ xfce_rc_write_bool_entry (rc, "flat_buttons", tasklist->flat_buttons);
+ xfce_rc_write_bool_entry (rc, "show_handles", tasklist->show_handles);
+
+ /* close the rc file */
+ xfce_rc_close (rc);
+ }
+ }
+}
+
+
+
+static void
+tasklist_plugin_free (TasklistPlugin *tasklist)
+{
+ GtkWidget *dialog;
+
+ /* destroy the dialog */
+ dialog = g_object_get_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"));
+ if (dialog)
+ gtk_widget_destroy (dialog);
+
+ /* disconnect screen changed signal */
+ g_signal_handler_disconnect (G_OBJECT (tasklist->panel_plugin), tasklist->screen_changed_id);
+
+ /* free slice */
+ panel_slice_free (TasklistPlugin, tasklist);
+}
+
+
+
+static void
+tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
+{
+ TasklistPlugin *tasklist;
+
+ /* create the tray panel plugin */
+ tasklist = tasklist_plugin_new (panel_plugin);
+
+ /* set the action widgets and show configure */
+ xfce_panel_plugin_add_action_widget (panel_plugin, tasklist->handle);
+ xfce_panel_plugin_menu_show_configure (panel_plugin);
+
+ /* whether to expand the plugin */
+ xfce_panel_plugin_set_expand (panel_plugin, tasklist->expand);
+
+ /* connect plugin signals */
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "orientation-changed",
+ G_CALLBACK (tasklist_plugin_orientation_changed), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-changed",
+ G_CALLBACK (tasklist_plugin_size_changed), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-request",
+ G_CALLBACK (tasklist_plugin_size_request), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-allocate",
+ G_CALLBACK (tasklist_plugin_size_allocate), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "save",
+ G_CALLBACK (tasklist_plugin_write), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "free-data",
+ G_CALLBACK (tasklist_plugin_free), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "configure-plugin",
+ G_CALLBACK (tasklist_dialogs_configure), tasklist);
+
+ /* screen changed signal */
+ tasklist->screen_changed_id =
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "screen-changed",
+ G_CALLBACK (tasklist_plugin_screen_changed), tasklist);
+}
diff --git a/plugins/tasklist/tasklist.desktop.in.in b/plugins/tasklist/.svn/text-base/tasklist.desktop.in.in.svn-base
similarity index 57%
copy from plugins/tasklist/tasklist.desktop.in.in
copy to plugins/tasklist/.svn/text-base/tasklist.desktop.in.in.svn-base
index 2d6b77d..dcb6ca4 100644
--- a/plugins/tasklist/tasklist.desktop.in.in
+++ b/plugins/tasklist/.svn/text-base/tasklist.desktop.in.in.svn-base
@@ -2,8 +2,8 @@
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
_Name=Task List
-_Comment=Switch between open windows using buttons
-Icon=preferences-system-windows
+_Comment=Show all running applications
+Icon=xfce4-taskbar
X-XFCE-Module=tasklist
X-XFCE-Module-Path=@libdir@/xfce4/panel-plugins
-X-XFCE-External=TRUE
+
diff --git a/plugins/tasklist/.svn/text-base/tasklist.h.svn-base b/plugins/tasklist/.svn/text-base/tasklist.h.svn-base
new file mode 100644
index 0000000..2f6fba8
--- /dev/null
+++ b/plugins/tasklist/.svn/text-base/tasklist.h.svn-base
@@ -0,0 +1,63 @@
+/* $Id$
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TASKLIST_H__
+#define __TASKLIST_H__
+
+#include <gtk/gtk.h>
+#include <libwnck/libwnck.h>
+#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4panel/xfce-panel-plugin.h>
+
+typedef struct _TasklistPlugin TasklistPlugin;
+
+struct _TasklistPlugin
+{
+ /* the panel plugin */
+ XfcePanelPlugin *panel_plugin;
+
+ /* widgets */
+ GtkWidget *box;
+ GtkWidget *handle;
+ GtkWidget *list;
+
+ /* signals */
+ gint screen_changed_id;
+
+ /* icon theme */
+ GtkIconTheme *icon_theme;
+
+ /* requested width */
+ gint req_size;
+
+ /* settings */
+ gint width;
+ WnckTasklistGroupingType grouping;
+ guint all_workspaces : 1;
+ guint show_label : 1;
+ guint expand : 1;
+ guint flat_buttons : 1;
+ guint show_handles : 1;
+};
+
+
+void tasklist_plugin_write (TasklistPlugin *tasklist) G_GNUC_INTERNAL;
+gboolean tasklist_using_xinerama (XfcePanelPlugin *panel_plugin) G_GNUC_INTERNAL;
+
+#endif /* !__TASKLIST_H__ */
diff --git a/plugins/tasklist/Makefile.am b/plugins/tasklist/Makefile.am
index bd7ad92..1acf417 100644
--- a/plugins/tasklist/Makefile.am
+++ b/plugins/tasklist/Makefile.am
@@ -2,9 +2,9 @@
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_builddir) \
- -DBINDIR=\"$(bindir)\" \
-DG_LOG_DOMAIN=\"libtasklist\" \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
plugindir = \
@@ -14,15 +14,16 @@ plugin_LTLIBRARIES = \
libtasklist.la
libtasklist_la_SOURCES = \
- tasklist-box.c \
- tasklist-box.h \
- tasklist-plugin.c \
- tasklist-plugin.h
+ tasklist.c \
+ tasklist.h \
+ tasklist-dialogs.c \
+ tasklist-dialogs.h
libtasklist_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
+ $(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
libtasklist_la_LDFLAGS = \
@@ -39,7 +40,8 @@ libtasklist_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
- $(LIBXFCE4UI_LIBS)
+ $(LIBXFCE4UI_LIBS) \
+ $(LIBWNCK_LIBS)
libtasklist_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la
diff --git a/plugins/tasklist/tasklist-dialogs.c b/plugins/tasklist/tasklist-dialogs.c
new file mode 100644
index 0000000..12d1e6c
--- /dev/null
+++ b/plugins/tasklist/tasklist-dialogs.c
@@ -0,0 +1,232 @@
+/* $Id: tasklist-dialogs.c 26151 2007-10-20 10:33:12Z nick $
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "tasklist.h"
+#include "tasklist-dialogs.h"
+
+
+
+/* prototypes */
+static void tasklist_all_workspaces_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_grouping_changed (GtkComboBox *cb,
+ TasklistPlugin *tasklist);
+static void tasklist_expand_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_flat_buttons_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_show_handle_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist);
+static void tasklist_width_changed (GtkSpinButton *sb,
+ TasklistPlugin *tasklist);
+static void tasklist_dialog_response (GtkWidget *dlg,
+ gint reponse,
+ TasklistPlugin *tasklist);
+
+
+
+static void
+tasklist_all_workspaces_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->all_workspaces = gtk_toggle_button_get_active (tb);
+
+ wnck_tasklist_set_include_all_workspaces (WNCK_TASKLIST (tasklist->list),
+ tasklist->all_workspaces);
+}
+
+
+
+static void
+tasklist_grouping_changed (GtkComboBox *cb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->grouping = gtk_combo_box_get_active (cb);
+
+ wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist->list),
+ tasklist->grouping);
+}
+
+
+
+static void
+tasklist_expand_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->expand = gtk_toggle_button_get_active (tb);
+
+ xfce_panel_plugin_set_expand (tasklist->panel_plugin, tasklist->expand);
+}
+
+
+
+static void
+tasklist_flat_buttons_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->flat_buttons = gtk_toggle_button_get_active (tb);
+
+ wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->list),
+ tasklist->flat_buttons ?
+ GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
+}
+
+
+
+static void
+tasklist_show_handle_toggled (GtkToggleButton *tb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->show_handles = gtk_toggle_button_get_active (tb);
+
+ if (tasklist->show_handles)
+ gtk_widget_show (tasklist->handle);
+ else
+ gtk_widget_hide (tasklist->handle);
+}
+
+
+
+static void
+tasklist_width_changed (GtkSpinButton *sb,
+ TasklistPlugin *tasklist)
+{
+ tasklist->width = gtk_spin_button_get_value_as_int (sb);
+
+ gtk_widget_queue_resize (GTK_WIDGET (tasklist->panel_plugin));
+}
+
+
+
+static void
+tasklist_dialog_response (GtkWidget *dlg,
+ gint reponse,
+ TasklistPlugin *tasklist)
+{
+ g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), NULL);
+
+ gtk_widget_destroy (dlg);
+ xfce_panel_plugin_unblock_menu (tasklist->panel_plugin);
+ tasklist_plugin_write (tasklist);
+}
+
+
+
+void
+tasklist_dialogs_configure (TasklistPlugin *tasklist)
+{
+ GtkWidget *dlg, *mainvbox, *vbox, *frame, *cb,
+ *hbox, *label, *spin;
+
+ xfce_panel_plugin_block_menu (tasklist->panel_plugin);
+
+ dlg = xfce_titled_dialog_new_with_buttons (_("Task List"), NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_window_set_screen (GTK_WINDOW (dlg), gtk_widget_get_screen (GTK_WIDGET (tasklist->panel_plugin)));
+
+ g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), dlg);
+
+ gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
+ gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
+
+ g_signal_connect (G_OBJECT (dlg), "response",
+ G_CALLBACK (tasklist_dialog_response), tasklist);
+
+ gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
+
+ mainvbox = gtk_vbox_new (FALSE, 8);
+ gtk_container_set_border_width (GTK_CONTAINER (mainvbox), 5);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), mainvbox,
+ TRUE, TRUE, 0);
+
+ /* Size */
+ vbox = gtk_vbox_new (FALSE, 8);
+
+ frame = xfce_gtk_frame_box_new_with_content (_("Appearance"), vbox);
+ gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new (FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Minimum Width:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ /* an arbitrary max of 4000 should be future proof, right? */
+ spin = gtk_spin_button_new_with_range (100, 4000, 10);
+ gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), tasklist->width);
+ g_signal_connect (G_OBJECT (spin), "value-changed",
+ G_CALLBACK (tasklist_width_changed), tasklist);
+
+ if (tasklist_using_xinerama (tasklist->panel_plugin))
+ {
+ cb = gtk_check_button_new_with_mnemonic (_("Use all available space"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->expand);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_expand_toggled), tasklist);
+ }
+
+ cb = gtk_check_button_new_with_mnemonic (_("Use flat buttons"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->flat_buttons);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_flat_buttons_toggled), tasklist);
+
+ cb = gtk_check_button_new_with_mnemonic (_("Show handle"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_handles);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_show_handle_toggled), tasklist);
+
+ /* Tasks */
+ vbox = gtk_vbox_new (FALSE, 8);
+
+ frame = xfce_gtk_frame_box_new_with_content (_("Task List"), vbox);
+ gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
+
+ cb = gtk_check_button_new_with_mnemonic (_("Show tasks from _all workspaces"));
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->all_workspaces);
+ g_signal_connect (G_OBJECT (cb), "toggled",
+ G_CALLBACK (tasklist_all_workspaces_toggled), tasklist);
+
+ cb = gtk_combo_box_new_text ();
+ gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+
+ /* keep order in sync with WnckTasklistGroupingType */
+ gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Never group tasks"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Automatically group tasks"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Always group tasks"));
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (cb), tasklist->grouping);
+
+ g_signal_connect (G_OBJECT (cb), "changed",
+ G_CALLBACK (tasklist_grouping_changed), tasklist);
+
+ gtk_widget_show_all (dlg);
+}
diff --git a/plugins/tasklist/tasklist-dialogs.h b/plugins/tasklist/tasklist-dialogs.h
new file mode 100644
index 0000000..917a805
--- /dev/null
+++ b/plugins/tasklist/tasklist-dialogs.h
@@ -0,0 +1,25 @@
+/* $Id: tasklist-dialogs.h 26151 2007-10-20 10:33:12Z nick $
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TASKLIST_DIALOGS_H__
+#define __TASKLIST_DIALOGS_H__
+
+void tasklist_dialogs_configure (TasklistPlugin *tasklist) G_GNUC_INTERNAL;
+
+#endif /* !__TASKLIST_DIALOGS_H__ */
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
new file mode 100644
index 0000000..b402676
--- /dev/null
+++ b/plugins/tasklist/tasklist.c
@@ -0,0 +1,473 @@
+/* $Id: tasklist.c 26626 2008-02-18 12:42:14Z nick $
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2007 Nick Schermer <nick at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "tasklist.h"
+#include "tasklist-dialogs.h"
+
+#define TASKLIST_HANDLE_SIZE (8)
+
+
+/* prototypes */
+static gboolean tasklist_handle_exposed (GtkWidget *widget,
+ GdkEventExpose *event,
+ TasklistPlugin *tasklist);
+static GdkPixbuf *tasklist_icon_loader (const gchar *name,
+ gint size,
+ guint flags,
+ TasklistPlugin *tasklist);
+static TasklistPlugin *tasklist_plugin_new (XfcePanelPlugin *panel_plugin);
+static void tasklist_plugin_screen_changed (TasklistPlugin *tasklist,
+ GdkScreen *previous_screen);
+static void tasklist_plugin_orientation_changed (TasklistPlugin *tasklist,
+ GtkOrientation orientation);
+static gboolean tasklist_plugin_size_changed (TasklistPlugin *tasklist,
+ guint size);
+static void tasklist_plugin_size_request (TasklistPlugin *tasklist,
+ GtkRequisition *requisition);
+static void tasklist_plugin_read (TasklistPlugin *tasklist);
+static void tasklist_plugin_free (TasklistPlugin *tasklist);
+static void tasklist_plugin_construct (XfcePanelPlugin *panel_plugin);
+
+
+
+/* register with the panel */
+XFCE_PANEL_PLUGIN_REGISTER (tasklist_plugin_construct);
+
+
+
+gboolean
+tasklist_using_xinerama (XfcePanelPlugin *panel_plugin)
+{
+ return (gdk_screen_get_n_monitors (gtk_widget_get_screen (GTK_WIDGET (panel_plugin))) > 1);
+}
+
+
+
+static gboolean
+tasklist_handle_exposed (GtkWidget *widget,
+ GdkEventExpose *event,
+ TasklistPlugin *tasklist)
+{
+ GtkOrientation orientation;
+ gint x, y, w, h;
+
+ if (GTK_WIDGET_DRAWABLE (widget))
+ {
+ /* get the panel orientation */
+ orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
+
+ /* set sizes */
+ x = widget->allocation.x;
+ y = widget->allocation.y;
+ w = widget->allocation.width;
+ h = widget->allocation.height;
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ y += widget->style->ythickness;
+ h -= 2 * widget->style->ythickness;
+ }
+ else
+ {
+ x += widget->style->xthickness;
+ w -= 2 * widget->style->xthickness;
+ }
+
+ gtk_paint_handle (widget->style, widget->window,
+ GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
+ &(event->area), widget, "handlebox",
+ x, y, w, h, orientation);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+static GdkPixbuf *
+tasklist_icon_loader (const gchar *name,
+ gint size,
+ guint flags,
+ TasklistPlugin *tasklist)
+{
+ GdkPixbuf *pixbuf = NULL;
+ gchar *base = NULL;
+ const gchar *p;
+
+ /* do nothing on invalid names */
+ if (G_UNLIKELY (name == NULL || *name == '\0'))
+ return NULL;
+
+ if (g_path_is_absolute (name))
+ {
+ if (g_file_test (name, G_FILE_TEST_EXISTS))
+ {
+ /* directly load the file */
+ pixbuf = gdk_pixbuf_new_from_file_at_size (name, size, size, NULL);
+ }
+ else
+ {
+ /* get the base name */
+ base = g_path_get_basename (name);
+
+ /* use this function to try again */
+ pixbuf = tasklist_icon_loader (base, size, flags, tasklist);
+
+ /* cleanup */
+ g_free (base);
+ }
+ }
+ else
+ {
+ /* strip prefix */
+ p = strrchr (name, '.');
+ if (G_UNLIKELY (p))
+ base = g_strndup (name, p - name);
+
+ /* load the icon */
+ pixbuf = gtk_icon_theme_load_icon (tasklist->icon_theme, base ? base : name, size, 0, NULL);
+
+ /* cleanup */
+ g_free (base);
+ }
+
+ return pixbuf;
+}
+
+
+
+static TasklistPlugin *
+tasklist_plugin_new (XfcePanelPlugin *panel_plugin)
+{
+ TasklistPlugin *tasklist;
+ GdkScreen *screen;
+ gint screen_n;
+
+ /* allocate structure */
+ tasklist = g_slice_new0 (TasklistPlugin);
+
+ /* init data */
+ tasklist->panel_plugin = panel_plugin;
+
+ /* read settings */
+ tasklist_plugin_read (tasklist);
+
+ /* create hvbox */
+ tasklist->box = xfce_hvbox_new (xfce_panel_plugin_get_orientation (panel_plugin), FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (panel_plugin), tasklist->box);
+ gtk_widget_show (tasklist->box);
+
+ /* create handle */
+ tasklist->handle = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
+ gtk_widget_set_size_request (tasklist->handle, TASKLIST_HANDLE_SIZE, TASKLIST_HANDLE_SIZE);
+ gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->handle, FALSE, FALSE, 0);
+ g_signal_connect (tasklist->handle, "expose-event", G_CALLBACK (tasklist_handle_exposed), tasklist);
+ if (tasklist->show_handles)
+ gtk_widget_show (tasklist->handle);
+
+ /* get the current screen number */
+ screen = gtk_widget_get_screen (GTK_WIDGET (panel_plugin));
+ screen_n = gdk_screen_get_number (screen);
+
+ /* set the icon theme */
+ tasklist->icon_theme = gtk_icon_theme_get_for_screen (screen);
+
+ /* create tasklist */
+ tasklist->list = wnck_tasklist_new (wnck_screen_get (screen_n));
+ gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->list, FALSE, FALSE, 0);
+ gtk_widget_show (tasklist->list);
+
+ /* set the tasklist settings */
+ wnck_tasklist_set_include_all_workspaces (WNCK_TASKLIST (tasklist->list), tasklist->all_workspaces);
+ wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist->list), tasklist->grouping);
+ wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->list), tasklist->flat_buttons ? GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
+ wnck_tasklist_set_icon_loader (WNCK_TASKLIST (tasklist->list), (WnckLoadIconFunction) tasklist_icon_loader, tasklist, NULL);
+
+ return tasklist;
+}
+
+
+
+static void
+tasklist_plugin_screen_changed (TasklistPlugin *tasklist,
+ GdkScreen *previous_screen)
+{
+ GdkScreen *screen;
+ WnckScreen *wnck_screen;
+
+ /* get the new screen */
+ screen = gtk_widget_get_screen (GTK_WIDGET (tasklist->panel_plugin));
+ if (G_UNLIKELY (screen == NULL))
+ screen = gdk_screen_get_default ();
+
+ /* get the wnck screen */
+ wnck_screen = wnck_screen_get (gdk_screen_get_number (screen));
+
+ /* set the new tasklist screen */
+ wnck_tasklist_set_screen (WNCK_TASKLIST (tasklist->list), wnck_screen);
+
+ /* set the icon theme */
+ tasklist->icon_theme = gtk_icon_theme_get_for_screen (screen);
+}
+
+
+
+static void
+tasklist_plugin_orientation_changed (TasklistPlugin *tasklist,
+ GtkOrientation orientation)
+{
+ /* set the new orientation of the hvbox */
+ xfce_hvbox_set_orientation (XFCE_HVBOX (tasklist->box), orientation);
+
+ /* redraw the handle */
+ gtk_widget_queue_draw (tasklist->handle);
+}
+
+
+
+gboolean
+tasklist_plugin_size_changed (TasklistPlugin *tasklist,
+ guint size)
+{
+ /* size is handled in the size_request function */
+ return TRUE;
+}
+
+
+
+static void
+tasklist_plugin_size_request (TasklistPlugin *tasklist,
+ GtkRequisition *requisition)
+{
+ const gint *size_hints;
+ gint length;
+ gint size;
+ GtkOrientation orientation;
+
+ /* get the size hints */
+ size_hints = wnck_tasklist_get_size_hint_list (WNCK_TASKLIST (tasklist->list), &length);
+
+ /* check for pairs of 2 */
+ if (G_LIKELY (length > 0))
+ {
+ /* get the first size */
+ size = size_hints[0];
+
+ /* add the handle size */
+ if (tasklist->show_handles)
+ size += TASKLIST_HANDLE_SIZE;
+
+ /* use the requested size when it is bigger then the prefered size */
+ if (tasklist->width > size)
+ size = tasklist->width;
+
+ /* get plugin orientation */
+ orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
+
+ /* set the panel size */
+ requisition->width = requisition->height = xfce_panel_plugin_get_size (tasklist->panel_plugin);
+
+ /* set the requested plugin size */
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ requisition->width = size;
+ else
+ requisition->height = size;
+
+ /* save the requested size */
+ tasklist->req_size = size;
+ }
+}
+
+
+static void
+tasklist_plugin_size_allocate (TasklistPlugin *tasklist,
+ GtkAllocation *allocation)
+{
+ GtkOrientation orientation;
+ gint a_size, p_size;
+
+ /* get orientation */
+ orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
+
+ /* get plugin size */
+ p_size = xfce_panel_plugin_get_size (tasklist->panel_plugin);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ a_size = MIN (tasklist->req_size, allocation->width);
+ else
+ a_size = MIN (tasklist->req_size, allocation->height);
+
+ if (tasklist->show_handles)
+ a_size -= TASKLIST_HANDLE_SIZE;
+
+ /* force the size request of the taskbar */
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_widget_set_size_request (GTK_WIDGET (tasklist->list), a_size, p_size);
+ else
+ gtk_widget_set_size_request (GTK_WIDGET (tasklist->list), p_size, a_size);
+}
+
+
+static void
+tasklist_plugin_read (TasklistPlugin *tasklist)
+{
+ gchar *file;
+ XfceRc *rc;
+
+ /* set defaults */
+ tasklist->grouping = WNCK_TASKLIST_AUTO_GROUP;
+ tasklist->all_workspaces = FALSE;
+ tasklist->expand = TRUE;
+ tasklist->flat_buttons = TRUE;
+ tasklist->show_handles = TRUE;
+ tasklist->width = 300;
+
+ /* get rc file name */
+ file = xfce_panel_plugin_lookup_rc_file (tasklist->panel_plugin);
+
+ if (G_LIKELY (file))
+ {
+ /* open the file, readonly */
+ rc = xfce_rc_simple_open (file, TRUE);
+
+ /* cleanup */
+ g_free (file);
+
+ if (G_LIKELY (rc))
+ {
+ /* read settings */
+ tasklist->grouping = xfce_rc_read_int_entry (rc, "grouping", tasklist->grouping);
+ tasklist->all_workspaces = xfce_rc_read_bool_entry (rc, "all_workspaces", tasklist->all_workspaces);
+ tasklist->flat_buttons = xfce_rc_read_bool_entry (rc, "flat_buttons", tasklist->flat_buttons);
+ tasklist->show_handles = xfce_rc_read_bool_entry (rc, "show_handles", tasklist->show_handles);
+ tasklist->width = xfce_rc_read_int_entry (rc, "width",tasklist->width);
+
+ /* only set expand flag if xinerama is used */
+ if (tasklist_using_xinerama (tasklist->panel_plugin))
+ tasklist->expand = xfce_rc_read_bool_entry (rc, "expand", tasklist->expand);
+
+ /* close the rc file */
+ xfce_rc_close (rc);
+ }
+ }
+}
+
+
+
+void
+tasklist_plugin_write (TasklistPlugin *tasklist)
+{
+ gchar *file;
+ XfceRc *rc;
+
+ /* get rc file name, create it if needed */
+ file = xfce_panel_plugin_save_location (tasklist->panel_plugin, TRUE);
+
+ if (G_LIKELY (file))
+ {
+ /* open the file, writable */
+ rc = xfce_rc_simple_open (file, FALSE);
+
+ /* cleanup */
+ g_free (file);
+
+ if (G_LIKELY (rc))
+ {
+ /* write settings */
+ xfce_rc_write_int_entry (rc, "grouping", tasklist->grouping);
+ xfce_rc_write_int_entry (rc, "width", tasklist->width);
+ xfce_rc_write_bool_entry (rc, "all_workspaces", tasklist->all_workspaces);
+ xfce_rc_write_bool_entry (rc, "expand", tasklist->expand);
+ xfce_rc_write_bool_entry (rc, "flat_buttons", tasklist->flat_buttons);
+ xfce_rc_write_bool_entry (rc, "show_handles", tasklist->show_handles);
+
+ /* close the rc file */
+ xfce_rc_close (rc);
+ }
+ }
+}
+
+
+
+static void
+tasklist_plugin_free (TasklistPlugin *tasklist)
+{
+ GtkWidget *dialog;
+
+ /* destroy the dialog */
+ dialog = g_object_get_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"));
+ if (dialog)
+ gtk_widget_destroy (dialog);
+
+ /* disconnect screen changed signal */
+ g_signal_handler_disconnect (G_OBJECT (tasklist->panel_plugin), tasklist->screen_changed_id);
+
+ /* free slice */
+ g_slice_free (TasklistPlugin, tasklist);
+}
+
+
+
+static void
+tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
+{
+ TasklistPlugin *tasklist;
+
+ /* create the tray panel plugin */
+ tasklist = tasklist_plugin_new (panel_plugin);
+
+ /* set the action widgets and show configure */
+ xfce_panel_plugin_add_action_widget (panel_plugin, tasklist->handle);
+ xfce_panel_plugin_menu_show_configure (panel_plugin);
+
+ /* whether to expand the plugin */
+ xfce_panel_plugin_set_expand (panel_plugin, tasklist->expand);
+
+ /* connect plugin signals */
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "orientation-changed",
+ G_CALLBACK (tasklist_plugin_orientation_changed), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-changed",
+ G_CALLBACK (tasklist_plugin_size_changed), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-request",
+ G_CALLBACK (tasklist_plugin_size_request), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-allocate",
+ G_CALLBACK (tasklist_plugin_size_allocate), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "save",
+ G_CALLBACK (tasklist_plugin_write), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "free-data",
+ G_CALLBACK (tasklist_plugin_free), tasklist);
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "configure-plugin",
+ G_CALLBACK (tasklist_dialogs_configure), tasklist);
+
+ /* screen changed signal */
+ tasklist->screen_changed_id =
+ g_signal_connect_swapped (G_OBJECT (panel_plugin), "screen-changed",
+ G_CALLBACK (tasklist_plugin_screen_changed), tasklist);
+}
diff --git a/plugins/tasklist/tasklist.desktop.in.in b/plugins/tasklist/tasklist.desktop.in.in
index 2d6b77d..ebb3a1f 100644
--- a/plugins/tasklist/tasklist.desktop.in.in
+++ b/plugins/tasklist/tasklist.desktop.in.in
@@ -2,8 +2,8 @@
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
_Name=Task List
-_Comment=Switch between open windows using buttons
-Icon=preferences-system-windows
+_Comment=Show all running applications
+Icon=xfwm4
X-XFCE-Module=tasklist
X-XFCE-Module-Path=@libdir@/xfce4/panel-plugins
-X-XFCE-External=TRUE
+X-XFCE-External=FALSE
diff --git a/plugins/tasklist/tasklist.h b/plugins/tasklist/tasklist.h
new file mode 100644
index 0000000..989421d
--- /dev/null
+++ b/plugins/tasklist/tasklist.h
@@ -0,0 +1,64 @@
+/* $Id: tasklist.h 26196 2007-10-25 18:23:36Z nick $
+ *
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TASKLIST_H__
+#define __TASKLIST_H__
+
+#include <gtk/gtk.h>
+#include <libwnck/libwnck.h>
+#include <libxfce4ui/libxfce4ui.h>
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4panel/libxfce4panel.h>
+
+typedef struct _TasklistPlugin TasklistPlugin;
+
+struct _TasklistPlugin
+{
+ /* the panel plugin */
+ XfcePanelPlugin *panel_plugin;
+
+ /* widgets */
+ GtkWidget *box;
+ GtkWidget *handle;
+ GtkWidget *list;
+
+ /* signals */
+ gint screen_changed_id;
+
+ /* icon theme */
+ GtkIconTheme *icon_theme;
+
+ /* requested width */
+ gint req_size;
+
+ /* settings */
+ gint width;
+ WnckTasklistGroupingType grouping;
+ guint all_workspaces : 1;
+ guint show_label : 1;
+ guint expand : 1;
+ guint flat_buttons : 1;
+ guint show_handles : 1;
+};
+
+
+void tasklist_plugin_write (TasklistPlugin *tasklist) G_GNUC_INTERNAL;
+gboolean tasklist_using_xinerama (XfcePanelPlugin *panel_plugin) G_GNUC_INTERNAL;
+
+#endif /* !__TASKLIST_H__ */
diff --git a/wrapper/main.c b/wrapper/main.c
index 44c7d74..fae3542 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -64,7 +64,7 @@ main (gint argc, gchar **argv)
PluginConstructFunc construct_func;
XfcePanelPluginProvider *provider = NULL;
GtkWidget *plug;
-
+
/* set translation domain */
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -74,31 +74,31 @@ main (gint argc, gchar **argv)
/* initialize the gthread system */
if (!g_thread_supported ())
g_thread_init (NULL);
-
+
/* initialize gtk */
if (!gtk_init_with_args (&argc, &argv, "", (GOptionEntry *) option_entries, GETTEXT_PACKAGE, &error))
{
/* print error */
g_critical ("Failed to initialize GTK+: %s", error ? error->message : "Unable to open display");
-
+
/* cleanup */
if (G_LIKELY (error != NULL))
g_error_free (error);
-
+
/* leave */
return EXIT_FAILURE;
}
-
+
/* check arguments */
if (opt_filename == NULL || opt_socket_id == 0 || opt_name == NULL || opt_id == NULL)
{
/* print error */
g_critical ("One of the required arguments for the wrapper is missing");
-
+
/* leave */
return EXIT_FAILURE;
}
-
+
/* try to open the library */
library = g_module_open (opt_filename, 0);
if (G_LIKELY (library != NULL))
@@ -107,7 +107,7 @@ main (gint argc, gchar **argv)
if (g_module_symbol (library, "xfce_panel_plugin_init", (gpointer) &construct_func))
{
/* create the panel plugin */
- provider = (*construct_func) (opt_name, NULL, opt_id, gdk_screen_get_default ());
+ provider = (*construct_func) (opt_name, opt_id, NULL, gdk_screen_get_default ());
}
else
{
@@ -115,24 +115,24 @@ main (gint argc, gchar **argv)
g_critical ("Plugin '%s' lacks required symbol: %s", opt_display_name, g_module_error ());
}
}
-
+
if (G_LIKELY (provider != NULL))
{
/* create the plug */
plug = wrapper_plug_new (opt_socket_id, provider);
gtk_container_add (GTK_CONTAINER (plug), GTK_WIDGET (provider));
gtk_widget_show (plug);
-
+
/* show the plugin */
gtk_widget_show (GTK_WIDGET (provider));
-
+
/* enter the mainloop */
gtk_main ();
/* destroy the plug (and provider) */
gtk_widget_destroy (plug);
}
-
+
/* close the library */
if (G_LIKELY (library != NULL))
g_module_close (library);
More information about the Xfce4-commits
mailing list