gnome-control-center/capplets/common/gnome-theme-test.c

135 lines
3.1 KiB
C
Raw Normal View History

#include <config.h>
#include <gtk/gtk.h>
#include <string.h>
#include <libgnome/gnome-desktop-item.h>
#include "gnome-theme-info.h"
int
main (int argc, char *argv[])
{
GList *themes, *list;
g_thread_init (NULL);
gtk_init (&argc, &argv);
port from gnome-vfs to gio (part of bug #524401) 2008-05-01 Jens Granseuer <jensgr@gmx.net> * gnome-theme-apply.c: * gnome-theme-info.c: (get_file_type), (add_theme_to_hash_by_name), (get_theme_from_hash_by_name), (gnome_theme_read_meta_theme), (read_icon_theme), (gdk_pixbuf_from_xcursor_image), (read_cursor_theme), (handle_change_signal), (update_theme_index), (update_gtk2_index), (update_keybinding_index), (update_metacity_index), (update_common_theme_dir_index), (update_meta_theme_index), (update_icon_theme_index), (update_cursor_theme_index), (gtk2_dir_changed), (keybinding_dir_changed), (metacity_dir_changed), (common_theme_dir_changed), (common_icon_theme_dir_changed), (add_common_theme_dir_monitor), (add_common_icon_theme_dir_monitor), (remove_common_theme_dir_monitor), (remove_common_icon_theme_dir_monitor), (top_theme_dir_changed), (top_icon_theme_dir_changed), (real_add_top_theme_dir_monitor), (add_top_theme_dir_monitor), (add_top_icon_theme_dir_monitor), (gnome_theme_init): * gnome-theme-info.h: * gnome-theme-test.c: (main): port from gnome-vfs to gio (part of bug #524401) 2008-05-01 Jens Granseuer <jensgr@gmx.net> * appearance-themes.c: (themes_init): update for changes in the theme-info API 2008-05-01 Jens Granseuer <jensgr@gmx.net> * theme-method.c: (vfs_module_init): * themus-properties-view.c: (themus_properties_view_init), (themus_properties_view_set_location): * themus-theme-applier.c: (main): update users of the theme-info API svn path=/trunk/; revision=8681
2008-05-01 09:08:07 +00:00
gnome_theme_init ();
themes = gnome_theme_meta_info_find_all ();
if (themes == NULL)
{
g_print ("No meta themes were found.\n");
}
else
{
g_print ("%d meta themes were found:\n", g_list_length (themes));
for (list = themes; list; list = list->next)
{
GnomeThemeMetaInfo *meta_theme_info;
meta_theme_info = list->data;
g_print ("\t%s\n", meta_theme_info->readable_name);
}
}
g_list_free (themes);
themes = gnome_theme_icon_info_find_all ();
if (themes == NULL)
{
g_print ("No icon themes were found.\n");
}
else
{
g_print ("%d icon themes were found:\n", g_list_length (themes));
for (list = themes; list; list = list->next)
{
GnomeThemeIconInfo *icon_theme_info;
icon_theme_info = list->data;
g_print ("\t%s\n", icon_theme_info->name);
}
}
g_list_free (themes);
themes = gnome_theme_info_find_by_type (GNOME_THEME_METACITY);
if (themes == NULL)
{
g_print ("No metacity themes were found.\n");
}
else
{
g_print ("%d metacity themes were found:\n", g_list_length (themes));
for (list = themes; list; list = list->next)
{
GnomeThemeInfo *theme_info;
theme_info = list->data;
g_print ("\t%s\n", theme_info->name);
}
}
g_list_free (themes);
themes = gnome_theme_info_find_by_type (GNOME_THEME_GTK_2);
if (themes == NULL)
{
gchar *str;
g_print ("No gtk-2 themes were found. The following directories were tested:\n");
str = gtk_rc_get_theme_dir ();
g_print ("\t%s\n", str);
g_free (str);
str = g_build_filename (g_get_home_dir (), ".themes", NULL);
g_print ("\t%s\n", str);
g_free (str);
}
else
{
g_print ("%d gtk-2 themes were found:\n", g_list_length (themes));
for (list = themes; list; list = list->next)
{
GnomeThemeInfo *theme_info;
theme_info = list->data;
g_print ("\t%s\n", theme_info->name);
}
}
g_list_free (themes);
themes = gnome_theme_info_find_by_type (GNOME_THEME_GTK_2_KEYBINDING);
if (themes == NULL)
{
g_print ("No keybinding themes were found.\n");
}
else
{
g_print ("%d keybinding themes were found:\n", g_list_length (themes));
for (list = themes; list; list = list->next)
{
GnomeThemeInfo *theme_info;
theme_info = list->data;
g_print ("\t%s\n", theme_info->name);
}
}
g_list_free (themes);
themes = gnome_theme_cursor_info_find_all ();
if (themes == NULL)
{
g_print ("No cursor themes were found.\n");
}
else
{
g_print ("%d cursor themes were found:\n", g_list_length (themes));
for (list = themes; list; list = list->next)
{
GnomeThemeCursorInfo *cursor_theme_info;
cursor_theme_info = list->data;
g_print ("\t%s\n", cursor_theme_info->name);
}
}
g_list_free (themes);
return 0;
}