Commit 7f0eeed8 authored by Victor Ananjevsky's avatar Victor Ananjevsky

add icons filter (by command line) to icon browser

parent fd2d308d
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: YAD\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-21 08:51+0300\n"
"POT-Creation-Date: 2019-07-23 14:11+0300\n"
"PO-Revision-Date: 2009-04-30 16:47+0300\n"
"Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n"
"Language-Team: \n"
......@@ -176,22 +176,22 @@ msgstr "Не могу разобрать YAD_OPTIONS: %s\n"
msgid "Unable to parse command line: %s\n"
msgstr "Не удается разобрать командную строку: %s\n"
#: ../src/notification.c:129
#: ../src/notification.c:131
#, c-format
msgid "Could not load notification icon '%s': %s\n"
msgstr "Не удается загрузить иконку '%s': %s\n"
#: ../src/notification.c:319
#: ../src/notification.c:335
#, c-format
msgid "Invalid UTF-8 in tooltip!\n"
msgstr "Неверная последовательность UTF-8 в подсказке!\n"
#: ../src/notification.c:345
#: ../src/notification.c:363
#, c-format
msgid "Unknown command '%s'\n"
msgstr "Неизвестная команда '%s'\n"
#: ../src/notification.c:379
#: ../src/notification.c:400
msgid "Yad notification"
msgstr "Диалог уведомлений"
......@@ -1777,40 +1777,48 @@ msgstr "Настройки"
msgid "Yes"
msgstr "Да"
#: ../src/browser.c:128
#: ../src/browser.c:144
msgid "scalable "
msgstr "масштабируемый "
#: ../src/browser.c:138
#: ../src/browser.c:154
msgid "built-in"
msgstr "встроенный"
#: ../src/browser.c:198
msgid "Show all icons"
msgstr "Показывать все иконки"
#: ../src/browser.c:199
msgid "Show only symbolic icons"
msgstr "Показывать только символьные иконки"
#. initialize GTK+ and parse the command line arguments
#: ../src/browser.c:196
#: ../src/browser.c:215
msgid "- Icon browser"
msgstr "- Броузер иконок"
#: ../src/browser.c:209
#: ../src/browser.c:239
msgid "Icon browser"
msgstr "Броузер иконок"
#: ../src/browser.c:229
#: ../src/browser.c:259
msgid "<b>Name:</b>"
msgstr "<b>Имя:</b>"
#: ../src/browser.c:240
#: ../src/browser.c:270
msgid "<b>Sizes:</b>"
msgstr "<b>Размеры:</b>"
#: ../src/browser.c:251
#: ../src/browser.c:281
msgid "<b>Filename:</b>"
msgstr "<b>Имя файла:</b>"
#: ../src/browser.c:282
#: ../src/browser.c:312
msgid "Category"
msgstr "Категория"
#: ../src/browser.c:313
#: ../src/browser.c:343
msgid "Icons"
msgstr "Иконки"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: YAD\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-21 08:51+0300\n"
"POT-Creation-Date: 2019-07-23 14:11+0300\n"
"PO-Revision-Date: 2009-04-30 16:47+0300\n"
"Last-Translator: Victor Ananjevsky <ananasik@gmail.com>\n"
"Language-Team: \n"
......@@ -176,22 +176,22 @@ msgstr "Не можу розібрати YAD_OPTIONS: %s\n"
msgid "Unable to parse command line: %s\n"
msgstr "Не вдається розібрати командний рядок: %s\n"
#: ../src/notification.c:129
#: ../src/notification.c:131
#, c-format
msgid "Could not load notification icon '%s': %s\n"
msgstr "Не вдається завантажити іконку '%s': %s\n"
#: ../src/notification.c:319
#: ../src/notification.c:335
#, c-format
msgid "Invalid UTF-8 in tooltip!\n"
msgstr "Неправильна послідовність UTF-8 у підказці!\n"
#: ../src/notification.c:345
#: ../src/notification.c:363
#, c-format
msgid "Unknown command '%s'\n"
msgstr "Невідома команда '%s'\n"
#: ../src/notification.c:379
#: ../src/notification.c:400
msgid "Yad notification"
msgstr "Діалог повідомлень"
......@@ -1782,40 +1782,48 @@ msgstr "Налаштування"
msgid "Yes"
msgstr "Так"
#: ../src/browser.c:128
#: ../src/browser.c:144
msgid "scalable "
msgstr "масштабований "
#: ../src/browser.c:138
#: ../src/browser.c:154
msgid "built-in"
msgstr "вбудований"
#: ../src/browser.c:198
msgid "Show all icons"
msgstr "Показувати всі іконки"
#: ../src/browser.c:199
msgid "Show only symbolic icons"
msgstr "Показувати тільки символьні іконки"
#. initialize GTK+ and parse the command line arguments
#: ../src/browser.c:196
#: ../src/browser.c:215
msgid "- Icon browser"
msgstr "- Навігатор іконок"
#: ../src/browser.c:209
#: ../src/browser.c:239
msgid "Icon browser"
msgstr "Навігатор іконок"
#: ../src/browser.c:229
#: ../src/browser.c:259
msgid "<b>Name:</b>"
msgstr "<b>Назва:</b>"
#: ../src/browser.c:240
#: ../src/browser.c:270
msgid "<b>Sizes:</b>"
msgstr "<b>Розміри:</b>"
#: ../src/browser.c:251
#: ../src/browser.c:281
msgid "<b>Filename:</b>"
msgstr "<b>Назва файлу:</b>"
#: ../src/browser.c:282
#: ../src/browser.c:312
msgid "Category"
msgstr "Категорія"
#: ../src/browser.c:313
#: ../src/browser.c:343
msgid "Icons"
msgstr "Іконки"
......
......@@ -37,6 +37,9 @@ typedef struct {
GHashTable *icons;
} IconBrowserData;
static gboolean show_regular = TRUE;
static gboolean show_symbolic = FALSE;
static gboolean
key_press_cb (GtkWidget * w, GdkEventKey * ev, gpointer data)
{
......@@ -65,8 +68,22 @@ load_icon_cat (IconBrowserData * data, gchar * cat)
{
GtkTreeIter iter;
GdkPixbuf *pb, *spb;
GtkIconInfo *info;
info = gtk_icon_theme_lookup_icon (data->theme, i->data, size, 0);
if (gtk_icon_info_is_symbolic (info))
{
if (!show_symbolic)
continue;
}
else
{
if (!show_regular)
continue;
}
g_object_unref (info);
spb = pb = gtk_icon_theme_load_icon (data->theme, i->data, size, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
spb = pb = gtk_icon_theme_load_icon (data->theme, i->data, size, 0, NULL);
if (pb)
{
......@@ -85,9 +102,8 @@ load_icon_cat (IconBrowserData * data, gchar * cat)
if (pb)
g_object_unref (pb);
g_free (i->data);
}
g_list_free (icons);
g_list_free_full (icons, g_free);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), 1, GTK_SORT_ASCENDING);
......@@ -176,10 +192,13 @@ main (gint argc, gchar * argv[])
GtkTreeViewColumn *col;
GtkCellRenderer *r;
GtkWidget *w, *p, *box, *t;
gboolean all = FALSE, symbolic = FALSE;
GOptionEntry entrs[] = {
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &themes, NULL, NULL},
{NULL}
{ "all", 'a', 0, G_OPTION_ARG_NONE, &all, _("Show all icons"), NULL },
{ "symbolic", 's', 0, G_OPTION_ARG_NONE, &symbolic, _("Show only symbolic icons"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &themes, NULL, NULL },
{ NULL }
};
data = g_new0 (IconBrowserData, 1);
......@@ -195,6 +214,17 @@ main (gint argc, gchar * argv[])
/* initialize GTK+ and parse the command line arguments */
gtk_init_with_args (&argc, &argv, _("- Icon browser"), entrs, GETTEXT_PACKAGE, NULL);
if (all)
{
show_regular = TRUE;
show_symbolic = TRUE;
}
else if (symbolic)
{
show_regular = FALSE;
show_symbolic = TRUE;
}
/* load icon theme */
if (themes && themes[0])
{
......
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