2001-12-09 17:41:12 -05:00
|
|
|
/* Metacity preferences */
|
|
|
|
|
|
|
|
/*
|
2002-07-06 12:50:48 -04:00
|
|
|
* Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc.
|
2001-12-09 17:41:12 -05:00
|
|
|
*
|
|
|
|
* 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"
|
2002-04-28 00:52:26 -04:00
|
|
|
#include "ui.h"
|
2001-12-09 17:41:12 -05:00
|
|
|
#include "util.h"
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <gconf/gconf-client.h>
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <string.h>
|
2002-07-11 00:10:44 -04:00
|
|
|
#include <stdlib.h>
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2003-02-22 17:43:13 -05:00
|
|
|
#define MAX_REASONABLE_WORKSPACES 36
|
2003-02-23 21:16:09 -05:00
|
|
|
|
|
|
|
#define MAX_COMMANDS (32 + NUM_EXTRA_COMMANDS)
|
|
|
|
#define NUM_EXTRA_COMMANDS 2
|
|
|
|
#define SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 2)
|
|
|
|
#define WIN_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 1)
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
/* If you add a key, it needs updating in init() and in the gconf
|
|
|
|
* notify listener and of course in the .schemas file
|
|
|
|
*/
|
2002-10-07 19:14:40 -04:00
|
|
|
#define KEY_MOUSE_BUTTON_MODS "/apps/metacity/general/mouse_button_modifier"
|
2001-12-09 17:41:12 -05:00
|
|
|
#define KEY_FOCUS_MODE "/apps/metacity/general/focus_mode"
|
2002-10-18 17:22:27 -04:00
|
|
|
#define KEY_ACTION_DOUBLE_CLICK_TITLEBAR "/apps/metacity/general/action_double_click_titlebar"
|
2002-05-23 22:23:46 -04:00
|
|
|
#define KEY_AUTO_RAISE "/apps/metacity/general/auto_raise"
|
|
|
|
#define KEY_AUTO_RAISE_DELAY "/apps/metacity/general/auto_raise_delay"
|
2002-02-06 22:07:56 -05:00
|
|
|
#define KEY_THEME "/apps/metacity/general/theme"
|
2002-05-23 22:55:54 -04:00
|
|
|
#define KEY_USE_SYSTEM_FONT "/apps/metacity/general/titlebar_uses_system_font"
|
2001-12-09 17:41:12 -05:00
|
|
|
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
|
2001-12-09 22:55:26 -05:00
|
|
|
#define KEY_NUM_WORKSPACES "/apps/metacity/general/num_workspaces"
|
2002-01-27 00:50:34 -05:00
|
|
|
#define KEY_APPLICATION_BASED "/apps/metacity/general/application_based"
|
2002-04-30 23:23:46 -04:00
|
|
|
#define KEY_DISABLE_WORKAROUNDS "/apps/metacity/general/disable_workarounds"
|
2002-10-12 13:44:55 -04:00
|
|
|
#define KEY_BUTTON_LAYOUT "/apps/metacity/general/button_layout"
|
2003-10-12 02:25:38 -04:00
|
|
|
#define KEY_REDUCED_RESOURCES "/apps/metacity/general/reduced_resources"
|
2005-01-26 03:43:38 -05:00
|
|
|
#define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility"
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
#define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_"
|
2004-10-13 04:32:10 -04:00
|
|
|
|
|
|
|
#define KEY_TERMINAL_COMMAND "/desktop/gnome/applications/terminal/exec"
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
#define KEY_SCREEN_BINDINGS_PREFIX "/apps/metacity/global_keybindings"
|
|
|
|
#define KEY_WINDOW_BINDINGS_PREFIX "/apps/metacity/window_keybindings"
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
#define KEY_WORKSPACE_NAME_PREFIX "/apps/metacity/workspace_names/name_"
|
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
#define KEY_VISUAL_BELL "/apps/metacity/general/visual_bell"
|
|
|
|
#define KEY_AUDIBLE_BELL "/apps/metacity/general/audible_bell"
|
|
|
|
#define KEY_VISUAL_BELL_TYPE "/apps/metacity/general/visual_bell_type"
|
2005-07-11 09:25:08 -04:00
|
|
|
#define KEY_CURSOR_THEME "/desktop/gnome/peripherals/mouse/cursor_theme"
|
|
|
|
#define KEY_CURSOR_SIZE "/desktop/gnome/peripherals/mouse/cursor_size"
|
2003-01-28 10:07:43 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-02-07 22:34:26 -05:00
|
|
|
static GConfClient *default_client = NULL;
|
2001-12-09 17:41:12 -05:00
|
|
|
static GList *changes = NULL;
|
|
|
|
static guint changed_idle;
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif
|
|
|
|
static GList *listeners = NULL;
|
|
|
|
|
2002-05-23 22:55:54 -04:00
|
|
|
static gboolean use_system_font = TRUE;
|
2001-12-09 17:41:12 -05:00
|
|
|
static PangoFontDescription *titlebar_font = NULL;
|
2002-10-07 19:14:40 -04:00
|
|
|
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
|
2001-12-09 17:41:12 -05:00
|
|
|
static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
|
2002-02-06 22:07:56 -05:00
|
|
|
static char* current_theme = NULL;
|
2001-12-09 22:55:26 -05:00
|
|
|
static int num_workspaces = 4;
|
2002-10-18 17:22:27 -04:00
|
|
|
static MetaActionDoubleClickTitlebar action_double_click_titlebar =
|
|
|
|
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE;
|
2002-01-27 00:50:34 -05:00
|
|
|
static gboolean application_based = FALSE;
|
2002-04-30 23:23:46 -04:00
|
|
|
static gboolean disable_workarounds = FALSE;
|
2002-05-23 22:23:46 -04:00
|
|
|
static gboolean auto_raise = FALSE;
|
|
|
|
static gboolean auto_raise_delay = 500;
|
2003-01-28 10:07:43 -05:00
|
|
|
static gboolean provide_visual_bell = TRUE;
|
|
|
|
static gboolean bell_is_audible = TRUE;
|
2003-10-12 02:25:38 -04:00
|
|
|
static gboolean reduced_resources = FALSE;
|
2005-01-26 03:43:38 -05:00
|
|
|
static gboolean gnome_accessibility = FALSE;
|
2005-07-11 09:25:08 -04:00
|
|
|
static char *cursor_theme = NULL;
|
|
|
|
static int cursor_size = 24;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_INVALID;
|
2002-10-12 13:44:55 -04:00
|
|
|
static MetaButtonLayout button_layout = {
|
|
|
|
{
|
|
|
|
META_BUTTON_FUNCTION_MENU,
|
|
|
|
META_BUTTON_FUNCTION_LAST,
|
|
|
|
META_BUTTON_FUNCTION_LAST,
|
|
|
|
META_BUTTON_FUNCTION_LAST
|
|
|
|
},
|
|
|
|
{
|
|
|
|
META_BUTTON_FUNCTION_MINIMIZE,
|
|
|
|
META_BUTTON_FUNCTION_MAXIMIZE,
|
|
|
|
META_BUTTON_FUNCTION_CLOSE,
|
|
|
|
META_BUTTON_FUNCTION_LAST
|
|
|
|
}
|
|
|
|
};
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
/* The screenshot commands are at the end */
|
2002-11-03 14:06:39 -05:00
|
|
|
static char *commands[MAX_COMMANDS] = { NULL, };
|
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
static char *terminal_command = NULL;
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, };
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-05-23 22:55:54 -04:00
|
|
|
static gboolean update_use_system_font (gboolean value);
|
2001-12-09 17:41:12 -05:00
|
|
|
static gboolean update_titlebar_font (const char *value);
|
2002-10-07 19:14:40 -04:00
|
|
|
static gboolean update_mouse_button_mods (const char *value);
|
2001-12-09 17:41:12 -05:00
|
|
|
static gboolean update_focus_mode (const char *value);
|
2002-02-06 22:07:56 -05:00
|
|
|
static gboolean update_theme (const char *value);
|
2003-01-28 10:07:43 -05:00
|
|
|
static gboolean update_visual_bell (gboolean v1, gboolean v2);
|
|
|
|
static gboolean update_visual_bell_type (const char *value);
|
2001-12-09 22:55:26 -05:00
|
|
|
static gboolean update_num_workspaces (int value);
|
2002-01-27 00:50:34 -05:00
|
|
|
static gboolean update_application_based (gboolean value);
|
2002-04-30 23:23:46 -04:00
|
|
|
static gboolean update_disable_workarounds (gboolean value);
|
2002-10-18 17:22:27 -04:00
|
|
|
static gboolean update_action_double_click_titlebar (const char *value);
|
2002-05-23 22:23:46 -04:00
|
|
|
static gboolean update_auto_raise (gboolean value);
|
|
|
|
static gboolean update_auto_raise_delay (int value);
|
2002-10-12 13:44:55 -04:00
|
|
|
static gboolean update_button_layout (const char *value);
|
2002-04-28 00:52:26 -04:00
|
|
|
static gboolean update_window_binding (const char *name,
|
|
|
|
const char *value);
|
|
|
|
static gboolean update_screen_binding (const char *name,
|
|
|
|
const char *value);
|
|
|
|
static gboolean update_binding (MetaKeyPref *binding,
|
|
|
|
const char *value);
|
2002-07-11 00:10:44 -04:00
|
|
|
static gboolean update_command (const char *name,
|
|
|
|
const char *value);
|
2004-10-13 04:32:10 -04:00
|
|
|
static gboolean update_terminal_command (const char *value);
|
2002-11-03 14:06:39 -05:00
|
|
|
static gboolean update_workspace_name (const char *name,
|
|
|
|
const char *value);
|
2003-10-12 02:25:38 -04:00
|
|
|
static gboolean update_reduced_resources (gboolean value);
|
2005-01-26 03:43:38 -05:00
|
|
|
static gboolean update_gnome_accessibility (gboolean value);
|
2005-07-11 09:25:08 -04:00
|
|
|
static gboolean update_cursor_theme (const char *value);
|
|
|
|
static gboolean update_cursor_size (int size);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
static void change_notify (GConfClient *client,
|
|
|
|
guint cnxn_id,
|
|
|
|
GConfEntry *entry,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
static char* gconf_key_for_workspace_name (int i);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
static void queue_changed (MetaPreference pref);
|
|
|
|
#endif /* HAVE_GCONF */
|
|
|
|
|
|
|
|
static void init_bindings (void);
|
|
|
|
static void init_commands (void);
|
|
|
|
static void init_workspace_names (void);
|
|
|
|
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
static void
|
|
|
|
emit_changed (MetaPreference pref)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n",
|
|
|
|
meta_preference_to_string (pref));
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
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;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
static void
|
|
|
|
queue_changed (MetaPreference pref)
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n",
|
|
|
|
meta_preference_to_string (pref));
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL)
|
|
|
|
changes = g_list_prepend (changes, GINT_TO_POINTER (pref));
|
|
|
|
else
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Change of pref %s was already pending\n",
|
|
|
|
meta_preference_to_string (pref));
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
/* add idle at priority below the gconf notify idle */
|
2001-12-09 17:41:12 -05:00
|
|
|
if (changed_idle == 0)
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY,
|
2002-04-28 00:52:26 -04:00
|
|
|
changed_idle_handler, NULL, NULL);
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
static void
|
|
|
|
cleanup_error (GError **error)
|
|
|
|
{
|
|
|
|
if (*error)
|
|
|
|
{
|
2001-12-09 22:55:26 -05:00
|
|
|
meta_warning ("%s\n", (*error)->message);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
g_error_free (*error);
|
|
|
|
*error = NULL;
|
|
|
|
}
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_init (void)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
GError *err = NULL;
|
|
|
|
char *str_val;
|
|
|
|
int int_val;
|
2003-01-28 10:07:43 -05:00
|
|
|
gboolean bool_val, bool_val_2;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
if (default_client != NULL)
|
2001-12-09 17:41:12 -05:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* returns a reference which we hold forever */
|
2002-02-07 22:34:26 -05:00
|
|
|
default_client = gconf_client_get_default ();
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
gconf_client_add_dir (default_client, "/apps/metacity",
|
2001-12-09 17:41:12 -05:00
|
|
|
GCONF_CLIENT_PRELOAD_RECURSIVE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
2005-01-25 13:02:39 -05:00
|
|
|
gconf_client_add_dir (default_client, "/desktop/gnome/applications/terminal",
|
|
|
|
GCONF_CLIENT_PRELOAD_RECURSIVE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
2005-01-26 03:43:38 -05:00
|
|
|
gconf_client_add_dir (default_client, KEY_GNOME_ACCESSIBILITY,
|
|
|
|
GCONF_CLIENT_PRELOAD_RECURSIVE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
2005-07-11 09:25:08 -04:00
|
|
|
gconf_client_add_dir (default_client, "/desktop/gnome/peripherals/mouse",
|
|
|
|
GCONF_CLIENT_PRELOAD_RECURSIVE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
str_val = gconf_client_get_string (default_client, KEY_MOUSE_BUTTON_MODS,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_mouse_button_mods (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
str_val = gconf_client_get_string (default_client, KEY_FOCUS_MODE,
|
2001-12-09 17:41:12 -05:00
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_focus_mode (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
2002-10-18 17:22:27 -04:00
|
|
|
str_val = gconf_client_get_string (default_client,
|
|
|
|
KEY_ACTION_DOUBLE_CLICK_TITLEBAR,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_action_double_click_titlebar (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_AUTO_RAISE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_auto_raise (bool_val);
|
|
|
|
|
|
|
|
int_val = gconf_client_get_int (default_client, KEY_AUTO_RAISE_DELAY,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_auto_raise_delay (int_val);
|
|
|
|
|
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
str_val = gconf_client_get_string (default_client, KEY_THEME,
|
2002-02-06 22:07:56 -05:00
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_theme (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
/* If the keys aren't set in the database, we use essentially
|
|
|
|
* bogus values instead of any kind of default. This is
|
|
|
|
* just lazy. But they keys ought to be set, anyhow.
|
|
|
|
*/
|
|
|
|
|
2002-05-23 22:55:54 -04:00
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_USE_SYSTEM_FONT,
|
2001-12-09 17:41:12 -05:00
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
2002-05-23 22:55:54 -04:00
|
|
|
update_use_system_font (bool_val);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
str_val = gconf_client_get_string (default_client, KEY_TITLEBAR_FONT,
|
2001-12-09 17:41:12 -05:00
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_titlebar_font (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
int_val = gconf_client_get_int (default_client, KEY_NUM_WORKSPACES,
|
2001-12-09 22:55:26 -05:00
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_num_workspaces (int_val);
|
2002-01-27 00:50:34 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_APPLICATION_BASED,
|
2002-01-27 00:50:34 -05:00
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_application_based (bool_val);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-04-30 23:23:46 -04:00
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_DISABLE_WORKAROUNDS,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_disable_workarounds (bool_val);
|
2002-10-12 13:44:55 -04:00
|
|
|
|
|
|
|
str_val = gconf_client_get_string (default_client, KEY_BUTTON_LAYOUT,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_button_layout (str_val);
|
|
|
|
g_free (str_val);
|
2002-04-30 23:23:46 -04:00
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_VISUAL_BELL,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
bool_val_2 = gconf_client_get_bool (default_client, KEY_AUDIBLE_BELL,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_visual_bell (bool_val, bool_val_2);
|
|
|
|
|
|
|
|
str_val = gconf_client_get_string (default_client, KEY_VISUAL_BELL_TYPE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_visual_bell_type (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
2003-10-12 02:25:38 -04:00
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_REDUCED_RESOURCES,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_reduced_resources (bool_val);
|
2004-10-13 04:32:10 -04:00
|
|
|
|
|
|
|
str_val = gconf_client_get_string (default_client, KEY_TERMINAL_COMMAND,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_terminal_command (str_val);
|
|
|
|
g_free (str_val);
|
2005-01-26 03:43:38 -05:00
|
|
|
|
|
|
|
bool_val = gconf_client_get_bool (default_client, KEY_GNOME_ACCESSIBILITY,
|
|
|
|
&err);
|
|
|
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_gnome_accessibility (bool_val);
|
2005-07-11 09:25:08 -04:00
|
|
|
|
|
|
|
str_val = gconf_client_get_string (default_client, KEY_CURSOR_THEME,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_cursor_theme (str_val);
|
|
|
|
g_free (str_val);
|
|
|
|
|
|
|
|
int_val = gconf_client_get_int (default_client, KEY_CURSOR_SIZE,
|
|
|
|
&err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
update_cursor_size (int_val);
|
2003-10-12 02:25:38 -04:00
|
|
|
#endif /* HAVE_GCONF */
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
/* Load keybindings prefs */
|
|
|
|
init_bindings ();
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
/* commands */
|
|
|
|
init_commands ();
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
|
|
/* workspace names */
|
|
|
|
init_workspace_names ();
|
2002-12-08 14:17:17 -05:00
|
|
|
|
|
|
|
#ifdef HAVE_GCONF
|
2002-02-07 22:34:26 -05:00
|
|
|
gconf_client_notify_add (default_client, "/apps/metacity",
|
2001-12-09 17:41:12 -05:00
|
|
|
change_notify,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&err);
|
2004-10-13 04:32:10 -04:00
|
|
|
gconf_client_notify_add (default_client, KEY_TERMINAL_COMMAND,
|
|
|
|
change_notify,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&err);
|
2005-01-26 03:43:38 -05:00
|
|
|
gconf_client_notify_add (default_client, KEY_GNOME_ACCESSIBILITY,
|
|
|
|
change_notify,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&err);
|
2005-07-11 09:25:08 -04:00
|
|
|
gconf_client_notify_add (default_client, "/desktop/gnome/peripherals/mouse",
|
|
|
|
change_notify,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&err);
|
2005-01-26 03:43:38 -05:00
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
cleanup_error (&err);
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-04-28 00:52:26 -04:00
|
|
|
/* from eel */
|
|
|
|
static gboolean
|
|
|
|
str_has_prefix (const char *haystack, const char *needle)
|
|
|
|
{
|
|
|
|
const char *h, *n;
|
|
|
|
|
|
|
|
/* Eat one character at a time. */
|
|
|
|
h = haystack == NULL ? "" : haystack;
|
|
|
|
n = needle == NULL ? "" : needle;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (*n == '\0')
|
|
|
|
return TRUE;
|
|
|
|
if (*h == '\0')
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
while (*h++ == *n++);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
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);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
if (strcmp (key, KEY_MOUSE_BUTTON_MODS) == 0)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_MOUSE_BUTTON_MODS);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_mouse_button_mods (str))
|
|
|
|
queue_changed (META_PREF_MOUSE_BUTTON_MODS);
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
else if (strcmp (key, KEY_FOCUS_MODE) == 0)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
else if (strcmp (key, KEY_THEME) == 0)
|
2002-02-06 22:07:56 -05:00
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_THEME);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
2002-02-06 23:32:48 -05:00
|
|
|
if (update_theme (str))
|
2002-02-06 22:07:56 -05:00
|
|
|
queue_changed (META_PREF_THEME);
|
|
|
|
}
|
2001-12-09 17:41:12 -05:00
|
|
|
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);
|
|
|
|
}
|
2002-05-23 22:55:54 -04:00
|
|
|
else if (strcmp (key, KEY_USE_SYSTEM_FONT) == 0)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
2002-05-23 22:55:54 -04:00
|
|
|
KEY_USE_SYSTEM_FONT);
|
2001-12-09 17:41:12 -05:00
|
|
|
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
|
|
|
|
*/
|
2002-05-23 22:55:54 -04:00
|
|
|
if (update_use_system_font (b))
|
2001-12-09 17:41:12 -05:00
|
|
|
queue_changed (META_PREF_TITLEBAR_FONT);
|
|
|
|
}
|
2001-12-09 22:55:26 -05:00
|
|
|
else if (strcmp (key, KEY_NUM_WORKSPACES) == 0)
|
|
|
|
{
|
|
|
|
int d;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_INT)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_NUM_WORKSPACES);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2002-01-27 00:50:34 -05:00
|
|
|
d = value ? gconf_value_get_int (value) : num_workspaces;
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
if (update_num_workspaces (d))
|
|
|
|
queue_changed (META_PREF_NUM_WORKSPACES);
|
|
|
|
}
|
2002-01-27 00:50:34 -05:00
|
|
|
else if (strcmp (key, KEY_APPLICATION_BASED) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-01-27 00:50:34 -05:00
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_APPLICATION_BASED);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
b = value ? gconf_value_get_bool (value) : application_based;
|
|
|
|
|
|
|
|
if (update_application_based (b))
|
|
|
|
queue_changed (META_PREF_APPLICATION_BASED);
|
|
|
|
}
|
2002-04-30 23:23:46 -04:00
|
|
|
else if (strcmp (key, KEY_DISABLE_WORKAROUNDS) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_APPLICATION_BASED);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
b = value ? gconf_value_get_bool (value) : disable_workarounds;
|
|
|
|
|
|
|
|
if (update_disable_workarounds (b))
|
|
|
|
queue_changed (META_PREF_DISABLE_WORKAROUNDS);
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
else if (str_has_prefix (key, KEY_WINDOW_BINDINGS_PREFIX))
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_window_binding (key, str))
|
|
|
|
queue_changed (META_PREF_WINDOW_KEYBINDINGS);
|
|
|
|
}
|
|
|
|
else if (str_has_prefix (key, KEY_SCREEN_BINDINGS_PREFIX))
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_screen_binding (key, str))
|
|
|
|
queue_changed (META_PREF_SCREEN_KEYBINDINGS);
|
|
|
|
}
|
2002-10-18 17:22:27 -04:00
|
|
|
else if (strcmp (key, KEY_ACTION_DOUBLE_CLICK_TITLEBAR) == 0)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_action_double_click_titlebar (str))
|
|
|
|
queue_changed (META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR);
|
|
|
|
}
|
2002-05-23 22:23:46 -04:00
|
|
|
else if (strcmp (key, KEY_AUTO_RAISE) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_AUTO_RAISE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
b = value ? gconf_value_get_bool (value) : auto_raise;
|
|
|
|
|
|
|
|
if (update_auto_raise (b))
|
|
|
|
queue_changed (META_PREF_AUTO_RAISE);
|
|
|
|
}
|
|
|
|
else if (strcmp (key, KEY_AUTO_RAISE_DELAY) == 0)
|
|
|
|
{
|
|
|
|
int d;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_INT)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_AUTO_RAISE_DELAY);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
d = value ? gconf_value_get_int (value) : 0;
|
|
|
|
|
|
|
|
if (update_auto_raise_delay (d))
|
|
|
|
queue_changed (META_PREF_AUTO_RAISE_DELAY);
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
else if (str_has_prefix (key, KEY_COMMAND_PREFIX))
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_command (key, str))
|
|
|
|
queue_changed (META_PREF_COMMANDS);
|
2002-05-23 22:23:46 -04:00
|
|
|
}
|
2004-10-13 04:32:10 -04:00
|
|
|
else if (strcmp (key, KEY_TERMINAL_COMMAND) == 0)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_TERMINAL_COMMAND);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_terminal_command (str))
|
|
|
|
queue_changed (META_PREF_TERMINAL_COMMAND);
|
|
|
|
}
|
2002-11-03 14:06:39 -05:00
|
|
|
else if (str_has_prefix (key, KEY_WORKSPACE_NAME_PREFIX))
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_workspace_name (key, str))
|
|
|
|
queue_changed (META_PREF_WORKSPACE_NAMES);
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
else if (strcmp (key, KEY_BUTTON_LAYOUT) == 0)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_BUTTON_LAYOUT);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_button_layout (str))
|
|
|
|
queue_changed (META_PREF_BUTTON_LAYOUT);
|
|
|
|
}
|
2003-01-28 10:07:43 -05:00
|
|
|
else if (strcmp (key, KEY_VISUAL_BELL) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
2004-04-29 20:26:48 -04:00
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
b = value ? gconf_value_get_bool (value) : provide_visual_bell;
|
|
|
|
if (update_visual_bell (b, bell_is_audible))
|
|
|
|
queue_changed (META_PREF_VISUAL_BELL);
|
|
|
|
}
|
|
|
|
else if (strcmp (key, KEY_AUDIBLE_BELL) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
2004-04-29 20:26:48 -04:00
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
key);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
b = value ? gconf_value_get_bool (value) : bell_is_audible;
|
|
|
|
if (update_visual_bell (provide_visual_bell, b))
|
|
|
|
queue_changed (META_PREF_AUDIBLE_BELL);
|
|
|
|
}
|
|
|
|
else if (strcmp (key, KEY_VISUAL_BELL_TYPE) == 0)
|
|
|
|
{
|
|
|
|
const char * str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_VISUAL_BELL_TYPE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
if (update_visual_bell_type (str))
|
|
|
|
queue_changed (META_PREF_VISUAL_BELL_TYPE);
|
|
|
|
}
|
2003-10-12 02:25:38 -04:00
|
|
|
else if (strcmp (key, KEY_REDUCED_RESOURCES) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_REDUCED_RESOURCES);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
b = value ? gconf_value_get_bool (value) : reduced_resources;
|
|
|
|
|
|
|
|
if (update_reduced_resources (b))
|
|
|
|
queue_changed (META_PREF_REDUCED_RESOURCES);
|
|
|
|
}
|
2005-01-26 03:43:38 -05:00
|
|
|
else if (strcmp (key, KEY_GNOME_ACCESSIBILITY) == 0)
|
|
|
|
{
|
|
|
|
gboolean b;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_BOOL)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_GNOME_ACCESSIBILITY);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
b = value ? gconf_value_get_bool (value) : gnome_accessibility;
|
|
|
|
|
|
|
|
if (update_gnome_accessibility (b))
|
|
|
|
queue_changed (META_PREF_GNOME_ACCESSIBILITY);
|
|
|
|
}
|
2005-07-11 09:25:08 -04:00
|
|
|
else if (strcmp (key, KEY_CURSOR_THEME) == 0)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_CURSOR_THEME);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
if (update_cursor_theme (str))
|
|
|
|
queue_changed (META_PREF_CURSOR_THEME);
|
|
|
|
}
|
|
|
|
else if (strcmp (key, KEY_CURSOR_SIZE) == 0)
|
|
|
|
{
|
|
|
|
int d;
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_INT)
|
|
|
|
{
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
KEY_CURSOR_SIZE);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
d = value ? gconf_value_get_int (value) : 24;
|
|
|
|
|
|
|
|
if (update_cursor_size (d))
|
|
|
|
queue_changed (META_PREF_CURSOR_SIZE);
|
|
|
|
}
|
2002-01-27 00:50:34 -05:00
|
|
|
else
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Key %s doesn't mean anything to Metacity\n",
|
|
|
|
key);
|
2002-01-27 00:50:34 -05:00
|
|
|
}
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
out:
|
|
|
|
/* nothing */
|
2002-08-10 11:55:18 -04:00
|
|
|
return; /* AIX compiler wants something after a label like out: */
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-10-07 19:14:40 -04:00
|
|
|
static gboolean
|
|
|
|
update_mouse_button_mods (const char *value)
|
|
|
|
{
|
|
|
|
MetaVirtualModifier old_mods = mouse_button_mods;
|
|
|
|
|
|
|
|
if (value != NULL)
|
|
|
|
{
|
|
|
|
MetaVirtualModifier mods;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Mouse button modifier has new gconf value \"%s\"\n",
|
|
|
|
value ? value : "none");
|
|
|
|
|
|
|
|
if (meta_ui_parse_modifier (value, &mods))
|
|
|
|
{
|
|
|
|
mouse_button_mods = mods;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Failed to parse new gconf value\n");
|
|
|
|
|
|
|
|
meta_warning (_("\"%s\" found in configuration database is not a valid value for mouse button modifier\n"),
|
|
|
|
value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return old_mods != mouse_button_mods;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-10-07 19:14:40 -04:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
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
|
2002-10-07 19:14:40 -04:00
|
|
|
meta_warning (_("GConf key '%s' is set to an invalid value\n"),
|
2001-12-09 17:41:12 -05:00
|
|
|
KEY_FOCUS_MODE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (old_mode != focus_mode);
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-02-06 22:07:56 -05:00
|
|
|
static gboolean
|
|
|
|
update_theme (const char *value)
|
|
|
|
{
|
2002-02-07 22:34:26 -05:00
|
|
|
char *old_theme;
|
2002-02-06 22:07:56 -05:00
|
|
|
gboolean changed;
|
|
|
|
|
|
|
|
old_theme = current_theme;
|
|
|
|
|
|
|
|
if (value != NULL && *value)
|
|
|
|
{
|
|
|
|
current_theme = g_strdup (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = TRUE;
|
|
|
|
if ((old_theme && current_theme &&
|
|
|
|
strcmp (old_theme, current_theme) == 0) ||
|
|
|
|
(old_theme == NULL && current_theme == NULL))
|
|
|
|
changed = FALSE;
|
|
|
|
|
|
|
|
if (old_theme != current_theme)
|
|
|
|
g_free (old_theme);
|
|
|
|
|
|
|
|
if (current_theme == NULL)
|
|
|
|
{
|
|
|
|
/* Fallback crackrock */
|
|
|
|
current_theme = g_strdup ("Atlanta");
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
|
|
MetaVirtualModifier
|
|
|
|
meta_prefs_get_mouse_button_mods (void)
|
|
|
|
{
|
|
|
|
return mouse_button_mods;
|
|
|
|
}
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
MetaFocusMode
|
|
|
|
meta_prefs_get_focus_mode (void)
|
|
|
|
{
|
|
|
|
return focus_mode;
|
|
|
|
}
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
const char*
|
|
|
|
meta_prefs_get_theme (void)
|
|
|
|
{
|
|
|
|
return current_theme;
|
|
|
|
}
|
|
|
|
|
2005-07-11 09:25:08 -04:00
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
static gboolean
|
|
|
|
update_cursor_theme (const char *value)
|
|
|
|
{
|
|
|
|
char *old_theme;
|
|
|
|
gboolean changed;
|
|
|
|
|
|
|
|
old_theme = cursor_theme;
|
|
|
|
|
|
|
|
if (value != NULL && *value)
|
|
|
|
{
|
|
|
|
cursor_theme = g_strdup (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = TRUE;
|
|
|
|
if ((old_theme && cursor_theme &&
|
|
|
|
strcmp (old_theme, cursor_theme) == 0) ||
|
|
|
|
(old_theme == NULL && cursor_theme == NULL))
|
|
|
|
changed = FALSE;
|
|
|
|
|
|
|
|
if (old_theme != cursor_theme)
|
|
|
|
g_free (old_theme);
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_GCONF */
|
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_prefs_get_cursor_theme (void)
|
|
|
|
{
|
|
|
|
return cursor_theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
static gboolean
|
|
|
|
update_cursor_size (int value)
|
|
|
|
{
|
|
|
|
int old = cursor_size;
|
|
|
|
|
|
|
|
cursor_size = value;
|
|
|
|
|
|
|
|
return old != value;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_prefs_get_cursor_size (void)
|
|
|
|
{
|
|
|
|
return cursor_size;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
static gboolean
|
2002-05-23 22:55:54 -04:00
|
|
|
update_use_system_font (gboolean value)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
2002-05-23 22:55:54 -04:00
|
|
|
gboolean old = use_system_font;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-05-23 22:55:54 -04:00
|
|
|
use_system_font = value;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
return old != value;
|
|
|
|
}
|
2003-01-28 10:07:43 -05:00
|
|
|
|
|
|
|
static MetaVisualBellType
|
|
|
|
visual_bell_type_from_string (const char *value)
|
|
|
|
{
|
|
|
|
if (value)
|
|
|
|
{
|
|
|
|
if (!strcmp (value, "fullscreen"))
|
|
|
|
{
|
|
|
|
return META_VISUAL_BELL_FULLSCREEN_FLASH;
|
|
|
|
}
|
|
|
|
else if (!strcmp (value, "frame_flash"))
|
|
|
|
{
|
|
|
|
return META_VISUAL_BELL_FRAME_FLASH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return META_VISUAL_BELL_FULLSCREEN_FLASH;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_visual_bell_type (const char *value)
|
|
|
|
{
|
|
|
|
MetaVisualBellType old_bell_type;
|
|
|
|
|
|
|
|
old_bell_type = visual_bell_type;
|
|
|
|
visual_bell_type = visual_bell_type_from_string (value);
|
|
|
|
|
|
|
|
return (visual_bell_type != old_bell_type);
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
static gboolean
|
|
|
|
update_visual_bell (gboolean visual_bell, gboolean audible_bell)
|
|
|
|
{
|
|
|
|
gboolean old_visual = provide_visual_bell;
|
|
|
|
gboolean old_audible = bell_is_audible;
|
|
|
|
gboolean has_changed;
|
|
|
|
|
|
|
|
provide_visual_bell = visual_bell;
|
|
|
|
bell_is_audible = audible_bell;
|
|
|
|
has_changed = (old_visual != provide_visual_bell) ||
|
|
|
|
(old_audible != bell_is_audible);
|
|
|
|
|
|
|
|
return has_changed;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-10-12 13:44:55 -04:00
|
|
|
static gboolean
|
|
|
|
button_layout_equal (const MetaButtonLayout *a,
|
|
|
|
const MetaButtonLayout *b)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < MAX_BUTTONS_PER_CORNER)
|
|
|
|
{
|
|
|
|
if (a->left_buttons[i] != b->left_buttons[i])
|
|
|
|
return FALSE;
|
|
|
|
if (a->right_buttons[i] != b->right_buttons[i])
|
|
|
|
return FALSE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaButtonFunction
|
|
|
|
button_function_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp (str, "menu") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_MENU;
|
|
|
|
else if (strcmp (str, "minimize") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_MINIMIZE;
|
|
|
|
else if (strcmp (str, "maximize") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_MAXIMIZE;
|
|
|
|
else if (strcmp (str, "close") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_CLOSE;
|
|
|
|
else
|
|
|
|
return META_BUTTON_FUNCTION_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_button_layout (const char *value)
|
|
|
|
{
|
|
|
|
MetaButtonLayout new_layout;
|
|
|
|
char **sides;
|
|
|
|
int i;
|
|
|
|
gboolean changed;
|
|
|
|
|
|
|
|
if (value == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < MAX_BUTTONS_PER_CORNER)
|
|
|
|
{
|
|
|
|
new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We need to ignore unknown button functions, for
|
|
|
|
* compat with future versions
|
|
|
|
*/
|
|
|
|
|
|
|
|
sides = g_strsplit (value, ":", 2);
|
|
|
|
|
|
|
|
if (sides[0] != NULL)
|
|
|
|
{
|
|
|
|
char **buttons;
|
|
|
|
int b;
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
{
|
|
|
|
used[i] = FALSE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
buttons = g_strsplit (sides[0], ",", -1);
|
|
|
|
i = 0;
|
|
|
|
b = 0;
|
|
|
|
while (buttons[b] != NULL)
|
|
|
|
{
|
|
|
|
MetaButtonFunction f = button_function_from_string (buttons[b]);
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
{
|
|
|
|
new_layout.left_buttons[i] = f;
|
|
|
|
used[f] = TRUE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
buttons[b]);
|
2002-10-12 13:44:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
++b;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sides[0] != NULL && sides[1] != NULL)
|
|
|
|
{
|
|
|
|
char **buttons;
|
|
|
|
int b;
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
{
|
|
|
|
used[i] = FALSE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
buttons = g_strsplit (sides[1], ",", -1);
|
|
|
|
i = 0;
|
|
|
|
b = 0;
|
|
|
|
while (buttons[b] != NULL)
|
|
|
|
{
|
|
|
|
MetaButtonFunction f = button_function_from_string (buttons[b]);
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
{
|
|
|
|
new_layout.right_buttons[i] = f;
|
|
|
|
used[f] = TRUE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
buttons[b]);
|
2002-10-12 13:44:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
++b;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (sides);
|
|
|
|
|
|
|
|
changed = !button_layout_equal (&button_layout, &new_layout);
|
|
|
|
|
|
|
|
button_layout = new_layout;
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-10-12 13:44:55 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
const PangoFontDescription*
|
|
|
|
meta_prefs_get_titlebar_font (void)
|
|
|
|
{
|
2002-05-23 22:55:54 -04:00
|
|
|
if (use_system_font)
|
2001-12-09 17:41:12 -05:00
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return titlebar_font;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 22:55:26 -05:00
|
|
|
static gboolean
|
|
|
|
update_num_workspaces (int value)
|
|
|
|
{
|
|
|
|
int old = num_workspaces;
|
|
|
|
|
|
|
|
if (value < 1 || value > MAX_REASONABLE_WORKSPACES)
|
|
|
|
{
|
|
|
|
meta_warning (_("%d stored in GConf key %s is not a reasonable number of workspaces, current maximum is %d\n"),
|
|
|
|
value, KEY_NUM_WORKSPACES, MAX_REASONABLE_WORKSPACES);
|
|
|
|
if (value < 1)
|
|
|
|
value = 1;
|
|
|
|
else if (value > MAX_REASONABLE_WORKSPACES)
|
|
|
|
value = MAX_REASONABLE_WORKSPACES;
|
|
|
|
}
|
|
|
|
|
|
|
|
num_workspaces = value;
|
|
|
|
|
|
|
|
return old != num_workspaces;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
int
|
|
|
|
meta_prefs_get_num_workspaces (void)
|
|
|
|
{
|
|
|
|
return num_workspaces;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-01-27 00:50:34 -05:00
|
|
|
static gboolean
|
|
|
|
update_application_based (gboolean value)
|
|
|
|
{
|
|
|
|
gboolean old = application_based;
|
|
|
|
|
2003-01-05 02:51:02 -05:00
|
|
|
/* DISABLE application_based feature for now */
|
|
|
|
#if 0
|
2002-01-27 00:50:34 -05:00
|
|
|
application_based = value;
|
2003-01-05 02:51:02 -05:00
|
|
|
#else
|
|
|
|
application_based = FALSE;
|
|
|
|
#endif
|
2002-01-27 00:50:34 -05:00
|
|
|
|
|
|
|
return old != application_based;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-01-27 00:50:34 -05:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_prefs_get_application_based (void)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
return FALSE; /* For now, we never want this to do anything */
|
|
|
|
|
2002-01-27 00:50:34 -05:00
|
|
|
return application_based;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-04-30 23:23:46 -04:00
|
|
|
static gboolean
|
|
|
|
update_disable_workarounds (gboolean value)
|
|
|
|
{
|
|
|
|
gboolean old = disable_workarounds;
|
|
|
|
|
|
|
|
disable_workarounds = value;
|
|
|
|
|
|
|
|
{
|
|
|
|
static gboolean first_disable = TRUE;
|
|
|
|
|
|
|
|
if (disable_workarounds && first_disable)
|
|
|
|
{
|
|
|
|
first_disable = FALSE;
|
|
|
|
|
|
|
|
meta_warning (_("Workarounds for broken applications disabled. Some applications may not behave properly.\n"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return old != disable_workarounds;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-04-30 23:23:46 -04:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_prefs_get_disable_workarounds (void)
|
|
|
|
{
|
|
|
|
return disable_workarounds;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-10-18 17:22:27 -04:00
|
|
|
static MetaActionDoubleClickTitlebar
|
|
|
|
action_double_click_titlebar_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp (str, "toggle_shade") == 0)
|
|
|
|
return META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE;
|
|
|
|
else if (strcmp (str, "toggle_maximize") == 0)
|
|
|
|
return META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE;
|
|
|
|
else
|
|
|
|
return META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_action_double_click_titlebar (const char *value)
|
|
|
|
{
|
|
|
|
MetaActionDoubleClickTitlebar old_action = action_double_click_titlebar;
|
|
|
|
|
|
|
|
if (value != NULL)
|
|
|
|
{
|
|
|
|
action_double_click_titlebar = action_double_click_titlebar_from_string (value);
|
|
|
|
|
|
|
|
if (action_double_click_titlebar == META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST)
|
|
|
|
{
|
|
|
|
action_double_click_titlebar = old_action;
|
|
|
|
meta_warning (_("GConf key '%s' is set to an invalid value\n"),
|
|
|
|
KEY_ACTION_DOUBLE_CLICK_TITLEBAR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (old_action != action_double_click_titlebar);
|
|
|
|
}
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
static gboolean
|
|
|
|
update_auto_raise (gboolean value)
|
|
|
|
{
|
|
|
|
gboolean old = auto_raise;
|
|
|
|
|
|
|
|
auto_raise = value;
|
|
|
|
|
|
|
|
return old != auto_raise;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MAX_REASONABLE_AUTO_RAISE_DELAY 10000
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_auto_raise_delay (int value)
|
|
|
|
{
|
|
|
|
int old = auto_raise_delay;
|
|
|
|
|
|
|
|
if (value < 0 || value > MAX_REASONABLE_AUTO_RAISE_DELAY)
|
|
|
|
{
|
|
|
|
meta_warning (_("%d stored in GConf key %s is out of range 0 to %d\n"),
|
|
|
|
value, KEY_AUTO_RAISE_DELAY,
|
|
|
|
MAX_REASONABLE_AUTO_RAISE_DELAY);
|
|
|
|
value = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto_raise_delay = value;
|
|
|
|
|
|
|
|
return old != auto_raise_delay;
|
|
|
|
}
|
2003-10-12 02:25:38 -04:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_reduced_resources (gboolean value)
|
|
|
|
{
|
|
|
|
gboolean old = reduced_resources;
|
|
|
|
|
|
|
|
reduced_resources = value;
|
|
|
|
|
|
|
|
return old != reduced_resources;
|
|
|
|
}
|
2005-01-26 03:43:38 -05:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_gnome_accessibility (gboolean value)
|
|
|
|
{
|
|
|
|
gboolean old = gnome_accessibility;
|
|
|
|
|
|
|
|
gnome_accessibility = value;
|
|
|
|
|
|
|
|
return old != gnome_accessibility;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-05-23 22:23:46 -04:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-12-09 17:41:12 -05:00
|
|
|
const char*
|
|
|
|
meta_preference_to_string (MetaPreference pref)
|
|
|
|
{
|
|
|
|
switch (pref)
|
|
|
|
{
|
2002-10-07 19:14:40 -04:00
|
|
|
case META_PREF_MOUSE_BUTTON_MODS:
|
|
|
|
return "MOUSE_BUTTON_MODS";
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
case META_PREF_FOCUS_MODE:
|
|
|
|
return "FOCUS_MODE";
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
case META_PREF_THEME:
|
|
|
|
return "THEME";
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
case META_PREF_TITLEBAR_FONT:
|
|
|
|
return "TITLEBAR_FONT";
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
case META_PREF_NUM_WORKSPACES:
|
|
|
|
return "NUM_WORKSPACES";
|
2002-01-27 00:50:34 -05:00
|
|
|
|
|
|
|
case META_PREF_APPLICATION_BASED:
|
|
|
|
return "APPLICATION_BASED";
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
case META_PREF_SCREEN_KEYBINDINGS:
|
|
|
|
return "SCREEN_KEYBINDINGS";
|
|
|
|
|
|
|
|
case META_PREF_WINDOW_KEYBINDINGS:
|
|
|
|
return "WINDOW_KEYBINDINGS";
|
2002-04-30 23:23:46 -04:00
|
|
|
|
|
|
|
case META_PREF_DISABLE_WORKAROUNDS:
|
|
|
|
return "DISABLE_WORKAROUNDS";
|
2002-05-23 22:23:46 -04:00
|
|
|
|
2002-10-18 17:22:27 -04:00
|
|
|
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
|
|
|
|
return "ACTION_DOUBLE_CLICK_TITLEBAR";
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
case META_PREF_AUTO_RAISE:
|
|
|
|
return "AUTO_RAISE";
|
|
|
|
|
|
|
|
case META_PREF_AUTO_RAISE_DELAY:
|
|
|
|
return "AUTO_RAISE_DELAY";
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
case META_PREF_COMMANDS:
|
|
|
|
return "COMMANDS";
|
2002-10-03 22:28:57 -04:00
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
case META_PREF_TERMINAL_COMMAND:
|
|
|
|
return "TERMINAL_COMMAND";
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
case META_PREF_BUTTON_LAYOUT:
|
|
|
|
return "BUTTON_LAYOUT";
|
|
|
|
break;
|
2002-11-19 22:57:20 -05:00
|
|
|
|
|
|
|
case META_PREF_WORKSPACE_NAMES:
|
|
|
|
return "WORKSPACE_NAMES";
|
|
|
|
break;
|
2003-01-28 10:07:43 -05:00
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL:
|
|
|
|
return "VISUAL_BELL";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_PREF_AUDIBLE_BELL:
|
|
|
|
return "AUDIBLE_BELL";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL_TYPE:
|
|
|
|
return "VISUAL_BELL_TYPE";
|
|
|
|
break;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
|
|
|
case META_PREF_REDUCED_RESOURCES:
|
|
|
|
return "REDUCED_RESOURCES";
|
|
|
|
break;
|
2005-01-26 03:43:38 -05:00
|
|
|
case META_PREF_GNOME_ACCESSIBILITY:
|
|
|
|
return "GNOME_ACCESSIBILTY";
|
|
|
|
break;
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return "(unknown)";
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-03-10 13:36:08 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_set_num_workspaces (int n_workspaces)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-03-10 13:36:08 -05:00
|
|
|
GError *err;
|
|
|
|
|
|
|
|
if (default_client == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (n_workspaces < 1)
|
|
|
|
n_workspaces = 1;
|
|
|
|
if (n_workspaces > MAX_REASONABLE_WORKSPACES)
|
|
|
|
n_workspaces = MAX_REASONABLE_WORKSPACES;
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
gconf_client_set_int (default_client,
|
|
|
|
KEY_NUM_WORKSPACES,
|
|
|
|
n_workspaces,
|
|
|
|
&err);
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
{
|
|
|
|
meta_warning (_("Error setting number of workspaces to %d: %s\n"),
|
|
|
|
num_workspaces,
|
|
|
|
err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-03-10 13:36:08 -05:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-07-13 23:16:41 -04:00
|
|
|
/* Indexes must correspond to MetaKeybindingAction */
|
2002-04-28 00:52:26 -04:00
|
|
|
static MetaKeyPref screen_bindings[] = {
|
2003-02-22 15:31:51 -05:00
|
|
|
{ META_KEYBINDING_WORKSPACE_1, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_2, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_3, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_4, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_5, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_6, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_7, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_8, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_9, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_10, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_11, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_12, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_LEFT, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_RIGHT, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_UP, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_WORKSPACE_DOWN, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_SWITCH_WINDOWS, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_SWITCH_WINDOWS_BACKWARD, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_SWITCH_PANELS, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_SWITCH_PANELS_BACKWARD, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_CYCLE_WINDOWS, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_CYCLE_WINDOWS_BACKWARD, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_CYCLE_PANELS, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_CYCLE_PANELS_BACKWARD, 0, 0, TRUE },
|
|
|
|
{ META_KEYBINDING_SHOW_DESKTOP, 0, 0, FALSE },
|
2003-02-23 21:16:09 -05:00
|
|
|
{ META_KEYBINDING_PANEL_MAIN_MENU, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_PANEL_RUN_DIALOG, 0, 0, FALSE },
|
2003-02-22 15:31:51 -05:00
|
|
|
{ META_KEYBINDING_COMMAND_1, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_2, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_3, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_4, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_5, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_6, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_7, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_8, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_9, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_10, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_11, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_12, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_13, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_14, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_15, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_16, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_17, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_18, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_19, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_20, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_21, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_22, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_23, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_24, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_25, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_26, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_27, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_28, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_29, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_30, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_31, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_32, 0, 0, FALSE },
|
2003-02-23 21:16:09 -05:00
|
|
|
{ META_KEYBINDING_COMMAND_SCREENSHOT, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_COMMAND_WIN_SCREENSHOT, 0, 0, FALSE },
|
2004-10-13 04:32:10 -04:00
|
|
|
{ META_KEYBINDING_RUN_COMMAND_TERMINAL, 0, 0, FALSE },
|
2003-02-22 15:31:51 -05:00
|
|
|
{ NULL, 0, 0, FALSE}
|
2002-04-28 00:52:26 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
static MetaKeyPref window_bindings[] = {
|
2003-02-22 15:31:51 -05:00
|
|
|
{ META_KEYBINDING_WINDOW_MENU, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_TOGGLE_FULLSCREEN, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_TOGGLE_MAXIMIZE, 0, 0, FALSE },
|
2003-06-27 10:49:56 -04:00
|
|
|
{ META_KEYBINDING_TOGGLE_ABOVE, 0, 0, FALSE },
|
2003-02-22 15:31:51 -05:00
|
|
|
{ META_KEYBINDING_MAXIMIZE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_UNMAXIMIZE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_TOGGLE_SHADE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MINIMIZE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_CLOSE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_BEGIN_MOVE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_BEGIN_RESIZE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_TOGGLE_STICKY, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_1, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_2, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_3, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_4, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_5, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_6, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_7, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_8, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_9, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_10, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_11, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_12, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_LEFT, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_RIGHT, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_UP, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MOVE_WORKSPACE_DOWN, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_RAISE_OR_LOWER, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_RAISE, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_LOWER, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MAXIMIZE_VERTICALLY, 0, 0, FALSE },
|
|
|
|
{ META_KEYBINDING_MAXIMIZE_HORIZONTALLY, 0, 0, FALSE },
|
|
|
|
{ NULL, 0, 0, FALSE }
|
2002-04-28 00:52:26 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_bindings (void)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-04-28 00:52:26 -04:00
|
|
|
int i;
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (window_bindings[i].name)
|
|
|
|
{
|
|
|
|
char *str_val;
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
key = g_strconcat (KEY_WINDOW_BINDINGS_PREFIX, "/",
|
|
|
|
window_bindings[i].name, NULL);
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
update_binding (&window_bindings[i], str_val);
|
|
|
|
|
|
|
|
g_free (str_val);
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (screen_bindings[i].name)
|
|
|
|
{
|
|
|
|
char *str_val;
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/",
|
|
|
|
screen_bindings[i].name, NULL);
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
update_binding (&screen_bindings[i], str_val);
|
|
|
|
|
|
|
|
g_free (str_val);
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
static void
|
|
|
|
init_commands (void)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-07-11 00:10:44 -04:00
|
|
|
int i;
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
i = 0;
|
2002-11-03 14:06:39 -05:00
|
|
|
while (i < MAX_COMMANDS)
|
2002-07-11 00:10:44 -04:00
|
|
|
{
|
|
|
|
char *str_val;
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
key = meta_prefs_get_gconf_key_for_command (i);
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
update_command (key, str_val);
|
|
|
|
|
|
|
|
g_free (str_val);
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-07-11 00:10:44 -04:00
|
|
|
}
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
static void
|
|
|
|
init_workspace_names (void)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
int i;
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < MAX_REASONABLE_WORKSPACES)
|
|
|
|
{
|
|
|
|
char *str_val;
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
key = gconf_key_for_workspace_name (i);
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
update_workspace_name (key, str_val);
|
|
|
|
|
2002-11-19 22:57:20 -05:00
|
|
|
g_assert (workspace_names[i] != NULL);
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
g_free (str_val);
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-04-28 00:52:26 -04:00
|
|
|
static gboolean
|
|
|
|
update_binding (MetaKeyPref *binding,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
unsigned int keysym;
|
2002-07-13 23:16:41 -04:00
|
|
|
MetaVirtualModifier mods;
|
2002-04-28 00:52:26 -04:00
|
|
|
gboolean changed;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Binding \"%s\" has new gconf value \"%s\"\n",
|
|
|
|
binding->name, value ? value : "none");
|
|
|
|
|
|
|
|
keysym = 0;
|
2002-07-13 23:16:41 -04:00
|
|
|
mods = 0;
|
2002-04-28 00:52:26 -04:00
|
|
|
if (value)
|
|
|
|
{
|
2002-07-13 23:16:41 -04:00
|
|
|
if (!meta_ui_parse_accelerator (value, &keysym, &mods))
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Failed to parse new gconf value\n");
|
2002-10-07 19:14:40 -04:00
|
|
|
meta_warning (_("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n"),
|
2002-04-28 00:52:26 -04:00
|
|
|
value, binding->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = FALSE;
|
|
|
|
if (keysym != binding->keysym ||
|
2002-07-13 23:16:41 -04:00
|
|
|
mods != binding->modifiers)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
|
|
|
changed = TRUE;
|
|
|
|
|
|
|
|
binding->keysym = keysym;
|
2002-07-13 23:16:41 -04:00
|
|
|
binding->modifiers = mods;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2002-07-13 23:16:41 -04:00
|
|
|
"New keybinding for \"%s\" is keysym = 0x%x mods = 0x%x\n",
|
|
|
|
binding->name, binding->keysym, binding->modifiers);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Keybinding for \"%s\" is unchanged\n", binding->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar*
|
|
|
|
relative_key (const gchar* key)
|
|
|
|
{
|
|
|
|
const gchar* end;
|
|
|
|
|
|
|
|
end = strrchr (key, '/');
|
|
|
|
|
|
|
|
++end;
|
|
|
|
|
|
|
|
return end;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return value is TRUE if a preference changed and we need to
|
|
|
|
* notify
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
find_and_update_binding (MetaKeyPref *bindings,
|
|
|
|
const char *name,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
const char *key;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (*name == '/')
|
|
|
|
key = relative_key (name);
|
|
|
|
else
|
|
|
|
key = name;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (bindings[i].name &&
|
|
|
|
strcmp (key, bindings[i].name) != 0)
|
|
|
|
++i;
|
|
|
|
|
|
|
|
if (bindings[i].name)
|
|
|
|
return update_binding (&bindings[i], value);
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_window_binding (const char *name,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
return find_and_update_binding (window_bindings, name, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_screen_binding (const char *name,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
return find_and_update_binding (screen_bindings, name, value);
|
|
|
|
}
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
static gboolean
|
|
|
|
update_command (const char *name,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
p = strrchr (name, '_');
|
|
|
|
if (p == NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Command %s has no underscore?\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
++p;
|
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
if (g_ascii_isdigit (*p))
|
2002-07-11 00:10:44 -04:00
|
|
|
{
|
2003-02-23 21:16:09 -05:00
|
|
|
i = atoi (p);
|
|
|
|
i -= 1; /* count from 0 not 1 */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p = strrchr (name, '/');
|
|
|
|
++p;
|
|
|
|
|
|
|
|
if (strcmp (p, "command_screenshot") == 0)
|
|
|
|
{
|
|
|
|
i = SCREENSHOT_COMMAND_IDX;
|
|
|
|
}
|
|
|
|
else if (strcmp (p, "command_window_screenshot") == 0)
|
|
|
|
{
|
|
|
|
i = WIN_SCREENSHOT_COMMAND_IDX;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Command %s doesn't end in number?\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-11 00:10:44 -04:00
|
|
|
}
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
if (i >= MAX_COMMANDS)
|
2002-07-11 00:10:44 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Command %d is too highly numbered, ignoring\n", i);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
if ((commands[i] == NULL && value == NULL) ||
|
|
|
|
(commands[i] && value && strcmp (commands[i], value) == 0))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Command %d is unchanged\n", i);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
g_free (commands[i]);
|
|
|
|
commands[i] = g_strdup (value);
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Updated command %d to \"%s\"\n",
|
|
|
|
i, commands[i] ? commands[i] : "none");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-10-13 04:32:10 -04:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_terminal_command (const char *value)
|
|
|
|
{
|
|
|
|
char *old_terminal_command;
|
|
|
|
gboolean changed;
|
|
|
|
|
|
|
|
old_terminal_command = terminal_command;
|
|
|
|
|
|
|
|
if (value != NULL && *value)
|
|
|
|
{
|
|
|
|
terminal_command = g_strdup (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = TRUE;
|
|
|
|
if ((old_terminal_command && terminal_command &&
|
|
|
|
strcmp (old_terminal_command, terminal_command) == 0) ||
|
|
|
|
(old_terminal_command == NULL && terminal_command == NULL))
|
|
|
|
changed = FALSE;
|
|
|
|
|
|
|
|
if (old_terminal_command != terminal_command)
|
|
|
|
g_free (old_terminal_command);
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_prefs_get_command (int i)
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
g_return_val_if_fail (i >= 0 && i < MAX_COMMANDS, NULL);
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
return commands[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
char*
|
|
|
|
meta_prefs_get_gconf_key_for_command (int i)
|
|
|
|
{
|
|
|
|
char *key;
|
2003-02-23 21:16:09 -05:00
|
|
|
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case SCREENSHOT_COMMAND_IDX:
|
|
|
|
key = g_strdup (KEY_COMMAND_PREFIX "screenshot");
|
|
|
|
break;
|
|
|
|
case WIN_SCREENSHOT_COMMAND_IDX:
|
|
|
|
key = g_strdup (KEY_COMMAND_PREFIX "window_screenshot");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
key = g_strdup_printf (KEY_COMMAND_PREFIX"%d", i + 1);
|
|
|
|
break;
|
|
|
|
}
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
const char*
|
|
|
|
meta_prefs_get_terminal_command (void)
|
|
|
|
{
|
|
|
|
return terminal_command;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_prefs_get_gconf_key_for_terminal_command (void)
|
|
|
|
{
|
|
|
|
return KEY_TERMINAL_COMMAND;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
static gboolean
|
|
|
|
update_workspace_name (const char *name,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
p = strrchr (name, '_');
|
|
|
|
if (p == NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace name %s has no underscore?\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
if (!g_ascii_isdigit (*p))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace name %s doesn't end in number?\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = atoi (p);
|
|
|
|
i -= 1; /* count from 0 not 1 */
|
|
|
|
|
|
|
|
if (i >= MAX_REASONABLE_WORKSPACES)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace name %d is too highly numbered, ignoring\n", i);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-11-19 22:57:20 -05:00
|
|
|
if (workspace_names[i] && value && strcmp (workspace_names[i], value) == 0)
|
2002-11-03 14:06:39 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace name %d is unchanged\n", i);
|
|
|
|
return FALSE;
|
2002-11-19 22:57:20 -05:00
|
|
|
}
|
|
|
|
|
2002-12-08 09:59:14 -05:00
|
|
|
/* This is a bad hack. We have to treat empty string as
|
|
|
|
* "unset" because the root window property can't contain
|
|
|
|
* null. So it gets empty string instead and we don't want
|
|
|
|
* that to result in setting the empty string as a value that
|
|
|
|
* overrides "unset".
|
|
|
|
*/
|
|
|
|
if (value != NULL && *value != '\0')
|
2002-11-19 22:57:20 -05:00
|
|
|
{
|
|
|
|
g_free (workspace_names[i]);
|
|
|
|
workspace_names[i] = g_strdup (value);
|
|
|
|
}
|
2002-11-03 14:06:39 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* use a default name */
|
|
|
|
char *d;
|
2002-11-19 22:57:20 -05:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
d = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
|
|
if (workspace_names[i] && strcmp (workspace_names[i], d) == 0)
|
|
|
|
{
|
|
|
|
g_free (d);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-19 22:57:20 -05:00
|
|
|
g_free (workspace_names[i]);
|
2002-11-03 14:06:39 -05:00
|
|
|
workspace_names[i] = d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Updated workspace name %d to \"%s\"\n",
|
|
|
|
i, workspace_names[i] ? workspace_names[i] : "none");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_prefs_get_workspace_name (int i)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (i >= 0 && i < MAX_REASONABLE_WORKSPACES, NULL);
|
2002-11-19 22:57:20 -05:00
|
|
|
|
|
|
|
g_assert (workspace_names[i] != NULL);
|
2002-11-19 23:54:01 -05:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Getting workspace name for %d: \"%s\"\n",
|
|
|
|
i, workspace_names[i]);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
|
|
return workspace_names[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_change_workspace_name (int i,
|
|
|
|
const char *name)
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
char *key;
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
g_return_if_fail (i >= 0 && i < MAX_REASONABLE_WORKSPACES);
|
|
|
|
|
2002-11-19 23:54:01 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Changing name of workspace %d to %s\n",
|
|
|
|
i, name ? name : "none");
|
|
|
|
|
|
|
|
/* This is a bad hack. We have to treat empty string as
|
|
|
|
* "unset" because the root window property can't contain
|
|
|
|
* null. So it gets empty string instead and we don't want
|
|
|
|
* that to result in setting the empty string as a value that
|
|
|
|
* overrides "unset".
|
|
|
|
*/
|
|
|
|
if (name && *name == '\0')
|
|
|
|
name = NULL;
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
if ((name == NULL && workspace_names[i] == NULL) ||
|
|
|
|
(name && workspace_names[i] && strcmp (name, workspace_names[i]) == 0))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace %d already has name %s\n",
|
|
|
|
i, name ? name : "none");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
key = gconf_key_for_workspace_name (i);
|
|
|
|
|
|
|
|
err = NULL;
|
2002-12-15 13:51:29 -05:00
|
|
|
if (name != NULL)
|
|
|
|
gconf_client_set_string (default_client,
|
|
|
|
key, name,
|
|
|
|
&err);
|
|
|
|
else
|
|
|
|
gconf_client_unset (default_client,
|
|
|
|
key, &err);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2002-12-15 13:51:29 -05:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
if (err)
|
|
|
|
{
|
|
|
|
meta_warning (_("Error setting name for workspace %d to \"%s\": %s\n"),
|
|
|
|
i, name ? name : "none",
|
|
|
|
err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (key);
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
static char*
|
|
|
|
gconf_key_for_workspace_name (int i)
|
|
|
|
{
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
key = g_strdup_printf (KEY_WORKSPACE_NAME_PREFIX"%d", i + 1);
|
|
|
|
|
|
|
|
return key;
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
void
|
2002-10-12 13:44:55 -04:00
|
|
|
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
|
2002-10-03 22:28:57 -04:00
|
|
|
{
|
2002-10-12 13:44:55 -04:00
|
|
|
*button_layout_p = button_layout;
|
2002-10-03 22:28:57 -04:00
|
|
|
}
|
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_visual_bell (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
{
|
|
|
|
return provide_visual_bell;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_bell_is_audible (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
{
|
|
|
|
return bell_is_audible;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaVisualBellType
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_visual_bell_type (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
{
|
|
|
|
return visual_bell_type;
|
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
void
|
|
|
|
meta_prefs_get_screen_bindings (const MetaKeyPref **bindings,
|
|
|
|
int *n_bindings)
|
|
|
|
{
|
|
|
|
|
|
|
|
*bindings = screen_bindings;
|
|
|
|
*n_bindings = (int) G_N_ELEMENTS (screen_bindings) - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
|
|
|
|
int *n_bindings)
|
|
|
|
{
|
|
|
|
*bindings = window_bindings;
|
|
|
|
*n_bindings = (int) G_N_ELEMENTS (window_bindings) - 1;
|
|
|
|
}
|
2002-10-18 17:22:27 -04:00
|
|
|
|
|
|
|
MetaActionDoubleClickTitlebar
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_action_double_click_titlebar (void)
|
2002-10-18 17:22:27 -04:00
|
|
|
{
|
|
|
|
return action_double_click_titlebar;
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_auto_raise (void)
|
2002-05-23 22:23:46 -04:00
|
|
|
{
|
|
|
|
return auto_raise;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_auto_raise_delay (void)
|
2002-05-23 22:23:46 -04:00
|
|
|
{
|
|
|
|
return auto_raise_delay;
|
|
|
|
}
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2003-10-12 02:25:38 -04:00
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_reduced_resources (void)
|
2003-10-12 02:25:38 -04:00
|
|
|
{
|
|
|
|
return reduced_resources;
|
|
|
|
}
|
|
|
|
|
2005-01-26 03:43:38 -05:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_gnome_accessibility ()
|
|
|
|
{
|
|
|
|
return gnome_accessibility;
|
|
|
|
}
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
MetaKeyBindingAction
|
2002-07-13 23:16:41 -04:00
|
|
|
meta_prefs_get_keybinding_action (const char *name)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-07-13 23:16:41 -04:00
|
|
|
i = G_N_ELEMENTS (screen_bindings) - 2; /* -2 for dummy entry at end */
|
2002-06-09 00:04:19 -04:00
|
|
|
while (i >= 0)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
2002-07-13 23:16:41 -04:00
|
|
|
if (strcmp (screen_bindings[i].name, name) == 0)
|
2002-06-08 23:44:16 -04:00
|
|
|
return (MetaKeyBindingAction) i;
|
2002-06-09 00:04:19 -04:00
|
|
|
|
|
|
|
--i;
|
2002-06-08 23:44:16 -04:00
|
|
|
}
|
2002-06-09 00:04:19 -04:00
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
}
|
|
|
|
|
2002-09-26 21:40:17 -04:00
|
|
|
void
|
|
|
|
meta_prefs_get_window_binding (const char *name,
|
|
|
|
unsigned int *keysym,
|
|
|
|
MetaVirtualModifier *modifiers)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = G_N_ELEMENTS (window_bindings) - 2; /* -2 for dummy entry at end */
|
|
|
|
while (i >= 0)
|
|
|
|
{
|
|
|
|
if (strcmp (window_bindings[i].name, name) == 0)
|
|
|
|
{
|
|
|
|
*keysym = window_bindings[i].keysym;
|
|
|
|
*modifiers = window_bindings[i].modifiers;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
--i;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|