Commit 73b3cd88 authored by Victor Ananjevsky's avatar Victor Ananjevsky

move --show-lang and --show-themes functions to yad-tools

parent f72acd1e
......@@ -1463,7 +1463,7 @@ msgstr "Показать список языков проверки орфогр
#: ../src/option.c:717
msgid "Show list of GtkSourceView themes"
msgstr "Показать список текм для GtkSourceView"
msgstr "Показать список тем для GtkSourceView"
#: ../src/option.c:720
msgid "Load additional CSS settings from file or string"
......
......@@ -46,8 +46,8 @@ if BUILD_TOOLS
bin_PROGRAMS += yad-tools
yad_tools_SOURCES = tools.c
yad_tools_CFLAGS = $(GTK_CFLAGS)
yad_tools_LDADD = $(GTK_LIBS)
yad_tools_CFLAGS = $(GTK_CFLAGS) $(SPELL_CFLAGS) $(SOURCEVIEW_CFLAGS)
yad_tools_LDADD = $(GTK_LIBS) $(SPELL_LIBS) $(SOURCEVIEW_LIBS)
endif
if BUILD_IB
......
......@@ -875,18 +875,6 @@ main (gint argc, gchar ** argv)
g_print ("%s (GTK+ %d.%d.%d)\n", VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version);
break;
#ifdef HAVE_SPELL
case YAD_MODE_LANGS:
show_langs ();
break;
#endif
#ifdef HAVE_SOURCEVIEW
case YAD_MODE_THEMES:
show_themes ();
break;
#endif
#ifdef HAVE_TRAY
case YAD_MODE_NOTIFICATION:
ret = yad_notification_run ();
......
......@@ -63,12 +63,6 @@ static gboolean set_smart_homend (const gchar *, const gchar *, gpointer, GError
static gboolean about_mode = FALSE;
static gboolean version_mode = FALSE;
#ifdef HAVE_SPELL
static gboolean langs_mode = FALSE;
#endif
#ifdef HAVE_SOURCEVIEW
static gboolean themes_mode = FALSE;
#endif
static gboolean app_mode = FALSE;
static gboolean calendar_mode = FALSE;
static gboolean color_mode = FALSE;
......@@ -708,14 +702,6 @@ static GOptionEntry filter_options[] = {
static GOptionEntry misc_options[] = {
{ "version", 0, 0, G_OPTION_ARG_NONE, &version_mode,
N_("Print version"), NULL },
#ifdef HAVE_SPELL
{ "show-langs", 0, 0, G_OPTION_ARG_NONE, &langs_mode,
N_("Show list of spell languages"), NULL },
#endif
#ifdef HAVE_SOURCEVIEW
{ "show-themes", 0, 0, G_OPTION_ARG_NONE, &themes_mode,
N_("Show list of GtkSourceView themes"), NULL },
#endif
{ "css", 0, 0, G_OPTION_ARG_STRING, &options.css,
N_("Load additional CSS settings from file or string"), N_("STRING") },
{ "gtkrc", 0, 0, G_OPTION_ARG_FILENAME, &options.gtkrc_file,
......@@ -1527,14 +1513,6 @@ yad_set_mode (void)
options.mode = YAD_MODE_ABOUT;
else if (version_mode)
options.mode = YAD_MODE_VERSION;
#ifdef HAVE_SPELL
else if (langs_mode)
options.mode = YAD_MODE_LANGS;
#endif
#ifdef HAVE_SOURCEVIEW
else if (themes_mode)
options.mode = YAD_MODE_THEMES;
#endif
}
void
......
......@@ -22,6 +22,14 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#ifdef HAVE_SPELL
#include <gspell/gspell.h>
#endif
#ifdef HAVE_SOURCEVIEW
#include <gtksourceview/gtksource.h>
#endif
typedef enum {
PANGO_SPEC,
XFT_SPEC
......@@ -35,6 +43,12 @@ static FontType font_type = XFT_SPEC;
static gboolean pfd_mode = FALSE;
static gboolean icon_mode = FALSE;
static gboolean ver = FALSE;
#ifdef HAVE_SPELL
static gboolean langs_mode = FALSE;
#endif
#ifdef HAVE_SOURCEVIEW
static gboolean themes_mode = FALSE;
#endif
static guint icon_size = 24;
static gchar *icon_theme_name = NULL;
......@@ -43,6 +57,12 @@ static gchar **args = NULL;
static GOptionEntry ents[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &ver, N_("Print version"), NULL },
#ifdef HAVE_SPELL
{ "show-langs", 0, 0, G_OPTION_ARG_NONE, &langs_mode, N_("Show list of spell languages"), NULL },
#endif
#ifdef HAVE_SOURCEVIEW
{ "show-themes", 0, 0, G_OPTION_ARG_NONE, &themes_mode, N_("Show list of GtkSourceView themes"), NULL },
#endif
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL, N_("STRING ...") },
{ NULL }
};
......@@ -272,6 +292,45 @@ run_icon_mode ()
return 0;
}
#ifdef HAVE_SPELL
static gint
show_langs ()
{
const GList *lng;
for (lng = gspell_language_get_available (); lng; lng = lng->next)
{
const GspellLanguage *l = lng->data;
g_print ("%s\n", gspell_language_get_code (l));
}
return 0;
}
#endif
#ifdef HAVE_SOURCEVIEW
static gint
show_themes ()
{
GtkSourceStyleSchemeManager *sm;
const gchar **si;
guint i = 0;
sm = gtk_source_style_scheme_manager_get_default ();
if ((si = (const gchar **) gtk_source_style_scheme_manager_get_scheme_ids (sm)) == NULL)
return 1;
while (si[i])
{
GtkSourceStyleScheme *s = gtk_source_style_scheme_manager_get_scheme (sm, si[i]);
g_print ("%s\n", gtk_source_style_scheme_get_name (s));
i++;
}
return 0;
}
#endif
int
main (int argc, char *argv[])
{
......@@ -319,6 +378,14 @@ main (int argc, char *argv[])
ret = run_pfd_mode ();
else if (icon_mode)
ret = run_icon_mode ();
#ifdef HAVE_SPELL
else if (langs_mode)
ret = show_langs ();
#endif
#ifdef HAVE_SOURCEVIEW
else if (themes_mode)
ret = show_themes ();
#endif
else
{
g_printerr (_("no mode specified\n"));
......
......@@ -823,38 +823,3 @@ open_uri (const gchar *uri)
run_command_async (cmdline);
g_free (cmdline);
}
#ifdef HAVE_SPELL
void
show_langs ()
{
const GList *lng;
for (lng = gspell_language_get_available (); lng; lng = lng->next)
{
const GspellLanguage *l = lng->data;
g_print ("%s\n", gspell_language_get_code (l));
}
}
#endif
#ifdef HAVE_SOURCEVIEW
void
show_themes ()
{
GtkSourceStyleSchemeManager *sm;
const gchar **si;
guint i = 0;
sm = gtk_source_style_scheme_manager_get_default ();
if ((si = (const gchar **) gtk_source_style_scheme_manager_get_scheme_ids (sm)) == NULL)
return;
while (si[i])
{
GtkSourceStyleScheme *s = gtk_source_style_scheme_manager_get_scheme (sm, si[i]);
g_print ("%s\n", gtk_source_style_scheme_get_name (s));
i++;
}
}
#endif
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