Remove unused CFLAGS;

2002-06-04  Seth Nickell  <snickell@stanford.edu>

	* Makefile.am:

	Remove unused CFLAGS;

	* gnome-window-properties.c: (wm_widget_add_wm),
	(setup_appearance_option_menu):

	Improve handling of option menus, set the default item.

	* metacity-window-manager.c: (metacity_set_theme),
	(add_themes_from_dir), (metacity_get_theme_list),
	(metacity_set_font), (metacity_set_focus_follows_mouse),
	(metacity_window_manager_class_init):

	Actually do things when the "set" calls are made, improve
	intelligence of loading the theme list. Eventually we should
	probably do validation on the XML files.
This commit is contained in:
Seth Nickell 2002-06-05 00:36:57 +00:00 committed by Seth Nickell
parent 51f9aad29a
commit 03f10ccb0c
4 changed files with 102 additions and 18 deletions

View file

@ -1,3 +1,23 @@
2002-06-04 Seth Nickell <snickell@stanford.edu>
* Makefile.am:
Remove unused CFLAGS;
* gnome-window-properties.c: (wm_widget_add_wm),
(setup_appearance_option_menu):
Improve handling of option menus, set the default item.
* metacity-window-manager.c: (metacity_set_theme),
(add_themes_from_dir), (metacity_get_theme_list),
(metacity_set_font), (metacity_set_focus_follows_mouse),
(metacity_window_manager_class_init):
Actually do things when the "set" calls are made, improve
intelligence of loading the theme list. Eventually we should
probably do validation on the XML files.
2002-06-04 Seth Nickell <snickell@stanford.edu>
* gnome-window-properties.c: (set_wm_change_pending),

View file

@ -40,9 +40,10 @@ desktopdir = $(GNOMECC_DESKTOP_DIR)
Desktop_in_files = window-properties.desktop.in
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) $(DESKTOP_ITEM_CFLAGS) \
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) \
-I $(top_builddir)/libwindow-settings \
-DGNOME_WINDOW_MANAGER_MODULE_PATH=\""$(libdir)/window-manager-settings"\"
-DGNOME_WINDOW_MANAGER_MODULE_PATH=\""$(libdir)/window-manager-settings"\" \
-DMETACITY_THEME_DIR=\""$(datadir)/metacity/themes"\"
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
EXTRA_DIST = $(Glade_DATA) $(icons_DATA) $(Desktop_in_files) $(pixmap_DATA)

View file

@ -116,11 +116,11 @@ wm_widget_add_wm (GnomeWindowManager *wm)
gtk_widget_show_all (menu_item);
gtk_menu_shell_prepend (GTK_MENU_SHELL (wm_menu), menu_item);
wm_menu_window_managers = g_list_prepend (wm_menu_window_managers, wm);
wm_menu_window_managers = g_list_append (wm_menu_window_managers, wm);
/* If this is supposed to be the selected window manager, do so */
if (gnome_wm_manager_same_wm (wm, selected_wm))
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 0);
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), g_list_length (wm_menu_window_managers) - 1);
}
static void
@ -192,7 +192,9 @@ setup_appearance_option_menu (GtkWidget *appearance_option_menu, GnomeWindowMana
{
GtkWidget *menu, *menu_item;
GList *themes, *node;
char *theme_name;
const char *theme_name;
char *current_theme_name;
int index = 0;
menu = gtk_menu_new ();
gtk_widget_show_all (menu);
@ -200,6 +202,8 @@ setup_appearance_option_menu (GtkWidget *appearance_option_menu, GnomeWindowMana
themes = gnome_window_manager_get_theme_list (wm);
current_theme_name = gconf_client_get_string (gconf_client, THEME_KEY, NULL);
for (node = themes; node != NULL; node = node->next) {
theme_name = (char *)node->data;
@ -207,8 +211,15 @@ setup_appearance_option_menu (GtkWidget *appearance_option_menu, GnomeWindowMana
gtk_widget_show_all (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
if (strcmp (theme_name, current_theme_name) == 0)
gtk_option_menu_set_history (GTK_OPTION_MENU (appearance_option_menu), index);
index++;
}
g_free (current_theme_name);
theme_list = themes;
}

View file

@ -1,5 +1,12 @@
#include <dirent.h>
#include <config.h>
#include <gconf/gconf-client.h>
#include "metacity-window-manager.h"
#define METACITY_THEME_KEY "/apps/metacity/general/theme"
#define METACITY_FONT_KEY "/apps/metacity/general/titlebar_font"
#define METACITY_FOCUS_KEY "/apps/metacity/general/focus_mode"
static GnomeWindowManagerClass *parent_class;
struct _MetacityWindowManagerPrivate {
@ -15,22 +22,62 @@ window_manager_new (void)
return wm;
}
static void
metacity_set_theme (const char *theme_name)
{
gconf_client_set_string (gconf_client_get_default (),
METACITY_THEME_KEY,
theme_name, NULL);
}
static GList *
add_themes_from_dir (GList *current_list, const char *path)
{
DIR *theme_dir;
struct dirent *entry;
char *theme_file_path;
GList *node;
gboolean found = FALSE;
theme_dir = opendir (path);
for (entry = readdir (theme_dir); entry != NULL; entry = readdir (theme_dir)) {
theme_file_path = g_build_filename (path, entry->d_name, "metacity-theme-1.xml", NULL);
if (g_file_test (theme_file_path, G_FILE_TEST_EXISTS)) {
for (node = current_list; (node != NULL) && (!found); node = node->next) {
found = (strcmp (node->data, entry->d_name) == 0);
}
if (!found) {
current_list = g_list_prepend (current_list, g_strdup (entry->d_name));
}
}
/*g_free (entry);*/
g_free (theme_file_path);
}
closedir (theme_dir);
return current_list;
}
static GList *
metacity_get_theme_list (void)
{
GList *themes = NULL;
char *home_dir_themes;
themes = g_list_prepend (themes, g_strdup ("Crux"));
themes = g_list_prepend (themes, g_strdup ("Atlanta"));
themes = g_list_prepend (themes, g_strdup ("Butt Ugly XRP"));
themes = g_list_prepend (themes, g_strdup ("ForMyGirlFriend"));
themes = g_list_prepend (themes, g_strdup ("Themes.orgRocks"));
home_dir_themes = g_build_filename (g_get_home_dir (), ".metacity/themes", NULL);
themes = add_themes_from_dir (themes, METACITY_THEME_DIR);
themes = add_themes_from_dir (themes, "/usr/share/metacity/themes");
themes = add_themes_from_dir (themes, home_dir_themes);
g_free (home_dir_themes);
return themes;
}
@ -38,19 +85,25 @@ metacity_get_theme_list (void)
static void
metacity_set_font (const char *font)
{
}
static gboolean
metacity_get_focus_follows_mouse (void)
{
return FALSE;
gconf_client_set_string (gconf_client_get_default (),
METACITY_FONT_KEY,
font, NULL);
}
static void
metacity_set_focus_follows_mouse (gboolean focus_follows_mouse)
{
const char *focus_mode;
if (focus_follows_mouse) {
focus_mode = "sloppy";
} else {
focus_mode = "click";
}
gconf_client_set_string (gconf_client_get_default (),
METACITY_FOCUS_KEY,
focus_mode, NULL);
}
@ -90,7 +143,6 @@ metacity_window_manager_class_init (MetacityWindowManagerClass *class)
wm_class->set_theme = metacity_set_theme;
wm_class->get_theme_list = metacity_get_theme_list;
wm_class->set_font = metacity_set_font;
wm_class->get_focus_follows_mouse = metacity_get_focus_follows_mouse;
wm_class->set_focus_follows_mouse = metacity_set_focus_follows_mouse;
parent_class = g_type_class_peek_parent (class);