[nautilus: 17/18] eel: remove unused code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus: 17/18] eel: remove unused code
- Date: Mon, 6 Dec 2010 14:58:25 +0000 (UTC)
commit b5302ebfc104aec7cc480931ede752efe9cc4325
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Dec 6 15:56:01 2010 +0100
eel: remove unused code
eel/eel-gdk-extensions.c | 221 +-----------------------------------
eel/eel-gdk-extensions.h | 46 +--------
eel/eel-gtk-extensions.c | 2 +-
eel/eel-lib-self-check-functions.h | 1 -
4 files changed, 3 insertions(+), 267 deletions(-)
---
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 958ada5..44a5ba1 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -28,116 +28,15 @@
#include "eel-gdk-extensions.h"
#include "eel-glib-extensions.h"
-#include "eel-lib-self-check-functions.h"
#include "eel-string.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk/gdkprivate.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <stdlib.h>
#include <pango/pango.h>
/**
- * eel_gdk_color_parse_with_white_default
- * @color_spec: A color spec, or NULL.
- * @color: Pointer to place to put resulting color.
- *
- * The same as gdk_color_parse, except sets the color to white if
- * the spec. can't be parsed, instead of returning a boolean flag.
- */
-void
-eel_gdk_color_parse_with_white_default (const char *color_spec,
- GdkColor *color)
-{
- gboolean got_color;
-
- g_return_if_fail (color != NULL);
-
- got_color = FALSE;
- if (color_spec != NULL) {
- if (gdk_color_parse (color_spec, color)) {
- got_color = TRUE;
- }
- }
-
- if (!got_color) {
- color->red = 0xFFFF;
- color->green = 0xFFFF;
- color->blue = 0xFFFF;
- }
-}
-
-guint32
-eel_rgb16_to_rgb (gushort r, gushort g, gushort b)
-{
- guint32 result;
-
- result = (0xff0000 | (r & 0xff00));
- result <<= 8;
- result |= ((g & 0xff00) | (b >> 8));
-
- return result;
-}
-
-guint32
-eel_rgb8_to_rgb (guchar r, guchar g, guchar b)
-{
- return eel_rgb16_to_rgb (r << 8, g << 8, b << 8);
-}
-
-/**
- * eel_gdk_color_to_rgb
- * @color: A GdkColor style color.
- * Returns: An rgb value.
- *
- * Converts from a GdkColor stlye color to a gdk_rgb one.
- * Alpha gets set to fully opaque
- */
-guint32
-eel_gdk_color_to_rgb (const GdkColor *color)
-{
- return eel_rgb16_to_rgb (color->red, color->green, color->blue);
-}
-
-/**
- * eel_gdk_rgb_to_color
- * @color: a gdk_rgb style value.
- *
- * Converts from a gdk_rgb value style to a GdkColor one.
- * The gdk_rgb color alpha channel is ignored.
- *
- * Return value: A GdkColor structure version of the given RGB color.
- */
-GdkColor
-eel_gdk_rgb_to_color (guint32 color)
-{
- GdkColor result;
-
- result.red = ((color >> 16) & 0xFF) * 0x101;
- result.green = ((color >> 8) & 0xFF) * 0x101;
- result.blue = (color & 0xff) * 0x101;
- result.pixel = 0;
-
- return result;
-}
-
-/**
- * eel_gdk_rgb_to_color_spec
- * @color: a gdk_rgb style value.
- *
- * Converts from a gdk_rgb value style to a string color spec.
- * The gdk_rgb color alpha channel is ignored.
- *
- * Return value: a newly allocated color spec.
- */
-char *
-eel_gdk_rgb_to_color_spec (const guint32 color)
-{
- return g_strdup_printf ("#%06X", (guint) (color & 0xFFFFFF));
-}
-
-/**
- * eel_gdk_color_is_dark:
+ * eel_gdk_rgba_is_dark:
*
* Return true if the given color is `dark'
*/
@@ -242,121 +141,3 @@ eel_make_color_inactive (GdkRGBA *color)
color->green = CLAMP_COLOR (color->green);
color->blue = CLAMP_COLOR (color->blue);
}
-
-#if ! defined (EEL_OMIT_SELF_CHECK)
-
-static char *
-eel_gdk_color_as_hex_string (GdkColor color)
-{
- return g_strdup_printf ("%04X%04X%04X",
- color.red, color.green, color.blue);
-}
-
-static char *
-eel_self_check_parse (const char *color_spec)
-{
- GdkColor color;
-
- eel_gdk_color_parse_with_white_default (color_spec, &color);
- return eel_gdk_color_as_hex_string (color);
-}
-
-static char *
-eel_self_check_gdk_rgb_to_color (guint32 color)
-{
- GdkColor result;
-
- result = eel_gdk_rgb_to_color (color);
-
- return eel_gdk_color_as_hex_string (result);
-}
-
-void
-eel_self_check_gdk_extensions (void)
-{
- /* eel_gdk_color_parse_with_white_default */
- EEL_CHECK_STRING_RESULT (eel_self_check_parse (""), "FFFFFFFFFFFF");
- EEL_CHECK_STRING_RESULT (eel_self_check_parse ("a"), "FFFFFFFFFFFF");
- EEL_CHECK_STRING_RESULT (eel_self_check_parse ("white"), "FFFFFFFFFFFF");
- EEL_CHECK_STRING_RESULT (eel_self_check_parse ("black"), "000000000000");
- EEL_CHECK_STRING_RESULT (eel_self_check_parse ("red"), "FFFF00000000");
- EEL_CHECK_STRING_RESULT (eel_self_check_parse ("#012345"), "010123234545");
- /* EEL_CHECK_STRING_RESULT (eel_self_check_parse ("rgb:0123/4567/89AB"), "#014589"); */
-
- /* eel_gdk_rgb_to_color */
- EEL_CHECK_STRING_RESULT (eel_self_check_gdk_rgb_to_color (EEL_RGB_COLOR_RED), "FFFF00000000");
- EEL_CHECK_STRING_RESULT (eel_self_check_gdk_rgb_to_color (EEL_RGB_COLOR_BLACK), "000000000000");
- EEL_CHECK_STRING_RESULT (eel_self_check_gdk_rgb_to_color (EEL_RGB_COLOR_WHITE), "FFFFFFFFFFFF");
- EEL_CHECK_STRING_RESULT (eel_self_check_gdk_rgb_to_color (EEL_RGB_COLOR_PACK (0x01, 0x23, 0x45)), "010123234545");
-
- /* EEL_RGBA_COLOR_PACK */
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0xFF, 0x00, 0x00, 00), EEL_RGB_COLOR_RED);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0x00, 0xFF, 0x00, 00), EEL_RGB_COLOR_GREEN);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0x00, 0x00, 0xFF, 00), EEL_RGB_COLOR_BLUE);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0xFF, 0xFF, 0xFF, 00), EEL_RGB_COLOR_WHITE);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0x00, 0x00, 0x00, 00), EEL_RGB_COLOR_BLACK);
-
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0xFF, 0x00, 0x00, 0xFF), EEL_RGBA_COLOR_OPAQUE_RED);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0x00, 0xFF, 0x00, 0xFF), EEL_RGBA_COLOR_OPAQUE_GREEN);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0x00, 0x00, 0xFF, 0xFF), EEL_RGBA_COLOR_OPAQUE_BLUE);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0xFF, 0xFF, 0xFF, 0xFF), EEL_RGBA_COLOR_OPAQUE_WHITE);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_PACK (0x00, 0x00, 0x00, 0xFF), EEL_RGBA_COLOR_OPAQUE_BLACK);
-
- /* EEL_RGB_COLOR_PACK */
- EEL_CHECK_INTEGER_RESULT (EEL_RGB_COLOR_PACK (0xFF, 0x00, 0x00), EEL_RGBA_COLOR_OPAQUE_RED);
- EEL_CHECK_INTEGER_RESULT (EEL_RGB_COLOR_PACK (0x00, 0xFF, 0x00), EEL_RGBA_COLOR_OPAQUE_GREEN);
- EEL_CHECK_INTEGER_RESULT (EEL_RGB_COLOR_PACK (0x00, 0x00, 0xFF), EEL_RGBA_COLOR_OPAQUE_BLUE);
- EEL_CHECK_INTEGER_RESULT (EEL_RGB_COLOR_PACK (0xFF, 0xFF, 0xFF), EEL_RGBA_COLOR_OPAQUE_WHITE);
- EEL_CHECK_INTEGER_RESULT (EEL_RGB_COLOR_PACK (0x00, 0x00, 0x00), EEL_RGBA_COLOR_OPAQUE_BLACK);
-
- /* EEL_RGBA_COLOR_GET_R */
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGBA_COLOR_OPAQUE_RED), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGBA_COLOR_OPAQUE_GREEN), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGBA_COLOR_OPAQUE_BLUE), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGBA_COLOR_OPAQUE_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGBA_COLOR_OPAQUE_BLACK), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGB_COLOR_RED), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGB_COLOR_GREEN), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGB_COLOR_BLUE), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGB_COLOR_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_R (EEL_RGB_COLOR_BLACK), 0x00);
-
- /* EEL_RGBA_COLOR_GET_G */
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGBA_COLOR_OPAQUE_RED), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGBA_COLOR_OPAQUE_GREEN), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGBA_COLOR_OPAQUE_BLUE), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGBA_COLOR_OPAQUE_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGBA_COLOR_OPAQUE_BLACK), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGB_COLOR_RED), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGB_COLOR_GREEN), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGB_COLOR_BLUE), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGB_COLOR_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_G (EEL_RGB_COLOR_BLACK), 0x00);
-
- /* EEL_RGBA_COLOR_GET_B */
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGBA_COLOR_OPAQUE_RED), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGBA_COLOR_OPAQUE_GREEN), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGBA_COLOR_OPAQUE_BLUE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGBA_COLOR_OPAQUE_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGBA_COLOR_OPAQUE_BLACK), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGB_COLOR_RED), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGB_COLOR_GREEN), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGB_COLOR_BLUE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGB_COLOR_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_B (EEL_RGB_COLOR_BLACK), 0x00);
-
- /* EEL_RGBA_COLOR_GET_A */
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGBA_COLOR_OPAQUE_RED), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGBA_COLOR_OPAQUE_GREEN), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGBA_COLOR_OPAQUE_BLUE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGBA_COLOR_OPAQUE_WHITE), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGBA_COLOR_OPAQUE_BLACK), 0xFF);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGB_COLOR_RED), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGB_COLOR_GREEN), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGB_COLOR_BLUE), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGB_COLOR_WHITE), 0x00);
- EEL_CHECK_INTEGER_RESULT (EEL_RGBA_COLOR_GET_A (EEL_RGB_COLOR_BLACK), 0x00);
-
-}
-
-#endif /* ! EEL_OMIT_SELF_CHECK */
diff --git a/eel/eel-gdk-extensions.h b/eel/eel-gdk-extensions.h
index 1d75e70..8703179 100644
--- a/eel/eel-gdk-extensions.h
+++ b/eel/eel-gdk-extensions.h
@@ -28,35 +28,6 @@
#include <gdk/gdk.h>
-#define EEL_RGB_COLOR_RED 0xFF0000
-#define EEL_RGB_COLOR_GREEN 0x00FF00
-#define EEL_RGB_COLOR_BLUE 0x0000FF
-#define EEL_RGB_COLOR_WHITE 0xFFFFFF
-#define EEL_RGB_COLOR_BLACK 0x000000
-
-#define EEL_RGBA_COLOR_OPAQUE_RED 0xFFFF0000
-#define EEL_RGBA_COLOR_OPAQUE_GREEN 0xFF00FF00
-#define EEL_RGBA_COLOR_OPAQUE_BLUE 0xFF0000FF
-#define EEL_RGBA_COLOR_OPAQUE_WHITE 0xFFFFFFFF
-#define EEL_RGBA_COLOR_OPAQUE_BLACK 0xFF000000
-
-/* Pack RGBA values into 32 bits */
-#define EEL_RGBA_COLOR_PACK(r, g, b, a) \
-( (((guint32)a) << 24) | \
- (((guint32)r) << 16) | \
- (((guint32)g) << 8) | \
- (((guint32)b) << 0) )
-
-/* Pack opaque RGBA values into 32 bits */
-#define EEL_RGB_COLOR_PACK(r, g, b) \
-EEL_RGBA_COLOR_PACK((r), (g), (b), 0xFF)
-
-/* Access the individual RGBA components */
-#define EEL_RGBA_COLOR_GET_R(color) (((color) >> 16) & 0xff)
-#define EEL_RGBA_COLOR_GET_G(color) (((color) >> 8) & 0xff)
-#define EEL_RGBA_COLOR_GET_B(color) (((color) >> 0) & 0xff)
-#define EEL_RGBA_COLOR_GET_A(color) (((color) >> 24) & 0xff)
-
/* Bits returned by eel_gdk_parse_geometry */
typedef enum {
EEL_GDK_NO_VALUE = 0x00,
@@ -69,22 +40,7 @@ typedef enum {
EEL_GDK_Y_NEGATIVE = 0x20
} EelGdkGeometryFlags;
-/* A version of parse_color that substitutes a default color instead of returning
- a boolean to indicate it cannot be parsed.
-*/
-void eel_gdk_color_parse_with_white_default (const char *color_spec,
- GdkColor *parsed_color);
-guint32 eel_rgb16_to_rgb (gushort r,
- gushort g,
- gushort b);
-guint32 eel_rgb8_to_rgb (guchar r,
- guchar g,
- guchar b);
-guint32 eel_gdk_color_to_rgb (const GdkColor *color);
-GdkColor eel_gdk_rgb_to_color (guint32 color);
-char * eel_gdk_rgb_to_color_spec (guint32 color);
-
-gboolean eel_gdk_color_is_dark (GdkColor *color);
+gboolean eel_gdk_rgba_is_dark (const GdkRGBA *color);
/* Wrapper for XParseGeometry */
EelGdkGeometryFlags eel_gdk_parse_geometry (const char *string,
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index bfe96e4..a491659 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -364,7 +364,7 @@ eel_gtk_label_make_bold (GtkLabel *label)
* theme or user prefs, since the font desc only has the
* weight flag turned on.
*/
- gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
+ gtk_widget_override_font (GTK_WIDGET (label), font_desc);
pango_font_description_free (font_desc);
}
diff --git a/eel/eel-lib-self-check-functions.h b/eel/eel-lib-self-check-functions.h
index 2221a9f..f34fcda 100644
--- a/eel/eel-lib-self-check-functions.h
+++ b/eel/eel-lib-self-check-functions.h
@@ -39,7 +39,6 @@ void eel_run_lib_self_checks (void);
*/
#define EEL_LIB_FOR_EACH_SELF_CHECK_FUNCTION(macro) \
- macro (eel_self_check_gdk_extensions) \
macro (eel_self_check_glib_extensions) \
macro (eel_self_check_string) \
/* Add new self-check functions to the list above this line. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]