2015-10-12 11:11:36 +00:00
|
|
|
/* Copyright 2015 Timm Bäder
|
|
|
|
*
|
2023-07-21 11:05:25 +00:00
|
|
|
* GTK is free software; you can redistribute it and/or modify it
|
2015-10-12 11:11:36 +00:00
|
|
|
* under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GLib is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2023-07-21 11:05:25 +00:00
|
|
|
* License along with GTK; see the file COPYING. If not,
|
2015-10-12 11:11:36 +00:00
|
|
|
* see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-10-07 09:26:53 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
GtkSettings *settings;
|
|
|
|
GParamSpec **props;
|
|
|
|
guint n_properties;
|
2016-04-16 11:57:32 +00:00
|
|
|
guint i;
|
2015-10-07 09:26:53 +00:00
|
|
|
int max_prop_name_length = 0;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *pattern = NULL;
|
2015-10-07 09:26:53 +00:00
|
|
|
|
2016-12-28 13:53:22 +00:00
|
|
|
gtk_init ();
|
2015-10-07 09:26:53 +00:00
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
pattern = argv[1];
|
|
|
|
|
|
|
|
settings = gtk_settings_get_default ();
|
|
|
|
props = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), &n_properties);
|
|
|
|
|
|
|
|
for (i = 0; i < n_properties; i ++)
|
|
|
|
{
|
|
|
|
int len = strlen (props[i]->name);
|
|
|
|
|
|
|
|
if (len > max_prop_name_length)
|
|
|
|
max_prop_name_length = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_properties; i ++)
|
|
|
|
{
|
|
|
|
GValue value = {0};
|
|
|
|
GParamSpec *prop = props[i];
|
2020-07-24 18:40:36 +00:00
|
|
|
char *value_str;
|
2016-04-30 10:10:14 +00:00
|
|
|
int spacing = max_prop_name_length - strlen (prop->name) + 1;
|
|
|
|
gboolean deprecated;
|
2015-10-07 09:26:53 +00:00
|
|
|
|
|
|
|
if (pattern && !g_strrstr (prop->name, pattern))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
g_value_init (&value, prop->value_type);
|
|
|
|
g_object_get_property (G_OBJECT (settings), prop->name, &value);
|
2016-04-30 10:10:14 +00:00
|
|
|
deprecated = prop->flags & G_PARAM_DEPRECATED;
|
2015-10-07 09:26:53 +00:00
|
|
|
|
|
|
|
if (G_VALUE_HOLDS_ENUM (&value))
|
|
|
|
{
|
|
|
|
GEnumClass *enum_class = G_PARAM_SPEC_ENUM (prop)->enum_class;
|
|
|
|
GEnumValue *enum_value = g_enum_get_value (enum_class, g_value_get_enum (&value));
|
|
|
|
|
|
|
|
value_str = g_strdup (enum_value->value_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value_str = g_strdup_value_contents (&value);
|
|
|
|
}
|
|
|
|
|
2016-04-30 10:10:14 +00:00
|
|
|
if (deprecated)
|
|
|
|
{
|
|
|
|
printf ("!");
|
|
|
|
spacing --;
|
|
|
|
}
|
|
|
|
|
2015-10-07 09:26:53 +00:00
|
|
|
for (; spacing >= 0; spacing --)
|
|
|
|
printf (" ");
|
|
|
|
|
|
|
|
printf ("%s: %s\n", prop->name, value_str);
|
|
|
|
|
|
|
|
g_free (value_str);
|
|
|
|
g_value_unset (&value);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (props);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|