Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
yad
Commits
346a58c3
Commit
346a58c3
authored
Apr 24, 2018
by
Victor Ananjesky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to GtkColorChooser in color widget for gtk3. remove --extra option for color dialogs
parent
5bc40060
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
form.c
src/form.c
+14
-2
option.c
src/option.c
+0
-1
util.c
src/util.c
+4
-4
No files found.
src/form.c
View file @
346a58c3
...
@@ -107,11 +107,17 @@ expand_action (gchar * cmd)
...
@@ -107,11 +107,17 @@ expand_action (gchar * cmd)
break
;
break
;
case
YAD_FIELD_COLOR
:
case
YAD_FIELD_COLOR
:
{
{
#if !GTK_CHECK_VERSION(3,0,0)
GdkColor
c
;
GdkColor
c
;
GtkColorButton
*
cb
=
GTK_COLOR_BUTTON
(
g_slist_nth_data
(
fields
,
num
));
GtkColorButton
*
cb
=
GTK_COLOR_BUTTON
(
g_slist_nth_data
(
fields
,
num
));
gtk_color_button_get_color
(
cb
,
&
c
);
gtk_color_button_get_color
(
cb
,
&
c
);
buf
=
get_color
(
&
c
,
gtk_color_button_get_alpha
(
cb
));
buf
=
get_color
(
&
c
,
gtk_color_button_get_alpha
(
cb
));
#else
GdkRGBA
c
;
GtkColorChooser
*
cb
=
GTK_COLOR_CHOOSER
(
g_slist_nth_data
(
fields
,
num
));
gtk_color_chooser_get_rgba
(
cb
,
&
c
);
buf
=
get_color
(
&
c
);
#endif
arg
=
g_shell_quote
(
buf
?
buf
:
""
);
arg
=
g_shell_quote
(
buf
?
buf
:
""
);
g_free
(
buf
);
g_free
(
buf
);
break
;
break
;
...
@@ -1256,11 +1262,17 @@ form_print_field (guint fn)
...
@@ -1256,11 +1262,17 @@ form_print_field (guint fn)
case
YAD_FIELD_COLOR
:
case
YAD_FIELD_COLOR
:
{
{
gchar
*
cs
;
gchar
*
cs
;
#if !GTK_CHECK_VERSION(3,0,0)
GdkColor
c
;
GdkColor
c
;
GtkColorButton
*
cb
=
GTK_COLOR_BUTTON
(
g_slist_nth_data
(
fields
,
fn
));
GtkColorButton
*
cb
=
GTK_COLOR_BUTTON
(
g_slist_nth_data
(
fields
,
fn
));
gtk_color_button_get_color
(
cb
,
&
c
);
gtk_color_button_get_color
(
cb
,
&
c
);
cs
=
get_color
(
&
c
,
gtk_color_button_get_alpha
(
cb
));
cs
=
get_color
(
&
c
,
gtk_color_button_get_alpha
(
cb
));
#else
GdkRGBA
c
;
GtkColorChooser
*
cb
=
GTK_COLOR_CHOOSER
(
g_slist_nth_data
(
fields
,
fn
));
gtk_color_chooser_get_rgba
(
cb
,
&
c
);
cs
=
get_color
(
&
c
);
#endif
if
(
options
.
common_data
.
quoted_output
)
if
(
options
.
common_data
.
quoted_output
)
{
{
buf
=
g_shell_quote
(
cs
?
cs
:
""
);
buf
=
g_shell_quote
(
cs
?
cs
:
""
);
...
...
src/option.c
View file @
346a58c3
...
@@ -1474,7 +1474,6 @@ yad_options_init (void)
...
@@ -1474,7 +1474,6 @@ yad_options_init (void)
options
.
color_data
.
use_palette
=
FALSE
;
options
.
color_data
.
use_palette
=
FALSE
;
options
.
color_data
.
expand_palette
=
FALSE
;
options
.
color_data
.
expand_palette
=
FALSE
;
options
.
color_data
.
palette
=
NULL
;
options
.
color_data
.
palette
=
NULL
;
options
.
color_data
.
extra
=
FALSE
;
options
.
color_data
.
alpha
=
FALSE
;
options
.
color_data
.
alpha
=
FALSE
;
options
.
color_data
.
mode
=
YAD_COLOR_HEX
;
options
.
color_data
.
mode
=
YAD_COLOR_HEX
;
...
...
src/util.c
View file @
346a58c3
...
@@ -198,9 +198,9 @@ get_color (GdkColor *c, guint64 alpha)
...
@@ -198,9 +198,9 @@ get_color (GdkColor *c, guint64 alpha)
{
{
case
YAD_COLOR_HEX
:
case
YAD_COLOR_HEX
:
if
(
options
.
color_data
.
alpha
)
if
(
options
.
color_data
.
alpha
)
res
=
g_strdup_printf
(
"#%
hXhXhXhX"
,
c
->
red
,
c
->
green
,
c
->
blue
,
alpha
/
256
);
res
=
g_strdup_printf
(
"#%
X%X%X%X"
,
c
->
red
&
0xFF
,
c
->
green
&
0xFF
,
c
->
blue
&
0xFF
,
(
alpha
/
256
)
&
0xFF
);
else
else
res
=
g_strdup_printf
(
"#%
hXhXhX"
,
c
->
red
,
c
->
green
,
c
->
blue
);
res
=
g_strdup_printf
(
"#%
X%X%X"
,
c
->
red
&
0xFF
,
c
->
green
&
0xFF
,
c
->
blue
&
0xFF
);
break
;
break
;
case
YAD_COLOR_RGB
:
case
YAD_COLOR_RGB
:
if
(
options
.
color_data
.
alpha
)
if
(
options
.
color_data
.
alpha
)
...
@@ -224,9 +224,9 @@ get_color (GdkRGBA *c)
...
@@ -224,9 +224,9 @@ get_color (GdkRGBA *c)
{
{
case
YAD_COLOR_HEX
:
case
YAD_COLOR_HEX
:
if
(
options
.
color_data
.
alpha
)
if
(
options
.
color_data
.
alpha
)
res
=
g_strdup_printf
(
"#%
hXhXhXhX"
,
c
->
red
*
255
,
c
->
green
*
255
,
c
->
blue
*
255
,
c
->
alpha
*
255
);
res
=
g_strdup_printf
(
"#%
X%X%X%X"
,
(
int
)
(
c
->
red
*
255
),
(
int
)
(
c
->
green
*
255
),
(
int
)
(
c
->
blue
*
255
),
(
int
)
(
c
->
alpha
*
255
)
);
else
else
res
=
g_strdup_printf
(
"#%
hXhXhX"
,
c
->
red
*
255
,
c
->
green
*
255
,
c
->
blue
*
255
);
res
=
g_strdup_printf
(
"#%
X%X%X"
,
(
int
)
(
c
->
red
*
255
),
(
int
)
(
c
->
green
*
255
),
(
int
)
(
c
->
blue
*
255
)
);
break
;
break
;
case
YAD_COLOR_RGB
:
case
YAD_COLOR_RGB
:
res
=
gdk_rgba_to_string
(
c
);
res
=
gdk_rgba_to_string
(
c
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment