Index: settings-dialogs/xfwm4-settings.desktop.in =================================================================== --- settings-dialogs/xfwm4-settings.desktop.in (revision 0) +++ settings-dialogs/xfwm4-settings.desktop.in (revision 0) @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +_Name=Xfce 4 Windowmanager Settings +_GenericName=Windowmanager Settings +_Comment= +Exec=xfwm4-settings +Icon=xfwm4 +Terminal=false +Type=Application +Categories=X-XFCE;Settings;DesktopSettings; +StartupNotify=true +OnlyShowIn=XFCE; Index: settings-dialogs/xfwm4-settings.c =================================================================== --- settings-dialogs/xfwm4-settings.c (revision 0) +++ settings-dialogs/xfwm4-settings.c (revision 0) @@ -0,0 +1,1164 @@ +/* + * Copyright (c) 2008 Stephan Arts + * + * 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 Library 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. + * + * Based on the mcs-plugin written by olivier fourdan + */ + + +#include +#include + +#include + +#if defined(GETTEXT_PACKAGE) +#include +#else +#include +#endif + +#include +#include + +#include +#include +#include "xfwm4-dialog_glade.h" + +typedef enum { + THEME_TYPE_XFWM4, + THEME_TYPE_KEYTHEME, +} ThemeType; + +typedef struct { + const gchar *name; + const gchar *key; + gchar *value; +} KeyThemeTmpl; + +typedef struct { + gchar *name; + gchar *value; +} MenuTmpl; + +static const MenuTmpl dbl_click_values[] = { + {N_("Shade window"), "shade"}, + {N_("Hide window"), "hide"}, + {N_("Maximize window"), "maximize"}, + {N_("Fill window"), "fill"}, + {N_("Nothing"), "none"}, + {NULL, NULL} +}; + +static const MenuTmpl title_align_values[] = { + {N_("Left"), "left"}, + {N_("Center"), "center"}, + {N_("Right"), "right"}, + {NULL, NULL} +}; + +static KeyThemeTmpl key_theme_values[] = { + {N_("Window operations menu"), "popup_menu_key", NULL}, + {N_("Up"), "up_key", NULL}, + {N_("Down"), "down_key", NULL}, + {N_("Left"), "left_key", NULL}, + {N_("Right"), "right_key", NULL}, + {N_("Cancel"), "cancel_key", NULL}, + {N_("Cycle windows"), "cycle_windows_key", NULL}, + {N_("Close window"), "close_window_key", NULL}, + {N_("Maximize window horizontally"), "maximize_horiz_key", NULL}, + {N_("Maximize window vertically"), "maximize_vert_key", NULL}, + {N_("Maximize window"), "maximize_window_key", NULL}, + {N_("Hide window"), "hide_window_key", NULL}, + {N_("Move window"), "move_window_key", NULL}, + {N_("Resize window"), "resize_window_key", NULL}, + {N_("Shade window"), "shade_window_key", NULL}, + {N_("Stick window"), "stick_window_key", NULL}, + {N_("Raise window"), "raise_window_key", NULL}, + {N_("Lower window"), "lower_window_key", NULL}, + {N_("Fill window"), "fill_window_key", NULL}, + {N_("Fill window horizontally"), "fill_horiz_key", NULL}, + {N_("Fill window vertically"), "fill_vert_key", NULL}, + {N_("Toggle above"), "above_key", NULL}, + {N_("Toggle fullscreen"), "fullscreen_key", NULL}, + {N_("Move window to upper workspace"), "move_window_up_workspace_key", NULL}, + {N_("Move window to bottom workspace"), "move_window_down_workspace_key", NULL}, + {N_("Move window to left workspace"), "move_window_left_workspace_key", NULL}, + {N_("Move window to right workspace"), "move_window_right_workspace_key", NULL}, + {N_("Move window to previous workspace"), "move_window_prev_workspace_key", NULL}, + {N_("Move window to next workspace"), "move_window_next_workspace_key", NULL}, + {N_("Show desktop"), "show_desktop_key", NULL}, + {N_("Upper workspace"), "up_workspace_key", NULL}, + {N_("Bottom workspace"), "down_workspace_key", NULL}, + {N_("Left workspace"), "left_workspace_key", NULL}, + {N_("Right workspace"), "right_workspace_key", NULL}, + {N_("Previous workspace"), "prev_workspace_key", NULL}, + {N_("Next workspace"), "next_workspace_key", NULL}, + {N_("Add workspace"), "add_workspace_key", NULL}, + {N_("Add adjacent workspace"), "add_adjacent_workspace_key", NULL}, + {N_("Delete last workspace"), "del_workspace_key", NULL}, + {N_("Delete active workspace"), "del_active_workspace_key", NULL}, + {NULL, NULL, NULL} +}; + +#define INDICATOR_SIZE 9 + + + +static gboolean version = FALSE; + +static void +cb_xfwm4_theme_treeselection_changed (GtkTreeSelection *selection, XfconfChannel *channel); + +static void +cb_xfwm4_dbl_click_changed (GtkComboBox *combo, XfconfChannel *channel); + +static void +cb_xfwm4_title_align_changed (GtkComboBox *combo, XfconfChannel *channel); + +static void +cb_xwfm4_title_button_alignment_changed (GtkComboBox *combo, GtkButton *button); + +static void +cb_xfwm4_channel_double_click_action_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + GtkComboBox *combo); + +static void +cb_xfwm4_channel_title_alignment_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + GtkComboBox *combo); + +static void +cb_xfwm4_channel_button_layout_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + GtkContainer *hidden_box); + +static gboolean +str_starts_with(const gchar *str, const gchar *start); + +static void +save_button_layout (GtkContainer *container, XfconfChannel *channel); + +static void +cb_xfwm4_active_frame_drag_data (GtkWidget*, GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint, GtkWidget*); +static gboolean +cb_xfwm4_active_frame_drag_motion (GtkWidget*, GdkDragContext*, gint, gint, guint, GtkWidget*); +static void +cb_xfwm4_active_frame_drag_leave (GtkWidget*, GdkDragContext*, guint, GtkWidget*); +static void +cb_xfwm4_hidden_frame_drag_data (GtkWidget*, GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint, GtkWidget*); +static void +cb_xfwm4_title_button_data_get (GtkWidget*, GdkDragContext*, GtkSelectionData*, guint, guint, const gchar*); +static void +cb_xfwm4_title_button_drag_begin (GtkWidget*, GdkDragContext*, gpointer); +static void +cb_xfwm4_title_button_drag_end (GtkWidget*, GdkDragContext*, gpointer); +static gboolean +cb_xfwm4_signal_blocker (GtkWidget*, gpointer); + +static GdkPixbuf* +xfwm4_create_icon_from_widget(GtkWidget *widget); + +static void +xfwm4_create_indicator(GtkWidget *box, gint x, gint y, gint width, gint height); +static void +xfwm4_delete_indicator(GtkWidget *box); + +void +check_keytheme_contents (GtkListStore *list_store, GtkTreeView *tree_view, XfconfChannel *channel) +{ + gchar *active_theme_name = xfconf_channel_get_string (channel, "/general/keytheme", "Default"); +} + +void +check_xfwm4_themes (GtkListStore *list_store, GtkTreeView *tree_view, XfconfChannel *channel, ThemeType type) +{ + GSList *check_list = NULL; + gint i; + const gchar *file; + gchar *xfwm4rc_filename; + gchar **xfwm4_theme_dirs; + GDir *dir; + gchar *active_theme_name = NULL; + GtkTreeIter iter; + GtkTreePath *tree_path = NULL; + GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view); + + switch (type) + { + case THEME_TYPE_XFWM4: + active_theme_name = xfconf_channel_get_string (channel, "/general/theme", "Default"); + break; + case THEME_TYPE_KEYTHEME: + active_theme_name = xfconf_channel_get_string (channel, "/general/keytheme", "Default"); + break; + } + + xfce_resource_push_path (XFCE_RESOURCE_THEMES, DATADIR G_DIR_SEPARATOR_S "themes"); + xfwm4_theme_dirs = xfce_resource_dirs (XFCE_RESOURCE_THEMES); + xfce_resource_pop_path (XFCE_RESOURCE_THEMES); + + /* Iterate over all base directories */ + for (i = 0; xfwm4_theme_dirs[i] != NULL; ++i) + { + /* Open directory handle */ + dir = g_dir_open (xfwm4_theme_dirs[i], 0, NULL); + + /* Try next base directory if this one cannot be read */ + if (G_UNLIKELY (dir == NULL)) + continue; + + /* Iterate over filenames in the directory */ + while ((file = g_dir_read_name (dir)) != NULL) + { + /* Build the theme style filename */ + switch (type) + { + case THEME_TYPE_XFWM4: + xfwm4rc_filename = g_build_filename (xfwm4_theme_dirs[i], file, "xfwm4", "themerc", NULL); + break; + case THEME_TYPE_KEYTHEME: + xfwm4rc_filename = g_build_filename (xfwm4_theme_dirs[i], file, "xfwm4", "keythemerc", NULL); + break; + } + + /* Check if the gtkrc file exists and the theme is not already in the list */ + if (g_file_test (xfwm4rc_filename, G_FILE_TEST_EXISTS) + && g_slist_find_custom (check_list, file, (GCompareFunc) g_utf8_collate) == NULL) + { + + /* Insert the theme in the check list */ + check_list = g_slist_prepend (check_list, g_strdup (file)); + + /* Append ui theme to the list store */ + gtk_list_store_append (list_store, &iter); + gtk_list_store_set (list_store, &iter, + 0, file, + -1); + + /* Check if this is the active theme, if so, select it */ + if (G_UNLIKELY (g_utf8_collate (file, active_theme_name) == 0)) + { + tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_store), &iter); + gtk_tree_selection_select_path (gtk_tree_view_get_selection (tree_view), tree_path); + gtk_tree_path_free (tree_path); + } + } + /* Free xfwm4rc filename */ + g_free (xfwm4rc_filename); + } + /* Close directory handle */ + g_dir_close (dir); + } +} + +static void +load_key_theme (const gchar* user_theme_name) +{ + gchar *dir_name; + gchar *user_theme_file = NULL; + gchar *default_theme_file = g_build_filename (DATADIR, "themes", "Default", "xfwm4", "keythemerc", NULL); + gchar **shortcuts_keys, **shortcut = NULL; + XfceRc *default_rc = NULL; + XfceRc *user_rc = NULL; + gchar **theme_dirs, **xfwm4_theme_dirs; + gint i = 0; + + xfce_resource_push_path (XFCE_RESOURCE_THEMES, DATADIR G_DIR_SEPARATOR_S "themes"); + xfwm4_theme_dirs = xfce_resource_dirs (XFCE_RESOURCE_THEMES); + xfce_resource_pop_path (XFCE_RESOURCE_THEMES); + + theme_dirs = xfwm4_theme_dirs; + + while (*theme_dirs) + { + user_theme_file = g_build_filename (*theme_dirs, user_theme_name, "xfwm4", "keythemerc", NULL); + if (!g_file_test (user_theme_file, G_FILE_TEST_EXISTS)) + { + g_free (user_theme_file); + user_theme_file = NULL; + } + theme_dirs++; + } + + + + default_rc = xfce_rc_simple_open (default_theme_file, TRUE); + if (user_theme_file) + user_rc = xfce_rc_simple_open (user_theme_file, TRUE); + + shortcuts_keys = xfce_rc_get_entries (default_rc, NULL); + + shortcut = shortcuts_keys; + + while (*shortcut) + { + gboolean found = FALSE; + const gchar *entry_value; + const gchar *fallback_value; + fallback_value = xfce_rc_read_entry (default_rc, *shortcut, "none"); + entry_value = xfce_rc_read_entry (user_rc, *shortcut, fallback_value); + + for (i = 0; !found && key_theme_values[i].name; i++) + { + if (g_ascii_strcasecmp (*shortcut, key_theme_values[i].key) == 0) + { + key_theme_values[i].value = g_strdup(entry_value); + } + } + shortcut++; + } + + g_strfreev (shortcuts_keys); + + xfce_rc_close (default_rc); + xfce_rc_close (user_rc); +} + +GtkWidget * +xfwm4_dialog_new_from_xml (GladeXML *gxml) +{ + GtkWidget *dialog; + GtkWidget *vbox; + GtkTreeIter iter; + GtkListStore *list_store; + GtkCellRenderer *renderer; + const MenuTmpl *tmpl_iter; + const KeyThemeTmpl *shortcuts_iter; + GtkTreeSelection *theme_selection, *keytheme_contents_selection; + GtkTargetEntry target_entry[2]; + GList *list_iter, *children; + GValue value = { 0, }; + XfconfChannel *xfwm4_channel = xfconf_channel_new("xfwm4"); + + /* Style tab */ + GtkWidget *theme_name_treeview = glade_xml_get_widget (gxml, "theme_name_treeview"); + GtkWidget *title_font_button = glade_xml_get_widget (gxml, "title_font_button"); + GtkWidget *title_align_combo = glade_xml_get_widget (gxml, "title_align_combo"); + GtkWidget *active_frame = glade_xml_get_widget (gxml, "active-frame"); + GtkWidget *active_box = glade_xml_get_widget (gxml, "active-box"); + GtkWidget *hidden_frame = glade_xml_get_widget (gxml, "hidden-frame"); + GtkWidget *hidden_box = glade_xml_get_widget (gxml, "hidden-box"); + + /* Keyboard tab */ + GtkWidget *keytheme_name_treeview = glade_xml_get_widget (gxml, "keytheme_name_treeview"); + GtkWidget *keytheme_contents_treeview = glade_xml_get_widget (gxml, "keytheme_contents_treeview"); + + /* Focus tab */ + GtkWidget *focus_delay_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "focus_delay_scale"))); + GtkWidget *focus_new_check = glade_xml_get_widget (gxml, "focus_new_check"); + GtkWidget *raise_on_focus_check = glade_xml_get_widget (gxml, "raise_on_focus_check"); + GtkWidget *raise_on_click_check = glade_xml_get_widget (gxml, "raise_on_click_check"); + GtkWidget *click_to_focus_mode = glade_xml_get_widget (gxml, "click_to_focus_mode"); + + /* Advanced tab */ + GtkWidget *box_move_check = glade_xml_get_widget (gxml, "box_move_check"); + GtkWidget *box_resize_check = glade_xml_get_widget (gxml, "box_resize_check"); + GtkWidget *snap_to_border_check = glade_xml_get_widget (gxml, "snap_to_border_check"); + GtkWidget *snap_to_window_check = glade_xml_get_widget (gxml, "snap_to_window_check"); + GtkWidget *double_click_action_combo = glade_xml_get_widget (gxml, "double_click_action_combo"); + GtkWidget *snap_width_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "snap_width_scale"))); + GtkWidget *wrap_resistance_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "wrap_resistance_scale"))); + + /* Double click action */ + list_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + tmpl_iter = dbl_click_values; + while (tmpl_iter->name) + { + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, tmpl_iter->name, 1, tmpl_iter->value, -1); + tmpl_iter++; + } + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (double_click_action_combo)); + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (double_click_action_combo), renderer, TRUE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (double_click_action_combo), renderer, "text", 0); + + gtk_combo_box_set_model (GTK_COMBO_BOX (double_click_action_combo), GTK_TREE_MODEL(list_store)); + + xfconf_channel_get_property (xfwm4_channel, "/general/double_click_action", &value); + cb_xfwm4_channel_double_click_action_changed (xfwm4_channel, "/general/double_click_action", &value, GTK_COMBO_BOX (double_click_action_combo)); + g_value_unset (&value); + + g_signal_connect (G_OBJECT (double_click_action_combo), "changed", G_CALLBACK (cb_xfwm4_dbl_click_changed), xfwm4_channel); + + /* Title alignment */ + list_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + tmpl_iter = title_align_values; + while (tmpl_iter->name) + { + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, tmpl_iter->name, 1, tmpl_iter->value, -1); + tmpl_iter++; + } + + gtk_cell_layout_clear (GTK_CELL_LAYOUT (title_align_combo)); + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (title_align_combo), renderer, TRUE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (title_align_combo), renderer, "text", 0); + + gtk_combo_box_set_model (GTK_COMBO_BOX (title_align_combo), GTK_TREE_MODEL(list_store)); + + xfconf_channel_get_property (xfwm4_channel, "/general/title_alignment", &value); + cb_xfwm4_channel_title_alignment_changed (xfwm4_channel, "/general/title_alignment", &value, GTK_COMBO_BOX (title_align_combo)); + g_value_unset (&value); + + g_signal_connect (G_OBJECT (title_align_combo), "changed", G_CALLBACK (cb_xfwm4_title_align_changed), xfwm4_channel); + + /* Button layout */ + target_entry[0].target = "_xfwm4_button_layout"; + target_entry[0].flags = GTK_TARGET_SAME_APP; + target_entry[0].info = 2; + target_entry[1].target = "_xfwm4_active_layout"; + target_entry[1].flags = GTK_TARGET_SAME_APP; + target_entry[1].info = 3; + + gtk_drag_dest_set (active_frame, GTK_DEST_DEFAULT_ALL, target_entry, 2, GDK_ACTION_MOVE); + g_signal_connect (active_frame, "drag-data-received", G_CALLBACK (cb_xfwm4_active_frame_drag_data), active_box); + g_signal_connect (active_frame, "drag-motion", G_CALLBACK (cb_xfwm4_active_frame_drag_motion), active_box); + g_signal_connect (active_frame, "drag-leave", G_CALLBACK (cb_xfwm4_active_frame_drag_leave), active_box); + + g_object_set_data (G_OBJECT (active_box), "xfwm4_channel", xfwm4_channel); + + gtk_drag_dest_set (hidden_frame, GTK_DEST_DEFAULT_ALL, target_entry, 1, GDK_ACTION_MOVE); + g_signal_connect (hidden_frame, "drag-data-received", G_CALLBACK (cb_xfwm4_hidden_frame_drag_data), hidden_box); + + g_object_set_data (G_OBJECT (hidden_box), "active_box", active_box); + + children = list_iter = gtk_container_get_children(GTK_CONTAINER(active_box)); + + while(list_iter) + { + GtkWidget *button; + const gchar *name; + + button = GTK_WIDGET(list_iter->data); + name = gtk_widget_get_name(button); + + if (name[strlen(name)-1] == '|') + { + g_signal_connect (G_OBJECT (title_align_combo), "changed", G_CALLBACK (cb_xwfm4_title_button_alignment_changed), button); + cb_xwfm4_title_button_alignment_changed (GTK_COMBO_BOX (title_align_combo), GTK_BUTTON (button)); + } + + g_object_set_data (G_OBJECT (button), "key_char", (gpointer)&name[strlen(name)-1]); + gtk_drag_source_set(button, GDK_BUTTON1_MASK, &target_entry[1], 1, GDK_ACTION_MOVE); + g_signal_connect (G_OBJECT (button), "drag_data_get", G_CALLBACK (cb_xfwm4_title_button_data_get), target_entry[1].target); + g_signal_connect (G_OBJECT (button), "drag_begin", G_CALLBACK (cb_xfwm4_title_button_drag_begin), NULL); + g_signal_connect (G_OBJECT (button), "drag_end", G_CALLBACK (cb_xfwm4_title_button_drag_end), NULL); + g_signal_connect (G_OBJECT (button), "button_press_event", G_CALLBACK (cb_xfwm4_signal_blocker), NULL); + g_signal_connect (G_OBJECT (button), "enter_notify_event", G_CALLBACK (cb_xfwm4_signal_blocker), NULL); + g_signal_connect (G_OBJECT (button), "focus", G_CALLBACK (cb_xfwm4_signal_blocker), NULL); + + list_iter = g_list_next(list_iter); + } + + g_list_free(children); + + children = list_iter = gtk_container_get_children(GTK_CONTAINER(hidden_box)); + + while(list_iter) + { + GtkWidget *button; + const gchar *name; + + button = GTK_WIDGET(list_iter->data); + name = gtk_widget_get_name(button); + + g_object_set_data (G_OBJECT (button), "key_char", (gpointer)&name[strlen(name)-1]); + gtk_drag_source_set(button, GDK_BUTTON1_MASK, &target_entry[0], 1, GDK_ACTION_MOVE); + g_signal_connect (G_OBJECT (button), "drag_data_get", G_CALLBACK (cb_xfwm4_title_button_data_get), target_entry[0].target); + g_signal_connect (G_OBJECT (button), "drag_begin", G_CALLBACK (cb_xfwm4_title_button_drag_begin), NULL); + g_signal_connect (G_OBJECT (button), "drag_end", G_CALLBACK (cb_xfwm4_title_button_drag_end), NULL); + g_signal_connect (G_OBJECT (button), "button_press_event", G_CALLBACK (cb_xfwm4_signal_blocker), NULL); + g_signal_connect (G_OBJECT (button), "enter_notify_event", G_CALLBACK (cb_xfwm4_signal_blocker), NULL); + g_signal_connect (G_OBJECT (button), "focus", G_CALLBACK (cb_xfwm4_signal_blocker), NULL); + + list_iter = g_list_next(list_iter); + } + + g_list_free(children); + + xfconf_channel_get_property (xfwm4_channel, "/general/button_layout", &value); + cb_xfwm4_channel_button_layout_changed (xfwm4_channel, "/general/button_layout", &value, GTK_CONTAINER (hidden_box)); + g_value_unset (&value); + + + /* theme name */ + list_store = gtk_list_store_new(1, G_TYPE_STRING); + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_set_model (GTK_TREE_VIEW (theme_name_treeview), GTK_TREE_MODEL (list_store)); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (theme_name_treeview), 0, "", renderer, "text", 0, NULL); + + theme_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (theme_name_treeview)); + gtk_tree_selection_set_mode (theme_selection, GTK_SELECTION_SINGLE); + + check_xfwm4_themes (list_store, GTK_TREE_VIEW (theme_name_treeview), xfwm4_channel, THEME_TYPE_XFWM4); + + /* keytheme name */ + list_store = gtk_list_store_new(1, G_TYPE_STRING); + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_set_model (GTK_TREE_VIEW (keytheme_name_treeview), GTK_TREE_MODEL (list_store)); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (keytheme_name_treeview), 0, "", renderer, "text", 0, NULL); + + theme_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (keytheme_name_treeview)); + gtk_tree_selection_set_mode (theme_selection, GTK_SELECTION_SINGLE); + + check_xfwm4_themes (list_store, GTK_TREE_VIEW (keytheme_name_treeview), xfwm4_channel, THEME_TYPE_KEYTHEME); + + /* keytheme contents */ + load_key_theme (xfconf_channel_get_string(xfwm4_channel, "/general/keytheme", "Default")); + list_store = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + shortcuts_iter = key_theme_values; + while (shortcuts_iter->name) + { + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, shortcuts_iter->name, 1, shortcuts_iter->value, 2, shortcuts_iter->key, -1); + shortcuts_iter++; + } + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_set_model (GTK_TREE_VIEW (keytheme_contents_treeview), GTK_TREE_MODEL (list_store)); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (keytheme_contents_treeview), 0, _("Action"), renderer, "text", 0, NULL); + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (keytheme_contents_treeview), 1, _("Button"), renderer, "text", 1, NULL); + + keytheme_contents_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (keytheme_contents_treeview)); + gtk_tree_selection_set_mode (keytheme_contents_selection, GTK_SELECTION_SINGLE); + + + /* Bind easy properties */ + /* Style tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/title_font", + G_TYPE_STRING, + (GObject *)title_font_button, "font-name"); + g_signal_connect (G_OBJECT(xfwm4_channel), + "property-changed::/general/title_alignment", + G_CALLBACK(cb_xfwm4_channel_title_alignment_changed), + title_align_combo); + g_signal_connect (G_OBJECT(xfwm4_channel), + "property-changed::/general/button_layout", + G_CALLBACK(cb_xfwm4_channel_button_layout_changed), + hidden_box); + /* Focus tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/focus_delay", + G_TYPE_INT, + (GObject *)focus_delay_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/click_to_focus", + G_TYPE_BOOLEAN, + (GObject *)click_to_focus_mode, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/raise_on_click", + G_TYPE_BOOLEAN, + (GObject *)raise_on_click_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/raise_on_focus", + G_TYPE_BOOLEAN, + (GObject *)raise_on_focus_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/focus_new", + G_TYPE_BOOLEAN, + (GObject *)focus_new_check, "active"); + + /* Keyboard tab */ + + /* Advanced tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/snap_width", + G_TYPE_INT, + (GObject *)snap_width_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/wrap_resistance", + G_TYPE_INT, + (GObject *)wrap_resistance_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/box_move", + G_TYPE_BOOLEAN, + (GObject *)box_move_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/box_resize", + G_TYPE_BOOLEAN, + (GObject *)box_resize_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/snap_to_border", + G_TYPE_BOOLEAN, + (GObject *)snap_to_border_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/snap_to_windows", + G_TYPE_BOOLEAN, + (GObject *)snap_to_window_check, "active"); + g_signal_connect (G_OBJECT(xfwm4_channel), + "property-changed::/general/double_click_action", + G_CALLBACK(cb_xfwm4_channel_double_click_action_changed), + double_click_action_combo); + + g_signal_connect (G_OBJECT(theme_selection), "changed", G_CALLBACK (cb_xfwm4_theme_treeselection_changed), xfwm4_channel); + + vbox = glade_xml_get_widget (gxml, "main-vbox"); + dialog = glade_xml_get_widget (gxml, "main-dialog"); + + gtk_widget_show_all(vbox); + + return dialog; +} + + +static GOptionEntry entries[] = +{ + { "version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version, + N_("Version information"), + NULL + }, + { NULL } +}; + + +int +main(int argc, gchar **argv) +{ + GladeXML *gxml; + GtkWidget *dialog; + GError *cli_error = NULL; + + #ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + #endif + + if(!gtk_init_with_args(&argc, &argv, _("."), entries, PACKAGE, &cli_error)) + { + if (cli_error != NULL) + { + g_print (_("%s: %s\nTry %s --help to see a full list of available command line options.\n"), PACKAGE, cli_error->message, PACKAGE_NAME); + g_error_free (cli_error); + return 1; + } + } + + if(version) + { + g_print("%s\n", PACKAGE_STRING); + return 0; + } + + xfconf_init(NULL); + + gxml = glade_xml_new_from_buffer (xfwm4_dialog_glade, + xfwm4_dialog_glade_length, + NULL, NULL); + + dialog = xfwm4_dialog_new_from_xml (gxml); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + xfconf_shutdown(); + + return 0; +} + +static void +cb_xfwm4_theme_treeselection_changed (GtkTreeSelection *selection, XfconfChannel *channel) +{ + GtkTreeModel *model = NULL; + GList *list = gtk_tree_selection_get_selected_rows (selection, &model); + GtkTreeIter iter; + GValue value = {0,}; + + /* valid failure */ + if ( g_list_length (list) == 0) + return; + + /* everything else is invalid */ + g_return_if_fail (g_list_length (list) == 1); + + gtk_tree_model_get_iter (model, &iter, list->data); + gtk_tree_model_get_value (model, &iter, 0, &value); + + xfconf_channel_set_property (channel, "/general/theme", &value); + + g_value_unset (&value); + + g_list_foreach (list, (GFunc)gtk_tree_path_free, NULL); + g_list_free (list); + +} + +static void +cb_xfwm4_dbl_click_changed (GtkComboBox *combo, XfconfChannel *channel) +{ + GtkTreeIter iter; + GtkTreeModel *model; + GValue value = { 0, }; + + model = gtk_combo_box_get_model (combo); + + gtk_combo_box_get_active_iter (combo, &iter); + gtk_tree_model_get_value (model, &iter, 1, &value); + + g_signal_handlers_block_by_func (channel, G_CALLBACK (cb_xfwm4_channel_double_click_action_changed), combo); + xfconf_channel_set_property (channel, "/general/double_click_action", &value); + g_signal_handlers_unblock_by_func (channel, G_CALLBACK (cb_xfwm4_channel_double_click_action_changed), combo); + + g_value_unset (&value); +} + +static void +cb_xfwm4_title_align_changed (GtkComboBox *combo, XfconfChannel *channel) +{ + GtkTreeIter iter; + GtkTreeModel *model; + GValue value = { 0, }; + + model = gtk_combo_box_get_model (combo); + + gtk_combo_box_get_active_iter (combo, &iter); + gtk_tree_model_get_value (model, &iter, 1, &value); + + g_signal_handlers_block_by_func (channel, G_CALLBACK (cb_xfwm4_channel_title_alignment_changed), combo); + xfconf_channel_set_property (channel, "/general/title_alignment", &value); + g_signal_handlers_unblock_by_func (channel, G_CALLBACK (cb_xfwm4_channel_title_alignment_changed), combo); + + g_value_unset (&value); +} + +static void +cb_xwfm4_title_button_alignment_changed (GtkComboBox *combo, GtkButton *button) +{ + GtkTreeIter iter; + GtkTreeModel *model; + GValue value = { 0, }; + const gchar *str_value; + float align = 0.5f; + + model = gtk_combo_box_get_model (combo); + + gtk_combo_box_get_active_iter (combo, &iter); + gtk_tree_model_get_value (model, &iter, 1, &value); + + str_value = g_value_get_string (&value); + + if (strcmp (str_value, "left") == 0) + { + align = 0.0f; + } + else if (strcmp (str_value, "right") == 0) + { + align = 1.0f; + } + + g_value_unset (&value); + + gtk_button_set_alignment (button, align, 0.5f); +} + +static void +cb_xfwm4_channel_double_click_action_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + GtkComboBox *combo) +{ + GtkTreeIter iter; + GtkTreeModel *model; + const gchar *str_value; + GValue value2 = { 0, }; + + model = gtk_combo_box_get_model (combo); + + str_value = g_value_get_string (value); + + gtk_tree_model_get_iter_first (model, &iter); + do { + gtk_tree_model_get_value (model, &iter, 1, &value2); + if (strcmp (g_value_get_string (&value2), str_value) == 0) + { + g_value_unset (&value2); + g_signal_handlers_block_by_func (combo, G_CALLBACK (cb_xfwm4_dbl_click_changed), channel); + gtk_combo_box_set_active_iter (combo, &iter); + g_signal_handlers_unblock_by_func (combo, G_CALLBACK (cb_xfwm4_dbl_click_changed), channel); + break; + } + g_value_unset (&value2); + } + while (gtk_tree_model_iter_next (model, &iter)); +} + +static void +cb_xfwm4_channel_title_alignment_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + GtkComboBox *combo) +{ + GtkTreeIter iter; + GtkTreeModel *model; + const gchar *str_value; + GValue value2 = { 0, }; + + model = gtk_combo_box_get_model (combo); + + str_value = g_value_get_string (value); + + gtk_tree_model_get_iter_first (model, &iter); + do { + gtk_tree_model_get_value (model, &iter, 1, &value2); + if (strcmp (g_value_get_string (&value2), str_value) == 0) + { + g_value_unset (&value2); + g_signal_handlers_block_by_func (combo, G_CALLBACK (cb_xfwm4_title_align_changed), channel); + gtk_combo_box_set_active_iter (combo, &iter); + g_signal_handlers_unblock_by_func (combo, G_CALLBACK (cb_xfwm4_title_align_changed), channel); + break; + } + g_value_unset (&value2); + } + while (gtk_tree_model_iter_next (model, &iter)); +} + +static void +save_button_layout (GtkContainer *container, XfconfChannel *channel) +{ + GList *children, *list_iter; + gchar *str_value = NULL; + gchar *tmp_string = ""; + + children = list_iter = gtk_container_get_children(container); + + while(list_iter) + { + GtkWidget *button; + + button = GTK_WIDGET(list_iter->data); + + tmp_string = g_strconcat(tmp_string, (const gchar*)g_object_get_data (G_OBJECT (button), "key_char"), NULL); + g_free (str_value); + str_value = tmp_string; + + list_iter = g_list_next(list_iter); + } + + g_list_free(children); + + g_signal_handlers_block_by_func (channel, G_CALLBACK (cb_xfwm4_channel_button_layout_changed), NULL); + xfconf_channel_set_string (channel, "/general/button_layout", str_value); + g_signal_handlers_unblock_by_func (channel, G_CALLBACK (cb_xfwm4_channel_button_layout_changed), NULL); + + g_free (str_value); +} + +static gboolean +str_starts_with(const gchar *str, const gchar *start) +{ + while (*start) + { + if (*str++ != *start++) + return FALSE; + } + + return TRUE; +} + +static void +cb_xfwm4_channel_button_layout_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + GtkContainer *hidden_box) +{ + GList *children, *list_iter; + const gchar *str_value; + GtkContainer *active_box; + + str_value = g_value_get_string (value); + + active_box = g_object_get_data (G_OBJECT (hidden_box), "active_box"); + + gtk_widget_set_app_paintable (GTK_WIDGET (active_box), FALSE); + gtk_widget_set_app_paintable (GTK_WIDGET (hidden_box), FALSE); + + /* move all the buttons to the hidden list, except the title */ + children = list_iter = gtk_container_get_children(active_box); + + while (list_iter) + { + GtkWidget *button; + const gchar *key_char; + + button = GTK_WIDGET(list_iter->data); + + key_char = (const gchar*)g_object_get_data (G_OBJECT (button), "key_char"); + + if (key_char[0] != '|') + { + gtk_container_remove(active_box, button); + gtk_box_pack_start (GTK_BOX (hidden_box), button, FALSE, FALSE, 0); + } + + list_iter = g_list_next(list_iter); + } + + g_list_free(children); + + /* move the buttons to the active list, in the correct order */ + children = g_list_concat (gtk_container_get_children (active_box), gtk_container_get_children (hidden_box)); + + while (*str_value) + { + list_iter = children; + while (list_iter) + { + GtkWidget *button; + const gchar *key_char; + + button = GTK_WIDGET(list_iter->data); + + key_char = (const gchar*)g_object_get_data (G_OBJECT (button), "key_char"); + + if (str_starts_with(str_value, key_char)) + { + gtk_container_remove(GTK_CONTAINER (gtk_widget_get_parent (button)), button); + gtk_box_pack_start (GTK_BOX (active_box), button, key_char[0] == '|', key_char[0] == '|', 0); + break; + } + + list_iter = g_list_next(list_iter); + } + + str_value++; + } + + g_list_free(children); + + gtk_widget_set_app_paintable (GTK_WIDGET (active_box), TRUE); + gtk_widget_set_app_paintable (GTK_WIDGET (hidden_box), TRUE); +} + +static void +cb_xfwm4_active_frame_drag_data (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time, GtkWidget *active_box) +{ + GtkWidget *source = gtk_drag_get_source_widget(drag_context); + GtkWidget *parent = gtk_widget_get_parent(source); + + gtk_widget_ref(source); + gtk_container_remove(GTK_CONTAINER(parent), source); + gtk_box_pack_start(GTK_BOX(active_box), source, info == 3, info == 3, 0); + gtk_widget_unref(source); + + guint button = 0; + gint xoffset = widget->allocation.x; + GtkWidget *item; + + GList *iter, *children = iter = gtk_container_get_children(GTK_CONTAINER(active_box)); + + gint i = 0; + + while(iter) + { + item = GTK_WIDGET(iter->data); + + if(GTK_WIDGET_VISIBLE(item)) + { + button++; + if(x < (item->allocation.width/2 + item->allocation.x - xoffset)) + { + break; + } + } + i++; + iter = g_list_next(iter); + } + + g_list_free(children); + + gtk_box_reorder_child(GTK_BOX(active_box), source, i); + + save_button_layout (GTK_CONTAINER (active_box), g_object_get_data (G_OBJECT (active_box), "xfwm4_channel")); +} + +static gboolean +cb_xfwm4_active_frame_drag_motion (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, guint time, GtkWidget *active_box) +{ + guint button = 0; + gint ix, iy; + gint xoffset = widget->allocation.x; + GtkWidget *item; + GdkWindow *indicator; + + GList *iter, *children = iter = gtk_container_get_children(GTK_CONTAINER(active_box)); + + ix = active_box->allocation.x + gtk_container_get_border_width(GTK_CONTAINER(active_box)); + + while(iter) + { + item = GTK_WIDGET(iter->data); + + if(GTK_WIDGET_VISIBLE(item)) + { + button++; + if(x < (item->allocation.width/2 + item->allocation.x - xoffset)) + { + ix = item->allocation.x; + break; + } + ix = item->allocation.x + item->allocation.width; + } + iter = g_list_next(iter); + } + + g_list_free(children); + + ix -= INDICATOR_SIZE/2 + 1; + iy = active_box->allocation.y - INDICATOR_SIZE/2 + gtk_container_get_border_width(GTK_CONTAINER(active_box)); + + indicator = g_object_get_data (G_OBJECT (active_box), "indicator_window"); + if(!indicator) + { + xfwm4_create_indicator(active_box, ix, iy, INDICATOR_SIZE, active_box->allocation.height + INDICATOR_SIZE - gtk_container_get_border_width(GTK_CONTAINER(active_box))*2); + } + else + { + gdk_window_move(indicator, ix, iy); + } + + return FALSE; +} + +static void +cb_xfwm4_active_frame_drag_leave (GtkWidget *widget, GdkDragContext *drag_context, guint time, GtkWidget *active_box) +{ + xfwm4_delete_indicator (active_box); +} + +static void +cb_xfwm4_hidden_frame_drag_data (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time, GtkWidget *hidden_box) +{ + GtkWidget *source = gtk_drag_get_source_widget(drag_context); + GtkWidget *parent = gtk_widget_get_parent(source); + + /* if the item was dragged back to the location it already was */ + if(parent == hidden_box) + { + return; + } + + gtk_widget_ref(source); + gtk_container_remove(GTK_CONTAINER(parent), source); + gtk_box_pack_start(GTK_BOX(hidden_box), source, FALSE, FALSE, 0); + gtk_widget_unref(source); + + save_button_layout (g_object_get_data (G_OBJECT (hidden_box), "active_box"), g_object_get_data (G_OBJECT (parent), "xfwm4_channel")); +} + +static void +cb_xfwm4_title_button_data_get (GtkWidget *widget, GdkDragContext *drag_context, GtkSelectionData *data, guint info, guint time, const gchar *atom_name) +{ + gtk_widget_hide(widget); + gtk_selection_data_set(data, gdk_atom_intern(atom_name, FALSE), 8, NULL, 0); +} + +static void +cb_xfwm4_title_button_drag_begin (GtkWidget *widget, GdkDragContext *drag_context, gpointer user_data) +{ + GdkPixbuf *pixbuf = xfwm4_create_icon_from_widget(widget); + + gtk_drag_source_set_icon_pixbuf(widget, pixbuf); + g_object_unref(G_OBJECT(pixbuf)); + gtk_widget_hide(widget); +} + +static void +cb_xfwm4_title_button_drag_end (GtkWidget *widget, GdkDragContext *drag_context, gpointer user_data) +{ + gtk_widget_show(widget); +} + +static gboolean +cb_xfwm4_signal_blocker (GtkWidget *widget, gpointer user_data) +{ + return TRUE; +} + +static GdkPixbuf* +xfwm4_create_icon_from_widget(GtkWidget *widget) +{ + GdkWindow *drawable = GDK_DRAWABLE(gtk_widget_get_parent_window(widget)); + return gdk_pixbuf_get_from_drawable(NULL, drawable, NULL, widget->allocation.x, widget->allocation.y, 0, 0, widget->allocation.width, widget->allocation.height); +} + +static void +xfwm4_create_indicator(GtkWidget *widget, gint x, gint y, gint width, gint height) +{ + gint attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP | GDK_WA_VISUAL; + GdkWindowAttr attributes = { + NULL, + 0, + x, y, + width, height, + GDK_INPUT_OUTPUT, + gtk_widget_get_visual(widget), + gtk_widget_get_colormap(widget), + GDK_WINDOW_CHILD, + NULL, NULL, NULL, FALSE + }; + + GdkWindow *indicator = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attr_mask); + gdk_window_set_user_data(indicator, widget); + g_object_set_data (G_OBJECT (widget), "indicator_window", indicator); + + GdkPoint points[9]; + points[0].x = 0; + points[0].y = 0; + points[1].x = width; + points[1].y = 0; + points[2].x = width/2+1; + points[2].y = width/2; + points[3].x = width/2+1; + points[3].y = height-1-width/2; + points[4].x = width; + points[4].y = height; + points[5].x = 0; + points[5].y = height-1; + points[6].x = width/2; + points[6].y = height-1-width/2; + points[7].x = width/2; + points[7].y = width/2; + points[8].x = 0; + points[8].y = 0; + GdkRegion *shape = gdk_region_polygon(points, 9, GDK_WINDING_RULE); + + gdk_window_shape_combine_region(indicator, shape, 0, 0); + + gdk_window_show(indicator); + gdk_window_raise(indicator); +} + +static void +xfwm4_delete_indicator(GtkWidget *widget) +{ + GdkWindow *indicator = g_object_get_data (G_OBJECT (widget), "indicator_window"); + if(indicator) + { + gdk_window_destroy(indicator); + g_object_set_data (G_OBJECT (widget), "indicator_window", NULL); + } +} Index: settings-dialogs/xfwm4-tweaks-dialog.glade =================================================================== --- settings-dialogs/xfwm4-tweaks-dialog.glade (revision 0) +++ settings-dialogs/xfwm4-tweaks-dialog.glade (revision 0) @@ -0,0 +1,935 @@ + + + + + + + 500 + 5 + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + 2 + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + wmtweaks + Window Manager Tweaks + + + False + False + 1 + + + + + True + True + + + True + + + True + True + Skip windows that have "skip pager" +or "skip taskbar" properties set + 0 + True + + + False + False + + + + + True + True + Include hidden (i.e. iconified) windows + 0 + True + + + False + False + 1 + + + + + True + True + Cycle through windows on all workspaces + 0 + True + + + False + False + 2 + + + + + + + True + Cycling + + + tab + False + + + + + True + 3 + + + True + True + Activate focus stealing prevention + 0 + True + + + False + False + + + + + True + True + Honor standard ICCCM focus hint + 0 + True + + + False + False + 1 + + + + + True + False + + + True + 0 + When a window raises itself: + + + + + True + 12 + + + True + + + True + True + Bring window on current workspace + 0 + True + True + + + + + True + True + Switch to window's workspace + 0 + True + True + activate_action_bring_option + + + 1 + + + + + True + True + Do nothing + 0 + True + True + activate_action_bring_option + + + 2 + + + + + + + 1 + + + + + False + False + 2 + + + + + 1 + + + + + True + Focus + + + tab + 1 + False + + + + + True + + + True + 4 + + + True + 0 + Key used to grab and move windows + + + False + False + + + + + True + + + + False + False + 1 + + + + + False + False + + + + + True + True + Raise windows when any mouse button is pressed + 0 + True + + + False + False + 1 + + + + + True + True + Hide frame of windows when maximized + 0 + True + + + False + False + 2 + + + + + True + True + Restore original size of maximized windows when moving + 0 + True + + + False + False + 3 + + + + + True + True + Use edge resistance instead of window-snapping + 0 + True + + + False + False + 4 + + + + + 2 + + + + + True + Accessibility + + + tab + 2 + False + + + + + True + + + True + True + Switch workspaces using mousewheel over desktop + 0 + True + + + False + False + + + + + True + True + Remember and recall previous workspace +when switching via keyboard shortcuts + 0 + True + + + False + False + 1 + + + + + True + True + Wrap workspaced depending on the actual desktop layout + 0 + True + + + False + False + 2 + + + + + True + True + Wrap workspaces when the first or the last workspace is reached + 0 + True + + + False + False + 3 + + + + + 3 + + + + + True + Workspaces + + + tab + 3 + False + + + + + True + + + True + 0 + Minimum size of windows to trigger smart placement + + + False + False + + + + + True + + + True + Small + + + False + False + + + + + True + True + 88 0 100 1 10 10 + False + False + + + 1 + + + + + True + Large + + + False + 2 + + + + + False + False + 1 + + + + + 4 + + + + + True + Placement + + + tab + 4 + False + + + + + True + + + True + True + Enable display compositing + 0 + True + + + False + False + + + + + True + False + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + GTK_RESIZE_QUEUE + GTK_SHADOW_NONE + + + True + 10 + + + True + 3 + + + True + True + Display fullscreen overlay windows directly + 0 + True + + + + + True + True + Show shadows under regular windows + 0 + True + + + 1 + + + + + True + True + Show shadows under popup windows + 0 + True + + + 2 + + + + + True + True + Show shadows under docking windows + 0 + True + + + 3 + + + + + True + + + True + 0 + Opacity of window decorations + + + False + + + + + True + + + True + <i>Transparent</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 90 0 100 1 10 0 + False + False + + + 1 + + + + + True + <i>Opaque</i> + True + + + False + False + 2 + + + + + False + False + 1 + + + + + 4 + + + + + True + + + True + 0 + Opacity of inactive windows + + + False + False + + + + + True + + + True + <i>Transparent</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 90 0 100 1 10 0 + False + False + + + 1 + + + + + True + <i>Opaque</i> + True + + + False + False + 2 + + + + + False + False + 1 + + + + + 5 + + + + + True + + + True + 0 + Opacity of windows during move + + + False + False + + + + + True + + + True + <i>Transparent</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 100 0 100 1 10 0 + False + False + + + 1 + + + + + True + <i>Opaque</i> + True + + + False + False + 2 + + + + + False + False + 1 + + + + + 6 + + + + + True + + + True + 0 + Opacity of windows during resize + + + False + False + + + + + True + + + True + <i>Transparent</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 90 0 100 1 10 0 + False + False + + + 1 + + + + + True + <i>Opaque</i> + True + + + False + False + 2 + + + + + False + False + 1 + + + + + 7 + + + + + True + + + True + 0 + Opacity of popup windows + + + False + False + + + + + True + + + True + <i>Transparent</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 90 0 100 1 10 10 + False + 1.7976931348623158e+25 + False + + + 1 + + + + + True + <i>Opaque</i> + True + + + False + False + 2 + + + + + False + False + 1 + + + + + 8 + + + + + + + + + + + 1 + + + + + 5 + + + + + True + Compositor + + + tab + 5 + False + + + + + 2 + + + + + True + GTK_BUTTONBOX_EDGE + + + True + True + True + gtk-help + True + 0 + + + + + True + True + True + gtk-close + True + 0 + + + 1 + + + + + False + GTK_PACK_END + + + + + + Index: settings-dialogs/xfwm4-workspace-dialog.glade =================================================================== --- settings-dialogs/xfwm4-workspace-dialog.glade (revision 0) +++ settings-dialogs/xfwm4-workspace-dialog.glade (revision 0) @@ -0,0 +1,115 @@ + + + + + + + 5 + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + 2 + + + True + xfce4-workspaces + Workspace Settings + + + False + False + 1 + + + + + True + 5 + + + True + 4 + + + True + Number of workspaces: + + + False + False + + + + + True + True + False + 0 0 100 1 10 10 + + + False + False + 1 + + + + + False + False + + + + + True + True + True + + + 1 + + + + + 2 + + + + + True + GTK_BUTTONBOX_EDGE + + + True + True + True + gtk-help + True + 0 + + + + + True + True + True + gtk-close + True + 0 + + + 1 + + + + + False + GTK_PACK_END + + + + + + Index: settings-dialogs/Makefile.am =================================================================== --- settings-dialogs/Makefile.am (revision 0) +++ settings-dialogs/Makefile.am (revision 0) @@ -0,0 +1,112 @@ +bin_PROGRAMS = \ +xfwm4-settings \ +xfwm4-tweaks-settings \ +xfwm4-workspace-settings + +xfwm4_workspace_settings_SOURCES = \ + workspace-settings.c \ + xfwm4-workspace-dialog_glade.h + +xfwm4_workspace_settings_CFLAGS = \ + $(GTK_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GLADE_CFLAGS) \ + $(DBUS_GLIB_CFLAGS) \ + $(LIBXFCEGUI4_CFLAGS) \ + $(LIBXFCONF_CFLAGS) \ + -DDATADIR=\"$(datadir)\" \ + -DSRCDIR=\"$(top_srcdir)\" \ + -DLOCALEDIR=\"$(localedir)\" + +xfwm4_workspace_settings_LDADD = \ + $(GTK_LIBS) \ + $(GLIB_LIBS) \ + $(GLADE_LIBS) \ + $(DBUS_GLIB_LIBS) \ + $(LIBXFCEGUI4_LIBS) \ + $(LIBXFCONF_LIBS) + +xfwm4_settings_SOURCES = \ + xfwm4-settings.c \ + xfwm4-dialog_glade.h + +xfwm4_settings_CFLAGS = \ + $(GTK_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GLADE_CFLAGS) \ + $(DBUS_GLIB_CFLAGS) \ + $(LIBXFCEGUI4_CFLAGS) \ + $(LIBXFCONF_CFLAGS) \ + -DDATADIR=\"$(datadir)\" \ + -DSRCDIR=\"$(top_srcdir)\" \ + -DLOCALEDIR=\"$(localedir)\" + +xfwm4_settings_LDADD = \ + $(GTK_LIBS) \ + $(GLIB_LIBS) \ + $(GLADE_LIBS) \ + $(DBUS_GLIB_LIBS) \ + $(LIBXFCEGUI4_LIBS) \ + $(LIBXFCONF_LIBS) + +xfwm4_tweaks_settings_SOURCES = \ + tweaks-settings.c \ + xfwm4-tweaks-dialog_glade.h + +xfwm4_tweaks_settings_CFLAGS = \ + $(GTK_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GLADE_CFLAGS) \ + $(DBUS_GLIB_CFLAGS) \ + $(LIBXFCEGUI4_CFLAGS) \ + $(LIBXFCONF_CFLAGS) \ + -DDATADIR=\"$(datadir)\" \ + -DSRCDIR=\"$(top_srcdir)\" \ + -DLOCALEDIR=\"$(localedir)\" + +xfwm4_tweaks_settings_LDADD = \ + $(GTK_LIBS) \ + $(GLIB_LIBS) \ + $(GLADE_LIBS) \ + $(DBUS_GLIB_LIBS) \ + $(LIBXFCEGUI4_LIBS) \ + $(LIBXFCONF_LIBS) + +INCLUDES = \ + -I${top_srcdir} + +if MAINTAINER_MODE + +BUILT_SOURCES = \ +xfwm4-dialog_glade.h \ +xfwm4-tweaks-dialog_glade.h \ +xfwm4-workspace-dialog_glade.h + +xfwm4-workspace-dialog_glade.h: xfwm4-workspace-dialog.glade + exo-csource --static --name=workspace_dialog_glade $< >$@ + +xfwm4-dialog_glade.h: xfwm4-dialog.glade + exo-csource --static --name=xfwm4_dialog_glade $< >$@ + +xfwm4-tweaks-dialog_glade.h: xfwm4-tweaks-dialog.glade + exo-csource --static --name=tweaks_dialog_glade $< >$@ + +endif + +desktopdir = $(datadir)/applications +desktop_in_files = \ + xfwm4-settings.desktop.in \ + xfwm4-tweaks-settings.desktop.in \ + xfwm4-workspace-settings.desktop.in +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) + +settingsdir = $(datadir)/xfce4/settings-dialogs +settings_DATA = $(desktop_DATA) + +@INTLTOOL_DESKTOP_RULE@ + +EXTRA_DIST = \ + $(desktop_in_files) \ + xfwm4-workspace-dialog.glade \ + xfwm4-tweaks-dialog.glade \ + xfwm4-dialog.glade Index: settings-dialogs/xfwm4-tweaks-settings.desktop.in =================================================================== --- settings-dialogs/xfwm4-tweaks-settings.desktop.in (revision 0) +++ settings-dialogs/xfwm4-tweaks-settings.desktop.in (revision 0) @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +_Name=Xfce 4 WM Tweaks +_GenericName=Window Manager Tweaks +_Comment= +Exec=xfwm4-tweaks-settings +Icon=wmtweaks +Terminal=false +Type=Application +Categories=X-XFCE;Settings;DesktopSettings; +StartupNotify=true +OnlyShowIn=XFCE; Index: settings-dialogs/xfwm4-workspace-settings.desktop.in =================================================================== --- settings-dialogs/xfwm4-workspace-settings.desktop.in (revision 0) +++ settings-dialogs/xfwm4-workspace-settings.desktop.in (revision 0) @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +_Name=Xfce 4 Workspace Settings +_GenericName=Workspace Settings +_Comment= +Exec=xfwm4-workspace-settings +Icon=xfce4-workspaces +Terminal=false +Type=Application +Categories=X-XFCE;Settings;DesktopSettings; +StartupNotify=true +OnlyShowIn=XFCE; Index: settings-dialogs/tweaks-settings.c =================================================================== --- settings-dialogs/tweaks-settings.c (revision 0) +++ settings-dialogs/tweaks-settings.c (revision 0) @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2008 Stephan Arts + * + * 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 Library 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 +#include + +#include + +#if defined(GETTEXT_PACKAGE) +#include +#else +#include +#endif + +#include +#include + +#include +#include +#include "xfwm4-tweaks-dialog_glade.h" + +static gboolean version = FALSE; + +void +cb_easy_click_combo_box_changed (GtkComboBox *combo, XfconfChannel *channel) +{ + switch (gtk_combo_box_get_active(combo)) + { + case 0: + xfconf_channel_set_string (channel, "/general/easy_click", "Alt"); + break; + case 1: + xfconf_channel_set_string (channel, "/general/easy_click", "Control"); + break; + default: + xfconf_channel_set_string (channel, "/general/easy_click", "Alt"); + break; + } +} + +void +cb_use_compositing_check_button_toggled (GtkToggleButton *toggle, GtkWidget *box) +{ + gtk_widget_set_sensitive (box, gtk_toggle_button_get_active(toggle)); +} + +void +cb_prevent_focus_stealing_check_button_toggled (GtkToggleButton *toggle, GtkWidget *box) +{ + gtk_widget_set_sensitive (box, gtk_toggle_button_get_active(toggle)); +} + +void +cb_activate_action_bring_radio_toggled (GtkToggleButton *toggle, XfconfChannel *channel) +{ + if (gtk_toggle_button_get_active (toggle)) + { + xfconf_channel_set_string (channel, "/general/activate_action", "bring"); + } +} + +void +cb_activate_action_switch_radio_toggled (GtkToggleButton *toggle, XfconfChannel *channel) +{ + if (gtk_toggle_button_get_active (toggle)) + { + xfconf_channel_set_string (channel, "/general/activate_action", "switch"); + } +} + +void +cb_activate_action_none_radio_toggled (GtkToggleButton *toggle, XfconfChannel *channel) +{ + if (gtk_toggle_button_get_active (toggle)) + { + xfconf_channel_set_string (channel, "/general/activate_action", "none"); + } +} + +GtkWidget * +wm_tweaks_dialog_new_from_xml (GladeXML *gxml) +{ + GtkWidget *dialog, *vbox; + GtkTreeIter iter; + GtkListStore *list_store; + GtkCellRenderer *renderer; + XfconfChannel *xfwm4_channel = xfconf_channel_new("xfwm4"); + gchar *easy_click = NULL; + gchar *activate_action = NULL; + + /* Cycling tab */ + GtkWidget *cycle_workspaces_check = glade_xml_get_widget (gxml, "cycle_workspaces_check"); + GtkWidget *cycle_hidden_check = glade_xml_get_widget (gxml, "cycle_hidden_check"); + GtkWidget *cycle_minimum_check = glade_xml_get_widget (gxml, "cycle_minimum_check"); + + /* Focus tab */ + GtkWidget *prevent_focus_stealing_check = glade_xml_get_widget (gxml, "prevent_focus_stealing_check"); + GtkWidget *prevent_focus_stealing_box = glade_xml_get_widget (gxml, "prevent_focus_stealing_box"); + GtkWidget *focus_hint_check = glade_xml_get_widget (gxml, "focus_hint_check"); + + GtkWidget *activate_action_bring_option = glade_xml_get_widget (gxml, "activate_action_bring_option"); + GtkWidget *activate_action_switch_option = glade_xml_get_widget (gxml, "activate_action_switch_option"); + GtkWidget *activate_action_none_option = glade_xml_get_widget (gxml, "activate_action_none_option"); + + /* Accessibility tab */ + GtkWidget *easy_click_combo_box = glade_xml_get_widget (gxml, "easy_click_combo_box"); + GtkWidget *raise_on_click_check = glade_xml_get_widget (gxml, "raise_on_click_check"); + GtkWidget *borderless_maximize_check = glade_xml_get_widget (gxml, "borderless_maximize_check"); + GtkWidget *restore_on_move_check = glade_xml_get_widget (gxml, "restore_on_move_check"); + GtkWidget *snap_resist_check = glade_xml_get_widget (gxml, "snap_resist_check"); + + /* Workspaces tab */ + GtkWidget *scroll_workspaces_check = glade_xml_get_widget (gxml, "scroll_workspaces_check"); + GtkWidget *toggle_workspaces_check = glade_xml_get_widget (gxml, "toggle_workspaces_check"); + GtkWidget *wrap_layout_check = glade_xml_get_widget (gxml, "wrap_layout_check"); + GtkWidget *wrap_cycle_check = glade_xml_get_widget (gxml, "wrap_cycle_check"); + + + /* Placement tab */ + GtkWidget *placement_ratio_scale = (GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "placement_ratio_scale"))); + + /* Compositing tab */ + GtkWidget *use_compositing_check = glade_xml_get_widget (gxml, "use_compositing_check"); + GtkWidget *use_compositing_box = glade_xml_get_widget (gxml, "use_compositing_box"); + + GtkWidget *unredirect_overlays_check = glade_xml_get_widget (gxml, "unredirect_overlays_check"); + GtkWidget *show_frame_shadow_check = glade_xml_get_widget (gxml, "show_frame_shadow_check"); + GtkWidget *show_popup_shadow_check = glade_xml_get_widget (gxml, "show_popup_shadow_check"); + GtkWidget *show_dock_shadow_check = glade_xml_get_widget (gxml, "show_dock_shadow_check"); + + GtkWidget *frame_opacity_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "frame_opacity_scale"))); + GtkWidget *inactive_opacity_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "inactive_opacity_scale"))); + GtkWidget *move_opacity_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "move_opacity_scale"))); + GtkWidget *popup_opacity_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "popup_opacity_scale"))); + GtkWidget *resize_opacity_scale =(GtkWidget *)gtk_range_get_adjustment(GTK_RANGE(glade_xml_get_widget (gxml, "resize_opacity_scale"))); + + + /* Hinting Combo */ + list_store = gtk_list_store_new(1, G_TYPE_STRING); + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, N_("Alt"), -1); + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, N_("Ctrl"), -1); + + /* Fill combo-box */ + gtk_cell_layout_clear (GTK_CELL_LAYOUT (easy_click_combo_box)); + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (easy_click_combo_box), renderer, TRUE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (easy_click_combo_box), renderer, "text", 0); + + gtk_combo_box_set_model (GTK_COMBO_BOX (easy_click_combo_box), GTK_TREE_MODEL(list_store)); + + easy_click = xfconf_channel_get_string (xfwm4_channel, "/general/easy_click", "Alt"); + gtk_combo_box_set_active (GTK_COMBO_BOX(easy_click_combo_box), 0); + if (!strcmp(easy_click, "Ctrl")) + gtk_combo_box_set_active (GTK_COMBO_BOX(easy_click_combo_box), 1); + + activate_action = xfconf_channel_get_string (xfwm4_channel, "/general/activate_action", "bring"); + if (!strcmp (activate_action, "switch")) + { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(activate_action_bring_option), FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(activate_action_switch_option), TRUE); + } + if (!strcmp (activate_action, "none")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(activate_action_none_option), TRUE); + + + /* not so easy properties */ + g_signal_connect (G_OBJECT (activate_action_bring_option), + "toggled", + G_CALLBACK (cb_activate_action_bring_radio_toggled), + xfwm4_channel); + g_signal_connect (G_OBJECT (activate_action_switch_option), + "toggled", + G_CALLBACK (cb_activate_action_switch_radio_toggled), + xfwm4_channel); + g_signal_connect (G_OBJECT (activate_action_none_option), + "toggled", + G_CALLBACK (cb_activate_action_none_radio_toggled), + xfwm4_channel); + + g_signal_connect (G_OBJECT (prevent_focus_stealing_check), + "toggled", + G_CALLBACK (cb_prevent_focus_stealing_check_button_toggled), + prevent_focus_stealing_box); + g_signal_connect (G_OBJECT (use_compositing_check), + "toggled", + G_CALLBACK (cb_use_compositing_check_button_toggled), + use_compositing_box); + g_signal_connect (G_OBJECT (easy_click_combo_box), + "changed", + G_CALLBACK (cb_easy_click_combo_box_changed), + xfwm4_channel); + + + + /* Bind easy properties */ + /* Cycling tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/cycle_minimum", + G_TYPE_BOOLEAN, + (GObject *)cycle_minimum_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/cycle_hidden", + G_TYPE_BOOLEAN, + (GObject *)cycle_hidden_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/cycle_workspaces", + G_TYPE_BOOLEAN, + (GObject *)cycle_workspaces_check, "active"); + + /* Focus tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/prevent_focus_stealing", + G_TYPE_BOOLEAN, + (GObject *)prevent_focus_stealing_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/focus_hint", + G_TYPE_BOOLEAN, + (GObject *)focus_hint_check, "active"); + + /* Accessibility tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/raise_on_click", + G_TYPE_BOOLEAN, + (GObject *)raise_on_click_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/borderless_maximize", + G_TYPE_BOOLEAN, + (GObject *)borderless_maximize_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/restore_on_move", + G_TYPE_BOOLEAN, + (GObject *)restore_on_move_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/snap_resist", + G_TYPE_BOOLEAN, + (GObject *)snap_resist_check, "active"); + + /* Workspaces tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/toggle_workspaces", + G_TYPE_BOOLEAN, + (GObject *)toggle_workspaces_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/scroll_workspaces", + G_TYPE_BOOLEAN, + (GObject *)scroll_workspaces_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/wrap_layout", + G_TYPE_BOOLEAN, + (GObject *)wrap_layout_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/wrap_cycle", + G_TYPE_BOOLEAN, + (GObject *)wrap_cycle_check, "active"); + + /* Placement tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/placement_ratio", + G_TYPE_INT, + (GObject *)placement_ratio_scale, "value"); + + /* Compositing tab */ + xfconf_g_property_bind (xfwm4_channel, + "/general/use_compositing", + G_TYPE_BOOLEAN, + (GObject *)use_compositing_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/unredirect_overlays", + G_TYPE_BOOLEAN, + (GObject *)unredirect_overlays_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/show_frame_shadow", + G_TYPE_BOOLEAN, + (GObject *)show_frame_shadow_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/show_popup_shadow", + G_TYPE_BOOLEAN, + (GObject *)show_popup_shadow_check, "active"); + xfconf_g_property_bind (xfwm4_channel, + "/general/show_dock_shadow", + G_TYPE_BOOLEAN, + (GObject *)show_dock_shadow_check, "active"); + + xfconf_g_property_bind (xfwm4_channel, + "/general/frame_opacity", + G_TYPE_INT, + (GObject *)frame_opacity_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/resize_opacity", + G_TYPE_INT, + (GObject *)resize_opacity_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/move_opacity", + G_TYPE_INT, + (GObject *)move_opacity_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/inactive_opacity", + G_TYPE_INT, + (GObject *)inactive_opacity_scale, "value"); + xfconf_g_property_bind (xfwm4_channel, + "/general/popup_opacity", + G_TYPE_INT, + (GObject *)popup_opacity_scale, "value"); + + vbox = glade_xml_get_widget (gxml, "main-vbox"); + dialog = glade_xml_get_widget (gxml, "main-dialog"); + + gtk_widget_show_all(vbox); + + if (easy_click) + g_free (easy_click); + if (activate_action) + g_free (activate_action); + + return dialog; +} + +static GOptionEntry entries[] = +{ + { "version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version, + N_("Version information"), + NULL + }, + { NULL } +}; + +int +main(int argc, gchar **argv) +{ + GladeXML *gxml; + GtkWidget *dialog; + GError *cli_error = NULL; + + #ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + #endif + + if(!gtk_init_with_args(&argc, &argv, _("."), entries, PACKAGE, &cli_error)) + { + if (cli_error != NULL) + { + g_print (_("%s: %s\nTry %s --help to see a full list of available command line options.\n"), PACKAGE, cli_error->message, PACKAGE_NAME); + g_error_free (cli_error); + return 1; + } + } + + if(version) + { + g_print("%s\n", PACKAGE_STRING); + return 0; + } + + xfconf_init(NULL); + + gxml = glade_xml_new_from_buffer (tweaks_dialog_glade, + tweaks_dialog_glade_length, + NULL, NULL); + + dialog = wm_tweaks_dialog_new_from_xml (gxml); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + xfconf_shutdown(); + + return 0; +} Index: settings-dialogs/workspace-settings.c =================================================================== --- settings-dialogs/workspace-settings.c (revision 0) +++ settings-dialogs/workspace-settings.c (revision 0) @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2008 Stephan Arts + * + * 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 Library 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 +#include + +#include + +#if defined(GETTEXT_PACKAGE) +#include +#else +#include +#endif + +#include +#include + +#include +#include +#include "xfwm4-workspace-dialog_glade.h" + +static gboolean version = FALSE; + +GtkWidget * +workspace_dialog_new_from_xml (GladeXML *gxml) +{ + GtkWidget *dialog; + GtkWidget *vbox; + XfconfChannel *xfwm4_channel = xfconf_channel_new("xfwm4"); + + GtkWidget *workspace_count_spinbutton = glade_xml_get_widget (gxml, "workspace_count_spinbutton"); + + /* Bind easy properties */ + xfconf_g_property_bind (xfwm4_channel, + "/general/workspace_count", + G_TYPE_INT, + (GObject *)workspace_count_spinbutton, "value"); + + vbox = glade_xml_get_widget (gxml, "main-vbox"); + dialog = glade_xml_get_widget (gxml, "main-dialog"); + + gtk_widget_show_all(vbox); + + return dialog; +} + + +static GOptionEntry entries[] = +{ + { "version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version, + N_("Version information"), + NULL + }, + { NULL } +}; + + +int +main(int argc, gchar **argv) +{ + GladeXML *gxml; + GtkWidget *dialog; + GError *cli_error = NULL; + + #ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + #endif + + if(!gtk_init_with_args(&argc, &argv, _("."), entries, PACKAGE, &cli_error)) + { + if (cli_error != NULL) + { + g_print (_("%s: %s\nTry %s --help to see a full list of available command line options.\n"), PACKAGE, cli_error->message, PACKAGE_NAME); + g_error_free (cli_error); + return 1; + } + } + + if(version) + { + g_print("%s\n", PACKAGE_STRING); + return 0; + } + + xfconf_init(NULL); + + gxml = glade_xml_new_from_buffer (workspace_dialog_glade, + workspace_dialog_glade_length, + NULL, NULL); + + dialog = workspace_dialog_new_from_xml (gxml); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + xfconf_shutdown(); + + return 0; +} Index: settings-dialogs/xfwm4-dialog.glade =================================================================== --- settings-dialogs/xfwm4-dialog.glade (revision 0) +++ settings-dialogs/xfwm4-dialog.glade (revision 0) @@ -0,0 +1,1256 @@ + + + + + + + 5 + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + 2 + + + True + xfwm4 + Windowmanager Settings + + + False + False + 1 + + + + + True + True + + + True + 4 + 4 + 4 + 4 + + + True + + + 120 + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + False + False + + + + + True + 4 + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + True + True + 0 + + + + + + + True + <b>Title font</b> + True + + + label_item + + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + + + + + + + + True + <b>Title alignment</b> + True + + + label_item + + + + + False + False + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + + + True + Click and drag the buttons to change the layout + + + + + True + 0 + GTK_SHADOW_IN + + + True + 4 + 4 + 4 + + + 26 + True + + + True + True + True + The window title, it cannot be removed + Title + 0 + + + + + + + + + True + Active + True + + + label_item + + + + + 1 + + + + + 0 + GTK_SHADOW_IN + + + True + 4 + 4 + 4 + + + 26 + True + 5 + + + True + True + True + Menu + 0 + + + True + gtk-index + + + + + False + False + + + + + True + True + True + Stick + 0 + + + True + gtk-add + + + + + False + False + 1 + + + + + True + True + True + Shade + 0 + + + True + gtk-goto-top + + + + + False + False + 2 + + + + + True + True + True + Hide + 0 + + + True + gtk-undo + + + + + False + False + 3 + + + + + True + True + True + Maximize + 0 + + + True + gtk-zoom-100 + + + + + False + False + 4 + + + + + True + True + True + Close + 0 + + + True + gtk-close + + + + + False + False + 5 + + + + + + + + + True + Hidden + True + + + label_item + + + + + 2 + + + + + + + + + True + <b>Button layout</b> + True + + + label_item + + + + + False + False + 2 + + + + + 1 + + + + + + + + + True + Style + + + tab + False + + + + + True + 4 + 4 + 4 + 4 + + + True + + + True + 4 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + + + True + True + True + gtk-add + True + 0 + + + False + False + 1 + + + + + True + True + True + gtk-remove + True + 0 + + + False + False + 2 + + + + + False + False + 4 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + True + + + + + + + + + True + <b>Window shortcuts</b> + True + + + label_item + + + + + 1 + + + + + + + 1 + + + + + True + Keyboard + + + tab + 1 + False + + + + + True + 4 + 4 + 4 + 4 + + + True + 4 + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + True + + + True + True + Click to focus + 0 + True + True + + + + + True + True + Focus follows mouse + 0 + True + True + click_to_focus_mode + + + 1 + + + + + + + + + True + <b>Focus model</b> + True + + + label_item + + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + 4 + + + True + <i>Short</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 100 100 2000 1 10 10 + False + + + 1 + + + + + True + <i>Long</i> + True + + + False + False + 2 + + + + + + + + + True + <b>Delay before window receives focus</b> + True + + + label_item + + + + + False + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + True + Automatically give focus to newly created windows + 0 + True + + + + + + + True + <b>New window focus</b> + True + + + label_item + + + + + False + False + 2 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + 4 + + + True + True + Automatically raise windows when they receive focus + 0 + True + + + + + True + + + True + 0 + Delay before raising focused window: + + + False + False + + + + + True + 4 + + + True + <i>Short</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 100 100 2000 1 10 10 + False + + + 1 + + + + + True + <i>Long</i> + True + + + False + False + 2 + + + + + 1 + + + + + 1 + + + + + + + + + True + <b>Raise on focus</b> + True + + + label_item + + + + + False + False + 3 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + True + Raise window when clicking inside application window + 0 + True + + + + + + + True + <b>Raise on click</b> + True + + + label_item + + + + + False + False + 4 + + + + + + + 2 + + + + + True + Focus + + + tab + 2 + False + + + + + True + 4 + 4 + 4 + 4 + + + True + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + 4 + + + True + True + Snap windows to screen border + 0 + True + + + False + False + + + + + True + True + Snap windows to other windows + 0 + True + + + False + False + 1 + + + + + True + + + True + 0 + Distance: + + + + + True + 4 + + + True + <i>Small</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 20.332225913621262 0 100 1 10 10 + False + False + + + 1 + + + + + True + <i>Wide</i> + True + + + False + False + 2 + + + + + 1 + + + + + 2 + + + + + + + + + True + <b>Windows snapping</b> + True + + + label_item + + + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + 4 + + + True + True + Wrap workspaces when the pointer reaches the screen edge + 0 + True + + + + + True + True + Wrap workspaces when dragging a window off the screen + 0 + True + + + 1 + + + + + True + + + True + 0 + Edge resistance: + True + + + False + False + + + + + True + 4 + + + True + <i>Small</i> + True + + + False + False + + + + + True + True + GTK_UPDATE_DISCONTINUOUS + 20.332225913621262 0 100 1 10 10 + False + False + + + 1 + + + + + True + <i>Wide</i> + True + + + False + False + 2 + + + + + 1 + + + + + 2 + + + + + + + + + True + <b>Wrap workspaces</b> + True + + + label_item + + + + + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + 4 + + + True + True + Hide content of windows when resizing + 0 + True + + + False + False + + + + + True + True + Hide content of windows when moving + 0 + True + + + False + False + 1 + + + + + + + + + True + <b>Box move and resize</b> + True + + + label_item + + + + + 2 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + 12 + + + True + The action to perform when the title-bar is double-clicked + + + + + + + + True + <b>Double click action</b> + True + + + label_item + + + + + 3 + + + + + + + 3 + + + + + True + Advanced + + + tab + 3 + False + + + + + 2 + + + + + True + GTK_BUTTONBOX_EDGE + + + True + True + True + gtk-help + True + 0 + + + + + True + True + True + gtk-close + True + 0 + + + 1 + + + + + False + GTK_PACK_END + + + + + + Index: src/parserc.c =================================================================== --- src/parserc.c (revision 27208) +++ src/parserc.c (working copy) @@ -39,6 +39,8 @@ #define DEFAULT_THEME "Default" #endif +#define TOINT(x) (x ? atoi(x) : 0) + gboolean parseRc (const gchar * file, const gchar * dir, Settings *rc) { @@ -99,8 +101,8 @@ return rval; } -gchar * -getValue (const gchar * option, Settings *rc) +GValue * +getGValue (const gchar * option, Settings *rc) { gint i; @@ -119,7 +121,7 @@ } gboolean -setValue (const gchar * lvalue, const gchar * rvalue, Settings *rc) +setValue (const gchar * lvalue, const gchar *rvalue, Settings *rc) { gint i; @@ -134,12 +136,19 @@ { if (rvalue) { - if (rc[i].value) + switch (rc[i].type) { - g_free (rc[i].value); + case G_TYPE_STRING: + setStringValue (lvalue, rvalue, rc); + break; + case G_TYPE_INT: + setIntValue (lvalue, TOINT(rvalue), rc); + break; + case G_TYPE_BOOLEAN: + setBooleanValue (lvalue, !g_ascii_strcasecmp ("true", rvalue), rc); + break; } - rc[i].value = g_strdup (rvalue); - TRACE ("%s=%s", rc[i].option, rc[i].value); + //TRACE ("%s=%s", rc[i].option, rc[i].value); return TRUE; } } @@ -148,26 +157,70 @@ } gboolean -setBooleanValueFromInt (const gchar * lvalue, int value, Settings *rc) +setGValue (const gchar * lvalue, const GValue *rvalue, Settings *rc) { - return setValue (lvalue, value ? "true" : "false", rc); + gint i; + + TRACE ("entering setValue"); + + g_return_val_if_fail (lvalue != NULL, FALSE); + g_return_val_if_fail (rvalue != NULL, FALSE); + + for (i = 0; rc[i].option; i++) + { + if (!g_ascii_strcasecmp (lvalue, rc[i].option)) + { + if (rvalue) + { + if (rc[i].value) + { + g_value_unset (rc[i].value); + g_value_init (rc[i].value, G_VALUE_TYPE(rvalue)); + } + else + { + rc[i].value = g_new0(GValue, 1); + g_value_init (rc[i].value, G_VALUE_TYPE(rvalue)); + } + + g_value_copy (rvalue, rc[i].value); + //TRACE ("%s=%s", rc[i].option, rc[i].value); + return TRUE; + } + } + } + return FALSE; } gboolean -setIntValueFromInt (const gchar * lvalue, int value, Settings *rc) +setBooleanValue (const gchar * lvalue, gboolean value, Settings *rc) { - gchar *s; - gboolean result; + GValue tmp_val = {0, }; + g_value_init(&tmp_val, G_TYPE_BOOLEAN); + g_value_set_boolean(&tmp_val, value); - s = g_strdup_printf ("%i", value); - result = setValue (lvalue, s, rc); - g_free (s); + return setGValue (lvalue, &tmp_val, rc); +} - return result; +gboolean +setIntValue (const gchar * lvalue, gint value, Settings *rc) +{ + GValue tmp_val = {0, }; + g_value_init(&tmp_val, G_TYPE_INT); + g_value_set_int(&tmp_val, value); + return setGValue (lvalue, &tmp_val, rc); } +gboolean +setStringValue (const gchar * lvalue, const gchar *value, Settings *rc) +{ + GValue tmp_val = {0, }; + g_value_init(&tmp_val, G_TYPE_STRING); + g_value_set_string(&tmp_val, value); + return setGValue (lvalue, &tmp_val, rc); +} + gchar * - getSystemThemeDir (void) { return g_build_filename (DATADIR, "themes", DEFAULT_THEME, "xfwm4", NULL); @@ -228,8 +281,84 @@ { if (rc[i].value) { + g_value_unset(rc[i].value); g_free (rc[i].value); rc[i].value = NULL; } } } + +const gchar * +getStringValue (const gchar *option, Settings *rc) +{ + gint i; + + TRACE ("entering getStringValue"); + + g_return_val_if_fail (option != NULL, NULL); + + for (i = 0; rc[i].option; i++) + { + if (!g_ascii_strcasecmp (option, rc[i].option)) + { + if (rc[i].value == NULL) + return NULL; + if (G_VALUE_TYPE(rc[i].value) != G_TYPE_STRING) + { + g_print("%s", rc[i].option); + return NULL; + } + return g_value_get_string(rc[i].value); + } + } + return NULL; +} + +gint +getIntValue (const gchar *option, Settings *rc) +{ + gint i; + + TRACE ("entering getIntValue"); + + g_return_val_if_fail (option != NULL, 0); + + for (i = 0; rc[i].option; i++) + { + if (!g_ascii_strcasecmp (option, rc[i].option)) + { + if (rc[i].value == NULL) + return 0; + g_return_val_if_fail(G_VALUE_TYPE(rc[i].value) == G_TYPE_INT, 0); + return g_value_get_int(rc[i].value); + } + } + return 0; +} + +gboolean +getBoolValue (const gchar *option, Settings *rc) +{ + gint i; + + TRACE ("entering getBoolValue"); + + g_return_val_if_fail (option != NULL, FALSE); + + for (i = 0; rc[i].option; i++) + { + if (!g_ascii_strcasecmp (option, rc[i].option)) + { + if (rc[i].value == NULL) + return FALSE; + if (G_VALUE_TYPE(rc[i].value) != G_TYPE_BOOLEAN) + { + g_print("%s", rc[i].option); + return FALSE; + } + g_return_val_if_fail(G_VALUE_TYPE(rc[i].value) == G_TYPE_BOOLEAN, FALSE); + return g_value_get_boolean(rc[i].value); + } + } + return FALSE; +} Index: src/keyboard.c =================================================================== --- src/keyboard.c (revision 27208) +++ src/keyboard.c (working copy) @@ -64,7 +64,7 @@ } int -getModifierMap (char *str) +getModifierMap (const char *str) { gchar *tmp; int map; @@ -122,7 +122,7 @@ } void -parseKeyString (Display * dpy, MyKey * key, char *str) +parseKeyString (Display * dpy, MyKey * key, const char *str) { char *k; Index: src/mypixmap.c =================================================================== --- src/mypixmap.c (revision 27208) +++ src/mypixmap.c (working copy) @@ -320,7 +320,7 @@ return ret; } -static gchar * +static const gchar * search_color_symbol (gchar *symbol, xfwmColorSymbol *color_sym) { xfwmColorSymbol *i; @@ -432,7 +432,7 @@ } else if (key == 5) { - gchar *new_color = NULL; + const gchar *new_color = NULL; new_color = search_color_symbol (color, color_sym); if (new_color) { @@ -733,7 +733,7 @@ } static GdkPixbuf * -xfwmPixmapCompose (GdkPixbuf *pixbuf, gchar * dir, gchar * file) +xfwmPixmapCompose (GdkPixbuf *pixbuf, const gchar * dir, const gchar * file) { GdkPixbuf *alpha; gchar *filepng; @@ -931,7 +931,7 @@ } gboolean -xfwmPixmapLoad (ScreenInfo * screen_info, xfwmPixmap * pm, gchar * dir, gchar * file, xfwmColorSymbol * cs) +xfwmPixmapLoad (ScreenInfo * screen_info, xfwmPixmap * pm, const gchar * dir, const gchar * file, xfwmColorSymbol * cs) { gchar *filename; gchar *filexpm; Index: src/parserc.h =================================================================== --- src/parserc.h (revision 27208) +++ src/parserc.h (working copy) @@ -35,11 +35,26 @@ const gchar *, Settings *); gboolean checkRc (Settings *); -gchar *getValue (const gchar *, +GValue *getGValue (const gchar *, Settings *); +const gchar *getStringValue (const gchar *, + Settings *); +gint getIntValue (const gchar *, + Settings *); +gboolean getBoolValue (const gchar *, + Settings *); gboolean setValue (const gchar *, const gchar *, Settings *); +gboolean setStringValue (const gchar *, + const gchar *, + Settings *); +gboolean setIntValue (const gchar *, + gint, + Settings *rc); +gboolean setBooleanValue (const gchar *, + gboolean, + Settings *rc); gboolean setBooleanValueFromInt (const gchar *, int, Settings *); Index: src/keyboard.h =================================================================== --- src/keyboard.h (revision 27208) +++ src/keyboard.h (working copy) @@ -44,10 +44,10 @@ extern unsigned int SuperMask; extern unsigned int HyperMask; -int getModifierMap (char *); +int getModifierMap (const char *); void parseKeyString (Display *, MyKey *, - char *); + const char *); gboolean grabKey (Display *, MyKey *, Window); Index: src/mypixmap.h =================================================================== --- src/mypixmap.h (revision 27208) +++ src/mypixmap.h (working copy) @@ -40,7 +40,7 @@ typedef struct { gchar *name; - gchar *value; + const gchar *value; } xfwmColorSymbol; @@ -59,8 +59,8 @@ GdkPixbuf *); gboolean xfwmPixmapLoad (ScreenInfo *, xfwmPixmap *, - gchar *, - gchar *, + const gchar *, + const gchar *, xfwmColorSymbol *); void xfwmPixmapCreate (ScreenInfo *, xfwmPixmap *, Index: src/settings.c =================================================================== --- src/settings.c (revision 27208) +++ src/settings.c (working copy) @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "screen.h" #include "hints.h" @@ -42,17 +42,14 @@ #include "ui_style.h" #define CHANNEL1 "xfwm4" -#define CHANNEL2 "margins" -#define CHANNEL3 "workspaces" -#define CHANNEL4 "xfwm4_keys" -#define CHANNEL5 "wmtweaks" +#define CHANNEL2 "xfwm4_keys" #define DEFAULT_KEYTHEME "Default" #define KEYTHEMERC "keythemerc" #define THEMERC "themerc" -#define TOINT(x) (x ? atoi(x) : 0) #define XPM_COLOR_SYMBOL_SIZE 22 +#define XFWM4_SETTINGS_COUNT 66 /* Forward static decls. */ @@ -60,22 +57,8 @@ static void set_settings_margin (ScreenInfo *, int , int); -static void notify_cb (const char *, - const char *, - McsAction, - McsSetting *, - void *); -static GdkFilterReturn client_event_filter (GdkXEvent *, - GdkEvent *, - gpointer); -static void watch_cb (Window, - Bool, - long, - void *); static void loadRcData (ScreenInfo *, Settings *); -static void loadMcsData (ScreenInfo *, - Settings *); static void loadTheme (ScreenInfo *, Settings *); static gboolean loadKeyBindings (ScreenInfo *, @@ -84,6 +67,10 @@ static void unloadSettings (ScreenInfo *); static gboolean reloadScreenSettings (ScreenInfo *, int); +static void cb_xfwm4_channel_property_changed (XfconfChannel *, + const gchar *, + const GValue *, + ScreenInfo *); static void update_grabs (ScreenInfo *screen_info) @@ -140,7 +127,7 @@ } static void -set_easy_click (ScreenInfo *screen_info, char *modifier) +set_easy_click (ScreenInfo *screen_info, const char *modifier) { g_return_if_fail (screen_info != NULL); g_return_if_fail (modifier != NULL); @@ -192,393 +179,10 @@ } static void -notify_cb (const char *name, const char *channel_name, McsAction action, McsSetting * setting, void *data) -{ - ScreenInfo *screen_info; - - screen_info = (ScreenInfo *) data; - g_return_if_fail (screen_info != NULL); - - if (!g_ascii_strcasecmp (CHANNEL1, channel_name)) - { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reload */ - if (!screen_info->mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/BoxMove")) - { - screen_info->params->box_move = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/BoxResize")) - { - screen_info->params->box_resize = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/ClickToFocus")) - { - screen_info->params->click_to_focus = setting->data.v_int; - update_grabs (screen_info); - } - else if (!strcmp (name, "Xfwm/FocusNewWindow")) - { - screen_info->params->focus_new = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/FocusRaise")) - { - screen_info->params->raise_on_focus = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/RaiseDelay")) - { - screen_info->params->raise_delay = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/FocusDelay")) - { - screen_info->params->focus_delay = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/RaiseOnClick")) - { - screen_info->params->raise_on_click = setting->data.v_int; - update_grabs (screen_info); - } - else if (!strcmp (name, "Xfwm/SnapToBorder")) - { - screen_info->params->snap_to_border = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/SnapToWindows")) - { - screen_info->params->snap_to_windows = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/SnapWidth")) - { - screen_info->params->snap_width = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/WrapWorkspaces")) - { - screen_info->params->wrap_workspaces = setting->data.v_int; - placeSidewalks (screen_info, screen_info->params->wrap_workspaces); - } - else if (!strcmp (name, "Xfwm/WrapWindows")) - { - screen_info->params->wrap_windows = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/WrapResistance")) - { - screen_info->params->wrap_resistance = setting->data.v_int; - } - } - else if (setting->type == MCS_TYPE_STRING) - { - if (!strcmp (name, "Xfwm/DblClickAction")) - { - reloadScreenSettings (screen_info, NO_UPDATE_FLAG); - } - else if (!strcmp (name, "Xfwm/ThemeName")) - { - reloadScreenSettings (screen_info, UPDATE_MAXIMIZE | UPDATE_GRAVITY | UPDATE_CACHE); - } - else if (!strcmp (name, "Xfwm/ButtonLayout")) - { - reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE); - } - if (!strcmp (name, "Xfwm/TitleAlign")) - { - reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE); - } - if (!strcmp (name, "Xfwm/TitleFont")) - { - reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } - } - else if (!g_ascii_strcasecmp (CHANNEL2, channel_name)) - { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!screen_info->mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/LeftMargin")) - { - set_settings_margin (screen_info, STRUTS_LEFT, setting->data.v_int); - } - else if (!strcmp (name, "Xfwm/RightMargin")) - { - set_settings_margin (screen_info, STRUTS_RIGHT, setting->data.v_int); - } - else if (!strcmp (name, "Xfwm/BottomMargin")) - { - set_settings_margin (screen_info, STRUTS_BOTTOM, setting->data.v_int); - } - else if (!strcmp (name, "Xfwm/TopMargin")) - { - set_settings_margin (screen_info, STRUTS_TOP, setting->data.v_int); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } - } - else if (!g_ascii_strcasecmp (CHANNEL3, channel_name)) - { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!screen_info->mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/WorkspaceCount")) - { - workspaceSetCount(screen_info, setting->data.v_int); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } - } - else if (!g_ascii_strcasecmp (CHANNEL4, channel_name)) - { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!screen_info->mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_STRING) - { - if (!strcmp (name, "Xfwm/KeyThemeName")) - { - reloadScreenSettings (screen_info, NO_UPDATE_FLAG); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } - } - else if (!g_ascii_strcasecmp (CHANNEL5, channel_name)) - { - switch (action) - { - case MCS_ACTION_NEW: - /* The following is to reduce initial startup time and reloads */ - if (!screen_info->mcs_initted) - { - return; - } - case MCS_ACTION_CHANGED: - if (setting->type == MCS_TYPE_INT) - { - if (!strcmp (name, "Xfwm/BorderlessMaximize")) - { - screen_info->params->borderless_maximize = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_MAXIMIZE); - } - else if (!strcmp (name, "Xfwm/CycleMinimum")) - { - screen_info->params->cycle_minimum = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/CycleHidden")) - { - screen_info->params->cycle_hidden = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/CycleWorkspaces")) - { - screen_info->params->cycle_workspaces = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/FocusHint")) - { - screen_info->params->focus_hint = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/FrameOpacity")) - { - screen_info->params->frame_opacity = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_FRAME); - } - else if (!strcmp (name, "Xfwm/InactiveOpacity")) - { - screen_info->params->inactive_opacity = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_FRAME); - clientUpdateAllOpacity (screen_info); - } - else if (!strcmp (name, "Xfwm/MoveOpacity")) - { - screen_info->params->move_opacity = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/ResizeOpacity")) - { - screen_info->params->resize_opacity = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/PopupOpacity")) - { - screen_info->params->popup_opacity = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_FRAME); - } - else if (!strcmp (name, "Xfwm/PlacementRatio")) - { - screen_info->params->placement_ratio = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/ShowDockShadow")) - { - screen_info->params->show_dock_shadow = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_FRAME); - } - else if (!strcmp (name, "Xfwm/ShowFrameShadow")) - { - screen_info->params->show_frame_shadow = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_FRAME); - } - else if (!strcmp (name, "Xfwm/ShowPopupShadow")) - { - screen_info->params->show_popup_shadow = setting->data.v_int; - reloadScreenSettings (screen_info, UPDATE_FRAME); - } - else if (!strcmp (name, "Xfwm/SnapResist")) - { - screen_info->params->snap_resist = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/PreventFocusStealing")) - { - screen_info->params->prevent_focus_stealing = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/RaiseWithAnyButton")) - { - screen_info->params->raise_with_any_button = setting->data.v_int; - update_grabs (screen_info); - } - else if (!strcmp (name, "Xfwm/RestoreOnMove")) - { - screen_info->params->restore_on_move = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/ScrollWorkspaces")) - { - screen_info->params->scroll_workspaces = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/ToggleWorkspaces")) - { - screen_info->params->toggle_workspaces = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/UnredirectOverlays")) - { - screen_info->params->unredirect_overlays = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/UseCompositing")) - { - screen_info->params->use_compositing = setting->data.v_int; - compositorActivateScreen (screen_info, - screen_info->params->use_compositing); - } - else if (!strcmp (name, "Xfwm/WrapLayout")) - { - screen_info->params->wrap_layout = setting->data.v_int; - } - else if (!strcmp (name, "Xfwm/WrapCycle")) - { - screen_info->params->wrap_cycle = setting->data.v_int; - } - } - else if (setting->type == MCS_TYPE_STRING) - { - if (!strcmp (name, "Xfwm/EasyClick")) - { - reloadScreenSettings (screen_info, UPDATE_BUTTON_GRABS); - } - else if (!strcmp (name, "Xfwm/ActivateAction")) - { - set_activate_action (screen_info, setting->data.v_string); - } - else if (!strcmp (name, "Xfwm/PlacementMode")) - { - set_placement_mode (screen_info, setting->data.v_string); - } - } - break; - case MCS_ACTION_DELETED: - default: - break; - } - } -} - -static GdkFilterReturn -client_event_filter (GdkXEvent * xevent, GdkEvent * event, gpointer data) -{ - ScreenInfo *screen_info; - - screen_info = (ScreenInfo *) data; - g_return_val_if_fail (screen_info != NULL, GDK_FILTER_CONTINUE); - - if (mcs_client_process_event (screen_info->mcs_client, (XEvent *) xevent)) - { - return GDK_FILTER_REMOVE; - } - else - { - return GDK_FILTER_CONTINUE; - } -} - -static void -watch_cb (Window window, Bool is_start, long mask, void *cb_data) -{ - GdkWindow *gdkwin; - - gdkwin = gdk_window_lookup (window); - - if (is_start) - { - if (!gdkwin) - { - gdkwin = gdk_window_foreign_new (window); - } - else - { - g_object_ref (gdkwin); - } - gdk_window_add_filter (gdkwin, client_event_filter, cb_data); - } - else - { - g_assert (gdkwin); - gdk_window_remove_filter (gdkwin, client_event_filter, cb_data); - g_object_unref (gdkwin); - } -} - -static void loadRcData (ScreenInfo *screen_info, Settings *rc) { gchar *homedir; - gchar *keythemevalue; + const gchar *keythemevalue; gchar *keytheme; gchar *system_keytheme; @@ -587,7 +191,7 @@ g_warning ("Missing defaults file"); exit (1); } - keythemevalue = getValue ("keytheme", rc); + keythemevalue = getStringValue ("keytheme", rc); if (keythemevalue) { system_keytheme = getSystemThemeDir (); @@ -610,334 +214,34 @@ } static void -loadMcsData (ScreenInfo *screen_info, Settings *rc) +loadXfconfData (ScreenInfo *screen_info, Settings *rc) { - McsSetting *setting; - - if (screen_info->mcs_client) + gint i = XPM_COLOR_SYMBOL_SIZE; + for (; i < (XPM_COLOR_SYMBOL_SIZE + XFWM4_SETTINGS_COUNT); ++i) { - /* "Regular" channel */ - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ClickToFocus", CHANNEL1, - &setting) == MCS_SUCCESS) + gchar *property_name = g_strconcat("/general/", rc[i].option, NULL); + if(xfconf_channel_has_property(screen_info->xfwm4_channel, property_name)) { - setBooleanValueFromInt ("click_to_focus", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusNewWindow", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("focus_new", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusRaise", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("raise_on_focus", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RaiseDelay", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("raise_delay", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusDelay", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("focus_delay", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RaiseOnClick", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("raise_on_click", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapToBorder", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("snap_to_border", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapToWindows", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("snap_to_windows", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapWidth", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("snap_width", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapWorkspaces", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("wrap_workspaces", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapWindows", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("wrap_windows", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapResistance", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("wrap_resistance", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BoxMove", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("box_move", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BoxResize", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("box_resize", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/DblClickAction", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("double_click_action", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ThemeName", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("theme", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ButtonLayout", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("button_layout", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/TitleAlign", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("title_alignment", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/TitleFont", CHANNEL1, - &setting) == MCS_SUCCESS) - { - setValue ("title_font", setting->data.v_string, rc); - mcs_setting_free (setting); - } + if(rc[i].value) + { + g_value_unset(rc[i].value); + g_free(rc[i].value); + } + rc[i].value = g_new0(GValue, 1); - /* Margins channel */ - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/LeftMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_left", setting->data.v_int, rc); - mcs_setting_free (setting); + if(!xfconf_channel_get_property(screen_info->xfwm4_channel, property_name, rc[i].value)) + { + /* g_debug("get prop failed"); */ + } } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RightMargin", CHANNEL2, - &setting) == MCS_SUCCESS) + else { - setIntValueFromInt ("margin_right", setting->data.v_int, rc); - mcs_setting_free (setting); + if (rc[i].value) + xfconf_channel_set_property(screen_info->xfwm4_channel, property_name, rc[i].value); } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BottomMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_bottom", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/TopMargin", CHANNEL2, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("margin_top", setting->data.v_int, rc); - mcs_setting_free (setting); - } - - /* Workspaces channel */ - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WorkspaceCount", CHANNEL3, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("workspace_count", setting->data.v_int, rc); - mcs_setting_free (setting); - } - - /* Keyboard theme channel */ - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/KeyThemeName", CHANNEL4, - &setting) == MCS_SUCCESS) - { - setValue ("keytheme", setting->data.v_string, rc); - mcs_setting_free (setting); - } - - /* Tweaks channel */ - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ActivateAction", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setValue ("activate_action", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/BorderlessMaximize", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("borderless_maximize", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/CycleMinimum", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("cycle_minimum", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/CycleHidden", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("cycle_hidden", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/CycleWorkspaces", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("cycle_workspaces", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/EasyClick", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setValue ("easy_click", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FocusHint", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("focus_hint", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/FrameOpacity", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("frame_opacity", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PlacementMode", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setValue ("placement_mode", setting->data.v_string, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PlacementRatio", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("placement_ratio", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/InactiveOpacity", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("inactive_opacity", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/MoveOpacity", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("move_opacity", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ResizeOpacity", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("resize_opacity", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PopupOpacity", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setIntValueFromInt ("popup_opacity", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ShowDockShadow", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("show_dock_shadow", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ShowFrameShadow", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("show_frame_shadow", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ShowPopupShadow", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("show_popup_shadow", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/SnapResist", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("snap_resist", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/PreventFocusStealing", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("prevent_focus_stealing", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RaiseWithAnyButton", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("raise_with_any_button", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/RestoreOnMove", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("restore_on_move", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ScrollWorkspaces", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("scroll_workspaces", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/ToggleWorkspaces", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("toggle_workspaces", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/UnredirectOverlays", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("unredirect_overlays", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/UseCompositing", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("use_compositing", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapLayout", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("wrap_layout", setting->data.v_int, rc); - mcs_setting_free (setting); - } - if (mcs_client_get_setting (screen_info->mcs_client, "Xfwm/WrapCycle", CHANNEL5, - &setting) == MCS_SUCCESS) - { - setBooleanValueFromInt ("wrap_cycle", setting->data.v_int, rc); - mcs_setting_free (setting); - } + g_free(property_name); } + } /* Simple helper function to avoid copy/paste of code */ @@ -950,7 +254,8 @@ color->allocated = FALSE; } - if (gdk_color_parse (rc[id].value, &color->col)) + /** do a direct value_get_string */ + if (gdk_color_parse (g_value_get_string(rc[id].value), &color->col)) { if (gdk_colormap_alloc_color (gdk_screen_get_rgb_colormap (screen_info->gscr), &color->col, FALSE, FALSE)) @@ -967,13 +272,19 @@ else { gdk_beep (); - g_message (_("%s: Cannot allocate color %s\n"), g_get_prgname (), rc[id].value); + if (G_VALUE_TYPE(rc[id].value) == G_TYPE_STRING) + g_message (_("%s: Cannot allocate color %s\n"), g_get_prgname (), g_value_get_string(rc[id].value)); + else + g_critical (_("%s: Cannot allocate color: GValue for color is not of type STRING"), g_get_prgname ()); } } else { gdk_beep (); - g_message (_("%s: Cannot parse color %s\n"), g_get_prgname (), rc[id].value); + if (G_VALUE_TYPE(rc[id].value) == G_TYPE_STRING) + g_message (_("%s: Cannot parse color %s\n"), g_get_prgname (), g_value_get_string(rc[id].value)); + else + g_critical (_("%s: Cannot parse color: GValue for color is not of type STRING"), g_get_prgname ()); } } @@ -982,7 +293,7 @@ { const gchar *val; - val = getValue (name, rc); + val = getStringValue (name, rc); if (!g_ascii_strcasecmp ("true", val) || !g_ascii_strcasecmp ("under", val)) { return TITLE_SHADOW_UNDER; @@ -1056,7 +367,7 @@ xfwmColorSymbol colsym[ XPM_COLOR_SYMBOL_SIZE + 1 ]; GtkWidget *widget; gchar *theme; - gchar *font; + const gchar *font; PangoFontDescription *desc; PangoContext *context; guint i, j; @@ -1067,51 +378,51 @@ desc = NULL; context = NULL; - rc[0].value = getUIStyle (widget, "fg", "selected"); - rc[1].value = getUIStyle (widget, "fg", "insensitive"); - rc[2].value = getUIStyle (widget, "dark", "selected"); - rc[3].value = getUIStyle (widget, "dark", "insensitive"); - rc[4].value = getUIStyle (widget, "fg", "normal"); - rc[5].value = getUIStyle (widget, "fg", "normal"); - rc[6].value = getUIStyle (widget, "bg", "selected"); - rc[7].value = getUIStyle (widget, "light", "selected"); - rc[8].value = getUIStyle (widget, "dark", "selected"); - rc[9].value = getUIStyle (widget, "mid", "selected"); - rc[10].value = getUIStyle (widget, "bg", "normal"); - rc[11].value = getUIStyle (widget, "light", "normal"); - rc[12].value = getUIStyle (widget, "dark", "normal"); - rc[13].value = getUIStyle (widget, "mid", "normal"); - rc[14].value = getUIStyle (widget, "bg", "insensitive"); - rc[15].value = getUIStyle (widget, "light", "insensitive"); - rc[16].value = getUIStyle (widget, "dark", "insensitive"); - rc[17].value = getUIStyle (widget, "mid", "insensitive"); - rc[18].value = getUIStyle (widget, "bg", "normal"); - rc[19].value = getUIStyle (widget, "light", "normal"); - rc[20].value = getUIStyle (widget, "dark", "normal"); - rc[21].value = getUIStyle (widget, "mid", "normal"); + setStringValue (rc[0].option, getUIStyle (widget, "fg", "selected"), rc); + setStringValue (rc[1].option, getUIStyle (widget, "fg", "insensitive"), rc); + setStringValue (rc[2].option, getUIStyle (widget, "dark", "selected"), rc); + setStringValue (rc[3].option, getUIStyle (widget, "dark", "insensitive"), rc); + setStringValue (rc[4].option, getUIStyle (widget, "fg", "normal"), rc); + setStringValue (rc[5].option, getUIStyle (widget, "fg", "normal"), rc); + setStringValue (rc[6].option, getUIStyle (widget, "bg", "selected"), rc); + setStringValue (rc[7].option, getUIStyle (widget, "light", "selected"), rc); + setStringValue (rc[8].option, getUIStyle (widget, "dark", "selected"), rc); + setStringValue (rc[9].option, getUIStyle (widget, "mid", "selected"), rc); + setStringValue (rc[10].option, getUIStyle (widget, "bg", "normal"), rc); + setStringValue (rc[11].option, getUIStyle (widget, "light", "normal"), rc); + setStringValue (rc[12].option, getUIStyle (widget, "dark", "normal"), rc); + setStringValue (rc[13].option, getUIStyle (widget, "mid", "normal"), rc); + setStringValue (rc[14].option, getUIStyle (widget, "bg", "insensitive"), rc); + setStringValue (rc[15].option, getUIStyle (widget, "light", "insensitive"), rc); + setStringValue (rc[16].option, getUIStyle (widget, "dark", "insensitive"), rc); + setStringValue (rc[17].option, getUIStyle (widget, "mid", "insensitive"), rc); + setStringValue (rc[18].option, getUIStyle (widget, "bg", "normal"), rc); + setStringValue (rc[19].option, getUIStyle (widget, "light", "normal"), rc); + setStringValue (rc[20].option, getUIStyle (widget, "dark", "normal"), rc); + setStringValue (rc[21].option, getUIStyle (widget, "mid", "normal"), rc); - theme = getThemeDir (getValue ("theme", rc), THEMERC); + theme = getThemeDir (getStringValue ("theme", rc), THEMERC); parseRc (THEMERC, theme, rc); screen_info->params->shadow_delta_x = - - (TOINT (getValue ("shadow_delta_x", rc))); + - getIntValue ("shadow_delta_x", rc); screen_info->params->shadow_delta_y = - - (TOINT (getValue ("shadow_delta_y", rc))); + - getIntValue ("shadow_delta_y", rc); screen_info->params->shadow_delta_width = - - (TOINT (getValue ("shadow_delta_width", rc))); + - getIntValue ("shadow_delta_width", rc); screen_info->params->shadow_delta_height = - - (TOINT (getValue ("shadow_delta_height", rc))); + - getIntValue ("shadow_delta_height", rc); for (i = 0; i < XPM_COLOR_SYMBOL_SIZE; i++) { colsym[i].name = rc[i].option; - colsym[i].value = rc[i].value; + colsym[i].value = g_value_get_string(rc[i].value); } colsym[XPM_COLOR_SYMBOL_SIZE].name = NULL; colsym[XPM_COLOR_SYMBOL_SIZE].value = NULL; - display_info->dbl_click_time = abs (TOINT (getValue ("dbl_click_time", rc))); + display_info->dbl_click_time = abs (getIntValue ("dbl_click_time", rc)); g_value_init (&tmp_val, G_TYPE_INT); if (gdk_setting_get ("gtk-double-click-time", &tmp_val)) { @@ -1119,7 +430,7 @@ } screen_info->font_height = 0; - font = getValue ("title_font", rc); + font = getStringValue ("title_font", rc); if (font && strlen (font)) { desc = pango_font_description_from_string (font); @@ -1192,11 +503,11 @@ screen_info->box_gc = createGC (screen_info, "#FFFFFF", GXxor, NULL, 2, TRUE); - if (!g_ascii_strcasecmp ("left", getValue ("title_alignment", rc))) + if (!g_ascii_strcasecmp ("left", getStringValue ("title_alignment", rc))) { screen_info->params->title_alignment = ALIGN_LEFT; } - else if (!g_ascii_strcasecmp ("right", getValue ("title_alignment", rc))) + else if (!g_ascii_strcasecmp ("right", getStringValue ("title_alignment", rc))) { screen_info->params->title_alignment = ALIGN_RIGHT; } @@ -1206,20 +517,20 @@ } screen_info->params->full_width_title = - !g_ascii_strcasecmp ("true", getValue ("full_width_title", rc)); + getBoolValue ("full_width_title", rc); screen_info->params->title_shadow[ACTIVE] = getTitleShadow (rc, "title_shadow_active"); screen_info->params->title_shadow[INACTIVE] = getTitleShadow (rc, "title_shadow_inactive"); - strncpy (screen_info->params->button_layout, getValue ("button_layout", rc), BUTTON_STRING_COUNT); - screen_info->params->button_spacing = TOINT (getValue ("button_spacing", rc)); - screen_info->params->button_offset = TOINT (getValue ("button_offset", rc)); - screen_info->params->maximized_offset = TOINT (getValue ("maximized_offset", rc)); + strncpy (screen_info->params->button_layout, getStringValue ("button_layout", rc), BUTTON_STRING_COUNT); + screen_info->params->button_spacing = getIntValue ("button_spacing", rc); + screen_info->params->button_offset = getIntValue ("button_offset", rc); + screen_info->params->maximized_offset = getIntValue ("maximized_offset", rc); screen_info->params->title_vertical_offset_active = - TOINT (getValue ("title_vertical_offset_active", rc)); + getIntValue ("title_vertical_offset_active", rc); screen_info->params->title_vertical_offset_inactive = - TOINT (getValue ("title_vertical_offset_inactive", rc)); + getIntValue ("title_vertical_offset_inactive", rc); screen_info->params->title_horizontal_offset = - TOINT (getValue ("title_horizontal_offset", rc)); + getIntValue ("title_horizontal_offset", rc); g_free (theme); } @@ -1230,7 +541,7 @@ gchar keyname[30]; Display *dpy; gchar *keytheme; - gchar *keythemevalue; + const gchar *keythemevalue; guint i; dpy = myScreenGetXDisplay (screen_info); @@ -1243,7 +554,7 @@ parseRc (KEYTHEMERC, keytheme, rc); g_free (keytheme); - keythemevalue = getValue ("keytheme", rc); + keythemevalue = getStringValue ("keytheme", rc); if (keythemevalue) { keytheme = getThemeDir (keythemevalue, KEYTHEMERC); @@ -1260,54 +571,54 @@ } } - parseKeyString (dpy, &screen_info->params->keys[KEY_CANCEL], getValue ("cancel_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_DOWN], getValue ("down_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_LEFT], getValue ("left_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_RIGHT], getValue ("right_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_UP], getValue ("up_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_ADD_WORKSPACE], getValue ("add_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_ADD_ADJACENT_WORKSPACE], getValue ("add_adjacent_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_CLOSE_WINDOW], getValue ("close_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_CYCLE_WINDOWS], getValue ("cycle_windows_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_DEL_WORKSPACE], getValue ("del_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_DEL_ACTIVE_WORKSPACE], getValue ("del_active_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_DOWN_WORKSPACE], getValue ("down_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_HORIZ], getValue ("fill_horiz_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_VERT], getValue ("fill_vert_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_WINDOW], getValue ("fill_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_HIDE_WINDOW], getValue ("hide_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_LEFT_WORKSPACE], getValue ("left_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_LOWER_WINDOW], getValue ("lower_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE], getValue ("move_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MAXIMIZE_HORIZ], getValue ("maximize_horiz_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MAXIMIZE_VERT], getValue ("maximize_vert_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MAXIMIZE_WINDOW], getValue ("maximize_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_DOWN_WORKSPACE], getValue ("move_window_down_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_LEFT_WORKSPACE], getValue ("move_window_left_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_NEXT_WORKSPACE], getValue ("move_window_next_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_PREV_WORKSPACE], getValue ("move_window_prev_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_RIGHT_WORKSPACE], getValue ("move_window_right_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_UP_WORKSPACE], getValue ("move_window_up_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_NEXT_WORKSPACE], getValue ("next_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_POPUP_MENU], getValue ("popup_menu_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_PREV_WORKSPACE], getValue ("prev_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_RAISE_WINDOW], getValue ("raise_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_RESIZE], getValue ("resize_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_RIGHT_WORKSPACE], getValue ("right_workspace_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_SHADE_WINDOW], getValue ("shade_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_SHOW_DESKTOP], getValue("show_desktop_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_STICK_WINDOW], getValue ("stick_window_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_TOGGLE_ABOVE], getValue ("above_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_TOGGLE_FULLSCREEN], getValue ("fullscreen_key", rc)); - parseKeyString (dpy, &screen_info->params->keys[KEY_UP_WORKSPACE], getValue ("up_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_CANCEL], getStringValue ("cancel_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_DOWN], getStringValue ("down_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_LEFT], getStringValue ("left_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_RIGHT], getStringValue ("right_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_UP], getStringValue ("up_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_ADD_WORKSPACE], getStringValue ("add_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_ADD_ADJACENT_WORKSPACE], getStringValue ("add_adjacent_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_CLOSE_WINDOW], getStringValue ("close_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_CYCLE_WINDOWS], getStringValue ("cycle_windows_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_DEL_WORKSPACE], getStringValue ("del_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_DEL_ACTIVE_WORKSPACE], getStringValue ("del_active_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_DOWN_WORKSPACE], getStringValue ("down_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_HORIZ], getStringValue ("fill_horiz_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_VERT], getStringValue ("fill_vert_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_WINDOW], getStringValue ("fill_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_HIDE_WINDOW], getStringValue ("hide_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_LEFT_WORKSPACE], getStringValue ("left_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_LOWER_WINDOW], getStringValue ("lower_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE], getStringValue ("move_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MAXIMIZE_HORIZ], getStringValue ("maximize_horiz_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MAXIMIZE_VERT], getStringValue ("maximize_vert_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MAXIMIZE_WINDOW], getStringValue ("maximize_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_DOWN_WORKSPACE], getStringValue ("move_window_down_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_LEFT_WORKSPACE], getStringValue ("move_window_left_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_NEXT_WORKSPACE], getStringValue ("move_window_next_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_PREV_WORKSPACE], getStringValue ("move_window_prev_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_RIGHT_WORKSPACE], getStringValue ("move_window_right_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_UP_WORKSPACE], getStringValue ("move_window_up_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_NEXT_WORKSPACE], getStringValue ("next_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_POPUP_MENU], getStringValue ("popup_menu_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_PREV_WORKSPACE], getStringValue ("prev_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_RAISE_WINDOW], getStringValue ("raise_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_RESIZE], getStringValue ("resize_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_RIGHT_WORKSPACE], getStringValue ("right_workspace_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_SHADE_WINDOW], getStringValue ("shade_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_SHOW_DESKTOP], getStringValue("show_desktop_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_STICK_WINDOW], getStringValue ("stick_window_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_TOGGLE_ABOVE], getStringValue ("above_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_TOGGLE_FULLSCREEN], getStringValue ("fullscreen_key", rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_UP_WORKSPACE], getStringValue ("up_workspace_key", rc)); for (i = 0; i < 12; i++) { g_snprintf(keyname, sizeof (keyname), "move_window_workspace_%d_key", i + 1); - parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_WORKSPACE_1 + i], getValue (keyname, rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_MOVE_WORKSPACE_1 + i], getStringValue (keyname, rc)); g_snprintf(keyname, sizeof (keyname), "workspace_%d_key", i + 1); - parseKeyString (dpy, &screen_info->params->keys[KEY_WORKSPACE_1 + i], getValue (keyname, rc)); + parseKeyString (dpy, &screen_info->params->keys[KEY_WORKSPACE_1 + i], getStringValue (keyname, rc)); } myScreenUngrabKeys (screen_info); @@ -1322,168 +633,169 @@ const gchar *value; Settings rc[] = { /* Do not change the order of the following parameters */ - {"active_text_color", NULL, FALSE}, - {"inactive_text_color", NULL, FALSE}, - {"active_text_shadow_color", NULL, FALSE}, - {"inactive_text_shadow_color", NULL, FALSE}, - {"active_border_color", NULL, FALSE}, - {"inactive_border_color", NULL, FALSE}, - {"active_color_1", NULL, FALSE}, - {"active_hilight_1", NULL, FALSE}, - {"active_shadow_1", NULL, FALSE}, - {"active_mid_1", NULL, FALSE}, - {"active_color_2", NULL, FALSE}, - {"active_hilight_2", NULL, FALSE}, - {"active_shadow_2", NULL, FALSE}, - {"active_mid_2", NULL, FALSE}, - {"inactive_color_1", NULL, FALSE}, - {"inactive_hilight_1", NULL, FALSE}, - {"inactive_shadow_1", NULL, FALSE}, - {"inactive_mid_1", NULL, FALSE}, - {"inactive_color_2", NULL, FALSE}, - {"inactive_hilight_2", NULL, FALSE}, - {"inactive_shadow_2", NULL, FALSE}, - {"inactive_mid_2", NULL, FALSE}, + {"active_text_color", NULL, G_TYPE_STRING, FALSE}, + {"inactive_text_color", NULL, G_TYPE_STRING, FALSE}, + {"active_text_shadow_color", NULL, G_TYPE_STRING, FALSE}, + {"inactive_text_shadow_color", NULL, G_TYPE_STRING, FALSE}, + {"active_border_color", NULL, G_TYPE_STRING, FALSE}, + {"inactive_border_color", NULL, G_TYPE_STRING, FALSE}, + {"active_color_1", NULL, G_TYPE_STRING, FALSE}, + {"active_hilight_1", NULL, G_TYPE_STRING, FALSE}, + {"active_shadow_1", NULL, G_TYPE_STRING, FALSE}, + {"active_mid_1", NULL, G_TYPE_STRING, FALSE}, + {"active_color_2", NULL, G_TYPE_STRING, FALSE}, + {"active_hilight_2", NULL, G_TYPE_STRING, FALSE}, + {"active_shadow_2", NULL, G_TYPE_STRING, FALSE}, + {"active_mid_2", NULL, G_TYPE_STRING, FALSE}, + {"inactive_color_1", NULL, G_TYPE_STRING, FALSE}, + {"inactive_hilight_1", NULL, G_TYPE_STRING, FALSE}, + {"inactive_shadow_1", NULL, G_TYPE_STRING, FALSE}, + {"inactive_mid_1", NULL, G_TYPE_STRING, FALSE}, + {"inactive_color_2", NULL, G_TYPE_STRING, FALSE}, + {"inactive_hilight_2", NULL, G_TYPE_STRING, FALSE}, + {"inactive_shadow_2", NULL, G_TYPE_STRING, FALSE}, + {"inactive_mid_2", NULL, G_TYPE_STRING, FALSE}, /* You can change the order of the following parameters */ - {"activate_action", NULL, TRUE}, - {"borderless_maximize", NULL, TRUE}, - {"box_move", NULL, TRUE}, - {"box_resize", NULL, TRUE}, - {"button_layout", NULL, TRUE}, - {"button_offset", NULL, TRUE}, - {"button_spacing", NULL, TRUE}, - {"click_to_focus", NULL, TRUE}, - {"focus_delay", NULL, TRUE}, - {"cycle_hidden", NULL, TRUE}, - {"cycle_minimum", NULL, TRUE}, - {"cycle_workspaces", NULL, TRUE}, - {"dbl_click_time", NULL, TRUE}, - {"double_click_action", NULL, TRUE}, - {"easy_click", NULL, TRUE}, - {"focus_hint", NULL, TRUE}, - {"focus_new", NULL, TRUE}, - {"frame_opacity", NULL, TRUE}, - {"full_width_title", NULL, TRUE}, - {"inactive_opacity", NULL, TRUE}, - {"keytheme", NULL, TRUE}, - {"margin_bottom", NULL, FALSE}, - {"margin_left", NULL, FALSE}, - {"margin_right", NULL, FALSE}, - {"margin_top", NULL, FALSE}, - {"maximized_offset", NULL, TRUE}, - {"move_opacity", NULL, TRUE}, - {"placement_ratio", NULL, TRUE}, - {"placement_mode", NULL, TRUE}, - {"popup_opacity", NULL, TRUE}, - {"prevent_focus_stealing", NULL, TRUE}, - {"raise_delay", NULL, TRUE}, - {"raise_on_click", NULL, TRUE}, - {"raise_on_focus", NULL, TRUE}, - {"raise_with_any_button", NULL, TRUE}, - {"resize_opacity", NULL, TRUE}, - {"restore_on_move", NULL, TRUE}, - {"scroll_workspaces", NULL, TRUE}, - {"shadow_delta_height", NULL, TRUE}, - {"shadow_delta_width", NULL, TRUE}, - {"shadow_delta_x", NULL, TRUE}, - {"shadow_delta_y", NULL, TRUE}, - {"show_app_icon", NULL, TRUE}, - {"show_dock_shadow", NULL, TRUE}, - {"show_frame_shadow", NULL, TRUE}, - {"show_popup_shadow", NULL, TRUE}, - {"snap_resist", NULL, TRUE}, - {"snap_to_border", NULL, TRUE}, - {"snap_to_windows", NULL, TRUE}, - {"snap_width", NULL, TRUE}, - {"theme", NULL, TRUE}, - {"title_alignment", NULL, TRUE}, - {"title_font", NULL, FALSE}, - {"title_horizontal_offset", NULL, TRUE}, - {"title_shadow_active", NULL, TRUE}, - {"title_shadow_inactive", NULL, TRUE}, - {"title_vertical_offset_active", NULL, TRUE}, - {"title_vertical_offset_inactive", NULL, TRUE}, - {"toggle_workspaces", NULL, TRUE}, - {"unredirect_overlays", NULL, TRUE}, - {"use_compositing", NULL, TRUE}, - {"workspace_count", NULL, TRUE}, - {"wrap_cycle", NULL, TRUE}, - {"wrap_layout", NULL, TRUE}, - {"wrap_resistance", NULL, TRUE}, - {"wrap_windows", NULL, TRUE}, - {"wrap_workspaces", NULL, TRUE}, + {"activate_action", NULL, G_TYPE_STRING, TRUE}, + {"borderless_maximize", NULL, G_TYPE_BOOLEAN, TRUE}, + {"box_move", NULL, G_TYPE_BOOLEAN, TRUE}, + {"box_resize", NULL, G_TYPE_BOOLEAN, TRUE}, + {"button_layout", NULL, G_TYPE_STRING, TRUE}, + {"button_offset", NULL, G_TYPE_INT, TRUE}, + {"button_spacing", NULL, G_TYPE_INT, TRUE}, + {"click_to_focus", NULL, G_TYPE_BOOLEAN, TRUE}, + {"focus_delay", NULL, G_TYPE_INT, TRUE}, + {"cycle_hidden", NULL, G_TYPE_BOOLEAN, TRUE}, + {"cycle_minimum", NULL, G_TYPE_BOOLEAN, TRUE}, + {"cycle_workspaces", NULL, G_TYPE_BOOLEAN, TRUE}, + {"dbl_click_time", NULL, G_TYPE_INT, TRUE}, + {"double_click_action", NULL, G_TYPE_STRING, TRUE}, + {"easy_click", NULL, G_TYPE_STRING, TRUE}, + {"focus_hint", NULL, G_TYPE_BOOLEAN, TRUE}, + {"focus_new", NULL, G_TYPE_BOOLEAN,TRUE}, + {"frame_opacity", NULL, G_TYPE_INT, TRUE}, + {"full_width_title", NULL, G_TYPE_BOOLEAN, TRUE}, + {"inactive_opacity", NULL, G_TYPE_INT, TRUE}, + {"keytheme", NULL, G_TYPE_STRING, TRUE}, + {"margin_bottom", NULL, G_TYPE_INT, FALSE}, + {"margin_left", NULL, G_TYPE_INT, FALSE}, + {"margin_right", NULL, G_TYPE_INT, FALSE}, + {"margin_top", NULL, G_TYPE_INT, FALSE}, + {"maximized_offset", NULL, G_TYPE_INT, TRUE}, + {"move_opacity", NULL, G_TYPE_INT, TRUE}, + {"placement_ratio", NULL, G_TYPE_INT, TRUE}, + {"placement_mode", NULL, G_TYPE_STRING, TRUE}, + {"popup_opacity", NULL, G_TYPE_INT, TRUE}, + {"prevent_focus_stealing", NULL, G_TYPE_BOOLEAN, TRUE}, + {"raise_delay", NULL, G_TYPE_INT, TRUE}, + {"raise_on_click", NULL, G_TYPE_BOOLEAN, TRUE}, + {"raise_on_focus", NULL, G_TYPE_BOOLEAN, TRUE}, + {"raise_with_any_button", NULL, G_TYPE_BOOLEAN, TRUE}, + {"resize_opacity", NULL, G_TYPE_INT, TRUE}, + {"restore_on_move", NULL, G_TYPE_BOOLEAN, TRUE}, + {"scroll_workspaces", NULL, G_TYPE_BOOLEAN, TRUE}, + {"shadow_delta_height", NULL, G_TYPE_INT, TRUE}, + {"shadow_delta_width", NULL, G_TYPE_INT, TRUE}, + {"shadow_delta_x", NULL, G_TYPE_INT, TRUE}, + {"shadow_delta_y", NULL, G_TYPE_INT, TRUE}, + {"show_app_icon", NULL, G_TYPE_BOOLEAN, TRUE}, + {"show_dock_shadow", NULL, G_TYPE_BOOLEAN, TRUE}, + {"show_frame_shadow", NULL, G_TYPE_BOOLEAN, TRUE}, + {"show_popup_shadow", NULL, G_TYPE_BOOLEAN, TRUE}, + {"snap_resist", NULL, G_TYPE_BOOLEAN, TRUE}, + {"snap_to_border", NULL, G_TYPE_BOOLEAN, TRUE}, + {"snap_to_windows", NULL, G_TYPE_BOOLEAN, TRUE}, + {"snap_width", NULL, G_TYPE_INT, TRUE}, + {"theme", NULL, G_TYPE_STRING, TRUE}, + {"title_alignment", NULL, G_TYPE_STRING, TRUE}, + {"title_font", NULL, G_TYPE_STRING, FALSE}, + {"title_horizontal_offset", NULL, G_TYPE_INT, TRUE}, + {"title_shadow_active", NULL, G_TYPE_STRING, TRUE}, + {"title_shadow_inactive", NULL, G_TYPE_STRING, TRUE}, + {"title_vertical_offset_active", NULL, G_TYPE_INT, TRUE}, + {"title_vertical_offset_inactive", NULL, G_TYPE_INT, TRUE}, + {"toggle_workspaces", NULL, G_TYPE_BOOLEAN, TRUE}, + {"unredirect_overlays", NULL, G_TYPE_BOOLEAN, TRUE}, + {"use_compositing", NULL, G_TYPE_BOOLEAN, TRUE}, + {"workspace_count", NULL, G_TYPE_INT, TRUE}, + {"wrap_cycle", NULL, G_TYPE_BOOLEAN, TRUE}, + {"wrap_layout", NULL, G_TYPE_BOOLEAN, TRUE}, + {"wrap_resistance", NULL, G_TYPE_INT, TRUE}, + {"wrap_windows", NULL, G_TYPE_BOOLEAN, TRUE}, + {"wrap_workspaces", NULL, G_TYPE_BOOLEAN, TRUE}, /* Keys */ - {"above_key", NULL, TRUE}, - {"add_adjacent_workspace_key", NULL, TRUE}, - {"add_workspace_key", NULL, TRUE}, - {"cancel_key", NULL, TRUE}, - {"close_window_key", NULL, TRUE}, - {"cycle_windows_key", NULL, TRUE}, - {"del_active_workspace_key", NULL, TRUE}, - {"del_workspace_key", NULL, TRUE}, - {"down_key", NULL, TRUE}, - {"down_workspace_key", NULL, TRUE}, - {"fill_horiz_key", NULL, TRUE}, - {"fill_vert_key", NULL, TRUE}, - {"fill_window_key", NULL, TRUE}, - {"fullscreen_key", NULL, TRUE}, - {"hide_window_key", NULL, TRUE}, - {"left_key", NULL, TRUE}, - {"left_workspace_key", NULL, TRUE}, - {"lower_window_key", NULL, TRUE}, - {"maximize_horiz_key", NULL, TRUE}, - {"maximize_vert_key", NULL, TRUE}, - {"maximize_window_key", NULL, TRUE}, - {"move_window_down_workspace_key", NULL, TRUE}, - {"move_window_left_workspace_key", NULL, TRUE}, - {"move_window_next_workspace_key", NULL, TRUE}, - {"move_window_key", NULL, TRUE}, - {"move_window_prev_workspace_key", NULL, TRUE}, - {"move_window_right_workspace_key", NULL, TRUE}, - {"move_window_up_workspace_key", NULL, TRUE}, - {"move_window_workspace_1_key", NULL, TRUE}, - {"move_window_workspace_2_key", NULL, TRUE}, - {"move_window_workspace_3_key", NULL, TRUE}, - {"move_window_workspace_4_key", NULL, TRUE}, - {"move_window_workspace_5_key", NULL, TRUE}, - {"move_window_workspace_6_key", NULL, TRUE}, - {"move_window_workspace_7_key", NULL, TRUE}, - {"move_window_workspace_8_key", NULL, TRUE}, - {"move_window_workspace_9_key", NULL, TRUE}, - {"move_window_workspace_10_key", NULL, TRUE}, - {"move_window_workspace_11_key", NULL, TRUE}, - {"move_window_workspace_12_key", NULL, TRUE}, - {"next_workspace_key", NULL, TRUE}, - {"popup_menu_key", NULL, TRUE}, - {"prev_workspace_key", NULL, TRUE}, - {"raise_window_key", NULL, TRUE}, - {"resize_window_key", NULL, TRUE}, - {"right_key", NULL, TRUE}, - {"right_workspace_key", NULL, TRUE}, - {"shade_window_key", NULL, TRUE}, - {"show_desktop_key", NULL, FALSE}, - {"stick_window_key", NULL, TRUE}, - {"up_key", NULL, TRUE}, - {"up_workspace_key", NULL, TRUE}, - {"workspace_1_key", NULL, TRUE}, - {"workspace_2_key", NULL, TRUE}, - {"workspace_3_key", NULL, TRUE}, - {"workspace_4_key", NULL, TRUE}, - {"workspace_5_key", NULL, TRUE}, - {"workspace_6_key", NULL, TRUE}, - {"workspace_7_key", NULL, TRUE}, - {"workspace_8_key", NULL, TRUE}, - {"workspace_9_key", NULL, TRUE}, - {"workspace_10_key", NULL, TRUE}, - {"workspace_11_key", NULL, TRUE}, - {"workspace_12_key", NULL, TRUE}, - {NULL, NULL, FALSE} + {"above_key", NULL, G_TYPE_STRING, TRUE}, + {"add_adjacent_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"add_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"cancel_key", NULL, G_TYPE_STRING, TRUE}, + {"close_window_key", NULL, G_TYPE_STRING, TRUE}, + {"cycle_windows_key", NULL, G_TYPE_STRING, TRUE}, + {"del_active_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"del_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"down_key", NULL, G_TYPE_STRING, TRUE}, + {"down_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"fill_horiz_key", NULL, G_TYPE_STRING, TRUE}, + {"fill_vert_key", NULL, G_TYPE_STRING, TRUE}, + {"fill_window_key", NULL, G_TYPE_STRING, TRUE}, + {"fullscreen_key", NULL, G_TYPE_STRING, TRUE}, + {"hide_window_key", NULL, G_TYPE_STRING, TRUE}, + {"left_key", NULL, G_TYPE_STRING, TRUE}, + {"left_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"lower_window_key", NULL, G_TYPE_STRING, TRUE}, + {"maximize_horiz_key", NULL, G_TYPE_STRING, TRUE}, + {"maximize_vert_key", NULL, G_TYPE_STRING, TRUE}, + {"maximize_window_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_down_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_left_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_next_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_prev_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_right_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_up_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_1_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_2_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_3_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_4_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_5_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_6_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_7_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_8_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_9_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_10_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_11_key", NULL, G_TYPE_STRING, TRUE}, + {"move_window_workspace_12_key", NULL, G_TYPE_STRING, TRUE}, + {"next_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"popup_menu_key", NULL, G_TYPE_STRING, TRUE}, + {"prev_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"raise_window_key", NULL, G_TYPE_STRING, TRUE}, + {"resize_window_key", NULL, G_TYPE_STRING, TRUE}, + {"right_key", NULL, G_TYPE_STRING, TRUE}, + {"right_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"shade_window_key", NULL, G_TYPE_STRING, TRUE}, + {"show_desktop_key", NULL, G_TYPE_STRING, FALSE}, + {"stick_window_key", NULL, G_TYPE_STRING, TRUE}, + {"up_key", NULL, G_TYPE_STRING, TRUE}, + {"up_workspace_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_1_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_2_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_3_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_4_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_5_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_6_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_7_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_8_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_9_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_10_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_11_key", NULL, G_TYPE_STRING, TRUE}, + {"workspace_12_key", NULL, G_TYPE_STRING, TRUE}, + {NULL, NULL, G_TYPE_INVALID, FALSE} }; TRACE ("entering loadSettings"); loadRcData (screen_info, rc); - loadMcsData (screen_info, rc); + loadRcData (screen_info, rc); + loadXfconfData (screen_info, rc); loadTheme (screen_info, rc); update_grabs (screen_info); @@ -1494,80 +806,80 @@ } screen_info->params->borderless_maximize = - !g_ascii_strcasecmp ("true", getValue ("borderless_maximize", rc)); + getBoolValue ("borderless_maximize", rc); screen_info->params->box_resize = - !g_ascii_strcasecmp ("true", getValue ("box_resize", rc)); + getBoolValue ("box_resize", rc); screen_info->params->box_move = - !g_ascii_strcasecmp ("true", getValue ("box_move", rc)); + getBoolValue ("box_move", rc); screen_info->params->click_to_focus = - !g_ascii_strcasecmp ("true", getValue ("click_to_focus", rc)); + getBoolValue ("click_to_focus", rc); screen_info->params->cycle_minimum = - !g_ascii_strcasecmp ("true", getValue ("cycle_minimum", rc)); + getBoolValue ("cycle_minimum", rc); screen_info->params->cycle_hidden = - !g_ascii_strcasecmp ("true", getValue ("cycle_hidden", rc)); + getBoolValue ("cycle_hidden", rc); screen_info->params->cycle_workspaces = - !g_ascii_strcasecmp ("true", getValue ("cycle_workspaces", rc)); + getBoolValue ("cycle_workspaces", rc); screen_info->params->focus_hint = - !g_ascii_strcasecmp ("true", getValue ("focus_hint", rc)); + getBoolValue ("focus_hint", rc); screen_info->params->focus_new = - !g_ascii_strcasecmp ("true", getValue ("focus_new", rc)); + getBoolValue ("focus_new", rc); screen_info->params->raise_on_focus = - !g_ascii_strcasecmp ("true", getValue ("raise_on_focus", rc)); + getBoolValue ("raise_on_focus", rc); screen_info->params->prevent_focus_stealing = - !g_ascii_strcasecmp ("true", getValue ("prevent_focus_stealing", rc)); + getBoolValue ("prevent_focus_stealing", rc); screen_info->params->raise_delay = - abs (TOINT (getValue ("raise_delay", rc))); + getIntValue ("raise_delay", rc); screen_info->params->focus_delay = - abs (TOINT (getValue ("focus_delay", rc))); + getIntValue ("focus_delay", rc); screen_info->params->raise_on_click = - !g_ascii_strcasecmp ("true", getValue ("raise_on_click", rc)); + getBoolValue ("raise_on_click", rc); screen_info->params->raise_with_any_button = - !g_ascii_strcasecmp ("true", getValue ("raise_with_any_button", rc)); + getBoolValue ("raise_with_any_button", rc); screen_info->params->restore_on_move = - !g_ascii_strcasecmp ("true", getValue ("restore_on_move", rc)); + getBoolValue ("restore_on_move", rc); screen_info->params->frame_opacity = - abs (TOINT (getValue ("frame_opacity", rc))); + getIntValue ("frame_opacity", rc); screen_info->params->inactive_opacity = - abs (TOINT (getValue ("inactive_opacity", rc))); + getIntValue ("inactive_opacity", rc); screen_info->params->move_opacity = - abs (TOINT (getValue ("move_opacity", rc))); + getIntValue ("move_opacity", rc); screen_info->params->resize_opacity = - abs (TOINT (getValue ("resize_opacity", rc))); + getIntValue ("resize_opacity", rc); screen_info->params->popup_opacity = - abs (TOINT (getValue ("popup_opacity", rc))); + getIntValue ("popup_opacity", rc); screen_info->params->placement_ratio = - abs (TOINT (getValue ("placement_ratio", rc))); + getIntValue ("placement_ratio", rc); screen_info->params->show_app_icon = - !g_ascii_strcasecmp ("true", getValue ("show_app_icon", rc)); + getBoolValue ("show_app_icon", rc); screen_info->params->show_dock_shadow = - !g_ascii_strcasecmp ("true", getValue ("show_dock_shadow", rc)); + getBoolValue ("show_dock_shadow", rc); screen_info->params->show_frame_shadow = - !g_ascii_strcasecmp ("true", getValue ("show_frame_shadow", rc)); + getBoolValue ("show_frame_shadow", rc); screen_info->params->show_popup_shadow = - !g_ascii_strcasecmp ("true", getValue ("show_popup_shadow", rc)); + getBoolValue ("show_popup_shadow", rc); screen_info->params->snap_to_border = - !g_ascii_strcasecmp ("true", getValue ("snap_to_border", rc)); + getBoolValue ("snap_to_border", rc); screen_info->params->snap_to_windows = - !g_ascii_strcasecmp ("true", getValue ("snap_to_windows", rc)); + getBoolValue ("snap_to_windows", rc); screen_info->params->snap_resist = - !g_ascii_strcasecmp ("true", getValue ("snap_resist", rc)); + getBoolValue ("snap_resist", rc); screen_info->params->snap_width = - abs (TOINT (getValue ("snap_width", rc))); + getIntValue ("snap_width", rc); - set_settings_margin (screen_info, STRUTS_LEFT, TOINT (getValue ("margin_left", rc))); - set_settings_margin (screen_info, STRUTS_RIGHT, TOINT (getValue ("margin_right", rc))); - set_settings_margin (screen_info, STRUTS_BOTTOM, TOINT (getValue ("margin_bottom", rc))); - set_settings_margin (screen_info, STRUTS_TOP, TOINT (getValue ("margin_top", rc))); + set_settings_margin (screen_info, STRUTS_LEFT, getIntValue ("margin_left", rc)); + set_settings_margin (screen_info, STRUTS_RIGHT, getIntValue ("margin_right", rc)); + set_settings_margin (screen_info, STRUTS_BOTTOM, getIntValue ("margin_bottom", rc)); + set_settings_margin (screen_info, STRUTS_TOP, getIntValue ("margin_top", rc)); - set_easy_click (screen_info, getValue ("easy_click", rc)); + set_easy_click (screen_info, getStringValue ("easy_click", rc)); - value = getValue ("placement_mode", rc); + value = getStringValue ("placement_mode", rc); set_placement_mode (screen_info, value); - value = getValue ("activate_action", rc); + value = getStringValue ("activate_action", rc); set_activate_action (screen_info, value); - value = getValue ("double_click_action", rc); + value = getStringValue ("double_click_action", rc); if (!g_ascii_strcasecmp ("shade", value)) { screen_info->params->double_click_action = DBL_CLICK_ACTION_SHADE; @@ -1592,7 +904,7 @@ if (screen_info->workspace_count < 0) { gint workspace_count; - workspace_count = abs (TOINT (getValue ("workspace_count", rc))); + workspace_count = getIntValue ("workspace_count", rc); if (workspace_count < 0) { workspace_count = 0; @@ -1601,23 +913,23 @@ } screen_info->params->toggle_workspaces = - !g_ascii_strcasecmp ("true", getValue ("toggle_workspaces", rc)); + getBoolValue ("toggle_workspaces", rc); screen_info->params->unredirect_overlays = - !g_ascii_strcasecmp ("true", getValue ("unredirect_overlays", rc)); + getBoolValue ("unredirect_overlays", rc); screen_info->params->use_compositing = - !g_ascii_strcasecmp ("true", getValue ("use_compositing", rc)); + getBoolValue ("use_compositing", rc); screen_info->params->wrap_workspaces = - !g_ascii_strcasecmp ("true", getValue ("wrap_workspaces", rc)); + getBoolValue ("wrap_workspaces", rc); screen_info->params->wrap_layout = - !g_ascii_strcasecmp ("true", getValue ("wrap_layout", rc)); + getBoolValue ("wrap_layout", rc); screen_info->params->wrap_windows = - !g_ascii_strcasecmp ("true", getValue ("wrap_windows", rc)); + getBoolValue ("wrap_windows", rc); screen_info->params->wrap_cycle = - !g_ascii_strcasecmp ("true", getValue ("wrap_cycle", rc)); + getBoolValue ("wrap_cycle", rc); screen_info->params->scroll_workspaces = - !g_ascii_strcasecmp ("true", getValue ("scroll_workspaces", rc)); + getBoolValue ("scroll_workspaces", rc); screen_info->params->wrap_resistance = - abs (TOINT (getValue ("wrap_resistance", rc))); + getIntValue ("wrap_resistance", rc); freeRc (rc); return TRUE; @@ -1727,33 +1039,24 @@ TRACE ("entering initSettings"); + if (!xfconf_init (NULL)) + { + g_critical ("Xfconf could not be initialized"); + return FALSE; + } + + display_info = screen_info->display_info; names = NULL; val = 0; i = 0; - if (!mcs_client_check_manager (myScreenGetXDisplay (screen_info), screen_info->screen, "xfce-mcs-manager")) - { - g_warning ("MCS manager not running, startup delayed for 5 seconds"); - sleep (5); - } + screen_info->xfwm4_channel = xfconf_channel_new(CHANNEL1); + screen_info->keys_channel = xfconf_channel_new(CHANNEL2); - screen_info->mcs_client = mcs_client_new (myScreenGetXDisplay (screen_info), screen_info->screen, notify_cb, watch_cb, (gpointer) screen_info); - if (screen_info->mcs_client) - { - mcs_client_add_channel (screen_info->mcs_client, CHANNEL1); - mcs_client_add_channel (screen_info->mcs_client, CHANNEL2); - mcs_client_add_channel (screen_info->mcs_client, CHANNEL3); - mcs_client_add_channel (screen_info->mcs_client, CHANNEL4); - mcs_client_add_channel (screen_info->mcs_client, CHANNEL5); - mcs_client_set_raw_channel (screen_info->mcs_client, CHANNEL4, TRUE); - } - else - { - g_warning ("Cannot create MCS client channel"); - } - screen_info->mcs_initted = TRUE; + g_signal_connect (G_OBJECT(screen_info->xfwm4_channel), "property-changed", (GCallback)cb_xfwm4_channel_property_changed, screen_info); + if (!loadSettings (screen_info)) { return FALSE; @@ -1788,10 +1091,260 @@ { g_return_if_fail (screen_info); - if (screen_info->mcs_client) + unloadSettings (screen_info); +} + +static void +cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_name, const GValue *value, ScreenInfo *screen_info) +{ + if (g_str_has_prefix(property_name, "/general/") == TRUE) { - mcs_client_destroy (screen_info->mcs_client); - screen_info->mcs_client = NULL; + const gchar *name = &property_name[9]; + switch (G_VALUE_TYPE(value)) + { + case G_TYPE_STRING: + if (!strcmp (name, "double_click_action")) + { + reloadScreenSettings (screen_info, NO_UPDATE_FLAG); + } + else if (!strcmp (name, "theme")) + { + reloadScreenSettings(screen_info, UPDATE_MAXIMIZE | UPDATE_GRAVITY | UPDATE_CACHE); + } + else if (!strcmp (name, "button_layout")) + { + reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE); + } + else if (!strcmp (name, "title_alignment")) + { + reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE); + } + else if (!strcmp (name, "title_font")) + { + reloadScreenSettings (screen_info, UPDATE_FRAME | UPDATE_CACHE); + } + else if (!strcmp (name, "keytheme")) + { + reloadScreenSettings (screen_info, NO_UPDATE_FLAG); + } + else if (!strcmp (name, "easy_click")) + { + reloadScreenSettings (screen_info, UPDATE_BUTTON_GRABS); + } + else if (!strcmp (name, "activate_action")) + { + set_activate_action (screen_info, g_value_get_string (value)); + } + else if (!strcmp (name, "placement_mode")) + { + set_placement_mode (screen_info, g_value_get_string (value)); + } + else + { + g_warning("The property '%s' is not supported", property_name); + } + break; + case G_TYPE_INT: + if (!strcmp (name, "raise_delay")) + { + screen_info->params->raise_delay = g_value_get_int (value); + } + else if (!strcmp (name, "focus_delay")) + { + screen_info->params->focus_delay = g_value_get_int (value); + } + else if (!strcmp (name, "snap_width")) + { + screen_info->params->snap_width = g_value_get_int (value); + } + else if (!strcmp (name, "wrap_resistance")) + { + screen_info->params->wrap_resistance = g_value_get_int (value); + } + else if (!strcmp (name, "margin_left")) + { + set_settings_margin (screen_info, STRUTS_LEFT, g_value_get_int (value)); + } + else if (!strcmp (name, "margin_right")) + { + set_settings_margin (screen_info, STRUTS_RIGHT, g_value_get_int (value)); + } + else if (!strcmp (name, "margin_bottom")) + { + set_settings_margin (screen_info, STRUTS_BOTTOM, g_value_get_int (value)); + } + else if (!strcmp (name, "margin_top")) + { + set_settings_margin (screen_info, STRUTS_TOP, g_value_get_int (value)); + } + else if (!strcmp (name, "workspace_count")) + { + workspaceSetCount(screen_info, g_value_get_int (value)); + } + else if (!strcmp (name, "frame_opacity")) + { + screen_info->params->frame_opacity = g_value_get_int(value); + reloadScreenSettings (screen_info, UPDATE_FRAME); + } + else if (!strcmp (name, "inactive_opacity")) + { + screen_info->params->inactive_opacity = g_value_get_int(value); + reloadScreenSettings (screen_info, UPDATE_FRAME); + clientUpdateAllOpacity (screen_info); + } + else if (!strcmp (name, "move_opacity")) + { + screen_info->params->move_opacity = g_value_get_int (value); + } + else if (!strcmp (name, "resize_opacity")) + { + screen_info->params->resize_opacity = g_value_get_int (value); + } + else if (!strcmp (name, "popup_opacity")) + { + screen_info->params->popup_opacity = g_value_get_int (value); + reloadScreenSettings (screen_info, UPDATE_FRAME); + } + else if (!strcmp (name, "placement_ratio")) + { + screen_info->params->placement_ratio = g_value_get_int (value); + } + else + { + g_warning("The property '%s' is not supported", property_name); + } + break; + case G_TYPE_BOOLEAN: + if (!strcmp (name, "box_move")) + { + screen_info->params->box_move = g_value_get_boolean (value); + + } + else if (!strcmp (name, "box_resize")) + { + screen_info->params->box_resize = g_value_get_boolean (value); + } + else if (!strcmp (name, "click_to_focus")) + { + screen_info->params->click_to_focus = g_value_get_boolean (value); + update_grabs (screen_info); + } + else if (!strcmp (name, "focus_new")) + { + screen_info->params->focus_new = g_value_get_boolean (value); + } + else if (!strcmp (name, "raise_on_focus")) + { + screen_info->params->raise_on_focus = g_value_get_boolean (value); + } + else if (!strcmp (name, "raise_on_click")) + { + screen_info->params->raise_on_click = g_value_get_boolean (value); + update_grabs (screen_info); + } + else if (!strcmp (name, "snap_to_border")) + { + screen_info->params->snap_to_border = g_value_get_boolean (value); + } + else if (!strcmp (name, "snap_to_windows")) + { + screen_info->params->snap_to_windows = g_value_get_boolean (value); + } + else if (!strcmp (name, "wrap_workspaces")) + { + screen_info->params->wrap_workspaces = g_value_get_boolean (value); + } + else if (!strcmp (name, "wrap_windows")) + { + screen_info->params->wrap_windows = g_value_get_boolean (value); + } + else if (!strcmp (name, "borderless_maximize")) + { + screen_info->params->borderless_maximize = g_value_get_boolean (value); + reloadScreenSettings (screen_info, UPDATE_MAXIMIZE); + } + else if (!strcmp (name, "cycle_minimum")) + { + screen_info->params->cycle_minimum = g_value_get_boolean (value); + } + else if (!strcmp (name, "cycle_hidden")) + { + screen_info->params->cycle_hidden = g_value_get_boolean (value); + } + else if (!strcmp (name, "cycle_workspaces")) + { + screen_info->params->cycle_workspaces = g_value_get_boolean (value); + } + else if (!strcmp (name, "focus_hint")) + { + screen_info->params->focus_hint = g_value_get_boolean (value); + } + else if (!strcmp (name, "show_dock_shadow")) + { + screen_info->params->show_dock_shadow = g_value_get_boolean (value); + reloadScreenSettings (screen_info, UPDATE_FRAME); + } + else if (!strcmp (name, "show_frame_shadow")) + { + screen_info->params->show_frame_shadow = g_value_get_boolean (value); + reloadScreenSettings (screen_info, UPDATE_FRAME); + } + else if (!strcmp (name, "show_popup_shadow")) + { + screen_info->params->show_popup_shadow = g_value_get_boolean (value); + reloadScreenSettings (screen_info, UPDATE_FRAME); + } + else if (!strcmp (name, "snap_resist")) + { + screen_info->params->snap_resist = g_value_get_boolean (value); + } + else if (!strcmp (name, "prevent_focus_stealing")) + { + screen_info->params->prevent_focus_stealing = g_value_get_boolean (value); + } + else if (!strcmp (name, "raise_with_any_button")) + { + screen_info->params->raise_with_any_button = g_value_get_boolean (value); + update_grabs (screen_info); + } + else if (!strcmp (name, "restore_on_move")) + { + screen_info->params->restore_on_move = g_value_get_boolean (value); + } + else if (!strcmp (name, "scroll_workspaces")) + { + screen_info->params->scroll_workspaces = g_value_get_boolean (value); + } + else if (!strcmp (name, "toggle_workspaces")) + { + screen_info->params->toggle_workspaces = g_value_get_boolean (value); + } + else if (!strcmp (name, "unredirect_overlays")) + { + screen_info->params->unredirect_overlays = g_value_get_boolean (value); + } + else if (!strcmp (name, "use_compositing")) + { + screen_info->params->use_compositing = g_value_get_boolean (value); + compositorActivateScreen (screen_info, + screen_info->params->use_compositing); + } + else if (!strcmp (name, "wrap_layout")) + { + screen_info->params->wrap_layout = g_value_get_boolean (value); + } + else if (!strcmp (name, "wrap_cycle")) + { + screen_info->params->wrap_cycle = g_value_get_boolean (value); + } + else + { + g_warning("The property '%s' is not supported", property_name); + } + break; + default: + g_warning("The type of property '%s' is not supported", property_name); + break; + } } - unloadSettings (screen_info); } Index: src/settings.h =================================================================== --- src/settings.h (revision 27208) +++ src/settings.h (working copy) @@ -152,8 +152,9 @@ struct _Settings { - gchar *option; - gchar *value; + gchar *option; + GValue *value; + GType type; gboolean required; }; Index: src/screen.c =================================================================== --- src/screen.c (revision 27208) +++ src/screen.c (working copy) @@ -210,9 +210,6 @@ screen_info->workspace_names = NULL; screen_info->workspace_names_items = 0; - screen_info->mcs_client = NULL; - screen_info->mcs_initted = FALSE; - screen_info->windows_stack = NULL; screen_info->last_raise = NULL; screen_info->windows = NULL; Index: src/screen.h =================================================================== --- src/screen.h (revision 27208) +++ src/screen.h (working copy) @@ -29,7 +29,7 @@ #include #include #include -#include +#include #ifdef HAVE_LIBSTARTUP_NOTIFICATION #define SN_API_NOT_YET_FROZEN @@ -116,8 +116,8 @@ gulong button_handler_id; /* MCS stuff */ - McsClient *mcs_client; - gboolean mcs_initted; + XfconfChannel *xfwm4_channel; + XfconfChannel *keys_channel; /* Per screen parameters */ XfwmParams *params; Index: src/main.c =================================================================== --- src/main.c (revision 27208) +++ src/main.c (working copy) @@ -114,6 +114,7 @@ myDisplayClose (display_info); g_free (display_info); display_info = NULL; + xfconf_shutdown(); } static void Index: src/Makefile.am =================================================================== --- src/Makefile.am (revision 27208) +++ src/Makefile.am (working copy) @@ -72,7 +72,7 @@ xfwm4_CFLAGS = \ $(LIBX11_CFLAGS) \ - $(LIBXFCE4MCS_CLIENT_CFLAGS) \ + $(LIBXFCONF_CFLAGS) \ $(LIBXFCEGUI4_CFLAGS) \ $(RENDER_CFLAGS) \ $(LIBSTARTUP_NOTIFICATION_CFLAGS) \ @@ -85,7 +85,7 @@ xfwm4_LDADD = \ $(LIBX11_LIBS) \ $(LIBX11_LDFLAGS) \ - $(LIBXFCE4MCS_CLIENT_LIBS) \ + $(LIBXFCONF_LIBS) \ $(LIBXFCEGUI4_LIBS) \ $(LIBSTARTUP_NOTIFICATION_LIBS) \ $(RENDER_LIBS) \ Index: configure.ac.in =================================================================== --- configure.ac.in (revision 27208) +++ configure.ac.in (working copy) @@ -62,12 +62,11 @@ ], [], [$LIBX11_CFLAGS $LIBX11_LDFLAGS $LIBX11_LIBS]) XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [gtk_minimum_version]) -XDT_CHECK_PACKAGE([LIBXFCE4MCS_CLIENT], [libxfce4mcs-client-1.0], [xfce_minimum_version]) -XDT_CHECK_PACKAGE([LIBXFCE4MCS_MANAGER], [libxfce4mcs-manager-1.0], [xfce_minimum_version]) +XDT_CHECK_PACKAGE([GLADE], [libglade-2.0], [2.0.0]) XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [xfce_minimum_version]) -XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [xfce_minimum_version]) +XDT_CHECK_PACKAGE([LIBXFCEGUI4], libxfcegui4-1.0, [xfce_minimum_version]) +XDT_CHECK_PACKAGE([LIBXFCONF], libxfconf-0, [0.0.0]) XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [wnck_minimum_version]) -XFCE_MCS_PLUGIN([XFCE_MCS_MANAGER], [xfce_minimum_version]) dnl dnl Startup notification support @@ -210,8 +209,8 @@ icons/Makefile icons/48x48/Makefile icons/scalable/Makefile -mcs-plugin/Makefile po/Makefile.in +settings-dialogs/Makefile src/Makefile themes/Makefile themes/daloa/Makefile Index: Makefile.am =================================================================== --- Makefile.am (revision 27208) +++ Makefile.am (working copy) @@ -14,7 +14,7 @@ intltool-update \ xfwm4.spec -SUBDIRS = po doc icons src mcs-plugin defaults themes +SUBDIRS = po doc icons src defaults themes settings-dialogs distclean-local: rm -rf *.cache