2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of quvi <http://quvi.sourceforge.net/>.
6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
23 #include <glib/gi18n.h>
27 void lopts_print_config_values(lopts_t lopts
)
29 const GOptionEntry
*p
;
31 g_assert(lopts
!= NULL
);
32 g_assert(lopts
->entries
!= NULL
);
34 g_print(_("# Value of all configuration options\n"));
38 while (p
->long_name
!= NULL
)
40 if (g_strcmp0(p
->long_name
, G_OPTION_REMAINING
) != 0)
44 case G_OPTION_ARG_FILENAME_ARRAY
:
45 case G_OPTION_ARG_STRING_ARRAY
:
47 gchar
**sv
= *(gchar
***) p
->arg_data
;
50 gchar
*s
= g_strjoinv(",", sv
);
51 g_print("%s=%s\n", p
->long_name
, s
);
55 g_print(_("%s is unset\n"), p
->long_name
);
59 case G_OPTION_ARG_FILENAME
:
60 case G_OPTION_ARG_STRING
:
62 const gchar
*s
= *(const gchar
**) p
->arg_data
;
64 g_print("%s=%s\n", p
->long_name
, s
);
66 g_print(_("%s is unset\n"), p
->long_name
);
70 case G_OPTION_ARG_DOUBLE
:
71 g_print("%s=%g\n", p
->long_name
, *(gdouble
*) p
->arg_data
);
74 case G_OPTION_ARG_INT64
:
75 g_print("%s=%"G_GINT64_FORMAT
"\n",
76 p
->long_name
, *(gint64
*) p
->arg_data
);
79 case G_OPTION_ARG_NONE
:
81 const gboolean r
= (*(gboolean
*) p
->arg_data
);
83 g_print(_("%s is set\n"), p
->long_name
);
85 g_print(_("%s is unset\n"), p
->long_name
);
89 case G_OPTION_ARG_INT
:
90 g_print("%s=%d\n", p
->long_name
, *(gint
*) p
->arg_data
);
93 case G_OPTION_ARG_CALLBACK
:
102 extern gchar
**search_dirs();
104 void lopts_print_config_paths(lopts_t lopts
)
106 gchar
*rcpath
, **dirs
, *p
;
109 g_print(_("# Search paths for the configuration file\n#\n"));
111 rcpath
= g_build_path(G_DIR_SEPARATOR_S
, "quvi", "quvirc", NULL
);
112 dirs
= search_dirs();
115 while (dirs
[i
] != NULL
)
117 p
= g_build_path(G_DIR_SEPARATOR_S
, dirs
[i
++], rcpath
, NULL
);
125 /* vim: set ts=2 sw=2 tw=72 expandtab: */