mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
move SM init a bit later in the process, and init prefs
2001-12-09 Havoc Pennington <hp@pobox.com> * src/main.c (main): move SM init a bit later in the process, and init prefs * src/session.c: fix no SM case (though I hardly know why I'm bothering) * src/main.c (main): call bindtextdomain * src/util.h (_): actually call gettext * configure.in: put in AM_GLIB_GNU_GETTEXT and gconf stuff * src/prefs.c: Preferences - this marks the beginning of our doom. None of them are actually implemented yet, but we monitor some stuff from gconf.
This commit is contained in:
parent
b3778e4470
commit
6981a8198b
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2001-12-09 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* src/main.c (main): move SM init a bit later in the process, and
|
||||
init prefs
|
||||
|
||||
* src/session.c: fix no SM case (though I hardly know why I'm
|
||||
bothering)
|
||||
|
||||
* src/main.c (main): call bindtextdomain
|
||||
|
||||
* src/util.h (_): actually call gettext
|
||||
|
||||
* configure.in: put in AM_GLIB_GNU_GETTEXT and gconf stuff
|
||||
|
||||
* src/prefs.c: Preferences - this marks the beginning of our doom.
|
||||
None of them are actually implemented yet, but we monitor
|
||||
some stuff from gconf.
|
||||
|
||||
2001-12-07 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* src/window.c (meta_window_unminimize): when unminimizing an app,
|
||||
|
14
configure.in
14
configure.in
@ -38,11 +38,11 @@ fi
|
||||
changequote([,])dnl
|
||||
|
||||
ALL_LINGUAS="es gl ru sv uk"
|
||||
dnl AM_GNU_GETTEXT
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
## here we get the flags we'll actually use
|
||||
PKG_CHECK_MODULES(METACITY, gtk+-2.0 >= 1.3.10)
|
||||
PKG_CHECK_MODULES(METACITY_RESTART, gtk+-2.0 >= 1.3.10)
|
||||
PKG_CHECK_MODULES(METACITY, gtk+-2.0 >= 1.3.11 gconf-2.0 >= 1.1.5)
|
||||
PKG_CHECK_MODULES(METACITY_RESTART, gtk+-2.0 >= 1.3.11)
|
||||
|
||||
CFLAGS="$METACITY_CFLAGS $CFLAGS"
|
||||
|
||||
@ -82,6 +82,14 @@ LDFLAGS="$METACITY_LIBS $LDFLAGS"
|
||||
AC_CHECK_FUNCS(gdk_pixbuf_new_from_stream)
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
|
||||
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
|
||||
|
||||
if test x"$GCONFTOOL" = xno; then
|
||||
AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
|
||||
fi
|
||||
|
||||
AM_GCONF_SOURCE_2
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
SUBDIRS=wm-tester tools
|
||||
|
||||
INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\"
|
||||
INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
metacity_SOURCES= \
|
||||
common.h \
|
||||
@ -30,6 +30,8 @@ metacity_SOURCES= \
|
||||
menu.h \
|
||||
place.c \
|
||||
place.h \
|
||||
prefs.c \
|
||||
prefs.h \
|
||||
screen.c \
|
||||
screen.h \
|
||||
session.c \
|
||||
@ -54,6 +56,12 @@ metacity_LDADD= @METACITY_LIBS@
|
||||
desktopfilesdir=$(datadir)/gnome/wm-properties
|
||||
desktopfiles_DATA=metacity.desktop
|
||||
|
||||
schemadir = @GCONF_SCHEMA_FILE_DIR@
|
||||
schema_DATA = metacity.schemas
|
||||
|
||||
install-data-local:
|
||||
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schema_DATA)
|
||||
|
||||
IMAGES=default_icon.png
|
||||
VARIABLES=default_icon_data $(srcdir)/default_icon.png
|
||||
|
||||
@ -63,4 +71,4 @@ CLEANFILES += inlinepixbufs.h
|
||||
inlinepixbufs.h: $(IMAGES)
|
||||
$(GDK_PIXBUF_CSOURCE) --raw --build-list $(VARIABLES) >$(srcdir)/inlinepixbufs.h
|
||||
|
||||
EXTRA_DIST=$(desktopfiles_DATA) $(IMAGES)
|
||||
EXTRA_DIST=$(desktopfiles_DATA) $(IMAGES) $(schema_DATA)
|
||||
|
@ -123,6 +123,13 @@ typedef enum
|
||||
} MetaCursor;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_FOCUS_MODE_CLICK,
|
||||
META_FOCUS_MODE_SLOPPY,
|
||||
META_FOCUS_MODE_MOUSE
|
||||
} MetaFocusMode;
|
||||
|
||||
/* should investigate changing these to whatever most apps use */
|
||||
#define META_ICON_WIDTH 32
|
||||
#define META_ICON_HEIGHT 32
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "display.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "errors.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "frames.h"
|
||||
#include "util.h"
|
||||
#include "core.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "keybindings.h"
|
||||
#include "workspace.h"
|
||||
#include "errors.h"
|
||||
|
17
src/main.c
17
src/main.c
@ -19,12 +19,14 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
#include "display.h"
|
||||
#include "errors.h"
|
||||
#include "ui.h"
|
||||
#include "session.h"
|
||||
#include "prefs.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
@ -74,7 +76,9 @@ main (int argc, char **argv)
|
||||
act.sa_flags = 0;
|
||||
sigaction (SIGPIPE, &act, 0);
|
||||
|
||||
g_set_prgname (PACKAGE);
|
||||
g_set_prgname (argv[0]);
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
|
||||
|
||||
meta_set_verbose (TRUE);
|
||||
meta_set_debugging (TRUE);
|
||||
@ -169,8 +173,8 @@ main (int argc, char **argv)
|
||||
|
||||
g_type_init ();
|
||||
|
||||
if (!disable_sm)
|
||||
meta_session_init (client_id); /* client_id == NULL is fine */
|
||||
/* Load prefs */
|
||||
meta_prefs_init ();
|
||||
|
||||
meta_ui_init (&argc, &argv);
|
||||
|
||||
@ -181,6 +185,13 @@ main (int argc, char **argv)
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
|
||||
log_handler, NULL);
|
||||
g_log_set_always_fatal (G_LOG_LEVEL_MASK);
|
||||
|
||||
/* Connect to SM as late as possible - but before managing display,
|
||||
* or we might try to manage a window before we have the session
|
||||
* info
|
||||
*/
|
||||
if (!disable_sm)
|
||||
meta_session_init (client_id); /* client_id == NULL is fine */
|
||||
|
||||
if (!meta_display_open (NULL))
|
||||
meta_exit (META_EXIT_ERROR);
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "menu.h"
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
|
@ -4,7 +4,8 @@
|
||||
<!-- General preferences -->
|
||||
|
||||
<schema>
|
||||
<key>/apps/metacity/general/focus_mode</key>
|
||||
<key>/schemas/apps/metacity/general/focus_mode</key>
|
||||
<applyto>/apps/metacity/general/focus_mode</applyto>
|
||||
<owner>metacity</owner>
|
||||
<type>string</type>
|
||||
<default>click</default>
|
||||
@ -22,7 +23,8 @@
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/apps/metacity/general/titlebar_uses_desktop_font</key>
|
||||
<key>/schemas/apps/metacity/general/titlebar_uses_desktop_font</key>
|
||||
<applyto>/apps/metacity/general/titlebar_uses_desktop_font</applyto>
|
||||
<owner>metacity</owner>
|
||||
<type>bool</type>
|
||||
<default>true</default>
|
||||
@ -37,7 +39,8 @@
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/apps/metacity/general/titlebar_font</key>
|
||||
<key>/schemas/apps/metacity/general/titlebar_font</key>
|
||||
<applyto>/apps/metacity/general/titlebar_font</applyto>
|
||||
<owner>metacity</owner>
|
||||
<type>string</type>
|
||||
<!-- no default is deliberate - we want to be unset by default -->
|
||||
@ -57,7 +60,8 @@
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/apps/metacity/general/titlebar_font_size</key>
|
||||
<key>/schemas/apps/metacity/general/titlebar_font_size</key>
|
||||
<applyto>/apps/metacity/general/titlebar_font_size</applyto>
|
||||
<owner>metacity</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
@ -75,18 +79,19 @@
|
||||
<!-- Keybindings -->
|
||||
|
||||
<schema>
|
||||
<key>/apps/metacity/keybindings/activate_window_menu</key>
|
||||
<key>/schemas/apps/metacity/keybindings/activate_window_menu</key>
|
||||
<applyto>/apps/metacity/keybindings/activate_window_menu</applyto>
|
||||
<owner>metacity</owner>
|
||||
<type>string</type>
|
||||
<default>
|
||||
<default><Alt>space</default>
|
||||
<locale name="C">
|
||||
<short>Activate window menu</short>
|
||||
<long>
|
||||
The keybinding used to activate the window menu.
|
||||
The format looks like "<Control>a" or "<Shift><Alt>F1" or
|
||||
"<Release>z" (the last one is for key release). The parser is
|
||||
The format looks like "<Control>a" or "<Shift><Alt>F1" or
|
||||
"<Release>z" (the last one is for key release). The parser is
|
||||
fairly liberal and allows lower or upper case, and also
|
||||
abbreviations such as "<Ctl>" and "<Ctrl>". This option can be
|
||||
abbreviations such as "<Ctl>" and "<Ctrl>". This option can be
|
||||
set to a single string, or a list of strings; if a list,
|
||||
all of the given keybindings will be present. If you set
|
||||
the option to the special string "disabled", then there
|
||||
|
441
src/prefs.c
Normal file
441
src/prefs.c
Normal file
@ -0,0 +1,441 @@
|
||||
/* Metacity preferences */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001 Havoc Pennington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "prefs.h"
|
||||
#include "util.h"
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <string.h>
|
||||
|
||||
/* If you add a key, it needs updating in init() and in the gconf
|
||||
* notify listener and of course in the .schemas file
|
||||
*/
|
||||
#define KEY_FOCUS_MODE "/apps/metacity/general/focus_mode"
|
||||
#define KEY_USE_DESKTOP_FONT "/apps/metacity/general/titlebar_uses_desktop_font"
|
||||
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
|
||||
#define KEY_TITLEBAR_FONT_SIZE "/apps/metacity/general/titlebar_font_size"
|
||||
|
||||
static GConfClient *client = NULL;
|
||||
static GList *listeners = NULL;
|
||||
static GList *changes = NULL;
|
||||
static guint changed_idle;
|
||||
static gboolean use_desktop_font = TRUE;
|
||||
static PangoFontDescription *titlebar_font = NULL;
|
||||
static int titlebar_font_size = 0;
|
||||
static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
|
||||
|
||||
static gboolean update_use_desktop_font (gboolean value);
|
||||
static gboolean update_titlebar_font (const char *value);
|
||||
static gboolean update_titlebar_font_size (int value);
|
||||
static gboolean update_focus_mode (const char *value);
|
||||
|
||||
static void queue_changed (MetaPreference pref);
|
||||
static void change_notify (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MetaPrefsChangedFunc func;
|
||||
gpointer data;
|
||||
} MetaPrefsListener;
|
||||
|
||||
void
|
||||
meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
MetaPrefsListener *l;
|
||||
|
||||
l = g_new (MetaPrefsListener, 1);
|
||||
l->func = func;
|
||||
l->data = data;
|
||||
|
||||
listeners = g_list_prepend (listeners, l);
|
||||
}
|
||||
|
||||
void
|
||||
meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
tmp = listeners;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaPrefsListener *l = tmp->data;
|
||||
|
||||
if (l->func == func &&
|
||||
l->data == data)
|
||||
{
|
||||
g_free (l);
|
||||
listeners = g_list_delete_link (listeners, tmp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
meta_bug ("Did not find listener to remove\n");
|
||||
}
|
||||
|
||||
static void
|
||||
emit_changed (MetaPreference pref)
|
||||
{
|
||||
GList *tmp;
|
||||
GList *copy;
|
||||
|
||||
meta_verbose ("Notifying listeners that pref %s changed\n",
|
||||
meta_preference_to_string (pref));
|
||||
|
||||
copy = g_list_copy (listeners);
|
||||
|
||||
tmp = copy;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaPrefsListener *l = tmp->data;
|
||||
|
||||
(* l->func) (pref, l->data);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (copy);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
changed_idle_handler (gpointer data)
|
||||
{
|
||||
GList *tmp;
|
||||
GList *copy;
|
||||
|
||||
changed_idle = 0;
|
||||
|
||||
copy = g_list_copy (changes); /* reentrancy paranoia */
|
||||
|
||||
g_list_free (changes);
|
||||
changes = NULL;
|
||||
|
||||
tmp = copy;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaPreference pref = GPOINTER_TO_INT (tmp->data);
|
||||
|
||||
emit_changed (pref);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (copy);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
queue_changed (MetaPreference pref)
|
||||
{
|
||||
meta_verbose ("Queueing change of pref %s\n",
|
||||
meta_preference_to_string (pref));
|
||||
|
||||
if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL)
|
||||
changes = g_list_prepend (changes, GINT_TO_POINTER (pref));
|
||||
else
|
||||
meta_verbose ("Change of pref %s was already pending\n",
|
||||
meta_preference_to_string (pref));
|
||||
|
||||
if (changed_idle == 0)
|
||||
changed_idle = g_idle_add (changed_idle_handler, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_error (GError **error)
|
||||
{
|
||||
if (*error)
|
||||
{
|
||||
meta_warning ("%s", (*error)->message);
|
||||
|
||||
g_error_free (*error);
|
||||
*error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_prefs_init (void)
|
||||
{
|
||||
GError *err = NULL;
|
||||
char *str_val;
|
||||
int int_val;
|
||||
gboolean bool_val;
|
||||
|
||||
if (client != NULL)
|
||||
return;
|
||||
|
||||
/* returns a reference which we hold forever */
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
gconf_client_add_dir (client, "/apps/metacity",
|
||||
GCONF_CLIENT_PRELOAD_RECURSIVE,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
|
||||
str_val = gconf_client_get_string (client, KEY_FOCUS_MODE,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
update_focus_mode (str_val);
|
||||
g_free (str_val);
|
||||
|
||||
bool_val = gconf_client_get_bool (client, KEY_USE_DESKTOP_FONT,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
update_use_desktop_font (bool_val);
|
||||
|
||||
int_val = gconf_client_get_int (client, KEY_TITLEBAR_FONT_SIZE,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
update_titlebar_font_size (int_val);
|
||||
|
||||
str_val = gconf_client_get_string (client, KEY_TITLEBAR_FONT,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
update_titlebar_font (str_val);
|
||||
g_free (str_val);
|
||||
|
||||
gconf_client_notify_add (client, "/apps/metacity",
|
||||
change_notify,
|
||||
NULL,
|
||||
NULL,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
}
|
||||
|
||||
static void
|
||||
change_notify (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
const char *key;
|
||||
GConfValue *value;
|
||||
|
||||
key = gconf_entry_get_key (entry);
|
||||
value = gconf_entry_get_value (entry);
|
||||
|
||||
if (strcmp (key, KEY_FOCUS_MODE) == 0)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if (value && value->type != GCONF_VALUE_STRING)
|
||||
{
|
||||
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
||||
KEY_FOCUS_MODE);
|
||||
goto out;
|
||||
}
|
||||
|
||||
str = value ? gconf_value_get_string (value) : NULL;
|
||||
|
||||
if (update_focus_mode (str))
|
||||
queue_changed (META_PREF_FOCUS_MODE);
|
||||
}
|
||||
else if (strcmp (key, KEY_TITLEBAR_FONT) == 0)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if (value && value->type != GCONF_VALUE_STRING)
|
||||
{
|
||||
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
||||
KEY_TITLEBAR_FONT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
str = value ? gconf_value_get_string (value) : NULL;
|
||||
|
||||
if (update_titlebar_font (str))
|
||||
queue_changed (META_PREF_TITLEBAR_FONT);
|
||||
}
|
||||
else if (strcmp (key, KEY_TITLEBAR_FONT_SIZE) == 0)
|
||||
{
|
||||
int d;
|
||||
|
||||
if (value && value->type != GCONF_VALUE_INT)
|
||||
{
|
||||
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
||||
KEY_TITLEBAR_FONT_SIZE);
|
||||
goto out;
|
||||
}
|
||||
|
||||
d = value ? gconf_value_get_int (value) : 0;
|
||||
|
||||
if (update_titlebar_font_size (d))
|
||||
queue_changed (META_PREF_TITLEBAR_FONT_SIZE);
|
||||
}
|
||||
else if (strcmp (key, KEY_USE_DESKTOP_FONT) == 0)
|
||||
{
|
||||
gboolean b;
|
||||
|
||||
if (value && value->type != GCONF_VALUE_BOOL)
|
||||
{
|
||||
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
||||
KEY_USE_DESKTOP_FONT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
b = value ? gconf_value_get_bool (value) : TRUE;
|
||||
|
||||
/* There's no external pref for this, it just affects whether
|
||||
* get_titlebar_font returns NULL, so that's what we queue
|
||||
* the change on
|
||||
*/
|
||||
if (update_use_desktop_font (b))
|
||||
queue_changed (META_PREF_TITLEBAR_FONT);
|
||||
}
|
||||
else
|
||||
meta_verbose ("Key %s doesn't mean anything to Metacity\n",
|
||||
key);
|
||||
|
||||
out:
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_focus_mode (const char *value)
|
||||
{
|
||||
MetaFocusMode old_mode = focus_mode;
|
||||
|
||||
if (value != NULL)
|
||||
{
|
||||
if (g_ascii_strcasecmp (value, "click") == 0)
|
||||
focus_mode = META_FOCUS_MODE_CLICK;
|
||||
else if (g_ascii_strcasecmp (value, "sloppy") == 0)
|
||||
focus_mode = META_FOCUS_MODE_SLOPPY;
|
||||
else if (g_ascii_strcasecmp (value, "mouse") == 0)
|
||||
focus_mode = META_FOCUS_MODE_MOUSE;
|
||||
else
|
||||
meta_warning (_("GConf key '%s' is set to an invalid value"),
|
||||
KEY_FOCUS_MODE);
|
||||
}
|
||||
|
||||
return (old_mode != focus_mode);
|
||||
}
|
||||
|
||||
MetaFocusMode
|
||||
meta_prefs_get_focus_mode (void)
|
||||
{
|
||||
return focus_mode;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_use_desktop_font (gboolean value)
|
||||
{
|
||||
gboolean old = use_desktop_font;
|
||||
|
||||
use_desktop_font = value;
|
||||
|
||||
return old != value;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_titlebar_font (const char *value)
|
||||
{
|
||||
PangoFontDescription *new_desc;
|
||||
|
||||
new_desc = NULL;
|
||||
|
||||
if (value)
|
||||
{
|
||||
new_desc = pango_font_description_from_string (value);
|
||||
if (new_desc == NULL)
|
||||
meta_warning (_("Could not parse font description \"%s\" from GConf key %s\n"),
|
||||
value, KEY_TITLEBAR_FONT);
|
||||
}
|
||||
|
||||
if (new_desc && titlebar_font &&
|
||||
pango_font_description_equal (new_desc, titlebar_font))
|
||||
{
|
||||
pango_font_description_free (new_desc);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (titlebar_font)
|
||||
pango_font_description_free (titlebar_font);
|
||||
|
||||
titlebar_font = new_desc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
const PangoFontDescription*
|
||||
meta_prefs_get_titlebar_font (void)
|
||||
{
|
||||
if (use_desktop_font)
|
||||
return NULL;
|
||||
else
|
||||
return titlebar_font;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_titlebar_font_size (int value)
|
||||
{
|
||||
int old = titlebar_font_size;
|
||||
|
||||
if (value < 0)
|
||||
{
|
||||
meta_warning (_("%d stored in GConf key %s is not a valid font size\n"),
|
||||
value, KEY_TITLEBAR_FONT_SIZE);
|
||||
value = 0;
|
||||
}
|
||||
|
||||
titlebar_font_size = value;
|
||||
|
||||
return old != titlebar_font_size;
|
||||
}
|
||||
|
||||
int
|
||||
meta_prefs_get_titlebar_font_size (void)
|
||||
{
|
||||
return titlebar_font_size;
|
||||
}
|
||||
|
||||
const char*
|
||||
meta_preference_to_string (MetaPreference pref)
|
||||
{
|
||||
switch (pref)
|
||||
{
|
||||
case META_PREF_FOCUS_MODE:
|
||||
return "FOCUS_MODE";
|
||||
break;
|
||||
|
||||
case META_PREF_TITLEBAR_FONT:
|
||||
return "TITLEBAR_FONT";
|
||||
break;
|
||||
|
||||
case META_PREF_TITLEBAR_FONT_SIZE:
|
||||
return "TITLEBAR_FONT_SIZE";
|
||||
break;
|
||||
}
|
||||
|
||||
return "(unknown)";
|
||||
}
|
58
src/prefs.h
Normal file
58
src/prefs.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* Metacity preferences */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2001 Havoc Pennington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef META_PREFS_H
|
||||
#define META_PREFS_H
|
||||
|
||||
/* This header is a "common" one between the UI and core side */
|
||||
#include "common.h"
|
||||
#include <pango/pango-font.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_PREF_FOCUS_MODE,
|
||||
META_PREF_TITLEBAR_FONT,
|
||||
META_PREF_TITLEBAR_FONT_SIZE
|
||||
|
||||
} MetaPreference;
|
||||
|
||||
typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
|
||||
gpointer data);
|
||||
|
||||
void meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
||||
gpointer data);
|
||||
void meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
||||
gpointer data);
|
||||
|
||||
void meta_prefs_init (void);
|
||||
const char* meta_preference_to_string (MetaPreference pref);
|
||||
|
||||
MetaFocusMode meta_prefs_get_focus_mode (void);
|
||||
/* returns NULL if GTK default should be used */
|
||||
const PangoFontDescription* meta_prefs_get_titlebar_font (void);
|
||||
/* returns 0 if default should be used */
|
||||
int meta_prefs_get_titlebar_font_size (void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "screen.h"
|
||||
#include "util.h"
|
||||
#include "errors.h"
|
||||
|
@ -19,6 +19,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "session.h"
|
||||
|
||||
#ifndef HAVE_SM
|
||||
@ -27,6 +29,18 @@ meta_session_init (const char *previous_id)
|
||||
{
|
||||
meta_verbose ("Compiled without session management support\n");
|
||||
}
|
||||
|
||||
const MetaWindowSessionInfo*
|
||||
meta_window_lookup_saved_state (MetaWindow *window)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_release_saved_state (const MetaWindowSessionInfo *info)
|
||||
{
|
||||
;
|
||||
}
|
||||
#else /* HAVE_SM */
|
||||
|
||||
#include <X11/ICE/ICElib.h>
|
||||
|
@ -46,9 +46,8 @@ void meta_fatal (const char *format,
|
||||
void meta_push_no_msg_prefix (void);
|
||||
void meta_pop_no_msg_prefix (void);
|
||||
|
||||
/* FIXME */
|
||||
#include <config.h>
|
||||
#define _(x) x
|
||||
#include <libintl.h>
|
||||
#define _(x) dgettext (GETTEXT_PACKAGE, x)
|
||||
#define N_(x) x
|
||||
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "window.h"
|
||||
#include "util.h"
|
||||
#include "frame.h"
|
||||
|
Loading…
Reference in New Issue
Block a user