GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit f91a19b1 authored by Michael Natterer's avatar Michael Natterer 😴

libgimpwidgets: merge some GimpColorButton API from gtk3-port

parent 308efbb5
......@@ -112,7 +112,7 @@ gimp_color_panel_button_press (GtkWidget *widget,
color_button = GIMP_COLOR_BUTTON (widget);
color_panel = GIMP_COLOR_PANEL (widget);
ui_manager = GTK_UI_MANAGER (color_button->popup_menu);
ui_manager = gimp_color_button_get_ui_manager (color_button);
group = gtk_ui_manager_get_action_groups (ui_manager)->data;
......@@ -162,15 +162,17 @@ gimp_color_panel_clicked (GtkButton *button)
if (! panel->color_dialog)
{
GimpColorButton *color_button = GIMP_COLOR_BUTTON (button);
panel->color_dialog =
gimp_color_dialog_new (NULL, panel->context,
GIMP_COLOR_BUTTON (button)->title,
gimp_color_button_get_title (color_button),
NULL, NULL,
GTK_WIDGET (button),
NULL, NULL,
&color,
gimp_color_button_get_update (GIMP_COLOR_BUTTON (button)),
gimp_color_button_has_alpha (GIMP_COLOR_BUTTON (button)));
gimp_color_button_get_update (color_button),
gimp_color_button_has_alpha (color_button));
g_signal_connect (panel->color_dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
......@@ -252,8 +254,8 @@ gimp_color_panel_set_context (GimpColorPanel *panel,
panel->context = context;
if (context)
gimp_color_area_set_color_config (GIMP_COLOR_AREA (GIMP_COLOR_BUTTON (panel)->color_area),
context->gimp->config->color_management);
gimp_color_button_set_color_config (GIMP_COLOR_BUTTON (panel),
context->gimp->config->color_management);
}
......
......@@ -27,6 +27,7 @@
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpconfig/gimpconfig.h"
#include "gimpwidgetstypes.h"
......@@ -228,7 +229,7 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
g_param_spec_string ("title", NULL, NULL,
NULL,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
G_PARAM_CONSTRUCT));
/**
* GimpColorButton:color:
*
......@@ -449,8 +450,7 @@ gimp_color_button_set_property (GObject *object,
switch (property_id)
{
case PROP_TITLE:
g_free (button->title);
button->title = g_value_dup_string (value);
gimp_color_button_set_title (button, g_value_get_string (value));
break;
case PROP_COLOR:
......@@ -640,6 +640,47 @@ gimp_color_button_new (const gchar *title,
NULL);
}
/**
* gimp_color_button_set_title:
* @button: a #GimpColorButton.
* @color: the new title.
*
* Sets the @button dialog's title.
*
* Since: GIMP 2.10
**/
void
gimp_color_button_set_title (GimpColorButton *button,
const gchar *title)
{
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
g_return_if_fail (title != NULL);
g_free (button->title);
button->title = g_strdup (title);
if (button->dialog)
gtk_window_set_title (GTK_WINDOW (button->dialog), title);
g_object_notify (G_OBJECT (button), "title");
}
/**
* gimp_color_button_get_title:
* @button: a #GimpColorButton.
*
* Returns: The @button dialog's title.
*
* Since: GIMP 2.10
**/
const gchar *
gimp_color_button_get_title (GimpColorButton *button)
{
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (button), NULL);
return button->title;
}
/**
* gimp_color_button_set_color:
* @button: Pointer to a #GimpColorButton.
......@@ -770,6 +811,43 @@ gimp_color_button_set_update (GimpColorButton *button,
}
}
/**
* gimp_color_button_set_color_config:
* @button: a #GimpColorButton widget.
* @config: a #GimpColorConfig object.
*
* Sets the color management configuration to use with this color button's
* #GimpColorArea.
*
* Since: 2.10
*/
void
gimp_color_button_set_color_config (GimpColorButton *button,
GimpColorConfig *config)
{
g_return_if_fail (GIMP_IS_COLOR_BUTTON (button));
g_return_if_fail (config == NULL || GIMP_IS_COLOR_CONFIG (config));
gimp_color_area_set_color_config (GIMP_COLOR_AREA (button->color_area),
config);
}
/**
* gimp_color_button_get_ui_manager:
* @button: a #GimpColorButton.
*
* Returns: The @button's #GtkUIManager.
*
* Since: GIMP 2.10
**/
GtkUIManager *
gimp_color_button_get_ui_manager (GimpColorButton *button)
{
g_return_val_if_fail (GIMP_IS_COLOR_BUTTON (button), NULL);
return button->popup_menu;
}
/* private functions */
......
......@@ -78,26 +78,35 @@ struct _GimpColorButtonClass
};
GType gimp_color_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_button_new (const gchar *title,
gint width,
gint height,
const GimpRGB *color,
GimpColorAreaType type);
void gimp_color_button_set_color (GimpColorButton *button,
const GimpRGB *color);
void gimp_color_button_get_color (GimpColorButton *button,
GimpRGB *color);
gboolean gimp_color_button_has_alpha (GimpColorButton *button);
void gimp_color_button_set_type (GimpColorButton *button,
GimpColorAreaType type);
gboolean gimp_color_button_get_update (GimpColorButton *button);
void gimp_color_button_set_update (GimpColorButton *button,
gboolean continuous);
GType gimp_color_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_button_new (const gchar *title,
gint width,
gint height,
const GimpRGB *color,
GimpColorAreaType type);
void gimp_color_button_set_title (GimpColorButton *button,
const gchar *title);
const gchar * gimp_color_button_get_title (GimpColorButton *button);
void gimp_color_button_set_color (GimpColorButton *button,
const GimpRGB *color);
void gimp_color_button_get_color (GimpColorButton *button,
GimpRGB *color);
gboolean gimp_color_button_has_alpha (GimpColorButton *button);
void gimp_color_button_set_type (GimpColorButton *button,
GimpColorAreaType type);
gboolean gimp_color_button_get_update (GimpColorButton *button);
void gimp_color_button_set_update (GimpColorButton *button,
gboolean continuous);
void gimp_color_button_set_color_config (GimpColorButton *button,
GimpColorConfig *config);
GtkUIManager * gimp_color_button_get_ui_manager (GimpColorButton *button);
G_END_DECLS
......
......@@ -34,11 +34,15 @@ EXPORTS
gimp_color_area_set_type
gimp_color_area_type_get_type
gimp_color_button_get_color
gimp_color_button_get_title
gimp_color_button_get_type
gimp_color_button_get_ui_manager
gimp_color_button_get_update
gimp_color_button_has_alpha
gimp_color_button_new
gimp_color_button_set_color
gimp_color_button_set_color_config
gimp_color_button_set_title
gimp_color_button_set_type
gimp_color_button_set_update
gimp_color_display_changed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment