Browse Source

Initial import.

upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
commit
170fd5924b
  1. 0
      AUTHORS
  2. 0
      COPYING
  3. 0
      ChangeLog
  4. 29
      Makefile.am
  5. 0
      NEWS
  6. 0
      README
  7. 26
      STATUS
  8. 49
      autogen.sh
  9. 240
      configure.in.in
  10. 10
      docs/README.libxfce4panel
  11. 52
      libxfce4panel/Makefile.am
  12. 188
      libxfce4panel/libxfce4panel.h
  13. 306
      libxfce4panel/xfce-arrow-button.c
  14. 70
      libxfce4panel/xfce-arrow-button.h
  15. 177
      libxfce4panel/xfce-hvbox.c
  16. 70
      libxfce4panel/xfce-hvbox.h
  17. 103
      libxfce4panel/xfce-panel-convenience.c
  18. 38
      libxfce4panel/xfce-panel-convenience.h
  19. 174
      libxfce4panel/xfce-panel-enums.h
  20. 91
      libxfce4panel/xfce-panel-macros.h
  21. 184
      libxfce4panel/xfce-panel-plugin-provider.c
  22. 98
      libxfce4panel/xfce-panel-plugin-provider.h
  23. 1208
      libxfce4panel/xfce-panel-plugin.c
  24. 138
      libxfce4panel/xfce-panel-plugin.h
  25. 90
      panel/Makefile.am
  26. 183
      panel/main.c
  27. 1084
      panel/panel-application.c
  28. 70
      panel/panel-application.h
  29. 77
      panel/panel-dbus-infos.xml
  30. 259
      panel/panel-dbus.c
  31. 52
      panel/panel-dbus.h
  32. 64
      panel/panel-dialogs.c
  33. 30
      panel/panel-dialogs.h
  34. 315
      panel/panel-glue.c
  35. 42
      panel/panel-glue.h
  36. 705
      panel/panel-item-dialog.c
  37. 42
      panel/panel-item-dialog.h
  38. 1039
      panel/panel-itembar.c
  39. 80
      panel/panel-itembar.h
  40. 371
      panel/panel-module-factory.c
  41. 58
      panel/panel-module-factory.h
  42. 467
      panel/panel-module.c
  43. 72
      panel/panel-module.h
  44. 480
      panel/panel-plugin-external.c
  45. 44
      panel/panel-plugin-external.h
  46. 826
      panel/panel-preferences-dialog.c
  47. 43
      panel/panel-preferences-dialog.h
  48. 103
      panel/panel-private.c
  49. 44
      panel/panel-private.h
  50. 1969
      panel/panel-window.c
  51. 131
      panel/panel-window.h
  52. 8
      plugins/Makefile.am
  53. 89
      plugins/clock/.svn/all-wcprops
  54. 10
      plugins/clock/.svn/dir-prop-base
  55. 210
      plugins/clock/.svn/entries
  56. 1
      plugins/clock/.svn/format
  57. 5
      plugins/clock/.svn/prop-base/Makefile.am.svn-base
  58. 5
      plugins/clock/.svn/prop-base/clock-analog.c.svn-base
  59. 5
      plugins/clock/.svn/prop-base/clock-analog.h.svn-base
  60. 5
      plugins/clock/.svn/prop-base/clock-binary.c.svn-base
  61. 5
      plugins/clock/.svn/prop-base/clock-binary.h.svn-base
  62. 5
      plugins/clock/.svn/prop-base/clock-dialog.c.svn-base
  63. 5
      plugins/clock/.svn/prop-base/clock-dialog.h.svn-base
  64. 5
      plugins/clock/.svn/prop-base/clock-digital.c.svn-base
  65. 5
      plugins/clock/.svn/prop-base/clock-digital.h.svn-base
  66. 5
      plugins/clock/.svn/prop-base/clock-lcd.c.svn-base
  67. 5
      plugins/clock/.svn/prop-base/clock-lcd.h.svn-base
  68. 9
      plugins/clock/.svn/prop-base/clock.c.svn-base
  69. 5
      plugins/clock/.svn/prop-base/clock.desktop.in.in.svn-base
  70. 5
      plugins/clock/.svn/prop-base/clock.h.svn-base
  71. 81
      plugins/clock/.svn/text-base/Makefile.am.svn-base
  72. 377
      plugins/clock/.svn/text-base/clock-analog.c.svn-base
  73. 43
      plugins/clock/.svn/text-base/clock-analog.h.svn-base
  74. 395
      plugins/clock/.svn/text-base/clock-binary.c.svn-base
  75. 43
      plugins/clock/.svn/text-base/clock-binary.h.svn-base
  76. 563
      plugins/clock/.svn/text-base/clock-dialog.c.svn-base
  77. 31
      plugins/clock/.svn/text-base/clock-dialog.h.svn-base
  78. 226
      plugins/clock/.svn/text-base/clock-digital.c.svn-base
  79. 43
      plugins/clock/.svn/text-base/clock-digital.h.svn-base
  80. 551
      plugins/clock/.svn/text-base/clock-lcd.c.svn-base
  81. 43
      plugins/clock/.svn/text-base/clock-lcd.h.svn-base
  82. 667
      plugins/clock/.svn/text-base/clock.c.svn-base
  83. 8
      plugins/clock/.svn/text-base/clock.desktop.in.in.svn-base
  84. 105
      plugins/clock/.svn/text-base/clock.h.svn-base
  85. 81
      plugins/clock/Makefile.am
  86. 347
      plugins/clock/clock-analog.c
  87. 45
      plugins/clock/clock-analog.h
  88. 364
      plugins/clock/clock-binary.c
  89. 45
      plugins/clock/clock-binary.h
  90. 591
      plugins/clock/clock-dialog.c
  91. 31
      plugins/clock/clock-dialog.h
  92. 213
      plugins/clock/clock-digital.c
  93. 45
      plugins/clock/clock-digital.h
  94. 526
      plugins/clock/clock-lcd.c
  95. 45
      plugins/clock/clock-lcd.h
  96. 741
      plugins/clock/clock.c
  97. 9
      plugins/clock/clock.desktop.in.in
  98. 124
      plugins/clock/clock.h
  99. 53
      plugins/launcher/.svn/all-wcprops
  100. 10
      plugins/launcher/.svn/dir-prop-base

0
AUTHORS

0
COPYING

0
ChangeLog

29
Makefile.am

@ -0,0 +1,29 @@
# $Id$
SUBDIRS = \
libxfce4panel \
panel \
wrapper \
plugins
distclean-local:
rm -rf *.spec *.cache *~
rpm: dist
rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz
@rm -f $(PACKAGE)-$(VERSION).tar.gz
EXTRA_DIST = \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update
DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

0
NEWS

0
README

26
STATUS

@ -0,0 +1,26 @@
Status Xfce Panel
=================
New features
------------
- Plugins can run both internal and external without recompiling.
External plugins now run inside a wrapper program. As a result
a lot of code has been removed from libxfce4panel.
Bugs Fixed
----------
692 : Corner offset of panels. Panels can now be moved and
locked in any position.
1933 : Panel Grows and shrinks from the center. You can
also snap a panel on an screen edge.
2203 : Arbitrarily resizable panels.
2465 : Normal Width also applies to height. This feature has
been removed.
2471 : Hidden panel doesn't grow. The hidden window is now
also properly allocated when the window is hidden.
2955 : Then opening the properties or add items dialog it
appears on the correct screen.
3748 : Panel desn't pick up changes made with XRandr. The
monitor configuration is no longer stored and recalculated
when the screen size or monitor number changes (GTK+ 2.14).

49
autogen.sh

@ -0,0 +1,49 @@
#!/bin/sh
#
# $Id: autogen.sh 25025 2007-02-24 09:54:07Z jasper $
#
# Copyright (c) 2002-2005
# The Xfce development team. All rights reserved.
#
# Written for Xfce by Benedikt Meurer <benny@xfce.org>.
#
(type xdt-autogen) >/dev/null 2>&1 || {
cat >&2 <<EOF
autogen.sh: You don't seem to have the Xfce development tools installed on
your system, which are required to build this software.
Please install the xfce4-dev-tools package first, it is available
from http://www.xfce.org/.
EOF
exit 1
}
# verify that po/LINGUAS is present
(test -f po/LINGUAS) >/dev/null 2>&1 || {
cat >&2 <<EOF
autogen.sh: The file po/LINGUAS could not be found. Please check your snapshot
or try to checkout again.
EOF
exit 1
}
# substitute revision and linguas
linguas=`sed -e '/^#/d' po/LINGUAS`
if test -d .git/svn; then
revision=`LC_ALL=C git-svn find-rev HEAD`
else
revision=`LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n",
$2}'`
fi
sed -e "s/@LINGUAS@/${linguas}/g" \
-e "s/@REVISION@/${revision}/g" \
< "configure.in.in" > "configure.in"
xdt-autogen $@
# xdt-autogen clean does not remove all generated files
(test x"clean" = x"$1") && {
rm -f configure.in
rm -f INSTALL
} || true
# vi:set ts=2 sw=2 et ai:

240
configure.in.in

@ -0,0 +1,240 @@
dnl $Id: configure.in.in 26568 2008-01-14 01:09:43Z jannis $
dnl
dnl Copyright (c) 2004 - 2008 The Xfce development team
dnl
dnl 2005-2007 Jasper Huijsmans <jasper@xfce.org>
dnl 2006-2008 Nick Schermer <nick@xfce.org>
dnl
dnl ***************************
dnl *** Version information ***
dnl ***************************
m4_define([libxfce4panel_verinfo], [3:0:1])
m4_define([xfce4_panel_version_major], [4])
m4_define([xfce4_panel_version_minor], [5])
m4_define([xfce4_panel_version_micro], [1])
m4_define([xfce4_panel_version_nano], [0]) dnl leave this empty to have no nano version
m4_define([xfce4_panel_version_build], [r@REVISION@])
m4_define([xfce4_panel_version_tag], [svn])
m4_define([xfce4_panel_version], [xfce4_panel_version_major().xfce4_panel_version_minor().xfce4_panel_version_micro()ifelse(xfce4_panel_version_nano(), [], [], [.xfce4_panel_version_nano()])ifelse(xfce4_panel_version_tag(), [svn], [xfce4_panel_version_tag()-xfce4_panel_version_build()], [xfce4_panel_version_tag()])])
dnl *******************************************
dnl *** Debugging support for SVN snapshots ***
dnl *******************************************
m4_define([panel_debug_default], [ifelse(xfce4_panel_version_tag(), [svn], [yes], [minimum])])
dnl ***************************
dnl *** Initialize autoconf ***
dnl ***************************
AC_COPYRIGHT([Copyright (c) 2002 - 2008
The Xfce development team. All rights reserved.
Written for Xfce by Jasper Huijsmans <jasper@xfce.org>
and Nick Schermer <nick@xfce.org>.])
AC_INIT([xfce4-panel], [xfce4_panel_version], [http://bugzilla.xfce.org/], [xfce4-panel])
AC_PREREQ([2.50])
AC_REVISION([$Id$])
dnl ***************************
dnl *** Initialize automake ***
dnl ***************************
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
AM_MAINTAINER_MODE()
dnl *******************************
dnl *** Check for UNIX variants ***
dnl *******************************
AC_AIX()
AC_ISC_POSIX()
AC_MINIX()
AM_CONDITIONAL([HAVE_CYGWIN], [test "`uname | grep \"CYGWIN\"`" != ""])
dnl ********************************
dnl *** Check for basic programs ***
dnl ********************************
AC_PROG_CC()
AC_PROG_LD()
AC_PROG_INSTALL()
AC_PROG_INTLTOOL()
AC_CHECK_PROGS([PERL], [perl5 perl])
dnl **************************
dnl *** Initialize libtool ***
dnl **************************
AC_DISABLE_STATIC()
AC_PROG_LIBTOOL()
dnl ****************************
dnl *** Intltool-update hack ***
dnl ****************************
AC_CONFIG_COMMANDS([intltool-update],
[(sed -e 's/^\("desktop.*".*\)/\1\n"rc(?:\\\\.in)+|"\./' intltool-update > intltool-update-tmp &&
mv intltool-update-tmp intltool-update && chmod 755 intltool-update)])
dnl **************************************
dnl *** Substitute version information ***
dnl **************************************
LIBXFCE4PANEL_VERINFO=libxfce4panel_verinfo()
AC_SUBST([LIBXFCE4PANEL_VERINFO])
dnl **********************************
dnl *** Check for standard headers ***
dnl **********************************
AC_HEADER_STDC()
AC_CHECK_HEADERS([stdlib.h unistd.h locale.h stdio.h errno.h time.h string.h \
math.h sys/types.h sys/wait.h memory.h])
dnl ******************************
dnl *** Check for i18n support ***
dnl ******************************
XDT_I18N([@LINGUAS@])
dnl *******************************
dnl *** Check for X11 installed ***
dnl *******************************
XDT_CHECK_LIBX11_REQUIRE()
XDT_CHECK_LIBSM()
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.4.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.12.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.5.0])
XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.1.11])
XDT_CHECK_PACKAGE([DBUS], [dbus-glib-1], [0.34])
XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.0.0])
dnl ***********************************
dnl *** Check for optional packages ***
dnl ***********************************
XDT_CHECK_OPTIONAL_PACKAGE([LIBSTARTUP_NOTIFICATION],
[libstartup-notification-1.0],
[0.5], [startup-notification],
[startup notification library], [yes])
dnl *************************
dnl *** Check for gtk-doc ***
dnl *************************
GTK_DOC_CHECK([1.0])
dnl *************************************
dnl *** Disable deprecated components ***
dnl *************************************
AC_DEFINE([XFCE_DISABLE_DEPRECATED], [1], [Define to 1 to disable deprecated Xfce components])
AC_DEFINE([G_DISABLE_DEPRECATED], [1], [Define to 1 to disable deprecated Glib components])
dnl ***********************************
dnl *** Check for debugging support ***
dnl ***********************************
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=panel_debug_default@:>@]),
[], [enable_debug=panel_debug_default])
AC_MSG_CHECKING([whether to enable debugging support])
if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
dnl Print the result
AC_MSG_RESULT([$enable_debug])
dnl Make sure we detect possible errors (if supported)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_MSG_CHECKING([whether $CC accepts -Wall -Werror])
AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
AC_MSG_RESULT([yes])
PLATFORM_CFLAGS="$PLATFORM_CFLAGS -Wall -Werror"
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
dnl Paranoia for --enable-debug=full
if test x"$enable_debug" = x"full"; then
dnl Enable extensive debugging
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_ENABLE_DEBUG"
dnl Use -O0 -g3 if the compiler supports it
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -O0 -g3"
AC_MSG_CHECKING([whether $CC accepts -O0 -g3])
AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
AC_MSG_RESULT([yes])
PLATFORM_CFLAGS="$PLATFORM_CFLAGS -O0 -g3"
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
fi
else
dnl Print the result
AC_MSG_RESULT([$enable_debug])
dnl Disable debugging (release build)
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DNDEBUG"
dnl Disable object cast checks
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_CAST_CHECKS"
dnl Disable all checks for --enable-debug=no
if test x"$enable_debug" = x"no"; then
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
fi
fi
dnl ****************************************
dnl *** Check for ELF visibility support ***
dnl ****************************************
AC_ARG_ENABLE([visibility], AC_HELP_STRING([--disable-visibility], [Don't use ELF visibility attributes]), [], [enable_visibility=yes])
have_gnuc_visibility=no
if test x"$enable_visibility" != x"no"; then
dnl Check whether the compiler supports the visibility attribute
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute])
AC_COMPILE_IFELSE(AC_LANG_SOURCE(
[
void __attribute__ ((visibility("default"))) test_default (void) {}
void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
int main (int argc, char **argv) { test_default (); test_hidden (); return 0; }
]),
[
have_gnuc_visibility=yes
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
fi
if test x"$have_gnuc_visibility" = x"yes"; then
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DHAVE_GNUC_VISIBILITY"
fi
AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test x"$have_gnuc_visibility" = x"yes"])
dnl *********************************
dnl *** Substitute platform flags ***
dnl *********************************
AC_MSG_CHECKING([PLATFORM_CPPFLAGS])
AC_MSG_RESULT([$PLATFORM_CPPFLAGS])
AC_SUBST([PLATFORM_CPPFLAGS])
AC_MSG_CHECKING([PLATFORM_CFLAGS])
AC_MSG_RESULT([$PLATFORM_CFLAGS])
AC_SUBST([PLATFORM_CFLAGS])
AC_MSG_CHECKING([PLATFORM_LDFLAGS])
AC_MSG_RESULT([$PLATFORM_LDFLAGS])
AC_SUBST([PLATFORM_LDFLAGS])
AC_OUTPUT([
Makefile
libxfce4panel/Makefile
panel/Makefile
wrapper/Makefile
plugins/Makefile
plugins/clock/Makefile
plugins/launcher/Makefile
plugins/systray/Makefile
po/Makefile.in
])

10
docs/README.libxfce4panel

@ -0,0 +1,10 @@
The Xfce Panel plugin library
=============================
XfcePanelPlugin
---------------
XfcePanelPluginProvider
-----------------------

52
libxfce4panel/Makefile.am

@ -0,0 +1,52 @@
# $Id$
INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libxfce4panel\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
-DLIBXFCE4PANEL_COMPILATION \
$(PLATFORM_CPPFLAGS)
lib_LTLIBRARIES = \
libxfce4panel.la
libxfce4panel_headers = \
libxfce4panel.h \
xfce-arrow-button.h \
xfce-hvbox.h \
xfce-panel-convenience.h \
xfce-panel-macros.h \
xfce-panel-plugin.h
libxfce4panel_includedir = \
$(includedir)/xfce4/libxfce4panel
libxfce4panel_include_HEADERS = \
$(libxfce4panel_headers)
libxfce4panel_la_SOURCES = \
$(libxfce4panel_headers) \
xfce-arrow-button.c \
xfce-hvbox.c \
xfce-panel-convenience.c \
xfce-panel-plugin.c \
xfce-panel-plugin-provider.c \
xfce-panel-plugin-provider.h
libxfce4panel_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(PLATFORM_CFLAGS)
libxfce4panel_la_LDFLAGS = \
-no-undefined \
-export-dynamic \
-export-symbols-regex "^[^_].*" \
-version-info $(LIBXFCE4PANEL_VERINFO) \
$(PLATFORM_LDFLAGS)
libxfce4panel_la_LIBADD = \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS)
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

188
libxfce4panel/libxfce4panel.h

@ -0,0 +1,188 @@
/* $Id$ */
/*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifndef __LIBXFCE4PANEL__
#define __LIBXFCE4PANEL__
G_BEGIN_DECLS
/* typedef for registering types, could be useful if we want
* a real XfcePanelModule object in the feature */
typedef GTypeModule XfcePanelModule;
#define LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H
#include <libxfce4panel/xfce-arrow-button.h>
#include <libxfce4panel/xfce-hvbox.h>
#include <libxfce4panel/xfce-panel-convenience.h>
#include <libxfce4panel/xfce-panel-enums.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-panel-macros.h>
#undef LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H
#define XFCE_PANEL_DEFINE_TYPE(TN, t_n, T_P) XFCE_PANEL_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
#define XFCE_PANEL_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) XFCE_PANEL_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, _C_)
#define XFCE_PANEL_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P) XFCE_PANEL_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})
#define XFCE_PANEL_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) XFCE_PANEL_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, _C_)
#define XFCE_PANEL_DEFINE_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE) \
static gpointer type_name##_parent_class = NULL; \
static GType type_name##_type = G_TYPE_INVALID; \
static void type_name##_init (TypeName *self); \
static void type_name##_class_init (TypeName##Class *klass); \
static void type_name##_class_intern_init (TypeName##Class *klass) \
{ \
type_name##_parent_class = g_type_class_peek_parent (klass); \
type_name##_class_init (klass); \
} \
\
GType \
type_name##_get_type (void) \
{ \
return type_name##_type; \
} \
\
void \
type_name##_register_type (XfcePanelModule *xfce_panel_module) \
{ \
GType xfce_panel_define_type_id; \
static const GTypeInfo xfce_panel_define_type_info = \
{ \
sizeof (TypeName##Class), \
NULL, \
NULL, \
(GClassInitFunc) type_name##_class_intern_init, \
NULL, \
NULL, \
sizeof (TypeName), \
0, \
(GInstanceInitFunc) type_name##_init, \
NULL, \
}; \
xfce_panel_define_type_id = g_type_module_register_type (G_TYPE_MODULE (xfce_panel_module), TYPE_PARENT, \
#TypeName, &xfce_panel_define_type_info, flags); \
{ CODE ; } \
type_name##_type = xfce_panel_define_type_id; \
}
#define XFCE_PANEL_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) \
{ \
static const GInterfaceInfo xfce_panel_implement_interface_info = \
{ \
(GInterfaceInitFunc) iface_init \
}; \
g_type_module_add_interface (G_TYPE_MODULE (xfce_panel_module), xfce_panel_define_type_id, \
TYPE_IFACE, &xfce_panel_implement_interface_info); \
}
#define XFCE_PANEL_PLUGIN_REGISTER_OBJECT(type) \
XFCE_PANEL_PLUGIN_REGISTER_OBJECT_EXTENDED (type, {})
#define XFCE_PANEL_PLUGIN_REGISTER_OBJECT_WITH_CHECK(type, check_func) \
XFCE_PANEL_PLUGIN_REGISTER_OBJECT_EXTENDED (type, {})
#define XFCE_PANEL_PLUGIN_REGISTER_OBJECT_EXTENDED(type, CODE) \
const gchar *plugin_init_name = NULL; \
const gchar *plugin_init_id = NULL; \
const gchar *plugin_init_display_name = NULL; \
\
G_MODULE_EXPORT XfcePanelPlugin * \
xfce_panel_plugin_construct (const gchar *name, \
const gchar *id, \
const gchar *display_name, \
GdkScreen *screen) \
{ \
XfcePanelPlugin *plugin; \
extern const gchar *plugin_init_name; \
extern const gchar *plugin_init_id; \
extern const gchar *plugin_init_display_name; \
\
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); \
panel_return_val_if_fail (name != NULL && id != NULL, NULL); \
panel_return_val_if_fail (g_type_is_a (type, XFCE_TYPE_PANEL_PLUGIN), NULL); \
\
/* set the temporarily names for the init function */ \
plugin_init_name = name; \
plugin_init_id = id; \
plugin_init_display_name = display_name; \
\
CODE \
\
plugin = g_object_new (type, \
"name", name, \
"display-name", display_name, \
"id", id, NULL); \
\
return plugin; \
}
#define XFCE_PANEL_PLUGIN_REGISTER(init_func) \
XFCE_PANEL_PLUGIN_REGISTER_EXTENDED (init_func, {})
#define XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK(construct_func, check_func) \
XFCE_PANEL_PLUGIN_REGISTER_EXTENDED (construct_func, if (G_LIKELY ((*check_func) (screen) == TRUE)))
#define XFCE_PANEL_PLUGIN_REGISTER_EXTENDED(construct_func, CODE) \
static void \
xfce_panel_plugin_realize (XfcePanelPlugin *plugin) \
{ \
panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); \
\
/* disconnect the realize signal */ \
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), G_CALLBACK (xfce_panel_plugin_realize), NULL); \
\
/* run the plugin construct function */ \
(*construct_func) (plugin); \
} \
\
G_MODULE_EXPORT XfcePanelPlugin * \
xfce_panel_plugin_construct (const gchar *name, \
const gchar *id, \
const gchar *display_name, \
GdkScreen *screen) \
{ \
XfcePanelPlugin *plugin = NULL; \
\
panel_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); \
panel_return_val_if_fail (name != NULL && id != NULL, NULL); \
\
CODE \
{ \
/* create new internal plugin */ \
plugin = g_object_new (XFCE_TYPE_PANEL_PLUGIN, \
"name", name, \
"display-name", display_name, \
"id", id, NULL); \
\
/* signal to realize the plugin */ \
g_signal_connect_after (G_OBJECT (plugin), "realize", G_CALLBACK (xfce_panel_plugin_realize), NULL); \
} \
\
/* return the plugin */ \
return plugin; \
}
G_END_DECLS
#endif /* !__LIBXFCE4PANEL__ */

306
libxfce4panel/xfce-arrow-button.c

@ -0,0 +1,306 @@
/* $Id$ */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <gtk/gtk.h>
#include <libxfce4panel/xfce-panel-macros.h>
#include <libxfce4panel/xfce-arrow-button.h>
#define ARROW_WIDTH (8)
#define ARROW_PADDING (2)
enum
{
ARROW_TYPE_CHANGED,
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_ARROW_TYPE
};
static void xfce_arrow_button_class_init (XfceArrowButtonClass *klass);
static void xfce_arrow_button_init (XfceArrowButton *button);
static void xfce_arrow_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void xfce_arrow_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static gboolean xfce_arrow_button_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void xfce_arrow_button_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void xfce_arrow_button_add (GtkContainer *container,
GtkWidget *child);
static GType xfce_arrow_button_child_type (GtkContainer *container);
static guint arrow_button_signals[LAST_SIGNAL];
G_DEFINE_TYPE (XfceArrowButton, xfce_arrow_button, GTK_TYPE_TOGGLE_BUTTON)
static void
xfce_arrow_button_class_init (XfceArrowButtonClass * klass)
{
GObjectClass *gobject_class;
GtkWidgetClass *gtkwidget_class;
GtkContainerClass *gtkcontainer_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = xfce_arrow_button_get_property;
gobject_class->set_property = xfce_arrow_button_set_property;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->expose_event = xfce_arrow_button_expose_event;
gtkwidget_class->size_request = xfce_arrow_button_size_request;
gtkcontainer_class = GTK_CONTAINER_CLASS (klass);
gtkcontainer_class->add = xfce_arrow_button_add;
gtkcontainer_class->child_type = xfce_arrow_button_child_type;
/**
* XfceArrowButton::arrow-type-changed
* @button: the object which emitted the signal
* @type: the new #GtkArrowType of the button
*
* Emitted when the arrow direction of the menu button changes.
* This value also determines the direction of the popup menu.
**/
arrow_button_signals[ARROW_TYPE_CHANGED] =
g_signal_new (I_("arrow-type-changed"),
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (XfceArrowButtonClass, arrow_type_changed),
NULL, NULL,
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1, GTK_TYPE_ARROW_TYPE);
/**
* XfceArrowButton:arrow-type
*
* The arrow type of the button. This value also determines the direction
* of the popup menu.
**/
g_object_class_install_property (gobject_class,
PROP_ARROW_TYPE,
g_param_spec_enum ("arrow-type",
"Arrow type",
"The arrow type of the menu button",
GTK_TYPE_ARROW_TYPE,
GTK_ARROW_UP,
G_PARAM_READWRITE | PANEL_PARAM_STATIC_STRINGS));
}
static void
xfce_arrow_button_init (XfceArrowButton *button)
{
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (button), GTK_NO_WINDOW);
button->arrow_type = GTK_ARROW_UP;
}
static void
xfce_arrow_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
XfceArrowButton *button = XFCE_ARROW_BUTTON (object);
switch (prop_id)
{
case PROP_ARROW_TYPE:
xfce_arrow_button_set_arrow_type (button, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xfce_arrow_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
XfceArrowButton *button = XFCE_ARROW_BUTTON (object);
switch (prop_id)
{
case PROP_ARROW_TYPE:
g_value_set_enum (value, xfce_arrow_button_get_arrow_type (button));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
xfce_arrow_button_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
gint x, y, w;
if (G_LIKELY (GTK_WIDGET_DRAWABLE (widget)))
{
w = MIN (widget->allocation.height - 2 * widget->style->ythickness,
widget->allocation.width - 2 * widget->style->xthickness);
w = MIN (w, ARROW_WIDTH);
x = widget->allocation.x + (widget->allocation.width - w) / 2;
y = widget->allocation.y + (widget->allocation.height - w) / 2;
(*GTK_WIDGET_CLASS (xfce_arrow_button_parent_class)->expose_event) (widget, event);
gtk_paint_arrow (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
&(event->area), widget, "xfce_arrow_button",
XFCE_ARROW_BUTTON (widget)->arrow_type, FALSE,
x, y, w, w);
}
return TRUE;
}
static void
xfce_arrow_button_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
gint size;
/* calculate the requested arrow size */
size = ARROW_WIDTH + ARROW_PADDING + 2 * MAX (widget->style->xthickness, widget->style->ythickness);
requisition->width = requisition->height = size;
}
static void
xfce_arrow_button_add (GtkContainer *container,
GtkWidget *child)
{
g_warning ("XfceArrowButton cannot contain any children");
}
static GType
xfce_arrow_button_child_type (GtkContainer *container)
{
return GTK_TYPE_NONE;
}
/**
* xfce_arrow_button_new:
* @type : #GtkArrowType for the arrow button
*
* Creates a new #XfceArrowButton widget.
*
* Returns: The newly created #XfceArrowButton widget.
**/
GtkWidget *
xfce_arrow_button_new (GtkArrowType arrow_type)
{
return g_object_new (XFCE_TYPE_ARROW_BUTTON, "arrow-type", arrow_type, NULL);
}
/**
* xfce_arrow_button_set_arrow_type:
* @button : a #XfceArrowButton
* @type : a valid #GtkArrowType
*
* Sets the arrow type for @button.
**/
void
xfce_arrow_button_set_arrow_type (XfceArrowButton *button,
GtkArrowType arrow_type)
{
g_return_if_fail (XFCE_IS_ARROW_BUTTON (button));
if (G_LIKELY (button->arrow_type != arrow_type))
{
/* store the new arrow type */
button->arrow_type = arrow_type;
/* emit signal */
g_signal_emit (G_OBJECT (button), arrow_button_signals[ARROW_TYPE_CHANGED], 0, arrow_type);
/* notify property change */
g_object_notify (G_OBJECT (button), "arrow-type");
/* redraw the arrow button */
gtk_widget_queue_draw (GTK_WIDGET (button));
}
}
/**
* xfce_arrow_button_get_arrow_type:
* @button : a #XfceArrowButton
*
* Returns the value of the ::arrow-type property.
*
* Returns: the #GtkArrowType of @button.
**/
GtkArrowType
xfce_arrow_button_get_arrow_type (XfceArrowButton *button)
{
g_return_val_if_fail (XFCE_IS_ARROW_BUTTON (button), GTK_ARROW_UP);
return button->arrow_type;
}

70
libxfce4panel/xfce-arrow-button.h

@ -0,0 +1,70 @@
/* $Id$ */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
#error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
#endif
#ifndef __XFCE_ARROW_BUTTON_H__
#define __XFCE_ARROW_BUTTON_H__
#include <gtk/gtkenums.h>
#include <gtk/gtktogglebutton.h>
G_BEGIN_DECLS
typedef struct _XfceArrowButtonClass XfceArrowButtonClass;
typedef struct _XfceArrowButton XfceArrowButton;
#define XFCE_TYPE_ARROW_BUTTON (xfce_arrow_button_get_type ())
#define XFCE_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButton))
#define XFCE_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass))
#define XFCE_IS_ARROW_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_ARROW_BUTTON))
#define XFCE_IS_ARROW_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_ARROW_BUTTON))
#define XFCE_ARROW_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonClass))
struct _XfceArrowButtonClass
{
/*< private >*/
GtkToggleButtonClass __parent__;
/*< signals >*/
void (*arrow_type_changed) (XfceArrowButton *button,
GtkArrowType type);
};
struct _XfceArrowButton
{
/*< private >*/
GtkToggleButton __parent__;
GtkArrowType arrow_type;
};
GType xfce_arrow_button_get_type (void) G_GNUC_CONST;
GtkWidget *xfce_arrow_button_new (GtkArrowType arrow_type) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
void xfce_arrow_button_set_arrow_type (XfceArrowButton *button,
GtkArrowType arrow_type);
GtkArrowType xfce_arrow_button_get_arrow_type (XfceArrowButton *button);
G_END_DECLS
#endif /* !__XFCE_ARROW_BUTTON_H__ */

177
libxfce4panel/xfce-hvbox.c

@ -0,0 +1,177 @@
/* $Id$ */
/*
* OBox Copyright (c) 2002 Red Hat Inc. based on GtkHBox
* Copyright (c) 2006 Jani Monoses <jani@ubuntu.com>
* Copyright (c) 2006-2007 Jasper Huijsmans <jasper@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <libxfce4panel/xfce-panel-macros.h>
#include <libxfce4panel/xfce-hvbox.h>
static void xfce_hvbox_class_init (XfceHVBoxClass *klass);
static void xfce_hvbox_init (XfceHVBox *hvbox);
static GtkWidgetClass *xfce_hvbox_get_class (XfceHVBox *hvbox);
static void xfce_hvbox_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void xfce_hvbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
G_DEFINE_TYPE (XfceHVBox, xfce_hvbox, GTK_TYPE_BOX)
static void
xfce_hvbox_class_init (XfceHVBoxClass *klass)
{
GtkWidgetClass *gtkwidget_class;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->size_request = xfce_hvbox_size_request;
gtkwidget_class->size_allocate = xfce_hvbox_size_allocate;
}
static void
xfce_hvbox_init (XfceHVBox *hvbox)
{
/* initialize variables */
hvbox->orientation = GTK_ORIENTATION_HORIZONTAL;
}
static GtkWidgetClass *
xfce_hvbox_get_class (XfceHVBox *hvbox)
{
GType type;
if (hvbox->orientation == GTK_ORIENTATION_HORIZONTAL)
type = GTK_TYPE_HBOX;
else
type = GTK_TYPE_VBOX;
/* return the widget class of the type */
return GTK_WIDGET_CLASS (gtk_type_class (type));
}
static void
xfce_hvbox_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkWidgetClass *klass;
/* get the widget class */
klass = xfce_hvbox_get_class (XFCE_HVBOX (widget));
(*klass->size_request) (widget, requisition);
}
static void
xfce_hvbox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkWidgetClass *klass;
/* get the widget class */
klass = xfce_hvbox_get_class (XFCE_HVBOX (widget));
(*klass->size_allocate) (widget, allocation);
}
/**
* xfce_hvbox_new:
* @orientation : Orientation of the #XfceHVBox
* @homogeneous : whether all children should be allocated the same size
* @spacing : spacing between #XfceHVBox children
*
* Creates a new #XfceHVBox container widget.
*
* Return value: the newly allocated #XfceHVBox container widget.
**/
GtkWidget *
xfce_hvbox_new (GtkOrientation orientation,
gboolean homogeneous,
gint spacing)
{
XfceHVBox *box;
/* create new object */
box = g_object_new (XFCE_TYPE_HVBOX, "homogeneous", homogeneous, "spacing", spacing, NULL);
/* store the orientation */
box->orientation = orientation;
return GTK_WIDGET (box);
}
/**
* xfce_hvbox_set_orientation:
* @hvbox : #XfceHVBox
* @orientation : the new orientation of the #XfceHVBox
*
* Set the new orientation of the #XfceHVBox container widget.
**/
void
xfce_hvbox_set_orientation (XfceHVBox *hvbox,
GtkOrientation orientation)
{
g_return_if_fail (XFCE_IS_HVBOX (hvbox));
if (G_LIKELY (hvbox->orientation != orientation))
{
/* store new orientation */
hvbox->orientation = orientation;
/* queue a resize */
gtk_widget_queue_resize (GTK_WIDGET (hvbox));
}
}
/**
* xfce_hvbox_get_orientation:
* @hvbox : #XfceHVBox
*
* Returns the current orientation of the #XfceHVBox.
**/
GtkOrientation
xfce_hvbox_get_orientation (XfceHVBox *hvbox)
{
g_return_val_if_fail (XFCE_IS_HVBOX (hvbox), GTK_ORIENTATION_HORIZONTAL);
return hvbox->orientation;
}

70
libxfce4panel/xfce-hvbox.h

@ -0,0 +1,70 @@
/* $Id$ */
/*
* OBox Copyright (c) 2002 Red Hat Inc. based on GtkHBox
* Copyright (c) 2006 Jani Monoses <jani@ubuntu.com>
* Copyright (c) 2006-2007 Jasper Huijsmans <jasper@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
#error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
#endif
#ifndef __XFCE_HVBOX_H__
#define __XFCE_HVBOX_H__
#include <gtk/gtkbox.h>
G_BEGIN_DECLS
typedef struct _XfceHVBoxClass XfceHVBoxClass;
typedef struct _XfceHVBox XfceHVBox;
#define XFCE_TYPE_HVBOX (xfce_hvbox_get_type())
#define XFCE_HVBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, XFCE_TYPE_HVBOX, XfceHVBox))
#define XFCE_HVBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, XFCE_TYPE_HVBOX, XfceHVBoxClass))
#define XFCE_IS_HVBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, XFCE_TYPE_HVBOX))
#define XFCE_IS_HVBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_HVBOX))
#define XFCE_HVBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_HVBOX, XfceHVBoxClass))
struct _XfceHVBoxClass
{
/*< private >*/
GtkBoxClass __parent__;
};
struct _XfceHVBox
{
/*< private >*/
GtkBox __parent__;
GtkOrientation orientation;
};
GType xfce_hvbox_get_type (void) G_GNUC_CONST;
GtkWidget *xfce_hvbox_new (GtkOrientation orientation,
gboolean homogeneous,
gint spacing) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
void xfce_hvbox_set_orientation (XfceHVBox *hvbox,
GtkOrientation orientation);
GtkOrientation xfce_hvbox_get_orientation (XfceHVBox *hvbox);
G_END_DECLS
#endif /* !__XFCE_HVBOX_H__ */

103
libxfce4panel/xfce-panel-convenience.c

@ -0,0 +1,103 @@
/* $Id */
/*
* Copyright (c) 2006-2007 Jasper Huijsmans <jasper@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libxfce4util/libxfce4util.h>
#include <gtk/gtk.h>
#include <libxfce4panel/xfce-panel-convenience.h>
/**
* xfce_create_panel_button:
*
* Create regular #GtkButton with a few properties set to be useful in the
* Xfce panel: Flat (%GTK_RELIEF_NONE), no focus on click and minimal padding.
*
* Returns: newly created #GtkButton.
**/
GtkWidget *
xfce_create_panel_button (void)
{
GtkWidget *button = gtk_button_new ();
GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
gtk_widget_set_name (button, "xfce_panel_button");
return button;
}
/**
* xfce_create_panel_toggle_button:
*
* Create regular #GtkToggleButton with a few properties set to be useful in
* Xfce panel: Flat (%GTK_RELIEF_NONE), no focus on click and minimal padding.
*
* Returns: newly created #GtkToggleButton.
**/
GtkWidget *
xfce_create_panel_toggle_button (void)
{
GtkWidget *button = gtk_toggle_button_new ();
GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
gtk_widget_set_name (button, "xfce_panel_toggle_button");
return button;
}
/**
* xfce_allow_panel_customization:
*
* Check if the user is allowed to customize the panel. Uses the kiosk mode
* implementation from libxfce4util.
*
* Returns: %TRUE if the user is allowed to customize the panel, %FALSE
* otherwise.
**/
gboolean
xfce_allow_panel_customization (void )
{
static gboolean allow_customization = FALSE;
static gboolean checked = FALSE;
XfceKiosk *kiosk;
if (G_UNLIKELY (!checked))
{
kiosk = xfce_kiosk_new ("xfce4-panel");
allow_customization = xfce_kiosk_query (kiosk, "CustomizePanel");
xfce_kiosk_free (kiosk);
checked = TRUE;
}
return allow_customization;
}

38
libxfce4panel/xfce-panel-convenience.h

@ -0,0 +1,38 @@
/* $Id$ */
/*
* Copyright (c) 2006-2007 Jasper Huijsmans <jasper@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
#error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
#endif
#ifndef __XFCE_PANEL_CONVENIENCE_H__
#define __XFCE_PANEL_CONVENIENCE_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
GtkWidget *xfce_create_panel_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
GtkWidget *xfce_create_panel_toggle_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
gboolean xfce_allow_panel_customization (void);
G_END_DECLS
#endif /* !__XFCE_PANEL_CONVENIENCE_H__ */

174
libxfce4panel/xfce-panel-enums.h

@ -0,0 +1,174 @@
/* $Id: xfce-panel-enums.h 25905 2007-07-09 19:51:58Z nick $
*
* Copyright (c) 2005-2007 Jasper Huijsmans <jasper@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
#error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
#endif
#ifndef __XFCE_PANEL_ENUMS_H__
#define __XFCE_PANEL_ENUMS_H__
G_BEGIN_DECLS
/**
* XfceScreenPosition
* @XFCE_SCREEN_POSITION_NONE : No position has been set.
* @XFCE_SCREEN_POSITION_NW_H : North West Horizontal
* @XFCE_SCREEN_POSITION_N : North
* @XFCE_SCREEN_POSITION_NE_H : North East Horizontal
* @XFCE_SCREEN_POSITION_NW_V : North West Vertical
* @XFCE_SCREEN_POSITION_W : West
* @XFCE_SCREEN_POSITION_SW_V : South West Vertical
* @XFCE_SCREEN_POSITION_NE_V : North East Vertical
* @XFCE_SCREEN_POSITION_E : East
* @XFCE_SCREEN_POSITION_SE_V : South East Vertical
* @XFCE_SCREEN_POSITION_SW_H : South West Horizontal
* @XFCE_SCREEN_POSITION_S : South
* @XFCE_SCREEN_POSITION_SE_H : South East Horizontal
* @XFCE_SCREEN_POSITION_FLOATING_H : Floating Horizontal
* @XFCE_SCREEN_POSITION_FLOATING_V : Floating Vertical
*
* There are three screen positions for each side of the screen:
* LEFT/TOP, CENTER and RIGHT/BOTTOM. The XfceScreenPosition is expressed
* as navigational direction, with possible addition of H or V to denote
* horizontal and vertical orientation. Additionally there are two floating
* positions, horizontal and vertical.
**/
typedef enum /*<enum,prefix=XFCE_SCREEN_POSITION >*/
{
XFCE_SCREEN_POSITION_NONE,
/* top */
XFCE_SCREEN_POSITION_NW_H, /* North West Horizontal */
XFCE_SCREEN_POSITION_N, /* North */
XFCE_SCREEN_POSITION_NE_H, /* North East Horizontal */
/* left */
XFCE_SCREEN_POSITION_NW_V, /* North West Vertical */
XFCE_SCREEN_POSITION_W, /* West */
XFCE_SCREEN_POSITION_SW_V, /* South West Vertical */
/* right */
XFCE_SCREEN_POSITION_NE_V, /* North East Vertical */
XFCE_SCREEN_POSITION_E, /* East */
XFCE_SCREEN_POSITION_SE_V, /* South East Vertical */
/* bottom */
XFCE_SCREEN_POSITION_SW_H, /* South West Horizontal */
XFCE_SCREEN_POSITION_S, /* South */
XFCE_SCREEN_POSITION_SE_H, /* South East Horizontal */
/* floating */
XFCE_SCREEN_POSITION_FLOATING_H, /* Floating Horizontal */
XFCE_SCREEN_POSITION_FLOATING_V /* Floating Vertical */
}
XfceScreenPosition;
/**
* xfce_screen_position_is_horizontal:
* @position : the #XfceScreenPosition
*
* Whether the current #XfceScreenPosition is horizontal.
*
* Returns: %TRUE if horizontal, %FALSE otherwise
**/
#define xfce_screen_position_is_horizontal(position) \
(position <= XFCE_SCREEN_POSITION_NE_H || \
(position >= XFCE_SCREEN_POSITION_SW_H && \
position <= XFCE_SCREEN_POSITION_FLOATING_H))
/**
* xfce_screen_position_get_orientation:
* @position : the #XfceScreenPosition
*
* Converts the current #XfceScreenPosition into a #GtkOrientation.
*
* Returns: the #GtkOrientation corresponding to @position.
**/
#define xfce_screen_position_get_orientation(position) \
(xfce_screen_position_is_horizontal (position) ? \
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL)
/**
* xfce_screen_position_is_floating:
* @position : the #XfceScreenPosition
*
* Whether the current #XfceScreenPosition is floating on the screen.
*
* Returns: %TRUE if floating, %FALSE otherwise.
**/
#define xfce_screen_position_is_floating(position) \
(position >= XFCE_SCREEN_POSITION_FLOATING_H || \
position == XFCE_SCREEN_POSITION_NONE)
/**
* xfce_screen_position_is_top:
* @position : the #XfceScreenPosition
*
* Whether the current #XfceScreenPosition is above of the center of
* the screen.
*
* Returns: %TRUE if on the top of the screen, %FALSE otherwise
**/
#define xfce_screen_position_is_top(position) \
(position >= XFCE_SCREEN_POSITION_NW_H && \
position <= XFCE_SCREEN_POSITION_NE_H)
/**
* xfce_screen_position_is_left:
* @position : the #XfceScreenPosition
*
* Whether the current #XfceScreenPosition is left of the center of
* the screen.
*
* Returns: %TRUE if on the left of the screen, %FALSE otherwise
**/
#define xfce_screen_position_is_left(position) \
(position >= XFCE_SCREEN_POSITION_NW_V && \
position <= XFCE_SCREEN_POSITION_SW_V)
/**
* xfce_screen_position_is_right:
* @position : the #XfceScreenPosition
*
* Whether the current #XfceScreenPosition is right of the center of
* the screen.
*
* Returns: %TRUE if on the right of the screen, %FALSE otherwise
**/
#define xfce_screen_position_is_right(position) \
(position >= XFCE_SCREEN_POSITION_NE_V && \
position <= XFCE_SCREEN_POSITION_SE_V)
/**
* xfce_screen_position_is_bottom:
* @position : the #XfceScreenPosition
*
* Whether the current #XfceScreenPosition is below of the center of
* the screen.
*
* Returns: %TRUE if on the bottom of the screen, %FALSE otherwise
**/
#define xfce_screen_position_is_bottom(position) \
(position >= XFCE_SCREEN_POSITION_SW_H && \
position <= XFCE_SCREEN_POSITION_SE_H)
G_END_DECLS
#endif /* !__XFCE_PANEL_ENUMS_H__ */

91
libxfce4panel/xfce-panel-macros.h

@ -0,0 +1,91 @@
/* $Id$ */
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
#error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
#endif
#ifndef __XFCE_PANEL_MACROS_H__
#define __XFCE_PANEL_MACROS_H__
#include <glib.h>
G_BEGIN_DECLS
/* support macros for debugging */
#ifndef NDEBUG
#define panel_assert(expr) g_assert (expr)
#define panel_assert_not_reached() g_assert_not_reached ()
#define panel_return_if_fail(expr) g_return_if_fail (expr)
#define panel_return_val_if_fail(expr, val) g_return_val_if_fail (expr, (val))
#else
#define panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
#define panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
#define panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
#define panel_return_val_if_fail(expr, val) G_STMT_START{ (void)0; }G_STMT_END
#endif
/* canonical representation for static strings */
#define I_(string) (g_intern_static_string ((string)))
/* static parameter strings */
#if GLIB_CHECK_VERSION (2,13,0)
#define PANEL_PARAM_STATIC_STRINGS (G_PARAM_STATIC_STRINGS)
#else
#define PANEL_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
#endif
/* gdk atoms */
#if GTK_CHECK_VERSION (2,10,0)
#define panel_atom_intern(string) gdk_atom_intern_static_string ((string))
#else
#define panel_atom_intern(string) gdk_atom_intern ((string), FALSE)
#endif
/* make api compatible with 4.4 panel */
#ifndef XFCE_DISABLE_DEPRECATED
/* register definitions */
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL XFCE_PANEL_PLUGIN_REGISTER
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL XFCE_PANEL_PLUGIN_REGISTER