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
a731d3f1
Commit
a731d3f1
authored
Apr 29, 2018
by
Victor Ananjesky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate to GtkFontChooser in gtk3 build
parent
2f69df13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
7 deletions
+44
-7
font.c
src/font.c
+22
-0
form.c
src/form.c
+22
-7
No files found.
src/font.c
View file @
a731d3f1
...
...
@@ -28,7 +28,11 @@ static GtkWidget *font;
static
void
realize_cb
(
GtkWidget
*
w
,
gpointer
d
)
{
#if GTK_CHECK_VERSION(3,0,0)
gtk_font_chooser_set_font
(
GTK_FONT_CHOOSER
(
w
),
options
.
common_data
.
font
);
#else
gtk_font_selection_set_font_name
(
GTK_FONT_SELECTION
(
w
),
options
.
common_data
.
font
);
#endif
}
GtkWidget
*
...
...
@@ -36,11 +40,19 @@ font_create_widget (GtkWidget * dlg)
{
GtkWidget
*
w
;
#if GTK_CHECK_VERSION(3,0,0)
w
=
font
=
gtk_font_chooser_widget_new
();
#else
w
=
font
=
gtk_font_selection_new
();
#endif
gtk_widget_set_name
(
w
,
"yad-font-widget"
);
if
(
options
.
font_data
.
preview
)
#if GTK_CHECK_VERSION(3,0,0)
gtk_font_chooser_set_preview_text
(
GTK_FONT_CHOOSER
(
w
),
options
.
font_data
.
preview
);
#else
gtk_font_selection_set_preview_text
(
GTK_FONT_SELECTION
(
w
),
options
.
font_data
.
preview
);
#endif
/* font must be set after widget inserted in toplevel */
if
(
options
.
common_data
.
font
)
...
...
@@ -58,9 +70,15 @@ font_print_result (void)
PangoFontFamily
*
family
;
gint
size
;
#if GTK_CHECK_VERSION(3,0,0)
face
=
gtk_font_chooser_get_font_face
(
GTK_FONT_CHOOSER
(
font
));
family
=
gtk_font_chooser_get_font_family
(
GTK_FONT_CHOOSER
(
font
));
size
=
gtk_font_chooser_get_font_size
(
GTK_FONT_CHOOSER
(
font
));
#else
face
=
gtk_font_selection_get_face
(
GTK_FONT_SELECTION
(
font
));
family
=
gtk_font_selection_get_family
(
GTK_FONT_SELECTION
(
font
));
size
=
gtk_font_selection_get_size
(
GTK_FONT_SELECTION
(
font
));
#endif
if
(
options
.
common_data
.
quoted_output
)
{
...
...
@@ -81,7 +99,11 @@ font_print_result (void)
}
else
{
#if GTK_CHECK_VERSION(3,0,0)
gchar
*
fn
=
gtk_font_chooser_get_font
(
GTK_FONT_CHOOSER
(
font
));
#else
gchar
*
fn
=
gtk_font_selection_get_font_name
(
GTK_FONT_SELECTION
(
font
));
#endif
if
(
options
.
common_data
.
quoted_output
)
{
...
...
src/form.c
View file @
a731d3f1
...
...
@@ -103,7 +103,11 @@ expand_action (gchar * cmd)
arg
=
g_shell_quote
(
gtk_file_chooser_get_filename
(
GTK_FILE_CHOOSER
(
g_slist_nth_data
(
fields
,
num
))));
break
;
case
YAD_FIELD_FONT
:
#if !GTK_CHECK_VERSION(3,0,0)
arg
=
g_shell_quote
(
gtk_font_button_get_font_name
(
GTK_FONT_BUTTON
(
g_slist_nth_data
(
fields
,
num
))));
#else
arg
=
g_shell_quote
(
gtk_font_chooser_get_font
(
GTK_FONT_CHOOSER
(
g_slist_nth_data
(
fields
,
num
))));
#endif
break
;
case
YAD_FIELD_COLOR
:
{
...
...
@@ -317,7 +321,11 @@ set_field_value (guint num, gchar * value)
break
;
case
YAD_FIELD_FONT
:
#if !GTK_CHECK_VERSION(3,0,0)
gtk_font_button_set_font_name
(
GTK_FONT_BUTTON
(
w
),
value
);
#else
gtk_font_chooser_set_font
(
GTK_FONT_CHOOSER
(
w
),
value
);
#endif
break
;
case
YAD_FIELD_SCALE
:
...
...
@@ -1262,13 +1270,20 @@ form_print_field (guint fn)
}
break
;
case
YAD_FIELD_FONT
:
if
(
options
.
common_data
.
quoted_output
)
g_printf
(
"'%s'%s"
,
gtk_font_button_get_font_name
(
GTK_FONT_BUTTON
(
g_slist_nth_data
(
fields
,
fn
))),
options
.
common_data
.
separator
);
else
g_printf
(
"%s%s"
,
gtk_font_button_get_font_name
(
GTK_FONT_BUTTON
(
g_slist_nth_data
(
fields
,
fn
))),
options
.
common_data
.
separator
);
break
;
{
gchar
*
fname
;
#if !GTK_CHECK_VERSION(3,0,0)
fname
=
gtk_font_button_get_font_name
(
GTK_FONT_BUTTON
(
g_slist_nth_data
(
fields
,
fn
)));
#else
fname
=
gtk_font_chooser_get_font
(
GTK_FONT_CHOOSER
(
g_slist_nth_data
(
fields
,
fn
)));
#endif
if
(
options
.
common_data
.
quoted_output
)
g_printf
(
"'%s'%s"
,
fname
,
options
.
common_data
.
separator
);
else
g_printf
(
"%s%s"
,
fname
,
options
.
common_data
.
separator
);
g_free
(
fname
);
break
;
}
case
YAD_FIELD_COLOR
:
{
gchar
*
cs
;
...
...
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