[Xfce4-commits] [xfce/xfce4-panel] 01/73: diff from nick/gtk3 with minor clean up
noreply at xfce.org
noreply at xfce.org
Sun Feb 26 16:33:42 CET 2017
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.
commit c8f8041f870b8af619a8828be7705afdeb26225c
Author: Andrzej <ndrwrdck at gmail.com>
Date: Tue Oct 25 00:19:05 2016 +0100
diff from nick/gtk3 with minor clean up
---
common/Makefile.am | 4 +-
common/panel-private.h | 3 +
common/panel-utils.c | 27 +-
common/panel-utils.h | 2 +
configure.ac.in | 28 +-
docs/references/libxfce4panel-docs.xml | 1 -
docs/references/libxfce4panel-sections.txt | 18 -
docs/references/libxfce4panel.types | 1 -
libxfce4panel/Makefile.am | 45 +-
libxfce4panel/libxfce4panel-1.0.pc.in | 4 +-
libxfce4panel/libxfce4panel-2.0.pc.in | 4 +-
libxfce4panel/libxfce4panel.symbols | 10 -
libxfce4panel/xfce-arrow-button.c | 10 +-
libxfce4panel/xfce-panel-plugin.c | 9 +-
panel/Makefile.am | 10 +-
panel/main.c | 6 +-
panel/panel-application.c | 24 +-
panel/panel-base-window.c | 136 ++--
panel/panel-dbus-client.c | 5 +-
panel/panel-dbus-service.c | 3 +-
panel/panel-dialogs.c | 21 +-
panel/panel-item-dialog.c | 24 +-
panel/panel-itembar.c | 279 ++++---
panel/panel-module-factory.c | 7 +-
panel/panel-module.c | 11 +-
panel/panel-plugin-external-46.c | 131 ++--
panel/panel-plugin-external-wrapper.c | 2 +-
panel/panel-plugin-external.c | 18 +-
panel/panel-plugin-external.h | 1 +
panel/panel-preferences-dialog.c | 183 ++---
panel/panel-preferences-dialog.glade | 97 +--
panel/panel-tic-tac-toe.c | 55 +-
panel/panel-window.c | 855 +++++++--------------
panel/panel-window.h | 33 +-
plugins/actions/Makefile.am | 4 +-
plugins/actions/actions-dialog.glade | 2 +-
plugins/actions/actions.c | 83 +-
plugins/applicationsmenu/Makefile.am | 6 +-
.../applicationsmenu/applicationsmenu-dialog.glade | 2 +-
plugins/applicationsmenu/applicationsmenu.c | 609 +++++++++++----
plugins/clock/Makefile.am | 4 +-
plugins/clock/clock-analog.c | 95 ++-
plugins/clock/clock-binary.c | 311 ++++----
plugins/clock/clock-digital.c | 8 +-
plugins/clock/clock-fuzzy.c | 28 +-
plugins/clock/clock-lcd.c | 176 ++---
plugins/clock/clock-time.c | 73 +-
plugins/clock/clock.c | 192 +++--
plugins/directorymenu/Makefile.am | 4 +-
plugins/directorymenu/directorymenu-dialog.glade | 2 +-
plugins/directorymenu/directorymenu.c | 65 +-
plugins/launcher/Makefile.am | 4 +-
plugins/launcher/launcher-dialog.c | 42 +-
plugins/launcher/launcher-dialog.glade | 2 +-
plugins/launcher/launcher.c | 240 +++---
plugins/pager/Makefile.am | 4 +-
plugins/pager/pager-buttons.c | 48 +-
plugins/pager/pager-dialog.glade | 2 +-
plugins/pager/pager.c | 129 +---
plugins/separator/Makefile.am | 4 +-
plugins/separator/separator-dialog.glade | 2 +-
plugins/separator/separator.c | 114 +--
plugins/systray/Makefile.am | 4 +-
plugins/systray/systray-box.c | 195 +++--
plugins/systray/systray-dialog.glade | 2 +-
plugins/systray/systray-manager.c | 69 +-
plugins/systray/systray-socket.c | 108 ++-
plugins/systray/systray-socket.h | 5 +-
plugins/systray/systray.c | 127 ++-
plugins/tasklist/Makefile.am | 4 +-
plugins/tasklist/tasklist-dialog.glade | 293 +++----
plugins/tasklist/tasklist-widget.c | 425 +++++-----
plugins/tasklist/tasklist-widget.h | 12 -
plugins/tasklist/tasklist.c | 91 ++-
plugins/windowmenu/Makefile.am | 4 +-
plugins/windowmenu/windowmenu-dialog.glade | 2 +-
plugins/windowmenu/windowmenu.c | 65 +-
po/POTFILES.in | 23 +-
po/POTFILES.skip | 46 --
wrapper/Makefile.am | 36 +-
wrapper/wrapper-plug.c | 124 ++-
81 files changed, 2907 insertions(+), 3050 deletions(-)
diff --git a/common/Makefile.am b/common/Makefile.am
index dd2d971..3d2a3be 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -20,7 +20,6 @@ libpanel_common_la_SOURCES = \
libpanel_common_la_CFLAGS = \
$(XFCONF_CFLAGS) \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(PLATFORM_CFLAGS)
@@ -31,8 +30,7 @@ libpanel_common_la_LDFLAGS = \
libpanel_common_la_LIBADD = \
$(XFCONF_LIBS) \
$(GTK_LIBS) \
- $(LIBXFCE4UI_LIBS) \
- $(EXO_LIBS)
+ $(LIBXFCE4UI_LIBS)
EXTRA_DIST = \
panel-dbus.h \
diff --git a/common/panel-private.h b/common/panel-private.h
index cc669be..b26c685 100644
--- a/common/panel-private.h
+++ b/common/panel-private.h
@@ -69,6 +69,9 @@
#define TRANSPOSE_AREA(area) G_STMT_START { SWAP_INTEGER (area.width, area.height); \
SWAP_INTEGER (area.x, area.y); } G_STMT_END
+/* to avoid exo for gtk3 testing */
+#define panel_str_is_empty(string) ((string) == NULL || *(string) == '\0')
+
/* quick GList and GSList counting without traversing */
#define LIST_HAS_ONE_ENTRY(l) ((l) != NULL && (l)->next == NULL)
#define LIST_HAS_ONE_OR_NO_ENTRIES(l) ((l) == NULL || (l)->next == NULL)
diff --git a/common/panel-utils.c b/common/panel-utils.c
index a86978e..3f596cc 100644
--- a/common/panel-utils.c
+++ b/common/panel-utils.c
@@ -25,7 +25,6 @@
#endif
#include <libxfce4ui/libxfce4ui.h>
-#include <exo/exo.h>
#include <common/panel-private.h>
#include <common/panel-utils.h>
@@ -122,6 +121,10 @@ panel_utils_show_help (GtkWindow *parent,
gboolean
panel_utils_grab_available (void)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ /* TODO fix for gtk3 */
+ return TRUE;
+#else
GdkScreen *screen;
GdkWindow *root;
GdkGrabStatus grab_pointer = GDK_GRAB_FROZEN;
@@ -166,6 +169,7 @@ panel_utils_grab_available (void)
}
return grab_succeed;
+#endif
}
@@ -201,3 +205,24 @@ panel_utils_set_atk_info (GtkWidget *widget,
atk_object_set_description (object, description);
}
}
+
+
+
+static gboolean
+destroy_later (gpointer widget)
+{
+ gtk_widget_destroy (GTK_WIDGET (widget));
+ g_object_unref (G_OBJECT (widget));
+ return FALSE;
+}
+
+
+
+void
+panel_utils_destroy_later (GtkWidget *widget)
+{
+ panel_return_if_fail (GTK_IS_WIDGET (widget));
+
+ g_idle_add_full (G_PRIORITY_HIGH, destroy_later, widget, NULL);
+ g_object_ref_sink (G_OBJECT (widget));
+}
diff --git a/common/panel-utils.h b/common/panel-utils.h
index 70cbd3d..9a175c3 100644
--- a/common/panel-utils.h
+++ b/common/panel-utils.h
@@ -42,4 +42,6 @@ void panel_utils_set_atk_info (GtkWidget *widget,
const gchar *name,
const gchar *description);
+void panel_utils_destroy_later (GtkWidget *widget);
+
#endif /* !__PANEL_BUILDER_H__ */
diff --git a/configure.ac.in b/configure.ac.in
index 8a7032b..cb6b8e2 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -9,7 +9,7 @@ dnl ***************************
dnl *** Version information ***
dnl ***************************
m4_define([libxfce4panel_verinfo], [4:0:0]) dnl current:revision:age
-m4_define([libxfce4panel_version_api], [1.0])
+m4_define([libxfce4panel_version_api], [2.0])
m4_define([xfce4_panel_config_version], [2])
m4_define([xfce4_panel_version_major], [4])
m4_define([xfce4_panel_version_minor], [13])
@@ -129,25 +129,23 @@ dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.9.0])
XDT_CHECK_PACKAGE([GARCON], [garcon-1], [0.1.5])
-XDT_CHECK_PACKAGE([GARCON_GTK2], [garcon-gtk2-1], [0.3.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.11.0])
-XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.9.0])
-XDT_CHECK_PACKAGE([EXO], [exo-1], [0.7.2])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.13.0])
+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.12.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.16.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.24.0])
XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.24.0])
XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.24.0])
XDT_CHECK_PACKAGE([DBUS], [dbus-glib-1], [0.73])
XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.0.0])
-XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [2.30])
+XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-3.0], [3.0])
dnl ***********************************************************
-dnl *** Optional support for a GTK+3 version of the library ***
+dnl *** Optional support for a GTK+2 version of the library ***
dnl ***********************************************************
-XDT_CHECK_OPTIONAL_PACKAGE([GTK3],
- [gtk+-3.0], [3.2.0], [gtk3],
- [GTK+ 3 support], [no])
-AM_CONDITIONAL([ENABLE_GTK3_LIBRARY], [test "x$GTK3_FOUND" = "xyes"])
+XDT_CHECK_OPTIONAL_PACKAGE([GTK2],
+ [gtk+-2.0], [2.20.0], [gtk2],
+ [GTK+ 2 support])
+AM_CONDITIONAL([ENABLE_GTK2_LIBRARY], [test "x$GTK2_FOUND" = "xyes"])
dnl **********************************
dnl *** Optional GIO UNIX features ***
@@ -278,9 +276,9 @@ echo "Build Configuration:"
echo
echo "* Debug Support: $enable_debug"
echo "* GNU Visibility: $have_gnuc_visibility"
-if test x"$GTK3_FOUND" = x"yes"; then
-echo "* GTK+ 3 Support: yes"
+if test x"$GTK2_FOUND" = x"yes"; then
+echo "* GTK+ 2 Support: yes"
else
-echo "* GTK+ 3 Support: no"
+echo "* GTK+ 2 Support: no"
fi
echo
diff --git a/docs/references/libxfce4panel-docs.xml b/docs/references/libxfce4panel-docs.xml
index 16ff243..c6cec30 100644
--- a/docs/references/libxfce4panel-docs.xml
+++ b/docs/references/libxfce4panel-docs.xml
@@ -146,7 +146,6 @@
<para>This section describes the additional widgets provided by the <application>xfce4-panel</application> library.</para>
<xi:include href="xml/xfce-arrow-button.xml"/>
- <xi:include href="xml/xfce-hvbox.xml"/>
<xi:include href="xml/xfce-panel-image.xml"/>
</part>
diff --git a/docs/references/libxfce4panel-sections.txt b/docs/references/libxfce4panel-sections.txt
index f58be39..2bfc3fa 100644
--- a/docs/references/libxfce4panel-sections.txt
+++ b/docs/references/libxfce4panel-sections.txt
@@ -34,24 +34,6 @@ xfce_arrow_button_get_type
</SECTION>
<SECTION>
-<FILE>xfce-hvbox</FILE>
-XfceHVBox
-xfce_hvbox_new
-xfce_hvbox_set_orientation
-xfce_hvbox_get_orientation
-<SUBSECTION Standard>
-XfceHVBoxClass
-XFCE_TYPE_HVBOX
-XFCE_HVBOX
-XFCE_HVBOX_CLASS
-XFCE_IS_HVBOX
-XFCE_IS_HVBOX_CLASS
-XFCE_HVBOX_GET_CLASS
-<SUBSECTION Private>
-xfce_hvbox_get_type
-</SECTION>
-
-<SECTION>
<FILE>convenience</FILE>
xfce_panel_create_button
xfce_panel_create_toggle_button
diff --git a/docs/references/libxfce4panel.types b/docs/references/libxfce4panel.types
index bfdbd2f..c676220 100644
--- a/docs/references/libxfce4panel.types
+++ b/docs/references/libxfce4panel.types
@@ -1,6 +1,5 @@
#include <libxfce4panel/libxfce4panel.h>
xfce_arrow_button_get_type
-xfce_hvbox_get_type
xfce_panel_image_get_type
xfce_panel_plugin_get_type
diff --git a/libxfce4panel/Makefile.am b/libxfce4panel/Makefile.am
index 20b4e11..029e7f4 100644
--- a/libxfce4panel/Makefile.am
+++ b/libxfce4panel/Makefile.am
@@ -7,7 +7,7 @@ AM_CPPFLAGS = \
$(PLATFORM_CPPFLAGS)
lib_LTLIBRARIES = \
- libxfce4panel-1.0.la
+ libxfce4panel-2.0.la
libxfce4panel_public_built_sources = \
libxfce4panel-enum-types.h
@@ -37,34 +37,31 @@ libxfce4panel_includedir = \
libxfce4panel_include_HEADERS = \
$(libxfce4panel_public_built_sources) \
- $(libxfce4panel_headers) \
- xfce-hvbox.h
+ $(libxfce4panel_headers)
-libxfce4panel_1_0_la_SOURCES = \
+libxfce4panel_2_0_la_SOURCES = \
$(libxfce4panel_built_sources) \
$(libxfce4panel_headers) \
- xfce-hvbox.h \
libxfce4panel-config.c \
xfce-arrow-button.c \
- xfce-hvbox.c \
xfce-panel-convenience.c \
xfce-panel-plugin.c \
xfce-panel-plugin-provider.c \
xfce-panel-image.c
-libxfce4panel_1_0_la_CFLAGS = \
+libxfce4panel_2_0_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(PLATFORM_CFLAGS)
-libxfce4panel_1_0_la_LDFLAGS = \
+libxfce4panel_2_0_la_LDFLAGS = \
-no-undefined \
-export-dynamic \
-version-info $(LIBXFCE4PANEL_VERINFO) \
-export-symbols-regex '^[^_].*' \
$(PLATFORM_LDFLAGS)
-libxfce4panel_1_0_la_LIBADD = \
+libxfce4panel_2_0_la_LIBADD = \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
-lm
@@ -76,47 +73,49 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).pc
#
-# GTK+ 3 support library
+# Gtk+ 2 support library
#
-if ENABLE_GTK3_LIBRARY
+if ENABLE_GTK2_LIBRARY
-lib_LTLIBRARIES += libxfce4panel-2.0.la
+lib_LTLIBRARIES += libxfce4panel-1.0.la
-libxfce4panel2_includedir = \
- $(includedir)/xfce4/libxfce4panel-2.0/libxfce4panel
+libxfce4panel1_includedir = \
+ $(includedir)/xfce4/libxfce4panel-1.0/libxfce4panel
-libxfce4panel2_include_HEADERS = \
+libxfce4panel1_include_HEADERS = \
$(libxfce4panel_public_built_sources) \
- $(libxfce4panel_headers)
+ $(libxfce4panel_headers) \
+ xfce-hvbox.h
-libxfce4panel_2_0_la_SOURCES = \
+libxfce4panel_1_0_la_SOURCES = \
$(libxfce4panel_built_sources) \
$(libxfce4panel_headers) \
libxfce4panel-config.c \
xfce-arrow-button.c \
+ xfce-hvbox.c \
xfce-panel-convenience.c \
xfce-panel-plugin.c \
xfce-panel-plugin-provider.c \
xfce-panel-image.c
-libxfce4panel_2_0_la_CFLAGS = \
- $(GTK3_CFLAGS) \
+libxfce4panel_1_0_la_CFLAGS = \
+ $(GTK2_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(PLATFORM_CFLAGS)
-libxfce4panel_2_0_la_LDFLAGS = \
+libxfce4panel_1_0_la_LDFLAGS = \
-no-undefined \
-export-dynamic \
-version-info $(LIBXFCE4PANEL_VERINFO) \
-export-symbols-regex '^[^_].*' \
$(PLATFORM_LDFLAGS)
-libxfce4panel_2_0_la_LIBADD = \
- $(GTK3_LIBS) \
+libxfce4panel_1_0_la_LIBADD = \
+ $(GTK2_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
-lm
-pkgconfig_DATA += libxfce4panel-2.0.pc
+pkgconfig_DATA += libxfce4panel-1.0.pc
endif
diff --git a/libxfce4panel/libxfce4panel-1.0.pc.in b/libxfce4panel/libxfce4panel-1.0.pc.in
index f596d69..90423b6 100644
--- a/libxfce4panel/libxfce4panel-1.0.pc.in
+++ b/libxfce4panel/libxfce4panel-1.0.pc.in
@@ -9,5 +9,5 @@ Name: libxfce4panel
Description: Library for the Xfce Panel
Requires: gtk+-2.0 gmodule-2.0 glib-2.0 libxfce4util-1.0
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lxfce4panel- at LIBXFCE4PANEL_VERSION_API@
-Cflags: -I${includedir}/xfce4/libxfce4panel- at LIBXFCE4PANEL_VERSION_API@
+Libs: -L${libdir} -lxfce4panel-1.0
+Cflags: -I${includedir}/xfce4/libxfce4panel-1.0
diff --git a/libxfce4panel/libxfce4panel-2.0.pc.in b/libxfce4panel/libxfce4panel-2.0.pc.in
index 944a985..4f18f0f 100644
--- a/libxfce4panel/libxfce4panel-2.0.pc.in
+++ b/libxfce4panel/libxfce4panel-2.0.pc.in
@@ -9,5 +9,5 @@ Name: libxfce4panel
Description: Library for the Xfce Panel
Requires: gtk+-3.0 gmodule-2.0 glib-2.0 libxfce4util-1.0
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lxfce4panel-2.0
-Cflags: -I${includedir}/xfce4/libxfce4panel-2.0
+Libs: -L${libdir} -lxfce4panel- at LIBXFCE4PANEL_VERSION_API@
+Cflags: -I${includedir}/xfce4/libxfce4panel- at LIBXFCE4PANEL_VERSION_API@
diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols
index 34f1f97..0e45685 100644
--- a/libxfce4panel/libxfce4panel.symbols
+++ b/libxfce4panel/libxfce4panel.symbols
@@ -61,16 +61,6 @@ xfce_arrow_button_set_blinking
#endif
#endif
-/* xfce-hvbox.h */
-#if IN_HEADER(__XFCE_HVBOX_H__)
-#if IN_SOURCE(__XFCE_HVBOX_C__)
-xfce_hvbox_get_type G_GNUC_CONST
-xfce_hvbox_new G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
-xfce_hvbox_set_orientation
-xfce_hvbox_get_orientation
-#endif
-#endif
-
/* xfce-panel-convenience.h */
#if IN_HEADER(__XFCE_PANEL_CONVENIENCE_H__)
#if IN_SOURCE(__XFCE_PANEL_CONVENIENCE_C__)
diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index 7fbe831..c571256 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -602,12 +602,6 @@ static void
xfce_arrow_button_blinking_timeout_destroyed (gpointer user_data)
{
XfceArrowButton *button = XFCE_ARROW_BUTTON (user_data);
- GtkRcStyle *rc;
-
- rc = gtk_widget_get_modifier_style (GTK_WIDGET (button));
- gtk_button_set_relief (GTK_BUTTON (button), button->priv->last_relief);
- PANEL_UNSET_FLAG (rc->color_flags[GTK_STATE_NORMAL], GTK_RC_BG);
- gtk_widget_modify_style (GTK_WIDGET (button), rc);
button->priv->blinking_timeout_id = 0;
button->priv->blinking_counter = 0;
@@ -731,7 +725,6 @@ xfce_arrow_button_set_blinking (XfceArrowButton *button,
gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 500,
xfce_arrow_button_blinking_timeout, button,
xfce_arrow_button_blinking_timeout_destroyed);
- xfce_arrow_button_blinking_timeout (button);
}
}
else if (button->priv->blinking_timeout_id != 0)
@@ -739,6 +732,9 @@ xfce_arrow_button_set_blinking (XfceArrowButton *button,
/* stop the blinking timeout */
g_source_remove (button->priv->blinking_timeout_id);
}
+
+ /* start with a blinking or make sure the button is normal */
+ xfce_arrow_button_blinking_timeout (button);
}
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 9fb43d1..4fa0b1b 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -279,8 +279,6 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
*
* This signal is emmitted when the plugin is closing. Plugin
* writers should use this signal to free any allocated resources.
- *
- * See also #XfceHVBox.
**/
plugin_signals[FREE_DATA] =
g_signal_new (g_intern_static_string ("free-data"),
@@ -299,8 +297,6 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
* This signal is emmitted whenever the orientation of the panel
* the @plugin is on changes. Plugins writers can for example use
* this signal to change the order of widgets in the plugin.
- *
- * See also: #XfceHVBox.
**/
plugin_signals[ORIENTATION_CHANGED] =
g_signal_new (g_intern_static_string ("orientation-changed"),
@@ -715,7 +711,10 @@ xfce_panel_plugin_init (XfcePanelPlugin *plugin)
#endif
/* hide the event box window to make the plugin transparent */
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (plugin), FALSE);
+ // FIXME
+ // Temporarily disabled to workaround plugin transparency issues.
+ // It breaks background transparency and color support.
+ //gtk_event_box_set_visible_window (GTK_EVENT_BOX (plugin), FALSE);
}
diff --git a/panel/Makefile.am b/panel/Makefile.am
index 4184569..8c041b2 100644
--- a/panel/Makefile.am
+++ b/panel/Makefile.am
@@ -2,13 +2,11 @@
AM_CPPFLAGS = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"xfce4-panel\" \
- -DWNCK_I_KNOW_THIS_IS_UNSTABLE \
-DDATADIR=\"$(datadir)/xfce4\" \
-DLIBDIR=\"$(libdir)/xfce4\" \
-DHELPERDIR=\"$(HELPER_PATH_PREFIX)/xfce4/panel\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
-DDBUS_API_SUBJECT_TO_CHANGE \
- -DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
bin_PROGRAMS = \
@@ -59,14 +57,11 @@ xfce4_panel_SOURCES = \
xfce4_panel_CFLAGS = \
$(GTK_CFLAGS) \
$(GMODULE_CFLAGS) \
- $(EXO_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
- $(LIBWNCK_CFLAGS) \
$(DBUS_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBX11_CFLAGS) \
- $(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
xfce4_panel_LDFLAGS = \
@@ -77,15 +72,12 @@ xfce4_panel_LDADD = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(top_builddir)/common/libpanel-common.la \
$(GTK_LIBS) \
- $(EXO_LIBS) \
$(GMODULE_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
- $(LIBWNCK_LIBS) \
$(XFCONF_LIBS) \
$(DBUS_LIBS) \
$(LIBX11_LIBS) \
- $(LIBWNCK_LIBS) \
-lm
xfce4_panel_DEPENDENCIES = \
@@ -111,7 +103,7 @@ panel-plugin-external-wrapper-infos.h: $(srcdir)/panel-plugin-external-wrapper-i
$(AM_V_GEN) dbus-binding-tool --prefix=panel_plugin_external_wrapper --mode=glib-server $< > $@
panel-preferences-dialog-ui.h: $(srcdir)/panel-preferences-dialog.glade Makefile
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=panel_preferences_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=panel_preferences_dialog_ui $< >$@
#panel-marshal.h: $(srcdir)/panel-marshal.list Makefile
# $(AM_V_GEN) glib-genmarshal --header --prefix=panel_marshal $< > $@
diff --git a/panel/main.c b/panel/main.c
index 2761658..4ed389a 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -40,7 +40,6 @@
#include <dbus/dbus-glib.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
-#include <libwnck/libwnck.h>
#include <common/panel-private.h>
#include <common/panel-debug.h>
@@ -136,7 +135,7 @@ panel_signal_handler (gint signum)
panel_debug (PANEL_DEBUG_MAIN,
"received signal %s <%d>, %s panel",
g_strsignal (signum), signum,
- signum == SIGUSR1 ? "restarting" : "quitting");
+ signum == SIGUSR1 ? "restarting" : "quiting");
panel_dbus_service_exit_panel (signum == SIGUSR1);
}
@@ -339,9 +338,6 @@ main (gint argc, gchar **argv)
for (i = 0; i < G_N_ELEMENTS (signums); i++)
signal (signums[i], panel_signal_handler);
- /* set EWMH source indication */
- wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
-
application = panel_application_get ();
panel_application_load (application, opt_disable_wm_check);
diff --git a/panel/panel-application.c b/panel/panel-application.c
index 06ad96f..4235b6f 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -24,7 +24,6 @@
#include <stdlib.h>
#endif
-#include <exo/exo.h>
#include <glib/gstdio.h>
#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>
@@ -289,7 +288,7 @@ panel_application_xfconf_window_bindings (PanelApplication *application,
const PanelProperty properties[] =
{
{ "position-locked", G_TYPE_BOOLEAN },
- { "autohide-behavior", G_TYPE_UINT },
+ { "autohide", G_TYPE_BOOLEAN },
{ "span-monitors", G_TYPE_BOOLEAN },
{ "mode", G_TYPE_UINT },
{ "size", G_TYPE_UINT },
@@ -313,9 +312,6 @@ panel_application_xfconf_window_bindings (PanelApplication *application,
/* create the property base */
property_base = g_strdup_printf ("/panels/panel-%d", panel_window_get_id (window));
- /* migrate old autohide property */
- panel_window_migrate_autohide_property (window, application->xfconf, property_base);
-
/* bind all the properties */
panel_properties_bind (application->xfconf, G_OBJECT (window),
property_base, properties, save_properties);
@@ -509,9 +505,7 @@ panel_application_wait_for_window_manager_destroyed (gpointer data)
/* start loading the panels, hopefully a window manager is found, but it
* probably also works fine without... */
- GDK_THREADS_ENTER ();
panel_application_load_real (application);
- GDK_THREADS_LEAVE ();
}
#endif
@@ -528,7 +522,7 @@ panel_application_plugin_move_drag_data_get (GtkWidget *item,
/* set some data, we never use this, but GTK_DEST_DEFAULT_ALL
* used in the item dialog requires this */
gtk_selection_data_set (selection_data,
- selection_data->target, 8,
+ gtk_selection_data_get_target (selection_data), 8,
(const guchar *) "0", 1);
}
@@ -579,7 +573,7 @@ panel_application_plugin_move (GtkWidget *item,
module = panel_module_get_from_plugin_provider (XFCE_PANEL_PLUGIN_PROVIDER (item));
icon_name = panel_module_get_icon_name (module);
theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (item));
- if (!exo_str_is_empty (icon_name)
+ if (!panel_str_is_empty (icon_name)
&& gtk_icon_theme_has_icon (theme, icon_name))
gtk_drag_set_icon_name (context, icon_name, 0, 0);
else
@@ -603,7 +597,7 @@ panel_application_plugin_delete_config (PanelApplication *application,
gchar *filename, *path;
panel_return_if_fail (PANEL_IS_APPLICATION (application));
- panel_return_if_fail (!exo_str_is_empty (name));
+ panel_return_if_fail (!panel_str_is_empty (name));
panel_return_if_fail (unique_id != -1);
/* remove the xfconf property */
@@ -908,10 +902,10 @@ panel_application_drag_data_received (PanelWindow *window,
switch (info)
{
case TARGET_PLUGIN_NAME:
- if (G_LIKELY (selection_data->length > 0))
+ if (G_LIKELY (gtk_selection_data_get_length (selection_data) > 0))
{
/* create a new item with a unique id */
- name = (const gchar *) selection_data->data;
+ name = (const gchar *) gtk_selection_data_get_data (selection_data);
succeed = panel_application_plugin_insert (application, window, name,
-1, NULL, application->drop_index);
}
@@ -1220,8 +1214,8 @@ panel_application_load (PanelApplication *application,
/* setup timeout to check for a window manager */
application->wait_for_wm_timeout_id =
- g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 50, panel_application_wait_for_window_manager,
- wfwm, panel_application_wait_for_window_manager_destroyed);
+ gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 50, panel_application_wait_for_window_manager,
+ wfwm, panel_application_wait_for_window_manager_destroyed);
}
else
{
@@ -1523,7 +1517,7 @@ panel_application_new_window (PanelApplication *application,
/* add the itembar */
itembar = panel_itembar_new ();
for (i = 0; i < G_N_ELEMENTS (props); i++)
- exo_binding_new (G_OBJECT (window), props[i], G_OBJECT (itembar), props[i]);
+ g_object_bind_property (G_OBJECT (window), props[i], G_OBJECT (itembar), props[i], G_BINDING_DEFAULT);
gtk_container_add (GTK_CONTAINER (window), itembar);
gtk_widget_show (itembar);
diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 6064aee..6e41290 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -24,7 +24,8 @@
#include <math.h>
#endif
-#include <exo/exo.h>
+#include <gtk/gtk.h>
+
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <common/panel-private.h>
@@ -47,8 +48,8 @@ static void panel_base_window_set_property (GObject
static void panel_base_window_finalize (GObject *object);
static void panel_base_window_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
-static gboolean panel_base_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean panel_base_window_draw (GtkWidget *widget,
+ cairo_t *cr);
static gboolean panel_base_window_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean panel_base_window_leave_notify_event (GtkWidget *widget,
@@ -117,7 +118,7 @@ panel_base_window_class_init (PanelBaseWindowClass *klass)
gobject_class->finalize = panel_base_window_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->expose_event = panel_base_window_expose_event;
+ gtkwidget_class->draw = panel_base_window_draw;
gtkwidget_class->enter_notify_event = panel_base_window_enter_notify_event;
gtkwidget_class->leave_notify_event = panel_base_window_leave_notify_event;
gtkwidget_class->composited_changed = panel_base_window_composited_changed;
@@ -128,21 +129,21 @@ panel_base_window_class_init (PanelBaseWindowClass *klass)
g_param_spec_uint ("enter-opacity",
NULL, NULL,
0, 100, 100,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_LEAVE_OPACITY,
g_param_spec_uint ("leave-opacity",
NULL, NULL,
0, 100, 100,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BACKGROUND_ALPHA,
g_param_spec_uint ("background-alpha",
NULL, NULL,
0, 100, 100,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BACKGROUND_STYLE,
@@ -151,21 +152,21 @@ panel_base_window_class_init (PanelBaseWindowClass *klass)
PANEL_BG_STYLE_NONE,
PANEL_BG_STYLE_IMAGE,
PANEL_BG_STYLE_NONE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BACKGROUND_COLOR,
g_param_spec_boxed ("background-color",
NULL, NULL,
GDK_TYPE_COLOR,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BACKGROUND_IMAGE,
g_param_spec_string ("background-image",
NULL, NULL,
NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BORDERS,
@@ -173,21 +174,21 @@ panel_base_window_class_init (PanelBaseWindowClass *klass)
NULL, NULL,
0, G_MAXUINT,
PANEL_BORDER_NONE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ACTIVE,
g_param_spec_boolean ("active",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_COMPOSITED,
g_param_spec_boolean ("composited",
NULL, NULL,
FALSE,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
@@ -195,6 +196,8 @@ panel_base_window_class_init (PanelBaseWindowClass *klass)
static void
panel_base_window_init (PanelBaseWindow *window)
{
+ GtkStyleContext *context;
+
window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, PANEL_TYPE_BASE_WINDOW, PanelBaseWindowPrivate);
window->is_composited = FALSE;
@@ -215,6 +218,11 @@ panel_base_window_init (PanelBaseWindow *window)
/* set colormap */
panel_base_window_screen_changed (GTK_WIDGET (window), NULL);
+
+ /* set the panel class */
+ context = gtk_widget_get_style_context (GTK_WIDGET (window));
+ gtk_style_context_add_class (context, "panel");
+ gtk_style_context_add_class (context, "xfce4-panel");
}
@@ -228,6 +236,9 @@ panel_base_window_get_property (GObject *object,
PanelBaseWindow *window = PANEL_BASE_WINDOW (object);
PanelBaseWindowPrivate *priv = window->priv;
GdkColor *color;
+ GdkColor bg_color;
+ GdkRGBA bg_rgba;
+ GtkStyleContext *ctx;
switch (prop_id)
{
@@ -251,7 +262,14 @@ panel_base_window_get_property (GObject *object,
if (window->background_color != NULL)
color = window->background_color;
else
- color = &(GTK_WIDGET (window)->style->bg[GTK_STATE_NORMAL]);
+ {
+ ctx = gtk_widget_get_style_context (GTK_WIDGET (window));
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_rgba);
+ bg_color.red = CLAMP(bg_rgba.red * 65536, 65535, 0);
+ bg_color.green = CLAMP(bg_rgba.green * 65536, 65535, 0);
+ bg_color.blue = CLAMP(bg_rgba.blue * 65536, 65535, 0);
+ color = &bg_color;
+ }
g_value_set_boxed (value, color);
break;
@@ -392,7 +410,7 @@ panel_base_window_set_property (GObject *object,
if (priv->active_timeout_id == 0)
{
/* start timeout for the marching ants selection */
- priv->active_timeout_id = g_timeout_add_seconds_full (
+ priv->active_timeout_id = gdk_threads_add_timeout_seconds_full (
G_PRIORITY_DEFAULT_IDLE, 1,
panel_base_window_active_timeout, object,
panel_base_window_active_timeout_destroyed);
@@ -441,7 +459,7 @@ static void
panel_base_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen)
{
PanelBaseWindow *window = PANEL_BASE_WINDOW (widget);
- GdkColormap *colormap;
+ GdkVisual *visual;
GdkScreen *screen;
if (GTK_WIDGET_CLASS (panel_base_window_parent_class)->screen_changed != NULL)
@@ -449,58 +467,55 @@ panel_base_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen)
/* set the rgba colormap if supported by the screen */
screen = gtk_window_get_screen (GTK_WINDOW (window));
- colormap = gdk_screen_get_rgba_colormap (screen);
- if (colormap != NULL)
+ visual = gdk_screen_get_rgba_visual (screen);
+ if (visual != NULL)
{
- gtk_widget_set_colormap (widget, colormap);
+ gtk_widget_set_visual (widget, visual);
window->is_composited = gtk_widget_is_composited (widget);
}
panel_debug (PANEL_DEBUG_BASE_WINDOW,
- "%p: rgba colormap=%p, compositing=%s", window,
- colormap, PANEL_DEBUG_BOOL (window->is_composited));
+ "%p: rgba visual=%p, compositing=%s", window,
+ visual, PANEL_DEBUG_BOOL (window->is_composited));
}
static gboolean
-panel_base_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+panel_base_window_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- cairo_t *cr;
const GdkColor *color;
+ GdkRGBA bg_rgba;
+ GtkSymbolicColor *literal;
+ GtkSymbolicColor *shade;
PanelBaseWindow *window = PANEL_BASE_WINDOW (widget);
PanelBaseWindowPrivate *priv = window->priv;
gdouble alpha;
- gdouble width = widget->allocation.width;
- gdouble height = widget->allocation.height;
+ gdouble width = gtk_widget_get_allocated_width (widget);
+ gdouble height = gtk_widget_get_allocated_height (widget);
const gdouble dashes[] = { 4.00, 4.00 };
GTimeVal timeval;
GdkPixbuf *pixbuf;
GError *error = NULL;
cairo_matrix_t matrix = { 1, 0, 0, 1, 0, 0 }; /* identity matrix */
+ GtkStyleContext *ctx;
- if (!GTK_WIDGET_DRAWABLE (widget))
+ if (!gtk_widget_is_drawable (widget))
return FALSE;
+ ctx = gtk_widget_get_style_context (widget);
+
/* create cairo context and set some default properties */
- cr = gdk_cairo_create (widget->window);
- panel_return_val_if_fail (cr != NULL, FALSE);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_set_line_width (cr, 1.00);
- /* set rectangle to clip the drawing area */
- gdk_cairo_rectangle (cr, &event->area);
-
/* get background alpha */
alpha = window->is_composited ? window->background_alpha : 1.00;
if (window->background_style == PANEL_BG_STYLE_IMAGE)
{
- /* clip the drawing area */
- cairo_clip (cr);
-
if (G_LIKELY (priv->bg_image_cache != NULL))
{
if (G_UNLIKELY (priv->active_timeout_id != 0))
@@ -542,25 +557,22 @@ panel_base_window_expose_event (GtkWidget *widget,
/* get the background color */
if (window->background_style == PANEL_BG_STYLE_COLOR
&& window->background_color != NULL)
- color = window->background_color;
+ {
+ color = window->background_color;
+ panel_util_set_source_rgba (cr, color, alpha);
+ }
else
- color = &(widget->style->bg[GTK_STATE_NORMAL]);
+ {
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_rgba);
+ gdk_cairo_set_source_rgba (cr, &bg_rgba);
+ }
/* only do something with the background when compositing is enabled */
if (G_UNLIKELY (alpha < 1.00
|| window->background_style != PANEL_BG_STYLE_NONE))
{
- /* clip the drawing area, but preserve the rectangle */
- cairo_clip_preserve (cr);
-
/* draw the background */
- panel_util_set_source_rgba (cr, color, alpha);
- cairo_fill (cr);
- }
- else
- {
- /* clip the drawing area */
- cairo_clip (cr);
+ cairo_paint (cr);
}
}
@@ -584,8 +596,14 @@ panel_base_window_expose_event (GtkWidget *widget,
if (PANEL_HAS_FLAG (priv->borders, PANEL_BORDER_BOTTOM | PANEL_BORDER_RIGHT))
{
/* use dark color for buttom and right line */
- color = &(widget->style->dark[GTK_STATE_NORMAL]);
- panel_util_set_source_rgba (cr, color, alpha);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_rgba);
+ literal = gtk_symbolic_color_new_literal (&bg_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_unref (literal);
+ gtk_symbolic_color_resolve (shade, NULL, &bg_rgba);
+ gtk_symbolic_color_unref (shade);
+ bg_rgba.alpha = alpha;
+ gdk_cairo_set_source_rgba (cr, &bg_rgba);
if (PANEL_HAS_FLAG (priv->borders, PANEL_BORDER_BOTTOM))
{
@@ -605,8 +623,14 @@ panel_base_window_expose_event (GtkWidget *widget,
if (PANEL_HAS_FLAG (priv->borders, PANEL_BORDER_TOP | PANEL_BORDER_LEFT))
{
/* use light color for top and left line */
- color = &(widget->style->light[GTK_STATE_NORMAL]);
- panel_util_set_source_rgba (cr, color, alpha);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_rgba);
+ literal = gtk_symbolic_color_new_literal (&bg_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 1.3);
+ gtk_symbolic_color_unref (literal);
+ gtk_symbolic_color_resolve (shade, NULL, &bg_rgba);
+ gtk_symbolic_color_unref (shade);
+ bg_rgba.alpha = alpha;
+ gdk_cairo_set_source_rgba (cr, &bg_rgba);
if (PANEL_HAS_FLAG (priv->borders, PANEL_BORDER_LEFT))
{
@@ -624,8 +648,6 @@ panel_base_window_expose_event (GtkWidget *widget,
}
}
- cairo_destroy (cr);
-
return FALSE;
}
@@ -673,6 +695,7 @@ panel_base_window_composited_changed (GtkWidget *widget)
PanelBaseWindow *window = PANEL_BASE_WINDOW (widget);
gboolean was_composited = window->is_composited;
GdkWindow *gdkwindow;
+ GtkAllocation allocation;
/* set new compositing state */
window->is_composited = gtk_widget_is_composited (widget);
@@ -702,9 +725,10 @@ panel_base_window_composited_changed (GtkWidget *widget)
gdk_window_invalidate_rect (gdkwindow, NULL, TRUE);
/* HACK: invalid the geometry, so the wm notices it */
+ gtk_widget_get_allocation (widget, &allocation);
gtk_window_move (GTK_WINDOW (window),
- widget->allocation.x,
- widget->allocation.y);
+ allocation.x,
+ allocation.y);
gtk_widget_queue_resize (widget);
}
@@ -714,9 +738,7 @@ static gboolean
panel_base_window_active_timeout (gpointer user_data)
{
/* redraw to update marching ants */
- GDK_THREADS_ENTER ();
gtk_widget_queue_draw (GTK_WIDGET (user_data));
- GDK_THREADS_LEAVE ();
return TRUE;
}
diff --git a/panel/panel-dbus-client.c b/panel/panel-dbus-client.c
index 07214a2..b32b858 100644
--- a/panel/panel-dbus-client.c
+++ b/panel/panel-dbus-client.c
@@ -24,7 +24,6 @@
#include <stdlib.h>
#endif
-#include <exo/exo.h>
#include <dbus/dbus-glib.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
@@ -204,8 +203,8 @@ panel_dbus_client_plugin_event (const gchar *plugin_event,
n_tokens = g_strv_length (tokens);
if (!(n_tokens == 2 || n_tokens == N_TOKENS)
- || exo_str_is_empty (tokens[PLUGIN_NAME])
- || exo_str_is_empty (tokens[NAME]))
+ || panel_str_is_empty (tokens[PLUGIN_NAME])
+ || panel_str_is_empty (tokens[NAME]))
{
g_set_error_literal (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
_("Invalid plugin event syntax specified. "
diff --git a/panel/panel-dbus-service.c b/panel/panel-dbus-service.c
index 21537c5..03c575d 100644
--- a/panel/panel-dbus-service.c
+++ b/panel/panel-dbus-service.c
@@ -27,7 +27,6 @@
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include <exo/exo.h>
#include <common/panel-private.h>
#include <common/panel-dbus.h>
#include <libxfce4util/libxfce4util.h>
@@ -256,7 +255,7 @@ panel_dbus_service_add_new_item (PanelDBusService *service,
application = panel_application_get ();
- if (arguments != NULL && exo_str_is_empty (*arguments))
+ if (arguments != NULL && panel_str_is_empty (*arguments))
arguments = NULL;
/* add new plugin (with or without arguments) */
diff --git a/panel/panel-dialogs.c b/panel/panel-dialogs.c
index 9f6a0bd..dabea51 100644
--- a/panel/panel-dialogs.c
+++ b/panel/panel-dialogs.c
@@ -24,7 +24,6 @@
#include <string.h>
#endif
-#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
@@ -37,21 +36,28 @@
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void
panel_dialogs_show_about_email_hook (GtkAboutDialog *dialog,
const gchar *uri,
gpointer data)
{
+ GError *error = NULL;
+
if (g_strcmp0 ("tictactoe at xfce.org", uri) == 0)
{
/* open tic-tac-toe */
panel_tic_tac_toe_show ();
}
- else
+ else if (!gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (dialog)),
+ uri, gtk_get_current_event_time (), &error))
{
- exo_gtk_url_about_dialog_hook (dialog, uri, data);
+ xfce_dialog_show_error (GTK_WINDOW (dialog), error,
+ _("Unable to open the e-mail address"));
+ g_error_free (error);
}
}
+#endif
@@ -72,9 +78,8 @@ panel_dialogs_show_about (void)
"Jasper Huijsmans <jasper at xfce.org>",
"Tic-tac-toe <tictactoe at xfce.org>");
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_about_dialog_set_email_hook (panel_dialogs_show_about_email_hook, NULL, NULL);
-#if !GTK_CHECK_VERSION (2, 18, 0)
- gtk_about_dialog_set_url_hook (exo_gtk_url_about_dialog_hook, NULL, NULL);
#endif
gtk_show_about_dialog (NULL,
@@ -156,7 +161,7 @@ panel_dialogs_choose_panel (PanelApplication *application)
/* setup the dialog */
dialog = gtk_dialog_new_with_buttons (_("Add New Item"), NULL,
- GTK_DIALOG_NO_SEPARATOR,
+ 0,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -164,8 +169,8 @@ panel_dialogs_choose_panel (PanelApplication *application)
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
/* create widgets */
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_widget_show (vbox);
diff --git a/panel/panel-item-dialog.c b/panel/panel-item-dialog.c
index fe7e9ff..648dbb6 100644
--- a/panel/panel-item-dialog.c
+++ b/panel/panel-item-dialog.c
@@ -24,7 +24,6 @@
#include <string.h>
#endif
-#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
@@ -191,7 +190,6 @@ panel_item_dialog_init (PanelItemDialog *dialog)
xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog),
_("Add new plugins to the panel"));
gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 450);
gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_NORMAL);
@@ -203,13 +201,13 @@ panel_item_dialog_init (PanelItemDialog *dialog)
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
- main_vbox = gtk_vbox_new (FALSE, BORDER * 2);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER * 2);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_vbox);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), BORDER);
gtk_widget_show (main_vbox);
/* search widget */
- hbox = gtk_hbox_new (FALSE, BORDER);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -506,7 +504,7 @@ panel_item_dialog_drag_begin (GtkWidget *treeview,
/* set the drag icon */
icon_name = panel_module_get_icon_name (module);
theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (treeview));
- if (!exo_str_is_empty (icon_name)
+ if (!panel_str_is_empty (icon_name)
&& gtk_icon_theme_has_icon (theme, icon_name))
gtk_drag_set_icon_name (context, icon_name, 0, 0);
else
@@ -544,7 +542,7 @@ panel_item_dialog_drag_data_get (GtkWidget *treeview,
{
/* set the internal module name as selection data */
internal_name = panel_module_get_name (module);
- gtk_selection_data_set (selection_data, selection_data->target, 8,
+ gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8,
(guchar *) internal_name, strlen (internal_name));
g_object_unref (G_OBJECT (module));
}
@@ -636,14 +634,14 @@ panel_item_dialog_compare_func (GtkTreeModel *model,
/* don't move the separator */
result = 0;
}
- else if (exo_str_is_equal (LAUNCHER_PLUGIN_NAME,
- panel_module_get_name (module_a)))
+ else if (g_strcmp0 (LAUNCHER_PLUGIN_NAME,
+ panel_module_get_name (module_a)) == 0)
{
/* move the launcher to the first position */
result = -1;
}
- else if (exo_str_is_equal (LAUNCHER_PLUGIN_NAME,
- panel_module_get_name (module_b)))
+ else if (g_strcmp0 (LAUNCHER_PLUGIN_NAME,
+ panel_module_get_name (module_b)) == 0)
{
/* move the launcher to the first position */
result = 1;
@@ -690,7 +688,7 @@ panel_item_dialog_visible_func (GtkTreeModel *model,
/* search string from dialog */
text = gtk_entry_get_text (entry);
- if (G_UNLIKELY (exo_str_is_empty (text)))
+ if (G_UNLIKELY (panel_str_is_empty (text)))
return TRUE;
gtk_tree_model_get (model, iter, COLUMN_MODULE, &module, -1);
@@ -760,7 +758,7 @@ panel_item_dialog_text_renderer (GtkTreeViewColumn *column,
/* avoid (null) in markup string */
comment = panel_module_get_comment (module);
- if (exo_str_is_empty (comment))
+ if (panel_str_is_empty (comment))
comment = "";
name = panel_module_get_display_name (module);
diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index 98ffae1..2a25429 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -23,7 +23,6 @@
#include <math.h>
#include <gtk/gtk.h>
-#include <exo/exo.h>
#include <common/panel-private.h>
#include <libxfce4panel/libxfce4panel.h>
@@ -39,42 +38,49 @@ typedef struct _PanelItembarChild PanelItembarChild;
-static void panel_itembar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void panel_itembar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void panel_itembar_finalize (GObject *object);
-static void panel_itembar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void panel_itembar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gboolean panel_itembar_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static void panel_itembar_add (GtkContainer *container,
- GtkWidget *child);
-static void panel_itembar_remove (GtkContainer *container,
- GtkWidget *child);
-static void panel_itembar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-static GType panel_itembar_child_type (GtkContainer *container);
-static void panel_itembar_set_child_property (GtkContainer *container,
- GtkWidget *widget,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void panel_itembar_get_child_property (GtkContainer *container,
- GtkWidget *widget,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static PanelItembarChild *panel_itembar_get_child (PanelItembar *itembar,
- GtkWidget *widget);
+static void panel_itembar_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void panel_itembar_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void panel_itembar_finalize (GObject *object);
+static void panel_itembar_get_preferred_length (GtkWidget *widget,
+ gint *minimum_length,
+ gint *natural_length);
+static void panel_itembar_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+static void panel_itembar_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
+static void panel_itembar_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+static gboolean panel_itembar_draw (GtkWidget *widget,
+ cairo_t *cr);
+static void panel_itembar_add (GtkContainer *container,
+ GtkWidget *child);
+static void panel_itembar_remove (GtkContainer *container,
+ GtkWidget *child);
+static void panel_itembar_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
+static GType panel_itembar_child_type (GtkContainer *container);
+static void panel_itembar_set_child_property (GtkContainer *container,
+ GtkWidget *widget,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void panel_itembar_get_child_property (GtkContainer *container,
+ GtkWidget *widget,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static PanelItembarChild *panel_itembar_get_child (PanelItembar *itembar,
+ GtkWidget *widget);
@@ -161,9 +167,10 @@ panel_itembar_class_init (PanelItembarClass *klass)
gobject_class->finalize = panel_itembar_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = panel_itembar_size_request;
+ gtkwidget_class->get_preferred_width = panel_itembar_get_preferred_width;
+ gtkwidget_class->get_preferred_height = panel_itembar_get_preferred_height;
gtkwidget_class->size_allocate = panel_itembar_size_allocate;
- gtkwidget_class->expose_event = panel_itembar_expose_event;
+ gtkwidget_class->draw = panel_itembar_draw;
gtkcontainer_class = GTK_CONTAINER_CLASS (klass);
gtkcontainer_class->add = panel_itembar_add;
@@ -187,42 +194,42 @@ panel_itembar_class_init (PanelItembarClass *klass)
NULL, NULL,
XFCE_TYPE_PANEL_PLUGIN_MODE,
XFCE_PANEL_PLUGIN_MODE_HORIZONTAL,
- EXO_PARAM_WRITABLE));
+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SIZE,
g_param_spec_uint ("size",
NULL, NULL,
16, 128, 30,
- EXO_PARAM_WRITABLE));
+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_NROWS,
g_param_spec_uint ("nrows",
NULL, NULL,
1, 6, 1,
- EXO_PARAM_WRITABLE));
+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
gtk_container_class_install_child_property (gtkcontainer_class,
CHILD_PROP_EXPAND,
g_param_spec_boolean ("expand",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gtk_container_class_install_child_property (gtkcontainer_class,
CHILD_PROP_SHRINK,
g_param_spec_boolean ("shrink",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS));
gtk_container_class_install_child_property (gtkcontainer_class,
CHILD_PROP_SMALL,
g_param_spec_boolean ("small",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -237,7 +244,7 @@ panel_itembar_init (PanelItembar *itembar)
itembar->highlight_index = -1;
itembar->highlight_length = -1;
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (itembar), GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (itembar), FALSE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (itembar), FALSE);
}
@@ -300,29 +307,27 @@ panel_itembar_finalize (GObject *object)
(*G_OBJECT_CLASS (panel_itembar_parent_class)->finalize) (object);
}
-#define CHILD_LENGTH(child_req, itembar) \
- (IS_HORIZONTAL (itembar) ? child_req.width : child_req.height)
-
static void
-panel_itembar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+panel_itembar_get_preferred_length (GtkWidget *widget,
+ gint *minimum_length,
+ gint *natural_length)
{
PanelItembar *itembar = PANEL_ITEMBAR (widget);
GSList *li;
PanelItembarChild *child;
- GtkRequisition child_req;
gint border_width;
- gint row_max_size;
+ gint row_max_size, row_max_size_min;
gint col_count;
- gint rows_size;
- gint total_len;
- gint child_len;
+ gint total_len, total_len_min;
+ gint child_len, child_len_min;
/* total length we request */
total_len = 0;
+ total_len_min = 0;
/* counter for small child packing */
row_max_size = 0;
+ row_max_size_min = 0;
col_count = 0;
for (li = itembar->children; li != NULL; li = li->next)
@@ -331,24 +336,27 @@ panel_itembar_size_request (GtkWidget *widget,
if (G_LIKELY (child != NULL))
{
- if (!GTK_WIDGET_VISIBLE (child->widget))
+ if (!gtk_widget_get_visible (child->widget))
continue;
/* get the child's size request */
- gtk_widget_size_request (child->widget, &child_req);
+ if (IS_HORIZONTAL (itembar))
+ gtk_widget_get_preferred_width (child->widget, &child_len_min, &child_len);
+ else
+ gtk_widget_get_preferred_height (child->widget, &child_len_min, &child_len);
/* check if the small child fits in a row */
if (child->option == CHILD_OPTION_SMALL
&& itembar->nrows > 1)
{
- child_len = CHILD_LENGTH (child_req, itembar);
-
/* make sure we have enough space for all the children on the row.
* so add the difference between the largest child in this column */
if (child_len > row_max_size)
{
total_len += child_len - row_max_size;
+ total_len_min += child_len_min - row_max_size_min;
row_max_size = child_len;
+ row_max_size_min = child_len_min;
}
/* reset to new row if all columns are filled */
@@ -356,38 +364,89 @@ panel_itembar_size_request (GtkWidget *widget,
{
col_count = 0;
row_max_size = 0;
+ row_max_size_min = 0;
}
}
else /* expanding or normal item */
{
- total_len += CHILD_LENGTH (child_req, itembar);
+ total_len += child_len;
+ total_len_min += child_len_min;
/* reset column packing */
col_count = 0;
row_max_size = 0;
+ row_max_size_min = 0;
}
}
else
{
/* this noop item is the dnd position */
total_len += HIGHLIGHT_SIZE;
+ total_len_min += HIGHLIGHT_SIZE;
}
}
- /* the size property stored in the itembar is that of a single row */
- rows_size = itembar->size * itembar->nrows;
-
/* return the total size */
- border_width = GTK_CONTAINER (widget)->border_width * 2;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
+
+ if (natural_length != NULL)
+ *natural_length = total_len + border_width;
+
+ if (minimum_length != NULL)
+ *minimum_length = total_len + border_width;
+}
+
+
+
+static void
+panel_itembar_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ PanelItembar *itembar = PANEL_ITEMBAR (widget);
+ gint size;
+
if (IS_HORIZONTAL (itembar))
{
- requisition->width = total_len + border_width;
- requisition->height = rows_size + border_width;
+ panel_itembar_get_preferred_length (widget, minimum_width, natural_width);
}
else
{
- requisition->height = total_len + border_width;
- requisition->width = rows_size + border_width;
+ size = itembar->size * itembar->nrows +
+ gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
+
+ if (minimum_width != NULL)
+ *minimum_width = size;
+
+ if (natural_width != NULL)
+ *natural_width = size;
+ }
+}
+
+
+
+static void
+panel_itembar_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ PanelItembar *itembar = PANEL_ITEMBAR (widget);
+ gint size;
+
+ if (IS_HORIZONTAL (itembar))
+ {
+ size = itembar->size * itembar->nrows +
+ gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
+
+ if (minimum_height != NULL)
+ *minimum_height = size;
+
+ if (natural_height != NULL)
+ *natural_height = size;
+ }
+ else
+ {
+ panel_itembar_get_preferred_length (widget, minimum_height, natural_height);
}
}
@@ -400,7 +459,6 @@ panel_itembar_size_allocate (GtkWidget *widget,
PanelItembar *itembar = PANEL_ITEMBAR (widget);
GSList *lp, *ltemp;
PanelItembarChild *child;
- GtkRequisition child_req;
GtkAllocation child_alloc;
gint border_width;
gint expand_len_avail, expand_len_req;
@@ -410,16 +468,16 @@ panel_itembar_size_allocate (GtkWidget *widget,
gint x_init, y_init;
gboolean expand_children_fit;
gint new_len;
- gint child_len;
+ gint child_len, child_len_min;
gint row_max_size;
gint col_count;
gint rows_size;
/* the maximum allocation is limited by that of the
* panel window, so take over the assigned allocation */
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
if (IS_HORIZONTAL (itembar))
itembar_len = allocation->width - 2 * border_width;
@@ -444,12 +502,13 @@ panel_itembar_size_allocate (GtkWidget *widget,
child = lp->data;
if (G_LIKELY (child != NULL))
{
- if (!GTK_WIDGET_VISIBLE (child->widget))
+ if (!gtk_widget_get_visible (child->widget))
continue;
- gtk_widget_get_child_requisition (child->widget, &child_req);
-
- child_len = CHILD_LENGTH (child_req, itembar);
+ if (IS_HORIZONTAL (itembar))
+ gtk_widget_get_preferred_width (child->widget, &child_len_min, &child_len);
+ else
+ gtk_widget_get_preferred_height (child->widget, &child_len_min, &child_len);
if (G_UNLIKELY (child->option == CHILD_OPTION_SMALL
&& itembar->nrows > 1))
@@ -482,8 +541,8 @@ panel_itembar_size_allocate (GtkWidget *widget,
{
expand_len_avail -= child_len;
- if (child->option == CHILD_OPTION_SHRINK)
- shrink_len_avail += child_len;
+ if (child_len_min < child_len)
+ shrink_len_avail += (child_len - child_len_min);
}
}
}
@@ -534,8 +593,8 @@ panel_itembar_size_allocate (GtkWidget *widget,
if (itembar->highlight_small)
{
- itembar->highlight_x = x;
- itembar->highlight_y = y;
+ itembar->highlight_x = x - x_init;
+ itembar->highlight_y = y - y_init;
if (IS_HORIZONTAL (itembar))
y += HIGHLIGHT_SIZE;
else
@@ -543,16 +602,16 @@ panel_itembar_size_allocate (GtkWidget *widget,
}
else if (IS_HORIZONTAL (itembar))
{
- itembar->highlight_x = (col_count > 0) ? x + row_max_size : x;
- itembar->highlight_y = y_init;
+ itembar->highlight_x = ((col_count > 0) ? x + row_max_size : x) - x_init;
+ itembar->highlight_y = 0;
x += HIGHLIGHT_SIZE;
expand_len_avail -= HIGHLIGHT_SIZE;
}
else
{
- itembar->highlight_x = x_init;
- itembar->highlight_y = (col_count > 0) ? y + row_max_size : y;
+ itembar->highlight_x = 0;
+ itembar->highlight_y = ((col_count > 0) ? y + row_max_size : y) - y_init;
y += HIGHLIGHT_SIZE;
expand_len_avail -= HIGHLIGHT_SIZE;
@@ -561,12 +620,13 @@ panel_itembar_size_allocate (GtkWidget *widget,
continue;
}
- if (!GTK_WIDGET_VISIBLE (child->widget))
+ if (!gtk_widget_get_visible (child->widget))
continue;
- gtk_widget_get_child_requisition (child->widget, &child_req);
-
- child_len = CHILD_LENGTH (child_req, itembar);
+ if (IS_HORIZONTAL (itembar))
+ gtk_widget_get_preferred_width (child->widget, &child_len_min, &child_len);
+ else
+ gtk_widget_get_preferred_height (child->widget, &child_len_min, &child_len);
if (G_UNLIKELY (!expand_children_fit && child->option == CHILD_OPTION_EXPAND))
{
@@ -579,15 +639,15 @@ panel_itembar_size_allocate (GtkWidget *widget,
child_len = new_len;
}
- else if (child->option == CHILD_OPTION_SHRINK
+ else if (child_len_min < child_len
&& shrink_len_req > 0)
{
/* equally shrink all shrinking plugins */
panel_assert (shrink_len_avail > 0);
- new_len = shrink_len_req * child_len / shrink_len_avail;
-
+ new_len = MIN (shrink_len_req * (child_len - child_len_min) / shrink_len_avail,
+ child_len - child_len_min);
shrink_len_req -= new_len;
- shrink_len_avail -= child_len;
+ shrink_len_avail -= (child_len - child_len_min);
child_len -= new_len;
}
@@ -681,17 +741,15 @@ panel_itembar_size_allocate (GtkWidget *widget,
static gboolean
-panel_itembar_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+panel_itembar_draw (GtkWidget *widget,
+ cairo_t *cr)
{
PanelItembar *itembar = PANEL_ITEMBAR (widget);
gboolean result;
- cairo_t *cr;
- GdkWindow *window;
GdkRectangle rect;
gint row_size;
- result = (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->expose_event) (widget, event);
+ result = (*GTK_WIDGET_CLASS (panel_itembar_parent_class)->draw) (widget, cr);
if (itembar->highlight_index != -1)
{
@@ -715,17 +773,10 @@ panel_itembar_expose_event (GtkWidget *widget,
}
/* draw highlight box */
- window = gtk_widget_get_window (widget);
- cr = gdk_cairo_create (window);
cairo_set_source_rgb (cr, 1.00, 0.00, 0.00);
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
gdk_cairo_rectangle (cr, &rect);
cairo_fill (cr);
-
- cairo_destroy (cr);
}
return result;
@@ -751,7 +802,7 @@ panel_itembar_remove (GtkContainer *container,
panel_return_if_fail (PANEL_IS_ITEMBAR (itembar));
panel_return_if_fail (GTK_IS_WIDGET (widget));
- panel_return_if_fail (widget->parent == GTK_WIDGET (container));
+ panel_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (container));
panel_return_if_fail (itembar->children != NULL);
child = panel_itembar_get_child (itembar, widget);
@@ -899,7 +950,7 @@ panel_itembar_get_child (PanelItembar *itembar,
panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), NULL);
panel_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- panel_return_val_if_fail (widget->parent == GTK_WIDGET (itembar), NULL);
+ panel_return_val_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (itembar), NULL);
for (li = itembar->children; li != NULL; li = g_slist_next (li))
{
@@ -931,7 +982,7 @@ panel_itembar_insert (PanelItembar *itembar,
panel_return_if_fail (PANEL_IS_ITEMBAR (itembar));
panel_return_if_fail (GTK_IS_WIDGET (widget));
- panel_return_if_fail (widget->parent == NULL);
+ panel_return_if_fail (gtk_widget_get_parent (widget) == NULL);
child = g_slice_new0 (PanelItembarChild);
child->widget = widget;
@@ -955,7 +1006,7 @@ panel_itembar_reorder_child (PanelItembar *itembar,
panel_return_if_fail (PANEL_IS_ITEMBAR (itembar));
panel_return_if_fail (GTK_IS_WIDGET (widget));
- panel_return_if_fail (widget->parent == GTK_WIDGET (itembar));
+ panel_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (itembar));
child = panel_itembar_get_child (itembar, widget);
if (G_LIKELY (child != NULL))
@@ -981,7 +1032,7 @@ panel_itembar_get_child_index (PanelItembar *itembar,
panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), -1);
panel_return_val_if_fail (GTK_IS_WIDGET (widget), -1);
- panel_return_val_if_fail (widget->parent == GTK_WIDGET (itembar), -1);
+ panel_return_val_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (itembar), -1);
for (idx = 0, li = itembar->children; li != NULL; li = g_slist_next (li), idx++)
{
@@ -1029,7 +1080,7 @@ panel_itembar_get_drop_index (PanelItembar *itembar,
panel_return_val_if_fail (PANEL_IS_ITEMBAR (itembar), 0);
/* add the itembar position */
- alloc = GTK_WIDGET (itembar)->allocation;
+ gtk_widget_get_allocation (GTK_WIDGET (itembar), &alloc);
if (!IS_HORIZONTAL (itembar))
{
@@ -1055,7 +1106,7 @@ panel_itembar_get_drop_index (PanelItembar *itembar,
continue;
panel_assert (child->widget != NULL);
- alloc = child->widget->allocation;
+ gtk_widget_get_allocation (child->widget, &alloc);
if (!IS_HORIZONTAL (itembar))
TRANSPOSE_AREA (alloc);
@@ -1082,9 +1133,9 @@ panel_itembar_get_drop_index (PanelItembar *itembar,
panel_assert (child2->widget != NULL);
col_end_idx++;
if (IS_HORIZONTAL (itembar))
- col_width = MAX (col_width, child2->widget->allocation.width);
+ col_width = MAX (col_width, gtk_widget_get_allocated_width (child2->widget));
else
- col_width = MAX (col_width, child2->widget->allocation.height);
+ col_width = MAX (col_width, gtk_widget_get_allocated_height (child2->widget));
}
}
diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c
index 529fe85..c897bcc 100644
--- a/panel/panel-module-factory.c
+++ b/panel/panel-module-factory.c
@@ -28,7 +28,6 @@
#include <time.h>
#endif
-#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <common/panel-private.h>
@@ -203,7 +202,7 @@ panel_module_factory_load_modules_dir (PanelModuleFactory *factory,
/* check if this is the launcher */
if (!factory->has_launcher)
- factory->has_launcher = exo_str_is_equal (LAUNCHER_PLUGIN_NAME, internal_name);
+ factory->has_launcher = g_strcmp0 (LAUNCHER_PLUGIN_NAME, internal_name) == 0;
}
else
{
@@ -249,8 +248,8 @@ panel_module_factory_modules_cleanup (gpointer key,
/* if we're going to remove this item, check if it is the launcher */
if (remove_from_table
- && exo_str_is_equal (LAUNCHER_PLUGIN_NAME,
- panel_module_get_name (module)))
+ && g_strcmp0 (LAUNCHER_PLUGIN_NAME,
+ panel_module_get_name (module)) == 0)
factory->has_launcher = FALSE;
return remove_from_table;
diff --git a/panel/panel-module.c b/panel/panel-module.c
index 0be7096..48d9745 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -21,7 +21,6 @@
#endif
#include <gmodule.h>
-#include <exo/exo.h>
#include <glib/gstdio.h>
#include <libxfce4util/libxfce4util.h>
@@ -148,7 +147,7 @@ panel_module_init (PanelModule *module)
module->library = NULL;
module->construct_func = NULL;
module->plugin_type = G_TYPE_NONE;
- module->api = g_strdup (LIBXFCE4PANEL_VERSION_API);
+ module->api = NULL;
}
@@ -220,7 +219,6 @@ panel_module_load (GTypeModule *type_module)
/* from now on, run this plugin in a wrapper */
module->mode = WRAPPER;
- g_free (module->api);
module->api = g_strdup (LIBXFCE4PANEL_VERSION_API);
return FALSE;
@@ -311,8 +309,8 @@ panel_module_new_from_desktop_file (const gchar *filename,
const gchar *module_unique;
gboolean found;
- panel_return_val_if_fail (!exo_str_is_empty (filename), NULL);
- panel_return_val_if_fail (!exo_str_is_empty (name), NULL);
+ panel_return_val_if_fail (!panel_str_is_empty (filename), NULL);
+ panel_return_val_if_fail (!panel_str_is_empty (name), NULL);
rc = xfce_rc_simple_open (filename, TRUE);
if (G_UNLIKELY (rc == NULL))
@@ -369,8 +367,7 @@ panel_module_new_from_desktop_file (const gchar *filename,
if (force_external || !xfce_rc_read_bool_entry (rc, "X-XFCE-Internal", FALSE))
{
module->mode = WRAPPER;
- g_free (module->api);
- module->api = g_strdup (xfce_rc_read_entry (rc, "X-XFCE-API", LIBXFCE4PANEL_VERSION_API));
+ module->api = g_strdup (xfce_rc_read_entry (rc, "X-XFCE-API", "1.0"));
}
else
module->mode = INTERNAL;
diff --git a/panel/panel-plugin-external-46.c b/panel/panel-plugin-external-46.c
index c2d1c11..c115486 100644
--- a/panel/panel-plugin-external-46.c
+++ b/panel/panel-plugin-external-46.c
@@ -30,7 +30,6 @@
#include <math.h>
#endif
-#include <exo/exo.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <libxfce4util/libxfce4util.h>
@@ -49,17 +48,20 @@
-static void panel_plugin_external_46_finalize (GObject *object);
-static gboolean panel_plugin_external_46_client_event (GtkWidget *widget,
- GdkEventClient *event);
-static gchar **panel_plugin_external_46_get_argv (PanelPluginExternal *external,
- gchar **arguments);
-static void panel_plugin_external_46_set_properties (PanelPluginExternal *external,
- GSList *properties);
-static gboolean panel_plugin_external_46_remote_event (PanelPluginExternal *external,
- const gchar *name,
- const GValue *value,
- guint *handle);
+static void panel_plugin_external_46_finalize (GObject *object);
+static void panel_plugin_external_46_realize (GtkWidget *widget);
+static void panel_plugin_external_46_unrealize (GtkWidget *widget);
+static GdkFilterReturn panel_plugin_external_46_event_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data);
+static gchar **panel_plugin_external_46_get_argv (PanelPluginExternal *external,
+ gchar **arguments);
+static void panel_plugin_external_46_set_properties (PanelPluginExternal *external,
+ GSList *properties);
+static gboolean panel_plugin_external_46_remote_event (PanelPluginExternal *external,
+ const gchar *name,
+ const GValue *value,
+ guint *handle);
@@ -77,7 +79,7 @@ struct _PanelPluginExternal46
-static GdkAtom panel_atom = GDK_NONE;
+static Atom panel_atom = None;
@@ -96,14 +98,15 @@ panel_plugin_external_46_class_init (PanelPluginExternal46Class *klass)
gobject_class->finalize = panel_plugin_external_46_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->client_event = panel_plugin_external_46_client_event;
+ gtkwidget_class->realize = panel_plugin_external_46_realize;
+ gtkwidget_class->unrealize = panel_plugin_external_46_unrealize;
plugin_external_class = PANEL_PLUGIN_EXTERNAL_CLASS (klass);
plugin_external_class->get_argv = panel_plugin_external_46_get_argv;
plugin_external_class->set_properties = panel_plugin_external_46_set_properties;
plugin_external_class->remote_event = panel_plugin_external_46_remote_event;
- panel_atom = gdk_atom_intern_static_string (_PANEL_CLIENT_EVENT_ATOM);
+ panel_atom = XInternAtom( gdk_x11_get_default_xdisplay (), _PANEL_CLIENT_EVENT_ATOM, False);
}
@@ -128,16 +131,55 @@ panel_plugin_external_46_finalize (GObject *object)
-static gboolean
-panel_plugin_external_46_client_event (GtkWidget *widget,
- GdkEventClient *event)
+static void
+panel_plugin_external_46_realize (GtkWidget *widget)
+{
+ GdkWindow *window;
+
+ GTK_WIDGET_CLASS (panel_plugin_external_46_parent_class)->realize (widget);
+
+ window = gtk_widget_get_window (widget);
+ if (G_UNLIKELY (window == NULL))
+ return;
+
+ gdk_window_add_filter (window, panel_plugin_external_46_event_filter, widget);
+}
+
+
+
+static void
+panel_plugin_external_46_unrealize (GtkWidget *widget)
{
- PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (widget);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+ if (G_LIKELY (window != NULL))
+ {
+ gdk_window_remove_filter (window, panel_plugin_external_46_event_filter, NULL);
+ }
+
+ GTK_WIDGET_CLASS (panel_plugin_external_46_parent_class)->unrealize (widget);
+}
+
+
+
+static GdkFilterReturn
+panel_plugin_external_46_event_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ PanelPluginExternal *external = PANEL_PLUGIN_EXTERNAL (data);
gint provider_signal;
+ XClientMessageEvent *client_event;
- if (event->message_type == panel_atom)
+ if (((XEvent*)xevent)->type != ClientMessage)
+ return GDK_FILTER_CONTINUE;
+
+ client_event = (XClientMessageEvent*)xevent;
+
+ if (client_event->message_type == panel_atom)
{
- provider_signal = event->data.s[0];
+ provider_signal = client_event->data.s[0];
switch (provider_signal)
{
@@ -156,10 +198,10 @@ panel_plugin_external_46_client_event (GtkWidget *widget,
break;
}
- return FALSE;
+ return GDK_FILTER_REMOVE;
}
- return TRUE;
+ return GDK_FILTER_CONTINUE;
}
@@ -185,7 +227,7 @@ panel_plugin_external_46_get_argv (PanelPluginExternal *external,
argv[PLUGIN_ARGV_0] = g_strdup (panel_module_get_filename (external->module));
argv[PLUGIN_ARGV_FILENAME] = g_strdup (""); /* unused, for wrapper only */
argv[PLUGIN_ARGV_UNIQUE_ID] = g_strdup_printf ("%d", external->unique_id);;
- argv[PLUGIN_ARGV_SOCKET_ID] = g_strdup_printf ("%u", gtk_socket_get_id (GTK_SOCKET (external)));;
+ argv[PLUGIN_ARGV_SOCKET_ID] = g_strdup_printf ("%lu", gtk_socket_get_id (GTK_SOCKET (external)));;
argv[PLUGIN_ARGV_NAME] = g_strdup (panel_module_get_name (external->module));
argv[PLUGIN_ARGV_DISPLAY_NAME] = g_strdup (panel_module_get_display_name (external->module));
argv[PLUGIN_ARGV_COMMENT] = g_strdup (panel_module_get_comment (external->module));
@@ -213,24 +255,23 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external,
{
PanelPluginExternal46 *external46 = PANEL_PLUGIN_EXTERNAL_46 (external);
GSList *li;
- GdkEventClient event;
+ XEvent event;
PluginProperty *property;
GdkColor color = { 0, };
GdkWindow *window;
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL_46 (external));
- panel_return_if_fail (panel_atom != GDK_NONE);
+ panel_return_if_fail (panel_atom != None);
panel_return_if_fail (PANEL_IS_MODULE (external->module));
- if (!GTK_WIDGET_REALIZED (external))
+ if (!gtk_widget_get_realized (GTK_WIDGET (external)))
return;
- event.type = GDK_CLIENT_EVENT;
- panel_return_if_fail (GDK_IS_WINDOW (GTK_WIDGET (external)->window));
- event.window = GTK_WIDGET (external)->window;
- event.send_event = TRUE;
- event.message_type = panel_atom;
- event.data_format = 16;
+ event.xclient.type = ClientMessage;
+ panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (external))));
+ event.xclient.window = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (external)));
+ event.xclient.message_type = panel_atom;
+ event.xclient.format = 16;
gdk_error_trap_push ();
@@ -238,7 +279,7 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external,
{
property = li->data;
- event.data.s[0] = property->type;
+ event.xclient.data.s[0] = property->type;
switch (property->type)
{
@@ -246,25 +287,25 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external,
case PROVIDER_PROP_TYPE_SET_MODE:
case PROVIDER_PROP_TYPE_SET_NROWS:
case PROVIDER_PROP_TYPE_SET_SCREEN_POSITION:
- event.data.s[1] = g_value_get_int (&property->value);
+ event.xclient.data.s[1] = g_value_get_int (&property->value);
break;
case PROVIDER_PROP_TYPE_SET_BACKGROUND_ALPHA:
- event.data.s[1] = g_value_get_double (&property->value) * 100.00;
+ event.xclient.data.s[1] = g_value_get_double (&property->value) * 100.00;
break;
case PROVIDER_PROP_TYPE_SET_LOCKED:
case PROVIDER_PROP_TYPE_SET_SENSITIVE:
- event.data.s[1] = g_value_get_boolean (&property->value);
+ event.xclient.data.s[1] = g_value_get_boolean (&property->value);
break;
case PROVIDER_PROP_TYPE_SET_BACKGROUND_COLOR:
if (gdk_color_parse (g_value_get_string (&property->value), &color))
{
- event.data.s[1] = color.red;
- event.data.s[2] = color.green;
- event.data.s[3] = color.blue;
- event.data.s[4] = 0;
+ event.xclient.data.s[1] = color.red;
+ event.xclient.data.s[2] = color.green;
+ event.xclient.data.s[3] = color.blue;
+ event.xclient.data.s[4] = 0;
}
break;
@@ -284,7 +325,7 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external,
case PROVIDER_PROP_TYPE_ACTION_BACKGROUND_UNSET:
case PROVIDER_PROP_TYPE_ACTION_SHOW_CONFIGURE:
case PROVIDER_PROP_TYPE_ACTION_SHOW_ABOUT:
- event.data.s[1] = 0;
+ event.xclient.data.s[1] = 0;
break;
default:
@@ -296,7 +337,11 @@ panel_plugin_external_46_set_properties (PanelPluginExternal *external,
window = gtk_socket_get_plug_window (GTK_SOCKET (external));
panel_return_if_fail (GDK_IS_WINDOW (window));
- gdk_event_send_client_message ((GdkEvent *) &event, GDK_WINDOW_XID (window));
+ XSendEvent (gdk_x11_display_get_xdisplay (gdk_window_get_display (window)),
+ gdk_x11_window_get_xid (window),
+ False,
+ NoEventMask,
+ &event);
}
bailout:
diff --git a/panel/panel-plugin-external-wrapper.c b/panel/panel-plugin-external-wrapper.c
index 12da849..6b61713 100644
--- a/panel/panel-plugin-external-wrapper.c
+++ b/panel/panel-plugin-external-wrapper.c
@@ -220,7 +220,7 @@ panel_plugin_external_wrapper_get_argv (PanelPluginExternal *external,
argv[PLUGIN_ARGV_0] = g_strjoin ("-", WRAPPER_BIN, panel_module_get_api (external->module), NULL);
argv[PLUGIN_ARGV_FILENAME] = g_strdup (panel_module_get_filename (external->module));
argv[PLUGIN_ARGV_UNIQUE_ID] = g_strdup_printf ("%d", external->unique_id);;
- argv[PLUGIN_ARGV_SOCKET_ID] = g_strdup_printf ("%u", gtk_socket_get_id (GTK_SOCKET (external)));;
+ argv[PLUGIN_ARGV_SOCKET_ID] = g_strdup_printf ("%lu", gtk_socket_get_id (GTK_SOCKET (external)));;
argv[PLUGIN_ARGV_NAME] = g_strdup (panel_module_get_name (external->module));
argv[PLUGIN_ARGV_DISPLAY_NAME] = g_strdup (panel_module_get_display_name (external->module));
argv[PLUGIN_ARGV_COMMENT] = g_strdup (panel_module_get_comment (external->module));
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index b9e8f36..3debd5c 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -30,7 +30,6 @@
#include <sys/wait.h>
#endif
-#include <exo/exo.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <libxfce4util/libxfce4util.h>
@@ -40,6 +39,7 @@
#include <common/panel-private.h>
#include <common/panel-dbus.h>
#include <common/panel-debug.h>
+#include <common/panel-utils.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
@@ -170,7 +170,7 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass)
g_param_spec_int ("unique-id",
NULL, NULL,
-1, G_MAXINT, -1,
- EXO_PARAM_READWRITE
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
@@ -178,7 +178,7 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass)
g_param_spec_object ("module",
NULL, NULL,
PANEL_TYPE_MODULE,
- EXO_PARAM_READWRITE
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
@@ -186,7 +186,7 @@ panel_plugin_external_class_init (PanelPluginExternalClass *klass)
g_param_spec_boxed ("arguments",
NULL, NULL,
G_TYPE_STRV,
- EXO_PARAM_READWRITE
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
}
@@ -521,7 +521,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external)
GTimeVal timestamp;
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
- panel_return_if_fail (GTK_WIDGET_REALIZED (external));
+ panel_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (external)));
/* set plugin specific arguments */
argv = (*PANEL_PLUGIN_EXTERNAL_GET_CLASS (external)->get_argv) (external, external->priv->arguments);
@@ -639,7 +639,7 @@ panel_plugin_external_child_respawn (gpointer user_data)
panel_return_val_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external), FALSE);
/* abort startup if the plugin is not realized */
- if (!GTK_WIDGET_REALIZED (external))
+ if (!gtk_widget_get_realized (GTK_WIDGET (external)))
return FALSE;
/* delay startup if the old child is still embedded */
@@ -745,7 +745,7 @@ panel_plugin_external_child_watch (GPid pid,
PROVIDER_SIGNAL_REMOVE_PLUGIN);
/* wait until everything is settled before we destroy */
- exo_gtk_object_destroy_later (GTK_OBJECT (external));
+ panel_utils_destroy_later (GTK_WIDGET (external));
goto close_pid;
}
}
@@ -760,7 +760,7 @@ panel_plugin_external_child_watch (GPid pid,
}
}
- if (GTK_WIDGET_REALIZED (external)
+ if (gtk_widget_get_realized (GTK_WIDGET (external))
&& (auto_restart || panel_plugin_external_child_ask_restart (external)))
{
panel_plugin_external_child_respawn_schedule (external);
@@ -1082,7 +1082,7 @@ panel_plugin_external_set_sensitive (PanelPluginExternal *external)
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
g_value_init (&value, G_TYPE_BOOLEAN);
- g_value_set_boolean (&value, GTK_WIDGET_IS_SENSITIVE (external));
+ g_value_set_boolean (&value, gtk_widget_is_sensitive (GTK_WIDGET (external)));
panel_plugin_external_queue_add (external, PROVIDER_PROP_TYPE_SET_SENSITIVE,
&value);
diff --git a/panel/panel-plugin-external.h b/panel/panel-plugin-external.h
index 5163447..afa591d 100644
--- a/panel/panel-plugin-external.h
+++ b/panel/panel-plugin-external.h
@@ -20,6 +20,7 @@
#define __PANEL_PLUGIN_EXTERNAL_H__
#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4panel/xfce-panel-plugin-provider.h>
#include <panel/panel-module.h>
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 29d3610..49e905c 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2010 Nick Schermer <nick at xfce.org>
- * Copyright (C) 2014 Jannis Pohlmann <jannis 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
@@ -25,7 +24,6 @@
#include <stdlib.h>
#endif
-#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
@@ -56,12 +54,11 @@ static void panel_preferences_dialog_response
static void panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog,
const gchar *property1,
- const gchar *property2);
+ const gchar *property2,
+ GBindingFlags flags);
static void panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_output_changed (GtkComboBox *combobox,
PanelPreferencesDialog *dialog);
-static void panel_preferences_dialog_autohide_changed (GtkComboBox *combobox,
- PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_bg_style_changed (PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_bg_image_file_set (GtkFileChooserButton *button,
PanelPreferencesDialog *dialog);
@@ -74,8 +71,6 @@ static void panel_preferences_dialog_panel_add
PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_panel_remove (GtkWidget *widget,
PanelPreferencesDialog *dialog);
-static void panel_preferences_dialog_panel_switch (GtkWidget *widget,
- PanelPreferencesDialog *dialog);
static XfcePanelPluginProvider *panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog,
GtkTreeIter *return_iter);
static void panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
@@ -131,7 +126,7 @@ struct _PanelPreferencesDialog
/* currently selected window in the selector */
PanelWindow *active;
- /* ExoMutualBinding's between dialog <-> window */
+ /* GBinding's between dialog <-> window */
GSList *bindings;
/* store for the items list */
@@ -181,7 +176,6 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
- gchar *path;
dialog->bindings = NULL;
dialog->application = panel_application_get ();
@@ -209,14 +203,6 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
connect_signal ("panel-remove", "clicked", panel_preferences_dialog_panel_remove);
connect_signal ("panel-combobox", "changed", panel_preferences_dialog_panel_combobox_changed);
- /* check if panel-switch is installed and if so show button */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-switch");
- path = g_find_program_in_path ("xfpanel-switch");
- if (path == NULL)
- gtk_widget_set_visible (GTK_WIDGET (object), FALSE);
-
- connect_signal ("panel-switch", "clicked", panel_preferences_dialog_panel_switch);
-
/* style tab */
object = gtk_builder_get_object (GTK_BUILDER (dialog), "background-style");
panel_return_if_fail (G_IS_OBJECT (object));
@@ -230,8 +216,9 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
info = gtk_builder_get_object (GTK_BUILDER (dialog), "composited-info");
panel_return_if_fail (G_IS_OBJECT (info));
- exo_binding_new_with_negation (G_OBJECT (object), "sensitive",
- G_OBJECT (info), "visible");
+ g_object_bind_property (G_OBJECT (object), "sensitive",
+ G_OBJECT (info), "visible",
+ G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
object = gtk_builder_get_object (GTK_BUILDER (dialog), "background-image");
panel_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (object));
@@ -293,12 +280,6 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
g_signal_connect (G_OBJECT (object), "changed",
G_CALLBACK (panel_preferences_dialog_output_changed),
dialog);
-
- /* connect the autohide behavior changed signal */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "autohide-behavior");
- panel_return_if_fail (GTK_IS_COMBO_BOX (object));
- g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (panel_preferences_dialog_autohide_changed), dialog);
}
@@ -378,7 +359,7 @@ panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog)
{
/* remove all bindings */
for (li = dialog->bindings; li != NULL; li = li->next)
- exo_mutual_binding_unbind (li->data);
+ g_object_unref (G_OBJECT (li->data));
g_slist_free (dialog->bindings);
dialog->bindings = NULL;
@@ -402,17 +383,19 @@ panel_preferences_dialog_bindings_unbind (PanelPreferencesDialog *dialog)
static void
panel_preferences_dialog_bindings_add (PanelPreferencesDialog *dialog,
const gchar *property1,
- const gchar *property2)
+ const gchar *property2,
+ GBindingFlags flags)
{
- ExoMutualBinding *binding;
- GObject *object;
+ GBinding *binding;
+ GObject *object;
/* get the object from the builder */
object = gtk_builder_get_object (GTK_BUILDER (dialog), property1);
panel_return_if_fail (G_IS_OBJECT (object));
/* create the binding and prepend to the list */
- binding = exo_mutual_binding_new (G_OBJECT (dialog->active), property1, object, property2);
+ binding = g_object_bind_property (G_OBJECT (dialog->active), property1, object, property2,
+ flags ? flags : G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
dialog->bindings = g_slist_prepend (dialog->bindings, binding);
}
@@ -440,21 +423,21 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
return;
/* hook up the bindings */
- panel_preferences_dialog_bindings_add (dialog, "mode", "active");
- panel_preferences_dialog_bindings_add (dialog, "span-monitors", "active");
- panel_preferences_dialog_bindings_add (dialog, "position-locked", "active");
- panel_preferences_dialog_bindings_add (dialog, "autohide-behavior", "active");
- panel_preferences_dialog_bindings_add (dialog, "disable-struts", "active");
- panel_preferences_dialog_bindings_add (dialog, "size", "value");
- panel_preferences_dialog_bindings_add (dialog, "nrows", "value");
- panel_preferences_dialog_bindings_add (dialog, "length", "value");
- panel_preferences_dialog_bindings_add (dialog, "length-adjust", "active");
- panel_preferences_dialog_bindings_add (dialog, "background-alpha", "value");
- panel_preferences_dialog_bindings_add (dialog, "enter-opacity", "value");
- panel_preferences_dialog_bindings_add (dialog, "leave-opacity", "value");
- panel_preferences_dialog_bindings_add (dialog, "composited", "sensitive");
- panel_preferences_dialog_bindings_add (dialog, "background-style", "active");
- panel_preferences_dialog_bindings_add (dialog, "background-color", "color");
+ panel_preferences_dialog_bindings_add (dialog, "mode", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "span-monitors", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "position-locked", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "autohide", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "disable-struts", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "size", "value", 0);
+ panel_preferences_dialog_bindings_add (dialog, "nrows", "value", 0);
+ panel_preferences_dialog_bindings_add (dialog, "length", "value", 0);
+ panel_preferences_dialog_bindings_add (dialog, "length-adjust", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "background-alpha", "value", 0);
+ panel_preferences_dialog_bindings_add (dialog, "enter-opacity", "value", 0);
+ panel_preferences_dialog_bindings_add (dialog, "leave-opacity", "value", 0);
+ panel_preferences_dialog_bindings_add (dialog, "composited", "sensitive", G_BINDING_SYNC_CREATE);
+ panel_preferences_dialog_bindings_add (dialog, "background-style", "active", 0);
+ panel_preferences_dialog_bindings_add (dialog, "background-color", "color", 0);
/* watch image changes from the panel */
dialog->bg_image_notify_handler_id = g_signal_connect_swapped (G_OBJECT (dialog->active),
@@ -485,12 +468,12 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
if (n_screens > 1
|| n_monitors > 1
- || !exo_str_is_empty (output_name))
+ || !panel_str_is_empty (output_name))
{
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++,
OUTPUT_NAME, NULL,
OUTPUT_TITLE, _("Automatic"), -1);
- if (exo_str_is_empty (output_name))
+ if (panel_str_is_empty (output_name))
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
output_selected = TRUE;
@@ -514,7 +497,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
OUTPUT_NAME, name,
OUTPUT_TITLE, title, -1);
- if (!output_selected && exo_str_is_equal (name, output_name))
+ if (!output_selected && g_strcmp0 (name, output_name) == 0)
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
output_selected = TRUE;
@@ -529,7 +512,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
for (i = 0; i < n_monitors; i++)
{
name = gdk_screen_get_monitor_plug_name (screen, i);
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
{
g_free (name);
@@ -546,7 +529,8 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++,
OUTPUT_NAME, name,
OUTPUT_TITLE, title, -1);
- if (!output_selected && exo_str_is_equal (name, output_name))
+ if (!output_selected
+ && g_strcmp0 (name, output_name) == 0)
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
output_selected = TRUE;
@@ -558,7 +542,7 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
}
/* add the output from the config if still nothing has been selected */
- if (!output_selected && !exo_str_is_empty (output_name))
+ if (!output_selected && !panel_str_is_empty (output_name))
{
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++,
OUTPUT_NAME, output_name,
@@ -587,11 +571,6 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
g_object_set (G_OBJECT (object), "visible", n_monitors > 1, NULL);
g_free (output_name);
-
- /* update sensitivity of "don't reserve space on borders" option */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "autohide-behavior");
- panel_return_if_fail (GTK_IS_COMBO_BOX (object));
- panel_preferences_dialog_autohide_changed (GTK_COMBO_BOX (object), dialog);
}
@@ -627,28 +606,6 @@ panel_preferences_dialog_output_changed (GtkComboBox *combobox,
static void
-panel_preferences_dialog_autohide_changed (GtkComboBox *combobox,
- PanelPreferencesDialog *dialog)
-{
- GObject *object;
-
- panel_return_if_fail (GTK_IS_COMBO_BOX (combobox));
- panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
- panel_return_if_fail (PANEL_WINDOW (dialog->active));
-
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "disable-struts");
- panel_return_if_fail (GTK_IS_WIDGET (object));
-
- /* make "don't reserve space on borders" sensitive only when autohide is disabled */
- if (gtk_combo_box_get_active (combobox) == 0)
- gtk_widget_set_sensitive (GTK_WIDGET (object), TRUE);
- else
- gtk_widget_set_sensitive (GTK_WIDGET (object), FALSE);
-}
-
-
-
-static void
panel_preferences_dialog_bg_style_changed (PanelPreferencesDialog *dialog)
{
gint active;
@@ -940,26 +897,6 @@ panel_preferences_dialog_panel_remove (GtkWidget *widget,
-static void
-panel_preferences_dialog_panel_switch (GtkWidget *widget, PanelPreferencesDialog *dialog)
-{
- GtkWidget *toplevel;
- gchar *path;
- GError *error = NULL;
-
- path = g_find_program_in_path ("xfpanel-switch");
- if (path == NULL)
- return;
-
- /* close the preferences dialog */
- toplevel = gtk_widget_get_toplevel (widget);
- panel_preferences_dialog_response (toplevel, 0, dialog);
-
- /* run xfpanel-switch */
- g_spawn_command_line_async (path, &error);
-}
-
-
static XfcePanelPluginProvider *
panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog,
GtkTreeIter *return_iter)
@@ -997,22 +934,15 @@ static void
panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
PanelPreferencesDialog *dialog)
{
- GList *items, *li;
- guint i;
- PanelModule *module;
- gchar *tooltip, *display_name;
- XfcePanelPluginProvider *selected_provider;
- GtkTreeIter iter;
- GtkTreePath *path;
- GObject *treeview;
+ GList *items, *li;
+ guint i;
+ PanelModule *module;
+ gchar *tooltip, *display_name;
panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
panel_return_if_fail (GTK_IS_LIST_STORE (dialog->store));
panel_return_if_fail (PANEL_IS_ITEMBAR (itembar));
- /* memorize selected item */
- selected_provider = panel_preferences_dialog_item_get_selected (dialog, NULL);
-
gtk_list_store_clear (dialog->store);
g_signal_handlers_block_by_func (G_OBJECT (dialog->store),
@@ -1051,7 +981,7 @@ panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
xfce_panel_plugin_provider_get_unique_id (li->data));
}
- gtk_list_store_insert_with_values (dialog->store, &iter, i,
+ gtk_list_store_insert_with_values (dialog->store, NULL, i,
ITEM_COLUMN_ICON_NAME,
panel_module_get_icon_name (module),
ITEM_COLUMN_DISPLAY_NAME,
@@ -1060,16 +990,6 @@ panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
tooltip,
ITEM_COLUMN_PROVIDER, li->data, -1);
- /* reconstruct selection */
- if (selected_provider == li->data)
- {
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->store), &iter);
- treeview = gtk_builder_get_object (GTK_BUILDER (dialog), "item-treeview");
- if (GTK_IS_WIDGET (treeview))
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview), path, NULL, FALSE);
- gtk_tree_path_free (path);
- }
-
g_free (tooltip);
g_free (display_name);
}
@@ -1109,7 +1029,6 @@ panel_preferences_dialog_item_move (GtkWidget *button,
itembar = gtk_bin_get_child (GTK_BIN (dialog->active));
position = panel_itembar_get_child_index (PANEL_ITEMBAR (itembar),
GTK_WIDGET (provider));
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->store), &iter_a);
if (G_LIKELY (position != -1))
{
@@ -1135,20 +1054,20 @@ panel_preferences_dialog_item_move (GtkWidget *button,
/* swap the items in the list */
iter_b = iter_a;
if (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->store), &iter_b))
- {
- gtk_list_store_swap (dialog->store, &iter_a, &iter_b);
- gtk_tree_path_next (path);
- }
+ gtk_list_store_swap (dialog->store, &iter_a, &iter_b);
}
else
{
/* get the previous item in the list */
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->store), &iter_a);
if (gtk_tree_path_prev (path))
{
/* swap the items in the list */
gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->store), &iter_b, path);
gtk_list_store_swap (dialog->store, &iter_a, &iter_b);
}
+
+ gtk_tree_path_free (path);
}
/* fake update the selection */
@@ -1156,13 +1075,7 @@ panel_preferences_dialog_item_move (GtkWidget *button,
panel_return_if_fail (GTK_IS_WIDGET (treeview));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
panel_preferences_dialog_item_selection_changed (selection, dialog);
-
- /* make the new selected position visible if moved out of area */
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (treeview), path, NULL, FALSE, 0, 0);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview), path, NULL, FALSE);
-
}
- gtk_tree_path_free (path);
}
}
@@ -1396,8 +1309,8 @@ panel_preferences_dialog_plug_deleted (GtkWidget *plug)
static void
-panel_preferences_dialog_show_internal (PanelWindow *active,
- GdkNativeWindow socket_window)
+panel_preferences_dialog_show_internal (PanelWindow *active,
+ Window socket_window)
{
gint panel_id = 0;
GObject *window, *combo;
@@ -1506,12 +1419,12 @@ panel_preferences_dialog_show_from_id (gint panel_id,
{
PanelApplication *application;
PanelWindow *window;
- GdkNativeWindow socket_window = 0;
+ Window socket_window = 0;
/* x11 windows are ulong on 64 bit platforms
* or uint32 on other platforms */
if (socket_id != NULL)
- socket_window = (GdkNativeWindow) strtoul (socket_id, NULL, 0);
+ socket_window = (Window) strtoul (socket_id, NULL, 0);
application = panel_application_get ();
window = panel_application_get_window (application, panel_id);
diff --git a/panel/panel-preferences-dialog.glade b/panel/panel-preferences-dialog.glade
index e949d09..79b3d47 100644
--- a/panel/panel-preferences-dialog.glade
+++ b/panel/panel-preferences-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.20"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="mode-store">
@@ -36,23 +36,6 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="autohide-behavior-store">
- <columns>
- <!-- column-name title -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Never</col>
- </row>
- <row>
- <col id="0" translatable="yes">Intelligently</col>
- </row>
- <row>
- <col id="0" translatable="yes">Always</col>
- </row>
- </data>
- </object>
<object class="GtkListStore" id="styles-store">
<columns>
<!-- column-name title -->
@@ -109,11 +92,6 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkImage" id="image10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">package-x-generic</property>
- </object>
<object class="GtkSizeGroup" id="display-sizegroup">
<widgets>
<widget name="label13"/>
@@ -208,32 +186,6 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox7">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkButton" id="panel-switch">
- <property name="label">Backup and restore</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Switch between panel presets</property>
- <property name="image">image10</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="sensitive">False</property>
@@ -364,47 +316,16 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox6">
+ <object class="GtkCheckButton" id="autohide">
+ <property name="label" translatable="yes">Automatically show and _hide the panel</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="label20">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Automatically hide the panel:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">mode</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="autohide-behavior">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">autohide-behavior-store</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext5"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Select this option to hide the panel when the pointer is not above it. This only works when the panel is attached to a screen edge.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
@@ -1097,7 +1018,7 @@
</child>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
diff --git a/panel/panel-tic-tac-toe.c b/panel/panel-tic-tac-toe.c
index 87d757a..704b8b2 100644
--- a/panel/panel-tic-tac-toe.c
+++ b/panel/panel-tic-tac-toe.c
@@ -105,7 +105,7 @@ static void
panel_tic_tac_toe_init (PanelTicTacToe *dialog)
{
GtkWidget *button;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *separator;
guint i;
GtkWidget *label;
@@ -118,54 +118,54 @@ panel_tic_tac_toe_init (PanelTicTacToe *dialog)
gtk_window_set_title (GTK_WINDOW (dialog), "Tic-tac-toe");
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_window_set_icon_name (GTK_WINDOW (dialog), "applications-games");
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
button = xfce_gtk_button_new_mixed (GTK_STOCK_NEW, _("_New Game"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_ACCEPT);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Level:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- dialog->level = combo = gtk_combo_box_new_text ();
+ dialog->level = combo = gtk_combo_box_text_new ();
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Novice"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Intermediate"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Experienced"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Expert"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Novice"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Intermediate"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Experienced"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Expert"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), LEVEL_EXPERIENCED);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
- table = gtk_table_new (5, 5, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 1);
- gtk_table_set_row_spacings (GTK_TABLE (table), 1);
- gtk_container_add (GTK_CONTAINER (align), table);
+ grid = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (grid), 1);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 1);
+ gtk_container_add (GTK_CONTAINER (align), grid);
- separator = gtk_hseparator_new ();
- gtk_table_attach (GTK_TABLE (table), separator, 0, 5, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
- separator = gtk_hseparator_new ();
- gtk_table_attach (GTK_TABLE (table), separator, 0, 5, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
- separator = gtk_vseparator_new ();
- gtk_table_attach (GTK_TABLE (table), separator, 1, 2, 0, 5, GTK_FILL, GTK_FILL, 0, 0);
- separator = gtk_vseparator_new ();
- gtk_table_attach (GTK_TABLE (table), separator, 3, 4, 0, 5, GTK_FILL, GTK_FILL, 0, 0);
+ separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_grid_attach (GTK_GRID (grid), separator, 0, 5, 1, 2);
+ separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_grid_attach (GTK_GRID (grid), separator, 0, 5, 3, 4);
+ separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
+ gtk_grid_attach (GTK_GRID (grid), separator, 1, 2, 0, 5);
+ separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
+ gtk_grid_attach (GTK_GRID (grid), separator, 3, 4, 0, 5);
for (i = 0; i < 9; i++)
{
button = dialog->buttons[i] = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_widget_set_size_request (button, 70, 70);
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+ gtk_widget_set_can_default (button, FALSE);
+ gtk_widget_set_can_focus (button, FALSE);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (panel_tic_tac_toe_button_clicked), dialog);
@@ -175,12 +175,9 @@ panel_tic_tac_toe_init (PanelTicTacToe *dialog)
row = (i / 3) * 2;
col = (i % 3) * 2;
- gtk_table_attach (GTK_TABLE (table), button,
- col, col + 1,
- row, row + 1,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (grid), button,
+ col, col + 1,
+ row, row + 1);
}
/* set label attributes */
diff --git a/panel/panel-window.c b/panel/panel-window.c
index c21aac3..73f8cc9 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2009-2010 Nick Schermer <nick at xfce.org>
- * Copyright (C) 2014 Jannis Pohlmann <jannis 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
@@ -27,16 +26,17 @@
#ifdef HAVE_MATH_H
#include <math.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#endif
-#include <libwnck/libwnck.h>
+#include <libxfce4ui/libxfce4ui.h>
-#include <exo/exo.h>
-#include <xfconf/xfconf.h>
#include <common/panel-private.h>
#include <common/panel-debug.h>
#include <common/panel-utils.h>
@@ -69,96 +69,87 @@
-typedef enum _StrutsEgde StrutsEgde;
-typedef enum _AutohideBehavior AutohideBehavior;
-typedef enum _AutohideState AutohideState;
-typedef enum _SnapPosition SnapPosition;
-typedef enum _PluginProp PluginProp;
-
-
-
-static void panel_window_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void panel_window_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void panel_window_finalize (GObject *object);
-static gboolean panel_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static gboolean panel_window_delete_event (GtkWidget *widget,
- GdkEventAny *event);
-static gboolean panel_window_enter_notify_event (GtkWidget *widget,
- GdkEventCrossing *event);
-static gboolean panel_window_leave_notify_event (GtkWidget *widget,
- GdkEventCrossing *event);
-static gboolean panel_window_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint drag_time);
-static void panel_window_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint drag_time);
-static gboolean panel_window_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event);
-static gboolean panel_window_button_press_event (GtkWidget *widget,
- GdkEventButton *event);
-static gboolean panel_window_button_release_event (GtkWidget *widget,
- GdkEventButton *event);
-static void panel_window_grab_notify (GtkWidget *widget,
- gboolean was_grabbed);
-static void panel_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void panel_window_size_allocate (GtkWidget *widget,
- GtkAllocation *alloc);
-static void panel_window_size_allocate_set_xy (PanelWindow *window,
- gint window_width,
- gint window_height,
- gint *return_x,
- gint *return_y);
-static void panel_window_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen);
-static void panel_window_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static void panel_window_realize (GtkWidget *widget);
-static StrutsEgde panel_window_screen_struts_edge (PanelWindow *window);
-static void panel_window_screen_struts_set (PanelWindow *window);
-static void panel_window_screen_update_borders (PanelWindow *window);
-static SnapPosition panel_window_snap_position (PanelWindow *window);
-static void panel_window_display_layout_debug (GtkWidget *widget);
-static void panel_window_screen_layout_changed (GdkScreen *screen,
- PanelWindow *window);
-static void panel_window_active_window_changed (WnckScreen *screen,
- WnckWindow *previous_window,
- PanelWindow *window);
-static void panel_window_active_window_geometry_changed (WnckWindow *active_window,
- PanelWindow *window);
-static void panel_window_active_window_state_changed (WnckWindow *active_window,
- WnckWindowState changed,
- WnckWindowState new,
- PanelWindow *window);
-static void panel_window_autohide_queue (PanelWindow *window,
- AutohideState new_state);
-static void panel_window_set_autohide_behavior (PanelWindow *window,
- AutohideBehavior behavior);
-static void panel_window_update_autohide_window (PanelWindow *window,
- WnckScreen *screen,
- WnckWindow *active_window);
-static void panel_window_menu_popup (PanelWindow *window,
- guint32 event_time);
-static void panel_window_plugins_update (PanelWindow *window,
- PluginProp prop);
-static void panel_window_plugin_set_mode (GtkWidget *widget,
- gpointer user_data);
-static void panel_window_plugin_set_size (GtkWidget *widget,
- gpointer user_data);
-static void panel_window_plugin_set_nrows (GtkWidget *widget,
- gpointer user_data);
-static void panel_window_plugin_set_screen_position (GtkWidget *widget,
- gpointer user_data);
+typedef enum _StrutsEgde StrutsEgde;
+typedef enum _AutohideState AutohideState;
+typedef enum _SnapPosition SnapPosition;
+typedef enum _PluginProp PluginProp;
+
+
+
+static void panel_window_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void panel_window_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void panel_window_finalize (GObject *object);
+static gboolean panel_window_draw (GtkWidget *widget,
+ cairo_t *cr);
+static gboolean panel_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event);
+static gboolean panel_window_enter_notify_event (GtkWidget *widget,
+ GdkEventCrossing *event);
+static gboolean panel_window_leave_notify_event (GtkWidget *widget,
+ GdkEventCrossing *event);
+static gboolean panel_window_drag_motion (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint drag_time);
+static void panel_window_drag_leave (GtkWidget *widget,
+ GdkDragContext *context,
+ guint drag_time);
+static gboolean panel_window_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event);
+static gboolean panel_window_button_press_event (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean panel_window_button_release_event (GtkWidget *widget,
+ GdkEventButton *event);
+static void panel_window_grab_notify (GtkWidget *widget,
+ gboolean was_grabbed);
+static void panel_window_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+static void panel_window_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
+static void panel_window_size_allocate (GtkWidget *widget,
+ GtkAllocation *alloc);
+static void panel_window_size_allocate_set_xy (PanelWindow *window,
+ gint window_width,
+ gint window_height,
+ gint *return_x,
+ gint *return_y);
+static void panel_window_screen_changed (GtkWidget *widget,
+ GdkScreen *previous_screen);
+static void panel_window_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
+static void panel_window_realize (GtkWidget *widget);
+static StrutsEgde panel_window_screen_struts_edge (PanelWindow *window);
+static void panel_window_screen_struts_set (PanelWindow *window);
+static void panel_window_screen_update_borders (PanelWindow *window);
+static SnapPosition panel_window_snap_position (PanelWindow *window);
+static void panel_window_display_layout_debug (GtkWidget *widget);
+static void panel_window_screen_layout_changed (GdkScreen *screen,
+ PanelWindow *window);
+static void panel_window_autohide_queue (PanelWindow *window,
+ AutohideState new_state);
+static void panel_window_set_autohide (PanelWindow *window,
+ gboolean autohide);
+static void panel_window_menu_popup (PanelWindow *window,
+ guint32 event_time);
+static void panel_window_plugins_update (PanelWindow *window,
+ PluginProp prop);
+static void panel_window_plugin_set_mode (GtkWidget *widget,
+ gpointer user_data);
+static void panel_window_plugin_set_size (GtkWidget *widget,
+ gpointer user_data);
+static void panel_window_plugin_set_nrows (GtkWidget *widget,
+ gpointer user_data);
+static void panel_window_plugin_set_screen_position (GtkWidget *widget,
+ gpointer user_data);
@@ -172,7 +163,7 @@ enum
PROP_LENGTH,
PROP_LENGTH_ADJUST,
PROP_POSITION_LOCKED,
- PROP_AUTOHIDE_BEHAVIOR,
+ PROP_AUTOHIDE,
PROP_SPAN_MONITORS,
PROP_OUTPUT_NAME,
PROP_POSITION,
@@ -187,13 +178,6 @@ enum _PluginProp
PLUGIN_PROP_SIZE
};
-enum _AutohideBehavior
-{
- AUTOHIDE_BEHAVIOR_NEVER = 0,
- AUTOHIDE_BEHAVIOR_INTELLIGENTLY,
- AUTOHIDE_BEHAVIOR_ALWAYS,
-};
-
enum _AutohideState
{
AUTOHIDE_DISABLED = 0, /* autohide is disabled */
@@ -302,10 +286,7 @@ struct _PanelWindow
GdkRectangle alloc;
/* autohiding */
- WnckScreen *wnck_screen;
- WnckWindow *wnck_active_window;
GtkWidget *autohide_window;
- AutohideBehavior autohide_behavior;
AutohideState autohide_state;
guint autohide_timeout_id;
gint autohide_block;
@@ -359,7 +340,7 @@ panel_window_class_init (PanelWindowClass *klass)
gobject_class->finalize = panel_window_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->expose_event = panel_window_expose_event;
+ gtkwidget_class->draw = panel_window_draw;
gtkwidget_class->delete_event = panel_window_delete_event;
gtkwidget_class->enter_notify_event = panel_window_enter_notify_event;
gtkwidget_class->leave_notify_event = panel_window_leave_notify_event;
@@ -369,7 +350,8 @@ panel_window_class_init (PanelWindowClass *klass)
gtkwidget_class->button_press_event = panel_window_button_press_event;
gtkwidget_class->button_release_event = panel_window_button_release_event;
gtkwidget_class->grab_notify = panel_window_grab_notify;
- gtkwidget_class->size_request = panel_window_size_request;
+ gtkwidget_class->get_preferred_width = panel_window_get_preferred_width;
+ gtkwidget_class->get_preferred_height = panel_window_get_preferred_height;
gtkwidget_class->size_allocate = panel_window_size_allocate;
gtkwidget_class->screen_changed = panel_window_screen_changed;
gtkwidget_class->style_set = panel_window_style_set;
@@ -379,7 +361,7 @@ panel_window_class_init (PanelWindowClass *klass)
PROP_ID,
g_param_spec_int ("id", NULL, NULL,
0, G_MAXINT, 0,
- EXO_PARAM_READWRITE
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
@@ -387,69 +369,67 @@ panel_window_class_init (PanelWindowClass *klass)
g_param_spec_enum ("mode", NULL, NULL,
XFCE_TYPE_PANEL_PLUGIN_MODE,
XFCE_PANEL_PLUGIN_MODE_HORIZONTAL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SIZE,
g_param_spec_uint ("size", NULL, NULL,
16, 128, 48,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_NROWS,
g_param_spec_uint ("nrows", NULL, NULL,
1, 6, 1,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_LENGTH,
g_param_spec_uint ("length", NULL, NULL,
1, 100, 10,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_LENGTH_ADJUST,
g_param_spec_boolean ("length-adjust", NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_POSITION_LOCKED,
g_param_spec_boolean ("position-locked", NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
- PROP_AUTOHIDE_BEHAVIOR,
- g_param_spec_uint ("autohide-behavior", NULL, NULL,
- AUTOHIDE_BEHAVIOR_NEVER,
- AUTOHIDE_BEHAVIOR_ALWAYS,
- AUTOHIDE_BEHAVIOR_NEVER,
- EXO_PARAM_READWRITE));
+ PROP_AUTOHIDE,
+ g_param_spec_boolean ("autohide", NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SPAN_MONITORS,
g_param_spec_boolean ("span-monitors", NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_OUTPUT_NAME,
g_param_spec_string ("output-name", NULL, NULL,
NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_POSITION,
g_param_spec_string ("position", NULL, NULL,
NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_DISABLE_STRUTS,
g_param_spec_boolean ("disable-struts", NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("popup-delay",
@@ -457,7 +437,7 @@ panel_window_class_init (PanelWindowClass *klass)
"Time before the panel will unhide on an enter event",
1, G_MAXINT,
DEFAULT_POPUP_DELAY,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("popdown-delay",
@@ -465,7 +445,7 @@ panel_window_class_init (PanelWindowClass *klass)
"Time before the panel will hide on a leave event",
1, G_MAXINT,
DEFAULT_POPDOWN_DELAY,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("autohide-size",
@@ -473,7 +453,7 @@ panel_window_class_init (PanelWindowClass *klass)
"Size of hidden panel",
1, G_MAXINT,
DEFAULT_ATUOHIDE_SIZE,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/* initialize the atoms */
cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
@@ -491,8 +471,6 @@ panel_window_init (PanelWindow *window)
window->id = -1;
window->locked = TRUE;
window->screen = NULL;
- window->wnck_screen = NULL;
- window->wnck_active_window = NULL;
window->struts_edge = STRUTS_EDGE_NONE;
window->struts_disabled = FALSE;
window->mode = XFCE_PANEL_PLUGIN_MODE_HORIZONTAL;
@@ -504,7 +482,6 @@ panel_window_init (PanelWindow *window)
window->span_monitors = FALSE;
window->position_locked = FALSE;
window->autohide_state = AUTOHIDE_DISABLED;
- window->autohide_behavior = AUTOHIDE_BEHAVIOR_NEVER;
window->autohide_timeout_id = 0;
window->autohide_block = 0;
window->autohide_grab_block = 0;
@@ -571,8 +548,8 @@ panel_window_get_property (GObject *object,
g_value_set_boolean (value, window->position_locked);
break;
- case PROP_AUTOHIDE_BEHAVIOR:
- g_value_set_uint (value, window->autohide_behavior);
+ case PROP_AUTOHIDE:
+ g_value_set_boolean (value, !!(window->autohide_state != AUTOHIDE_DISABLED));
break;
case PROP_SPAN_MONITORS:
@@ -695,9 +672,8 @@ panel_window_set_property (GObject *object,
}
break;
- case PROP_AUTOHIDE_BEHAVIOR:
- panel_window_set_autohide_behavior (window, MIN (g_value_get_uint (value),
- AUTOHIDE_BEHAVIOR_ALWAYS));
+ case PROP_AUTOHIDE:
+ panel_window_set_autohide (window, g_value_get_boolean (value));
break;
case PROP_SPAN_MONITORS:
@@ -713,7 +689,7 @@ panel_window_set_property (GObject *object,
g_free (window->output_name);
val_string = g_value_get_string (value);
- if (exo_str_is_empty (val_string))
+ if (panel_str_is_empty (val_string))
window->output_name = NULL;
else
window->output_name = g_strdup (val_string);
@@ -723,7 +699,7 @@ panel_window_set_property (GObject *object,
case PROP_POSITION:
val_string = g_value_get_string (value);
- if (!exo_str_is_empty (val_string)
+ if (!panel_str_is_empty (val_string)
&& sscanf (val_string, "p=%d;x=%d;y=%d", &snap_position, &x, &y) == 3)
{
window->snap_position = CLAMP (snap_position, SNAP_POSITION_NONE, SNAP_POSITION_S);
@@ -763,9 +739,6 @@ panel_window_finalize (GObject *object)
{
PanelWindow *window = PANEL_WINDOW (object);
- /* disconnect from active screen and window */
- panel_window_update_autohide_window (window, NULL, NULL);
-
/* stop running autohide timeout */
if (G_UNLIKELY (window->autohide_timeout_id != 0))
g_source_remove (window->autohide_timeout_id);
@@ -782,22 +755,24 @@ panel_window_finalize (GObject *object)
static gboolean
-panel_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- PanelWindow *window = PANEL_WINDOW (widget);
- cairo_t *cr;
- GdkColor *color;
- guint xx, yy, i;
- gint xs, xe, ys, ye;
- gint handle_w, handle_h;
- gdouble alpha = 1.00;
- GtkWidget *child;
+panel_window_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ PanelWindow *window = PANEL_WINDOW (widget);
+ GdkRGBA bg_rgba, light_rgba, dark_rgba;
+ GtkSymbolicColor *literal;
+ GtkSymbolicColor *shade;
+ guint xx, yy, i;
+ gint xs, xe, ys, ye;
+ gint handle_w, handle_h;
+ gdouble alpha = 1.00;
+ GtkWidget *child;
+ GtkStyleContext *ctx;
/* expose the background and borders handled in PanelBaseWindow */
- (*GTK_WIDGET_CLASS (panel_window_parent_class)->expose_event) (widget, event);
+ (*GTK_WIDGET_CLASS (panel_window_parent_class)->draw) (widget, cr);
- if (window->position_locked || !GTK_WIDGET_DRAWABLE (widget))
+ if (window->position_locked || !gtk_widget_is_drawable (widget))
goto end;
if (IS_HORIZONTAL (window))
@@ -808,11 +783,6 @@ panel_window_expose_event (GtkWidget *widget,
xs = HANDLE_SPACING + 1;
xe = window->alloc.width - HANDLE_SIZE - HANDLE_SIZE;
ys = ye = (window->alloc.height - handle_h) / 2;
-
- /* dirty check if we have to redraw the handles */
- if (event->area.x > xs + HANDLE_SIZE
- && event->area.x + event->area.width < xe)
- goto end;
}
else
{
@@ -822,35 +792,36 @@ panel_window_expose_event (GtkWidget *widget,
xs = xe = (window->alloc.width - handle_w) / 2;
ys = HANDLE_SPACING + 1;
ye = window->alloc.height - HANDLE_SIZE - HANDLE_SIZE;
-
- /* dirty check if we have to redraw the handles */
- if (event->area.y > ys + HANDLE_SIZE
- && event->area.y + event->area.height < ye)
- goto end;
}
/* create cairo context and set some default properties */
- cr = gdk_cairo_create (widget->window);
- panel_return_val_if_fail (cr != NULL, FALSE);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- /* clip the drawing area */
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
/* alpha color */
if (PANEL_BASE_WINDOW (window)->is_composited)
alpha = MAX (0.50, PANEL_BASE_WINDOW (window)->background_alpha);
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &bg_rgba);
+ literal = gtk_symbolic_color_new_literal (&bg_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 1.3);
+ gtk_symbolic_color_resolve (shade, NULL, &light_rgba);
+ gtk_symbolic_color_unref (shade);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &dark_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
+ light_rgba.alpha = alpha;
+ dark_rgba.alpha = alpha;
+
for (i = HANDLE_PIXELS; i >= HANDLE_PIXELS - 1; i--)
{
/* set the source color */
if (i == HANDLE_PIXELS)
- color = &(widget->style->light[GTK_STATE_NORMAL]);
+ gdk_cairo_set_source_rgba (cr, &light_rgba);
else
- color = &(widget->style->dark[GTK_STATE_NORMAL]);
- panel_util_set_source_rgba (cr, color, alpha);
+ gdk_cairo_set_source_rgba (cr, &dark_rgba);
/* draw the dots */
for (xx = 0; xx < (guint) handle_w; xx += HANDLE_PIXELS + HANDLE_PIXEL_SPACE)
@@ -864,13 +835,11 @@ panel_window_expose_event (GtkWidget *widget,
cairo_fill (cr);
}
- cairo_destroy (cr);
-
end:
/* send the expose event to the child */
child = gtk_bin_get_child (GTK_BIN (widget));
if (G_LIKELY (child != NULL))
- gtk_container_propagate_expose (GTK_CONTAINER (widget), child, event);
+ gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
return FALSE;
}
@@ -920,14 +889,8 @@ panel_window_leave_notify_event (GtkWidget *widget,
/* queue an autohide timeout if needed */
if (event->detail != GDK_NOTIFY_INFERIOR
&& window->autohide_state != AUTOHIDE_DISABLED
- && window->autohide_state != AUTOHIDE_BLOCKED) {
- /* simulate a geometry change to check for overlapping windows with intelligent hiding */
- if (window->autohide_behavior == AUTOHIDE_BEHAVIOR_INTELLIGENTLY)
- panel_window_active_window_geometry_changed (window->wnck_active_window, window);
- /* otherwise just hide the panel */
- else
- panel_window_autohide_queue (window, AUTOHIDE_POPDOWN);
- }
+ && window->autohide_state != AUTOHIDE_BLOCKED)
+ panel_window_autohide_queue (window, AUTOHIDE_POPDOWN);
return (*GTK_WIDGET_CLASS (panel_window_parent_class)->leave_notify_event) (widget, event);
}
@@ -986,8 +949,8 @@ panel_window_motion_notify_event (GtkWidget *widget,
* the panel that is currently dragged */
if (event->x == 0 && event->y == 0)
{
- gdk_display_get_pointer (gtk_widget_get_display (widget),
- &screen, NULL, NULL, NULL);
+ gdk_device_get_position (event->device,
+ &screen, NULL, NULL);
if (screen != gtk_window_get_screen (GTK_WINDOW (window)))
{
gtk_window_set_screen (GTK_WINDOW (window), screen);
@@ -1053,7 +1016,7 @@ panel_window_button_press_event (GtkWidget *widget,
guint modifiers;
/* leave if the event is not for this window */
- if (event->window != widget->window)
+ if (event->window != gtk_widget_get_window (widget))
goto end;
modifiers = event->state & gtk_accelerator_get_default_mod_mask ();
@@ -1070,12 +1033,13 @@ panel_window_button_press_event (GtkWidget *widget,
cursor = gdk_cursor_new_for_display (display, GDK_FLEUR);
/* grab the pointer for dragging the window */
- status = gdk_pointer_grab (event->window, FALSE,
- GDK_BUTTON_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, cursor, event->time);
+ status = gdk_device_grab (event->device, event->window,
+ GDK_OWNERSHIP_NONE, FALSE,
+ GDK_BUTTON_MOTION_MASK
+ | GDK_BUTTON_RELEASE_MASK,
+ cursor, event->time);
- gdk_cursor_unref (cursor);
+ g_object_unref (cursor);
/* set the grab info if the grab was successfully made */
if (G_LIKELY (status == GDK_GRAB_SUCCESS))
@@ -1109,15 +1073,13 @@ panel_window_button_release_event (GtkWidget *widget,
GdkEventButton *event)
{
PanelWindow *window = PANEL_WINDOW (widget);
- GdkDisplay *display;
panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
if (window->grab_time != 0)
{
/* ungrab the pointer */
- display = gdk_screen_get_display (window->screen);
- gdk_display_pointer_ungrab (display, window->grab_time);
+ gdk_device_ungrab (event->device, window->grab_time);
window->grab_time = 0;
/* store the new position */
@@ -1143,8 +1105,6 @@ panel_window_grab_notify (GtkWidget *widget,
{
PanelWindow *window = PANEL_WINDOW (widget);
GtkWidget *current;
- GdkScreen *screen;
- gint x, y;
current = gtk_grab_get_current ();
if (GTK_IS_MENU_SHELL (current))
@@ -1162,16 +1122,10 @@ panel_window_grab_notify (GtkWidget *widget,
{
if (current != NULL)
{
- gdk_display_get_pointer (gtk_widget_get_display (current),
- &screen, &x, &y, NULL);
-
/* filter out grab event that did not occur in the panel window,
* but in a windows that is part of this process */
- if (gtk_window_get_screen (GTK_WINDOW (window)) != screen
- || x < window->alloc.x
- || x > window->alloc.x + window->alloc.width
- || y < window->alloc.y
- || y > window->alloc.y + window->alloc.height)
+ if (gtk_widget_get_toplevel (GTK_WIDGET (window)) !=
+ gtk_widget_get_toplevel (current))
{
/* block the next notification */
window->autohide_grab_block++;
@@ -1193,26 +1147,26 @@ panel_window_grab_notify (GtkWidget *widget,
static void
-panel_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+panel_window_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
{
PanelWindow *window = PANEL_WINDOW (widget);
- GtkRequisition child_requisition = { 0, 0 };
+ gint m_width = 0;
+ gint n_width = 0;
gint length;
- gint extra_width = 0, extra_height = 0;
+ gint extra_width = 0;
PanelBorders borders;
/* get the child requisition */
- if (GTK_BIN (widget)->child != NULL)
- gtk_widget_size_request (GTK_BIN (widget)->child, &child_requisition);
+ if (gtk_bin_get_child (GTK_BIN (widget)) != NULL)
+ gtk_widget_get_preferred_width (gtk_bin_get_child (GTK_BIN (widget)), &m_width, &n_width);
/* handle size */
if (!window->position_locked)
{
if (IS_HORIZONTAL (window))
extra_width += 2 * HANDLE_SIZE_TOTAL;
- else
- extra_height += 2 * HANDLE_SIZE_TOTAL;
}
/* get the active borders */
@@ -1221,31 +1175,83 @@ panel_window_size_request (GtkWidget *widget,
extra_width++;
if (PANEL_HAS_FLAG (borders, PANEL_BORDER_RIGHT))
extra_width++;
- if (PANEL_HAS_FLAG (borders, PANEL_BORDER_TOP))
- extra_height++;
- if (PANEL_HAS_FLAG (borders, PANEL_BORDER_BOTTOM))
- extra_height++;
- requisition->height = child_requisition.height + extra_height;
- requisition->width = child_requisition.width + extra_width;
+ m_width += extra_width;
+ n_width += extra_width;
/* respect the length and monitor/screen size */
if (IS_HORIZONTAL (window))
{
if (!window->length_adjust)
- requisition->width = extra_width;
+ {
+ m_width = n_width = extra_width;
+ }
length = window->area.width * window->length;
- requisition->width = CLAMP (requisition->width, length, window->area.width);
+ m_width = CLAMP (m_width, length, window->area.width);
+ n_width = CLAMP (n_width, length, window->area.width);
}
- else
+
+ if (minimum_width != NULL)
+ *minimum_width = m_width;
+
+ if (natural_width != NULL)
+ *natural_width = n_width;
+}
+
+
+
+static void
+panel_window_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ PanelWindow *window = PANEL_WINDOW (widget);
+ gint m_height = 0;
+ gint n_height = 0;
+ gint length;
+ gint extra_height = 0;
+ PanelBorders borders;
+
+ /* get the child requisition */
+ if (gtk_bin_get_child (GTK_BIN (widget)) != NULL)
+ gtk_widget_get_preferred_height (gtk_bin_get_child (GTK_BIN (widget)), &m_height, &n_height);
+
+ /* handle size */
+ if (!window->position_locked)
+ {
+ if (!IS_HORIZONTAL (window))
+ extra_height += 2 * HANDLE_SIZE_TOTAL;
+ }
+
+ /* get the active borders */
+ borders = panel_base_window_get_borders (PANEL_BASE_WINDOW (window));
+ if (PANEL_HAS_FLAG (borders, PANEL_BORDER_TOP))
+ extra_height++;
+ if (PANEL_HAS_FLAG (borders, PANEL_BORDER_BOTTOM))
+ extra_height++;
+
+ m_height += extra_height;
+ n_height += extra_height;
+
+ /* respect the length and monitor/screen size */
+ if (!IS_HORIZONTAL (window))
{
if (!window->length_adjust)
- requisition->height = extra_height;
+ {
+ m_height = n_height = extra_height;
+ }
length = window->area.height * window->length;
- requisition->height = CLAMP (requisition->height, length, window->area.height);
+ m_height = CLAMP (m_height, length, window->area.height);
+ n_height = CLAMP (n_height, length, window->area.height);
}
+
+ if (minimum_height != NULL)
+ *minimum_height = m_height;
+
+ if (natural_height != NULL)
+ *natural_height = n_height;
}
@@ -1260,7 +1266,7 @@ panel_window_size_allocate (GtkWidget *widget,
PanelBorders borders;
GtkWidget *child;
- widget->allocation = *alloc;
+ gtk_widget_set_allocation (widget, alloc);
window->alloc = *alloc;
if (G_UNLIKELY (window->autohide_state == AUTOHIDE_HIDDEN
@@ -1457,8 +1463,6 @@ panel_window_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
{
PanelWindow *window = PANEL_WINDOW (widget);
- WnckWindow *wnck_window;
- WnckScreen *wnck_screen;
GdkScreen *screen;
if (G_LIKELY (GTK_WIDGET_CLASS (panel_window_parent_class)->screen_changed != NULL))
@@ -1492,11 +1496,6 @@ panel_window_screen_changed (GtkWidget *widget,
/* update the screen layout */
panel_window_screen_layout_changed (screen, window);
-
- /* update wnck screen to be used for the autohide feature */
- wnck_screen = wnck_screen_get (gdk_screen_get_number (screen));
- wnck_window = wnck_screen_get_active_window (wnck_screen);
- panel_window_update_autohide_window (window, wnck_screen, wnck_window);
}
@@ -1599,7 +1598,7 @@ panel_window_screen_struts_set (PanelWindow *window)
panel_return_if_fail (cardinal_atom != 0 && net_wm_strut_partial_atom != 0);
panel_return_if_fail (GDK_IS_SCREEN (window->screen));
- if (!GTK_WIDGET_REALIZED (window))
+ if (!gtk_widget_get_realized (GTK_WIDGET (window)))
return;
/* set the struts */
@@ -1653,15 +1652,15 @@ panel_window_screen_struts_set (PanelWindow *window)
gdk_error_trap_push ();
/* set the wm strut partial */
- panel_return_if_fail (GDK_IS_WINDOW (GTK_WIDGET (window)->window));
- gdk_property_change (GTK_WIDGET (window)->window,
+ panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (window))));
+ gdk_property_change (gtk_widget_get_window (GTK_WIDGET (window)),
net_wm_strut_partial_atom,
cardinal_atom, 32, GDK_PROP_MODE_REPLACE,
(guchar *) &struts, N_STRUTS);
#if SET_OLD_WM_STRUTS
/* set the wm strut (old window managers) */
- gdk_property_change (GTK_WIDGET (window)->window,
+ gdk_property_change (gtk_widget_get_window (GTK_WIDGET (window)),
net_wm_strut_atom,
cardinal_atom, 32, GDK_PROP_MODE_REPLACE,
(guchar *) &struts, 4);
@@ -1853,11 +1852,9 @@ panel_window_display_layout_debug (GtkWidget *widget)
if (panel_debug_has_domain (PANEL_DEBUG_DISPLAY_LAYOUT))
{
- g_string_append_printf (str, "{comp=%s, sys=%p:%p, rgba=%p:%p}",
+ g_string_append_printf (str, "{comp=%s, sys=%p, rgba=%p}",
PANEL_DEBUG_BOOL (gdk_screen_is_composited (screen)),
- gdk_screen_get_system_colormap (screen),
gdk_screen_get_system_visual (screen),
- gdk_screen_get_rgba_colormap (screen),
gdk_screen_get_rgba_visual (screen));
}
@@ -1948,24 +1945,9 @@ panel_window_screen_layout_changed (GdkScreen *screen,
/* get the screen geometry we also use this if there is only
* one monitor and no output is choosen, as a fast-path */
- gdk_screen_get_monitor_geometry (screen, 0, &a);
-
- a.width += a.x;
- a.height += a.y;
-
- for (n = 1; n < n_monitors; n++)
- {
- gdk_screen_get_monitor_geometry (screen, n, &b);
-
- a.x = MIN (a.x, b.x);
- a.y = MIN (a.y, b.y);
- a.width = MAX (a.width, b.x + b.width);
- a.height = MAX (a.height, b.y + b.height);
- }
-
- a.width -= a.x;
- a.height -= a.y;
-
+ a.x = a.y = 0;
+ a.width = gdk_screen_get_width (screen);
+ a.height = gdk_screen_get_height (screen);
panel_return_if_fail (a.width > 0 && a.height > 0);
}
else if (window->output_name != NULL
@@ -1983,7 +1965,7 @@ panel_window_screen_layout_changed (GdkScreen *screen,
window, screen_num);
/* out of range, hide the window */
- if (GTK_WIDGET_VISIBLE (window))
+ if (gtk_widget_get_visible (GTK_WIDGET (window)))
gtk_widget_hide (GTK_WIDGET (window));
return;
}
@@ -2009,7 +1991,7 @@ panel_window_screen_layout_changed (GdkScreen *screen,
}
else
{
- if (exo_str_is_empty (window->output_name))
+ if (panel_str_is_empty (window->output_name))
{
normal_monitor_positioning:
@@ -2071,7 +2053,7 @@ panel_window_screen_layout_changed (GdkScreen *screen,
window, window->output_name);
/* hide the panel if the monitor was not found */
- if (GTK_WIDGET_VISIBLE (window))
+ if (gtk_widget_get_visible (GTK_WIDGET (window)))
gtk_widget_hide (GTK_WIDGET (window));
return;
}
@@ -2140,120 +2122,12 @@ panel_window_screen_layout_changed (GdkScreen *screen,
if (force_struts_update)
panel_window_screen_struts_set (window);
- if (!GTK_WIDGET_VISIBLE (window))
+ if (!gtk_widget_get_visible (GTK_WIDGET (window)))
gtk_widget_show (GTK_WIDGET (window));
}
-static void
-panel_window_active_window_changed (WnckScreen *screen,
- WnckWindow *previous_window,
- PanelWindow *window)
-{
- WnckWindow *active_window;
-
- panel_return_if_fail (WNCK_IS_SCREEN (screen));
- panel_return_if_fail (PANEL_IS_WINDOW (window));
-
- /* obtain new active window from the screen */
- active_window = wnck_screen_get_active_window (screen);
-
- /* update the active window to be used for the autohide feature */
- panel_window_update_autohide_window (window, screen, active_window);
-}
-
-
-
-static void
-panel_window_active_window_geometry_changed (WnckWindow *active_window,
- PanelWindow *window)
-{
- GdkRectangle panel_area;
- GdkRectangle window_area;
-
- panel_return_if_fail (WNCK_IS_WINDOW (active_window));
- panel_return_if_fail (PANEL_IS_WINDOW (window));
-
- /* ignore if for some reason the active window does not match the one we know */
- if (G_UNLIKELY (window->wnck_active_window != active_window))
- return;
-
- /* only react to active window geometry changes if we are doing
- * intelligent autohiding */
- if (window->autohide_behavior == AUTOHIDE_BEHAVIOR_INTELLIGENTLY
- && window->autohide_block == 0)
- {
- if (wnck_window_get_window_type (active_window) != WNCK_WINDOW_DESKTOP)
- {
- /* obtain position and dimensions from the active window */
- wnck_window_get_geometry (active_window,
- &window_area.x, &window_area.y,
- &window_area.width, &window_area.height);
-
- /* if a window is shaded, check the height of the window's
- * decoration */
- if (wnck_window_is_shaded (active_window))
- {
- GdkRectangle window_content;
-
- wnck_window_get_client_window_geometry (active_window,
- &window_content.x,
- &window_content.y,
- &window_content.width,
- &window_content.height);
- window_area.height = window_area.height - window_content.height;
- }
-
- /* obtain position and dimension from the panel */
- panel_window_size_allocate_set_xy (window,
- window->alloc.width,
- window->alloc.height,
- &panel_area.x,
- &panel_area.y);
- gtk_window_get_size (GTK_WINDOW (window),
- &panel_area.width,
- &panel_area.height);
-
- /* show/hide the panel, depending on whether the active window overlaps
- * with its coordinates */
- if (window->autohide_state != AUTOHIDE_HIDDEN)
- {
- if (gdk_rectangle_intersect (&panel_area, &window_area, NULL))
- panel_window_autohide_queue (window, AUTOHIDE_HIDDEN);
- }
- else
- {
- if (!gdk_rectangle_intersect (&panel_area, &window_area, NULL))
- panel_window_autohide_queue (window, AUTOHIDE_VISIBLE);
- }
- }
- else
- {
- /* make the panel visible if it isn't at the moment and the active
- * window is the desktop */
- if (window->autohide_state != AUTOHIDE_VISIBLE)
- panel_window_autohide_queue (window, AUTOHIDE_VISIBLE);
- }
- }
-}
-
-
-
-static void
-panel_window_active_window_state_changed (WnckWindow *active_window,
- WnckWindowState changed,
- WnckWindowState new,
- PanelWindow *window)
-{
- panel_return_if_fail (WNCK_IS_WINDOW (active_window));
-
- if (changed & WNCK_WINDOW_STATE_SHADED)
- panel_window_active_window_geometry_changed (active_window, window);
-}
-
-
-
static gboolean
panel_window_autohide_timeout (gpointer user_data)
{
@@ -2389,8 +2263,8 @@ panel_window_autohide_event (GtkWidget *widget,
static void
-panel_window_set_autohide_behavior (PanelWindow *window,
- AutohideBehavior behavior)
+panel_window_set_autohide (PanelWindow *window,
+ gboolean autohide)
{
GtkWidget *popup;
guint i;
@@ -2401,83 +2275,58 @@ panel_window_set_autohide_behavior (PanelWindow *window,
panel_return_if_fail (PANEL_IS_WINDOW (window));
- /* do nothing if the behavior hasn't changed at all */
- if (window->autohide_behavior == behavior)
+ if ((window->autohide_state != AUTOHIDE_DISABLED) == autohide)
return;
- /* remember the new behavior */
- window->autohide_behavior = behavior;
+ /* respond to drag motion */
+ gtk_drag_dest_set_track_motion (GTK_WIDGET (window), autohide);
- /* create an autohide window only if we are autohiding at all */
- if (window->autohide_behavior != AUTOHIDE_BEHAVIOR_NEVER)
+ if (autohide)
{
- /* create an autohide window; doing this only when it doesn't exist
- * yet allows us to transition between "always autohide" and "intelligently
- * autohide" without recreating the window */
- if (window->autohide_window == NULL)
+ /* create the window */
+ panel_return_if_fail (window->autohide_window == NULL);
+ popup = g_object_new (PANEL_TYPE_BASE_WINDOW,
+ "type", GTK_WINDOW_TOPLEVEL,
+ "decorated", FALSE,
+ "resizable", TRUE,
+ "type-hint", GDK_WINDOW_TYPE_HINT_DOCK,
+ "gravity", GDK_GRAVITY_STATIC,
+ "name", "XfcePanelWindowHidden",
+ NULL);
+
+ /* move the window offscreen */
+ panel_base_window_move_resize (PANEL_BASE_WINDOW (popup),
+ -9999, -9999, 3, 3);
+
+ /* bind some properties to sync the two windows */
+ for (i = 0; i < G_N_ELEMENTS (properties); i++)
{
- /* create the window */
- panel_return_if_fail (window->autohide_window == NULL);
- popup = g_object_new (PANEL_TYPE_BASE_WINDOW,
- "type", GTK_WINDOW_TOPLEVEL,
- "decorated", FALSE,
- "resizable", TRUE,
- "type-hint", GDK_WINDOW_TYPE_HINT_DOCK,
- "gravity", GDK_GRAVITY_STATIC,
- "name", "XfcePanelWindowHidden",
- NULL);
-
- /* move the window offscreen */
- panel_base_window_move_resize (PANEL_BASE_WINDOW (popup),
- -9999, -9999, 3, 3);
-
- /* bind some properties to sync the two windows */
- for (i = 0; i < G_N_ELEMENTS (properties); i++)
- {
- exo_binding_new (G_OBJECT (window), properties[i],
- G_OBJECT (popup), properties[i]);
- }
-
- /* respond to drag motion */
- gtk_drag_dest_set_track_motion (GTK_WIDGET (window), TRUE);
-
- /* signals for pointer enter/leave events */
- g_signal_connect (G_OBJECT (popup), "enter-notify-event",
- G_CALLBACK (panel_window_autohide_event), window);
- g_signal_connect (G_OBJECT (popup), "leave-notify-event",
- G_CALLBACK (panel_window_autohide_event), window);
-
- /* show/hide the panel on drag events */
- gtk_drag_dest_set (popup, 0, NULL, 0, 0);
- gtk_drag_dest_set_track_motion (popup, TRUE);
- g_signal_connect (G_OBJECT (popup), "drag-motion",
- G_CALLBACK (panel_window_autohide_drag_motion), window);
- g_signal_connect (G_OBJECT (popup), "drag-leave",
- G_CALLBACK (panel_window_autohide_drag_leave), window);
-
- /* show the window */
- window->autohide_window = popup;
- gtk_widget_show (popup);
+ g_object_bind_property (G_OBJECT (window), properties[i],
+ G_OBJECT (popup), properties[i],
+ G_BINDING_SYNC_CREATE);
}
- if (window->autohide_behavior == AUTOHIDE_BEHAVIOR_ALWAYS)
- {
- /* start autohide by hiding the panel straight away */
- if (window->autohide_state != AUTOHIDE_HIDDEN)
- {
- panel_window_autohide_queue (window,
- window->autohide_block == 0 ? AUTOHIDE_POPDOWN_SLOW : AUTOHIDE_BLOCKED);
- }
- }
- else if (window->autohide_behavior == AUTOHIDE_BEHAVIOR_INTELLIGENTLY)
- {
- /* start intelligent autohide by making the panel visible initially */
- if (window->autohide_state != AUTOHIDE_VISIBLE)
- {
- panel_window_autohide_queue (window,
- window->autohide_block == 0 ? AUTOHIDE_POPUP : AUTOHIDE_BLOCKED);
- }
- }
+ /* signals for pointer enter/leave events */
+ g_signal_connect (G_OBJECT (popup), "enter-notify-event",
+ G_CALLBACK (panel_window_autohide_event), window);
+ g_signal_connect (G_OBJECT (popup), "leave-notify-event",
+ G_CALLBACK (panel_window_autohide_event), window);
+
+ /* show/hide the panel on drag events */
+ gtk_drag_dest_set (popup, 0, NULL, 0, 0);
+ gtk_drag_dest_set_track_motion (popup, TRUE);
+ g_signal_connect (G_OBJECT (popup), "drag-motion",
+ G_CALLBACK (panel_window_autohide_drag_motion), window);
+ g_signal_connect (G_OBJECT (popup), "drag-leave",
+ G_CALLBACK (panel_window_autohide_drag_leave), window);
+
+ /* show the window */
+ window->autohide_window = popup;
+ gtk_widget_show (popup);
+
+ /* start autohide */
+ panel_window_autohide_queue (window,
+ window->autohide_block == 0 ? AUTOHIDE_POPDOWN_SLOW : AUTOHIDE_BLOCKED);
}
else if (window->autohide_window != NULL)
{
@@ -2494,68 +2343,6 @@ panel_window_set_autohide_behavior (PanelWindow *window,
static void
-panel_window_update_autohide_window (PanelWindow *window,
- WnckScreen *screen,
- WnckWindow *active_window)
-{
- panel_return_if_fail (PANEL_IS_WINDOW (window));
- panel_return_if_fail (screen == NULL || WNCK_IS_SCREEN (screen));
- panel_return_if_fail (active_window == NULL || WNCK_IS_WINDOW (active_window));
-
- /* update current screen */
- if (screen != window->wnck_screen)
- {
- /* disconnect from previous screen */
- if (G_LIKELY (window->wnck_screen != NULL))
- {
- g_signal_handlers_disconnect_by_func (window->wnck_screen,
- panel_window_active_window_changed, window);
- }
-
- /* remember new screen */
- window->wnck_screen = screen;
-
- /* connect to the new screen */
- if (screen != NULL)
- {
- g_signal_connect (G_OBJECT (screen), "active-window-changed",
- G_CALLBACK (panel_window_active_window_changed), window);
- }
- }
-
- /* update active window */
- if (G_LIKELY (active_window != window->wnck_active_window))
- {
- /* disconnect from previously active window */
- if (G_LIKELY (window->wnck_active_window != NULL))
- {
- g_signal_handlers_disconnect_by_func (window->wnck_active_window,
- panel_window_active_window_geometry_changed, window);
- g_signal_handlers_disconnect_by_func (window->wnck_active_window,
- panel_window_active_window_state_changed, window);
- }
-
- /* remember the new window */
- window->wnck_active_window = active_window;
-
- /* connect to the new window but only if it is not a desktop/root-type window */
- if (active_window != NULL)
- {
- g_signal_connect (G_OBJECT (active_window), "geometry-changed",
- G_CALLBACK (panel_window_active_window_geometry_changed), window);
- g_signal_connect (G_OBJECT (active_window), "state-changed",
- G_CALLBACK (panel_window_active_window_state_changed), window);
-
- /* simulate a geometry change for immediate hiding when the new active
- * window already overlaps the panel */
- panel_window_active_window_geometry_changed (active_window, window);
- }
- }
-}
-
-
-
-static void
panel_window_menu_toggle_locked (GtkCheckMenuItem *item,
PanelWindow *window)
{
@@ -2963,14 +2750,8 @@ panel_window_thaw_autohide (PanelWindow *window)
window->autohide_block--;
if (window->autohide_block == 0
- && window->autohide_state != AUTOHIDE_DISABLED) {
- /* simulate a geometry change to check for overlapping windows with intelligent hiding */
- if (window->autohide_behavior == AUTOHIDE_BEHAVIOR_INTELLIGENTLY)
- panel_window_active_window_geometry_changed (window->wnck_active_window, window);
- /* otherwise just hide the panel */
- else
- panel_window_autohide_queue (window, AUTOHIDE_POPDOWN);
- }
+ && window->autohide_state != AUTOHIDE_DISABLED)
+ panel_window_autohide_queue (window, AUTOHIDE_POPDOWN);
}
@@ -3003,20 +2784,20 @@ panel_window_focus (PanelWindow *window)
XClientMessageEvent event;
panel_return_if_fail (PANEL_IS_WINDOW (window));
- panel_return_if_fail (GTK_WIDGET_REALIZED (window));
+ panel_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (window)));
/* we need a slightly custom version of the call through Gtk+ to
* properly focus the panel when a plugin calls
* xfce_panel_plugin_focus_widget() */
event.type = ClientMessage;
- event.window = GDK_WINDOW_XID (GTK_WIDGET (window)->window);
+ event.window = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window)));
event.message_type = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW");
event.format = 32;
event.data.l[0] = 0;
gdk_error_trap_push ();
- XSendEvent (GDK_DISPLAY (), GDK_ROOT_WINDOW (), False,
+ XSendEvent (gdk_x11_get_default_xdisplay (), GDK_ROOT_WINDOW (), False,
StructureNotifyMask, (XEvent *) &event);
gdk_flush ();
@@ -3028,51 +2809,3 @@ panel_window_focus (PanelWindow *window)
gtk_window_present (GTK_WINDOW (window));
#endif
}
-
-
-
-void
-panel_window_migrate_autohide_property (PanelWindow *window,
- XfconfChannel *xfconf,
- const gchar *property_base)
-{
- gboolean autohide;
- gchar *new_property;
- gchar *old_property;
-
- panel_return_if_fail (PANEL_IS_WINDOW (window));
- panel_return_if_fail (XFCONF_IS_CHANNEL (xfconf));
- panel_return_if_fail (property_base != NULL && *property_base != '\0');
-
- old_property = g_strdup_printf ("%s/autohide", property_base);
-
- /* check if we have an old "autohide" property for this panel */
- if (xfconf_channel_has_property (xfconf, old_property))
- {
- new_property = g_strdup_printf ("%s/autohide-behavior", property_base);
-
- /* migrate from old "autohide" to new "autohide-behavior" if the latter
- * isn't set already */
- if (!xfconf_channel_has_property (xfconf, new_property))
- {
- /* find out whether or not autohide was enabled in the old config */
- autohide = xfconf_channel_get_bool (xfconf, old_property, FALSE);
-
- /* set autohide behavior to always or never, depending on whether it
- * was enabled in the old configuration */
- if (xfconf_channel_set_uint (xfconf,
- new_property,
- autohide ? AUTOHIDE_BEHAVIOR_ALWAYS
- : AUTOHIDE_BEHAVIOR_NEVER))
- {
- /* remove the old autohide property */
- xfconf_channel_reset_property (xfconf, old_property, FALSE);
- }
- }
- else
- {
- /* the new property is already set, simply remove the old property */
- xfconf_channel_reset_property (xfconf, old_property, FALSE);
- }
- }
-}
diff --git a/panel/panel-window.h b/panel/panel-window.h
index f5aa603..e31d2b6 100644
--- a/panel/panel-window.h
+++ b/panel/panel-window.h
@@ -20,7 +20,6 @@
#define __PANEL_WINDOW_H__
#include <gtk/gtk.h>
-#include <xfconf/xfconf.h>
G_BEGIN_DECLS
@@ -34,33 +33,29 @@ typedef struct _PanelWindow PanelWindow;
#define PANEL_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANEL_TYPE_WINDOW))
#define PANEL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANEL_TYPE_WINDOW, PanelWindowClass))
-GType panel_window_get_type (void) G_GNUC_CONST;
+GType panel_window_get_type (void) G_GNUC_CONST;
-GtkWidget *panel_window_new (GdkScreen *screen,
- gint id) G_GNUC_MALLOC;
+GtkWidget *panel_window_new (GdkScreen *screen,
+ gint id) G_GNUC_MALLOC;
-gint panel_window_get_id (PanelWindow *window);
+gint panel_window_get_id (PanelWindow *window);
-gboolean panel_window_has_position (PanelWindow *window);
+gboolean panel_window_has_position (PanelWindow *window);
-void panel_window_set_povider_info (PanelWindow *window,
- GtkWidget *provider,
- gboolean moving_to_other_panel);
+void panel_window_set_povider_info (PanelWindow *window,
+ GtkWidget *provider,
+ gboolean moving_to_other_panel);
-void panel_window_freeze_autohide (PanelWindow *window);
+void panel_window_freeze_autohide (PanelWindow *window);
-void panel_window_thaw_autohide (PanelWindow *window);
+void panel_window_thaw_autohide (PanelWindow *window);
-void panel_window_set_locked (PanelWindow *window,
- gboolean locked);
+void panel_window_set_locked (PanelWindow *window,
+ gboolean locked);
-gboolean panel_window_get_locked (PanelWindow *window);
+gboolean panel_window_get_locked (PanelWindow *window);
-void panel_window_focus (PanelWindow *window);
-
-void panel_window_migrate_autohide_property (PanelWindow *window,
- XfconfChannel *xfconf,
- const gchar *property_base);
+void panel_window_focus (PanelWindow *window);
G_END_DECLS
diff --git a/plugins/actions/Makefile.am b/plugins/actions/Makefile.am
index 07a523a..af74ee4 100644
--- a/plugins/actions/Makefile.am
+++ b/plugins/actions/Makefile.am
@@ -21,7 +21,6 @@ libactions_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(DBUS_CFLAGS) \
$(PLATFORM_CFLAGS)
@@ -39,7 +38,6 @@ libactions_la_LIBADD = \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
- $(EXO_LIBS) \
$(DBUS_LIBS) \
$(XFCONF_LIBS)
@@ -70,7 +68,7 @@ DISTCLEANFILES += \
$(libactions_built_sources)
actions-dialog_ui.h: actions-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=actions_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=actions_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/actions/actions-dialog.glade b/plugins/actions/actions-dialog.glade
index 7b1a424..f2a26cd 100644
--- a/plugins/actions/actions-dialog.glade
+++ b/plugins/actions/actions-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.20"/>
<!-- interface-requires libxfce4ui 4.5 -->
<!-- interface-naming-policy project-wide -->
<object class="XfceTitledDialog" id="dialog">
diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index 8aa38f4..5b6c017 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -25,7 +25,6 @@
#include <libxfce4panel/libxfce4panel.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
-#include <exo/exo.h>
#include <dbus/dbus-glib.h>
#include <common/panel-private.h>
@@ -197,7 +196,7 @@ static ActionEntry action_entries[] =
N_("_Restart"),
N_("Are you sure you want to restart?"),
N_("Restarting computer in %d seconds."),
- "system-reboot"
+ "xfsm-reboot"
},
{ ACTION_TYPE_SHUTDOWN,
"shutdown",
@@ -243,7 +242,7 @@ actions_plugin_class_init (ActionsPluginClass *klass)
g_param_spec_boxed ("items",
NULL, NULL,
PANEL_PROPERTIES_TYPE_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_APPEARANCE,
@@ -252,21 +251,21 @@ actions_plugin_class_init (ActionsPluginClass *klass)
APPEARANCE_TYPE_BUTTONS,
APPEARANCE_TYPE_MENU,
APPEARANCE_TYPE_MENU,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_INVERT_ORIENTATION,
g_param_spec_boolean ("invert-orientation",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ASK_CONFIRMATION,
g_param_spec_boolean ("ask-confirmation",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
menu_icon_size = gtk_icon_size_from_name ("panel-actions-menu");
if (menu_icon_size == GTK_ICON_SIZE_INVALID)
@@ -438,8 +437,7 @@ actions_plugin_size_changed (XfcePanelPlugin *panel_plugin,
box = gtk_bin_get_child (GTK_BIN (plugin));
if (box != NULL)
{
- if (plugin->invert_orientation !=
- (xfce_panel_plugin_get_mode (panel_plugin) == XFCE_PANEL_PLUGIN_MODE_DESKBAR))
+ if (plugin->invert_orientation)
{
children = gtk_container_get_children (GTK_CONTAINER (box));
if (G_UNLIKELY (children == NULL))
@@ -596,18 +594,22 @@ actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
return;
combo = gtk_builder_get_object (builder, "combo-mode");
- exo_mutual_binding_new (G_OBJECT (plugin), "appearance",
- G_OBJECT (combo), "active");
+ g_object_bind_property (G_OBJECT (plugin), "appearance",
+ G_OBJECT (combo), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
object = gtk_builder_get_object (builder, "invert-orientation");
- exo_mutual_binding_new (G_OBJECT (plugin), "invert-orientation",
- G_OBJECT (object), "active");
- exo_binding_new_with_negation (G_OBJECT (combo), "active",
- G_OBJECT (object), "sensitive");
+ g_object_bind_property (G_OBJECT (plugin), "invert-orientation",
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ g_object_bind_property (G_OBJECT (combo), "active",
+ G_OBJECT (object), "sensitive",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL | G_BINDING_INVERT_BOOLEAN);
object = gtk_builder_get_object (builder, "confirmation-dialog");
- exo_mutual_binding_new (G_OBJECT (plugin), "ask-confirmation",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "ask-confirmation",
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
store = gtk_builder_get_object (builder, "items-store");
panel_return_if_fail (GTK_IS_LIST_STORE (store));
@@ -626,7 +628,7 @@ actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
/* get the value and check if it is within range */
val = g_ptr_array_index (plugin->items, i);
name = g_value_get_string (val);
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
continue;
/* find the entry in the available actions */
@@ -745,7 +747,7 @@ actions_plugin_action_confirmation (ActionsPlugin *plugin,
gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
gtk_window_stick (GTK_WINDOW (dialog));
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_title (GTK_WINDOW (dialog), _(entry->display_name));
+ gtk_window_set_title (GTK_WINDOW (dialog), _(entry->name));
button = gtk_dialog_add_button (GTK_DIALOG (dialog), _(entry->mnemonic), GTK_RESPONSE_ACCEPT);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
@@ -911,12 +913,10 @@ static void
actions_plugin_action_activate (GtkWidget *widget,
ActionsPlugin *plugin)
{
- ActionEntry *entry;
- gboolean unattended = FALSE;
- GError *error = NULL;
- gboolean succeed = FALSE;
- XfconfChannel *channel;
- gboolean allow_save;
+ ActionEntry *entry;
+ gboolean unattended = FALSE;
+ GError *error = NULL;
+ gboolean succeed = FALSE;
entry = g_object_get_qdata (G_OBJECT (widget), action_quark);
panel_return_if_fail (entry != NULL);
@@ -927,31 +927,26 @@ actions_plugin_action_activate (GtkWidget *widget,
&& !actions_plugin_action_confirmation (plugin, entry, &unattended))
return;
- channel = xfconf_channel_get ("xfce4-session");
- allow_save = xfconf_channel_get_bool (channel, "/general/SaveOnExit", FALSE);
- /* unattended shutdown, don't save the session to avoid blocking the logout */
- allow_save = allow_save && !unattended;
-
switch (entry->type)
{
case ACTION_TYPE_LOGOUT:
succeed = actions_plugin_action_dbus_xfsm ("Logout", FALSE,
- allow_save, &error);
+ !unattended, &error);
break;
case ACTION_TYPE_LOGOUT_DIALOG:
succeed = actions_plugin_action_dbus_xfsm ("Logout", TRUE,
- allow_save, &error);
+ !unattended, &error);
break;
case ACTION_TYPE_RESTART:
succeed = actions_plugin_action_dbus_xfsm ("Restart", FALSE,
- allow_save, &error);
+ !unattended, &error);
break;
case ACTION_TYPE_SHUTDOWN:
succeed = actions_plugin_action_dbus_xfsm ("Shutdown", FALSE,
- allow_save, &error);
+ !unattended, &error);
break;
case ACTION_TYPE_HIBERNATE:
@@ -1100,18 +1095,15 @@ actions_plugin_pack_idle (gpointer data)
if (plugin->items == NULL)
plugin->items = actions_plugin_default_array ();
+ orientation = xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin));
+
allowed_types = actions_plugin_actions_allowed ();
if (plugin->type == APPEARANCE_TYPE_BUTTONS)
{
- if (xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)) == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
- orientation = GTK_ORIENTATION_VERTICAL;
- else
- orientation = GTK_ORIENTATION_HORIZONTAL;
-
if (plugin->invert_orientation)
orientation = !orientation;
- box = xfce_hvbox_new (orientation, FALSE, 0);
+ box = gtk_box_new (orientation, 0);
gtk_container_add (GTK_CONTAINER (plugin), box);
gtk_widget_show (box);
@@ -1124,8 +1116,7 @@ actions_plugin_pack_idle (gpointer data)
/* skip separators when packing buttons in the opposite
* orientation */
- if (plugin->invert_orientation !=
- (xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)) == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
+ if (plugin->invert_orientation
&& g_strcmp0 (name + 1, "separator") == 0)
continue;
@@ -1145,11 +1136,11 @@ actions_plugin_pack_idle (gpointer data)
{
/* get a decent username, not the glib defaults */
username = g_get_real_name ();
- if (exo_str_is_empty (username)
+ if (panel_str_is_empty (username)
|| strcmp (username, "Unknown") == 0)
{
username = g_get_user_name ();
- if (exo_str_is_empty (username)
+ if (panel_str_is_empty (username)
|| strcmp (username, "somebody") == 0)
username = _("John Doe");
}
@@ -1259,11 +1250,6 @@ actions_plugin_menu (GtkWidget *button,
ActionType allowed_types;
panel_return_if_fail (XFCE_IS_ACTIONS_PLUGIN (plugin));
- panel_return_if_fail (button != NULL);
-
- /* do not popup the menu if the button is being toggled off */
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
- return;
if (plugin->menu == NULL)
{
@@ -1272,7 +1258,6 @@ actions_plugin_menu (GtkWidget *button,
G_CALLBACK (actions_plugin_menu_deactivate), button);
g_object_add_weak_pointer (G_OBJECT (plugin->menu), (gpointer) &plugin->menu);
- size = DEFAULT_ICON_SIZE;
if (gtk_icon_size_lookup (menu_icon_size, &w, &h))
size = MIN (w, h);
diff --git a/plugins/applicationsmenu/Makefile.am b/plugins/applicationsmenu/Makefile.am
index 7f7779e..8dd1d88 100644
--- a/plugins/applicationsmenu/Makefile.am
+++ b/plugins/applicationsmenu/Makefile.am
@@ -19,12 +19,10 @@ libapplicationsmenu_la_SOURCES = \
libapplicationsmenu_la_CFLAGS = \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(GARCON_CFLAGS) \
- $(GARCON_GTK2_CFLAGS) \
$(PLATFORM_CFLAGS)
libapplicationsmenu_la_LDFLAGS = \
@@ -37,12 +35,10 @@ libapplicationsmenu_la_LDFLAGS = \
libapplicationsmenu_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(top_builddir)/common/libpanel-common.la \
- $(EXO_LIBS) \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(GARCON_LIBS) \
- $(GARCON_GTK2_LIBS) \
$(XFCONF_LIBS)
libapplicationsmenu_la_DEPENDENCIES = \
@@ -84,7 +80,7 @@ DISTCLEANFILES += \
$(libapplicationsmenu_built_sources)
applicationsmenu-dialog_ui.h: applicationsmenu-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=applicationsmenu_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=applicationsmenu_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/applicationsmenu/applicationsmenu-dialog.glade b/plugins/applicationsmenu/applicationsmenu-dialog.glade
index fdb7704..a95e359 100644
--- a/plugins/applicationsmenu/applicationsmenu-dialog.glade
+++ b/plugins/applicationsmenu/applicationsmenu-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index c9f5a0d..e94753c 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -20,9 +20,7 @@
#include <config.h>
#endif
-#include <exo/exo.h>
#include <garcon/garcon.h>
-#include <garcon-gtk/garcon-gtk.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/libxfce4panel.h>
@@ -36,7 +34,7 @@
/* I18N: default tooltip of the application menu */
-#define DEFAULT_TITLE _("Applications")
+#define DEFAULT_TITLE _("Applications Menu")
#define DEFAULT_ICON_NAME "xfce4-panel-menu"
#define DEFAULT_ICON_SIZE (16)
@@ -57,8 +55,9 @@ struct _ApplicationsMenuPlugin
GtkWidget *label;
GtkWidget *menu;
- guint is_constructed : 1;
-
+ guint show_generic_names : 1;
+ guint show_menu_icons : 1;
+ guint show_tooltips : 1;
guint show_button_title : 1;
gchar *button_title;
gchar *button_icon;
@@ -68,9 +67,6 @@ struct _ApplicationsMenuPlugin
/* temp item we store here when the
* properties dialog is opened */
GtkWidget *dialog_icon;
-
- gulong style_set_id;
- gulong screen_changed_id;
};
enum
@@ -86,6 +82,10 @@ enum
PROP_CUSTOM_MENU_FILE
};
+static const GtkTargetEntry dnd_target_list[] = {
+ { "text/uri-list", 0, 0 }
+};
+
static void applications_menu_plugin_get_property (GObject *object,
@@ -106,13 +106,10 @@ static void applications_menu_plugin_configure_plugin (XfcePanelPlugin
static gboolean applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin,
const gchar *name,
const GValue *value);
+static void applications_menu_plugin_menu_reload (ApplicationsMenuPlugin *plugin);
static gboolean applications_menu_plugin_menu (GtkWidget *button,
GdkEventButton *event,
ApplicationsMenuPlugin *plugin);
-static void applications_menu_plugin_menu_deactivate (GtkWidget *menu,
- GtkWidget *button);
-static void applications_menu_plugin_set_garcon_menu (ApplicationsMenuPlugin *plugin);
-static void applications_menu_button_theme_changed (ApplicationsMenuPlugin *plugin);
@@ -121,6 +118,10 @@ XFCE_PANEL_DEFINE_PLUGIN (ApplicationsMenuPlugin, applications_menu_plugin)
+static GtkIconSize menu_icon_size = GTK_ICON_SIZE_INVALID;
+
+
+
static void
applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass)
{
@@ -143,56 +144,62 @@ applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass)
PROP_SHOW_GENERIC_NAMES,
g_param_spec_boolean ("show-generic-names",
NULL, NULL,
- FALSE,
- EXO_PARAM_READWRITE));
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_MENU_ICONS,
g_param_spec_boolean ("show-menu-icons",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_TOOLTIPS,
g_param_spec_boolean ("show-tooltips",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_BUTTON_TITLE,
g_param_spec_boolean ("show-button-title",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BUTTON_TITLE,
g_param_spec_string ("button-title",
NULL, NULL,
DEFAULT_TITLE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_BUTTON_ICON,
g_param_spec_string ("button-icon",
NULL, NULL,
DEFAULT_ICON_NAME,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_CUSTOM_MENU,
g_param_spec_boolean ("custom-menu",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_CUSTOM_MENU_FILE,
g_param_spec_string ("custom-menu-file",
NULL, NULL,
NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ menu_icon_size = gtk_icon_size_from_name ("panel-applications-menu");
+ if (menu_icon_size == GTK_ICON_SIZE_INVALID)
+ menu_icon_size = gtk_icon_size_register ("panel-applications-menu",
+ DEFAULT_ICON_SIZE,
+ DEFAULT_ICON_SIZE);
}
@@ -200,8 +207,25 @@ applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass)
static void
applications_menu_plugin_init (ApplicationsMenuPlugin *plugin)
{
- /* init garcon environment */
- garcon_set_environment_xdg (GARCON_ENVIRONMENT_XFCE);
+ const gchar *desktop;
+
+ plugin->show_menu_icons = TRUE;
+ plugin->show_button_title = TRUE;
+ plugin->custom_menu = FALSE;
+
+ /* if the value is unset, fallback to XFCE, if the
+ * value is empty, allow all applications in the menu */
+ desktop = g_getenv ("XDG_CURRENT_DESKTOP");
+ if (G_LIKELY (desktop == NULL))
+ desktop = "XFCE";
+ else if (*desktop == '\0')
+ desktop = NULL;
+
+ panel_debug (PANEL_DEBUG_APPLICATIONSMENU,
+ "XDG_MENU_PREFIX is set to \"%s\", menu environment is \"%s\"",
+ g_getenv ("XDG_MENU_PREFIX"), desktop);
+
+ garcon_set_environment (desktop);
plugin->button = xfce_panel_create_toggle_button ();
xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), plugin->button);
@@ -212,7 +236,7 @@ applications_menu_plugin_init (ApplicationsMenuPlugin *plugin)
g_signal_connect (G_OBJECT (plugin->button), "button-press-event",
G_CALLBACK (applications_menu_plugin_menu), plugin);
- plugin->box = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 2);
+ plugin->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_container_set_border_width (GTK_CONTAINER (plugin->box), 0);
gtk_container_add (GTK_CONTAINER (plugin->button), plugin->box);
gtk_widget_show (plugin->box);
@@ -223,18 +247,7 @@ applications_menu_plugin_init (ApplicationsMenuPlugin *plugin)
plugin->label = gtk_label_new (DEFAULT_TITLE);
gtk_box_pack_start (GTK_BOX (plugin->box), plugin->label, FALSE, FALSE, 0);
- plugin->show_button_title = TRUE;
gtk_widget_show (plugin->label);
-
- /* prepare the menu */
- plugin->menu = garcon_gtk_menu_new (NULL);
- g_signal_connect (G_OBJECT (plugin->menu), "selection-done",
- G_CALLBACK (applications_menu_plugin_menu_deactivate), plugin->button);
-
- plugin->style_set_id = g_signal_connect_swapped (G_OBJECT (plugin->button), "style-set",
- G_CALLBACK (applications_menu_button_theme_changed), plugin);
- plugin->screen_changed_id = g_signal_connect_swapped (G_OBJECT (plugin->button), "screen-changed",
- G_CALLBACK (applications_menu_button_theme_changed), plugin);
}
@@ -250,18 +263,15 @@ applications_menu_plugin_get_property (GObject *object,
switch (prop_id)
{
case PROP_SHOW_GENERIC_NAMES:
- g_value_set_boolean (value,
- garcon_gtk_menu_get_show_generic_names (GARCON_GTK_MENU (plugin->menu)));
+ g_value_set_boolean (value, plugin->show_generic_names);
break;
case PROP_SHOW_MENU_ICONS:
- g_value_set_boolean (value,
- garcon_gtk_menu_get_show_menu_icons (GARCON_GTK_MENU (plugin->menu)));
+ g_value_set_boolean (value, plugin->show_menu_icons);
break;
case PROP_SHOW_TOOLTIPS:
- g_value_set_boolean (value,
- garcon_gtk_menu_get_show_tooltips (GARCON_GTK_MENU (plugin->menu)));
+ g_value_set_boolean (value, plugin->show_tooltips);
break;
case PROP_SHOW_BUTTON_TITLE:
@@ -274,7 +284,7 @@ applications_menu_plugin_get_property (GObject *object,
break;
case PROP_BUTTON_ICON:
- g_value_set_string (value, exo_str_is_empty (plugin->button_icon) ?
+ g_value_set_string (value, panel_str_is_empty (plugin->button_icon) ?
DEFAULT_ICON_NAME : plugin->button_icon);
break;
@@ -302,22 +312,23 @@ applications_menu_plugin_set_property (GObject *object,
{
ApplicationsMenuPlugin *plugin = XFCE_APPLICATIONS_MENU_PLUGIN (object);
gboolean force_a_resize = FALSE;
+ gboolean reload_menu = FALSE;
switch (prop_id)
{
case PROP_SHOW_GENERIC_NAMES:
- garcon_gtk_menu_set_show_generic_names (GARCON_GTK_MENU (plugin->menu),
- g_value_get_boolean (value));
+ plugin->show_generic_names = g_value_get_boolean (value);
+ reload_menu = TRUE;
break;
case PROP_SHOW_MENU_ICONS:
- garcon_gtk_menu_set_show_menu_icons (GARCON_GTK_MENU (plugin->menu),
- g_value_get_boolean (value));
- break;
+ plugin->show_menu_icons = g_value_get_boolean (value);
+ reload_menu = TRUE;
+ break;
case PROP_SHOW_TOOLTIPS:
- garcon_gtk_menu_set_show_tooltips (GARCON_GTK_MENU (plugin->menu),
- g_value_get_boolean (value));
+ plugin->show_tooltips = g_value_get_boolean (value);
+ reload_menu = TRUE;
break;
case PROP_SHOW_BUTTON_TITLE:
@@ -336,7 +347,7 @@ applications_menu_plugin_set_property (GObject *object,
gtk_label_set_text (GTK_LABEL (plugin->label),
plugin->button_title != NULL ? plugin->button_title : "");
gtk_widget_set_tooltip_text (plugin->button,
- exo_str_is_empty (plugin->button_title) ? NULL : plugin->button_title);
+ panel_str_is_empty (plugin->button_title) ? NULL : plugin->button_title);
/* check if the label still fits */
if (xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin)) == XFCE_PANEL_PLUGIN_MODE_DESKBAR
@@ -355,17 +366,13 @@ applications_menu_plugin_set_property (GObject *object,
case PROP_CUSTOM_MENU:
plugin->custom_menu = g_value_get_boolean (value);
-
- if (plugin->is_constructed)
- applications_menu_plugin_set_garcon_menu (plugin);
+ reload_menu = TRUE;
break;
case PROP_CUSTOM_MENU_FILE:
g_free (plugin->custom_menu_file);
plugin->custom_menu_file = g_value_dup_string (value);
-
- if (plugin->is_constructed)
- applications_menu_plugin_set_garcon_menu (plugin);
+ reload_menu = TRUE;
break;
default:
@@ -378,6 +385,9 @@ applications_menu_plugin_set_property (GObject *object,
applications_menu_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin),
xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)));
}
+
+ if (reload_menu)
+ applications_menu_plugin_menu_reload (plugin);
}
@@ -406,14 +416,7 @@ applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin)
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
- /* make sure the menu is set */
- applications_menu_plugin_set_garcon_menu (plugin);
-
gtk_widget_show (plugin->button);
-
- applications_menu_plugin_size_changed (panel_plugin,
- xfce_panel_plugin_get_size (panel_plugin));
- plugin->is_constructed = TRUE;
}
@@ -426,18 +429,6 @@ applications_menu_plugin_free_data (XfcePanelPlugin *panel_plugin)
if (plugin->menu != NULL)
gtk_widget_destroy (plugin->menu);
- if (plugin->style_set_id != 0)
- {
- g_signal_handler_disconnect (plugin->button, plugin->style_set_id);
- plugin->style_set_id = 0;
- }
-
- if (plugin->screen_changed_id != 0)
- {
- g_signal_handler_disconnect (plugin->button, plugin->screen_changed_id);
- plugin->screen_changed_id = 0;
- }
-
g_free (plugin->button_title);
g_free (plugin->button_icon);
g_free (plugin->custom_menu_file);
@@ -451,7 +442,6 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
{
ApplicationsMenuPlugin *plugin = XFCE_APPLICATIONS_MENU_PLUGIN (panel_plugin);
gint row_size;
- GtkStyle *style;
XfcePanelPluginMode mode;
GtkRequisition label_size;
GtkOrientation orientation;
@@ -462,6 +452,8 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
GdkScreen *screen;
GtkIconTheme *icon_theme = NULL;
gchar *icon_name;
+ GtkStyleContext *ctx;
+ GtkBorder padding, border;
gtk_box_set_child_packing (GTK_BOX (plugin->box), plugin->icon,
!plugin->show_button_title,
@@ -476,20 +468,23 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
orientation = GTK_ORIENTATION_VERTICAL;
row_size = size / xfce_panel_plugin_get_nrows (panel_plugin);
- style = gtk_widget_get_style (plugin->button);
- border_thickness = 2 * MAX (style->xthickness, style->ythickness) + 2;
+ /* style thickness */
+ ctx = gtk_widget_get_style_context (plugin->button);
+ gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (plugin->button), &padding);
+ gtk_style_context_get_border (ctx, gtk_widget_get_state_flags (plugin->button), &border);
+ border_thickness = MAX (padding.left + padding.right + border.left + border.right,
+ padding.top + padding.bottom + border.top + border.bottom);
/* arbitrary limit on non-square icon width in horizontal panel */
icon_width_max = (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
- 6 * row_size - border_thickness :
- size - border_thickness;
+ 6 * row_size - border_thickness : size - border_thickness;
icon_height_max = row_size - border_thickness;
screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
if (G_LIKELY (screen != NULL))
icon_theme = gtk_icon_theme_get_for_screen (screen);
- icon_name = exo_str_is_empty (plugin->button_icon) ?
+ icon_name = panel_str_is_empty (plugin->button_icon) ?
DEFAULT_ICON_NAME : plugin->button_icon;
icon = xfce_panel_pixbuf_from_source_at_size (icon_name,
@@ -507,9 +502,9 @@ applications_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
if (plugin->show_button_title &&
mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
{
- /* check if the label fits next to the icon */
- gtk_widget_size_request (GTK_WIDGET (plugin->label), &label_size);
- if (label_size.width <= size - border_thickness - icon_width)
+ /* check if the label (minimum size) fits next to the icon */
+ gtk_widget_get_preferred_size (GTK_WIDGET (plugin->label), &label_size, NULL);
+ if (label_size.width <= size - icon_width - 2 - border_thickness)
orientation = GTK_ORIENTATION_HORIZONTAL;
}
@@ -556,6 +551,7 @@ static void
applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button,
ApplicationsMenuPlugin *plugin)
{
+#ifdef EXO_CHECK_VERSION
GtkWidget *chooser;
gchar *icon;
@@ -573,7 +569,7 @@ applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget *
GTK_RESPONSE_CANCEL, -1);
exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser),
- exo_str_is_empty (plugin->button_icon) ? DEFAULT_ICON_NAME : plugin->button_icon);
+ panel_str_is_empty (plugin->button_icon) ? DEFAULT_ICON_NAME : plugin->button_icon);
if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT)
{
@@ -586,6 +582,7 @@ applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget *
}
gtk_widget_destroy (chooser);
+#endif
}
@@ -595,7 +592,7 @@ applications_menu_plugin_configure_plugin_edit (GtkWidget *button,
ApplicationsMenuPlugin *plugin)
{
GError *error = NULL;
- const gchar command[] = "alacarte";
+ const gchar *command = "alacarte";
panel_return_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin));
panel_return_if_fail (GTK_IS_WIDGET (button));
@@ -632,14 +629,16 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
{
object = gtk_builder_get_object (builder, check_names[i]);
panel_return_if_fail (GTK_IS_CHECK_BUTTON (object));
- exo_mutual_binding_new (G_OBJECT (plugin), check_names[i],
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), check_names[i],
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
}
object = gtk_builder_get_object (builder, "button-title");
panel_return_if_fail (GTK_IS_ENTRY (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "button-title",
- G_OBJECT (object), "text");
+ g_object_bind_property (G_OBJECT (plugin), "button-title",
+ G_OBJECT (object), "text",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
object = gtk_builder_get_object (builder, "icon-button");
panel_return_if_fail (GTK_IS_BUTTON (object));
@@ -647,7 +646,7 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
G_CALLBACK (applications_menu_plugin_configure_plugin_icon_chooser), plugin);
plugin->dialog_icon = xfce_panel_image_new_from_source (
- exo_str_is_empty (plugin->button_icon) ? DEFAULT_ICON_NAME : plugin->button_icon);
+ panel_str_is_empty (plugin->button_icon) ? DEFAULT_ICON_NAME : plugin->button_icon);
xfce_panel_image_set_size (XFCE_PANEL_IMAGE (plugin->dialog_icon), 48);
gtk_container_add (GTK_CONTAINER (object), plugin->dialog_icon);
g_object_add_weak_pointer (G_OBJECT (plugin->dialog_icon), (gpointer) &plugin->dialog_icon);
@@ -661,7 +660,9 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
{
object2 = gtk_builder_get_object (builder, "use-default-menu");
panel_return_if_fail (GTK_IS_RADIO_BUTTON (object2));
- exo_binding_new (G_OBJECT (object2), "active", G_OBJECT (object), "sensitive");
+ g_object_bind_property (G_OBJECT (object2), "active",
+ G_OBJECT (object), "sensitive",
+ G_BINDING_SYNC_CREATE);
g_signal_connect (G_OBJECT (object), "clicked",
G_CALLBACK (applications_menu_plugin_configure_plugin_edit), plugin);
}
@@ -673,17 +674,20 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
object = gtk_builder_get_object (builder, "use-custom-menu");
panel_return_if_fail (GTK_IS_RADIO_BUTTON (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "custom-menu",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "custom-menu",
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
/* sensitivity of custom file selector */
object2 = gtk_builder_get_object (builder, "custom-box");
panel_return_if_fail (GTK_IS_WIDGET (object2));
- exo_binding_new (G_OBJECT (object), "active", G_OBJECT (object2), "sensitive");
+ g_object_bind_property (G_OBJECT (object), "active",
+ G_OBJECT (object2), "sensitive",
+ G_BINDING_SYNC_CREATE);
object = gtk_builder_get_object (builder, "custom-file");
panel_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (object));
- if (!exo_str_is_empty (plugin->custom_menu_file))
+ if (!panel_str_is_empty (plugin->custom_menu_file))
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (object), plugin->custom_menu_file);
g_signal_connect (G_OBJECT (object), "file-set",
G_CALLBACK (applications_menu_plugin_configure_plugin_file_set), plugin);
@@ -703,7 +707,7 @@ applications_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin,
panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE);
if (strcmp (name, "popup") == 0
- && GTK_WIDGET_VISIBLE (panel_plugin)
+ && gtk_widget_get_visible (GTK_WIDGET (panel_plugin))
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button))
&& panel_utils_grab_available ())
{
@@ -746,41 +750,325 @@ applications_menu_plugin_menu_deactivate (GtkWidget *menu,
static void
-applications_menu_plugin_set_garcon_menu (ApplicationsMenuPlugin *plugin)
+applications_menu_plugin_append_quoted (GString *string,
+ const gchar *unquoted)
{
- GarconMenu *menu = NULL;
- gchar *filename;
- GFile *file;
+ gchar *quoted;
+
+ quoted = g_shell_quote (unquoted);
+ g_string_append (string, quoted);
+ g_free (quoted);
+}
+
+
+
+static void
+applications_menu_plugin_menu_item_activate (GtkWidget *mi,
+ GarconMenuItem *item)
+{
+ GString *string;
+ const gchar *command;
+ const gchar *p;
+ const gchar *tmp;
+ gchar **argv;
+ gboolean result = FALSE;
+ gchar *uri;
+ GError *error = NULL;
+
+ panel_return_if_fail (GTK_IS_WIDGET (mi));
+ panel_return_if_fail (GARCON_IS_MENU_ITEM (item));
+
+ command = garcon_menu_item_get_command (item);
+ if (panel_str_is_empty (command))
+ return;
+
+ string = g_string_sized_new (100);
+
+ if (garcon_menu_item_requires_terminal (item))
+ g_string_append (string, "exo-open --launch TerminalEmulator ");
+
+ /* expand the field codes */
+ for (p = command; *p != '\0'; ++p)
+ {
+ if (G_UNLIKELY (p[0] == '%' && p[1] != '\0'))
+ {
+ switch (*++p)
+ {
+ case 'f': case 'F':
+ case 'u': case 'U':
+ /* TODO for dnd, not a regression, xfdesktop never had this */
+ break;
+
+ case 'i':
+ tmp = garcon_menu_item_get_icon_name (item);
+ if (!panel_str_is_empty (tmp))
+ {
+ g_string_append (string, "--icon ");
+ applications_menu_plugin_append_quoted (string, tmp);
+ }
+ break;
+
+ case 'c':
+ tmp = garcon_menu_item_get_name (item);
+ if (!panel_str_is_empty (tmp))
+ applications_menu_plugin_append_quoted (string, tmp);
+ break;
+
+ case 'k':
+ uri = garcon_menu_item_get_uri (item);
+ if (!panel_str_is_empty (uri))
+ applications_menu_plugin_append_quoted (string, uri);
+ g_free (uri);
+ break;
+
+ case '%':
+ g_string_append_c (string, '%');
+ break;
+ }
+ }
+ else
+ {
+ g_string_append_c (string, *p);
+ }
+ }
+
+ /* parse and spawn command */
+ if (g_shell_parse_argv (string->str, NULL, &argv, &error))
+ {
+ result = xfce_spawn_on_screen (gtk_widget_get_screen (mi),
+ garcon_menu_item_get_path (item),
+ argv, NULL, G_SPAWN_SEARCH_PATH,
+ garcon_menu_item_supports_startup_notification (item),
+ gtk_get_current_event_time (),
+ garcon_menu_item_get_icon_name (item),
+ &error);
+
+ g_strfreev (argv);
+ }
+
+ if (G_UNLIKELY (!result))
+ {
+ xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), command);
+ g_error_free (error);
+ }
+
+ g_string_free (string, TRUE);
+}
+
+
+
+static void
+applications_menu_plugin_menu_item_drag_begin (GarconMenuItem *item,
+ GdkDragContext *drag_context)
+{
+ const gchar *icon_name;
+ panel_return_if_fail (GARCON_IS_MENU_ITEM (item));
+
+ icon_name = garcon_menu_item_get_icon_name (item);
+ if (!panel_str_is_empty (icon_name))
+ gtk_drag_set_icon_name (drag_context, icon_name, 0, 0);
+}
+
+
+
+static void
+applications_menu_plugin_menu_item_drag_data_get (GarconMenuItem *item,
+ GdkDragContext *drag_context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint drag_time)
+{
+ gchar *uris[2] = { NULL, NULL };
+
+ panel_return_if_fail (GARCON_IS_MENU_ITEM (item));
+
+ uris[0] = garcon_menu_item_get_uri (item);
+ if (G_LIKELY (uris[0] != NULL))
+ {
+ gtk_selection_data_set_uris (selection_data, uris);
+ g_free (uris[0]);
+ }
+}
+
+
+
+static void
+applications_menu_plugin_menu_item_drag_end (ApplicationsMenuPlugin *plugin)
+{
panel_return_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin));
- panel_return_if_fail (GARCON_GTK_IS_MENU (plugin->menu));
+ panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (plugin->button));
+ panel_return_if_fail (GTK_IS_MENU (plugin->menu));
- /* load the custom menu if set */
- if (plugin->custom_menu
- && plugin->custom_menu_file != NULL)
- menu = garcon_menu_new_for_path (plugin->custom_menu_file);
+ /* selection-done is never called, so handle that manually */
+ applications_menu_plugin_menu_deactivate (plugin->menu, plugin->button);
+}
- /* use the applications menu, this also respects the
- * XDG_MENU_PREFIX environment variable */
- if (G_LIKELY (menu == NULL))
- menu = garcon_menu_new_applications ();
- /* set the menu */
- garcon_gtk_menu_set_menu (GARCON_GTK_MENU (plugin->menu), menu);
- /* debugging information */
- if (0)
+static void
+applications_menu_plugin_menu_reload (ApplicationsMenuPlugin *plugin)
+{
+ panel_return_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin));
+
+ if (plugin->menu != NULL)
{
- file = garcon_menu_get_file (menu);
- filename = g_file_get_parse_name (file);
- g_object_unref (G_OBJECT (file));
+ panel_debug (PANEL_DEBUG_APPLICATIONSMENU,
+ "destroy menu for reload");
+
+ /* if the menu is opened, do not destroy it under the users'
+ * cursor, else destroy the menu in an idle, to give garcon
+ * time to finalize the events that triggered the reload */
+ if (gtk_widget_get_visible (plugin->menu))
+ g_signal_connect (G_OBJECT (plugin->menu), "selection-done",
+ G_CALLBACK (panel_utils_destroy_later), NULL);
+ else
+ panel_utils_destroy_later (GTK_WIDGET (plugin->menu));
+ }
+}
- panel_debug (PANEL_DEBUG_APPLICATIONSMENU,
- "menu from \"%s\"", filename);
- g_free (filename);
+
+
+static gboolean
+applications_menu_plugin_menu_add (GtkWidget *gtk_menu,
+ GtkWidget *button,
+ GarconMenu *menu,
+ ApplicationsMenuPlugin *plugin)
+{
+ GList *elements, *li;
+ GtkWidget *mi, *image;
+ const gchar *name, *icon_name;
+ const gchar *comment;
+ GtkWidget *submenu;
+ gboolean has_children = FALSE;
+ gint size = DEFAULT_ICON_SIZE, w, h;
+ const gchar *command;
+ GarconMenuDirectory *directory;
+
+ panel_return_val_if_fail (GTK_IS_MENU (gtk_menu), FALSE);
+ panel_return_val_if_fail (GARCON_IS_MENU (menu), FALSE);
+ panel_return_val_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin), FALSE);
+ panel_return_val_if_fail (button == NULL || GTK_IS_TOGGLE_BUTTON (button), FALSE);
+
+ if (gtk_icon_size_lookup (menu_icon_size, &w, &h))
+ size = MIN (w, h);
+
+ elements = garcon_menu_get_elements (menu);
+ for (li = elements; li != NULL; li = li->next)
+ {
+ panel_return_val_if_fail (GARCON_IS_MENU_ELEMENT (li->data), FALSE);
+ if (GARCON_IS_MENU_ITEM (li->data))
+ {
+ g_signal_connect_swapped (G_OBJECT (li->data), "changed",
+ G_CALLBACK (applications_menu_plugin_menu_reload), plugin);
+
+ if (!garcon_menu_element_get_visible (li->data))
+ continue;
+
+ name = NULL;
+ if (plugin->show_generic_names)
+ name = garcon_menu_item_get_generic_name (li->data);
+ if (name == NULL)
+ name = garcon_menu_item_get_name (li->data);
+ if (G_UNLIKELY (name == NULL))
+ continue;
+
+ mi = gtk_image_menu_item_new_with_label (name);
+ gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu), mi);
+ g_signal_connect (G_OBJECT (mi), "activate",
+ G_CALLBACK (applications_menu_plugin_menu_item_activate), li->data);
+ gtk_widget_show (mi);
+
+ if (plugin->show_tooltips)
+ {
+ comment = garcon_menu_item_get_comment (li->data);
+ if (!panel_str_is_empty (comment))
+ gtk_widget_set_tooltip_text (mi, comment);
+ }
+
+ /* dragging items from the menu to the panel */
+ gtk_drag_source_set (mi, GDK_BUTTON1_MASK, dnd_target_list,
+ G_N_ELEMENTS (dnd_target_list), GDK_ACTION_COPY);
+ g_signal_connect_swapped (G_OBJECT (mi), "drag-begin",
+ G_CALLBACK (applications_menu_plugin_menu_item_drag_begin), li->data);
+ g_signal_connect_swapped (G_OBJECT (mi), "drag-data-get",
+ G_CALLBACK (applications_menu_plugin_menu_item_drag_data_get), li->data);
+ g_signal_connect_swapped (G_OBJECT (mi), "drag-end",
+ G_CALLBACK (applications_menu_plugin_menu_item_drag_end), plugin);
+
+ command = garcon_menu_item_get_command (li->data);
+ if (G_UNLIKELY (panel_str_is_empty (command)))
+ gtk_widget_set_sensitive (mi, FALSE);
+
+ if (plugin->show_menu_icons)
+ {
+ icon_name = garcon_menu_item_get_icon_name (li->data);
+ if (panel_str_is_empty (icon_name))
+ icon_name = "applications-other";
+
+ image = xfce_panel_image_new_from_source (icon_name);
+ xfce_panel_image_set_size (XFCE_PANEL_IMAGE (image), size);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), image);
+ gtk_widget_show (image);
+ }
+
+ has_children = TRUE;
+ }
+ else if (GARCON_IS_MENU_SEPARATOR (li->data))
+ {
+ mi = gtk_separator_menu_item_new ();
+ gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu), mi);
+ gtk_widget_show (mi);
+ }
+ else if (GARCON_IS_MENU (li->data))
+ {
+ /* the element check for menu also copies the item list to
+ * check if all the elements are visible, we do that with the
+ * return value of this function, so avoid that and only check
+ * the visibility of the menu directory */
+ directory = garcon_menu_get_directory (li->data);
+ if (directory != NULL
+ && !garcon_menu_directory_get_visible (directory))
+ continue;
+
+ submenu = gtk_menu_new ();
+ if (applications_menu_plugin_menu_add (submenu, button, li->data, plugin))
+ {
+ name = garcon_menu_element_get_name (li->data);
+ mi = gtk_image_menu_item_new_with_label (name);
+ gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu), mi);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), submenu);
+ g_signal_connect (G_OBJECT (submenu), "selection-done",
+ G_CALLBACK (applications_menu_plugin_menu_deactivate), button);
+ gtk_widget_show (mi);
+
+ g_signal_connect_swapped (G_OBJECT (li->data), "directory-changed",
+ G_CALLBACK (applications_menu_plugin_menu_reload), plugin);
+
+ if (plugin->show_menu_icons)
+ {
+ icon_name = garcon_menu_element_get_icon_name (li->data);
+ if (panel_str_is_empty (icon_name))
+ icon_name = "applications-other";
+
+ image = xfce_panel_image_new_from_source (icon_name);
+ xfce_panel_image_set_size (XFCE_PANEL_IMAGE (image), size);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), image);
+ gtk_widget_show (image);
+ }
+
+ has_children = TRUE;
+ }
+ else
+ {
+ gtk_widget_destroy (submenu);
+ }
+ }
}
- g_object_unref (G_OBJECT (menu));
+ g_list_free (elements);
+
+ return has_children;
}
@@ -790,10 +1078,16 @@ applications_menu_plugin_menu (GtkWidget *button,
GdkEventButton *event,
ApplicationsMenuPlugin *plugin)
{
+ GtkWidget *mi;
+ GarconMenu *menu = NULL;
+ GError *error = NULL;
+ gchar *filename;
+ GFile *file;
+
panel_return_val_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin), FALSE);
panel_return_val_if_fail (button == NULL || plugin->button == button, FALSE);
- if (event != NULL /* remove event */
+ if (event != NULL
&& !(event->button == 1
&& event->type == GDK_BUTTON_PRESS
&& !PANEL_HAS_FLAG (event->state, GDK_CONTROL_MASK)))
@@ -802,7 +1096,64 @@ applications_menu_plugin_menu (GtkWidget *button,
if (button != NULL)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- /* show the menu */
+ if (plugin->menu == NULL)
+ {
+ if (G_UNLIKELY (plugin->custom_menu
+ && plugin->custom_menu_file != NULL))
+ menu = garcon_menu_new_for_path (plugin->custom_menu_file);
+
+ /* use the applications menu, this also respects the
+ * XDG_MENU_PREFIX environment variable */
+ if (G_LIKELY (menu == NULL))
+ menu = garcon_menu_new_applications ();
+
+ if (menu != NULL
+ && garcon_menu_load (menu, NULL, &error))
+ {
+ plugin->menu = gtk_menu_new ();
+ g_signal_connect (G_OBJECT (plugin->menu), "selection-done",
+ G_CALLBACK (applications_menu_plugin_menu_deactivate), button);
+ g_object_add_weak_pointer (G_OBJECT (plugin->menu), (gpointer) &plugin->menu);
+
+ if (!applications_menu_plugin_menu_add (plugin->menu, button, menu, plugin))
+ {
+ mi = gtk_menu_item_new_with_label (_("No applications found"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (plugin->menu), mi);
+ gtk_widget_set_sensitive (mi, FALSE);
+ gtk_widget_show (mi);
+ }
+
+ /* watch the menu for changes */
+ g_object_weak_ref (G_OBJECT (plugin->menu),
+ (GWeakNotify) g_object_unref, menu);
+ g_signal_connect_swapped (G_OBJECT (menu), "reload-required",
+ G_CALLBACK (applications_menu_plugin_menu_reload), plugin);
+
+ /* debugging information */
+ file = garcon_menu_get_file (menu);
+ filename = g_file_get_parse_name (file);
+ g_object_unref (G_OBJECT (file));
+
+ panel_debug (PANEL_DEBUG_APPLICATIONSMENU,
+ "loading from %s", filename);
+ g_free (filename);
+ }
+ else
+ {
+ xfce_dialog_show_error (NULL, error, _("Failed to load the applications menu"));
+
+ if (button != NULL)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
+
+ if (G_LIKELY (error != NULL))
+ g_error_free (error);
+ if (G_LIKELY (menu != NULL))
+ g_object_unref (G_OBJECT (menu));
+
+ return FALSE;
+ }
+ }
+
gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
button != NULL ? xfce_panel_plugin_position_menu : NULL,
plugin, 1,
@@ -810,15 +1161,3 @@ applications_menu_plugin_menu (GtkWidget *button,
return TRUE;
}
-
-
-
-static void
-applications_menu_button_theme_changed (ApplicationsMenuPlugin *plugin)
-{
- XfcePanelPlugin *panel_plugin = XFCE_PANEL_PLUGIN (plugin);
-
- applications_menu_plugin_size_changed (panel_plugin,
- xfce_panel_plugin_get_size (panel_plugin));
-}
-
diff --git a/plugins/clock/Makefile.am b/plugins/clock/Makefile.am
index cff17be..3260aca 100644
--- a/plugins/clock/Makefile.am
+++ b/plugins/clock/Makefile.am
@@ -35,7 +35,6 @@ libclock_la_CFLAGS = \
$(LIBXFCE4UTIL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(PLATFORM_CFLAGS)
@@ -54,7 +53,6 @@ libclock_la_LIBADD = \
$(CAIRO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
- $(EXO_LIBS) \
$(XFCONF_LIBS) \
-lm
@@ -85,7 +83,7 @@ DISTCLEANFILES += \
$(libclock_built_sources)
clock-dialog_ui.h: clock-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=clock_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=clock_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c
index 910450d..ff08aa6 100644
--- a/plugins/clock/clock-analog.c
+++ b/plugins/clock/clock-analog.c
@@ -46,8 +46,8 @@ static void xfce_clock_analog_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_analog_finalize (GObject *object);
-static gboolean xfce_clock_analog_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean xfce_clock_analog_draw (GtkWidget *widget,
+ cairo_t *cr);
static void xfce_clock_analog_draw_ticks (cairo_t *cr,
gdouble xc,
gdouble yc,
@@ -106,7 +106,7 @@ xfce_clock_analog_class_init (XfceClockAnalogClass *klass)
gobject_class->finalize = xfce_clock_analog_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->expose_event = xfce_clock_analog_expose_event;
+ gtkwidget_class->draw = xfce_clock_analog_draw;
g_object_class_install_property (gobject_class,
PROP_SIZE_RATIO,
@@ -209,65 +209,56 @@ xfce_clock_analog_finalize (GObject *object)
static gboolean
-xfce_clock_analog_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+xfce_clock_analog_draw (GtkWidget *widget,
+ cairo_t *cr)
{
XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (widget);
gdouble xc, yc;
gdouble angle, radius;
- cairo_t *cr;
- GDateTime *date_time;
+ GDateTime *time;
+ GtkAllocation allocation;
+ GtkStyleContext *ctx;
+ GdkRGBA fg_rgba;
panel_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (analog), FALSE);
+ panel_return_val_if_fail (cr != NULL, FALSE);
/* get center of the widget and the radius */
- xc = (widget->allocation.width / 2.0);
- yc = (widget->allocation.height / 2.0);
+ gtk_widget_get_allocation (widget, &allocation);
+ xc = (allocation.width / 2.0);
+ yc = (allocation.height / 2.0);
radius = MIN (xc, yc);
- /* add the window offset */
- xc += widget->allocation.x;
- yc += widget->allocation.y;
+ /* get the local time */
+ time = clock_time_get_time (analog->time);
- /* get the cairo context */
- cr = gdk_cairo_create (widget->window);
+ /* set the line properties */
+ cairo_set_line_width (cr, 1);
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (widget), &fg_rgba);
+ gdk_cairo_set_source_rgba (cr, &fg_rgba);
- if (G_LIKELY (cr != NULL))
+ /* draw the ticks */
+ xfce_clock_analog_draw_ticks (cr, xc, yc, radius);
+
+ if (analog->show_seconds)
{
- /* clip the drawing region */
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
- /* get the local time */
- date_time = clock_time_get_time (analog->time);
-
- /* set the line properties */
- cairo_set_line_width (cr, 1);
- gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_WIDGET_STATE (widget)]);
-
- /* draw the ticks */
- xfce_clock_analog_draw_ticks (cr, xc, yc, radius);
-
- if (analog->show_seconds)
- {
- /* second pointer */
- angle = TICKS_TO_RADIANS (g_date_time_get_second (date_time));
- xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.7, TRUE);
- }
-
- /* minute pointer */
- angle = TICKS_TO_RADIANS (g_date_time_get_minute (date_time));
- xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.8, FALSE);
-
- /* hour pointer */
- angle = HOURS_TO_RADIANS (g_date_time_get_hour (date_time), g_date_time_get_minute (date_time));
- xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.5, FALSE);
-
- /* cleanup */
- g_date_time_unref (date_time);
- cairo_destroy (cr);
+ /* second pointer */
+ angle = TICKS_TO_RADIANS (g_date_time_get_second (time));
+ xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.7, TRUE);
}
+ /* minute pointer */
+ angle = TICKS_TO_RADIANS (g_date_time_get_minute (time));
+ xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.8, FALSE);
+
+ /* hour pointer */
+ angle = HOURS_TO_RADIANS (g_date_time_get_hour (time), g_date_time_get_minute (time));
+ xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.5, FALSE);
+
+ /* cleanup */
+ g_date_time_unref (time);
+
return FALSE;
}
@@ -347,15 +338,15 @@ xfce_clock_analog_draw_pointer (cairo_t *cr,
static gboolean
xfce_clock_analog_update (XfceClockAnalog *analog,
- ClockTime *clock_time)
+ ClockTime *time)
{
GtkWidget *widget = GTK_WIDGET (analog);
panel_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (analog), FALSE);
- panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (clock_time), FALSE);
+ panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (time), FALSE);
/* update if the widget if visible */
- if (G_LIKELY (GTK_WIDGET_VISIBLE (widget)))
+ if (G_LIKELY (gtk_widget_get_visible (widget)))
gtk_widget_queue_draw (widget);
return TRUE;
@@ -364,11 +355,11 @@ xfce_clock_analog_update (XfceClockAnalog *analog,
GtkWidget *
-xfce_clock_analog_new (ClockTime *clock_time)
+xfce_clock_analog_new (ClockTime *time)
{
XfceClockAnalog *analog = g_object_new (XFCE_CLOCK_TYPE_ANALOG, NULL);
- analog->time = clock_time;
+ analog->time = time;
analog->timeout = clock_time_timeout_new (CLOCK_INTERVAL_MINUTE,
analog->time,
G_CALLBACK (xfce_clock_analog_update), analog);
diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c
index 46b852c..0b7775e 100644
--- a/plugins/clock/clock-binary.c
+++ b/plugins/clock/clock-binary.c
@@ -42,8 +42,8 @@ static void xfce_clock_binary_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_binary_finalize (GObject *object);
-static gboolean xfce_clock_binary_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean xfce_clock_binary_draw (GtkWidget *widget,
+ cairo_t *cr);
static gboolean xfce_clock_binary_update (XfceClockBinary *binary,
ClockTime *time);
@@ -98,7 +98,7 @@ xfce_clock_binary_class_init (XfceClockBinaryClass *klass)
gobject_class->finalize = xfce_clock_binary_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->expose_event = xfce_clock_binary_expose_event;
+ gtkwidget_class->draw = xfce_clock_binary_draw;
g_object_class_install_property (gobject_class,
PROP_SIZE_RATIO,
@@ -257,32 +257,54 @@ xfce_clock_binary_finalize (GObject *object)
static void
-xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary,
- cairo_t *cr,
- GtkAllocation *alloc)
+xfce_clock_binary_draw_true_binary (XfceClockBinary *binary,
+ cairo_t *cr,
+ GtkAllocation *alloc)
{
- GdkColor *active, *inactive;
- GDateTime *date_time;
- gint row, rows;
- static gint binary_table[] = { 32, 16, 8, 4, 2, 1 };
- gint col, cols = G_N_ELEMENTS (binary_table);
- gint remain_h, remain_w;
- gint offset_x, offset_y;
- gint w, h, x;
- gint ticks;
-
- if (G_UNLIKELY (GTK_WIDGET_STATE (binary) == GTK_STATE_INSENSITIVE))
+ GDateTime *time;
+ gint row, rows;
+ static gint binary_table[] = { 32, 16, 8, 4, 2, 1 };
+ gint col, cols = G_N_ELEMENTS (binary_table);
+ gint remain_h, remain_w;
+ gint offset_x, offset_y;
+ gint w, h, x;
+ gint ticks;
+ GtkStyleContext *ctx;
+ GdkRGBA active_rgba, inactive_rgba;
+ GtkSymbolicColor *literal;
+ GtkSymbolicColor *shade;
+
+ ctx = gtk_widget_get_style_context (GTK_WIDGET (binary));
+
+ if (G_UNLIKELY (gtk_widget_get_state_flags (GTK_WIDGET (binary)) & GTK_STATE_INSENSITIVE))
{
- inactive = &(GTK_WIDGET (binary)->style->mid[GTK_STATE_INSENSITIVE]);
- active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_INSENSITIVE]);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_INSENSITIVE, &inactive_rgba);
+ literal = gtk_symbolic_color_new_literal (&inactive_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &active_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
}
else
{
- inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]);
- active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &inactive_rgba);
+ literal = gtk_symbolic_color_new_literal (&inactive_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &inactive_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
+
+ gtk_style_context_get_background_color (ctx, GTK_STATE_SELECTED, &active_rgba);
+ literal = gtk_symbolic_color_new_literal (&active_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &active_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
+ gtk_style_context_get_color (ctx, GTK_STATE_NORMAL, &inactive_rgba);
+ gtk_style_context_get_color (ctx, GTK_STATE_SELECTED, &active_rgba);
}
- date_time = clock_time_get_time (binary->time);
+ time = clock_time_get_time (binary->time);
/* init sizes */
remain_h = alloc->height;
@@ -293,11 +315,11 @@ xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary,
{
/* get the time this row represents */
if (row == 0)
- ticks = g_date_time_get_hour (date_time);
+ ticks = g_date_time_get_hour (time);
else if (row == 1)
- ticks = g_date_time_get_minute (date_time);
+ ticks = g_date_time_get_minute (time);
else
- ticks = g_date_time_get_second (date_time);
+ ticks = g_date_time_get_second (time);
/* reset sizes */
remain_w = alloc->width;
@@ -315,12 +337,12 @@ xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary,
if (ticks >= binary_table[col])
{
- gdk_cairo_set_source_color (cr, active);
+ gdk_cairo_set_source_rgba (cr, &active_rgba);
ticks -= binary_table[col];
}
else if (binary->show_inactive)
{
- gdk_cairo_set_source_color (cr, inactive);
+ gdk_cairo_set_source_rgba (cr, &inactive_rgba);
}
else
{
@@ -336,39 +358,61 @@ xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary,
offset_y += h;
}
- g_date_time_unref (date_time);
+ g_date_time_unref (time);
}
static void
-xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
- cairo_t *cr,
- GtkAllocation *alloc)
+xfce_clock_binary_draw_binary (XfceClockBinary *binary,
+ cairo_t *cr,
+ GtkAllocation *alloc)
{
- GdkColor *active, *inactive;
- static gint binary_table[] = { 80, 40, 20, 10, 8, 4, 2, 1 };
- GDateTime *date_time;
- gint row, rows = G_N_ELEMENTS (binary_table) / 2;
- gint col, cols;
- gint digit;
- gint remain_h, remain_w;
- gint offset_x, offset_y;
- gint w, h, y;
- gint ticks = 0;
-
- if (G_UNLIKELY (GTK_WIDGET_STATE (binary) == GTK_STATE_INSENSITIVE))
+ static gint binary_table[] = { 80, 40, 20, 10, 8, 4, 2, 1 };
+ GDateTime *time;
+ gint row, rows = G_N_ELEMENTS (binary_table) / 2;
+ gint col, cols;
+ gint digit;
+ gint remain_h, remain_w;
+ gint offset_x, offset_y;
+ gint w, h, y;
+ gint ticks = 0;
+ GtkStyleContext *ctx;
+ GdkRGBA active_rgba, inactive_rgba;
+ GtkSymbolicColor *literal;
+ GtkSymbolicColor *shade;
+
+ ctx = gtk_widget_get_style_context (GTK_WIDGET (binary));
+
+ if (G_UNLIKELY (gtk_widget_get_state_flags (GTK_WIDGET (binary)) & GTK_STATE_INSENSITIVE))
{
- inactive = &(GTK_WIDGET (binary)->style->mid[GTK_STATE_INSENSITIVE]);
- active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_INSENSITIVE]);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_INSENSITIVE, &inactive_rgba);
+ literal = gtk_symbolic_color_new_literal (&inactive_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &active_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
}
else
{
- inactive = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_NORMAL]);
- active = &(GTK_WIDGET (binary)->style->dark[GTK_STATE_SELECTED]);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_NORMAL, &inactive_rgba);
+ literal = gtk_symbolic_color_new_literal (&inactive_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &inactive_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
+
+ gtk_style_context_get_background_color (ctx, GTK_STATE_SELECTED, &active_rgba);
+ literal = gtk_symbolic_color_new_literal (&active_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 0.7);
+ gtk_symbolic_color_resolve (shade, NULL, &active_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
+ gtk_style_context_get_color (ctx, GTK_STATE_NORMAL, &inactive_rgba);
+ gtk_style_context_get_color (ctx, GTK_STATE_SELECTED, &active_rgba);
}
- date_time = clock_time_get_time (binary->time);
+ time = clock_time_get_time (binary->time);
remain_w = alloc->width;
offset_x = alloc->x;
@@ -379,11 +423,11 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
{
/* get the time this row represents */
if (col == 0)
- ticks = g_date_time_get_hour (date_time);
+ ticks = g_date_time_get_hour (time);
else if (col == 2)
- ticks = g_date_time_get_minute (date_time);
+ ticks = g_date_time_get_minute (time);
else if (col == 4)
- ticks = g_date_time_get_second (date_time);
+ ticks = g_date_time_get_second (time);
/* reset sizes */
remain_h = alloc->height;
@@ -402,12 +446,12 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
digit = row + (4 * (col % 2));
if (ticks >= binary_table[digit])
{
- gdk_cairo_set_source_color (cr, active);
+ gdk_cairo_set_source_rgba (cr, &active_rgba);
ticks -= binary_table[digit];
}
else if (binary->show_inactive)
{
- gdk_cairo_set_source_color (cr, inactive);
+ gdk_cairo_set_source_rgba (cr, &inactive_rgba);
}
else
{
@@ -427,92 +471,93 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
static gboolean
-xfce_clock_binary_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+xfce_clock_binary_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget);
- cairo_t *cr;
- GdkColor *color;
- gint col, cols;
- gint row, rows;
- GtkAllocation alloc;
- gdouble remain_w, x;
- gdouble remain_h, y;
- gint w, h;
- gint pad_x, pad_y;
- gint diff;
+ XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget);
+ gint col, cols;
+ gint row, rows;
+ GtkAllocation alloc;
+ gdouble remain_w, x;
+ gdouble remain_h, y;
+ gint w, h;
+ gint pad_x, pad_y;
+ gint diff;
+ GtkStyleContext *ctx;
+ GdkRGBA bg_rgba, light_rgba;
+ GtkSymbolicColor *literal;
+ GtkSymbolicColor *shade;
panel_return_val_if_fail (XFCE_CLOCK_IS_BINARY (binary), FALSE);
- panel_return_val_if_fail (GDK_IS_WINDOW (widget->window), FALSE);
-
- cr = gdk_cairo_create (widget->window);
- if (G_LIKELY (cr != NULL))
+ //panel_return_val_if_fail (gtk_widget_get_has_window (widget), FALSE);
+ panel_return_val_if_fail (cr != NULL, FALSE);
+
+ gtk_misc_get_padding (GTK_MISC (widget), &pad_x, &pad_y);
+
+ gtk_widget_get_allocation (widget, &alloc);
+ alloc.width -= 1 + 2 * pad_x;
+ alloc.height -= 1 + 2 * pad_y;
+ alloc.x = pad_x + 1;
+ alloc.y = pad_y + 1;
+
+ /* align columns and fix rounding */
+ cols = binary->true_binary ? 6 : (binary->show_seconds ? 6 : 4);
+ diff = alloc.width - (floor ((gdouble) alloc.width / cols) * cols);
+ alloc.width -= diff;
+ alloc.x += diff / 2;
+
+ /* align rows and fix rounding */
+ rows = binary->true_binary ? (binary->show_seconds ? 3 : 2) : 4;
+ diff = alloc.height - (floor ((gdouble) alloc.height / rows) * rows);
+ alloc.height -= diff;
+ alloc.y += diff / 2;
+
+ if (binary->show_grid)
{
- /* clip the drawing region */
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
- gtk_misc_get_padding (GTK_MISC (widget), &pad_x, &pad_y);
-
- alloc = widget->allocation;
- alloc.width -= 1 + 2 * pad_x;
- alloc.height -= 1 + 2 * pad_y;
- alloc.x += pad_x + 1;
- alloc.y += pad_y + 1;
-
- /* align columns and fix rounding */
- cols = binary->true_binary ? 6 : (binary->show_seconds ? 6 : 4);
- diff = alloc.width - (floor ((gdouble) alloc.width / cols) * cols);
- alloc.width -= diff;
- alloc.x += diff / 2;
-
- /* align rows and fix rounding */
- rows = binary->true_binary ? (binary->show_seconds ? 3 : 2) : 4;
- diff = alloc.height - (floor ((gdouble) alloc.height / rows) * rows);
- alloc.height -= diff;
- alloc.y += diff / 2;
-
- if (binary->show_grid)
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_SELECTED, &bg_rgba);
+ /* make the bg color lighter */
+ literal = gtk_symbolic_color_new_literal (&bg_rgba);
+ shade = gtk_symbolic_color_new_shade (literal, 1.3);
+ gtk_symbolic_color_resolve (shade, NULL, &light_rgba);
+ gtk_symbolic_color_unref (shade);
+ gtk_symbolic_color_unref (literal);
+
+ gdk_cairo_set_source_rgba (cr, &light_rgba);
+ cairo_set_line_width (cr, 1);
+
+ remain_w = alloc.width;
+ remain_h = alloc.height;
+ x = alloc.x - 0.5;
+ y = alloc.y - 0.5;
+
+ cairo_rectangle (cr, x, y, alloc.width, alloc.height);
+ cairo_stroke (cr);
+
+ for (col = 0; col < cols - 1; col++)
{
- color = &(GTK_WIDGET (binary)->style->light[GTK_STATE_SELECTED]);
- gdk_cairo_set_source_color (cr, color);
- cairo_set_line_width (cr, 1);
-
- remain_w = alloc.width;
- remain_h = alloc.height;
- x = alloc.x - 0.5;
- y = alloc.y - 0.5;
-
- cairo_rectangle (cr, x, y, alloc.width, alloc.height);
+ w = remain_w / (cols - col);
+ x += w; remain_w -= w;
+ cairo_move_to (cr, x, alloc.y);
+ cairo_rel_line_to (cr, 0, alloc.height);
cairo_stroke (cr);
-
- for (col = 0; col < cols - 1; col++)
- {
- w = remain_w / (cols - col);
- x += w; remain_w -= w;
- cairo_move_to (cr, x, alloc.y);
- cairo_rel_line_to (cr, 0, alloc.height);
- cairo_stroke (cr);
- }
-
- for (row = 0; row < rows - 1; row++)
- {
- h = remain_h / (rows - row);
- y += h; remain_h -= h;
- cairo_move_to (cr, alloc.x, y);
- cairo_rel_line_to (cr, alloc.width, 0);
- cairo_stroke (cr);
- }
}
- if (binary->true_binary)
- xfce_clock_binary_expose_event_true_binary (binary, cr, &alloc);
- else
- xfce_clock_binary_expose_event_binary (binary, cr, &alloc);
-
- cairo_destroy (cr);
+ for (row = 0; row < rows - 1; row++)
+ {
+ h = remain_h / (rows - row);
+ y += h; remain_h -= h;
+ cairo_move_to (cr, alloc.x, y);
+ cairo_rel_line_to (cr, alloc.width, 0);
+ cairo_stroke (cr);
+ }
}
+ if (binary->true_binary)
+ xfce_clock_binary_draw_true_binary (binary, cr, &alloc);
+ else
+ xfce_clock_binary_draw_binary (binary, cr, &alloc);
+
return FALSE;
}
@@ -520,14 +565,14 @@ xfce_clock_binary_expose_event (GtkWidget *widget,
static gboolean
xfce_clock_binary_update (XfceClockBinary *binary,
- ClockTime *clock_time)
+ ClockTime *time)
{
GtkWidget *widget = GTK_WIDGET (binary);
panel_return_val_if_fail (XFCE_CLOCK_IS_BINARY (binary), FALSE);
/* update if the widget if visible */
- if (G_LIKELY (GTK_WIDGET_VISIBLE (widget)))
+ if (G_LIKELY (gtk_widget_get_visible (widget)))
gtk_widget_queue_draw (widget);
return TRUE;
@@ -536,11 +581,11 @@ xfce_clock_binary_update (XfceClockBinary *binary,
GtkWidget *
-xfce_clock_binary_new (ClockTime *clock_time)
+xfce_clock_binary_new (ClockTime *time)
{
XfceClockBinary *binary = g_object_new (XFCE_CLOCK_TYPE_BINARY, NULL);
- binary->time = clock_time;
+ binary->time = time;
binary->timeout = clock_time_timeout_new (CLOCK_INTERVAL_MINUTE,
binary->time,
G_CALLBACK (xfce_clock_binary_update), binary);
diff --git a/plugins/clock/clock-digital.c b/plugins/clock/clock-digital.c
index 34e7019..c293ed2 100644
--- a/plugins/clock/clock-digital.c
+++ b/plugins/clock/clock-digital.c
@@ -194,12 +194,12 @@ xfce_clock_digital_finalize (GObject *object)
static gboolean
xfce_clock_digital_update (XfceClockDigital *digital,
- ClockTime *clock_time)
+ ClockTime *time)
{
gchar *string;
panel_return_val_if_fail (XFCE_CLOCK_IS_DIGITAL (digital), FALSE);
- panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (clock_time), FALSE);
+ panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (time), FALSE);
/* set time string */
string = clock_time_strdup_strftime (digital->time, digital->format);
@@ -212,11 +212,11 @@ xfce_clock_digital_update (XfceClockDigital *digital,
GtkWidget *
-xfce_clock_digital_new (ClockTime *clock_time)
+xfce_clock_digital_new (ClockTime *time)
{
XfceClockDigital *digital = g_object_new (XFCE_CLOCK_TYPE_DIGITAL, NULL);
- digital->time = clock_time;
+ digital->time = time;
digital->timeout = clock_time_timeout_new (clock_time_interval_from_format (digital->format),
digital->time,
G_CALLBACK (xfce_clock_digital_update), digital);
diff --git a/plugins/clock/clock-fuzzy.c b/plugins/clock/clock-fuzzy.c
index 4b361dd..bc7e19a 100644
--- a/plugins/clock/clock-fuzzy.c
+++ b/plugins/clock/clock-fuzzy.c
@@ -25,7 +25,6 @@
#endif
#include <gtk/gtk.h>
-#include <exo/exo.h>
#include "clock.h"
#include "clock-time.h"
@@ -275,12 +274,12 @@ xfce_clock_fuzzy_finalize (GObject *object)
static gboolean
xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy,
- ClockTime *clock_time)
+ ClockTime *time)
{
GDateTime *date_time;
gint sector;
gint minute, hour;
- gchar *string;
+ GString *string;
const gchar *time_format;
gchar *p;
gchar pattern[3];
@@ -333,12 +332,25 @@ xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy,
p = strchr (time_format, '%');
panel_assert (p != NULL && g_ascii_isdigit (*(p + 1)));
}
+
+ string = g_string_new (NULL);
/* replace the %? with the hour name */
g_snprintf (pattern, sizeof (pattern), "%%%c", p != NULL ? *(p + 1) : '0');
- string = exo_str_replace (time_format, pattern, _(i18n_hour_names[hour]));
- gtk_label_set_text (GTK_LABEL (fuzzy), string);
- g_free (string);
+ p = strstr (time_format, pattern);
+ if (p != NULL)
+ {
+ g_string_append_len (string, time_format, p - time_format);
+ g_string_append (string, _(i18n_hour_names[hour]));
+ g_string_append (string, p + strlen (pattern));
+ }
+ else
+ {
+ g_string_append (string, time_format);
+ }
+
+ gtk_label_set_text (GTK_LABEL (fuzzy), string->str);
+ g_string_free (string, TRUE);
}
else /* FUZZINESS_DAY */
{
@@ -353,11 +365,11 @@ xfce_clock_fuzzy_update (XfceClockFuzzy *fuzzy,
GtkWidget *
-xfce_clock_fuzzy_new (ClockTime *clock_time)
+xfce_clock_fuzzy_new (ClockTime *time)
{
XfceClockFuzzy *fuzzy = g_object_new (XFCE_CLOCK_TYPE_FUZZY, NULL);
- fuzzy->time = clock_time;
+ fuzzy->time = time;
fuzzy->timeout = clock_time_timeout_new (CLOCK_INTERVAL_MINUTE,
fuzzy->time,
G_CALLBACK (xfce_clock_fuzzy_update), fuzzy);
diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c
index b180d30..662bab1 100644
--- a/plugins/clock/clock-lcd.c
+++ b/plugins/clock/clock-lcd.c
@@ -46,8 +46,8 @@ static void xfce_clock_lcd_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_lcd_finalize (GObject *object);
-static gboolean xfce_clock_lcd_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean xfce_clock_lcd_draw (GtkWidget *widget,
+ cairo_t *cr);
static gdouble xfce_clock_lcd_get_ratio (XfceClockLcd *lcd);
static gdouble xfce_clock_lcd_draw_dots (cairo_t *cr,
gdouble size,
@@ -119,7 +119,7 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass)
gobject_class->finalize = xfce_clock_lcd_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->expose_event = xfce_clock_lcd_expose_event;
+ gtkwidget_class->draw = xfce_clock_lcd_draw;
g_object_class_install_property (gobject_class,
PROP_SIZE_RATIO,
@@ -276,123 +276,115 @@ xfce_clock_lcd_finalize (GObject *object)
static gboolean
-xfce_clock_lcd_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+xfce_clock_lcd_draw (GtkWidget *widget,
+ cairo_t *cr)
{
XfceClockLcd *lcd = XFCE_CLOCK_LCD (widget);
- cairo_t *cr;
gdouble offset_x, offset_y;
gint ticks, i;
gdouble size;
gdouble ratio;
- GDateTime *date_time;
+ GDateTime *time;
+ GtkAllocation allocation;
panel_return_val_if_fail (XFCE_CLOCK_IS_LCD (lcd), FALSE);
+ panel_return_val_if_fail (cr != NULL, FALSE);
/* get the width:height ratio */
ratio = xfce_clock_lcd_get_ratio (XFCE_CLOCK_LCD (widget));
/* make sure we also fit on small vertical panels */
- size = MIN ((gdouble) widget->allocation.width / ratio, widget->allocation.height);
+ gtk_widget_get_allocation (widget, &allocation);
+ size = MIN ((gdouble) allocation.width / ratio, allocation.height);
/* begin offsets */
- offset_x = rint ((widget->allocation.width - (size * ratio)) / 2.00);
- offset_y = rint ((widget->allocation.height - size) / 2.00);
+ offset_x = rint ((allocation.width - (size * ratio)) / 2.00);
+ offset_y = rint ((allocation.height - size) / 2.00);
/* only allow positive values from the base point */
- offset_x = widget->allocation.x + MAX (0.00, offset_x);
- offset_y = widget->allocation.y + MAX (0.00, offset_y);
+ offset_x = MAX (0.00, offset_x);
+ offset_y = MAX (0.00, offset_y);
- /* get the cairo context */
- cr = gdk_cairo_create (widget->window);
+ cairo_push_group (cr);
- if (G_LIKELY (cr != NULL))
- {
- gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_WIDGET_STATE (widget)]);
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
- cairo_push_group (cr);
+ /* width of the clear line */
+ cairo_set_line_width (cr, MAX (size * 0.05, 1.5));
- /* width of the clear line */
- cairo_set_line_width (cr, MAX (size * 0.05, 1.5));
+ /* get the local time */
+ time = clock_time_get_time (lcd->time);
- /* get the local time */
- date_time = clock_time_get_time (lcd->time);
+ /* draw the hours */
+ ticks = g_date_time_get_hour (time);
- /* draw the hours */
- ticks = g_date_time_get_hour (date_time);
+ /* convert 24h clock to 12h clock */
+ if (!lcd->show_military && ticks > 12)
+ ticks -= 12;
- /* convert 24h clock to 12h clock */
- if (!lcd->show_military && ticks > 12)
- ticks -= 12;
+ if (ticks == 1 || (ticks >= 10 && ticks < 20))
+ offset_x -= size * (RELATIVE_SPACE * 4);
- if (ticks == 1 || (ticks >= 10 && ticks < 20))
- offset_x -= size * (RELATIVE_SPACE * 4);
+ /* queue a resize when the number of hour digits changed,
+ * because we might miss the exact second (due to slightly delayed
+ * timeout) we queue a resize the first 3 seconds or anything in
+ * the first minute */
+ if ((ticks == 10 || ticks == 0) && g_date_time_get_minute (time) == 0
+ && (!lcd->show_seconds || g_date_time_get_second (time) < 3))
+ g_object_notify (G_OBJECT (lcd), "size-ratio");
+
+ if (ticks >= 10)
+ {
+ /* draw the number and increase the offset */
+ offset_x = xfce_clock_lcd_draw_digit (cr, ticks >= 20 ? 2 : 1, size, offset_x, offset_y);
+ }
- /* queue a resize when the number of hour digits changed,
- * because we might miss the exact second (due to slightly delayed
- * timeout) we queue a resize the first 3 seconds or anything in
- * the first minute */
- if ((ticks == 10 || ticks == 0) && g_date_time_get_minute (date_time) == 0
- && (!lcd->show_seconds || g_date_time_get_second (date_time) < 3))
- g_object_notify (G_OBJECT (lcd), "size-ratio");
+ /* draw the other number of the hour and increase the offset */
+ offset_x = xfce_clock_lcd_draw_digit (cr, ticks % 10, size, offset_x, offset_y);
- if (ticks >= 10)
+ for (i = 0; i < 2; i++)
+ {
+ /* get the time */
+ if (i == 0)
{
- /* draw the number and increase the offset */
- offset_x = xfce_clock_lcd_draw_digit (cr, ticks >= 20 ? 2 : 1, size, offset_x, offset_y);
+ /* get the minutes */
+ ticks = g_date_time_get_minute (time);
}
-
- /* draw the other number of the hour and increase the offset */
- offset_x = xfce_clock_lcd_draw_digit (cr, ticks % 10, size, offset_x, offset_y);
-
- for (i = 0; i < 2; i++)
+ else
{
- /* get the time */
- if (i == 0)
- {
- /* get the minutes */
- ticks = g_date_time_get_minute (date_time);
- }
- else
- {
- /* leave when we don't want seconds */
- if (!lcd->show_seconds)
- break;
-
- /* get the seconds */
- ticks = g_date_time_get_second (date_time);
- }
-
- /* draw the dots */
- if (lcd->flash_separators && (g_date_time_get_second (date_time) % 2) == 1)
- offset_x += size * RELATIVE_SPACE * 2;
- else
- offset_x = xfce_clock_lcd_draw_dots (cr, size, offset_x, offset_y);
-
- /* draw the first digit */
- offset_x = xfce_clock_lcd_draw_digit (cr, (ticks - (ticks % 10)) / 10, size, offset_x, offset_y);
+ /* leave when we don't want seconds */
+ if (!lcd->show_seconds)
+ break;
- /* draw the second digit */
- offset_x = xfce_clock_lcd_draw_digit (cr, ticks % 10, size, offset_x, offset_y);
+ /* get the seconds */
+ ticks = g_date_time_get_second (time);
}
- if (lcd->show_meridiem)
- {
- /* am or pm? */
- ticks = g_date_time_get_hour (date_time) >= 12 ? 11 : 10;
+ /* draw the dots */
+ if (lcd->flash_separators && (g_date_time_get_second (time) % 2) == 1)
+ offset_x += size * RELATIVE_SPACE * 2;
+ else
+ offset_x = xfce_clock_lcd_draw_dots (cr, size, offset_x, offset_y);
- /* draw the digit */
- offset_x = xfce_clock_lcd_draw_digit (cr, ticks, size, offset_x, offset_y);
- }
+ /* draw the first digit */
+ offset_x = xfce_clock_lcd_draw_digit (cr, (ticks - (ticks % 10)) / 10, size, offset_x, offset_y);
+
+ /* draw the second digit */
+ offset_x = xfce_clock_lcd_draw_digit (cr, ticks % 10, size, offset_x, offset_y);
+ }
+
+ if (lcd->show_meridiem)
+ {
+ /* am or pm? */
+ ticks = g_date_time_get_hour (time) >= 12 ? 11 : 10;
- /* drop the pushed group */
- g_date_time_unref (date_time);
- cairo_pop_group_to_source (cr);
- cairo_paint (cr);
- cairo_destroy (cr);
+ /* draw the digit */
+ offset_x = xfce_clock_lcd_draw_digit (cr, ticks, size, offset_x, offset_y);
}
+ /* drop the pushed group */
+ g_date_time_unref (time);
+ cairo_pop_group_to_source (cr);
+ cairo_paint (cr);
+
return FALSE;
}
@@ -403,16 +395,16 @@ xfce_clock_lcd_get_ratio (XfceClockLcd *lcd)
{
gdouble ratio;
gint ticks;
- GDateTime *date_time;
+ GDateTime *time;
/* get the local time */
- date_time = clock_time_get_time (lcd->time);
+ time = clock_time_get_time (lcd->time);
/* 8:8(space)8 */
ratio = (3 * RELATIVE_DIGIT) + RELATIVE_DOTS + RELATIVE_SPACE;
- ticks = g_date_time_get_hour (date_time);
- g_date_time_unref (date_time);
+ ticks = g_date_time_get_hour (time);
+ g_date_time_unref (time);
if (!lcd->show_military && ticks > 12)
ticks -= 12;
@@ -584,14 +576,14 @@ xfce_clock_lcd_draw_digit (cairo_t *cr,
static gboolean
xfce_clock_lcd_update (XfceClockLcd *lcd,
- ClockTime *clock_time)
+ ClockTime *time)
{
GtkWidget *widget = GTK_WIDGET (lcd);
panel_return_val_if_fail (XFCE_CLOCK_IS_LCD (lcd), FALSE);
/* update if the widget if visible */
- if (G_LIKELY (GTK_WIDGET_VISIBLE (widget)))
+ if (G_LIKELY (gtk_widget_get_visible (widget)))
gtk_widget_queue_draw (widget);
return TRUE;
@@ -600,11 +592,11 @@ xfce_clock_lcd_update (XfceClockLcd *lcd,
GtkWidget *
-xfce_clock_lcd_new (ClockTime *clock_time)
+xfce_clock_lcd_new (ClockTime *time)
{
XfceClockLcd *lcd = g_object_new (XFCE_CLOCK_TYPE_LCD, NULL);
- lcd->time = clock_time;
+ lcd->time = time;
lcd->timeout = clock_time_timeout_new (CLOCK_INTERVAL_MINUTE,
lcd->time,
G_CALLBACK (xfce_clock_lcd_update), lcd);
diff --git a/plugins/clock/clock-time.c b/plugins/clock/clock-time.c
index b015b13..f737cad 100644
--- a/plugins/clock/clock-time.c
+++ b/plugins/clock/clock-time.c
@@ -18,7 +18,6 @@
#include <glib.h>
-#include <exo/exo.h>
#include "clock-time.h"
#include "clock.h"
@@ -93,7 +92,7 @@ clock_time_class_init (ClockTimeClass *klass)
g_param_spec_string ("timezone",
NULL, NULL,
DEFAULT_TIMEZONE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
clock_time_signals[TIME_CHANGED] =
g_signal_new (g_intern_static_string ("time-changed"),
@@ -107,10 +106,10 @@ clock_time_class_init (ClockTimeClass *klass)
static void
-clock_time_init (ClockTime *clock_time)
+clock_time_init (ClockTime *time)
{
- clock_time->timezone_name = g_strdup (DEFAULT_TIMEZONE);
- clock_time->timezone = g_time_zone_new_local ();
+ time->timezone_name = g_strdup (DEFAULT_TIMEZONE);
+ time->timezone = g_time_zone_new_local ();
}
@@ -118,11 +117,11 @@ clock_time_init (ClockTime *clock_time)
static void
clock_time_finalize (GObject *object)
{
- ClockTime *clock_time = XFCE_CLOCK_TIME (object);
+ ClockTime *time = XFCE_CLOCK_TIME (object);
- g_free (clock_time->timezone_name);
+ g_free (time->timezone_name);
- g_time_zone_unref (clock_time->timezone);
+ g_time_zone_unref (time->timezone);
G_OBJECT_CLASS (clock_time_parent_class)->finalize (object);
}
@@ -135,12 +134,12 @@ clock_time_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ClockTime *clock_time = XFCE_CLOCK_TIME (object);
+ ClockTime *time = XFCE_CLOCK_TIME (object);
switch (prop_id)
{
case PROP_TIMEZONE:
- g_value_set_string (value, clock_time->timezone_name);
+ g_value_set_string (value, time->timezone_name);
break;
default:
@@ -157,29 +156,29 @@ clock_time_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- ClockTime *clock_time = XFCE_CLOCK_TIME (object);
+ ClockTime *time = XFCE_CLOCK_TIME (object);
const gchar *str_value;
switch (prop_id)
{
case PROP_TIMEZONE:
str_value = g_value_get_string (value);
- if (g_strcmp0 (clock_time->timezone_name, str_value) != 0)
+ if (g_strcmp0 (time->timezone_name, str_value) != 0)
{
- g_free (clock_time->timezone_name);
- g_time_zone_unref (clock_time->timezone);
+ g_free (time->timezone_name);
+ g_time_zone_unref (time->timezone);
if (str_value == NULL || g_strcmp0 (str_value, "") == 0)
{
- clock_time->timezone_name = g_strdup (DEFAULT_TIMEZONE);
- clock_time->timezone = g_time_zone_new_local ();
+ time->timezone_name = g_strdup (DEFAULT_TIMEZONE);
+ time->timezone = g_time_zone_new_local ();
}
else
{
- clock_time->timezone_name = g_strdup (str_value);
- clock_time->timezone = g_time_zone_new (str_value);
+ time->timezone_name = g_strdup (str_value);
+ time->timezone = g_time_zone_new (str_value);
}
- g_signal_emit (G_OBJECT (clock_time), clock_time_signals[TIME_CHANGED], 0);
+ g_signal_emit (G_OBJECT (time), clock_time_signals[TIME_CHANGED], 0);
}
break;
@@ -192,14 +191,14 @@ clock_time_set_property (GObject *object,
GDateTime *
-clock_time_get_time (ClockTime *clock_time)
+clock_time_get_time (ClockTime *time)
{
GDateTime *date_time;
- panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (clock_time), NULL);
+ panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (time), NULL);
- if (clock_time->timezone != NULL)
- date_time = g_date_time_new_now (clock_time->timezone);
+ if (time->timezone != NULL)
+ date_time = g_date_time_new_now (time->timezone);
else
date_time = g_date_time_new_now_local ();
@@ -209,15 +208,15 @@ clock_time_get_time (ClockTime *clock_time)
gchar *
-clock_time_strdup_strftime (ClockTime *clock_time,
+clock_time_strdup_strftime (ClockTime *time,
const gchar *format)
{
GDateTime *date_time;
gchar *str;
- panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (clock_time), NULL);
+ panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (time), NULL);
- date_time = clock_time_get_time (clock_time);
+ date_time = clock_time_get_time (time);
str = g_date_time_format (date_time, format);
g_date_time_unref (date_time);
@@ -232,7 +231,7 @@ clock_time_interval_from_format (const gchar *format)
{
const gchar *p;
- if (G_UNLIKELY (exo_str_is_empty (format)))
+ if (G_UNLIKELY (panel_str_is_empty (format)))
return CLOCK_INTERVAL_MINUTE;
for (p = format; *p != '\0'; ++p)
@@ -262,7 +261,7 @@ static gboolean
clock_time_timeout_running (gpointer user_data)
{
ClockTimeTimeout *timeout = user_data;
- GDateTime *date_time;
+ GDateTime *time;
g_signal_emit (G_OBJECT (timeout->time), clock_time_signals[TIME_CHANGED], 0);
@@ -270,8 +269,8 @@ clock_time_timeout_running (gpointer user_data)
if (timeout->interval == CLOCK_INTERVAL_MINUTE)
{
/* sync again when we don't run on time */
- date_time = clock_time_get_time (timeout->time);
- timeout->restart = (g_date_time_get_second (date_time) != 0);
+ time = clock_time_get_time (timeout->time);
+ timeout->restart = (g_date_time_get_second (time) != 0);
}
return !timeout->restart;
@@ -312,13 +311,13 @@ clock_time_timeout_sync (gpointer user_data)
ClockTimeTimeout *
clock_time_timeout_new (guint interval,
- ClockTime *clock_time,
+ ClockTime *time,
GCallback c_handler,
gpointer gobject)
{
ClockTimeTimeout *timeout;
- panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (clock_time), NULL);
+ panel_return_val_if_fail (XFCE_IS_CLOCK_TIME (time), NULL);
panel_return_val_if_fail (interval > 0, NULL);
@@ -326,10 +325,10 @@ clock_time_timeout_new (guint interval,
timeout->interval = 0;
timeout->timeout_id = 0;
timeout->restart = FALSE;
- timeout->time = clock_time;
+ timeout->time = time;
timeout->time_changed_id =
- g_signal_connect_swapped (G_OBJECT (clock_time), "time-changed",
+ g_signal_connect_swapped (G_OBJECT (time), "time-changed",
c_handler, gobject);
g_object_ref (G_OBJECT (timeout->time));
@@ -345,7 +344,7 @@ void
clock_time_timeout_set_interval (ClockTimeTimeout *timeout,
guint interval)
{
- GDateTime *date_time;
+ GDateTime *time;
guint next_interval;
gboolean restart;
@@ -372,8 +371,8 @@ clock_time_timeout_set_interval (ClockTimeTimeout *timeout,
/* get the seconds to the next internal */
if (interval == CLOCK_INTERVAL_MINUTE)
{
- date_time = clock_time_get_time (timeout->time);
- next_interval = 60 - g_date_time_get_second (date_time);
+ time = clock_time_get_time (timeout->time);
+ next_interval = 60 - g_date_time_get_second (time);
}
else
{
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index e07c17b..3900a48 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -27,7 +27,6 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
@@ -86,7 +85,8 @@ static void clock_plugin_set_mode (ClockPlugin *p
static void clock_plugin_reposition_calendar (ClockPlugin *plugin);
static gboolean clock_plugin_pointer_grab (ClockPlugin *plugin,
GtkWidget *widget,
- gboolean keep);
+ gboolean keep,
+ guint32 activate_time);
static void clock_plugin_pointer_ungrab (ClockPlugin *plugin,
GtkWidget *widget);
static gboolean clock_plugin_calendar_pointed (GtkWidget *calendar_window,
@@ -98,8 +98,7 @@ static gboolean clock_plugin_calendar_button_press_event (GtkWidget *c
static gboolean clock_plugin_calendar_key_press_event (GtkWidget *calendar_window,
GdkEventKey *event,
ClockPlugin *plugin);
-static void clock_plugin_popup_calendar (ClockPlugin *plugin,
- gboolean modal);
+static void clock_plugin_popup_calendar (ClockPlugin *plugin);
static void clock_plugin_hide_calendar (ClockPlugin *plugin);
static gboolean clock_plugin_tooltip (gpointer user_data);
@@ -152,8 +151,11 @@ struct _ClockPlugin
gchar *tooltip_format;
ClockTimeTimeout *tooltip_timeout;
- GdkGrabStatus grab_pointer;
- GdkGrabStatus grab_keyboard;
+ GdkDevice *device;
+ GdkDevice *keyboard;
+ GdkDevice *pointer;
+ gboolean keyboard_grabbed;
+ gboolean pointer_grabbed;
gchar *time_config_tool;
ClockTime *time;
@@ -230,34 +232,34 @@ clock_plugin_class_init (ClockPluginClass *klass)
CLOCK_PLUGIN_MODE_MIN,
CLOCK_PLUGIN_MODE_MAX,
CLOCK_PLUGIN_MODE_DEFAULT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_TOOLTIP_FORMAT,
g_param_spec_string ("tooltip-format",
NULL, NULL,
DEFAULT_TOOLTIP_FORMAT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ROTATE_VERTICALLY,
g_param_spec_boolean ("rotate-vertically",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_COMMAND,
g_param_spec_string ("command",
NULL, NULL, NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_TIME_CONFIG_TOOL,
g_param_spec_string ("time-config-tool",
NULL, NULL,
DEFAULT_TIME_CONFIG_TOOL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -272,6 +274,11 @@ clock_plugin_init (ClockPlugin *plugin)
plugin->command = NULL;
plugin->time_config_tool = g_strdup (DEFAULT_TIME_CONFIG_TOOL);
plugin->rotate_vertically = TRUE;
+ plugin->device = NULL;
+ plugin->keyboard = NULL;
+ plugin->pointer = NULL;
+ plugin->keyboard_grabbed = FALSE;
+ plugin->pointer_grabbed = FALSE;
plugin->time = clock_time_new ();
plugin->button = xfce_panel_create_toggle_button ();
@@ -433,20 +440,25 @@ clock_plugin_button_press_event (GtkWidget *widget,
if (event->button == 1 || event->button == 2)
{
if (event->type == GDK_BUTTON_PRESS &&
- exo_str_is_empty (plugin->command))
+ panel_str_is_empty (plugin->command))
{
/* toggle calendar window visibility */
if (plugin->calendar_window == NULL
|| !gtk_widget_get_visible (GTK_WIDGET (plugin->calendar_window)))
- clock_plugin_popup_calendar
- (plugin, event->button == 1 && !(event->state & GDK_CONTROL_MASK));
+ {
+ clock_plugin_popup_calendar (plugin);
+ if (event->button == 1 && !(event->state & GDK_CONTROL_MASK))
+ clock_plugin_pointer_grab (plugin, GTK_WIDGET (plugin->calendar_window), TRUE, event->time);
+ }
else
- clock_plugin_hide_calendar (plugin);
+ {
+ clock_plugin_hide_calendar (plugin);
+ }
return TRUE;
}
else if (event->type == GDK_2BUTTON_PRESS
- && !exo_str_is_empty (plugin->command))
+ && !panel_str_is_empty (plugin->command))
{
/* launch command */
if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (widget),
@@ -697,15 +709,16 @@ clock_plugin_configure_plugin_mode_changed (GtkComboBox *combo,
g_object_set (G_OBJECT (dialog->plugin), "mode", mode, NULL);
panel_return_if_fail (G_IS_OBJECT (dialog->plugin->clock));
- /* connect the exo bindings */
+ /* connect the bindings */
for (i = 0; i < G_N_ELEMENTS (names); i++)
{
if (PANEL_HAS_FLAG (active, 1 << (i + 1)))
{
object = gtk_builder_get_object (dialog->builder, names[i].binding);
panel_return_if_fail (G_IS_OBJECT (object));
- exo_mutual_binding_new (G_OBJECT (dialog->plugin->clock), names[i].binding,
- G_OBJECT (object), names[i].property);
+ g_object_bind_property (G_OBJECT (dialog->plugin->clock), names[i].binding,
+ G_OBJECT (object), names[i].property,
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
}
}
@@ -791,7 +804,7 @@ clock_plugin_configure_plugin_chooser_fill (ClockPlugin *plugin,
g_free (preview);
if (has_active == FALSE
- && !exo_str_is_empty (active_format)
+ && !panel_str_is_empty (active_format)
&& strcmp (active_format, formats[i]) == 0)
{
gtk_combo_box_set_active_iter (combo, &iter);
@@ -895,8 +908,7 @@ clock_plugin_configure_zoneinfo_model_insert (GtkListStore *store,
if (g_file_test (filename, G_FILE_TEST_IS_DIR))
{
- if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK))
- clock_plugin_configure_zoneinfo_model_insert (store, filename);
+ clock_plugin_configure_zoneinfo_model_insert (store, filename);
}
else
{
@@ -920,8 +932,6 @@ clock_plugin_configure_zoneinfo_model (gpointer data)
GtkListStore *store;
GObject *object;
- GDK_THREADS_ENTER ();
-
dialog->zonecompletion_idle = 0;
object = gtk_builder_get_object (dialog->builder, "timezone-name");
@@ -942,8 +952,6 @@ clock_plugin_configure_zoneinfo_model (gpointer data)
g_object_unref (G_OBJECT (completion));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -983,22 +991,25 @@ clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
object = gtk_builder_get_object (builder, "timezone-name");
panel_return_if_fail (GTK_IS_ENTRY (object));
- exo_mutual_binding_new (G_OBJECT (plugin->time), "timezone",
- G_OBJECT (object), "text");
+ g_object_bind_property (G_OBJECT (plugin->time), "timezone",
+ G_OBJECT (object), "text",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
/* idle add the zone completion */
- dialog->zonecompletion_idle = g_idle_add (clock_plugin_configure_zoneinfo_model, dialog);
+ dialog->zonecompletion_idle = gdk_threads_add_idle (clock_plugin_configure_zoneinfo_model, dialog);
object = gtk_builder_get_object (builder, "mode");
g_signal_connect_data (G_OBJECT (object), "changed",
G_CALLBACK (clock_plugin_configure_plugin_mode_changed), dialog,
(GClosureNotify) clock_plugin_configure_plugin_free, 0);
- exo_mutual_binding_new (G_OBJECT (plugin), "mode",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "mode",
+ G_OBJECT (object), "active",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
object = gtk_builder_get_object (builder, "tooltip-format");
- exo_mutual_binding_new (G_OBJECT (plugin), "tooltip-format",
- G_OBJECT (object), "text");
+ g_object_bind_property (G_OBJECT (plugin), "tooltip-format",
+ G_OBJECT (object), "text",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
combo = gtk_builder_get_object (builder, "tooltip-chooser");
clock_plugin_configure_plugin_chooser_fill (plugin,
GTK_COMBO_BOX (combo),
@@ -1113,17 +1124,17 @@ static void
clock_plugin_calendar_show_event (GtkWidget *calendar_window,
ClockPlugin *plugin)
{
- GDateTime *date_time;
+ GDateTime *time;
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
clock_plugin_reposition_calendar (plugin);
- date_time = clock_time_get_time (plugin->time);
- gtk_calendar_select_month (GTK_CALENDAR (plugin->calendar), g_date_time_get_month (date_time) - 1,
- g_date_time_get_year (date_time));
- gtk_calendar_select_day (GTK_CALENDAR (plugin->calendar), g_date_time_get_day_of_month (date_time));
- g_date_time_unref (date_time);
+ time = clock_time_get_time (plugin->time);
+ gtk_calendar_select_month (GTK_CALENDAR (plugin->calendar), g_date_time_get_month (time) - 1,
+ g_date_time_get_year (time));
+ gtk_calendar_select_day (GTK_CALENDAR (plugin->calendar), g_date_time_get_day_of_month (time));
+ g_date_time_unref (time);
}
@@ -1132,10 +1143,19 @@ static void
clock_plugin_pointer_ungrab (ClockPlugin *plugin,
GtkWidget *widget)
{
- if (plugin->grab_pointer == GDK_GRAB_SUCCESS)
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- if (plugin->grab_keyboard == GDK_GRAB_SUCCESS)
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+ panel_return_if_fail (XFCE_IS_CLOCK_PLUGIN (plugin));
+
+ if (plugin->keyboard != NULL && plugin->keyboard_grabbed)
+ {
+ gdk_device_ungrab (plugin->keyboard, GDK_CURRENT_TIME);
+ plugin->keyboard_grabbed = FALSE;
+ }
+
+ if (plugin->pointer != NULL && plugin->pointer_grabbed)
+ {
+ gdk_device_ungrab (plugin->pointer, GDK_CURRENT_TIME);
+ plugin->pointer_grabbed = FALSE;
+ }
}
@@ -1143,32 +1163,64 @@ clock_plugin_pointer_ungrab (ClockPlugin *plugin,
static gboolean
clock_plugin_pointer_grab (ClockPlugin *plugin,
GtkWidget *widget,
- gboolean keep)
+ gboolean keep,
+ guint32 activate_time)
{
- GdkWindow *window;
- gboolean grab_succeed = FALSE;
- guint i;
- GdkEventMask pointer_mask = GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
- | GDK_POINTER_MOTION_MASK;
+ GdkWindow *window;
+ gboolean grabbed = FALSE;
+ guint i;
+ GdkDisplay *display;
+ GdkDeviceManager *device_manager;
+ GList *devices;
+
+ window = gtk_widget_get_window (widget);
- window = widget->window;
+ if (plugin->device == NULL)
+ plugin->device = gtk_get_current_event_device ();
+
+ if (plugin->device == NULL)
+ {
+ display = gtk_widget_get_display (widget);
+ device_manager = gdk_display_get_device_manager (display);
+ devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+ plugin->device = devices->data;
+ g_list_free (devices);
+ }
+
+ if (gdk_device_get_source (plugin->device) == GDK_SOURCE_KEYBOARD)
+ {
+ plugin->keyboard = plugin->device;
+ plugin->pointer = gdk_device_get_associated_device (plugin->device);
+ }
+ else
+ {
+ plugin->pointer = plugin->device;
+ plugin->keyboard = gdk_device_get_associated_device (plugin->device);
+ }
/* don't try to get the grab for longer then 1/4 second */
for (i = 0; i < (G_USEC_PER_SEC / 100 / 4); i++)
{
- plugin->grab_keyboard = gdk_keyboard_grab (window, TRUE, GDK_CURRENT_TIME);
- if (plugin->grab_keyboard == GDK_GRAB_SUCCESS)
+ plugin->keyboard_grabbed =
+ plugin->keyboard != NULL &&
+ gdk_device_grab (plugin->keyboard, window,
+ GDK_OWNERSHIP_WINDOW, TRUE,
+ GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
+ NULL, activate_time) == GDK_GRAB_SUCCESS;
+ if (plugin->keyboard_grabbed)
{
- plugin->grab_pointer = gdk_pointer_grab (window, TRUE, pointer_mask,
- NULL, NULL, GDK_CURRENT_TIME);
- if (plugin->grab_pointer == GDK_GRAB_SUCCESS)
- {
- grab_succeed = TRUE;
- break;
- }
+ grabbed = plugin->pointer_grabbed =
+ plugin->pointer != NULL &&
+ gdk_device_grab (plugin->pointer, window,
+ GDK_OWNERSHIP_WINDOW, TRUE,
+ GDK_SMOOTH_SCROLL_MASK |
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
+ GDK_POINTER_MOTION_MASK,
+ NULL, activate_time) == GDK_GRAB_SUCCESS;
+ if (grabbed)
+ break;
}
-
g_usleep (100);
}
@@ -1176,14 +1228,14 @@ clock_plugin_pointer_grab (ClockPlugin *plugin,
if (!keep)
clock_plugin_pointer_ungrab (plugin, widget);
- if (!grab_succeed)
+ if (!grabbed)
{
clock_plugin_pointer_ungrab (plugin, widget);
g_printerr (PACKAGE_NAME ": Unable to get keyboard and mouse "
"grab. Popup failed.\n");
}
- return grab_succeed;
+ return grabbed;
}
@@ -1194,13 +1246,16 @@ clock_plugin_calendar_pointed (GtkWidget *calendar_window,
gdouble y_root)
{
gint window_x, window_y;
+ GtkAllocation allocation;
if (gtk_widget_get_mapped (calendar_window))
{
- gdk_window_get_position (calendar_window->window, &window_x, &window_y);
+ gdk_window_get_position (gtk_widget_get_window (calendar_window), &window_x, &window_y);
+
+ gtk_widget_get_allocation (calendar_window, &allocation);
- if (x_root >= window_x && x_root < window_x + calendar_window->allocation.width &&
- y_root >= window_y && y_root < window_y + calendar_window->allocation.height)
+ if (x_root >= window_x && x_root < window_x + allocation.width &&
+ y_root >= window_y && y_root < window_y + allocation.height)
return TRUE;
}
@@ -1243,8 +1298,7 @@ clock_plugin_calendar_key_press_event (GtkWidget *calendar_window,
static void
-clock_plugin_popup_calendar (ClockPlugin *plugin,
- gboolean modal)
+clock_plugin_popup_calendar (ClockPlugin *plugin)
{
if (plugin->calendar_window == NULL)
{
@@ -1276,8 +1330,6 @@ clock_plugin_popup_calendar (ClockPlugin *plugin,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->button), TRUE);
gtk_widget_show (GTK_WIDGET (plugin->calendar_window));
xfce_panel_plugin_block_autohide (XFCE_PANEL_PLUGIN (plugin), TRUE);
- if (modal)
- clock_plugin_pointer_grab (plugin, GTK_WIDGET (plugin->calendar_window), TRUE);
}
diff --git a/plugins/directorymenu/Makefile.am b/plugins/directorymenu/Makefile.am
index a44a93b..c8208f6 100644
--- a/plugins/directorymenu/Makefile.am
+++ b/plugins/directorymenu/Makefile.am
@@ -19,7 +19,6 @@ libdirectorymenu_la_SOURCES = \
libdirectorymenu_la_CFLAGS = \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
@@ -37,7 +36,6 @@ libdirectorymenu_la_LDFLAGS = \
libdirectorymenu_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(top_builddir)/common/libpanel-common.la \
- $(EXO_LIBS) \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
@@ -84,7 +82,7 @@ DISTCLEANFILES += \
$(libdirectorymenu_built_sources)
directorymenu-dialog_ui.h: directorymenu-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=directorymenu_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=directorymenu_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/directorymenu/directorymenu-dialog.glade b/plugins/directorymenu/directorymenu-dialog.glade
index c8b4797..9b268b0 100644
--- a/plugins/directorymenu/directorymenu-dialog.glade
+++ b/plugins/directorymenu/directorymenu-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
diff --git a/plugins/directorymenu/directorymenu.c b/plugins/directorymenu/directorymenu.c
index 51c088c..edd72e3 100644
--- a/plugins/directorymenu/directorymenu.c
+++ b/plugins/directorymenu/directorymenu.c
@@ -21,7 +21,6 @@
#endif
#include <gio/gio.h>
-#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/libxfce4panel.h>
@@ -127,28 +126,28 @@ directory_menu_plugin_class_init (DirectoryMenuPluginClass *klass)
g_param_spec_string ("base-directory",
NULL, NULL,
NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ICON_NAME,
g_param_spec_string ("icon-name",
NULL, NULL,
NULL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_FILE_PATTERN,
g_param_spec_string ("file-pattern",
NULL, NULL,
"",
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_HIDDEN_FILES,
g_param_spec_boolean ("hidden-files",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
menu_file = g_quark_from_static_string ("dir-menu-file");
@@ -201,7 +200,7 @@ directory_menu_plugin_get_property (GObject *object,
break;
case PROP_FILE_PATTERN:
- g_value_set_string (value, exo_str_is_empty (plugin->file_pattern) ?
+ g_value_set_string (value, panel_str_is_empty (plugin->file_pattern) ?
"" : plugin->file_pattern);
break;
@@ -233,7 +232,7 @@ directory_menu_plugin_set_property (GObject *object,
{
case PROP_BASE_DIRECTORY:
path = g_value_get_string (value);
- if (exo_str_is_empty (path))
+ if (panel_str_is_empty (path))
path = g_get_home_dir ();
if (plugin->base_directory != NULL)
@@ -252,7 +251,7 @@ directory_menu_plugin_set_property (GObject *object,
g_free (plugin->icon_name);
plugin->icon_name = g_value_dup_string (value);
xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (plugin->icon),
- exo_str_is_empty (plugin->icon_name) ? DEFAULT_ICON_NAME : plugin->icon_name);
+ panel_str_is_empty (plugin->icon_name) ? DEFAULT_ICON_NAME : plugin->icon_name);
break;
case PROP_FILE_PATTERN:
@@ -265,7 +264,7 @@ directory_menu_plugin_set_property (GObject *object,
if (G_LIKELY (array != NULL))
{
for (i = 0; array[i] != NULL; i++)
- if (!exo_str_is_empty (array[i]))
+ if (!panel_str_is_empty (array[i]))
plugin->patterns = g_slist_prepend (plugin->patterns,
g_pattern_spec_new (array[i]));
@@ -368,7 +367,7 @@ directory_menu_plugin_configure_plugin_file_set (GtkFileChooserButton *button,
panel_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (button));
panel_return_if_fail (XFCE_IS_DIRECTORY_MENU_PLUGIN (plugin));
- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (button));
+ uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (button));
g_object_set (G_OBJECT (plugin), "base-directory", uri, NULL);
g_free (uri);
}
@@ -379,6 +378,7 @@ static void
directory_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button,
DirectoryMenuPlugin *plugin)
{
+#ifdef EXO_CHECK_VERSION
GtkWidget *chooser;
gchar *icon;
@@ -395,7 +395,7 @@ directory_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button
GTK_RESPONSE_ACCEPT,
GTK_RESPONSE_CANCEL, -1);
- if (!exo_str_is_empty (plugin->icon_name))
+ if (!panel_str_is_empty (plugin->icon_name))
exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser), plugin->icon_name);
if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT)
@@ -407,6 +407,7 @@ directory_menu_plugin_configure_plugin_icon_chooser (GtkWidget *button
}
gtk_widget_destroy (chooser);
+#endif
}
@@ -419,7 +420,7 @@ directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
GObject *dialog, *object;
const gchar *icon_name = plugin->icon_name;
- if (exo_str_is_empty (icon_name))
+ if (panel_str_is_empty (icon_name))
icon_name = DEFAULT_ICON_NAME;
/* setup the dialog */
@@ -434,7 +435,7 @@ directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
if (!gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (object),
plugin->base_directory, NULL))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (object), g_get_home_dir ());
- g_signal_connect (G_OBJECT (object), "selection-changed",
+ g_signal_connect (G_OBJECT (object), "current-folder-changed",
G_CALLBACK (directory_menu_plugin_configure_plugin_file_set), plugin);
object = gtk_builder_get_object (builder, "icon-button");
@@ -450,13 +451,15 @@ directory_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
object = gtk_builder_get_object (builder, "file-pattern");
panel_return_if_fail (GTK_IS_ENTRY (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "file-pattern",
- G_OBJECT (object), "text");
+ g_object_bind_property (G_OBJECT (plugin), "file-pattern",
+ G_OBJECT (object), "text",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
object = gtk_builder_get_object (builder, "hidden-files");
panel_return_if_fail (GTK_IS_CHECK_BUTTON (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "hidden-files",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "hidden-files",
+ G_OBJECT (object), "active",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_widget_show (GTK_WIDGET (dialog));
}
@@ -473,7 +476,7 @@ directory_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin,
panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE);
if (strcmp (name, "popup") == 0
- && GTK_WIDGET_VISIBLE (panel_plugin)
+ && gtk_widget_get_visible (GTK_WIDGET (panel_plugin))
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button))
&& panel_utils_grab_available ())
{
@@ -510,7 +513,7 @@ directory_menu_plugin_selection_done (GtkWidget *menu,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
/* delay destruction so we can handle the activate event first */
- exo_gtk_object_destroy_later (GTK_OBJECT (menu));
+ panel_utils_destroy_later (GTK_WIDGET (menu));
}
@@ -553,11 +556,13 @@ directory_menu_plugin_menu_launch_desktop_file (GtkWidget *mi,
GdkAppLaunchContext *context;
GIcon *icon;
GError *error = NULL;
+ GdkDisplay *display;
panel_return_if_fail (G_IS_APP_INFO (info));
panel_return_if_fail (GTK_IS_WIDGET (mi));
- context = gdk_app_launch_context_new ();
+ display = gtk_widget_get_display (mi);
+ context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (mi));
gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
icon = g_app_info_get_icon (info);
@@ -589,6 +594,7 @@ directory_menu_plugin_menu_launch (GtkWidget *mi,
GFileInfo *info;
const gchar *message;
gboolean result;
+ GdkDisplay *display;
panel_return_if_fail (G_IS_FILE (file));
panel_return_if_fail (GTK_IS_WIDGET (mi));
@@ -612,7 +618,8 @@ directory_menu_plugin_menu_launch (GtkWidget *mi,
fake_list.data = file;
- context = gdk_app_launch_context_new ();
+ display = gtk_widget_get_display (mi);
+ context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (mi));
gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
@@ -709,11 +716,11 @@ directory_menu_plugin_menu_open (GtkWidget *mi,
}
if (!result
- && !exo_execute_preferred_application_on_screen (category,
- path_as_arg ? working_dir : NULL,
- working_dir,
- NULL,
- gtk_widget_get_screen (mi), &error))
+#ifdef EXO_CHECK_VERSION
+ && !exo_execute_preferred_application_on_screen (category, NULL, working_dir, NULL,
+ gtk_widget_get_screen (mi), &error)
+#endif
+ )
{
xfce_dialog_show_error (NULL, error,
_("Failed to execute the preferred application for category \"%s\""), category);
@@ -754,7 +761,7 @@ directory_menu_plugin_menu_unload (GtkWidget *menu)
{
/* delay destruction so we can handle the activate event first */
gtk_container_foreach (GTK_CONTAINER (menu),
- (GtkCallback) exo_gtk_object_destroy_later, NULL);
+ (GtkCallback) panel_utils_destroy_later, NULL);
}
@@ -901,7 +908,7 @@ directory_menu_plugin_menu_load (GtkWidget *menu,
icon = g_app_info_get_icon (G_APP_INFO (desktopinfo));
/* ignore invalid or hidden files */
- if (exo_str_is_empty (display_name)
+ if (panel_str_is_empty (display_name)
|| g_desktop_app_info_get_is_hidden (desktopinfo))
{
g_object_unref (G_OBJECT (desktopinfo));
@@ -942,7 +949,7 @@ directory_menu_plugin_menu_load (GtkWidget *menu,
else if (G_UNLIKELY (desktopinfo != NULL))
{
description = g_app_info_get_description (G_APP_INFO (desktopinfo));
- if (!exo_str_is_empty (description))
+ if (!panel_str_is_empty (description))
gtk_widget_set_tooltip_text (mi, description);
g_signal_connect_data (G_OBJECT (mi), "activate",
diff --git a/plugins/launcher/Makefile.am b/plugins/launcher/Makefile.am
index 427737f..19fcda3 100644
--- a/plugins/launcher/Makefile.am
+++ b/plugins/launcher/Makefile.am
@@ -25,7 +25,6 @@ liblauncher_la_CFLAGS = \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(GARCON_CFLAGS) \
- $(EXO_CFLAGS) \
$(GIO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(DBUS_CFLAGS) \
@@ -45,7 +44,6 @@ liblauncher_la_LIBADD = \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(GARCON_LIBS) \
- $(EXO_LIBS) \
$(DBUS_LIBS) \
$(GIO_LIBS) \
$(XFCONF_LIBS)
@@ -77,7 +75,7 @@ DISTCLEANFILES += \
$(libclock_built_sources)
launcher-dialog_ui.h: launcher-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=launcher_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=launcher_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index b454433..9a68bbc 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -24,7 +24,6 @@
#include <string.h>
#endif
-#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
#include <garcon/garcon.h>
@@ -41,7 +40,7 @@
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
-#define LAUNCHER_WIDGET_XID(widget) ((guint) GDK_WINDOW_XID (GDK_WINDOW ((widget)->window)))
+#define LAUNCHER_WIDGET_XID(widget) ((guint) GDK_WINDOW_XID (gtk_widget_get_root_window (GTK_WIDGET (widget))))
#else
#define LAUNCHER_WIDGET_XID(widget) (0)
#endif
@@ -132,7 +131,7 @@ launcher_dialog_add_visible_function (GtkTreeModel *model,
/* get the search string from the item */
text = gtk_entry_get_text (GTK_ENTRY (user_data));
- if (G_UNLIKELY (exo_str_is_empty (text)))
+ if (G_UNLIKELY (panel_str_is_empty (text)))
return TRUE;
/* casefold the search text */
@@ -142,7 +141,7 @@ launcher_dialog_add_visible_function (GtkTreeModel *model,
/* try the pre-build search string first */
gtk_tree_model_get (model, iter, COL_SEARCH, &string, -1);
- if (!exo_str_is_empty (string))
+ if (!panel_str_is_empty (string))
{
/* search */
visible = (strstr (string, text_casefolded) != NULL);
@@ -151,7 +150,7 @@ launcher_dialog_add_visible_function (GtkTreeModel *model,
{
/* get the name */
gtk_tree_model_get (model, iter, COL_NAME, &string, -1);
- if (!exo_str_is_empty (string))
+ if (!panel_str_is_empty (string))
{
/* escape and casefold the name */
escaped = g_markup_escape_text (string, -1);
@@ -206,8 +205,6 @@ launcher_dialog_add_populate_model_idle (gpointer user_data)
panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE);
- GDK_THREADS_ENTER ();
-
/* load the item pool */
pool = launcher_plugin_garcon_menu_pool ();
@@ -217,8 +214,6 @@ launcher_dialog_add_populate_model_idle (gpointer user_data)
g_hash_table_destroy (pool);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -245,7 +240,7 @@ launcher_dialog_add_populate_model (LauncherPluginDialog *dialog)
/* fire an idle menu system load */
if (G_LIKELY (dialog->idle_populate_id == 0))
- dialog->idle_populate_id = g_idle_add_full (
+ dialog->idle_populate_id = gdk_threads_add_idle_full (
G_PRIORITY_DEFAULT_IDLE,
launcher_dialog_add_populate_model_idle,
dialog, launcher_dialog_add_populate_model_idle_destroyed);
@@ -343,8 +338,8 @@ launcher_dialog_add_key_press_event (GtkTreeView *treeview,
panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE);
panel_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), FALSE);
- if (event->keyval == GDK_Return
- || event->keyval == GDK_KP_Enter)
+ if (event->keyval == GDK_KEY_Return
+ || event->keyval == GDK_KEY_KP_Enter)
return launcher_dialog_press_event (dialog, "button-add");
return FALSE;
@@ -466,8 +461,6 @@ launcher_dialog_tree_save (LauncherPluginDialog *dialog)
GObject *store;
GPtrArray *array;
- GDK_THREADS_ENTER ();
-
store = gtk_builder_get_object (dialog->builder, "item-store");
array = g_ptr_array_new ();
@@ -481,8 +474,6 @@ launcher_dialog_tree_save (LauncherPluginDialog *dialog)
G_CALLBACK (launcher_dialog_items_load), dialog);
xfconf_array_free (array);
-
- GDK_THREADS_LEAVE ();
}
@@ -647,7 +638,7 @@ launcher_dialog_press_event (LauncherPluginDialog *dialog,
object = gtk_builder_get_object (dialog->builder, object_name);
panel_return_val_if_fail (GTK_IS_BUTTON (object), FALSE);
- if (GTK_WIDGET_SENSITIVE (object))
+ if (gtk_widget_get_sensitive (GTK_WIDGET (object)))
{
gtk_button_clicked (GTK_BUTTON (object));
return TRUE;
@@ -749,8 +740,8 @@ launcher_dialog_tree_key_press_event (GtkTreeView *treeview,
panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE);
panel_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), FALSE);
- if (event->keyval == GDK_Return
- || event->keyval == GDK_KP_Enter)
+ if (event->keyval == GDK_KEY_Return
+ || event->keyval == GDK_KEY_KP_Enter)
return launcher_dialog_press_event (dialog, "item-edit");
return FALSE;
@@ -856,7 +847,7 @@ launcher_dialog_item_button_clicked (GtkWidget *button,
if (xfce_dialog_confirm (GTK_WINDOW (toplevel), GTK_STOCK_DELETE, NULL,
_("If you delete an item, it will be permanently removed"),
_("Are you sure you want to remove \"%s\"?"),
- exo_str_is_empty (display_name) ? _("Unnamed item") : display_name))
+ panel_str_is_empty (display_name) ? _("Unnamed item") : display_name))
{
/* remove the item from the store */
gtk_list_store_remove (GTK_LIST_STORE (model), &iter_a);
@@ -1020,7 +1011,7 @@ launcher_dialog_tree_row_changed (GtkTreeModel *model,
panel_return_if_fail (GTK_IS_BUILDER (dialog->builder));
/* item moved with dnd, save the tree to update the plugin */
- g_idle_add ((GSourceFunc) launcher_dialog_tree_save, dialog);
+ gdk_threads_add_idle ((GSourceFunc) launcher_dialog_tree_save, dialog);
/* select the moved item to there is no selection change on reload */
treeview = gtk_builder_get_object (dialog->builder, "item-treeview");
@@ -1050,13 +1041,13 @@ launcher_dialog_items_set_item (GtkTreeModel *model,
name = garcon_menu_item_get_name (item);
comment = garcon_menu_item_get_comment (item);
- if (!exo_str_is_empty (comment))
+ if (!panel_str_is_empty (comment))
markup = g_markup_printf_escaped ("<b>%s</b>\n%s", name, comment);
else
markup = g_markup_printf_escaped ("<b>%s</b>", name);
icon_name = garcon_menu_item_get_icon_name (item);
- if (!exo_str_is_empty (icon_name))
+ if (!panel_str_is_empty (icon_name))
{
if (!gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &w, &h))
w = h = 32;
@@ -1241,8 +1232,9 @@ launcher_dialog_show (LauncherPlugin *plugin)
{
object = gtk_builder_get_object (builder, binding_names[i]);
panel_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (plugin), binding_names[i],
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), binding_names[i],
+ G_OBJECT (object), "active",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
/* setup responses for the add dialog */
diff --git a/plugins/launcher/launcher-dialog.glade b/plugins/launcher/launcher-dialog.glade
index cd4f7b8..8a64158 100644
--- a/plugins/launcher/launcher-dialog.glade
+++ b/plugins/launcher/launcher-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="arrow-position-model">
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index 6479869..5ff670a 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -25,7 +25,6 @@
#endif
#include <gio/gio.h>
-#include <exo/exo.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
#include <garcon/garcon.h>
@@ -135,9 +134,9 @@ static void launcher_plugin_button_drag_leave (GtkWidg
GdkDragContext *context,
guint drag_time,
LauncherPlugin *plugin);
-static gboolean launcher_plugin_button_expose_event (GtkWidget *widget,
- GdkEventExpose *event,
- LauncherPlugin *launcher);
+static gboolean launcher_plugin_button_draw (GtkWidget *widget,
+ cairo_t *cr,
+ LauncherPlugin *plugin);
static void launcher_plugin_arrow_visibility (LauncherPlugin *plugin);
static gboolean launcher_plugin_arrow_press_event (GtkWidget *button,
GdkEventButton *event,
@@ -280,28 +279,28 @@ launcher_plugin_class_init (LauncherPluginClass *klass)
g_param_spec_boxed ("items",
NULL, NULL,
PANEL_PROPERTIES_TYPE_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_DISABLE_TOOLTIPS,
g_param_spec_boolean ("disable-tooltips",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_MOVE_FIRST,
g_param_spec_boolean ("move-first",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_LABEL,
g_param_spec_boolean ("show-label",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ARROW_POSITION,
@@ -310,7 +309,7 @@ launcher_plugin_class_init (LauncherPluginClass *klass)
LAUNCHER_ARROW_DEFAULT,
LAUNCHER_ARROW_INTERNAL,
LAUNCHER_ARROW_DEFAULT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
launcher_signals[ITEMS_CHANGED] =
g_signal_new (g_intern_static_string ("items-changed"),
@@ -360,7 +359,7 @@ launcher_plugin_init (LauncherPlugin *plugin)
G_CALLBACK (launcher_plugin_icon_theme_changed), plugin);
/* create the panel widgets */
- plugin->box = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
+ plugin->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (plugin), plugin->box);
plugin->button = xfce_panel_create_button ();
@@ -382,8 +381,8 @@ launcher_plugin_init (LauncherPlugin *plugin)
G_CALLBACK (launcher_plugin_button_drag_drop), plugin);
g_signal_connect (G_OBJECT (plugin->button), "drag-leave",
G_CALLBACK (launcher_plugin_button_drag_leave), plugin);
- g_signal_connect_after (G_OBJECT (plugin->button), "expose-event",
- G_CALLBACK (launcher_plugin_button_expose_event), plugin);
+ g_signal_connect_after (G_OBJECT (plugin->button), "draw",
+ G_CALLBACK (launcher_plugin_button_draw), plugin);
plugin->child = xfce_panel_image_new ();
gtk_container_add (GTK_CONTAINER (plugin->button), plugin->child);
@@ -551,6 +550,27 @@ err1:
}
+static gboolean
+_exo_str_looks_like_an_uri (const gchar *str)
+{
+ const gchar *s = str;
+
+ if (G_UNLIKELY (str == NULL))
+ return FALSE;
+
+ /* <scheme> starts with an alpha character */
+ if (g_ascii_isalpha (*s))
+ {
+ /* <scheme> continues with (alpha | digit | "+" | "-" | ".")* */
+ for (++s; g_ascii_isalnum (*s) || *s == '+' || *s == '-' || *s == '.'; ++s);
+
+ /* <scheme> must be followed by ":" */
+ return (*s == ':' && *(s+1) == '/');
+ }
+
+ return FALSE;
+}
+
static GarconMenuItem *
launcher_plugin_item_load (LauncherPlugin *plugin,
@@ -568,7 +588,7 @@ launcher_plugin_item_load (LauncherPlugin *plugin,
panel_return_val_if_fail (str != NULL, NULL);
panel_return_val_if_fail (G_IS_FILE (plugin->config_directory), NULL);
- if (G_UNLIKELY (g_path_is_absolute (str) || exo_str_looks_like_an_uri (str)))
+ if (G_UNLIKELY (g_path_is_absolute (str) || _exo_str_looks_like_an_uri (str)))
{
src_file = g_file_new_for_commandline_arg (str);
if (g_file_has_prefix (src_file, plugin->config_directory))
@@ -1156,16 +1176,16 @@ launcher_plugin_remote_event (XfcePanelPlugin *panel_plugin,
panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE);
- if (exo_str_is_equal (name, "popup")
+ if (g_strcmp0 (name, "popup") == 0
&& LIST_HAS_TWO_OR_MORE_ENTRIES (plugin->items)
- && (plugin->menu == NULL || !GTK_WIDGET_VISIBLE (plugin->menu)))
+ && (plugin->menu == NULL || !gtk_widget_get_visible (plugin->menu)))
{
launcher_plugin_menu_popup (plugin);
return TRUE;
}
- if (exo_str_is_equal (name, "disable-tooltips")
+ if (g_strcmp0 (name, "disable-tooltips") == 0
&& value != NULL
&& G_VALUE_HOLDS_BOOLEAN (value))
{
@@ -1204,7 +1224,7 @@ launcher_plugin_save_delayed (LauncherPlugin *plugin)
if (plugin->save_timeout_id != 0)
g_source_remove (plugin->save_timeout_id);
- plugin->save_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_LOW, 1,
+ plugin->save_timeout_id = gdk_threads_add_timeout_seconds_full (G_PRIORITY_LOW, 1,
launcher_plugin_save_delayed_timeout, plugin,
launcher_plugin_save_delayed_timeout_destroyed);
}
@@ -1238,17 +1258,16 @@ launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin,
{
LauncherPlugin *plugin = XFCE_LAUNCHER_PLUGIN (panel_plugin);
gint p_width, p_height;
- gint a_width, a_height;
+ gint a_size;
gboolean horizontal;
LauncherArrowType arrow_position;
/* initialize the plugin size */
size /= xfce_panel_plugin_get_nrows (panel_plugin);
p_width = p_height = size;
- a_width = a_height = -1;
/* add the arrow size */
- if (GTK_WIDGET_VISIBLE (plugin->arrow))
+ if (gtk_widget_get_visible (plugin->arrow))
{
/* if the panel is horizontal */
horizontal = !!(xfce_panel_plugin_get_orientation (panel_plugin) ==
@@ -1261,20 +1280,20 @@ launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin,
{
case LAUNCHER_ARROW_NORTH:
case LAUNCHER_ARROW_SOUTH:
- a_height = ARROW_BUTTON_SIZE;
- if (horizontal)
- p_width -= ARROW_BUTTON_SIZE;
- else
- p_height += ARROW_BUTTON_SIZE;
+ if (!horizontal)
+ {
+ gtk_widget_get_preferred_height (plugin->arrow, NULL, &a_size);
+ p_height += a_size;
+ }
break;
case LAUNCHER_ARROW_EAST:
case LAUNCHER_ARROW_WEST:
- a_width = ARROW_BUTTON_SIZE;
if (horizontal)
- p_width += ARROW_BUTTON_SIZE;
- else
- p_height -= ARROW_BUTTON_SIZE;
+ {
+ gtk_widget_get_preferred_width (plugin->arrow, NULL, &a_size);
+ p_width += a_size;
+ }
break;
default:
@@ -1282,9 +1301,6 @@ launcher_plugin_size_changed (XfcePanelPlugin *panel_plugin,
panel_assert_not_reached ();
break;
}
-
- /* set the arrow size */
- gtk_widget_set_size_request (plugin->arrow, a_width, a_height);
}
/* set the panel plugin size */
@@ -1373,7 +1389,7 @@ launcher_plugin_pack_widgets (LauncherPlugin *plugin)
panel_return_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin));
/* leave when the arrow button is not visible */
- if (!GTK_WIDGET_VISIBLE (plugin->arrow)
+ if (!gtk_widget_get_visible (plugin->arrow)
|| plugin->arrow_position == LAUNCHER_ARROW_INTERNAL)
return;
@@ -1384,8 +1400,8 @@ launcher_plugin_pack_widgets (LauncherPlugin *plugin)
gtk_box_reorder_child (GTK_BOX (plugin->box), plugin->arrow,
(pos == LAUNCHER_ARROW_WEST || pos == LAUNCHER_ARROW_NORTH) ? 0 : -1);
- /* set the orientation of the hvbox */
- xfce_hvbox_set_orientation (XFCE_HVBOX (plugin->box),
+ /* set the orientation */
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (plugin->box),
!!(pos == LAUNCHER_ARROW_WEST || pos == LAUNCHER_ARROW_EAST) ?
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
}
@@ -1401,7 +1417,7 @@ launcher_plugin_tooltip_pixbuf (GdkScreen *screen,
panel_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), NULL);
- if (exo_str_is_empty (icon_name))
+ if (panel_str_is_empty (icon_name))
return NULL;
if (gtk_icon_size_lookup (launcher_tooltip_icon_size, &w, &h))
@@ -1411,7 +1427,7 @@ launcher_plugin_tooltip_pixbuf (GdkScreen *screen,
/* load directly from a file */
if (G_UNLIKELY (g_path_is_absolute (icon_name)))
- return exo_gdk_pixbuf_new_from_file_at_max_size (icon_name, size, size, TRUE, NULL);
+ return gdk_pixbuf_new_from_file_at_scale (icon_name, size, size, TRUE, NULL);
if (G_LIKELY (screen != NULL))
theme = gtk_icon_theme_get_for_screen (screen);
@@ -1518,7 +1534,7 @@ launcher_plugin_menu_item_drag_data_received (GtkWidget *widget,
}
/* hide the menu */
- gtk_widget_hide (GTK_MENU (plugin->menu)->toplevel);
+ gtk_widget_hide (gtk_widget_get_toplevel (plugin->menu));
gtk_widget_hide (plugin->menu);
/* inactivate the toggle button */
@@ -1572,7 +1588,7 @@ launcher_plugin_menu_construct (LauncherPlugin *plugin)
/* create the menu item */
name = garcon_menu_item_get_name (item);
mi = gtk_image_menu_item_new_with_label (
- exo_str_is_empty (name) ? _("Unnamed Item") : name);
+ panel_str_is_empty (name) ? _("Unnamed Item") : name);
g_object_set_qdata (G_OBJECT (mi), launcher_plugin_quark, plugin);
gtk_widget_show (mi);
gtk_drag_dest_set (mi, GTK_DEST_DEFAULT_ALL, drop_targets,
@@ -1600,7 +1616,7 @@ launcher_plugin_menu_construct (LauncherPlugin *plugin)
/* set the icon if one is set */
icon_name = garcon_menu_item_get_icon_name (item);
- if (!exo_str_is_empty (icon_name))
+ if (!panel_str_is_empty (icon_name))
{
image = xfce_panel_image_new_from_source (icon_name);
xfce_panel_image_set_size (XFCE_PANEL_IMAGE (image), size);
@@ -1628,8 +1644,6 @@ launcher_plugin_menu_popup (gpointer user_data)
panel_return_val_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin), FALSE);
- GDK_THREADS_ENTER ();
-
/* construct the menu if needed */
if (plugin->menu == NULL)
launcher_plugin_menu_construct (plugin);
@@ -1645,10 +1659,10 @@ launcher_plugin_menu_popup (gpointer user_data)
/* fallback to manual positioning, this is used with
* drag motion over the arrow button */
- if (!GTK_WIDGET_VISIBLE (plugin->menu))
+ if (!gtk_widget_get_visible (plugin->menu))
{
/* make sure the size is allocated */
- if (!GTK_WIDGET_REALIZED (plugin->menu))
+ if (!gtk_widget_get_realized (plugin->menu))
gtk_widget_realize (plugin->menu);
/* use the widget position function to get the coordinates */
@@ -1657,12 +1671,10 @@ launcher_plugin_menu_popup (gpointer user_data)
/* bit ugly... but show the menu */
gtk_widget_show (plugin->menu);
- gtk_window_move (GTK_WINDOW (GTK_MENU (plugin->menu)->toplevel), x, y);
- gtk_widget_show (GTK_MENU (plugin->menu)->toplevel);
+ gtk_window_move (GTK_WINDOW (gtk_widget_get_toplevel (plugin->menu)), x, y);
+ gtk_widget_show (gtk_widget_get_toplevel (plugin->menu));
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1733,7 +1745,7 @@ launcher_plugin_button_update (LauncherPlugin *plugin)
icon_name = garcon_menu_item_get_icon_name (item);
xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (plugin->child),
- exo_str_is_empty (icon_name) ? GTK_STOCK_MISSING_IMAGE : icon_name);
+ panel_str_is_empty (icon_name) ? GTK_STOCK_MISSING_IMAGE : icon_name);
panel_utils_set_atk_info (plugin->button,
garcon_menu_item_get_name (item),
@@ -1755,9 +1767,9 @@ launcher_plugin_button_state_changed (GtkWidget *button_a,
GtkStateType state,
GtkWidget *button_b)
{
- if (GTK_WIDGET_STATE (button_a) != GTK_WIDGET_STATE (button_b)
- && GTK_WIDGET_STATE (button_a) != GTK_STATE_INSENSITIVE)
- gtk_widget_set_state (button_b, GTK_WIDGET_STATE (button_a));
+ if (gtk_widget_get_state_flags (button_a) != gtk_widget_get_state_flags (button_b)
+ && (gtk_widget_get_state_flags (button_a) & GTK_STATE_INSENSITIVE))
+ gtk_widget_set_state_flags (button_b, gtk_widget_get_state_flags (button_a), TRUE);
}
@@ -1792,10 +1804,10 @@ launcher_plugin_button_press_event (GtkWidget *button,
{
/* start the popup timeout */
plugin->menu_timeout_id =
- g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
- MENU_POPUP_DELAY,
- launcher_plugin_menu_popup, plugin,
- launcher_plugin_menu_popup_destroyed);
+ gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
+ MENU_POPUP_DELAY,
+ launcher_plugin_menu_popup, plugin,
+ launcher_plugin_menu_popup_destroyed);
}
return FALSE;
@@ -1819,7 +1831,6 @@ launcher_plugin_button_release_event (GtkWidget *button,
/* leave when there are no menu items or there is an internal arrow */
if (plugin->items == NULL
- || !GTK_BUTTON (button)->in_button
|| ARROW_INSIDE_BUTTON (plugin))
return FALSE;
@@ -1934,7 +1945,7 @@ launcher_plugin_supported_drop (GdkDragContext *context,
return GDK_NONE;
/* check if we support the target */
- for (li = context->targets; li; li = li->next)
+ for (li = gdk_drag_context_list_targets (context); li; li = li->next)
{
target = GDK_POINTER_TO_ATOM (li->data);
for (i = 0; i < G_N_ELEMENTS (drop_targets); i++)
@@ -2022,12 +2033,16 @@ launcher_plugin_button_drag_leave (GtkWidget *widget,
static gboolean
-launcher_plugin_button_expose_event (GtkWidget *widget,
- GdkEventExpose *event,
- LauncherPlugin *plugin)
+launcher_plugin_button_draw (GtkWidget *widget,
+ cairo_t *cr,
+ LauncherPlugin *plugin)
{
- GtkArrowType arrow_type;
- gint size, x, y, thickness, offset;
+ GtkArrowType arrow_type;
+ gdouble angle;
+ gint size, x, y, offset;
+ GtkAllocation allocation;
+ GtkStyleContext *ctx;
+ GtkBorder padding;
panel_return_val_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin), FALSE);
@@ -2039,31 +2054,38 @@ launcher_plugin_button_expose_event (GtkWidget *widget,
arrow_type = xfce_arrow_button_get_arrow_type (XFCE_ARROW_BUTTON (plugin->arrow));
/* style thickness */
- thickness = MAX (widget->style->xthickness, widget->style->ythickness);
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (widget), &padding);
/* size of the arrow and the start coordinates */
- size = widget->allocation.width / 3;
- x = widget->allocation.x + thickness;
- y = widget->allocation.y + thickness;
- offset = size + 2 * thickness;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ size = allocation.width / 3;
+ x = padding.left;
+ y = padding.top;
+ offset = size + padding.left + padding.right;
+ angle = 1.5 * G_PI;
/* calculate the position based on the arrow type */
switch (arrow_type)
{
case GTK_ARROW_UP:
/* north east */
- x += widget->allocation.width - offset;
+ x += allocation.width - offset;
+ angle = 0.0 * G_PI;
break;
case GTK_ARROW_DOWN:
/* south west */
- y += widget->allocation.height - offset;
+ y += allocation.height - offset;
+ angle = 1.0 * G_PI;
break;
case GTK_ARROW_RIGHT:
/* south east */
- x += widget->allocation.width - offset;
- y += widget->allocation.height - offset;
+ x += allocation.width - offset;
+ y += allocation.height - offset;
+ angle = 0.5 * G_PI;
break;
default:
@@ -2072,10 +2094,7 @@ launcher_plugin_button_expose_event (GtkWidget *widget,
}
/* paint the arrow */
- gtk_paint_arrow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_IN,
- &(event->area), widget, "launcher_button",
- arrow_type, TRUE, x, y, size, size);
+ gtk_render_arrow (ctx, cr, angle, (gdouble) x, (gdouble) y, (gdouble) size);
return FALSE;
}
@@ -2139,9 +2158,9 @@ launcher_plugin_arrow_drag_motion (GtkWidget *widget,
/* start the popup timeout */
plugin->menu_timeout_id =
- g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, MENU_POPUP_DELAY,
- launcher_plugin_menu_popup, plugin,
- launcher_plugin_menu_popup_destroyed);
+ gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, MENU_POPUP_DELAY,
+ launcher_plugin_menu_popup, plugin,
+ launcher_plugin_menu_popup_destroyed);
}
return TRUE;
@@ -2158,7 +2177,7 @@ launcher_plugin_arrow_drag_leave_timeout (gpointer user_data)
gint menu_x, menu_y, menu_w, menu_h;
panel_return_val_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin), FALSE);
- panel_return_val_if_fail (menu == NULL || GDK_IS_WINDOW (menu->window), FALSE);
+ panel_return_val_if_fail (menu == NULL || gtk_widget_get_has_window (menu), FALSE);
/* leave when the menu is destroyed */
if (G_UNLIKELY (plugin->menu == NULL))
@@ -2169,15 +2188,16 @@ launcher_plugin_arrow_drag_leave_timeout (gpointer user_data)
NULL, &pointer_x, &pointer_y, NULL);
/* get the menu position */
- gdk_window_get_root_origin (menu->window, &menu_x, &menu_y);
- gdk_drawable_get_size (GDK_DRAWABLE (menu->window), &menu_w, &menu_h);
+ gdk_window_get_root_origin (gtk_widget_get_window (menu), &menu_x, &menu_y);
+ menu_w = gdk_window_get_width (gtk_widget_get_window (menu));
+ menu_h = gdk_window_get_height (gtk_widget_get_window (menu));
/* check if we should hide the menu */
if (pointer_x < menu_x || pointer_x > menu_x + menu_w
|| pointer_y < menu_y || pointer_y > menu_y + menu_h)
{
/* hide the menu */
- gtk_widget_hide (GTK_MENU (menu)->toplevel);
+ gtk_widget_hide (gtk_widget_get_toplevel (menu));
gtk_widget_hide (menu);
/* inactive the toggle button */
@@ -2208,7 +2228,7 @@ launcher_plugin_arrow_drag_leave (GtkWidget *widget,
else
{
/* start a timeout to give the user some time to drag to the menu */
- g_timeout_add (MENU_POPUP_DELAY, launcher_plugin_arrow_drag_leave_timeout, plugin);
+ gdk_threads_add_timeout (MENU_POPUP_DELAY, launcher_plugin_arrow_drag_leave_timeout, plugin);
}
}
@@ -2230,11 +2250,11 @@ launcher_plugin_item_query_tooltip (GtkWidget *widget,
/* require atleast an item name */
name = garcon_menu_item_get_name (item);
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
return FALSE;
comment = garcon_menu_item_get_comment (item);
- if (!exo_str_is_empty (comment))
+ if (!panel_str_is_empty (comment))
{
markup = g_markup_printf_escaped ("<b>%s</b>\n%s", name, comment);
gtk_tooltip_set_markup (tooltip, markup);
@@ -2250,7 +2270,7 @@ launcher_plugin_item_query_tooltip (GtkWidget *widget,
* data on the menu item widget */
if (GTK_IS_MENU_ITEM (widget))
{
- pixbuf = g_object_get_data (G_OBJECT (widget), I_("pixbuf-cache"));
+ pixbuf = g_object_get_data (G_OBJECT (widget), "pixbuf-cache");
if (G_LIKELY (pixbuf != NULL))
{
gtk_tooltip_set_icon (tooltip, pixbuf);
@@ -2262,7 +2282,7 @@ launcher_plugin_item_query_tooltip (GtkWidget *widget,
if (G_LIKELY (pixbuf != NULL))
{
gtk_tooltip_set_icon (tooltip, pixbuf);
- g_object_set_data_full (G_OBJECT (widget), I_("pixbuf-cache"), pixbuf,
+ g_object_set_data_full (G_OBJECT (widget), "pixbuf-cache", pixbuf,
(GDestroyNotify) g_object_unref);
}
}
@@ -2330,7 +2350,7 @@ launcher_plugin_item_exec (GarconMenuItem *item,
/* leave when there is nothing to execute */
command = garcon_menu_item_get_command (item);
- if (exo_str_is_empty (command))
+ if (panel_str_is_empty (command))
return;
if (G_UNLIKELY (uri_list != NULL
@@ -2362,7 +2382,7 @@ launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item,
GtkClipboard *clipboard;
gchar *text = NULL;
GSList *uri_list;
- GtkSelectionData data;
+ //GtkSelectionData data;
panel_return_if_fail (GARCON_IS_MENU_ITEM (item));
panel_return_if_fail (GDK_IS_SCREEN (screen));
@@ -2373,7 +2393,7 @@ launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item,
text = gtk_clipboard_wait_for_text (clipboard);
/* try the secondary keayboard if the text is empty */
- if (exo_str_is_empty (text))
+ if (panel_str_is_empty (text))
{
/* get the secondary clipboard text */
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
@@ -2381,21 +2401,21 @@ launcher_plugin_item_exec_from_clipboard (GarconMenuItem *item,
text = gtk_clipboard_wait_for_text (clipboard);
}
- if (!exo_str_is_empty (text))
+ if (!panel_str_is_empty (text))
{
/* create fake selection data */
- data.data = (guchar *) text;
- data.length = strlen (text);
- data.target = GDK_NONE;
+ //data.data = (guchar *) text; //HOWTO?
+ //data.length = strlen (text);
+ //data.target = GDK_NONE;
/* extract the uris from the selection data */
- uri_list = launcher_plugin_uri_list_extract (&data);
+ //uri_list = launcher_plugin_uri_list_extract (&data);
/* launch with the uri list */
- launcher_plugin_item_exec (item, event_time,
- screen, uri_list);
+ //launcher_plugin_item_exec (item, event_time,
+ // screen, uri_list);
- launcher_plugin_uri_list_free (uri_list);
+ //launcher_plugin_uri_list_free (uri_list);
}
g_free (text);
@@ -2433,7 +2453,7 @@ launcher_plugin_exec_parse (GarconMenuItem *item,
/* get the command */
command = garcon_menu_item_get_command (item);
- panel_return_val_if_fail (!exo_str_is_empty (command), FALSE);
+ panel_return_val_if_fail (!panel_str_is_empty (command), FALSE);
/* allocate an empty string */
string = g_string_sized_new (100);
@@ -2481,7 +2501,7 @@ launcher_plugin_exec_parse (GarconMenuItem *item,
case 'i':
tmp = garcon_menu_item_get_icon_name (item);
- if (!exo_str_is_empty (tmp))
+ if (!panel_str_is_empty (tmp))
{
g_string_append (string, "--icon ");
launcher_plugin_exec_append_quoted (string, tmp);
@@ -2490,13 +2510,13 @@ launcher_plugin_exec_parse (GarconMenuItem *item,
case 'c':
tmp = garcon_menu_item_get_name (item);
- if (!exo_str_is_empty (tmp))
+ if (!panel_str_is_empty (tmp))
launcher_plugin_exec_append_quoted (string, tmp);
break;
case 'k':
uri = garcon_menu_item_get_uri (item);
- if (!exo_str_is_empty (uri))
+ if (!panel_str_is_empty (uri))
launcher_plugin_exec_append_quoted (string, uri);
g_free (uri);
break;
@@ -2529,21 +2549,21 @@ launcher_plugin_uri_list_extract (GtkSelectionData *data)
gchar *uri;
/* leave if there is no data */
- if (data->length <= 0)
+ if (gtk_selection_data_get_length (data) <= 0)
return NULL;
/* extract the files */
- if (data->target == gdk_atom_intern_static_string ("text/uri-list"))
+ if (gtk_selection_data_get_target (data) == gdk_atom_intern_static_string ("text/uri-list"))
{
/* extract the list of uris */
- array = g_uri_list_extract_uris ((gchar *) data->data);
+ array = g_uri_list_extract_uris ((gchar *) gtk_selection_data_get_data (data));
if (G_UNLIKELY (array == NULL))
return NULL;
/* create the list of uris */
for (i = 0; array[i] != NULL; i++)
{
- if (!exo_str_is_empty (array[i]))
+ if (!panel_str_is_empty (array[i]))
list = g_slist_prepend (list, array[i]);
else
g_free (array[i]);
@@ -2554,7 +2574,7 @@ launcher_plugin_uri_list_extract (GtkSelectionData *data)
else
{
/* split the data on new lines */
- array = g_strsplit_set ((const gchar *) data->data, "\n\r", -1);
+ array = g_strsplit_set ((const gchar *) gtk_selection_data_get_data (data), "\n\r", -1);
if (G_UNLIKELY (array == NULL))
return NULL;
@@ -2562,14 +2582,14 @@ launcher_plugin_uri_list_extract (GtkSelectionData *data)
for (i = 0; array[i] != NULL; i++)
{
/* skip empty strings */
- if (!!exo_str_is_empty (array[i]))
+ if (!!panel_str_is_empty (array[i]))
continue;
uri = NULL;
if (g_path_is_absolute (array[i]))
uri = g_filename_to_uri (array[i], NULL, NULL);
- else if (exo_str_looks_like_an_uri (array[i]))
+ else if (_exo_str_looks_like_an_uri (array[i]))
uri = g_strdup (array[i]);
/* append the uri if we extracted one */
diff --git a/plugins/pager/Makefile.am b/plugins/pager/Makefile.am
index 27fc6a3..5959eb9 100644
--- a/plugins/pager/Makefile.am
+++ b/plugins/pager/Makefile.am
@@ -26,7 +26,6 @@ libpager_la_CFLAGS = \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBWNCK_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
- $(EXO_CFLAGS) \
$(PLATFORM_CFLAGS)
libpager_la_LDFLAGS = \
@@ -42,7 +41,6 @@ libpager_la_LIBADD = \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBWNCK_LIBS) \
- $(EXO_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(XFCONF_LIBS)
@@ -73,7 +71,7 @@ DISTCLEANFILES += \
$(libpager_built_sources)
pager-dialog_ui.h: pager-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=pager_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=pager_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/pager/pager-buttons.c b/plugins/pager/pager-buttons.c
index 040e58d..2a4f190 100644
--- a/plugins/pager/pager-buttons.c
+++ b/plugins/pager/pager-buttons.c
@@ -21,7 +21,7 @@
#endif
#include <gtk/gtk.h>
-#include <exo/exo.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
@@ -61,12 +61,12 @@ static void pager_buttons_viewport_button_toggled (GtkWidget *button,
struct _PagerButtonsClass
{
- GtkTableClass __parent__;
+ GtkGridClass __parent__;
};
struct _PagerButtons
{
- GtkTable __parent__;
+ GtkGrid __parent__;
GSList *buttons;
@@ -95,7 +95,7 @@ enum
-XFCE_PANEL_DEFINE_TYPE (PagerButtons, pager_buttons, GTK_TYPE_TABLE)
+XFCE_PANEL_DEFINE_TYPE (PagerButtons, pager_buttons, GTK_TYPE_GRID)
@@ -114,7 +114,7 @@ pager_buttons_class_init (PagerButtonsClass *klass)
g_param_spec_object ("screen",
NULL, NULL,
WNCK_TYPE_SCREEN,
- EXO_PARAM_WRITABLE
+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
@@ -122,7 +122,7 @@ pager_buttons_class_init (PagerButtonsClass *klass)
g_param_spec_int ("rows",
NULL, NULL,
1, 100, 1,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ORIENTATION,
@@ -130,7 +130,7 @@ pager_buttons_class_init (PagerButtonsClass *klass)
NULL, NULL,
GTK_TYPE_ORIENTATION,
GTK_ORIENTATION_HORIZONTAL,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -147,7 +147,9 @@ pager_buttons_init (PagerButtons *pager)
/* although I'd prefer normal allocation, the homogeneous setting
* takes care of small panels, while non-homogeneous tables allocate
* outside the panel size --nick */
- gtk_table_set_homogeneous (GTK_TABLE (pager), TRUE);
+ /* gtk_table_set_homogeneous (GTK_TABLE (pager), TRUE); */
+ gtk_grid_set_row_homogeneous (GTK_GRID (pager), TRUE);
+ gtk_grid_set_column_homogeneous (GTK_GRID (pager), TRUE);
}
@@ -294,8 +296,6 @@ pager_buttons_rebuild_idle (gpointer user_data)
panel_return_val_if_fail (XFCE_IS_PAGER_BUTTONS (pager), FALSE);
panel_return_val_if_fail (WNCK_IS_SCREEN (pager->wnck_screen), FALSE);
- GDK_THREADS_ENTER ();
-
gtk_container_foreach (GTK_CONTAINER (pager),
(GtkCallback) gtk_widget_destroy, NULL);
@@ -351,11 +351,6 @@ pager_buttons_rebuild_idle (gpointer user_data)
cols++;
}
- if (pager->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_table_resize (GTK_TABLE (pager), rows, cols);
- else
- gtk_table_resize (GTK_TABLE (pager), cols, rows);
-
panel_plugin = gtk_widget_get_ancestor (GTK_WIDGET (pager), XFCE_TYPE_PANEL_PLUGIN);
@@ -404,11 +399,8 @@ pager_buttons_rebuild_idle (gpointer user_data)
col = n % cols;
}
-
- gtk_table_attach (GTK_TABLE (pager), button,
- row, row + 1, col, col + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (pager), button,
+ row, col, 1, 1);
}
}
else
@@ -449,10 +441,8 @@ pager_buttons_rebuild_idle (gpointer user_data)
col = n % cols;
}
- gtk_table_attach (GTK_TABLE (pager), button,
- row, row + 1, col, col + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
- 0, 0);
+ gtk_grid_attach (GTK_GRID (pager), button,
+ row, col, 1, 1);
}
}
@@ -460,8 +450,6 @@ pager_buttons_rebuild_idle (gpointer user_data)
leave:
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -482,8 +470,8 @@ pager_buttons_queue_rebuild (PagerButtons *pager)
if (pager->rebuild_id == 0)
{
- pager->rebuild_id = g_idle_add_full (G_PRIORITY_LOW, pager_buttons_rebuild_idle,
- pager, pager_buttons_rebuild_idle_destroyed);
+ pager->rebuild_id = gdk_threads_add_idle_full (G_PRIORITY_LOW, pager_buttons_rebuild_idle,
+ pager, pager_buttons_rebuild_idle_destroyed);
}
}
@@ -571,11 +559,11 @@ pager_buttons_workspace_button_label (WnckWorkspace *workspace,
/* try to get an utf-8 valid name */
name = wnck_workspace_get_name (workspace);
- if (!exo_str_is_empty (name)
+ if (!panel_str_is_empty (name)
&& !g_utf8_validate (name, -1, NULL))
name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
name = name_num = g_strdup_printf (_("Workspace %d"),
wnck_workspace_get_number (workspace) + 1);
diff --git a/plugins/pager/pager-dialog.glade b/plugins/pager/pager-dialog.glade
index 02fbcde..bec47f1 100644
--- a/plugins/pager/pager-dialog.glade
+++ b/plugins/pager/pager-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index bea2fab..950fad9 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -33,7 +33,6 @@
#include <common/panel-utils.h>
#include <common/panel-private.h>
#include <libwnck/libwnck.h>
-#include <exo/exo.h>
#include "pager.h"
#include "pager-buttons.h"
@@ -53,8 +52,6 @@ static void pager_plugin_set_property (GObject *ob
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static void pager_plugin_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
static gboolean pager_plugin_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static void pager_plugin_screen_changed (GtkWidget *widget,
@@ -86,17 +83,14 @@ struct _PagerPlugin
/* settings */
guint scrolling : 1;
- guint wrap_workspaces : 1;
guint miniature_view : 1;
gint rows;
- gfloat ratio;
};
enum
{
PROP_0,
PROP_WORKSPACE_SCROLLING,
- PROP_WRAP_WORKSPACES,
PROP_MINIATURE_VIEW,
PROP_ROWS
};
@@ -122,7 +116,6 @@ pager_plugin_class_init (PagerPluginClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->scroll_event = pager_plugin_scroll_event;
- widget_class->size_request = pager_plugin_size_request;
plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
plugin_class->construct = pager_plugin_construct;
@@ -136,28 +129,21 @@ pager_plugin_class_init (PagerPluginClass *klass)
g_param_spec_boolean ("workspace-scrolling",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_WRAP_WORKSPACES,
- g_param_spec_boolean ("wrap-workspaces",
- NULL, NULL,
- FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_MINIATURE_VIEW,
g_param_spec_boolean ("miniature-view",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ROWS,
g_param_spec_uint ("rows",
NULL, NULL,
1, 50, 1,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -167,10 +153,8 @@ pager_plugin_init (PagerPlugin *plugin)
{
plugin->wnck_screen = NULL;
plugin->scrolling = TRUE;
- plugin->wrap_workspaces = FALSE;
plugin->miniature_view = TRUE;
plugin->rows = 1;
- plugin->ratio = 1.0;
plugin->pager = NULL;
}
@@ -190,10 +174,6 @@ pager_plugin_get_property (GObject *object,
g_value_set_boolean (value, plugin->scrolling);
break;
- case PROP_WRAP_WORKSPACES:
- g_value_set_boolean (value, plugin->wrap_workspaces);
- break;
-
case PROP_MINIATURE_VIEW:
g_value_set_boolean (value, plugin->miniature_view);
@@ -226,10 +206,6 @@ pager_plugin_set_property (GObject *object,
plugin->scrolling = g_value_get_boolean (value);
break;
- case PROP_WRAP_WORKSPACES:
- plugin->wrap_workspaces = g_value_get_boolean (value);
- break;
-
case PROP_MINIATURE_VIEW:
plugin->miniature_view = g_value_get_boolean (value);
break;
@@ -283,21 +259,12 @@ pager_plugin_scroll_event (GtkWidget *widget,
else
active_n++;
+ /* wrap around */
n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen) - 1;
-
- if (plugin->wrap_workspaces == TRUE)
- {
- /* wrap around */
- if (active_n < 0)
- active_n = n_workspaces;
- else if (active_n > n_workspaces)
- active_n = 0;
- }
- else if (active_n < 0 || active_n > n_workspaces )
- {
- /* we do not need to do anything */
- return TRUE;
- }
+ if (active_n < 0)
+ active_n = n_workspaces;
+ else if (active_n > n_workspaces)
+ active_n = 0;
new_ws = wnck_screen_get_workspace (plugin->wnck_screen, active_n);
if (new_ws != NULL && active_ws != new_ws)
@@ -330,13 +297,18 @@ pager_plugin_screen_layout_changed (PagerPlugin *plugin)
if (plugin->miniature_view)
{
- plugin->pager = wnck_pager_new (plugin->wnck_screen);
+ plugin->pager = wnck_pager_new ();
wnck_pager_set_display_mode (WNCK_PAGER (plugin->pager), WNCK_PAGER_DISPLAY_CONTENT);
if (!wnck_pager_set_n_rows (WNCK_PAGER (plugin->pager), plugin->rows))
g_message ("Setting the pager rows returned false. Maybe the setting is not applied.");
+#if 0
+ wnck_pager_set_layout_policy (WNCK_PAGER (plugin->pager),
+ (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
+ WNCK_PAGER_LAYOUT_POLICY_WIDTH_FOR_HEIGHT :
+ WNCK_PAGER_LAYOUT_POLICY_HEIGHT_FOR_WIDTH);
+#endif
wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation);
- plugin->ratio = (gfloat) gdk_screen_width () / (gfloat) gdk_screen_height ();
}
else
{
@@ -385,7 +357,6 @@ pager_plugin_construct (XfcePanelPlugin *panel_plugin)
const PanelProperty properties[] =
{
{ "workspace-scrolling", G_TYPE_BOOLEAN },
- { "wrap-workspaces", G_TYPE_BOOLEAN },
{ "miniature-view", G_TYPE_BOOLEAN },
{ "rows", G_TYPE_UINT },
{ NULL }
@@ -429,8 +400,6 @@ static gboolean
pager_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size)
{
- gtk_widget_queue_resize (GTK_WIDGET (panel_plugin));
-
/* do not set fixed size */
return TRUE;
}
@@ -449,7 +418,15 @@ pager_plugin_mode_changed (XfcePanelPlugin *panel_plugin,
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
if (plugin->miniature_view)
- wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation);
+ {
+#if 0
+ wnck_pager_set_layout_policy (WNCK_PAGER (plugin->pager),
+ (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
+ WNCK_PAGER_LAYOUT_POLICY_WIDTH_FOR_HEIGHT :
+ WNCK_PAGER_LAYOUT_POLICY_HEIGHT_FOR_WIDTH);
+#endif
+ wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation);
+ }
else
pager_buttons_set_orientation (XFCE_PAGER_BUTTONS (plugin->pager), orientation);
}
@@ -560,64 +537,24 @@ pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
object = gtk_builder_get_object (builder, "workspace-scrolling");
panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "workspace-scrolling",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "workspace-scrolling",
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
object = gtk_builder_get_object (builder, "miniature-view");
panel_return_if_fail (GTK_IS_TOGGLE_BUTTON (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "miniature-view",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "miniature-view",
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
object = gtk_builder_get_object (builder, "rows");
panel_return_if_fail (GTK_IS_ADJUSTMENT (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "rows",
- G_OBJECT (object), "value");
+ g_object_bind_property (G_OBJECT (plugin), "rows",
+ G_OBJECT (object), "value",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
/* update the rows limit */
pager_plugin_configure_n_workspaces_changed (plugin->wnck_screen, NULL, builder);
gtk_widget_show (GTK_WIDGET (dialog));
}
-
-
-
-static void
-pager_plugin_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- PagerPlugin *plugin = XFCE_PAGER_PLUGIN (widget);
- XfcePanelPluginMode mode;
- gint n_workspaces, n_cols;
-
- if (plugin->miniature_view)
- {
- mode = xfce_panel_plugin_get_mode (XFCE_PANEL_PLUGIN (plugin));
- n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen);
- n_cols = MAX (1, (n_workspaces + plugin->rows - 1) / plugin->rows);
- if (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
- {
- requisition->height = xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin));
- requisition->width = (gint) (requisition->height / plugin->rows * plugin->ratio * n_cols);
- }
- else if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
- {
- requisition->width = xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin));
- requisition->height = (gint) (requisition->width / plugin->rows / plugin->ratio * n_cols);
- }
- else /* (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) */
- {
- requisition->width = xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin));
- requisition->height = (gint) (requisition->width / n_cols / plugin->ratio * plugin->rows);
- }
- }
- else if (plugin->pager)
- {
- gtk_widget_size_request (plugin->pager, requisition);
- }
- else // initial fallback
- {
- requisition->width = 1;
- requisition->height = 1;
- }
-}
-
diff --git a/plugins/separator/Makefile.am b/plugins/separator/Makefile.am
index cacd475..c76c3eb 100644
--- a/plugins/separator/Makefile.am
+++ b/plugins/separator/Makefile.am
@@ -23,7 +23,6 @@ libseparator_la_CFLAGS = \
$(LIBXFCE4UTIL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
- $(EXO_CFLAGS) \
$(PLATFORM_CFLAGS)
libseparator_la_LDFLAGS = \
@@ -40,7 +39,6 @@ libseparator_la_LIBADD = \
$(CAIRO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
- $(EXO_LIBS) \
$(XFCONF_LIBS)
libseparator_la_DEPENDENCIES = \
@@ -70,7 +68,7 @@ DISTCLEANFILES += \
$(libseparator_built_sources)
separator-dialog_ui.h: separator-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=separator_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=separator_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/separator/separator-dialog.glade b/plugins/separator/separator-dialog.glade
index 5bf9152..b8fae9a 100644
--- a/plugins/separator/separator-dialog.glade
+++ b/plugins/separator/separator-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c
index 8543ee7..daced70 100644
--- a/plugins/separator/separator.c
+++ b/plugins/separator/separator.c
@@ -29,7 +29,6 @@
#include <common/panel-private.h>
#include <common/panel-xfconf.h>
#include <common/panel-utils.h>
-#include <exo/exo.h>
#include "separator.h"
#include "separator-dialog_ui.h"
@@ -38,6 +37,7 @@
#define SEPARATOR_OFFSET (0.15)
#define SEPARATOR_SIZE (8)
#define DOTS_SIZE (6)
+#define HANDLE_SIZE (4)
@@ -49,8 +49,8 @@ static void separator_plugin_set_property (GObject
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static gboolean separator_plugin_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean separator_plugin_draw (GtkWidget *widget,
+ cairo_t *cr);
static void separator_plugin_construct (XfcePanelPlugin *panel_plugin);
static gboolean separator_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size);
@@ -124,7 +124,7 @@ separator_plugin_class_init (SeparatorPluginClass *klass)
gobject_class->get_property = separator_plugin_get_property;
widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->expose_event = separator_plugin_expose_event;
+ widget_class->draw = separator_plugin_draw;
plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
plugin_class->construct = separator_plugin_construct;
@@ -139,14 +139,14 @@ separator_plugin_class_init (SeparatorPluginClass *klass)
SEPARATOR_PLUGIN_STYLE_MIN,
SEPARATOR_PLUGIN_STYLE_MAX,
SEPARATOR_PLUGIN_STYLE_DEFAULT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_EXPAND,
g_param_spec_boolean ("expand",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -221,17 +221,22 @@ separator_plugin_set_property (GObject *object,
static gboolean
-separator_plugin_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+separator_plugin_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (widget);
- GtkAllocation *alloc = &(widget->allocation);
- GdkBitmap *bmap;
- GdkGC *gc;
- GtkStateType state = GTK_WIDGET_STATE (widget);
- gint x, y, w, h;
- gint rows, cols;
- guint i;
+ SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (widget);
+ GtkAllocation alloc;
+ gint x, y, w, h;
+ gint rows, cols;
+ guint i;
+ GtkStyleContext *ctx;
+ GdkRGBA fg_rgba;
+
+ gtk_widget_get_allocation (widget, &alloc);
+
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_color (ctx, gtk_widget_get_state_flags (widget), &fg_rgba);
+ gdk_cairo_set_source_rgba (cr, &fg_rgba);
switch (plugin->style)
{
@@ -241,63 +246,65 @@ separator_plugin_expose_event (GtkWidget *widget,
break;
case SEPARATOR_PLUGIN_STYLE_SEPARATOR:
+
if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) ==
GTK_ORIENTATION_HORIZONTAL)
{
- gtk_paint_vline (widget->style,
- widget->window,
- state,
- &(event->area),
- widget, "separator",
- alloc->y + alloc->height * SEPARATOR_OFFSET,
- alloc->y + alloc->height * (1.00 - SEPARATOR_OFFSET),
- alloc->x + alloc->width / 2 - 1);
+ gtk_render_line (ctx, cr,
+ (gdouble) (alloc.width - 1.0) / 2.0,
+ (gdouble) alloc.height * SEPARATOR_OFFSET,
+ (gdouble) (alloc.width - 1.0) / 2.0,
+ (gdouble) alloc.height * (1.0 - SEPARATOR_OFFSET));
}
else
{
- gtk_paint_hline (widget->style,
- widget->window,
- state,
- &(event->area),
- widget, "separator",
- alloc->x + alloc->width * SEPARATOR_OFFSET,
- alloc->x + alloc->width * (1.00 - SEPARATOR_OFFSET),
- alloc->y + alloc->height / 2 - 1);
+ gtk_render_line (ctx, cr,
+ (gdouble) alloc.width * SEPARATOR_OFFSET,
+ (gdouble) (alloc.height - 1.0) / 2.0,
+ (gdouble) alloc.width * (1.0 - SEPARATOR_OFFSET),
+ (gdouble) (alloc.height - 1.0) / 2.0);
}
break;
case SEPARATOR_PLUGIN_STYLE_HANDLE:
- gtk_paint_handle (widget->style,
- widget->window,
- state,
- GTK_SHADOW_NONE,
- &(event->area),
- widget, "handlebox",
- alloc->x, alloc->y,
- alloc->width,
- alloc->height,
- xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) ==
- GTK_ORIENTATION_HORIZONTAL ? GTK_ORIENTATION_VERTICAL
- : GTK_ORIENTATION_HORIZONTAL);
+ if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) ==
+ GTK_ORIENTATION_HORIZONTAL)
+ {
+ gtk_render_handle (ctx, cr,
+ (gdouble) (alloc.width - HANDLE_SIZE) / 2.0,
+ (gdouble) alloc.height * SEPARATOR_OFFSET,
+ (gdouble) HANDLE_SIZE,
+ (gdouble) alloc.height * (1.0 - 2.0 * SEPARATOR_OFFSET));
+ }
+ else
+ {
+ gtk_render_handle (ctx, cr,
+ (gdouble) alloc.width * SEPARATOR_OFFSET,
+ (gdouble) (alloc.height - HANDLE_SIZE) / 2.0,
+ (gdouble) alloc.width * (1.0 - 2.0 * SEPARATOR_OFFSET),
+ (gdouble) HANDLE_SIZE);
+ }
break;
+ /* temporarily disabled */
+#if 0
case SEPARATOR_PLUGIN_STYLE_DOTS:
if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) ==
GTK_ORIENTATION_HORIZONTAL)
{
- rows = MAX (alloc->height / DOTS_SIZE, 1);
+ rows = MAX (alloc.height / DOTS_SIZE, 1);
w = DOTS_SIZE;
h = rows * DOTS_SIZE;
}
else
{
- cols = MAX (alloc->width / DOTS_SIZE, 1);
+ cols = MAX (alloc.width / DOTS_SIZE, 1);
h = DOTS_SIZE;
w = cols * DOTS_SIZE;
}
- x = alloc->x + (alloc->width - w) / 2;
- y = alloc->y + (alloc->height - h) / 2;
+ x = alloc.x + (alloc.width - w) / 2;
+ y = alloc.y + (alloc.height - h) / 2;
for (i = 0; i < G_N_ELEMENTS (bits); i++)
{
@@ -328,6 +335,7 @@ separator_plugin_expose_event (GtkWidget *widget,
gdk_gc_set_clip_rectangle (gc, NULL);
}
break;
+#endif
}
return FALSE;
@@ -396,12 +404,14 @@ separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
return;
style = gtk_builder_get_object (builder, "style");
- exo_mutual_binding_new (G_OBJECT (plugin), "style",
- G_OBJECT (style), "active");
+ g_object_bind_property (G_OBJECT (plugin), "style",
+ G_OBJECT (style), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
expand = gtk_builder_get_object (builder, "expand");
- exo_mutual_binding_new (G_OBJECT (plugin), "expand",
- G_OBJECT (expand), "active");
+ g_object_bind_property (G_OBJECT (plugin), "expand",
+ G_OBJECT (expand), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
gtk_widget_show (GTK_WIDGET (dialog));
}
diff --git a/plugins/systray/Makefile.am b/plugins/systray/Makefile.am
index 772da56..f1e0882 100644
--- a/plugins/systray/Makefile.am
+++ b/plugins/systray/Makefile.am
@@ -28,7 +28,6 @@ libsystray_la_SOURCES = \
libsystray_la_CFLAGS = \
$(LIBX11_CFLAGS) \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
@@ -46,7 +45,6 @@ libsystray_la_LIBADD = \
$(top_builddir)/common/libpanel-common.la \
$(LIBX11_LIBS) \
$(GTK_LIBS) \
- $(EXO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(XFCONF_LIBS)
@@ -89,7 +87,7 @@ systray-marshal.c: systray-marshal.list Makefile
&& glib-genmarshal --prefix=_systray_marshal --body $< >> $@
systray-dialog_ui.h: systray-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=systray_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=systray_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c
index 06f0b46..5505ec5 100644
--- a/plugins/systray/systray-box.c
+++ b/plugins/systray/systray-box.c
@@ -27,7 +27,6 @@
#include <math.h>
#endif
-#include <exo/exo.h>
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
@@ -49,8 +48,15 @@ static void systray_box_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void systray_box_finalize (GObject *object);
-static void systray_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void systray_box_get_preferred_length (GtkWidget *widget,
+ gint *minimum_length,
+ gint *natural_length);
+static void systray_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+static void systray_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
static void systray_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void systray_box_add (GtkContainer *container,
@@ -120,7 +126,8 @@ systray_box_class_init (SystrayBoxClass *klass)
gobject_class->finalize = systray_box_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = systray_box_size_request;
+ gtkwidget_class->get_preferred_width = systray_box_get_preferred_width;
+ gtkwidget_class->get_preferred_height = systray_box_get_preferred_height;
gtkwidget_class->size_allocate = systray_box_size_allocate;
gtkcontainer_class = GTK_CONTAINER_CLASS (klass);
@@ -134,7 +141,7 @@ systray_box_class_init (SystrayBoxClass *klass)
g_param_spec_boolean ("has-hidden",
NULL, NULL,
FALSE,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
@@ -142,7 +149,7 @@ systray_box_class_init (SystrayBoxClass *klass)
static void
systray_box_init (SystrayBox *box)
{
- GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
box->childeren = NULL;
box->size_max = SIZE_MAX_DEFAULT;
@@ -202,12 +209,16 @@ systray_box_size_get_max_child_size (SystrayBox *box,
gint *row_size_ret,
gint *offset_ret)
{
- GtkWidget *widget = GTK_WIDGET (box);
- gint size;
- gint rows;
- gint row_size;
+ GtkWidget *widget = GTK_WIDGET (box);
+ gint size;
+ gint rows;
+ gint row_size;
+ GtkStyleContext *ctx;
+ GtkBorder padding;
- alloc_size -= 2 * GTK_CONTAINER (widget)->border_width;
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (widget), &padding);
+ alloc_size -= MAX (padding.left+padding.right, padding.top+padding.bottom);
/* count the number of rows that fit in the allocated space */
for (rows = 1;; rows++)
@@ -244,24 +255,67 @@ systray_box_size_get_max_child_size (SystrayBox *box,
static void
-systray_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+systray_box_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
{
SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
- GtkWidget *child;
- gint border;
- GtkRequisition child_req;
- gint n_hidden_childeren = 0;
- gint rows;
- gdouble cols;
- gint row_size;
- gdouble cells;
- gint min_seq_cells = -1;
- gdouble ratio;
- GSList *li;
- gboolean hidden;
- gint col_px;
- gint row_px;
+
+ if (box->horizontal)
+ {
+ systray_box_get_preferred_length (widget, minimum_width, natural_width);
+ }
+ else
+ {
+ if (minimum_width != NULL)
+ *minimum_width = -1;
+ if (natural_width != NULL)
+ *natural_width = -1;
+ }
+}
+
+
+static void
+systray_box_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
+
+ if (box->horizontal)
+ {
+ if (minimum_height != NULL)
+ *minimum_height = -1;
+ if (natural_height != NULL)
+ *natural_height = -1;
+ }
+ else
+ {
+ systray_box_get_preferred_length (widget, minimum_height, natural_height);
+ }
+}
+
+
+static void
+systray_box_get_preferred_length (GtkWidget *widget,
+ gint *minimum_length,
+ gint *natural_length)
+{
+ SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
+ GtkWidget *child;
+ GtkRequisition child_req;
+ gint n_hidden_childeren = 0;
+ gint rows;
+ gdouble cols;
+ gint row_size;
+ gdouble cells;
+ gint min_seq_cells = -1;
+ gdouble ratio;
+ GSList *li;
+ gboolean hidden;
+ gint length;
+ GtkStyleContext *ctx;
+ GtkBorder padding;
box->n_visible_children = 0;
@@ -273,11 +327,11 @@ systray_box_size_request (GtkWidget *widget,
child = GTK_WIDGET (li->data);
panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (child));
- gtk_widget_size_request (child, &child_req);
+ gtk_widget_get_preferred_size (child, NULL, &child_req);
/* skip invisible requisitions (see macro) or hidden widgets */
if (REQUISITION_IS_INVISIBLE (child_req)
- || !GTK_WIDGET_VISIBLE (child))
+ || !gtk_widget_get_visible (child))
continue;
hidden = systray_socket_get_hidden (XFCE_SYSTRAY_SOCKET (child));
@@ -336,24 +390,11 @@ systray_box_size_request (GtkWidget *widget,
if (min_seq_cells != -1)
cols = MAX (min_seq_cells, cols);
- col_px = row_size * cols + (cols - 1) * SPACING;
- row_px = row_size * rows + (rows - 1) * SPACING;
-
- if (box->horizontal)
- {
- requisition->width = col_px;
- requisition->height = row_px;
- }
- else
- {
- requisition->width = row_px;
- requisition->height = col_px;
- }
+ length = row_size * cols + (cols - 1) * SPACING;
}
else
{
- requisition->width = 0;
- requisition->height = 0;
+ length = 0;
}
/* emit property if changed */
@@ -368,9 +409,15 @@ systray_box_size_request (GtkWidget *widget,
}
/* add border size */
- border = GTK_CONTAINER (widget)->border_width * 2;
- requisition->width += border;
- requisition->height += border;
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (widget), &padding);
+ length += MAX (padding.left+padding.right, padding.top+padding.bottom);
+
+ if (minimum_length != NULL)
+ *minimum_length = length;
+
+ if (natural_length != NULL)
+ *natural_length = length;
}
@@ -379,24 +426,26 @@ static void
systray_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
- GtkWidget *child;
- GtkAllocation child_alloc;
- GtkRequisition child_req;
- gint border;
- gint rows;
- gint row_size;
- gdouble ratio;
- gint x, x_start, x_end;
- gint y, y_start, y_end;
- gint offset;
- GSList *li;
- gint alloc_size;
- gint idx;
-
- widget->allocation = *allocation;
-
- border = GTK_CONTAINER (widget)->border_width;
+ SystrayBox *box = XFCE_SYSTRAY_BOX (widget);
+ GtkWidget *child;
+ GtkAllocation child_alloc;
+ GtkRequisition child_req;
+ gint rows;
+ gint row_size;
+ gdouble ratio;
+ gint x, x_start, x_end;
+ gint y, y_start, y_end;
+ gint offset;
+ GSList *li;
+ gint alloc_size;
+ gint idx;
+ GtkStyleContext *ctx;
+ GtkBorder padding;
+
+ gtk_widget_set_allocation (widget, allocation);
+
+ ctx = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (widget), &padding);
alloc_size = box->horizontal ? allocation->height : allocation->width;
@@ -404,14 +453,14 @@ systray_box_size_allocate (GtkWidget *widget,
panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "allocate rows=%d, row_size=%d, w=%d, h=%d, horiz=%s, border=%d",
rows, row_size, allocation->width, allocation->height,
- PANEL_DEBUG_BOOL (box->horizontal), border);
+ PANEL_DEBUG_BOOL (box->horizontal), padding.left);
/* get allocation bounds */
- x_start = allocation->x + border;
- x_end = allocation->x + allocation->width - border;
+ x_start = allocation->x + padding.left;
+ x_end = allocation->x + allocation->width - padding.right;
- y_start = allocation->y + border;
- y_end = allocation->y + allocation->height - border;
+ y_start = allocation->y + padding.top;
+ y_end = allocation->y + allocation->height - padding.bottom;
/* add offset to center the tray contents */
if (box->horizontal)
@@ -429,10 +478,10 @@ systray_box_size_allocate (GtkWidget *widget,
child = GTK_WIDGET (li->data);
panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (child));
- if (!GTK_WIDGET_VISIBLE (child))
+ if (!gtk_widget_get_visible (child))
continue;
- gtk_widget_get_child_requisition (child, &child_req);
+ gtk_widget_get_preferred_size (child, NULL, &child_req);
if (REQUISITION_IS_INVISIBLE (child_req)
|| (!box->show_hidden
@@ -573,7 +622,7 @@ systray_box_add (GtkContainer *container,
panel_return_if_fail (XFCE_IS_SYSTRAY_BOX (box));
panel_return_if_fail (GTK_IS_WIDGET (child));
- panel_return_if_fail (child->parent == NULL);
+ panel_return_if_fail (gtk_widget_get_parent (child) == NULL);
box->childeren = g_slist_insert_sorted (box->childeren, child,
systray_box_compare_function);
diff --git a/plugins/systray/systray-dialog.glade b/plugins/systray/systray-dialog.glade
index a322f39..a960c6e 100644
--- a/plugins/systray/systray-dialog.glade
+++ b/plugins/systray/systray-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkListStore" id="applications-store">
diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c
index d77faee..ac820eb 100644
--- a/plugins/systray/systray-manager.c
+++ b/plugins/systray/systray-manager.c
@@ -118,6 +118,9 @@ struct _SystrayManager
/* _net_system_tray_opcode atom */
Atom opcode_atom;
+ /* _net_system_tray_message_data atom */
+ Atom data_atom;
+
/* _net_system_tray_s%d atom */
GdkAtom selection_atom;
};
@@ -307,6 +310,7 @@ systray_manager_register (SystrayManager *manager,
GtkWidget *invisible;
guint32 timestamp;
GdkAtom opcode_atom;
+ GdkAtom data_atom;
XClientMessageEvent xevent;
Window root_window;
@@ -343,10 +347,11 @@ systray_manager_register (SystrayManager *manager,
systray_manager_set_visual (manager);
/* get the current x server time stamp */
- timestamp = gdk_x11_get_server_time (invisible->window);
+ timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (invisible)));
/* try to become the selection owner of this display */
- succeed = gdk_selection_owner_set_for_display (display, invisible->window,
+ succeed = gdk_selection_owner_set_for_display (display,
+ gtk_widget_get_window (GTK_WIDGET (invisible)),
manager->selection_atom,
timestamp, TRUE);
@@ -363,7 +368,7 @@ systray_manager_register (SystrayManager *manager,
xevent.data.l[0] = timestamp;
xevent.data.l[1] = gdk_x11_atom_to_xatom_for_display (display,
manager->selection_atom);
- xevent.data.l[2] = GDK_WINDOW_XWINDOW (invisible->window);
+ xevent.data.l[2] = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (invisible)));
xevent.data.l[3] = 0;
xevent.data.l[4] = 0;
@@ -371,21 +376,16 @@ systray_manager_register (SystrayManager *manager,
XSendEvent (GDK_DISPLAY_XDISPLAY (display), root_window,
False, StructureNotifyMask, (XEvent *)&xevent);
- /* system_tray_request_dock and selectionclear */
- gdk_window_add_filter (invisible->window, systray_manager_window_filter, manager);
+ /* system_tray_request_dock, system_tray_begin_message, system_tray_cancel_message and selectionclear */
+ gdk_window_add_filter (gtk_widget_get_window (GTK_WIDGET (invisible)),
+ systray_manager_window_filter, manager);
/* get the opcode atom (for both gdk and x11) */
opcode_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_OPCODE", FALSE);
manager->opcode_atom = gdk_x11_atom_to_xatom_for_display (display, opcode_atom);
- /* system_tray_begin_message and system_tray_cancel_message */
- gdk_display_add_client_message_filter (display,
- opcode_atom, systray_manager_handle_client_message_opcode, manager);
-
- /* _net_system_tray_message_data */
- gdk_display_add_client_message_filter (display,
- gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA", FALSE),
- systray_manager_handle_client_message_message_data, manager);
+ data_atom = gdk_atom_intern ("_NET_SYSTEM_TRAY_MESSAGE_DATA", FALSE);
+ manager->data_atom = gdk_x11_atom_to_xatom_for_display (display, data_atom);
panel_debug (PANEL_DEBUG_SYSTRAY, "registered manager on screen %d", screen_number);
}
@@ -441,24 +441,24 @@ systray_manager_unregister (SystrayManager *manager)
return;
panel_return_if_fail (GTK_IS_INVISIBLE (invisible));
- panel_return_if_fail (GTK_WIDGET_REALIZED (invisible));
- panel_return_if_fail (GDK_IS_WINDOW (invisible->window));
+ panel_return_if_fail (gtk_widget_get_realized (invisible));
+ panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (invisible))));
/* get the display of the invisible window */
display = gtk_widget_get_display (invisible);
/* remove our handling of the selection if we're the owner */
owner = gdk_selection_owner_get_for_display (display, manager->selection_atom);
- if (owner == invisible->window)
+ if (owner == gtk_widget_get_window (GTK_WIDGET (invisible)))
{
gdk_selection_owner_set_for_display (display, NULL,
manager->selection_atom,
- gdk_x11_get_server_time (invisible->window),
+ gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (invisible))),
TRUE);
}
/* remove window filter */
- gdk_window_remove_filter (invisible->window,
+ gdk_window_remove_filter (gtk_widget_get_window (GTK_WIDGET (invisible)),
systray_manager_window_filter, manager);
/* remove all sockets from the hash table */
@@ -487,14 +487,11 @@ systray_manager_window_filter (GdkXEvent *xev,
if (xevent->type == ClientMessage)
{
- if (xevent->xclient.message_type == manager->opcode_atom
- && xevent->xclient.data.l[1] == XFCE_SYSTRAY_MANAGER_REQUEST_DOCK)
- {
- /* dock a tray icon */
- systray_manager_handle_dock_request (manager, (XClientMessageEvent *) xevent);
+ if (xevent->xclient.message_type == manager->opcode_atom)
+ return systray_manager_handle_client_message_opcode (xevent, event, user_data);
- return GDK_FILTER_REMOVE;
- }
+ if (xevent->xclient.message_type == manager->data_atom)
+ return systray_manager_handle_client_message_message_data (xevent, event, user_data);
}
else if (xevent->type == SelectionClear)
{
@@ -526,8 +523,8 @@ systray_manager_handle_client_message_opcode (GdkXEvent *xevent,
switch (xev->data.l[1])
{
case XFCE_SYSTRAY_MANAGER_REQUEST_DOCK:
- /* handled in systray_manager_window_filter () */
- break;
+ systray_manager_handle_dock_request (manager, xev);
+ return GDK_FILTER_REMOVE;
case XFCE_SYSTRAY_MANAGER_BEGIN_MESSAGE:
systray_manager_handle_begin_message (manager, xev);
@@ -659,7 +656,7 @@ systray_manager_handle_cancel_message (SystrayManager *manager,
XClientMessageEvent *xevent)
{
GtkSocket *socket;
- GdkNativeWindow window = xevent->data.l[2];
+ Window window = xevent->data.l[2];
panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager));
@@ -683,7 +680,7 @@ systray_manager_handle_dock_request (SystrayManager *manager,
{
GtkWidget *socket;
GdkScreen *screen;
- GdkNativeWindow window = xevent->data.l[2];
+ Window window = xevent->data.l[2];
panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager));
panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible));
@@ -732,7 +729,7 @@ systray_manager_handle_undock_request (GtkSocket *socket,
gpointer user_data)
{
SystrayManager *manager = XFCE_SYSTRAY_MANAGER (user_data);
- GdkNativeWindow *window;
+ Window *window;
panel_return_val_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager), FALSE);
@@ -756,12 +753,11 @@ systray_manager_set_visual (SystrayManager *manager)
Visual *xvisual;
Atom visual_atom;
gulong data[1];
- GdkColormap *colormap;
GdkScreen *screen;
panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager));
panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible));
- panel_return_if_fail (GDK_IS_WINDOW (manager->invisible->window));
+ panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (manager->invisible))));
/* get invisible display and screen */
display = gtk_widget_get_display (manager->invisible);
@@ -781,13 +777,12 @@ systray_manager_set_visual (SystrayManager *manager)
else
{
/* use the default visual for the screen */
- colormap = gdk_screen_get_default_colormap (screen);
- xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap));
+ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen));
}
data[0] = XVisualIDFromVisual (xvisual);
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
+ GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (manager->invisible))),
visual_atom,
XA_VISUALID, 32,
PropModeReplace,
@@ -806,7 +801,7 @@ systray_manager_set_orientation (SystrayManager *manager,
panel_return_if_fail (XFCE_IS_SYSTRAY_MANAGER (manager));
panel_return_if_fail (GTK_IS_INVISIBLE (manager->invisible));
- panel_return_if_fail (GDK_IS_WINDOW (manager->invisible->window));
+ panel_return_if_fail (GDK_IS_WINDOW (gtk_widget_get_window (GTK_WIDGET (manager->invisible))));
/* set the new orientation */
manager->orientation = orientation;
@@ -825,7 +820,7 @@ systray_manager_set_orientation (SystrayManager *manager,
/* change the x property */
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XWINDOW (manager->invisible->window),
+ GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (manager->invisible))),
orientation_atom,
XA_CARDINAL, 32,
PropModeReplace,
diff --git a/plugins/systray/systray-socket.c b/plugins/systray/systray-socket.c
index 43423bb..6188774 100644
--- a/plugins/systray/systray-socket.c
+++ b/plugins/systray/systray-socket.c
@@ -53,7 +53,7 @@ struct _SystraySocket
GtkSocket __parent__;
/* plug window */
- GdkNativeWindow window;
+ Window window;
gchar *name;
@@ -68,8 +68,8 @@ static void systray_socket_finalize (GObject *object);
static void systray_socket_realize (GtkWidget *widget);
static void systray_socket_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static gboolean systray_socket_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean systray_socket_draw (GtkWidget *widget,
+ cairo_t *cr);
static void systray_socket_style_set (GtkWidget *widget,
GtkStyle *previous_style);
@@ -91,7 +91,7 @@ systray_socket_class_init (SystraySocketClass *klass)
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = systray_socket_realize;
gtkwidget_class->size_allocate = systray_socket_size_allocate;
- gtkwidget_class->expose_event = systray_socket_expose_event;
+ gtkwidget_class->draw = systray_socket_draw;
gtkwidget_class->style_set = systray_socket_style_set;
}
@@ -122,7 +122,7 @@ static void
systray_socket_realize (GtkWidget *widget)
{
SystraySocket *socket = XFCE_SYSTRAY_SOCKET (widget);
- GdkColor transparent = { 0, 0, 0, 0 };
+ GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 };
GdkWindow *window;
GTK_WIDGET_CLASS (systray_socket_parent_class)->realize (widget);
@@ -131,15 +131,15 @@ systray_socket_realize (GtkWidget *widget)
if (socket->is_composited)
{
- gdk_window_set_background (window, &transparent);
+ gdk_window_set_background_rgba (window, &transparent);
gdk_window_set_composited (window, TRUE);
socket->parent_relative_bg = FALSE;
}
else if (gtk_widget_get_visual (widget) ==
- gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (window))))
+ gdk_window_get_visual (gdk_window_get_parent (window)))
{
- gdk_window_set_back_pixmap (window, NULL, TRUE);
+ gdk_window_set_background_pattern (window, NULL);
socket->parent_relative_bg = TRUE;
}
@@ -169,27 +169,32 @@ systray_socket_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
SystraySocket *socket = XFCE_SYSTRAY_SOCKET (widget);
- gboolean moved = allocation->x != widget->allocation.x
- || allocation->y != widget->allocation.y;
- gboolean resized = allocation->width != widget->allocation.width
- ||allocation->height != widget->allocation.height;
+ GtkAllocation widget_allocation;
+ gboolean moved;
+ gboolean resized;
+
+ gtk_widget_get_allocation (widget, &widget_allocation);
+ moved = allocation->x != widget_allocation.x
+ || allocation->y != widget_allocation.y;
+ resized = allocation->width != widget_allocation.width
+ ||allocation->height != widget_allocation.height;
if ((moved || resized)
- && GTK_WIDGET_MAPPED (widget))
+ && gtk_widget_get_mapped (widget))
{
if (socket->is_composited)
- gdk_window_invalidate_rect (gdk_window_get_parent (widget->window),
- &widget->allocation, FALSE);
+ gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)),
+ &widget_allocation, FALSE);
}
GTK_WIDGET_CLASS (systray_socket_parent_class)->size_allocate (widget, allocation);
if ((moved || resized)
- && GTK_WIDGET_MAPPED (widget))
+ && gtk_widget_get_mapped (widget))
{
if (socket->is_composited)
- gdk_window_invalidate_rect (gdk_window_get_parent (widget->window),
- &widget->allocation, FALSE);
+ gdk_window_invalidate_rect (gdk_window_get_parent (gtk_widget_get_window (widget)),
+ &widget_allocation, FALSE);
else if (moved && socket->parent_relative_bg)
systray_socket_force_redraw (socket);
}
@@ -198,30 +203,24 @@ systray_socket_size_allocate (GtkWidget *widget,
static gboolean
-systray_socket_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
+systray_socket_draw (GtkWidget *widget,
+ cairo_t *cr)
{
SystraySocket *socket = XFCE_SYSTRAY_SOCKET (widget);
- cairo_t *cr;
if (socket->is_composited)
{
/* clear to transparent */
- cr = gdk_cairo_create (widget->window);
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- gdk_cairo_region (cr, event->region);
cairo_fill (cr);
- cairo_destroy (cr);
}
else if (socket->parent_relative_bg)
{
/* clear to parent-relative pixmap */
- gdk_window_clear_area (widget->window,
- event->area.x,
- event->area.y,
- event->area.width,
- event->area.height);
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_fill (cr);
}
return FALSE;
@@ -239,15 +238,14 @@ systray_socket_style_set (GtkWidget *widget,
GtkWidget *
systray_socket_new (GdkScreen *screen,
- GdkNativeWindow window)
+ Window window)
{
SystraySocket *socket;
GdkDisplay *display;
XWindowAttributes attr;
gint result;
GdkVisual *visual;
- GdkColormap *colormap;
- gboolean release_colormap = FALSE;
+ gint red_prec, green_prec, blue_prec;
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
@@ -267,32 +265,17 @@ systray_socket_new (GdkScreen *screen,
if (G_UNLIKELY (visual == NULL))
return NULL;
- /* get the correct colormap */
- if (visual == gdk_screen_get_rgb_visual (screen))
- colormap = gdk_screen_get_rgb_colormap (screen);
- else if (visual == gdk_screen_get_rgba_visual (screen))
- colormap = gdk_screen_get_rgba_colormap (screen);
- else if (visual == gdk_screen_get_system_visual (screen))
- colormap = gdk_screen_get_system_colormap (screen);
- else
- {
- /* create custom colormap */
- colormap = gdk_colormap_new (visual, FALSE);
- release_colormap = TRUE;
- }
-
/* create a new socket */
socket = g_object_new (XFCE_TYPE_SYSTRAY_SOCKET, NULL);
socket->window = window;
socket->is_composited = FALSE;
- gtk_widget_set_colormap (GTK_WIDGET (socket), colormap);
-
- /* release the custom colormap */
- if (release_colormap)
- g_object_unref (G_OBJECT (colormap));
+ gtk_widget_set_visual (GTK_WIDGET (socket), visual);
/* check if there is an alpha channel in the visual */
- if (visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth
+ gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
+ gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
+ gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+ if (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual)
&& gdk_display_supports_composite (gdk_screen_get_display (screen)))
socket->is_composited = TRUE;
@@ -304,22 +287,25 @@ systray_socket_new (GdkScreen *screen,
void
systray_socket_force_redraw (SystraySocket *socket)
{
- GtkWidget *widget = GTK_WIDGET (socket);
- XEvent xev;
- GdkDisplay *display;
+ GtkWidget *widget = GTK_WIDGET (socket);
+ XEvent xev;
+ GdkDisplay *display;
+ GtkAllocation allocation;
panel_return_if_fail (XFCE_IS_SYSTRAY_SOCKET (socket));
- if (GTK_WIDGET_MAPPED (socket) && socket->parent_relative_bg)
+ if (gtk_widget_get_mapped (widget) && socket->parent_relative_bg)
{
display = gtk_widget_get_display (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
xev.xexpose.type = Expose;
- xev.xexpose.window = GDK_WINDOW_XWINDOW (GTK_SOCKET (socket)->plug_window);
+ xev.xexpose.window = GDK_WINDOW_XID (gtk_socket_get_plug_window (GTK_SOCKET (socket)));
xev.xexpose.x = 0;
xev.xexpose.y = 0;
- xev.xexpose.width = widget->allocation.width;
- xev.xexpose.height = widget->allocation.height;
+ xev.xexpose.width = allocation.width;
+ xev.xexpose.height = allocation.height;
xev.xexpose.count = 0;
gdk_error_trap_push ();
@@ -331,7 +317,7 @@ systray_socket_force_redraw (SystraySocket *socket)
* since that is asynchronous.
*/
XSync (GDK_DISPLAY_XDISPLAY (display), False);
- gdk_error_trap_pop ();
+ gdk_error_trap_pop_ignored ();
}
}
@@ -421,7 +407,7 @@ systray_socket_get_name (SystraySocket *socket)
-GdkNativeWindow *
+Window *
systray_socket_get_window (SystraySocket *socket)
{
panel_return_val_if_fail (XFCE_IS_SYSTRAY_SOCKET (socket), NULL);
diff --git a/plugins/systray/systray-socket.h b/plugins/systray/systray-socket.h
index 619eb99..8d9ccbd 100644
--- a/plugins/systray/systray-socket.h
+++ b/plugins/systray/systray-socket.h
@@ -23,6 +23,7 @@
#define __SYSTRAY_SOCKET_H__
#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
typedef struct _SystraySocketClass SystraySocketClass;
typedef struct _SystraySocket SystraySocket;
@@ -39,7 +40,7 @@ GType systray_socket_get_type (void) G_GNUC_CONST;
void systray_socket_register_type (GTypeModule *type_module);
GtkWidget *systray_socket_new (GdkScreen *screen,
- GdkNativeWindow window) G_GNUC_MALLOC;
+ Window window) G_GNUC_MALLOC;
void systray_socket_force_redraw (SystraySocket *socket);
@@ -47,7 +48,7 @@ gboolean systray_socket_is_composited (SystraySocket *socket);
const gchar *systray_socket_get_name (SystraySocket *socket);
-GdkNativeWindow *systray_socket_get_window (SystraySocket *socket);
+Window *systray_socket_get_window (SystraySocket *socket);
gboolean systray_socket_get_hidden (SystraySocket *socket);
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index 154bc03..0d85fb3 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -27,7 +27,6 @@
#include <common/panel-xfconf.h>
#include <common/panel-utils.h>
#include <common/panel-debug.h>
-#include <exo/exo.h>
#include "systray.h"
#include "systray-box.h"
@@ -55,8 +54,8 @@ static void systray_plugin_orientation_changed (XfcePanelPlugin
static gboolean systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size);
static void systray_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
-static void systray_plugin_box_expose_event (GtkWidget *box,
- GdkEventExpose *event);
+static void systray_plugin_box_draw (GtkWidget *box,
+ cairo_t *cr);
static void systray_plugin_button_toggled (GtkWidget *button,
SystrayPlugin *plugin);
static void systray_plugin_button_set_arrow (SystrayPlugin *plugin);
@@ -182,28 +181,28 @@ systray_plugin_class_init (SystrayPluginClass *klass)
SIZE_MAX_MIN,
SIZE_MAX_MAX,
SIZE_MAX_DEFAULT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_FRAME,
g_param_spec_boolean ("show-frame",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_NAMES_HIDDEN,
g_param_spec_boxed ("names-hidden",
NULL, NULL,
PANEL_PROPERTIES_TYPE_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_NAMES_VISIBLE,
g_param_spec_boxed ("names-visible",
NULL, NULL,
PANEL_PROPERTIES_TYPE_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -211,7 +210,7 @@ systray_plugin_class_init (SystrayPluginClass *klass)
static void
systray_plugin_init (SystrayPlugin *plugin)
{
- GtkRcStyle *style;
+ //GtkRcStyle *style;
plugin->manager = NULL;
plugin->show_frame = TRUE;
@@ -223,19 +222,20 @@ systray_plugin_init (SystrayPlugin *plugin)
gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (plugin->frame);
- style = gtk_rc_style_new ();
- style->xthickness = style->ythickness = 1;
- gtk_widget_modify_style (plugin->frame, style);
- g_object_unref (G_OBJECT (style));
+ // FIXME
+ //style = gtk_rc_style_new ();
+ //style->xthickness = style->ythickness = 1;
+ //gtk_widget_modify_style (plugin->frame, style);
+ //g_object_unref (G_OBJECT (style));
- plugin->hvbox = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 2);
+ plugin->hvbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_container_add (GTK_CONTAINER (plugin->frame), plugin->hvbox);
gtk_widget_show (plugin->hvbox);
plugin->box = systray_box_new ();
gtk_box_pack_start (GTK_BOX (plugin->hvbox), plugin->box, TRUE, TRUE, 0);
- g_signal_connect (G_OBJECT (plugin->box), "expose-event",
- G_CALLBACK (systray_plugin_box_expose_event), NULL);
+ g_signal_connect (G_OBJECT (plugin->box), "draw",
+ G_CALLBACK (systray_plugin_box_draw), NULL);
gtk_container_set_border_width (GTK_CONTAINER (plugin->box), FRAME_SPACING);
gtk_widget_show (plugin->box);
@@ -244,7 +244,9 @@ systray_plugin_init (SystrayPlugin *plugin)
g_signal_connect (G_OBJECT (plugin->button), "toggled",
G_CALLBACK (systray_plugin_button_toggled), plugin);
gtk_button_set_relief (GTK_BUTTON (plugin->button), GTK_RELIEF_NONE);
- exo_binding_new (G_OBJECT (plugin->box), "has-hidden", G_OBJECT (plugin->button), "visible");
+ g_object_bind_property (G_OBJECT (plugin->box), "has-hidden",
+ G_OBJECT (plugin->button), "visible",
+ G_BINDING_SYNC_CREATE);
xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), plugin->button);
}
@@ -305,7 +307,7 @@ systray_plugin_set_property (GObject *object,
const GValue *tmp;
gchar *name;
guint i;
- GtkRcStyle *style;
+ //GtkRcStyle *style;
switch (prop_id)
{
@@ -322,10 +324,11 @@ systray_plugin_set_property (GObject *object,
gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame),
show_frame ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_NONE);
- style = gtk_rc_style_new ();
- style->xthickness = style->ythickness = show_frame ? 1 : 0;
- gtk_widget_modify_style (plugin->frame, style);
- g_object_unref (G_OBJECT (style));
+ // FIXME
+ //style = gtk_rc_style_new ();
+ //style->xthickness = style->ythickness = show_frame ? 1 : 0;
+ //gtk_widget_modify_style (plugin->frame, style);
+ //g_object_unref (G_OBJECT (style));
systray_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin),
xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)));
@@ -374,8 +377,6 @@ systray_plugin_screen_changed_idle (gpointer user_data)
GdkScreen *screen;
GError *error = NULL;
- GDK_THREADS_ENTER ();
-
/* create a new manager and register this screen */
plugin->manager = systray_manager_new ();
g_signal_connect (G_OBJECT (plugin->manager), "icon-added",
@@ -399,8 +400,6 @@ systray_plugin_screen_changed_idle (gpointer user_data)
g_error_free (error);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -430,8 +429,8 @@ systray_plugin_screen_changed (GtkWidget *widget,
/* schedule a delayed startup */
if (plugin->idle_startup == 0)
- plugin->idle_startup = g_idle_add_full (G_PRIORITY_LOW, systray_plugin_screen_changed_idle,
- plugin, systray_plugin_screen_changed_idle_destroyed);
+ plugin->idle_startup = gdk_threads_add_idle_full (G_PRIORITY_LOW, systray_plugin_screen_changed_idle,
+ plugin, systray_plugin_screen_changed_idle_destroyed);
}
@@ -505,7 +504,7 @@ systray_plugin_orientation_changed (XfcePanelPlugin *panel_plugin,
{
SystrayPlugin *plugin = XFCE_SYSTRAY_PLUGIN (panel_plugin);
- xfce_hvbox_set_orientation (XFCE_HVBOX (plugin->hvbox), orientation);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (plugin->hvbox), orientation);
systray_box_set_orientation (XFCE_SYSTRAY_BOX (plugin->box), orientation);
if (G_LIKELY (plugin->manager != NULL))
@@ -525,9 +524,11 @@ static gboolean
systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size)
{
- SystrayPlugin *plugin = XFCE_SYSTRAY_PLUGIN (panel_plugin);
- GtkWidget *frame = plugin->frame;
- gint border = 0;
+ SystrayPlugin *plugin = XFCE_SYSTRAY_PLUGIN (panel_plugin);
+ GtkWidget *frame = plugin->frame;
+ gint border = 0;
+ GtkStyleContext *ctx;
+ GtkBorder padding;
/* set the frame border */
if (plugin->show_frame && size > 26)
@@ -538,8 +539,12 @@ systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
* behind the allocated size when resizing and during startup, we
* correct the maximum size set by the user with the size the panel
* will most likely allocated */
- border += MAX (frame->style->xthickness, frame->style->ythickness);
- systray_box_set_size_alloc (XFCE_SYSTRAY_BOX (plugin->box), size - 2 * border);
+
+ ctx = gtk_widget_get_style_context (frame);
+ gtk_style_context_get_padding (ctx, gtk_widget_get_state_flags (frame), &padding);
+
+ border += MAX (padding.left+padding.right, padding.top+padding.bottom);
+ systray_box_set_size_alloc (XFCE_SYSTRAY_BOX (plugin->box), size - border);
return TRUE;
}
@@ -562,13 +567,15 @@ systray_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
object = gtk_builder_get_object (builder, "size-max");
panel_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "size-max",
- G_OBJECT (object), "value");
+ g_object_bind_property (G_OBJECT (plugin), "size-max",
+ G_OBJECT (object), "value",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
object = gtk_builder_get_object (builder, "show-frame");
panel_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (plugin), "show-frame",
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), "show-frame",
+ G_OBJECT (object), "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
store = gtk_builder_get_object (builder, "applications-store");
panel_return_if_fail (GTK_IS_LIST_STORE (store));
@@ -592,21 +599,22 @@ systray_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
static void
-systray_plugin_box_expose_event_icon (GtkWidget *child,
- gpointer user_data)
+systray_plugin_box_draw_icon (GtkWidget *child,
+ gpointer user_data)
{
cairo_t *cr = user_data;
- GtkAllocation *alloc;
+ GtkAllocation alloc;
if (systray_socket_is_composited (XFCE_SYSTRAY_SOCKET (child)))
{
- alloc = &child->allocation;
+ gtk_widget_get_allocation (child, &alloc);
/* skip hidden (see offscreen in box widget) icons */
- if (alloc->x > -1 && alloc->y > -1)
+ if (alloc.x > -1 && alloc.y > -1)
{
- gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (child),
- alloc->x, alloc->y);
+ // FIXME
+ //gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (child),
+ // alloc.x, alloc.y);
cairo_paint (cr);
}
}
@@ -615,27 +623,18 @@ systray_plugin_box_expose_event_icon (GtkWidget *child,
static void
-systray_plugin_box_expose_event (GtkWidget *box,
- GdkEventExpose *event)
+systray_plugin_box_draw (GtkWidget *box,
+ cairo_t *cr)
{
- cairo_t *cr;
+ panel_return_if_fail (cr != NULL);
if (!gtk_widget_is_composited (box))
return;
- cr = gdk_cairo_create (gtk_widget_get_window (box));
- if (G_LIKELY (cr != NULL))
- {
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
- /* separately draw all the composed tray icons after gtk
- * handled the expose event */
- gtk_container_foreach (GTK_CONTAINER (box),
- systray_plugin_box_expose_event_icon, cr);
-
- cairo_destroy (cr);
- }
+ /* separately draw all the composed tray icons after gtk
+ * handled the draw event */
+ gtk_container_foreach (GTK_CONTAINER (box),
+ systray_plugin_box_draw_icon, cr);
}
@@ -760,7 +759,7 @@ systray_plugin_names_set_hidden (SystrayPlugin *plugin,
gboolean hidden)
{
panel_return_if_fail (XFCE_IS_SYSTRAY_PLUGIN (plugin));
- panel_return_if_fail (!exo_str_is_empty (name));
+ panel_return_if_fail (!panel_str_is_empty (name));
g_hash_table_replace (plugin->names, g_strdup (name),
GUINT_TO_POINTER (hidden ? 1 : 0));
@@ -779,7 +778,7 @@ systray_plugin_names_get_hidden (SystrayPlugin *plugin,
{
gpointer p;
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
return FALSE;
/* lookup the name in the table */
@@ -880,7 +879,7 @@ systray_plugin_dialog_camel_case (const gchar *text)
gunichar c;
GString *result;
- panel_return_val_if_fail (!exo_str_is_empty (text), NULL);
+ panel_return_val_if_fail (!panel_str_is_empty (text), NULL);
/* allocate a new string for the result */
result = g_string_sized_new (32);
@@ -932,7 +931,7 @@ systray_plugin_dialog_add_application_names (gpointer key,
panel_return_if_fail (name == NULL || g_utf8_validate (name, -1, NULL));
/* skip invalid names */
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
return;
/* check if we have a better name for the application */
diff --git a/plugins/tasklist/Makefile.am b/plugins/tasklist/Makefile.am
index f14d5fe..34c38ab 100644
--- a/plugins/tasklist/Makefile.am
+++ b/plugins/tasklist/Makefile.am
@@ -21,7 +21,6 @@ libtasklist_la_SOURCES = \
libtasklist_la_CFLAGS = \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
@@ -39,7 +38,6 @@ libtasklist_la_LDFLAGS = \
libtasklist_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(top_builddir)/common/libpanel-common.la \
- $(EXO_LIBS) \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
@@ -74,7 +72,7 @@ DISTCLEANFILES += \
$(libtasklist_built_sources)
tasklist-dialog_ui.h: tasklist-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=tasklist_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=tasklist_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/tasklist/tasklist-dialog.glade b/plugins/tasklist/tasklist-dialog.glade
index ec57311..8fa64c4 100644
--- a/plugins/tasklist/tasklist-dialog.glade
+++ b/plugins/tasklist/tasklist-dialog.glade
@@ -1,129 +1,41 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkListStore" id="grouping-model">
- <columns>
- <!-- column-name title -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Never</col>
- </row>
- <row>
- <col id="0" translatable="yes">Always</col>
- </row>
- <row>
- <col id="0" translatable="yes">When space is limited</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="sort-order-model">
- <columns>
- <!-- column-name title -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Timestamp</col>
- </row>
- <row>
- <col id="0" translatable="yes">Group title and timestamp</col>
- </row>
- <row>
- <col id="0" translatable="yes">Window title</col>
- </row>
- <row>
- <col id="0" translatable="yes">Group title and window title</col>
- </row>
- <row>
- <col id="0" translatable="yes">None, allow drag-and-drop</col>
- </row>
- </data>
- </object>
<object class="XfceTitledDialog" id="dialog">
- <property name="can_focus">False</property>
<property name="title" translatable="yes">Window Buttons</property>
<property name="icon_name">gtk-properties</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="close-button">
- <property name="label">gtk-close</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="help-button">
- <property name="label">gtk-help</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="border_width">6</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="border_width">6</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="show-labels">
<property name="label" translatable="yes">Show button _labels</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -131,15 +43,12 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="flat-buttons">
<property name="label" translatable="yes">Show _flat buttons</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -147,15 +56,12 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="show-handle">
<property name="label" translatable="yes">Show _handle</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -163,34 +69,28 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Sorting _order:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">sort-order</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="sort-order">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="model">sort-order-model</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
@@ -201,14 +101,11 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
@@ -219,7 +116,6 @@
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Appearance</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -229,36 +125,31 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="border_width">6</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Window _grouping:</property>
<property name="use_underline">True</property>
@@ -266,14 +157,12 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="grouping">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="model">grouping-model</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
@@ -284,66 +173,30 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkCheckButton" id="switch-workspace-on-unminimize">
+ <property name="label" translatable="yes">Restore minimized windows to current _workspace</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Mi_ddle click action:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">middle-click</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="middle-click">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">middle-click-model</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="switch-workspace-on-unminimize">
- <property name="label" translatable="yes">Restore minimized windows to current _workspace</property>
- <property name="use_action_appearance">False</property>
+ <object class="GtkCheckButton" id="show-wireframes">
+ <property name="label" translatable="yes">D_raw window frame when hovering a button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -351,15 +204,12 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="show-wireframes">
- <property name="label" translatable="yes">D_raw window frame when hovering a button</property>
- <property name="use_action_appearance">False</property>
+ <object class="GtkCheckButton" id="window-scrolling">
+ <property name="label" translatable="yes">_Switch windows using the mouse wheel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -367,15 +217,12 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="window-scrolling">
- <property name="label" translatable="yes">_Switch windows using the mouse wheel</property>
- <property name="use_action_appearance">False</property>
+ <object class="GtkCheckButton" id="middle-button-close">
+ <property name="label" translatable="yes">_Close windows using middle mouse button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -383,8 +230,6 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
@@ -395,7 +240,6 @@
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Behaviour</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -405,31 +249,27 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="border_width">6</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="include-all-workspaces">
<property name="label" translatable="yes">Show windows from _all workspaces or viewports</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -437,15 +277,12 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="include-all-monitors">
- <property name="label" translatable="yes">Show windows from all mo_nitors</property>
- <property name="use_action_appearance">False</property>
+ <object class="GtkCheckButton" id="show-only-minimized">
+ <property name="label" translatable="yes">Show only _minimized windows</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -453,15 +290,12 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="show-only-minimized">
- <property name="label" translatable="yes">Show only _minimized windows</property>
- <property name="use_action_appearance">False</property>
+ <object class="GtkCheckButton" id="include-all-monitors">
+ <property name="label" translatable="yes">Show windows from all mo_nitors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -469,8 +303,6 @@
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -481,7 +313,6 @@
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Filtering</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -490,18 +321,55 @@
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="close-button">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help-button">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
</child>
<action-widgets>
@@ -509,27 +377,44 @@
<action-widget response="0">help-button</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="middle-click-model">
+ <object class="GtkListStore" id="grouping-model">
<columns>
<!-- column-name title -->
<column type="gchararray"/>
</columns>
<data>
<row>
- <col id="0" translatable="yes">Nothing</col>
+ <col id="0" translatable="yes">Never</col>
</row>
<row>
- <col id="0" translatable="yes">Close Window</col>
+ <col id="0" translatable="yes">Always</col>
</row>
<row>
- <col id="0" translatable="yes">Minimize Window</col>
+ <col id="0" translatable="yes">When space is limited</col>
</row>
</data>
</object>
- <object class="GtkSizeGroup" id="sizegroup1">
- <widgets>
- <widget name="label4"/>
- <widget name="label6"/>
- </widgets>
+ <object class="GtkListStore" id="sort-order-model">
+ <columns>
+ <!-- column-name title -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Timestamp</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Group title and timestamp</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Window title</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Group title and window title</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">None, allow drag-and-drop</col>
+ </row>
+ </data>
</object>
</interface>
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 53174a9..dfdc69a 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -28,7 +28,7 @@
#endif
#include <gtk/gtk.h>
-#include <exo/exo.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <libwnck/libwnck.h>
#include <libxfce4panel/libxfce4panel.h>
#include <common/panel-private.h>
@@ -71,8 +71,13 @@
#define xfce_tasklist_horizontal(tasklist) ((tasklist)->mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
#define xfce_tasklist_vertical(tasklist) ((tasklist)->mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
#define xfce_tasklist_deskbar(tasklist) ((tasklist)->mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
-#define xfce_tasklist_filter_monitors(tasklist) (!(tasklist)->all_monitors && (tasklist)->n_monitors > 1)
-#define xfce_tasklist_geometry_set_invalid(tasklist) ((tasklist)->n_monitors = 0)
+#define xfce_tasklist_filter_monitors(tasklist) (!(tasklist)->all_monitors && (tasklist)->monitor_geometry.width != -1)
+#define xfce_tasklist_geometry_set_invalid(tasklist) ((tasklist)->monitor_geometry.width = -1)
+#define xfce_tasklist_geometry_has_point(tasklist, x, y) ( \
+ (x) >= ((tasklist)->monitor_geometry.x) \
+ && (x) < ((tasklist)->monitor_geometry.x + (tasklist)->monitor_geometry.width) \
+ && (y) >= ((tasklist)->monitor_geometry.y) \
+ && (y) < ((tasklist)->monitor_geometry.y + (tasklist)->monitor_geometry.height))
@@ -90,9 +95,8 @@ enum
PROP_SHOW_HANDLE,
PROP_SORT_ORDER,
PROP_WINDOW_SCROLLING,
- PROP_WRAP_WINDOWS,
PROP_INCLUDE_ALL_BLINKING,
- PROP_MIDDLE_CLICK
+ PROP_MIDDLE_BUTTON_CLOSE
};
struct _XfceTasklistClass
@@ -152,21 +156,18 @@ struct _XfceTasklist
/* switch window with the mouse wheel */
guint window_scrolling : 1;
- guint wrap_windows : 1;
/* whether we show blinking windows from all workspaces
* or only the active workspace */
guint all_blinking : 1;
- /* action to preform when middle clicking */
- XfceTasklistMClick middle_click;
+ /* close window with the mouse middle button */
+ guint middle_button_close : 1;
/* whether we only show windows that are in the geometry of
* the monitor the tasklist is on */
guint all_monitors : 1;
- guint n_monitors;
- guint my_monitor;
- GdkRectangle *all_monitors_geometry;
+ GdkRectangle monitor_geometry;
/* whether we show wireframes when hovering a button in
* the tasklist */
@@ -263,8 +264,15 @@ static void xfce_tasklist_set_property (GObjec
const GValue *value,
GParamSpec *pspec);
static void xfce_tasklist_finalize (GObject *object);
-static void xfce_tasklist_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void xfce_tasklist_get_preferred_length (GtkWidget *widget,
+ gint *minimum_length,
+ gint *natural_length);
+static void xfce_tasklist_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width);
+static void xfce_tasklist_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height);
static void xfce_tasklist_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void xfce_tasklist_style_set (GtkWidget *widget,
@@ -374,7 +382,8 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
gobject_class->finalize = xfce_tasklist_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = xfce_tasklist_size_request;
+ gtkwidget_class->get_preferred_width = xfce_tasklist_get_preferred_width;
+ gtkwidget_class->get_preferred_height = xfce_tasklist_get_preferred_height;
gtkwidget_class->size_allocate = xfce_tasklist_size_allocate;
gtkwidget_class->style_set = xfce_tasklist_style_set;
gtkwidget_class->realize = xfce_tasklist_realize;
@@ -394,63 +403,63 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
XFCE_TASKLIST_GROUPING_MIN,
XFCE_TASKLIST_GROUPING_MAX + 1 /* TODO drop this later */,
XFCE_TASKLIST_GROUPING_DEFAULT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_INCLUDE_ALL_WORKSPACES,
g_param_spec_boolean ("include-all-workspaces",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_INCLUDE_ALL_MONITORS,
g_param_spec_boolean ("include-all-monitors",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_FLAT_BUTTONS,
g_param_spec_boolean ("flat-buttons",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SWITCH_WORKSPACE_ON_UNMINIMIZE,
g_param_spec_boolean ("switch-workspace-on-unminimize",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_LABELS,
g_param_spec_boolean ("show-labels",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_ONLY_MINIMIZED,
g_param_spec_boolean ("show-only-minimized",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_WIREFRAMES,
g_param_spec_boolean ("show-wireframes",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SHOW_HANDLE,
g_param_spec_boolean ("show-handle",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_SORT_ORDER,
@@ -459,37 +468,28 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
XFCE_TASKLIST_SORT_ORDER_MIN,
XFCE_TASKLIST_SORT_ORDER_MAX,
XFCE_TASKLIST_SORT_ORDER_DEFAULT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_WINDOW_SCROLLING,
g_param_spec_boolean ("window-scrolling",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_WRAP_WINDOWS,
- g_param_spec_boolean ("wrap-windows",
- NULL, NULL,
- FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_INCLUDE_ALL_BLINKING,
g_param_spec_boolean ("include-all-blinking",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
- PROP_MIDDLE_CLICK,
- g_param_spec_uint ("middle-click",
- NULL, NULL,
- XFCE_TASKLIST_MIDDLE_CLICK_MIN,
- XFCE_TASKLIST_MIDDLE_CLICK_MAX,
- XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT,
- EXO_PARAM_READWRITE));
+ PROP_MIDDLE_BUTTON_CLOSE,
+ g_param_spec_boolean ("middle-button-close",
+ NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("max-button-length",
@@ -497,7 +497,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
"The maximum length of a window button",
-1, G_MAXINT,
DEFAULT_MAX_BUTTON_LENGTH,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("min-button-length",
@@ -505,7 +505,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
"The minumum length of a window button",
1, G_MAXINT,
DEFAULT_MIN_BUTTON_LENGTH,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("max-button-size",
@@ -513,7 +513,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
"The maximum size of a window button",
1, G_MAXINT,
DEFAULT_BUTTON_SIZE,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_enum ("ellipsize-mode",
@@ -521,7 +521,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
"The ellipsize mode used for the button label",
PANGO_TYPE_ELLIPSIZE_MODE,
DEFAULT_ELLIPSIZE_MODE,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("minimized-icon-lucency",
@@ -529,14 +529,14 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
"Lucent percentage of minimized icons",
0, 100,
DEFAULT_ICON_LUCENCY,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("menu-max-width-chars",
NULL,
"Maximum chars in the overflow menu labels",
0, G_MAXINT,
DEFAULT_MENU_MAX_WIDTH_CHARS,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
menu_icon_size = gtk_icon_size_from_name ("panel-tasklist-menu");
if (menu_icon_size == GTK_ICON_SIZE_INVALID)
@@ -550,7 +550,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
static void
xfce_tasklist_init (XfceTasklist *tasklist)
{
- GTK_WIDGET_SET_FLAGS (tasklist, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (GTK_WIDGET (tasklist), FALSE);
tasklist->locked = 0;
tasklist->screen = NULL;
@@ -566,12 +566,9 @@ xfce_tasklist_init (XfceTasklist *tasklist)
tasklist->show_wireframes = FALSE;
tasklist->show_handle = TRUE;
tasklist->all_monitors = TRUE;
- tasklist->n_monitors = 0;
- tasklist->all_monitors_geometry = NULL;
tasklist->window_scrolling = TRUE;
- tasklist->wrap_windows = FALSE;
tasklist->all_blinking = TRUE;
- tasklist->middle_click = XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT;
+ tasklist->middle_button_close = FALSE;
xfce_tasklist_geometry_set_invalid (tasklist);
#ifdef GDK_WINDOWING_X11
tasklist->wireframe_window = 0;
@@ -658,16 +655,12 @@ xfce_tasklist_get_property (GObject *object,
g_value_set_boolean (value, tasklist->window_scrolling);
break;
- case PROP_WRAP_WINDOWS:
- g_value_set_boolean (value, tasklist->wrap_windows);
- break;
-
case PROP_INCLUDE_ALL_BLINKING:
g_value_set_boolean (value, tasklist->all_blinking);
break;
- case PROP_MIDDLE_CLICK:
- g_value_set_uint (value, tasklist->middle_click);
+ case PROP_MIDDLE_BUTTON_CLOSE:
+ g_value_set_boolean (value, tasklist->middle_button_close);
break;
default:
@@ -740,16 +733,12 @@ xfce_tasklist_set_property (GObject *object,
tasklist->window_scrolling = g_value_get_boolean (value);
break;
- case PROP_WRAP_WINDOWS:
- tasklist->wrap_windows = g_value_get_boolean (value);
- break;
-
case PROP_INCLUDE_ALL_BLINKING:
tasklist->all_blinking = g_value_get_boolean (value);
break;
- case PROP_MIDDLE_CLICK:
- tasklist->middle_click= g_value_get_uint (value);
+ case PROP_MIDDLE_BUTTON_CLOSE:
+ tasklist->middle_button_close = g_value_get_boolean (value);
break;
default:
@@ -790,8 +779,55 @@ xfce_tasklist_finalize (GObject *object)
static void
-xfce_tasklist_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+xfce_tasklist_get_preferred_width (GtkWidget *widget,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ XfceTasklist *tasklist = XFCE_TASKLIST (widget);
+
+ if (xfce_tasklist_horizontal (tasklist))
+ {
+ xfce_tasklist_get_preferred_length (widget, minimum_width, natural_width);
+ }
+ else
+ {
+ if (minimum_width != NULL)
+ *minimum_width = tasklist->size;
+
+ if (natural_width != NULL)
+ *natural_width = tasklist->size;
+ }
+}
+
+
+
+static void
+xfce_tasklist_get_preferred_height (GtkWidget *widget,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ XfceTasklist *tasklist = XFCE_TASKLIST (widget);
+
+ if (!xfce_tasklist_horizontal (tasklist))
+ {
+ xfce_tasklist_get_preferred_length (widget, minimum_height, natural_height);
+ }
+ else
+ {
+ if (minimum_height != NULL)
+ *minimum_height = tasklist->size;
+
+ if (natural_height != NULL)
+ *natural_height = tasklist->size;
+ }
+}
+
+
+
+static void
+xfce_tasklist_get_preferred_length (GtkWidget *widget,
+ gint *minimum_length,
+ gint *natural_length)
{
XfceTasklist *tasklist = XFCE_TASKLIST (widget);
gint rows, cols;
@@ -806,9 +842,9 @@ xfce_tasklist_size_request (GtkWidget *widget,
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button))
+ if (gtk_widget_get_visible (child->button))
{
- gtk_widget_size_request (child->button, &child_req);
+ gtk_widget_get_preferred_size (child->button, NULL, &child_req);
/* child_height = MAX (child_height, child_req.height); */
child_height = MAX (child_height, tasklist->size / tasklist->nrows);
@@ -847,22 +883,15 @@ xfce_tasklist_size_request (GtkWidget *widget,
length = cols * DEFAULT_MAX_BUTTON_LENGTH;
}
- /* set the requested sizes */
if (xfce_tasklist_deskbar (tasklist) && tasklist->show_labels)
- {
- requisition->height = child_height * n_windows;
- requisition->width = tasklist->size;
- }
- else if (xfce_tasklist_horizontal (tasklist))
- {
- requisition->width = length;
- requisition->height = tasklist->size;
- }
- else
- {
- requisition->width = tasklist->size;
- requisition->height = length;
- }
+ length = child_height * n_windows;
+
+ /* set the requested sizes */
+ if (natural_length != NULL)
+ *natural_length = length;
+
+ if (minimum_length != NULL)
+ *minimum_length = (n_windows == 0) ? 0 : ARROW_BUTTON_SIZE;
}
@@ -949,7 +978,7 @@ xfce_tasklist_size_layout (XfceTasklist *tasklist,
for (li = tasklist->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button))
+ if (gtk_widget_get_visible (child->button))
{
windows_scored = g_slist_insert_sorted (windows_scored, child,
xfce_tasklist_size_sort_window);
@@ -1035,10 +1064,10 @@ xfce_tasklist_size_allocate (GtkWidget *widget,
gint arrow_position;
GtkRequisition child_req;
- panel_return_if_fail (GTK_WIDGET_VISIBLE (tasklist->arrow_button));
+ panel_return_if_fail (gtk_widget_get_visible (tasklist->arrow_button));
/* set widget allocation */
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
/* swap integers with vertical orientation */
if (!xfce_tasklist_horizontal (tasklist))
@@ -1090,7 +1119,7 @@ xfce_tasklist_size_allocate (GtkWidget *widget,
child = li->data;
/* skip hidden buttons */
- if (!GTK_WIDGET_VISIBLE (child->button))
+ if (!gtk_widget_get_visible (child->button))
continue;
if (G_LIKELY (child->type == CHILD_TYPE_WINDOW
@@ -1146,7 +1175,7 @@ xfce_tasklist_size_allocate (GtkWidget *widget,
}
else
{
- gtk_widget_get_child_requisition (child->button, &child_req);
+ gtk_widget_get_preferred_size (child->button, NULL, &child_req);
/* move the button offscreen */
child_alloc.y = child_alloc.x = -9999;
@@ -1253,12 +1282,11 @@ xfce_tasklist_scroll_event (GtkWidget *widget,
if (!tasklist->window_scrolling)
return TRUE;
- /* get the current active button */
for (li = tasklist->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (child->button)))
break;
}
@@ -1274,12 +1302,9 @@ xfce_tasklist_scroll_event (GtkWidget *widget,
{
child = lnew->data;
if (child->window != NULL
- && GTK_WIDGET_VISIBLE (child->button))
+ && gtk_widget_get_visible (child->button))
break;
}
-
- /* wrap if the first button is reached */
- lnew = (lnew == NULL && tasklist->wrap_windows) ? g_list_last (li) : lnew;
break;
case GDK_SCROLL_DOWN:
@@ -1288,12 +1313,9 @@ xfce_tasklist_scroll_event (GtkWidget *widget,
{
child = lnew->data;
if (child->window != NULL
- && GTK_WIDGET_VISIBLE (child->button))
+ && gtk_widget_get_visible (child->button))
break;
}
-
- /* wrap if the last button is reached */
- lnew = (lnew == NULL && tasklist->wrap_windows) ? g_list_first (li) : lnew;
break;
case GDK_SCROLL_LEFT:
@@ -1303,6 +1325,10 @@ xfce_tasklist_scroll_event (GtkWidget *widget,
case GDK_SCROLL_RIGHT:
/* TODO */
break;
+
+ case GDK_SCROLL_SMOOTH:
+ /* TODO */
+ break;
}
if (lnew != NULL)
@@ -1330,7 +1356,7 @@ xfce_tasklist_remove (GtkContainer *container,
{
tasklist->windows = g_list_delete_link (tasklist->windows, li);
- was_visible = GTK_WIDGET_VISIBLE (widget);
+ was_visible = gtk_widget_get_visible (widget);
gtk_widget_unparent (child->button);
@@ -1579,6 +1605,14 @@ xfce_tasklist_active_window_changed (WnckScreen *screen,
{
child = li->data;
+ /* skip hidden buttons */
+ /* TODO the visible check probably breaks with grouping */
+ if (!gtk_widget_get_visible (child->button)
+ || !(child->window == previous_window
+ || child->window == active_window
+ || !tasklist->all_workspaces))
+ continue;
+
/* update timestamp for window */
if (child->window == active_window)
g_get_current_time (&child->last_focused);
@@ -1851,7 +1885,7 @@ xfce_tasklist_update_icon_geometries (gpointer data)
XfceTasklist *tasklist = XFCE_TASKLIST (data);
GList *li;
XfceTasklistChild *child, *child2;
- GtkAllocation *alloc;
+ GtkAllocation alloc;
GSList *lp;
gint root_x, root_y;
GtkWidget *toplevel;
@@ -1867,31 +1901,31 @@ xfce_tasklist_update_icon_geometries (gpointer data)
switch (child->type)
{
case CHILD_TYPE_WINDOW:
- alloc = &child->button->allocation;
+ gtk_widget_get_allocation (child->button, &alloc);
panel_return_val_if_fail (WNCK_IS_WINDOW (child->window), FALSE);
- wnck_window_set_icon_geometry (child->window, alloc->x + root_x,
- alloc->y + root_y, alloc->width,
- alloc->height);
+ wnck_window_set_icon_geometry (child->window, alloc.x + root_x,
+ alloc.y + root_y, alloc.width,
+ alloc.height);
break;
case CHILD_TYPE_GROUP:
- alloc = &child->button->allocation;
+ gtk_widget_get_allocation (child->button, &alloc);
for (lp = child->windows; lp != NULL; lp = lp->next)
{
child2 = lp->data;
panel_return_val_if_fail (WNCK_IS_WINDOW (child2->window), FALSE);
- wnck_window_set_icon_geometry (child2->window, alloc->x + root_x,
- alloc->y + root_y, alloc->width,
- alloc->height);
+ wnck_window_set_icon_geometry (child2->window, alloc.x + root_x,
+ alloc.y + root_y, alloc.width,
+ alloc.height);
}
break;
case CHILD_TYPE_OVERFLOW_MENU:
- alloc = &tasklist->arrow_button->allocation;
+ gtk_widget_get_allocation (tasklist->arrow_button, &alloc);
panel_return_val_if_fail (WNCK_IS_WINDOW (child->window), FALSE);
- wnck_window_set_icon_geometry (child->window, alloc->x + root_x,
- alloc->y + root_y, alloc->width,
- alloc->height);
+ wnck_window_set_icon_geometry (child->window, alloc.x + root_x,
+ alloc.y + root_y, alloc.width,
+ alloc.height);
break;
case CHILD_TYPE_GROUP_MENU:
@@ -1920,12 +1954,9 @@ xfce_tasklist_update_monitor_geometry_idle (gpointer data)
GdkScreen *screen;
gboolean geometry_set = FALSE;
GdkWindow *window;
- guint tmp;
panel_return_val_if_fail (XFCE_IS_TASKLIST (tasklist), FALSE);
- GDK_THREADS_ENTER ();
-
if (!tasklist->all_monitors)
{
screen = gtk_widget_get_screen (GTK_WIDGET (tasklist));
@@ -1933,18 +1964,12 @@ xfce_tasklist_update_monitor_geometry_idle (gpointer data)
if (G_LIKELY (screen != NULL
&& window != NULL
- && (tasklist->n_monitors = gdk_screen_get_n_monitors (screen)) > 1))
+ && gdk_screen_get_n_monitors (screen) > 1))
{
/* set the monitor geometry */
- tasklist->my_monitor = gdk_screen_get_monitor_at_window (screen, window);
-
- if (tasklist->all_monitors_geometry)
- tasklist->all_monitors_geometry = g_renew (GdkRectangle, tasklist->all_monitors_geometry, tasklist->n_monitors);
- else
- tasklist->all_monitors_geometry = g_new (GdkRectangle, tasklist->n_monitors);
-
- for(tmp = 0; tmp < tasklist->n_monitors; tmp++)
- gdk_screen_get_monitor_geometry (screen, tmp, &tasklist->all_monitors_geometry[tmp]);
+ gdk_screen_get_monitor_geometry (screen,
+ gdk_screen_get_monitor_at_window (screen, window),
+ &tasklist->monitor_geometry);
geometry_set = TRUE;
}
@@ -1960,8 +1985,6 @@ xfce_tasklist_update_monitor_geometry_idle (gpointer data)
xfce_tasklist_active_workspace_changed (tasklist->screen,
NULL, tasklist);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1983,8 +2006,6 @@ xfce_tasklist_child_drag_motion_timeout (gpointer data)
panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE);
panel_return_val_if_fail (WNCK_IS_SCREEN (child->tasklist->screen), FALSE);
- GDK_THREADS_ENTER ();
-
if (child->type == CHILD_TYPE_WINDOW)
{
xfce_tasklist_button_activate (child, child->motion_timestamp);
@@ -1994,8 +2015,6 @@ xfce_tasklist_child_drag_motion_timeout (gpointer data)
/* TODO popup menu */
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -2033,9 +2052,9 @@ xfce_tasklist_child_drag_motion (XfceTasklistChild *child,
if (child->motion_timeout_id == 0
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (child->button)))
{
- child->motion_timeout_id = g_timeout_add_full (G_PRIORITY_LOW, DRAG_ACTIVATE_TIMEOUT,
- xfce_tasklist_child_drag_motion_timeout, child,
- xfce_tasklist_child_drag_motion_timeout_destroyed);
+ child->motion_timeout_id = gdk_threads_add_timeout_full (G_PRIORITY_LOW, DRAG_ACTIVATE_TIMEOUT,
+ xfce_tasklist_child_drag_motion_timeout, child,
+ xfce_tasklist_child_drag_motion_timeout_destroyed);
}
/* keep emitting the signal */
@@ -2087,8 +2106,8 @@ xfce_tasklist_child_new (XfceTasklist *tasklist)
gtk_button_set_relief (GTK_BUTTON (child->button),
tasklist->button_relief);
- child->box = xfce_hvbox_new (!xfce_tasklist_vertical (tasklist) ?
- GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, FALSE, 6);
+ child->box = gtk_box_new (!xfce_tasklist_vertical (tasklist) ?
+ GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (child->button), child->box);
gtk_widget_show (child->box);
@@ -2265,8 +2284,7 @@ xfce_tasklist_button_visible (XfceTasklistChild *child,
WnckWorkspace *active_ws)
{
XfceTasklist *tasklist = XFCE_TASKLIST (child->tasklist);
- GdkRectangle window, intersection;
- guint best_size = 0, best_monitor = 0, size, tmp;
+ gint x, y, w, h;
panel_return_val_if_fail (active_ws == NULL || WNCK_IS_WORKSPACE (active_ws), FALSE);
panel_return_val_if_fail (XFCE_IS_TASKLIST (tasklist), FALSE);
@@ -2275,19 +2293,11 @@ xfce_tasklist_button_visible (XfceTasklistChild *child,
if (xfce_tasklist_filter_monitors (tasklist))
{
/* center of the window must be on this screen */
- wnck_window_get_geometry (child->window, &window.x, &window.y, &window.width, &window.height);
+ wnck_window_get_geometry (child->window, &x, &y, &w, &h);
+ x += w / 2;
+ y += h / 2;
- for (tmp = 0; tmp < tasklist->n_monitors; tmp++)
- {
- gdk_rectangle_intersect(&tasklist->all_monitors_geometry[tmp], &window, &intersection);
- size = intersection.width * intersection.height;
- if (size > best_size)
- {
- best_size = size;
- best_monitor = tmp;
- }
- }
- if (best_monitor != tasklist->my_monitor)
+ if (!xfce_tasklist_geometry_has_point (tasklist, x, y))
return FALSE;
}
@@ -2375,10 +2385,10 @@ xfce_tasklist_button_compare (gconstpointer child_a,
name_b = wnck_class_group_get_name (class_group_b);
/* if there is no class group name, use the window name */
- if (exo_str_is_empty (name_a)
+ if (panel_str_is_empty (name_a)
&& a->window != NULL)
name_a = wnck_window_get_name (a->window);
- if (exo_str_is_empty (name_b)
+ if (panel_str_is_empty (name_b)
&& b->window != NULL)
name_b = wnck_window_get_name (b->window) ;
@@ -2466,9 +2476,11 @@ xfce_tasklist_button_icon_changed (WnckWindow *window,
&& tasklist->minimized_icon_lucency < 100
&& wnck_window_is_minimized (window))
{
+#ifdef EXO_CHECK_VERSION
lucent = exo_gdk_pixbuf_lucent (pixbuf, tasklist->minimized_icon_lucency);
if (G_UNLIKELY (lucent != NULL))
pixbuf = lucent;
+#endif
}
xfce_panel_image_set_from_pixbuf (XFCE_PANEL_IMAGE (child->icon), pixbuf);
@@ -2756,39 +2768,35 @@ xfce_tasklist_button_button_release_event (GtkWidget *button,
GdkEventButton *event,
XfceTasklistChild *child)
{
+ GtkAllocation allocation;
+
panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE);
panel_return_val_if_fail (child->type != CHILD_TYPE_GROUP, FALSE);
+ gtk_widget_get_allocation (button, &allocation);
+
/* only respond to in-button events */
if (event->type == GDK_BUTTON_RELEASE
&& !xfce_taskbar_is_locked (child->tasklist)
+ && event->button == 1
&& !(event->x == 0 && event->y == 0) /* 0,0 = outside the widget in Gtk */
- && event->x >= 0 && event->x < button->allocation.width
- && event->y >= 0 && event->y < button->allocation.height)
+ && event->x >= 0 && event->x < allocation.width
+ && event->y >= 0 && event->y < allocation.height)
{
- if (event->button == 1)
- {
- /* press the button */
- xfce_tasklist_button_activate (child, event->time);
- return FALSE;
- }
- else if (event->button == 2)
- {
- switch (child->tasklist->middle_click)
- {
- case XFCE_TASKLIST_MIDDLE_CLICK_NOTHING:
- break;
-
- case XFCE_TASKLIST_MIDDLE_CLICK_CLOSE_WINDOW:
- wnck_window_close (child->window, event->time);
- return TRUE;
+ xfce_tasklist_button_activate (child, event->time);
+ }
- case XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW:
- if (!wnck_window_is_minimized (child->window))
- wnck_window_minimize (child->window);
- return FALSE;
- }
- }
+ /* close the window on middle mouse button */
+ if (event->type == GDK_BUTTON_RELEASE
+ && !xfce_taskbar_is_locked (child->tasklist)
+ && event->button == 2
+ && child->tasklist->middle_button_close
+ && !(event->x == 0 && event->y == 0) /* 0,0 = outside the widget in Gtk */
+ && event->x >= 0 && event->x < allocation.width
+ && event->y >= 0 && event->y < allocation.height)
+ {
+ wnck_window_close (child->window, event->time);
+ return TRUE;
}
return FALSE;
@@ -2831,8 +2839,12 @@ xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child,
panel_return_val_if_fail (WNCK_IS_WINDOW (child->window), NULL);
mi = gtk_image_menu_item_new ();
- exo_binding_new (G_OBJECT (child->label), "label", G_OBJECT (mi), "label");
- exo_binding_new (G_OBJECT (child->label), "label", G_OBJECT (mi), "tooltip-text");
+ g_object_bind_property (G_OBJECT (child->label), "label",
+ G_OBJECT (mi), "label",
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (G_OBJECT (child->label), "label",
+ G_OBJECT (mi), "tooltip-text",
+ G_BINDING_SYNC_CREATE);
label = gtk_bin_get_child (GTK_BIN (mi));
panel_return_val_if_fail (GTK_IS_LABEL (label), NULL);
@@ -2844,7 +2856,9 @@ xfce_tasklist_button_proxy_menu_item (XfceTasklistChild *child,
image = xfce_panel_image_new ();
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), image);
xfce_panel_image_set_size (XFCE_PANEL_IMAGE (image), tasklist->menu_icon_size);
- exo_binding_new (G_OBJECT (child->icon), "pixbuf", G_OBJECT (image), "pixbuf");
+ g_object_bind_property (G_OBJECT (child->icon), "pixbuf",
+ G_OBJECT (image), "pixbuf",
+ G_BINDING_SYNC_CREATE);
gtk_widget_show (image);
}
@@ -2886,10 +2900,7 @@ xfce_tasklist_button_activate (XfceTasklistChild *child,
if (wnck_window_is_active (child->window)
|| wnck_window_transient_is_most_recently_activated (child->window))
{
- /* minimize does not work when this is assigned to the
- * middle mouse button */
- if (child->tasklist->middle_click != XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW)
- wnck_window_minimize (child->window);
+ wnck_window_minimize (child->window);
}
else
{
@@ -2946,8 +2957,7 @@ xfce_tasklist_button_activate (XfceTasklistChild *child,
else if (wnck_screen_get_active_workspace (child->tasklist->screen) != workspace)
{
/* switch to the other workspace before we activate the window */
- wnck_workspace_activate (workspace, timestamp);
- gtk_main_iteration ();
+ wnck_workspace_activate (workspace, timestamp - 1);
}
}
else if (workspace != NULL
@@ -3023,15 +3033,15 @@ xfce_tasklist_button_drag_begin (GtkWidget *button,
XfceTasklistChild *child)
{
GdkPixbuf *pixbuf;
- GdkPixmap *pixmap;
+ /* GdkPixmap *pixmap; */
panel_return_if_fail (WNCK_IS_WINDOW (child->window));
+ /* not available in Gtk3 */
+#if 0
if (child->tasklist->show_labels)
{
- /* FIXME Triggers specific repaint error (bug 11283) */
- //pixmap = gtk_widget_get_snapshot (button, NULL);
- pixmap = NULL;
+ pixmap = gtk_widget_get_snapshot (button, NULL);
if (pixmap != NULL)
{
gtk_drag_set_icon_pixmap (context,
@@ -3042,6 +3052,7 @@ xfce_tasklist_button_drag_begin (GtkWidget *button,
return;
}
}
+#endif
pixbuf = wnck_window_get_icon (child->window);
if (G_LIKELY (pixbuf != NULL))
@@ -3064,17 +3075,20 @@ xfce_tasklist_button_drag_data_received (GtkWidget *button,
gulong xid;
XfceTasklistChild *child;
XfceTasklist *tasklist = XFCE_TASKLIST (child2->tasklist);
+ GtkAllocation allocation;
panel_return_if_fail (XFCE_IS_TASKLIST (tasklist));
if (tasklist->sort_order != XFCE_TASKLIST_SORT_ORDER_DND)
return;
+ gtk_widget_get_allocation (button, &allocation);
+
sibling = g_list_find (tasklist->windows, child2);
panel_return_if_fail (sibling != NULL);
- if ((!xfce_tasklist_vertical (tasklist) && x >= button->allocation.width / 2)
- || (xfce_tasklist_vertical (tasklist) && y >= button->allocation.height / 2))
+ if ((!xfce_tasklist_vertical (tasklist) && x >= allocation.width / 2)
+ || (xfce_tasklist_vertical (tasklist) && y >= allocation.height / 2))
sibling = g_list_next (sibling);
xid = *((gulong *) gtk_selection_data_get_data (selection_data));
@@ -3184,7 +3198,7 @@ xfce_tasklist_group_button_menu_minimize_all (XfceTasklistChild *group_child)
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
{
panel_return_if_fail (WNCK_IS_WINDOW (child->window));
@@ -3207,7 +3221,7 @@ xfce_tasklist_group_button_menu_unminimize_all (XfceTasklistChild *group_child)
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
{
panel_return_if_fail (WNCK_IS_WINDOW (child->window));
@@ -3230,7 +3244,7 @@ xfce_tasklist_group_button_menu_maximize_all (XfceTasklistChild *group_child)
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
{
panel_return_if_fail (WNCK_IS_WINDOW (child->window));
@@ -3253,7 +3267,7 @@ xfce_tasklist_group_button_menu_unmaximize_all (XfceTasklistChild *group_child)
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
{
panel_return_if_fail (WNCK_IS_WINDOW (child->window));
@@ -3275,7 +3289,7 @@ xfce_tasklist_group_button_menu_close_all (XfceTasklistChild *group_child)
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
{
panel_return_if_fail (WNCK_IS_WINDOW (child->window));
@@ -3304,7 +3318,7 @@ xfce_tasklist_group_button_menu (XfceTasklistChild *group_child,
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
{
mi = xfce_tasklist_button_proxy_menu_item (child, !action_menu_entries);
@@ -3458,14 +3472,14 @@ xfce_tasklist_group_button_name_changed (WnckClassGroup *class_group,
for (li = group_child->windows, n_windows = 0; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button)
+ if (gtk_widget_get_visible (child->button)
&& child->type == CHILD_TYPE_GROUP_MENU)
n_windows++;
}
/* create the button label */
name = wnck_class_group_get_name (group_child->class_group);
- if (!exo_str_is_empty (name))
+ if (!panel_str_is_empty (name))
label = g_strdup_printf ("%s (%d)", name, n_windows);
else
label = g_strdup_printf ("(%d)", n_windows);
@@ -3568,7 +3582,7 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button))
+ if (gtk_widget_get_visible (child->button))
visible_counter++;
}
@@ -3588,7 +3602,7 @@ xfce_tasklist_group_button_child_visible_changed (XfceTasklistChild *group_child
for (li = group_child->windows; li != NULL; li = li->next)
{
child = li->data;
- if (GTK_WIDGET_VISIBLE (child->button))
+ if (gtk_widget_get_visible (child->button))
child->type = type;
}
@@ -3837,10 +3851,7 @@ xfce_tasklist_set_show_labels (XfceTasklist *tasklist,
/* update the icon (we use another size for
* icon box mode) */
- if (child->type == CHILD_TYPE_GROUP)
- xfce_tasklist_group_button_icon_changed (child->class_group, child);
- else
- xfce_tasklist_button_icon_changed (child->window, child);
+ xfce_tasklist_button_icon_changed (child->window, child);
}
}
}
@@ -3922,7 +3933,7 @@ xfce_tasklist_update_orientation (XfceTasklist *tasklist)
child = li->data;
/* update task box */
- xfce_hvbox_set_orientation (XFCE_HVBOX (child->box),
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (child->box),
horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
/* update the label */
@@ -3999,8 +4010,8 @@ xfce_tasklist_update_monitor_geometry (XfceTasklist *tasklist)
{
if (tasklist->update_monitor_geometry_id == 0)
{
- tasklist->update_monitor_geometry_id = g_idle_add_full (G_PRIORITY_LOW, xfce_tasklist_update_monitor_geometry_idle,
- tasklist, xfce_tasklist_update_monitor_geometry_idle_destroy);
+ tasklist->update_monitor_geometry_id = gdk_threads_add_idle_full (G_PRIORITY_LOW, xfce_tasklist_update_monitor_geometry_idle,
+ tasklist, xfce_tasklist_update_monitor_geometry_idle_destroy);
}
}
diff --git a/plugins/tasklist/tasklist-widget.h b/plugins/tasklist/tasklist-widget.h
index d3321c8..5b4fc01 100644
--- a/plugins/tasklist/tasklist-widget.h
+++ b/plugins/tasklist/tasklist-widget.h
@@ -27,7 +27,6 @@ typedef struct _XfceTasklistClass XfceTasklistClass;
typedef struct _XfceTasklist XfceTasklist;
typedef enum _XfceTasklistGrouping XfceTasklistGrouping;
typedef enum _XfceTasklistSortOrder XfceTasklistSortOrder;
-typedef enum _XfceTasklistMClick XfceTasklistMClick;
#define XFCE_TYPE_TASKLIST (xfce_tasklist_get_type ())
#define XFCE_TASKLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TASKLIST, XfceTasklist))
@@ -62,17 +61,6 @@ enum _XfceTasklistSortOrder
XFCE_TASKLIST_SORT_ORDER_DEFAULT = XFCE_TASKLIST_SORT_ORDER_GROUP_TIMESTAMP
};
-enum _XfceTasklistMClick
-{
- XFCE_TASKLIST_MIDDLE_CLICK_NOTHING, /* do nothing */
- XFCE_TASKLIST_MIDDLE_CLICK_CLOSE_WINDOW, /* close the window */
- XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW, /* minimize, never minimize with button 1 */
-
- XFCE_TASKLIST_MIDDLE_CLICK_MIN = XFCE_TASKLIST_MIDDLE_CLICK_NOTHING,
- XFCE_TASKLIST_MIDDLE_CLICK_MAX = XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW,
- XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT = XFCE_TASKLIST_MIDDLE_CLICK_NOTHING
-};
-
GType xfce_tasklist_get_type (void) G_GNUC_CONST;
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index fdea304..c5ec1db 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -20,7 +20,6 @@
#include <config.h>
#endif
-#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <common/panel-xfconf.h>
#include <common/panel-utils.h>
@@ -30,6 +29,11 @@
#include "tasklist-widget.h"
#include "tasklist-dialog_ui.h"
+
+#define HANDLE_OFFSET (0.15)
+#define HANDLE_SIZE (4)
+
+
/* TODO move to header */
GType tasklist_plugin_get_type (void) G_GNUC_CONST;
void tasklist_plugin_register_type (XfcePanelTypeModule *type_module);
@@ -69,8 +73,8 @@ static void tasklist_plugin_nrows_changed (XfcePanelPlugin *pan
static void tasklist_plugin_screen_position_changed (XfcePanelPlugin *panel_plugin,
XfceScreenPosition position);
static void tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
-static gboolean tasklist_plugin_handle_expose_event (GtkWidget *widget,
- GdkEventExpose *event,
+static gboolean tasklist_plugin_handle_draw (GtkWidget *widget,
+ cairo_t *cr,
TasklistPlugin *plugin);
@@ -102,23 +106,26 @@ tasklist_plugin_init (TasklistPlugin *plugin)
GtkWidget *box;
/* create widgets */
- box = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (plugin), box);
- exo_binding_new (G_OBJECT (plugin), "orientation", G_OBJECT (box), "orientation");
+ g_object_bind_property (G_OBJECT (plugin), "orientation",
+ G_OBJECT (box), "orientation",
+ G_BINDING_SYNC_CREATE);
gtk_widget_show (box);
plugin->handle = gtk_alignment_new (0.00, 0.00, 0.00, 0.00);
gtk_box_pack_start (GTK_BOX (box), plugin->handle, FALSE, FALSE, 0);
- g_signal_connect (G_OBJECT (plugin->handle), "expose-event",
- G_CALLBACK (tasklist_plugin_handle_expose_event), plugin);
+ g_signal_connect (G_OBJECT (plugin->handle), "draw",
+ G_CALLBACK (tasklist_plugin_handle_draw), plugin);
gtk_widget_set_size_request (plugin->handle, 8, 8);
gtk_widget_show (plugin->handle);
plugin->tasklist = g_object_new (XFCE_TYPE_TASKLIST, NULL);
gtk_box_pack_start (GTK_BOX (box), plugin->tasklist, TRUE, TRUE, 0);
- exo_binding_new (G_OBJECT (plugin->tasklist), "show-handle",
- G_OBJECT (plugin->handle), "visible");
+ g_object_bind_property (G_OBJECT (plugin->tasklist), "show-handle",
+ G_OBJECT (plugin->handle), "visible",
+ G_BINDING_SYNC_CREATE);
}
@@ -140,19 +147,14 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
{ "show-handle", G_TYPE_BOOLEAN },
{ "sort-order", G_TYPE_UINT },
{ "window-scrolling", G_TYPE_BOOLEAN },
- { "wrap-windows", G_TYPE_BOOLEAN },
{ "include-all-blinking", G_TYPE_BOOLEAN },
- { "middle-click", G_TYPE_UINT },
+ { "middle-button-close", G_TYPE_BOOLEAN },
{ NULL }
};
/* show configure */
xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
- /* expand the plugin */
- /* xfce_panel_plugin_set_expand (panel_plugin, FALSE); */
- xfce_panel_plugin_set_shrink (panel_plugin, TRUE);
-
/* bind all properties */
panel_properties_bind (NULL, G_OBJECT (plugin->tasklist),
xfce_panel_plugin_get_property_base (panel_plugin),
@@ -234,15 +236,20 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
#define TASKLIST_DIALOG_BIND(name, property) \
object = gtk_builder_get_object (builder, (name)); \
panel_return_if_fail (G_IS_OBJECT (object)); \
- exo_mutual_binding_new (G_OBJECT (plugin->tasklist), (name), \
- G_OBJECT (object), (property));
+ g_object_bind_property (G_OBJECT (plugin->tasklist), (name), \
+ G_OBJECT (object), (property), \
+ G_BINDING_BIDIRECTIONAL \
+ | G_BINDING_SYNC_CREATE);
#define TASKLIST_DIALOG_BIND_INV(name, property) \
object = gtk_builder_get_object (builder, (name)); \
panel_return_if_fail (G_IS_OBJECT (object)); \
- exo_mutual_binding_new_with_negation (G_OBJECT (plugin->tasklist), \
- name, G_OBJECT (object), \
- property);
+ g_object_bind_property (G_OBJECT (plugin->tasklist), \
+ name, G_OBJECT (object), \
+ property, \
+ G_BINDING_BIDIRECTIONAL \
+ | G_BINDING_SYNC_CREATE \
+ | G_BINDING_INVERT_BOOLEAN);
TASKLIST_DIALOG_BIND ("show-labels", "active")
TASKLIST_DIALOG_BIND ("grouping", "active")
@@ -255,7 +262,7 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
TASKLIST_DIALOG_BIND ("show-handle", "active")
TASKLIST_DIALOG_BIND ("sort-order", "active")
TASKLIST_DIALOG_BIND ("window-scrolling", "active")
- TASKLIST_DIALOG_BIND ("middle-click", "active")
+ TASKLIST_DIALOG_BIND ("middle-button-close", "active")
#ifndef GDK_WINDOWING_X11
/* not functional in x11, so avoid confusion */
@@ -274,34 +281,40 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
static gboolean
-tasklist_plugin_handle_expose_event (GtkWidget *widget,
- GdkEventExpose *event,
- TasklistPlugin *plugin)
+tasklist_plugin_handle_draw (GtkWidget *widget,
+ cairo_t *cr,
+ TasklistPlugin *plugin)
{
- GtkOrientation orientation;
+ GtkAllocation allocation;
+ GtkStyleContext *ctx;
panel_return_val_if_fail (XFCE_IS_TASKLIST_PLUGIN (plugin), FALSE);
panel_return_val_if_fail (plugin->handle == widget, FALSE);
- if (!GTK_WIDGET_DRAWABLE (widget))
+ if (!gtk_widget_is_drawable (widget))
return FALSE;
- /* get the orientation */
+ gtk_widget_get_allocation (widget, &allocation);
+ ctx = gtk_widget_get_style_context (widget);
+
+ /* get the orientation and render the handle */
if (xfce_panel_plugin_get_orientation (XFCE_PANEL_PLUGIN (plugin)) ==
GTK_ORIENTATION_HORIZONTAL)
- orientation = GTK_ORIENTATION_VERTICAL;
+ {
+ gtk_render_handle (ctx, cr,
+ (gdouble) (allocation.width - HANDLE_SIZE) / 2.0,
+ (gdouble) allocation.height * HANDLE_OFFSET,
+ (gdouble) HANDLE_SIZE,
+ (gdouble) allocation.height * (1.0 - 2.0 * HANDLE_OFFSET));
+ }
else
- orientation = GTK_ORIENTATION_HORIZONTAL;
-
- /* paint the handle */
- gtk_paint_handle (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
- &(event->area), widget, "handlebox",
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height,
- orientation);
+ {
+ gtk_render_handle (ctx, cr,
+ (gdouble) allocation.width * HANDLE_OFFSET,
+ (gdouble) (allocation.height - HANDLE_SIZE) / 2.0,
+ (gdouble) allocation.width * (1.0 - 2.0 * HANDLE_OFFSET),
+ (gdouble) HANDLE_SIZE);
+ }
return TRUE;
}
diff --git a/plugins/windowmenu/Makefile.am b/plugins/windowmenu/Makefile.am
index 811dd9c..029da7b 100644
--- a/plugins/windowmenu/Makefile.am
+++ b/plugins/windowmenu/Makefile.am
@@ -20,7 +20,6 @@ libwindowmenu_la_SOURCES = \
libwindowmenu_la_CFLAGS = \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
@@ -37,7 +36,6 @@ libwindowmenu_la_LDFLAGS = \
libwindowmenu_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(top_builddir)/common/libpanel-common.la \
- $(EXO_LIBS) \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
@@ -83,7 +81,7 @@ DISTCLEANFILES += \
$(libwindowmenu_built_sources)
windowmenu-dialog_ui.h: windowmenu-dialog.glade
- $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=windowmenu_dialog_ui $< >$@
+ $(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=windowmenu_dialog_ui $< >$@
endif
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/plugins/windowmenu/windowmenu-dialog.glade b/plugins/windowmenu/windowmenu-dialog.glade
index fa2b146..e430b2f 100644
--- a/plugins/windowmenu/windowmenu-dialog.glade
+++ b/plugins/windowmenu/windowmenu-dialog.glade
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.14"/>
<!-- interface-requires libxfce4ui 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="XfceTitledDialog" id="dialog">
diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c
index c96123a..0ddc47c 100644
--- a/plugins/windowmenu/windowmenu.c
+++ b/plugins/windowmenu/windowmenu.c
@@ -20,7 +20,6 @@
#include <config.h>
#endif
-#include <exo/exo.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libwnck/libwnck.h>
@@ -171,35 +170,35 @@ window_menu_plugin_class_init (WindowMenuPluginClass *klass)
BUTTON_STYLE_ICON,
BUTTON_STYLE_ARROW,
BUTTON_STYLE_ICON,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_WORKSPACE_ACTIONS,
g_param_spec_boolean ("workspace-actions",
NULL, NULL,
FALSE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_WORKSPACE_NAMES,
g_param_spec_boolean ("workspace-names",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_URGENTCY_NOTIFICATION,
g_param_spec_boolean ("urgentcy-notification",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_ALL_WORKSPACES,
g_param_spec_boolean ("all-workspaces",
NULL, NULL,
TRUE,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("minimized-icon-lucency",
@@ -207,7 +206,7 @@ window_menu_plugin_class_init (WindowMenuPluginClass *klass)
"Lucent percentage of minimized icons",
0, 100,
DEFAULT_ICON_LUCENCY,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_enum ("ellipsize-mode",
@@ -215,7 +214,7 @@ window_menu_plugin_class_init (WindowMenuPluginClass *klass)
"The ellipsize mode used for the menu label",
PANGO_TYPE_ELLIPSIZE_MODE,
DEFAULT_ELLIPSIZE_MODE,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gtk_widget_class_install_style_property (gtkwidget_class,
g_param_spec_int ("max-width-chars",
@@ -223,7 +222,7 @@ window_menu_plugin_class_init (WindowMenuPluginClass *klass)
"Maximum length of window/workspace name",
1, G_MAXINT,
DEFAULT_MAX_WIDTH_CHARS,
- EXO_PARAM_READABLE));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
window_quark = g_quark_from_static_string ("window-list-window-quark");
@@ -518,6 +517,7 @@ window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size)
{
WindowMenuPlugin *plugin = XFCE_WINDOW_MENU_PLUGIN (panel_plugin);
+ gint button_size;
if (plugin->button_style == BUTTON_STYLE_ICON)
{
@@ -530,11 +530,15 @@ window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
/* set the size of the arrow button */
if (xfce_panel_plugin_get_orientation (panel_plugin) ==
GTK_ORIENTATION_HORIZONTAL)
- gtk_widget_set_size_request (GTK_WIDGET (plugin),
- ARROW_BUTTON_SIZE, -1);
+ {
+ gtk_widget_get_preferred_width (plugin->button, NULL, &button_size);
+ gtk_widget_set_size_request (GTK_WIDGET (plugin), button_size, -1);
+ }
else
- gtk_widget_set_size_request (GTK_WIDGET (plugin),
- -1, ARROW_BUTTON_SIZE);
+ {
+ gtk_widget_get_preferred_height (plugin->button, NULL, &button_size);
+ gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, button_size);
+ }
}
return TRUE;
@@ -565,8 +569,9 @@ window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
{
object = gtk_builder_get_object (builder, names[i]);
panel_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (plugin), names[i],
- G_OBJECT (object), "active");
+ g_object_bind_property (G_OBJECT (plugin), names[i],
+ G_OBJECT (object), "active",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
gtk_widget_show (GTK_WIDGET (dialog));
@@ -584,7 +589,7 @@ window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin,
panel_return_val_if_fail (value == NULL || G_IS_VALUE (value), FALSE);
if (strcmp (name, "popup") == 0
- && GTK_WIDGET_VISIBLE (panel_plugin)
+ && gtk_widget_get_visible (GTK_WIDGET (panel_plugin))
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button))
&& panel_utils_grab_available ())
{
@@ -849,11 +854,11 @@ window_menu_plugin_menu_workspace_item_new (WnckWorkspace *workspace,
/* try to get an utf-8 valid name */
name = wnck_workspace_get_name (workspace);
- if (!exo_str_is_empty (name)
+ if (!panel_str_is_empty (name)
&& !g_utf8_validate (name, -1, NULL))
name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
name = name_num = g_strdup_printf (_("Workspace %d"),
wnck_workspace_get_number (workspace) + 1);
@@ -904,7 +909,7 @@ window_menu_plugin_menu_window_item_activate (GtkWidget *mi,
panel_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);
panel_return_val_if_fail (GTK_IS_MENU_ITEM (mi), FALSE);
- panel_return_val_if_fail (GTK_IS_MENU_SHELL (mi->parent), FALSE);
+ panel_return_val_if_fail (GTK_IS_MENU_SHELL (gtk_widget_get_parent (mi)), FALSE);
/* only respond to a button releases */
if (event->type != GDK_BUTTON_RELEASE)
@@ -959,10 +964,10 @@ window_menu_plugin_menu_window_item_new (WnckWindow *window,
/* try to get an utf-8 valid name */
name = wnck_window_get_name (window);
- if (!exo_str_is_empty (name) && !g_utf8_validate (name, -1, NULL))
+ if (!panel_str_is_empty (name) && !g_utf8_validate (name, -1, NULL))
name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
- if (exo_str_is_empty (name))
+ if (panel_str_is_empty (name))
name = "?";
/* store the tooltip text */
@@ -1020,9 +1025,11 @@ window_menu_plugin_menu_window_item_new (WnckWindow *window,
if (wnck_window_is_minimized (window)
&& plugin->minimized_icon_lucency < 100)
{
+#ifdef EXO_CHECK_VERSION
lucent = exo_gdk_pixbuf_lucent (pixbuf, plugin->minimized_icon_lucency);
if (G_LIKELY (lucent != NULL))
pixbuf = lucent;
+#endif
}
/* set the menu item label */
@@ -1053,7 +1060,7 @@ window_menu_plugin_menu_selection_done (GtkWidget *menu,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
/* delay destruction so we can handle the activate event first */
- exo_gtk_object_destroy_later (GTK_OBJECT (menu));
+ panel_utils_destroy_later (GTK_WIDGET (menu));
}
@@ -1072,15 +1079,15 @@ window_menu_plugin_menu_key_press_event (GtkWidget *menu,
/* construct an event */
switch (event->keyval)
{
- case GDK_space:
- case GDK_Return:
- case GDK_KP_Space:
- case GDK_KP_Enter:
+ case GDK_KEY_space:
+ case GDK_KEY_Return:
+ case GDK_KEY_KP_Space:
+ case GDK_KEY_KP_Enter:
/* active the menu item */
fake_event.button = 1;
break;
- case GDK_Menu:
+ case GDK_KEY_Menu:
/* popup the window actions menu */
fake_event.button = 3;
break;
@@ -1314,12 +1321,12 @@ window_menu_plugin_menu_new (WindowMenuPlugin *plugin)
{
/* try to get an utf-8 valid name */
name = wnck_workspace_get_name (workspace);
- if (!exo_str_is_empty (name) && !g_utf8_validate (name, -1, NULL))
+ if (!panel_str_is_empty (name) && !g_utf8_validate (name, -1, NULL))
name = utf8 = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
}
/* create label */
- if (!exo_str_is_empty (name))
+ if (!panel_str_is_empty (name))
label = g_strdup_printf (_("Remove Workspace \"%s\""), name);
else
label = g_strdup_printf (_("Remove Workspace %d"), n_workspaces);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4f16130..d2da4e4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,7 +4,6 @@ panel-preferences.desktop.in
common/panel-utils.c
libxfce4panel/xfce-arrow-button.c
-libxfce4panel/xfce-hvbox.c
libxfce4panel/xfce-panel-convenience.c
libxfce4panel/xfce-panel-image.c
libxfce4panel/xfce-panel-plugin-provider.c
@@ -36,11 +35,11 @@ migrate/main.c
plugins/actions/actions-dialog.glade
plugins/actions/actions.c
-plugins/actions/actions.desktop.in.in
+plugins/actions/actions.desktop.in
plugins/applicationsmenu/applicationsmenu-dialog.glade
plugins/applicationsmenu/applicationsmenu.c
-plugins/applicationsmenu/applicationsmenu.desktop.in.in
+plugins/applicationsmenu/applicationsmenu.desktop.in
plugins/applicationsmenu/xfce4-popup-applicationsmenu.sh
plugins/clock/clock.c
@@ -50,29 +49,29 @@ plugins/clock/clock-dialog.glade
plugins/clock/clock-digital.c
plugins/clock/clock-fuzzy.c
plugins/clock/clock-lcd.c
-plugins/clock/clock.desktop.in.in
+plugins/clock/clock.desktop.in
plugins/directorymenu/directorymenu.c
-plugins/directorymenu/directorymenu.desktop.in.in
+plugins/directorymenu/directorymenu.desktop.in
plugins/directorymenu/directorymenu-dialog.glade
plugins/directorymenu/xfce4-popup-directorymenu.sh
plugins/launcher/launcher.c
plugins/launcher/launcher-dialog.c
plugins/launcher/launcher-dialog.glade
-plugins/launcher/launcher.desktop.in.in
+plugins/launcher/launcher.desktop.in
plugins/pager/pager.c
plugins/pager/pager-buttons.c
plugins/pager/pager-dialog.glade
-plugins/pager/pager.desktop.in.in
+plugins/pager/pager.desktop.in
plugins/separator/separator.c
plugins/separator/separator-dialog.glade
-plugins/separator/separator.desktop.in.in
+plugins/separator/separator.desktop.in
plugins/showdesktop/showdesktop.c
-plugins/showdesktop/showdesktop.desktop.in.in
+plugins/showdesktop/showdesktop.desktop.in
plugins/systray/systray.c
plugins/systray/systray-box.c
@@ -80,14 +79,14 @@ plugins/systray/systray-dialog.glade
plugins/systray/systray-manager.c
plugins/systray/systray-marshal.list
plugins/systray/systray-socket.c
-plugins/systray/systray.desktop.in.in
+plugins/systray/systray.desktop.in
plugins/tasklist/tasklist.c
plugins/tasklist/tasklist-dialog.glade
plugins/tasklist/tasklist-widget.c
-plugins/tasklist/tasklist.desktop.in.in
+plugins/tasklist/tasklist.desktop.in
plugins/windowmenu/windowmenu.c
plugins/windowmenu/windowmenu-dialog.glade
-plugins/windowmenu/windowmenu.desktop.in.in
+plugins/windowmenu/windowmenu.desktop.in
plugins/windowmenu/xfce4-popup-windowmenu.sh
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
deleted file mode 100644
index f1b13ac..0000000
--- a/po/POTFILES.skip
+++ /dev/null
@@ -1,46 +0,0 @@
-plugins/actions/actions.desktop.in
-plugins/applicationsmenu/applicationsmenu.desktop.in
-plugins/clock/clock.desktop.in
-plugins/directorymenu/directorymenu.desktop.in
-plugins/launcher/launcher.desktop.in
-plugins/pager/pager.desktop.in
-plugins/separator/separator.desktop.in
-plugins/showdesktop/showdesktop.desktop.in
-plugins/systray/systray.desktop.in
-plugins/tasklist/tasklist.desktop.in
-plugins/windowmenu/windowmenu.desktop.in
-plugins/actions/actions.desktop.in
-plugins/applicationsmenu/applicationsmenu.desktop.in
-plugins/clock/clock.desktop.in
-plugins/directorymenu/directorymenu.desktop.in
-plugins/launcher/launcher.desktop.in
-plugins/pager/pager.desktop.in
-plugins/separator/separator.desktop.in
-plugins/showdesktop/showdesktop.desktop.in
-plugins/systray/systray.desktop.in
-plugins/tasklist/tasklist.desktop.in
-plugins/windowmenu/windowmenu.desktop.in
-
-# https://bugs.launchpad.net/intltool/+bug/111794
-sub/plugins/actions/actions.desktop.in
-sub/plugins/applicationsmenu/applicationsmenu.desktop.in
-sub/plugins/clock/clock.desktop.in
-sub/plugins/directorymenu/directorymenu.desktop.in
-sub/plugins/launcher/launcher.desktop.in
-sub/plugins/pager/pager.desktop.in
-sub/plugins/separator/separator.desktop.in
-sub/plugins/showdesktop/showdesktop.desktop.in
-sub/plugins/systray/systray.desktop.in
-sub/plugins/tasklist/tasklist.desktop.in
-sub/plugins/windowmenu/windowmenu.desktop.in
-sub/plugins/actions/actions.desktop.in
-sub/plugins/applicationsmenu/applicationsmenu.desktop.in
-sub/plugins/clock/clock.desktop.in
-sub/plugins/directorymenu/directorymenu.desktop.in
-sub/plugins/launcher/launcher.desktop.in
-sub/plugins/pager/pager.desktop.in
-sub/plugins/separator/separator.desktop.in
-sub/plugins/showdesktop/showdesktop.desktop.in
-sub/plugins/systray/systray.desktop.in
-sub/plugins/tasklist/tasklist.desktop.in
-sub/plugins/windowmenu/windowmenu.desktop.in
diff --git a/wrapper/Makefile.am b/wrapper/Makefile.am
index e3a9359..fa56540 100644
--- a/wrapper/Makefile.am
+++ b/wrapper/Makefile.am
@@ -8,12 +8,12 @@ AM_CPPFLAGS = \
wrapperdir = $(HELPER_PATH_PREFIX)/xfce4/panel
wrapper_PROGRAMS = \
- wrapper-1.0
+ wrapper-2.0
wrapper_built_sources = \
wrapper-dbus-client-infos.h
-wrapper_1_0_SOURCES = \
+wrapper_2_0_SOURCES = \
$(wrapper_built_sources) \
main.c \
wrapper-module.c \
@@ -21,35 +21,35 @@ wrapper_1_0_SOURCES = \
wrapper-plug.c \
wrapper-plug.h
-wrapper_1_0_CFLAGS = \
+wrapper_2_0_CFLAGS = \
$(GTK_CFLAGS) \
$(DBUS_CFLAGS) \
$(GMODULE_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(PLATFORM_CFLAGS)
-wrapper_1_0_LDFLAGS = \
+wrapper_2_0_LDFLAGS = \
-no-undefined \
$(PLATFORM_LDFLAGS)
-wrapper_1_0_LDADD = \
+wrapper_2_0_LDADD = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(GTK_LIBS) \
$(DBUS_LIBS) \
$(GMODULE_LIBS) \
$(LIBXFCE4UTIL_LIBS)
-wrapper_1_0_DEPENDENCIES = \
+wrapper_2_0_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la
#
-# Gtk+ 3 support library
+# Gtk+ 2 support library
#
-if ENABLE_GTK3_LIBRARY
+if ENABLE_GTK2_LIBRARY
-wrapper_PROGRAMS += wrapper-2.0
+wrapper_PROGRAMS += wrapper-1.0
-wrapper_2_0_SOURCES = \
+wrapper_1_0_SOURCES = \
$(wrapper_built_sources) \
main.c \
wrapper-module.c \
@@ -57,26 +57,26 @@ wrapper_2_0_SOURCES = \
wrapper-plug.c \
wrapper-plug.h
-wrapper_2_0_CFLAGS = \
- $(GTK3_CFLAGS) \
+wrapper_1_0_CFLAGS = \
+ $(GTK2_CFLAGS) \
$(DBUS_CFLAGS) \
$(GMODULE_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(PLATFORM_CFLAGS)
-wrapper_2_0_LDFLAGS = \
+wrapper_1_0_LDFLAGS = \
-no-undefined \
$(PLATFORM_LDFLAGS)
-wrapper_2_0_LDADD = \
- $(top_builddir)/libxfce4panel/libxfce4panel-2.0.la \
- $(GTK3_LIBS) \
+wrapper_1_0_LDADD = \
+ $(top_builddir)/libxfce4panel/libxfce4panel-1.0.la \
+ $(GTK2_LIBS) \
$(DBUS_LIBS) \
$(GMODULE_LIBS) \
$(LIBXFCE4UTIL_LIBS)
-wrapper_2_0_DEPENDENCIES = \
- $(top_builddir)/libxfce4panel/libxfce4panel-2.0.la
+wrapper_1_0_DEPENDENCIES = \
+ $(top_builddir)/libxfce4panel/libxfce4panel-1.0.la
endif
diff --git a/wrapper/wrapper-plug.c b/wrapper/wrapper-plug.c
index e3c3d61..3baed0c 100644
--- a/wrapper/wrapper-plug.c
+++ b/wrapper/wrapper-plug.c
@@ -94,8 +94,6 @@ wrapper_plug_init (WrapperPlug *plug)
GdkVisual *visual = NULL;
GdkScreen *screen;
GtkStyleContext *context;
- GtkCssProvider *provider = gtk_css_provider_new();
- gchar *css_string;
#else
GdkColormap *colormap = NULL;
GdkScreen *screen;
@@ -111,15 +109,6 @@ wrapper_plug_init (WrapperPlug *plug)
/* allow painting, else compositing won't work */
gtk_widget_set_app_paintable (GTK_WIDGET (plug), TRUE);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* old versions of gtk don't support transparent tray icons, if we
- * set an argb colormap on the tray, the icons won't be embedded because
- * the socket-plugin implementation requires identical colormaps */
- if (gtk_check_version (2, 16, 0) != NULL
- && strcmp (wrapper_name, "systray") == 0)
- return;
-#endif
-
/* set the colormap */
screen = gtk_window_get_screen (GTK_WINDOW (plug));
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -137,17 +126,6 @@ wrapper_plug_init (WrapperPlug *plug)
context = gtk_widget_get_style_context (GTK_WIDGET (plug));
gtk_style_context_add_class (context, "panel");
gtk_style_context_add_class (context, "xfce4-panel");
-
- /* We need to set the plugin button to transparent and let everything else
- * be in the theme or panel's color */
- css_string = g_strdup_printf (".xfce4-panel .button { background-color: transparent; }");
- gtk_css_provider_load_from_data (provider, css_string, -1, NULL);
- gtk_style_context_add_provider (context,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- g_free (css_string);
- g_object_unref (provider);
#endif
}
@@ -176,73 +154,71 @@ wrapper_plug_draw (GtkWidget *widget,
GdkPixbuf *pixbuf;
GError *error = NULL;
- cairo_save (cr);
-
- /* The "draw" signal is in widget coordinates, transform back to window */
- gtk_cairo_transform_to_window (cr,
- GTK_WIDGET (plug),
- gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (plug))));
-
- if (G_UNLIKELY (plug->background_image != NULL))
+ if (gtk_widget_is_drawable (widget))
{
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-
- if (G_LIKELY (plug->background_image_cache != NULL))
- {
- cairo_set_source (cr, plug->background_image_cache);
- cairo_paint (cr);
- }
- else
+ if (G_UNLIKELY (plug->background_image != NULL))
{
- /* load the image in a pixbuf */
- pixbuf = gdk_pixbuf_new_from_file (plug->background_image, &error);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- if (G_LIKELY (pixbuf != NULL))
+ if (G_LIKELY (plug->background_image_cache != NULL))
{
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- g_object_unref (G_OBJECT (pixbuf));
-
- plug->background_image_cache = cairo_get_source (cr);
- cairo_pattern_reference (plug->background_image_cache);
- cairo_pattern_set_extend (plug->background_image_cache, CAIRO_EXTEND_REPEAT);
+ cairo_set_source (cr, plug->background_image_cache);
cairo_paint (cr);
}
else
{
- /* print error message */
- g_warning ("Background image disabled, \"%s\" could not be loaded: %s",
- plug->background_image, error != NULL ? error->message : "No error");
- g_error_free (error);
+ /* load the image in a pixbuf */
+ pixbuf = gdk_pixbuf_new_from_file (plug->background_image, &error);
- /* disable background image */
- wrapper_plug_background_reset (plug);
- }
- }
- }
- else
- {
- alpha = gtk_widget_is_composited (GTK_WIDGET (plug)) ? plug->background_alpha : 1.00;
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ if (G_LIKELY (pixbuf != NULL))
+ {
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+ g_object_unref (G_OBJECT (pixbuf));
- /* get the background gdk color */
- if (plug->background_color != NULL)
- {
- color = plug->background_color;
- cairo_set_source_rgba (cr, PANEL_GDKCOLOR_TO_DOUBLE (color), alpha);
+ plug->background_image_cache = cairo_get_source (cr);
+ cairo_pattern_reference (plug->background_image_cache);
+ cairo_pattern_set_extend (plug->background_image_cache, CAIRO_EXTEND_REPEAT);
+ cairo_paint (cr);
+ }
+ else
+ {
+ /* print error message */
+ g_warning ("Background image disabled, \"%s\" could not be loaded: %s",
+ plug->background_image, error != NULL ? error->message : "No error");
+ g_error_free (error);
+
+ /* disable background image */
+ wrapper_plug_background_reset (plug);
+ }
+ }
}
else
{
- style = gtk_widget_get_style_context (widget);
- gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &rgba);
- rgba.alpha = alpha;
- gdk_cairo_set_source_rgba (cr, &rgba);
- }
+ alpha = gtk_widget_is_composited (GTK_WIDGET (plug)) ? plug->background_alpha : 1.00;
- /* draw the background color */
- cairo_paint (cr);
- }
+ if (alpha < 1.00 || plug->background_color != NULL)
+ {
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_restore(cr);
+ /* get the background gdk color */
+ if (plug->background_color != NULL)
+ {
+ color = plug->background_color;
+ cairo_set_source_rgba (cr, PANEL_GDKCOLOR_TO_DOUBLE (color), alpha);
+ }
+ else
+ {
+ style = gtk_widget_get_style_context (widget);
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &rgba);
+ rgba.alpha = alpha;
+ gdk_cairo_set_source_rgba (cr, &rgba);
+ }
+
+ /* draw the background color */
+ cairo_fill (cr);
+ }
+ }
+ }
return GTK_WIDGET_CLASS (wrapper_plug_parent_class)->draw (widget, cr);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list