Commit 119ca893 authored by Victor Ananjevsky's avatar Victor Ananjevsky

add yad-tools utility. remove pfd and add pfd wrapper for backward compatibility

parent 32c203bb
...@@ -23,7 +23,7 @@ po/*.gmo ...@@ -23,7 +23,7 @@ po/*.gmo
po/stamp-it po/stamp-it
src/yad src/yad
src/yad-icon-browser src/yad-icon-browser
src/pfd src/yad-tools
stamp-h1 stamp-h1
*.tar.xz *.tar.xz
build.log build.log
......
...@@ -89,27 +89,23 @@ if test x$have_sourceview = xyes; then ...@@ -89,27 +89,23 @@ if test x$have_sourceview = xyes; then
AC_DEFINE([HAVE_SOURCEVIEW], [1], [Define this if you need GtkSourceView support]) AC_DEFINE([HAVE_SOURCEVIEW], [1], [Define this if you need GtkSourceView support])
fi fi
dnl icon browser dnl standalone build
AC_ARG_ENABLE([standalone], AC_ARG_ENABLE([standalone],
[AS_HELP_STRING([--enable-standalone], [AS_HELP_STRING([--enable-standalone],
[Build standalone YAD binary (wihtout gsettings)])], [Build standalone YAD binary (wihtout gsettings)])],
[build_sa=$enableval], [build_sa=no]) [build_sa=$enableval], [build_sa=no])
AM_CONDITIONAL([STANDALONE], [test x$build_sa = xyes]) AM_CONDITIONAL([STANDALONE], [test x$build_sa = xyes])
if test x$build_sa = xyes; then if test x$build_sa = xyes; then
AC_DEFINE([STANDALONE], [1], [Define this if you need standalone YAD binary]) AC_DEFINE([STANDALONE], [1], [Define this if you need standalone YAD binary])
fi fi
dnl pfd dnl tools
AC_ARG_ENABLE([pfd], AC_ARG_ENABLE([tools],
[AS_HELP_STRING([--enable-pfd], [AS_HELP_STRING([--enable-tools],
[Build pfd utility])], [Build yad-tools utility])],
[build_pfd=$enableval], [build_pfd=yes]) [build_tools=$enableval], [build_tools=yes])
if test x$build_pfd = xyes; then AM_CONDITIONAL([BUILD_TOOLS], [test x$build_tools = xyes])
PKG_CHECK_MODULES([PFD], [pango], [build_pfd=yes], [build_pfd=no])
fi
AC_SUBST([PFD_CFLAGS])
AC_SUBST([PFD_LIBS])
AM_CONDITIONAL([BUILD_PFD], [test x$build_pfd = xyes])
dnl icon browser dnl icon browser
AC_ARG_ENABLE([icon-browser], AC_ARG_ENABLE([icon-browser],
...@@ -167,6 +163,6 @@ echo " GtkSourceView - $have_sourceview" ...@@ -167,6 +163,6 @@ echo " GtkSourceView - $have_sourceview"
echo " Spell checking - $have_spell" echo " Spell checking - $have_spell"
echo " Path to rgb.txt - $with_rgb" echo " Path to rgb.txt - $with_rgb"
echo " Standalone build - $build_sa" echo " Standalone build - $build_sa"
echo " pfd - $build_pfd" echo " Tools - $build_tools"
echo " Icon browser - $build_ib" echo " Icon browser - $build_ib"
echo echo
...@@ -13,8 +13,8 @@ gsettings_SCHEMAS = $(gsettings_in_files:.xml.in=.xml) ...@@ -13,8 +13,8 @@ gsettings_SCHEMAS = $(gsettings_in_files:.xml.in=.xml)
@GSETTINGS_RULES@ @GSETTINGS_RULES@
dist_man_MANS = yad.1 dist_man_MANS = yad.1
if BUILD_PFD if BUILD_TOOLS
dist_man_MANS += pfd.1 dist_man_MANS += yad-tools.1
endif endif
m4dir = $(datadir)/aclocal m4dir = $(datadir)/aclocal
......
.TH PFD "1" "February 2019" "pfd" "User Commands" .TH YAD-TOOLS "1" "March 2021" "yad-tools" "User Commands"
.SH NAME .SH NAME
pfd \- convert font description between xft and pango formats yad-tools \- show some miscellaneous stuff.
.SH SYNOPSIS .SH SYNOPSIS
.B pfd .B yad-tools
.RI [ OPTIONS ] .RI [OPTIONS]
.RI FONT .RI STRING
.SH DESCRIPTION .SH DESCRIPTION
\fBpfd\fR is a small command-line utility to transform font names from pango to xft specification and vice versa. \fByad-tools\fR is a small command-line utility for getting information that may be usefull in scripts.
.SH OPTIONS .SH OPTIONS
.SS General options
.TP
\fB\-f\fR, \fB\-\-pfd\fR
This mode is intended to transform font names from pango to xft specification and vice versa.
Additional argument is font name.
.TP
\fB\-i\fR, \fB\-\-icon\fR
This mode is intended to get full path to icon file from icon name.
Additional argument is icon name.
.SS PFD mode options
.TP .TP
\fB\-x\fR, \fB\-\-xft\fR \fB\-x\fR, \fB\-\-xft\fR
Print font name in xft format. This is default. Print font name in xft format. This is default.
.TP .TP
\fB\-p\fR, \fB\-\-pango\fR \fB\-p\fR, \fB\-\-pango\fR
Print font name in pango format. Print font name in pango format.
.SS Icon mode options
.TP
\fB\-s\fR, \fB\-\-size\fR=\fISIZE\fP
Use specified icon size. Default is 24.
.TP .TP
\fB\-h\fR, \fB\-\-help\fR \fB\-t\fR, \fB\-\-type\fR=\fITYPE\fP
Print help. Obtain icon size from one of predefined GTK+ types. \fITYPE\fP is one of the following \fImenu\fP, \fIbutton\fP, \fIsmall_toolbar\fP, \fIlarge_toolbar\fP, \fIdnd\fP or \fIdialog\fP,
.TP .TP
\fB\-v\fR, \fB\-\-version\fR \fB\-\-theme\fR=\fITHEME\fP
Print current version. Use specified icon theme instead of default.
...@@ -21,6 +21,6 @@ src/text.c ...@@ -21,6 +21,6 @@ src/text.c
src/notebook.c src/notebook.c
src/util.c src/util.c
src/browser.c src/browser.c
src/pfd.c src/tools.c
data/yad-icon-browser.desktop.in data/yad-icon-browser.desktop.in
data/yad.gschema.xml.in data/yad.gschema.xml.in
# Russian translation for YAD # Russian translation for YAD
# This file is distributed under the same license as the YAD package. # This file is distributed under the same license as the YAD package.
# #
# Victor Ananjevsky <ananasik@gmail.com>, 2009-2020. # Victor Ananjevsky <ananasik@gmail.com>, 2009-2021.
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: YAD\n" "Project-Id-Version: YAD\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-08 18:01+0200\n" "POT-Creation-Date: 2021-03-14 10:48+0200\n"
"PO-Revision-Date: 2009-04-30 16:47+0300\n" "PO-Revision-Date: 2009-04-30 16:47+0300\n"
"Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n" "Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
...@@ -137,32 +137,32 @@ msgstr "Не могу разобрать файл %s: %s\n" ...@@ -137,32 +137,32 @@ msgstr "Не могу разобрать файл %s: %s\n"
msgid "Unable to open directory %s: %s\n" msgid "Unable to open directory %s: %s\n"
msgstr "Не могу открыть каталог %s: %s\n" msgstr "Не могу открыть каталог %s: %s\n"
#: ../src/main.c:134 ../src/main.c:468 #: ../src/main.c:134 ../src/main.c:473
#, c-format #, c-format
msgid "%d sec" msgid "%d sec"
msgstr "%d сек" msgstr "%d сек"
#: ../src/main.c:720 ../src/main.c:727 #: ../src/main.c:725 ../src/main.c:732
#, c-format #, c-format
msgid "Unable to parse YAD_OPTIONS: %s\n" msgid "Unable to parse YAD_OPTIONS: %s\n"
msgstr "Не могу разобрать YAD_OPTIONS: %s\n" msgstr "Не могу разобрать YAD_OPTIONS: %s\n"
#: ../src/main.c:738 #: ../src/main.c:743
#, c-format #, c-format
msgid "Unable to parse command line: %s\n" msgid "Unable to parse command line: %s\n"
msgstr "Не удается разобрать командную строку: %s\n" msgstr "Не удается разобрать командную строку: %s\n"
#: ../src/main.c:767 #: ../src/main.c:772
#, c-format #, c-format
msgid "WARNING: Using gtkrc option is deprecated, please use --css instead\n" msgid "WARNING: Using gtkrc option is deprecated, please use --css instead\n"
msgstr "ПРЕДУПРЕЖДЕНИЕ: Опция gtkrc устарела, используйте --css вместо нее\n" msgstr "ПРЕДУПРЕЖДЕНИЕ: Опция gtkrc устарела, используйте --css вместо нее\n"
#: ../src/main.c:836 #: ../src/main.c:841
#, c-format #, c-format
msgid "WARNING: --plug mode not supported outside X11\n" msgid "WARNING: --plug mode not supported outside X11\n"
msgstr "ВНИМАНИЕ: Режим --plug поддерживается только в X11\n" msgstr "ВНИМАНИЕ: Режим --plug поддерживается только в X11\n"
#: ../src/main.c:856 #: ../src/main.c:861
#, c-format #, c-format
msgid "WARNING: This mode not supported outside X11\n" msgid "WARNING: This mode not supported outside X11\n"
msgstr "ВНИМАНИЕ: Этот режим поддерживается только в X11\n" msgstr "ВНИМАНИЕ: Этот режим поддерживается только в X11\n"
...@@ -318,7 +318,7 @@ msgstr "Задать выравнивание текста диалога (left, ...@@ -318,7 +318,7 @@ msgstr "Задать выравнивание текста диалога (left,
#: ../src/option.c:453 ../src/option.c:463 ../src/option.c:509 #: ../src/option.c:453 ../src/option.c:463 ../src/option.c:509
#: ../src/option.c:541 ../src/option.c:551 ../src/option.c:561 #: ../src/option.c:541 ../src/option.c:551 ../src/option.c:561
#: ../src/option.c:575 ../src/option.c:636 ../src/option.c:690 #: ../src/option.c:575 ../src/option.c:636 ../src/option.c:690
#: ../src/option.c:692 #: ../src/option.c:692 ../src/tools.c:60
msgid "TYPE" msgid "TYPE"
msgstr "ТИП" msgstr "ТИП"
...@@ -334,7 +334,8 @@ msgstr "КАРТИНКА" ...@@ -334,7 +334,8 @@ msgstr "КАРТИНКА"
msgid "Use specified icon theme instead of default" msgid "Use specified icon theme instead of default"
msgstr "Использовать указанную тему иконок" msgstr "Использовать указанную тему иконок"
#: ../src/option.c:120 ../src/option.c:659 #: ../src/option.c:120 ../src/option.c:659 ../src/browser.c:217
#: ../src/tools.c:61
msgid "THEME" msgid "THEME"
msgstr "ТЕМА" msgstr "ТЕМА"
...@@ -932,6 +933,7 @@ msgid "Force using specified icon size" ...@@ -932,6 +933,7 @@ msgid "Force using specified icon size"
msgstr "Принудительно использовать размер иконки" msgstr "Принудительно использовать размер иконки"
#: ../src/option.c:422 ../src/option.c:532 ../src/option.c:638 #: ../src/option.c:422 ../src/option.c:532 ../src/option.c:638
#: ../src/tools.c:59
msgid "SIZE" msgid "SIZE"
msgstr "РАЗМЕР" msgstr "РАЗМЕР"
...@@ -1374,7 +1376,7 @@ msgstr "Добавить фильтр изображений" ...@@ -1374,7 +1376,7 @@ msgstr "Добавить фильтр изображений"
msgid "[NAME]" msgid "[NAME]"
msgstr "[ИМЯ]" msgstr "[ИМЯ]"
#: ../src/option.c:676 ../src/pfd.c:85 #: ../src/option.c:676 ../src/tools.c:45
msgid "Print version" msgid "Print version"
msgstr "Вывести версию" msgstr "Вывести версию"
...@@ -1943,37 +1945,83 @@ msgstr "Категория" ...@@ -1943,37 +1945,83 @@ msgstr "Категория"
msgid "Icons" msgid "Icons"
msgstr "Иконки" msgstr "Иконки"
#: ../src/pfd.c:83 #: ../src/tools.c:46
msgid "STRING ..."
msgstr "СТРОКА ..."
#: ../src/tools.c:51
msgid "Pango fonts description tools"
msgstr "Преобразование названий шрифтов"
#: ../src/tools.c:52
msgid "Print font name in xft format" msgid "Print font name in xft format"
msgstr "Вывести шрифт в формате xft" msgstr "Вывести шрифт в формате xft"
#: ../src/pfd.c:84 #: ../src/tools.c:53
msgid "Print font name in pango format" msgid "Print font name in pango format"
msgstr "Вывести шрифт в формате pango" msgstr "Вывести шрифт в формате pango"
#: ../src/pfd.c:86 #: ../src/tools.c:58
msgid "FONT" msgid "Icon tools"
msgstr "ШРИФТ" msgstr "Иконки"
#: ../src/pfd.c:105 #: ../src/tools.c:59
msgid "- convert font description" msgid "Use specified icon size"
msgstr "- преобразование названий шрифтов" msgstr "Использовать указанный размер иконки"
#: ../src/pfd.c:109 #: ../src/tools.c:60
#, c-format msgid "Get icon size from GtkIconSize type"
msgid "option parsing failed: %s\n" msgstr "Получить размер иконки по типу GtkIconSize"
msgstr "сбой при разборе аргументов: %s\n"
#: ../src/tools.c:61
msgid "Use icon theme"
msgstr "Использовать указанную тему"
#: ../src/pfd.c:121 #: ../src/tools.c:140
#, c-format #, c-format
msgid "no font specified\n" msgid "no font specified\n"
msgstr "не задан шрифт.\n" msgstr "не задан шрифт.\n"
#: ../src/pfd.c:129 #: ../src/tools.c:148
#, c-format #, c-format
msgid "cannot get font description for for string \"%s\"\n" msgid "cannot get font description for for string \"%s\"\n"
msgstr "невозможно получить описание шрифта из строки \"%s\"\n" msgstr "невозможно получить описание шрифта из строки \"%s\"\n"
#: ../src/tools.c:250
#, c-format
msgid "no icon specified\n"
msgstr "иконка не задана\n"
#: ../src/tools.c:293
msgid "- yad miscellaneous tools"
msgstr "- дополнительные инструменты yad"
#: ../src/tools.c:296
msgid "PFD mode"
msgstr "Режим PFD"
#: ../src/tools.c:296
msgid "Show pfd mode options"
msgstr "Показывать параметры режима pfd"
#: ../src/tools.c:301
msgid "Icon mode"
msgstr "Режим иконок"
#: ../src/tools.c:301
msgid "Show icon mode options"
msgstr "Показывать параметры режима иконок"
#: ../src/tools.c:308
#, c-format
msgid "option parsing failed: %s\n"
msgstr "сбой при разборе аргументов: %s\n"
#: ../src/tools.c:324
#, c-format
msgid "no mode specified\n"
msgstr "не задан режим\n"
#: ../data/yad-icon-browser.desktop.in.h:1 #: ../data/yad-icon-browser.desktop.in.h:1
msgid "Icon Browser" msgid "Icon Browser"
msgstr "Броузер иконок" msgstr "Броузер иконок"
...@@ -2040,3 +2088,6 @@ msgstr "Игнорировать неизвестные арументы в ко ...@@ -2040,3 +2088,6 @@ msgstr "Игнорировать неизвестные арументы в ко
#: ../data/yad.gschema.xml.in.h:15 #: ../data/yad.gschema.xml.in.h:15
msgid "Enable debug mode with information about deprecated features" msgid "Enable debug mode with information about deprecated features"
msgstr "Разрешить режим отладки с информированием об устаревших функциях" msgstr "Разрешить режим отладки с информированием об устаревших функциях"
#~ msgid "FONT"
#~ msgstr "ШРИФТ"
# Ukrainian translation for YAD # Ukrainian translation for YAD
# This file is distributed under the same license as the YAD package. # This file is distributed under the same license as the YAD package.
# #
# Victor Ananjevsky <ananasik@gmail.com>, 2011-2020. # Victor Ananjevsky <ananasik@gmail.com>, 2011-2021.
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: YAD\n" "Project-Id-Version: YAD\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-08 18:01+0200\n" "POT-Creation-Date: 2021-03-14 10:48+0200\n"
"PO-Revision-Date: 2009-04-30 16:47+0300\n" "PO-Revision-Date: 2009-04-30 16:47+0300\n"
"Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n" "Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
...@@ -139,32 +139,32 @@ msgstr "Не можу розібрати файл %s: %s\n" ...@@ -139,32 +139,32 @@ msgstr "Не можу розібрати файл %s: %s\n"
msgid "Unable to open directory %s: %s\n" msgid "Unable to open directory %s: %s\n"
msgstr "Не можу відкрити каталог %s: %s\n" msgstr "Не можу відкрити каталог %s: %s\n"
#: ../src/main.c:134 ../src/main.c:468 #: ../src/main.c:134 ../src/main.c:473
#, c-format #, c-format
msgid "%d sec" msgid "%d sec"
msgstr "%d сек" msgstr "%d сек"
#: ../src/main.c:720 ../src/main.c:727 #: ../src/main.c:725 ../src/main.c:732
#, c-format #, c-format
msgid "Unable to parse YAD_OPTIONS: %s\n" msgid "Unable to parse YAD_OPTIONS: %s\n"
msgstr "Не можу розібрати YAD_OPTIONS: %s\n" msgstr "Не можу розібрати YAD_OPTIONS: %s\n"
#: ../src/main.c:738 #: ../src/main.c:743
#, c-format #, c-format
msgid "Unable to parse command line: %s\n" msgid "Unable to parse command line: %s\n"
msgstr "Не вдається розібрати командний рядок: %s\n" msgstr "Не вдається розібрати командний рядок: %s\n"
#: ../src/main.c:767 #: ../src/main.c:772
#, c-format #, c-format
msgid "WARNING: Using gtkrc option is deprecated, please use --css instead\n" msgid "WARNING: Using gtkrc option is deprecated, please use --css instead\n"
msgstr "УВАГА: Опція gtkrc застаріла, використовуйте --css замість неї\n" msgstr "УВАГА: Опція gtkrc застаріла, використовуйте --css замість неї\n"
#: ../src/main.c:836 #: ../src/main.c:841
#, c-format #, c-format
msgid "WARNING: --plug mode not supported outside X11\n" msgid "WARNING: --plug mode not supported outside X11\n"
msgstr "УВАГА: Опція --plug підтримується тільки в X11\n" msgstr "УВАГА: Опція --plug підтримується тільки в X11\n"
#: ../src/main.c:856 #: ../src/main.c:861
#, c-format #, c-format
msgid "WARNING: This mode not supported outside X11\n" msgid "WARNING: This mode not supported outside X11\n"
msgstr "УВАГА: Цей режим підтримується тільки в X11\n" msgstr "УВАГА: Цей режим підтримується тільки в X11\n"
...@@ -320,7 +320,7 @@ msgstr "Задати вирівнювання тексту діалогу (left, ...@@ -320,7 +320,7 @@ msgstr "Задати вирівнювання тексту діалогу (left,
#: ../src/option.c:453 ../src/option.c:463 ../src/option.c:509 #: ../src/option.c:453 ../src/option.c:463 ../src/option.c:509
#: ../src/option.c:541 ../src/option.c:551 ../src/option.c:561 #: ../src/option.c:541 ../src/option.c:551 ../src/option.c:561
#: ../src/option.c:575 ../src/option.c:636 ../src/option.c:690 #: ../src/option.c:575 ../src/option.c:636 ../src/option.c:690
#: ../src/option.c:692 #: ../src/option.c:692 ../src/tools.c:60
msgid "TYPE" msgid "TYPE"
msgstr "ТИП" msgstr "ТИП"
...@@ -336,7 +336,8 @@ msgstr "ЗОБРАЖЕННЯ" ...@@ -336,7 +336,8 @@ msgstr "ЗОБРАЖЕННЯ"
msgid "Use specified icon theme instead of default" msgid "Use specified icon theme instead of default"
msgstr "Використовувати вказану тему іконок" msgstr "Використовувати вказану тему іконок"
#: ../src/option.c:120 ../src/option.c:659 #: ../src/option.c:120 ../src/option.c:659 ../src/browser.c:217
#: ../src/tools.c:61
msgid "THEME" msgid "THEME"
msgstr "ТЕМА" msgstr "ТЕМА"
...@@ -938,6 +939,7 @@ msgid "Force using specified icon size" ...@@ -938,6 +939,7 @@ msgid "Force using specified icon size"
msgstr "Примусово використовувати розмір іконки" msgstr "Примусово використовувати розмір іконки"
#: ../src/option.c:422 ../src/option.c:532 ../src/option.c:638 #: ../src/option.c:422 ../src/option.c:532 ../src/option.c:638
#: ../src/tools.c:59
msgid "SIZE" msgid "SIZE"
msgstr "РОЗМІР" msgstr "РОЗМІР"
...@@ -1382,7 +1384,7 @@ msgstr "Додати фільтр для зображень" ...@@ -1382,7 +1384,7 @@ msgstr "Додати фільтр для зображень"
msgid "[NAME]" msgid "[NAME]"
msgstr "[ІМ'Я]" msgstr "[ІМ'Я]"
#: ../src/option.c:676 ../src/pfd.c:85 #: ../src/option.c:676 ../src/tools.c:45
msgid "Print version" msgid "Print version"
msgstr "Вивести версію" msgstr "Вивести версію"
...@@ -1951,37 +1953,83 @@ msgstr "Категорія" ...@@ -1951,37 +1953,83 @@ msgstr "Категорія"
msgid "Icons" msgid "Icons"
msgstr "Іконки" msgstr "Іконки"
#: ../src/pfd.c:83 #: ../src/tools.c:46
msgid "STRING ..."
msgstr "РЯДОК ..."
#: ../src/tools.c:51
msgid "Pango fonts description tools"
msgstr "Конвертація опису шрифта"
#: ../src/tools.c:52
msgid "Print font name in xft format" msgid "Print font name in xft format"
msgstr "Вивести назву шрифта у форматі xft" msgstr "Вивести назву шрифта у форматі xft"
#: ../src/pfd.c:84 #: ../src/tools.c:53
msgid "Print font name in pango format" msgid "Print font name in pango format"
msgstr "Вивести назву шрифта у форматі pango" msgstr "Вивести назву шрифта у форматі pango"
#: ../src/pfd.c:86 #: ../src/tools.c:58
msgid "FONT" msgid "Icon tools"
msgstr "НАЗВА_ШРИФТУ" msgstr "Іконки"
#: ../src/pfd.c:105 #: ../src/tools.c:59
msgid "- convert font description" msgid "Use specified icon size"
msgstr "- конвертація описа шрифта" msgstr "Використовувати заданий розмір іконки"
#: ../src/pfd.c:109 #: ../src/tools.c:60
#, c-format msgid "Get icon size from GtkIconSize type"
msgid "option parsing failed: %s\n" msgstr "Отримати розмір іконки с типу GtkIconSize"
msgstr "збій при розборі аргументів: %s\n"
#: ../src/tools.c:61
msgid "Use icon theme"
msgstr "Використовувати вказану тему іконок"
#: ../src/pfd.c:121 #: ../src/tools.c:140
#, c-format #, c-format
msgid "no font specified\n" msgid "no font specified\n"
msgstr "шрифт не вказано.\n" msgstr "шрифт не вказано\n"
#: ../src/pfd.c:129 #: ../src/tools.c:148
#, c-format #, c-format
msgid "cannot get font description for for string \"%s\"\n" msgid "cannot get font description for for string \"%s\"\n"
msgstr "неможливо отримати опис шрифта зі стрічки \"%s\"\n" msgstr "неможливо отримати опис шрифта зі стрічки \"%s\"\n"
#: ../src/tools.c:250
#, c-format
msgid "no icon specified\n"
msgstr "іконку не вказано\n"
#: ../src/tools.c:293
msgid "- yad miscellaneous tools"
msgstr "- додаткові інструменти yad"
#: ../src/tools.c:296
msgid "PFD mode"
msgstr "Режим PFD"
#: ../src/tools.c:296
msgid "Show pfd mode options"
msgstr "Показувати параметри режиму pfd"
#: ../src/tools.c:301
msgid "Icon mode"
msgstr "Режим іконок"
#: ../src/tools.c:301
msgid "Show icon mode options"
msgstr "Показувати параметри режиму іконок"
#: ../src/tools.c:308
#, c-format
msgid "option parsing failed: %s\n"
msgstr "збій при розборі аргументів: %s\n"
#: ../src/tools.c:324
#, c-format
msgid "no mode specified\n"
msgstr "режим не вказано\n"
#: ../data/yad-icon-browser.desktop.in.h:1 #: ../data/yad-icon-browser.desktop.in.h:1
msgid "Icon Browser" msgid "Icon Browser"
msgstr "Навігатор іконок" msgstr "Навігатор іконок"
...@@ -2049,3 +2097,6 @@ msgstr "Ігнорувати невідомі аргументи" ...@@ -2049,3 +2097,6 @@ msgstr "Ігнорувати невідомі аргументи"
#: ../data/yad.gschema.xml.in.h:15 #: ../data/yad.gschema.xml.in.h:15
msgid "Enable debug mode with information about deprecated features" msgid "Enable debug mode with information about deprecated features"
msgstr "Дозволити режим налагодження з інформуванням про застарілі функції" msgstr "Дозволити режим налагодження з інформуванням про застарілі функції"
#~ msgid "FONT"
#~ msgstr "НАЗВА_ШРИФТУ"
...@@ -42,12 +42,13 @@ endif ...@@ -42,12 +42,13 @@ endif
yad_CFLAGS = $(GTK_CFLAGS) $(HTML_CFLAGS) $(SPELL_CFLAGS) $(SOURCEVIEW_CFLAGS) yad_CFLAGS = $(GTK_CFLAGS) $(HTML_CFLAGS) $(SPELL_CFLAGS) $(SOURCEVIEW_CFLAGS)
yad_LDADD = $(GTK_LIBS) $(HTML_LIBS) $(SPELL_LIBS) $(SOURCEVIEW_LIBS) yad_LDADD = $(GTK_LIBS) $(HTML_LIBS) $(SPELL_LIBS) $(SOURCEVIEW_LIBS)
if BUILD_PFD if BUILD_TOOLS
bin_PROGRAMS += pfd bin_PROGRAMS += yad-tools
bin_SCRIPTS = pfd
pfd_SOURCES = pfd.c yad_tools_SOURCES = tools.c
pfd_CFLAGS = $(PFD_CFLAGS) yad_tools_CFLAGS = $(GTK_CFLAGS)
pfd_LDADD = $(PFD_LIBS) yad_tools_LDADD = $(GTK_LIBS)
endif endif
if BUILD_IB if BUILD_IB
......
#! /bin/bash
echo "WARNING: pfd is deprecated. Please use yad-tools --pfd instead" > /dev/stderr
exec yad-tools --pfd "$@"
...@@ -19,20 +19,51 @@ ...@@ -19,20 +19,51 @@
#include <config.h> #include <config.h>
#include <glib.h> #include <gtk/gtk.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <pango/pango.h>
#include <locale.h>
typedef enum { typedef enum {
PANGO_SPEC, PANGO_SPEC,
XFT_SPEC XFT_SPEC
} FontType; } FontType;
static gboolean set_font_type (const gchar *name, const gchar *val, gpointer d, GError **err);
static gboolean set_size_type (const gchar *name, const gchar *val, gpointer d, GError **err);
static FontType font_type = XFT_SPEC; static FontType font_type = XFT_SPEC;
static gboolean pfd_mode = FALSE;
static gboolean icon_mode = FALSE;
static gboolean ver = FALSE;
static guint icon_size = 24;
static gchar *icon_theme_name = NULL;
static gchar **args = NULL;
static GOptionEntry ents[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &ver, N_("Print version"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL, N_("STRING ...") },
{ NULL }
};
static GOptionEntry pfd_ents[] = {
{ "pfd", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &pfd_mode, N_("Pango fonts description tools"), NULL },
{ "xft", 'x', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_font_type, N_("Print font name in xft format"), NULL },
{ "pango", 'p', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_font_type, N_("Print font name in pango format"), NULL },
{ NULL }
};
static GOptionEntry icon_ents[] = {
{ "icon", 'i', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &icon_mode, N_("Icon tools"), NULL },
{ "size", 's', 0, G_OPTION_ARG_INT, &icon_size, N_("Use specified icon size"), N_("SIZE") },
{ "type", 't', 0, G_OPTION_ARG_CALLBACK, set_size_type, N_("Get icon size from GtkIconSize type"), N_("TYPE") },
{ "theme", 0, 0, G_OPTION_ARG_STRING, &icon_theme_name, N_("Use icon theme"), N_("THEME") },
{ NULL }
};
static gboolean static gboolean
set_type (const gchar *name, const gchar *val, gpointer d, GError **err) set_font_type (const gchar *name, const gchar *val, gpointer d, GError **err)
{ {
gint i = 1; gint i = 1;
...@@ -49,6 +80,28 @@ set_type (const gchar *name, const gchar *val, gpointer d, GError **err) ...@@ -49,6 +80,28 @@ set_type (const gchar *name, const gchar *val, gpointer d, GError **err)
return TRUE; return TRUE;
} }
static gboolean
set_size_type (const gchar *name, const gchar *val, gpointer d, GError **err)
{
gint w = 0, h = 0;
if (strcasecmp (val, "MENU") == 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
else if (strcasecmp (val, "BUTTON") == 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
else if (strcasecmp (val, "SMALL_TOOLBAR") == 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_SMALL_TOOLBAR, &w, &h);
else if (strcasecmp (val, "LARGE_TOOLBAR") == 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &w, &h);
else if (strcasecmp (val, "DND") == 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &w, &h);
else if (strcasecmp (val, "DIALOG") == 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &w, &h);
if (w && h)
icon_size = MIN (w, h);
}
static gchar * static gchar *
parse_font (gchar *fn) parse_font (gchar *fn)
{ {
...@@ -77,56 +130,22 @@ parse_font (gchar *fn) ...@@ -77,56 +130,22 @@ parse_font (gchar *fn)
return pfd->str; return pfd->str;
} }
static gchar **fonts = NULL; static gint
static gboolean ver = FALSE; run_pfd_mode ()
static GOptionEntry ents[] = {
{ "xft", 'x', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_type, N_("Print font name in xft format"), NULL },
{ "pango", 'p', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, set_type, N_("Print font name in pango format"), NULL },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &ver, N_("Print version"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &fonts, 0, N_("FONT") },
{ NULL }
};
int
main (int argc, char *argv[])
{ {
GOptionContext *ctx;
GError *err = NULL;
PangoFontDescription *fnd = NULL; PangoFontDescription *fnd = NULL;
setlocale (LC_ALL, ""); if (!args || !args[0])
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
ctx = g_option_context_new (_("- convert font description"));
g_option_context_add_main_entries (ctx, ents, GETTEXT_PACKAGE);
if (!g_option_context_parse (ctx, &argc, &argv, &err))
{
g_printerr (_("option parsing failed: %s\n"), err->message);
return 1;
}
if (ver)
{
g_print ("%s\n", VERSION);
return 0;
}
if (!fonts || !fonts[0])
{ {
g_printerr (_("no font specified\n")); g_printerr (_("no font specified\n"));
return 1; return 1;
} }
/* parse font */ /* parse font */
fnd = pango_font_description_from_string (parse_font (fonts[0])); fnd = pango_font_description_from_string (parse_font (args[0]));
if (!fnd) if (!fnd)
{ {
g_printerr (_("cannot get font description for for string \"%s\"\n"), fonts[0]); g_printerr (_("cannot get font description for for string \"%s\"\n"), args[0]);
return 1; return 1;
} }
...@@ -218,3 +237,93 @@ main (int argc, char *argv[]) ...@@ -218,3 +237,93 @@ main (int argc, char *argv[])
return 0; return 0;
} }
static gint
run_icon_mode ()
{
GtkIconTheme *theme;
GtkIconInfo *ii;
const gchar *filename;
if (!args || !args[0])
{
g_printerr (_("no icon specified\n"));
return 1;
}
if (icon_theme_name)
{
theme = gtk_icon_theme_new ();
gtk_icon_theme_set_custom_theme (theme, icon_theme_name);
}
else
theme = gtk_icon_theme_get_default ();
ii = gtk_icon_theme_lookup_icon (theme, args[0], icon_size, 0);
if (ii == NULL)
return 1;
filename = gtk_icon_info_get_filename (ii);
if (filename)
g_print ("%s\n", filename);
else
return 1;
return 0;
}
int
main (int argc, char *argv[])
{
GOptionContext *ctx;
GOptionGroup *grp;
GError *err = NULL;
gint ret = 0;
setlocale (LC_ALL, "");
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
gtk_init (&argc, &argv);
ctx = g_option_context_new (_("- yad miscellaneous tools"));
g_option_context_add_main_entries (ctx, ents, GETTEXT_PACKAGE);
grp = g_option_group_new ("pfd", _("PFD mode"), _("Show pfd mode options"), NULL, NULL);
g_option_group_add_entries (grp, pfd_ents);
g_option_group_set_translation_domain (grp, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, grp);
grp = g_option_group_new ("icon", _("Icon mode"), _("Show icon mode options"), NULL, NULL);
g_option_group_add_entries (grp, icon_ents);
g_option_group_set_translation_domain (grp, GETTEXT_PACKAGE);
g_option_context_add_group (ctx, grp);
if (!g_option_context_parse (ctx, &argc, &argv, &err))
{
g_printerr (_("option parsing failed: %s\n"), err->message);
return 1;
}
if (ver)
{
g_print ("%s\n", VERSION);
return 0;
}
if (pfd_mode)
ret = run_pfd_mode ();
else if (icon_mode)
ret = run_icon_mode ();
else
{
g_printerr (_("no mode specified\n"));
return 1;
}
return ret;
}
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