diff options
Diffstat (limited to 'src/core/prefs.c')
-rw-r--r-- | src/core/prefs.c | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/src/core/prefs.c b/src/core/prefs.c index 8847614e..2f3e9392 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -162,10 +162,14 @@ static void button_layout_handler (MetaPreference, const gchar*, gboolean*); static gboolean update_binding (MetaKeyPref *binding, gchar *value); -static void init_bindings (void); +static void init_bindings (GSettings *); +static void init_screen_bindings (void); +static void init_window_bindings (void); static void init_commands (void); static void init_workspace_names (void); +static MetaPlacementMode placement_mode = META_PLACEMENT_MODE_AUTOMATIC; + typedef struct { MetaPrefsChangedFunc func; @@ -315,6 +319,11 @@ static MetaEnumPreference preferences_enum[] = META_PREF_ACTION_RIGHT_CLICK_TITLEBAR, (gint *) &action_right_click_titlebar, }, + { "placement-mode", + KEY_GENERAL_SCHEMA, + META_PREF_PLACEMENT_MODE, + (gint *) &placement_mode, + }, { NULL, NULL, 0, NULL }, }; @@ -890,13 +899,6 @@ meta_prefs_init (void) g_hash_table_insert (settings_schemas, KEY_MATE_TERMINAL_SCHEMA, settings_mate_terminal); g_hash_table_insert (settings_schemas, KEY_MATE_MOUSE_SCHEMA, settings_mate_mouse); - /* Pick up initial values. */ - - handle_preference_init_enum (); - handle_preference_init_bool (); - handle_preference_init_string (); - handle_preference_init_int (); - g_signal_connect (settings_general, "changed", G_CALLBACK (change_notify), NULL); g_signal_connect (settings_command, "changed", G_CALLBACK (change_notify), NULL); g_signal_connect (settings_screen_bindings, "changed", G_CALLBACK (change_notify), NULL); @@ -909,7 +911,15 @@ meta_prefs_init (void) g_signal_connect (settings_mate_mouse, "changed::" KEY_MATE_MOUSE_CURSOR_THEME, G_CALLBACK (change_notify), NULL); g_signal_connect (settings_mate_mouse, "changed::" KEY_MATE_MOUSE_CURSOR_SIZE, G_CALLBACK (change_notify), NULL); - init_bindings (); + /* Pick up initial values. */ + + handle_preference_init_enum (); + handle_preference_init_bool (); + handle_preference_init_string (); + handle_preference_init_int (); + + init_screen_bindings (); + init_window_bindings (); init_commands (); init_workspace_names (); } @@ -972,7 +982,7 @@ change_notify (GSettings *settings, g_free(str); } - else if (g_strcmp0 (schema_name, KEY_WORKSPACE_NAME_SCHEMA)) + else if (g_strcmp0 (schema_name, KEY_WORKSPACE_NAME_SCHEMA) == 0) { gchar *str; str = g_settings_get_string (settings, key); @@ -1553,6 +1563,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_SIDE_BY_SIDE_TILING: return "SIDE_BY_SIDE_TILING"; + + case META_PREF_PLACEMENT_MODE: + return "PLACEMENT_MODE"; } return "(unknown)"; @@ -1582,32 +1595,32 @@ static MetaKeyPref key_bindings[] = { #undef keybind static void -init_bindings (void) +init_bindings (GSettings *settings) { - const char *prefix[] = { - KEY_WINDOW_BINDINGS_SCHEMA, - KEY_SCREEN_BINDINGS_SCHEMA, - NULL - }; - int i; gchar **list = NULL; gchar *str_val = NULL; - GSettings *bindings_settings = NULL; - for (i = 0; prefix[i]; i++) + list = g_settings_list_keys (settings); + while (*list != NULL) { - bindings_settings = g_settings_new (prefix [i]); - list = g_settings_list_keys (bindings_settings); - while (*list != NULL) - { - str_val = g_settings_get_string (bindings_settings, *list); - update_key_binding (*list, str_val); - list++; - } + str_val = g_settings_get_string (settings, *list); + update_key_binding (*list, str_val); + list++; } + g_free (str_val); - g_object_unref (bindings_settings); +} + +static void +init_screen_bindings (void) +{ + init_bindings (settings_screen_bindings); +} +static void +init_window_bindings (void) +{ + init_bindings (settings_window_bindings); } static void @@ -1623,6 +1636,7 @@ init_commands (void) update_command (*list, str_val); list++; } + g_free (str_val); } @@ -1639,6 +1653,7 @@ init_workspace_names (void) update_workspace_name (*list, str_val); list++; } + g_free (str_val); } @@ -2236,6 +2251,12 @@ meta_prefs_get_force_fullscreen (void) return force_fullscreen; } +MetaPlacementMode +meta_prefs_get_placement_mode (void) +{ + return placement_mode; +} + void meta_prefs_set_force_compositing_manager (gboolean whether) { |