[Xfce4-commits] <xfce4-panel:devel> * Rename the convenience functions to start with xfce_panel_* Add #defines in macos.h inside the deprecate block for backwards compatibility. * Add xfce_panel_cairo_set_source_rgba() as convenience function since it's used in the wrapper and panel and might be usefull for plugin rendering. * Add libxfce4util in libxfce4panel-1.0.pc.in because we link to it for the kiosk settings.

Nick Schermer nick at xfce.org
Tue Aug 11 20:22:24 CEST 2009


Updating branch refs/heads/devel
         to cb6d0fa9776a4c91fd9e035816f9e457a802ab71 (commit)
       from faf2e3020d6958b40405d5196bf67f77b6aa4d6b (commit)

commit cb6d0fa9776a4c91fd9e035816f9e457a802ab71
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Jun 21 11:15:11 2008 +0200

    * Rename the convenience functions to start with xfce_panel_*
      Add #defines in macos.h inside the deprecate block for backwards
      compatibility.
    * Add xfce_panel_cairo_set_source_rgba() as convenience function since
      it's used in the wrapper and panel and might be usefull for plugin
      rendering.
    * Add libxfce4util in libxfce4panel-1.0.pc.in because we link to it for
      the kiosk settings.

 libxfce4panel/libxfce4panel-1.0.pc.in  |    2 +-
 libxfce4panel/xfce-panel-convenience.c |   42 +++++++++++++++++++++++++++----
 libxfce4panel/xfce-panel-convenience.h |   12 +++++++--
 libxfce4panel/xfce-panel-macros.h      |   13 ++++++++-
 4 files changed, 57 insertions(+), 12 deletions(-)

diff --git a/libxfce4panel/libxfce4panel-1.0.pc.in b/libxfce4panel/libxfce4panel-1.0.pc.in
index 92940c8..aaa2bde 100644
--- a/libxfce4panel/libxfce4panel-1.0.pc.in
+++ b/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/
diff --git a/libxfce4panel/xfce-panel-convenience.c b/libxfce4panel/xfce-panel-convenience.c
index c10a2d3..ff7d336 100644
--- a/libxfce4panel/xfce-panel-convenience.c
+++ b/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);
+    }
+}
diff --git a/libxfce4panel/xfce-panel-convenience.h b/libxfce4panel/xfce-panel-convenience.h
index 8a9440b..2714797 100644
--- a/libxfce4panel/xfce-panel-convenience.h
+++ b/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
 
diff --git a/libxfce4panel/xfce-panel-macros.h b/libxfce4panel/xfce-panel-macros.h
index 5d28807..981c009 100644
--- a/libxfce4panel/xfce-panel-macros.h
+++ b/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



More information about the Xfce4-commits mailing list