Add new Makefiles ditto Add keybindings dialog
2002-03-17 Jonathan Blandford <jrb@redhat.com> * Makefile.am: Add new Makefiles * configure.in: ditto * capplets/Makefile.am: Add keybindings dialog * capplets/keybindings/.cvsignore: shut up CVS * capplets/keybindings/Makefile.am: * capplets/keybindings/eggcellrendererkeys.c: * capplets/keybindings/eggcellrendererkeys.h: * capplets/keybindings/gnome-keybinding-properties.c: * capplets/keybindings/gnome-keybinding-properties.glade: * capplets/keybindings/keybinding.desktop.in: New properties dialog. Seems to work * schemas/.cvsignore: shut up CVS * schemas/Makefile.am: * schemas/apps_gnome_keybinding_properties.schemas: New schemas file for configuring the keybinding schemas. * schemas/background.schemas: Remove unneeded schemas files * schemas/peripherals.schemas: * schemas/screensaver.schemas:
This commit is contained in:
parent
ee92876cb3
commit
ac9331cf2b
28 changed files with 1703 additions and 382 deletions
91
capplets/common/theme-common.c
Normal file
91
capplets/common/theme-common.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
#include <config.h>
|
||||
|
||||
#include <gnome.h>
|
||||
#include <glade/glade.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include "theme-common.h"
|
||||
|
||||
static GList *
|
||||
themes_common_list_add_dir (GList *list,
|
||||
const char *dirname)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
const gchar *suffix = "gtk-2.0";
|
||||
const gchar *key_suffix = "gtk-2.0-key";
|
||||
|
||||
g_return_val_if_fail (dirname != NULL, list);
|
||||
|
||||
dir = opendir (dirname);
|
||||
if (!dir)
|
||||
return list;
|
||||
|
||||
while ((de = readdir (dir)))
|
||||
{
|
||||
char *tmp;
|
||||
ThemeInfo *info = NULL;
|
||||
|
||||
if (de->d_name[0] == '.')
|
||||
continue;
|
||||
|
||||
tmp = g_build_filename (dirname, de->d_name, suffix, NULL);
|
||||
if (g_file_test (tmp, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
info = g_new0 (ThemeInfo, 1);
|
||||
info->path = g_build_filename (dirname, de->d_name, NULL);
|
||||
info->name = g_strdup (de->d_name);
|
||||
|
||||
info->has_gtk = TRUE;
|
||||
}
|
||||
g_free (tmp);
|
||||
|
||||
tmp = g_build_filename (dirname, de->d_name, key_suffix, NULL);
|
||||
if (g_file_test (tmp, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
if (info == NULL)
|
||||
{
|
||||
info = g_new0 (ThemeInfo, 1);
|
||||
info->path = g_build_filename (dirname, de->d_name, NULL);
|
||||
info->name = g_strdup (de->d_name);
|
||||
}
|
||||
info->has_keybinding = TRUE;
|
||||
}
|
||||
g_free (tmp);
|
||||
if (info)
|
||||
list = g_list_prepend (list, info);
|
||||
}
|
||||
closedir (dir);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
GList *
|
||||
theme_common_get_list (void)
|
||||
{
|
||||
gchar *dir;
|
||||
GList *theme_list = NULL;
|
||||
|
||||
dir = g_build_filename (g_get_home_dir (), ".themes", NULL);
|
||||
theme_list = themes_common_list_add_dir (theme_list, dir);
|
||||
g_free (dir);
|
||||
|
||||
dir = gtk_rc_get_theme_dir ();
|
||||
theme_list = themes_common_list_add_dir (theme_list, dir);
|
||||
g_free (dir);
|
||||
|
||||
return theme_list;
|
||||
}
|
||||
|
||||
void
|
||||
theme_common_list_free (GList *list)
|
||||
{
|
||||
if (list == NULL)
|
||||
return;
|
||||
|
||||
g_list_foreach (list, g_free, NULL);
|
||||
g_list_free (list);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue