diff options
Diffstat (limited to 'libmate-desktop/mate-colorbutton.c')
-rw-r--r-- | libmate-desktop/mate-colorbutton.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/libmate-desktop/mate-colorbutton.c b/libmate-desktop/mate-colorbutton.c index c4eee8b..249860a 100644 --- a/libmate-desktop/mate-colorbutton.c +++ b/libmate-desktop/mate-colorbutton.c @@ -25,7 +25,7 @@ * Modified by the GTK+ Team and others 2003. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" @@ -44,21 +44,21 @@ #define CHECK_DARK (1.0 / 3.0) #define CHECK_LIGHT (2.0 / 3.0) -struct _MateColorButtonPrivate +struct _MateColorButtonPrivate { GtkWidget *draw_area; /* Widget where we draw the color sample */ GtkWidget *cs_dialog; /* Color selection dialog */ - + gchar *title; /* Title for the color selection window */ - + GdkColor color; guint16 alpha; - + guint use_alpha : 1; /* Use alpha or not */ }; /* Properties */ -enum +enum { PROP_0, PROP_USE_ALPHA, @@ -68,7 +68,7 @@ enum }; /* Signals */ -enum +enum { COLOR_SET, LAST_SIGNAL @@ -86,7 +86,7 @@ static void mate_color_button_get_property (GObject *object, GParamSpec *pspec); /* gtkwidget signals */ -static void mate_color_button_state_changed (GtkWidget *widget, +static void mate_color_button_state_changed (GtkWidget *widget, GtkStateType previous_state); /* gtkbutton signals */ @@ -141,15 +141,15 @@ mate_color_button_class_init (MateColorButtonClass *klass) /** * MateColorButton:use-alpha: * - * If this property is set to %TRUE, the color swatch on the button is rendered against a - * checkerboard background to show its opacity and the opacity slider is displayed in the - * color selection dialog. + * If this property is set to %TRUE, the color swatch on the button is rendered against a + * checkerboard background to show its opacity and the opacity slider is displayed in the + * color selection dialog. * * Since: 1.9.1 */ g_object_class_install_property (gobject_class, PROP_USE_ALPHA, - g_param_spec_boolean ("use-alpha", _("Use alpha"), + g_param_spec_boolean ("use-alpha", _("Use alpha"), _("Whether or not to give the color an alpha value"), FALSE, G_PARAM_READWRITE)); @@ -163,8 +163,8 @@ mate_color_button_class_init (MateColorButtonClass *klass) */ g_object_class_install_property (gobject_class, PROP_TITLE, - g_param_spec_string ("title", - _("Title"), + g_param_spec_string ("title", + _("Title"), _("The title of the color selection dialog"), _("Pick a Color"), G_PARAM_READWRITE)); @@ -187,7 +187,7 @@ mate_color_button_class_init (MateColorButtonClass *klass) /** * MateColorButton:alpha: * - * The selected opacity value (0 fully transparent, 65535 fully opaque). + * The selected opacity value (0 fully transparent, 65535 fully opaque). * * Since: 1.9.1 */ @@ -198,13 +198,13 @@ mate_color_button_class_init (MateColorButtonClass *klass) _("The selected opacity value (0 fully transparent, 65535 fully opaque)"), 0, 65535, 65535, G_PARAM_READWRITE)); - + /** * MateColorButton::color-set: * @widget: the object which received the signal. - * - * The ::color-set signal is emitted when the user selects a color. - * When handling this signal, use mate_color_button_get_color() and + * + * The ::color-set signal is emitted when the user selects a color. + * When handling this signal, use mate_color_button_get_color() and * mate_color_button_get_alpha() to find out which color was just selected. * * Note that this signal is only emitted when the <emphasis>user</emphasis> @@ -254,8 +254,8 @@ mate_color_button_get_checkered (void) /* Handle exposure events for the color picker's drawing area */ static gboolean -draw (GtkWidget *widget, - cairo_t *cr, +draw (GtkWidget *widget, + cairo_t *cr, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); @@ -302,7 +302,7 @@ draw (GtkWidget *widget, } static void -mate_color_button_state_changed (GtkWidget *widget, +mate_color_button_state_changed (GtkWidget *widget, GtkStateType previous_state) { gtk_widget_queue_draw (widget); @@ -326,7 +326,7 @@ mate_color_button_drag_data_received (GtkWidget *widget, /* We accept drops with the wrong format, since the KDE color * chooser incorrectly drops application/x-color with format 8. */ - if (gtk_selection_data_get_length (selection_data) != 8) + if (gtk_selection_data_get_length (selection_data) != 8) { g_warning (_("Received invalid color data\n")); return; @@ -360,12 +360,12 @@ set_color_icon (GdkDragContext *context, pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 48, 32); - pixel = ((color->red & 0xff00) << 16) | - ((color->green & 0xff00) << 8) | + pixel = ((color->red & 0xff00) << 16) | + ((color->green & 0xff00) << 8) | (color->blue & 0xff00); gdk_pixbuf_fill (pixbuf, pixel); - + gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2); g_object_unref (pixbuf); } @@ -376,7 +376,7 @@ mate_color_button_drag_begin (GtkWidget *widget, gpointer data) { MateColorButton *color_button = data; - + set_color_icon (context, &color_button->priv->color); } @@ -482,9 +482,9 @@ mate_color_button_finalize (GObject *object) * mate_color_button_new: * * Creates a new color button. This returns a widget in the form of - * a small button containing a swatch representing the current selected - * color. When the button is clicked, a color-selection dialog will open, - * allowing the user to select a color. The swatch will be updated to reflect + * a small button containing a swatch representing the current selected + * color. When the button is clicked, a color-selection dialog will open, + * allowing the user to select a color. The swatch will be updated to reflect * the new color when the user finishes. * * Returns: a new color button. @@ -501,7 +501,7 @@ mate_color_button_new (void) * mate_color_button_new_with_color: * @color: A #GdkColor to set the current color with. * - * Creates a new color button. + * Creates a new color button. * * Returns: a new color button. * @@ -514,7 +514,7 @@ mate_color_button_new_with_color (const GdkColor *color) } static void -dialog_ok_clicked (GtkWidget *widget, +dialog_ok_clicked (GtkWidget *widget, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); @@ -538,11 +538,11 @@ dialog_ok_clicked (GtkWidget *widget, } static gboolean -dialog_destroy (GtkWidget *widget, +dialog_destroy (GtkWidget *widget, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); - + color_button->priv->cs_dialog = NULL; return FALSE; @@ -553,8 +553,8 @@ dialog_cancel_clicked (GtkWidget *widget, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); - - gtk_widget_hide (color_button->priv->cs_dialog); + + gtk_widget_hide (color_button->priv->cs_dialog); } static void @@ -564,26 +564,26 @@ mate_color_button_clicked (GtkButton *button) MateColorSelectionDialog *color_dialog; /* if dialog already exists, make sure it's shown and raised */ - if (!color_button->priv->cs_dialog) + if (!color_button->priv->cs_dialog) { /* Create the dialog and connects its buttons */ GtkWidget *parent; - + parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button)); - + color_button->priv->cs_dialog = mate_color_selection_dialog_new (color_button->priv->title); - + color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog); if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent)) { if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog))) gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent)); - + gtk_window_set_modal (GTK_WINDOW (color_dialog), gtk_window_get_modal (GTK_WINDOW (parent))); } - + g_signal_connect (color_dialog->ok_button, "clicked", G_CALLBACK (dialog_ok_clicked), color_button); g_signal_connect (color_dialog->cancel_button, "clicked", @@ -598,15 +598,15 @@ mate_color_button_clicked (GtkButton *button) color_button->priv->use_alpha); mate_color_selection_set_has_palette (MATE_COLOR_SELECTION (color_dialog->colorsel), TRUE); - - mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel), + + mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel), &color_button->priv->color); - mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), + mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), color_button->priv->alpha); - mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel), + mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel), &color_button->priv->color); - mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), + mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), color_button->priv->alpha); gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog)); @@ -633,7 +633,7 @@ mate_color_button_set_color (MateColorButton *color_button, color_button->priv->color.blue = color->blue; gtk_widget_queue_draw (color_button->priv->draw_area); - + g_object_notify (G_OBJECT (color_button), "color"); } @@ -659,7 +659,7 @@ mate_color_button_set_rgba (MateColorButton *color_button, color_button->priv->alpha = color->alpha * 65535; gtk_widget_queue_draw (color_button->priv->draw_area); - + g_object_notify (G_OBJECT (color_button), "color"); } @@ -668,7 +668,7 @@ mate_color_button_set_rgba (MateColorButton *color_button, * @color_button: a #MateColorButton. * @alpha: an integer between 0 and 65535. * - * Sets the current opacity to be @alpha. + * Sets the current opacity to be @alpha. * * Since: 1.9.1 **/ @@ -699,7 +699,7 @@ mate_color_button_get_color (MateColorButton *color_button, GdkColor *color) { g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button)); - + color->red = color_button->priv->color.red; color->green = color_button->priv->color.green; color->blue = color_button->priv->color.blue; @@ -719,7 +719,7 @@ mate_color_button_get_rgba (MateColorButton *color_button, GdkRGBA *color) { g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button)); - + color->red = color_button->priv->color.red / 65535.; color->green = color_button->priv->color.green / 65535.; color->blue = color_button->priv->color.blue / 65535.; @@ -730,7 +730,7 @@ mate_color_button_get_rgba (MateColorButton *color_button, * mate_color_button_get_alpha: * @color_button: a #MateColorButton. * - * Returns the current alpha value. + * Returns the current alpha value. * * Return value: an integer between 0 and 65535. * @@ -740,7 +740,7 @@ guint16 mate_color_button_get_alpha (MateColorButton *color_button) { g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), 0); - + return color_button->priv->alpha; } @@ -754,14 +754,14 @@ mate_color_button_get_alpha (MateColorButton *color_button) * Since: 1.9.1 */ void -mate_color_button_set_use_alpha (MateColorButton *color_button, +mate_color_button_set_use_alpha (MateColorButton *color_button, gboolean use_alpha) { g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button)); use_alpha = (use_alpha != FALSE); - if (color_button->priv->use_alpha != use_alpha) + if (color_button->priv->use_alpha != use_alpha) { color_button->priv->use_alpha = use_alpha; @@ -800,7 +800,7 @@ mate_color_button_get_use_alpha (MateColorButton *color_button) * Since: 1.9.1 */ void -mate_color_button_set_title (MateColorButton *color_button, +mate_color_button_set_title (MateColorButton *color_button, const gchar *title) { gchar *old_title; @@ -812,9 +812,9 @@ mate_color_button_set_title (MateColorButton *color_button, g_free (old_title); if (color_button->priv->cs_dialog) - gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog), + gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog), color_button->priv->title); - + g_object_notify (G_OBJECT (color_button), "title"); } @@ -844,7 +844,7 @@ mate_color_button_set_property (GObject *object, { MateColorButton *color_button = MATE_COLOR_BUTTON (object); - switch (param_id) + switch (param_id) { case PROP_USE_ALPHA: mate_color_button_set_use_alpha (color_button, g_value_get_boolean (value)); @@ -873,7 +873,7 @@ mate_color_button_get_property (GObject *object, MateColorButton *color_button = MATE_COLOR_BUTTON (object); GdkColor color; - switch (param_id) + switch (param_id) { case PROP_USE_ALPHA: g_value_set_boolean (value, mate_color_button_get_use_alpha (color_button)); |