Browse Source

Rename convenience functions to start with xfce_panel_.

Add macros for the old names and add libxfce4util to our .pc
file to avoid problem with plugins and we link to it in the
library anyways.
upstream/xfce4-panel-4.10.1
Nick Schermer 12 years ago
parent
commit
ac33bff39e
  1. 2
      libxfce4panel/libxfce4panel-1.0.pc.in
  2. 42
      libxfce4panel/xfce-panel-convenience.c
  3. 12
      libxfce4panel/xfce-panel-convenience.h
  4. 13
      libxfce4panel/xfce-panel-macros.h

2
libxfce4panel/libxfce4panel-1.0.pc.in

@ -8,7 +8,7 @@ localedir=@localedir@
Name: libxfce4panel
Description: Library for the Xfce Panel
Requires: gtk+-2.0 gmodule-2.0 glib-2.0
Requires: gtk+-2.0 gmodule-2.0 glib-2.0 libxfce4util-1.0
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lxfce4panel
Cflags: -I${includedir}/xfce4/

42
libxfce4panel/xfce-panel-convenience.c

@ -28,7 +28,7 @@
#include <libxfce4panel/xfce-panel-convenience.h>
/**
* xfce_create_panel_button:
* xfce_panel_create_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.
@ -36,7 +36,7 @@
* Returns: newly created #GtkButton.
**/
GtkWidget *
xfce_create_panel_button (void)
xfce_panel_create_button (void)
{
GtkWidget *button = gtk_button_new ();
@ -52,7 +52,7 @@ xfce_create_panel_button (void)
/**
* xfce_create_panel_toggle_button:
* xfce_panel_create_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.
@ -60,7 +60,7 @@ xfce_create_panel_button (void)
* Returns: newly created #GtkToggleButton.
**/
GtkWidget *
xfce_create_panel_toggle_button (void)
xfce_panel_create_toggle_button (void)
{
GtkWidget *button = gtk_toggle_button_new ();
@ -76,7 +76,7 @@ xfce_create_panel_toggle_button (void)
/**
* xfce_allow_panel_customization:
* xfce_panel_allow_customization:
*
* Check if the user is allowed to customize the panel. Uses the kiosk mode
* implementation from libxfce4util.
@ -85,7 +85,7 @@ xfce_create_panel_toggle_button (void)
* otherwise.
**/
gboolean
xfce_allow_panel_customization (void )
xfce_panel_allow_customization (void )
{
static gboolean allow_customization = FALSE;
static gboolean checked = FALSE;
@ -101,3 +101,33 @@ xfce_allow_panel_customization (void )
return allow_customization;
}
void
xfce_panel_cairo_set_source_rgba (cairo_t *cr,
GdkColor *color,
gdouble alpha)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (color != NULL);
g_return_if_fail (alpha >= 0.00 && alpha <= 1.00);
if (alpha >= 1.00)
{
/* set normal source color */
cairo_set_source_rgb (cr,
color->red / 65535.00,
color->green / 65535.00,
color->blue / 65535.00);
}
else
{
/* set source color with alpha */
cairo_set_source_rgba (cr,
color->red / 65535.00,
color->green / 65535.00,
color->blue / 65535.00,
alpha);
}
}

12
libxfce4panel/xfce-panel-convenience.h

@ -29,9 +29,15 @@
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);
GtkWidget *xfce_panel_create_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
GtkWidget *xfce_panel_create_toggle_button (void) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
gboolean xfce_panel_allow_customization (void);
void xfce_panel_cairo_set_source_rgba (cairo_t *cr,
GdkColor *color,
gdouble alpha);
G_END_DECLS

13
libxfce4panel/xfce-panel-macros.h

@ -56,16 +56,25 @@ G_BEGIN_DECLS
#define panel_atom_intern(string) gdk_atom_intern ((string), FALSE)
#endif
/* cairo context source color */
#define panel_cairo_set_source_rgba (cr, color, alpha) \
if (
/* make api compatible with 4.4 panel */
#ifndef XFCE_DISABLE_DEPRECATED
/* register definitions */
/* convenience functions (deprecated) */
#define xfce_create_panel_button() xfce_panel_create_button()
#define xfce_create_panel_toggle_button() xfce_panel_create_toggle_button()
#define xfce_allow_panel_customization() xfce_panel_allow_customization()
/* register definitions (deprecated) */
#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
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
/* parameter flags */
/* parameter flags (deprecated) */
#define PANEL_PARAM_READABLE G_PARAM_READABLE | PANEL_PARAM_STATIC_STRINGS
#define PANEL_PARAM_READWRITE G_PARAM_READWRITE | PANEL_PARAM_STATIC_STRINGS
#define PANEL_PARAM_WRITABLE G_PARAM_WRITABLE | PANEL_PARAM_STATIC_STRINGS

Loading…
Cancel
Save