adapt to gnome-wm-manager API changes
2002-10-26 Havoc Pennington <hp@pobox.com> * theme-switcher.c (window_read_themes): adapt to gnome-wm-manager API changes 2002-10-26 Havoc Pennington <hp@pobox.com> * gnome-window-manager.c: handle NULL fields in the class struct; and replace the individual setters with get/set for a big struct with flags indicating which fields we care about, a la a graphics context. Add settings_changed signal. (gnome_window_manager_get_type): change object name to GnomeWindowManager not GWindowManager * gnome-window-manager.h (struct _GnomeWindowManagerClass): add padding to the class struct * Makefile.am: move metacity module here from capplets/windows/ (libgnome_window_settings_la_SOURCES): don't build the code to switch window managers, it was bitrotted and broken anyway, and isn't in the UI right now. Keep the code in EXTRA_DIST in case someone wants to recover it. Move some relevant bits to gnome-wm-manager.c 2002-10-26 Havoc Pennington <hp@pobox.com> * gnome-window-properties.c: rewrite * Makefile.am (bin_PROGRAMS): remove metacity module, move to libwindow-settings (gnome_window_properties_LDADD): properly link to .la file for libgnome-window-settings, not the installed copy
This commit is contained in:
parent
69fcadbe29
commit
692b9dde4f
20 changed files with 1892 additions and 1489 deletions
|
@ -1,3 +1,12 @@
|
|||
2002-10-26 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gnome-window-properties.c: rewrite
|
||||
|
||||
* Makefile.am (bin_PROGRAMS): remove metacity module, move to
|
||||
libwindow-settings
|
||||
(gnome_window_properties_LDADD): properly link to .la file for
|
||||
libgnome-window-settings, not the installed copy
|
||||
|
||||
2002-10-21 Seth Nickell <snickell@stanford.edu>
|
||||
|
||||
* gnome-window-properties.c: (setup_appearance_option_menu):
|
||||
|
|
|
@ -1,34 +1,18 @@
|
|||
bin_PROGRAMS = gnome-window-properties
|
||||
|
||||
gnome_window_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) \
|
||||
-L$(top_builddir)/libwindow-settings/ -lgnome-window-settings
|
||||
$(top_builddir)/libwindow-settings/libgnome-window-settings.la
|
||||
|
||||
gnome_window_properties_SOURCES = \
|
||||
gnome-window-properties.c
|
||||
|
||||
|
||||
wms_flags = -export_dynamic -avoid-version
|
||||
wmsdir = $(libdir)/window-manager-settings/
|
||||
|
||||
wms_LTLIBRARIES = \
|
||||
libmetacity.la
|
||||
|
||||
libmetacity_la_SOURCES = \
|
||||
metacity-window-manager.c \
|
||||
metacity-window-manager.h
|
||||
|
||||
|
||||
libmetacity_la_LDFLAGS = $(wms_flags)
|
||||
#libmetacity_la_LIBADD = $(top_builddir)/libwindow-settings/libwindow-settings.la
|
||||
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
|
||||
pixmap_DATA =
|
||||
|
||||
Gladedir = $(GNOMECC_GLADE_DIR)
|
||||
Glade_DATA = gnome-window-properties.glade
|
||||
gladedir = $(GNOMECC_GLADE_DIR)
|
||||
glade_DATA = gnome-window-properties.glade
|
||||
|
||||
iconsdir = $(GNOMECC_ICONS_DIR)
|
||||
icons_DATA = window-capplet.png
|
||||
|
@ -43,7 +27,9 @@ desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
|
|||
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
-I $(top_srcdir)/libwindow-settings \
|
||||
-DGNOME_WINDOW_MANAGER_MODULE_PATH=\""$(libdir)/window-manager-settings"\" \
|
||||
-DMETACITY_THEME_DIR=\""$(datadir)/metacity/themes"\"
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
|
||||
EXTRA_DIST = $(Glade_DATA) $(icons_DATA) $(Desktop_in_files) $(pixmap_DATA)
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DPIXMAPDIR=\""$(pixmapdir)"\"
|
||||
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
|
||||
EXTRA_DIST = $(glade_DATA) $(icons_DATA) $(Desktop_in_files) $(pixmap_DATA)
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
/* gnome-window-properties.c
|
||||
* Copyright (C) 2002 Seth Nickell
|
||||
* Copyright (C) 2002 Red Hat, Inc.
|
||||
*
|
||||
* Written by: Seth Nickell <snickell@stanford.edu>
|
||||
* Havoc Pennington <hp@redhat.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -22,11 +24,9 @@
|
|||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <glade/glade.h>
|
||||
#include <gnome-wm-manager.h>
|
||||
|
@ -34,273 +34,595 @@
|
|||
#include "capplet-util.h"
|
||||
#include "gconf-property-editor.h"
|
||||
|
||||
|
||||
#define THEME_KEY "/desktop/gnome/applications/window_manager/theme"
|
||||
#define TITLEBAR_FONT_KEY "/desktop/gnome/applications/window_manager/titlebar_font"
|
||||
#define FOCUS_FOLLOWS_MOUSE_KEY "/desktop/gnome/applications/window_manager/focus_follows_mouse"
|
||||
|
||||
static GtkWidget *wm_widget;
|
||||
static GtkWidget *apply_now_button;
|
||||
static GtkWidget *properties_box;
|
||||
static GtkWidget *wm_menu;
|
||||
static GtkWidget *option_menu;
|
||||
static GList *wm_menu_window_managers;
|
||||
|
||||
static GtkWidget *appearance_option_menu;
|
||||
static GList *theme_list;
|
||||
|
||||
static GnomeWindowManager *selected_wm;
|
||||
|
||||
static gboolean in_fill;
|
||||
typedef struct
|
||||
{
|
||||
int number;
|
||||
char *name;
|
||||
const char *value; /* machine-readable name for storing config */
|
||||
} MouseClickModifier;
|
||||
|
||||
static GConfClient *gconf_client;
|
||||
static GladeXML *dialog;
|
||||
static GnomeWindowManager *current_wm; /* may be NULL */
|
||||
static GtkWidget *dialog_win;
|
||||
static GtkWidget *focus_mode_checkbutton;
|
||||
static GtkWidget *autoraise_checkbutton;
|
||||
static GtkWidget *autoraise_delay_spinbutton;
|
||||
static GtkWidget *autoraise_delay_hbox;
|
||||
static GtkWidget *double_click_titlebar_optionmenu;
|
||||
static GtkWidget *double_click_titlebar_hbox;
|
||||
static GtkWidget *alt_click_optionmenu;
|
||||
|
||||
static void setup_appearance_option_menu (GtkWidget *appearance_option_menu, GnomeWindowManager *wm);
|
||||
static GnomeWMSettings settings;
|
||||
static const GnomeWMDoubleClickAction *double_click_actions = NULL;
|
||||
static int n_double_click_actions = 0;
|
||||
|
||||
static MouseClickModifier *mouse_modifiers = NULL;
|
||||
static int n_mouse_modifiers = 0;
|
||||
|
||||
static void reload_mouse_modifiers (void);
|
||||
|
||||
static void
|
||||
set_wm_change_pending (gboolean pending)
|
||||
mouse_focus_toggled_callback (GtkWidget *button,
|
||||
void *data)
|
||||
{
|
||||
gtk_widget_set_sensitive (apply_now_button, pending);
|
||||
gtk_widget_set_sensitive (properties_box, !pending);
|
||||
GnomeWMSettings new_settings;
|
||||
|
||||
new_settings.flags = GNOME_WM_SETTING_MOUSE_FOCUS;
|
||||
new_settings.focus_follows_mouse =
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
if (current_wm != NULL && new_settings.focus_follows_mouse != settings.focus_follows_mouse)
|
||||
gnome_window_manager_change_settings (current_wm, &new_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
wm_selection_changed (GtkOptionMenu *option_menu, gpointer data)
|
||||
autoraise_toggled_callback (GtkWidget *button,
|
||||
void *data)
|
||||
{
|
||||
int index;
|
||||
GnomeWindowManager *wm;
|
||||
GnomeWMSettings new_settings;
|
||||
|
||||
index = gtk_option_menu_get_history (option_menu);
|
||||
wm = (GnomeWindowManager *) g_list_nth (wm_menu_window_managers, index)->data;
|
||||
new_settings.flags = GNOME_WM_SETTING_AUTORAISE;
|
||||
new_settings.autoraise =
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
|
||||
|
||||
if (current_wm != NULL && new_settings.autoraise != settings.autoraise)
|
||||
gnome_window_manager_change_settings (current_wm, &new_settings);
|
||||
|
||||
if (!in_fill) {
|
||||
if (!gnome_wm_manager_same_wm (wm, selected_wm)) {
|
||||
selected_wm = wm;
|
||||
set_wm_change_pending (TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wm_widget_clear ()
|
||||
autoraise_delay_value_changed_callback (GtkWidget *spinbutton,
|
||||
void *data)
|
||||
{
|
||||
wm_menu_window_managers = NULL;
|
||||
GnomeWMSettings new_settings;
|
||||
|
||||
wm_menu = gtk_menu_new ();
|
||||
gtk_widget_show_all (wm_menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), wm_menu);
|
||||
}
|
||||
new_settings.flags = GNOME_WM_SETTING_AUTORAISE_DELAY;
|
||||
new_settings.autoraise_delay =
|
||||
gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinbutton)) * 100;
|
||||
|
||||
GtkWidget *
|
||||
wm_widget_new ()
|
||||
{
|
||||
option_menu = gtk_option_menu_new ();
|
||||
g_signal_connect (G_OBJECT (option_menu), "changed",
|
||||
(GCallback)wm_selection_changed, NULL);
|
||||
|
||||
wm_widget_clear ();
|
||||
|
||||
gtk_widget_show_all (option_menu);
|
||||
return option_menu;
|
||||
if (current_wm != NULL && new_settings.autoraise_delay != settings.autoraise_delay)
|
||||
gnome_window_manager_change_settings (current_wm, &new_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
wm_widget_add_wm (GnomeWindowManager *wm)
|
||||
double_click_titlebar_changed_callback (GtkWidget *optionmenu,
|
||||
void *data)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
const char *row_text;
|
||||
GnomeWMSettings new_settings;
|
||||
|
||||
new_settings.flags = GNOME_WM_SETTING_DOUBLE_CLICK_ACTION;
|
||||
new_settings.double_click_action =
|
||||
gtk_option_menu_get_history (GTK_OPTION_MENU (optionmenu));
|
||||
|
||||
row_text = gnome_window_manager_get_name (wm);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label (row_text);
|
||||
gtk_widget_show_all (menu_item);
|
||||
|
||||
gtk_menu_shell_prepend (GTK_MENU_SHELL (wm_menu), menu_item);
|
||||
wm_menu_window_managers = g_list_append (wm_menu_window_managers, wm);
|
||||
|
||||
/* If this is supposed to be the selected window manager, do so */
|
||||
if (gnome_wm_manager_same_wm (wm, selected_wm))
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), g_list_length (wm_menu_window_managers) - 1);
|
||||
if (current_wm != NULL && new_settings.double_click_action != settings.double_click_action)
|
||||
gnome_window_manager_change_settings (current_wm, &new_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, gint response_id, gpointer data)
|
||||
alt_click_modifier_changed_callback (GtkWidget *optionmenu,
|
||||
void *data)
|
||||
{
|
||||
switch (response_id)
|
||||
{
|
||||
case GTK_RESPONSE_NONE:
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
gtk_main_quit ();
|
||||
break;
|
||||
}
|
||||
GnomeWMSettings new_settings;
|
||||
int history;
|
||||
|
||||
new_settings.flags = GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER;
|
||||
history = gtk_option_menu_get_history (GTK_OPTION_MENU (optionmenu));
|
||||
|
||||
if (history >= n_mouse_modifiers) /* paranoia */
|
||||
return;
|
||||
|
||||
new_settings.mouse_move_modifier = mouse_modifiers[history].value;
|
||||
|
||||
if (current_wm != NULL &&
|
||||
strcmp (new_settings.mouse_move_modifier,
|
||||
settings.mouse_move_modifier) != 0)
|
||||
gnome_window_manager_change_settings (current_wm, &new_settings);
|
||||
}
|
||||
|
||||
static void
|
||||
update_gui (void)
|
||||
update_sensitivity (void)
|
||||
{
|
||||
GList *tmp_list;
|
||||
GnomeWindowManager *wm;
|
||||
gtk_widget_set_sensitive (autoraise_checkbutton,
|
||||
settings.focus_follows_mouse);
|
||||
|
||||
gtk_widget_set_sensitive (autoraise_delay_hbox,
|
||||
settings.focus_follows_mouse && settings.autoraise);
|
||||
|
||||
wm_widget_clear ();
|
||||
gtk_widget_set_sensitive (double_click_titlebar_optionmenu,
|
||||
n_double_click_actions > 1);
|
||||
|
||||
in_fill = TRUE;
|
||||
/* disable the whole dialog while no WM is running, or
|
||||
* a WM we don't understand is running. We should probably do
|
||||
* something better. I don't want to just launch the config tool
|
||||
* as we would on startup though, because then you'd get weirdness
|
||||
* in the gap time between old and new WM.
|
||||
*/
|
||||
gtk_widget_set_sensitive (dialog_win, current_wm != NULL);
|
||||
}
|
||||
|
||||
tmp_list = gnome_wm_manager_get_list ();
|
||||
static void
|
||||
init_settings_struct (GnomeWMSettings *settings)
|
||||
{
|
||||
/* Init fields that weren't initialized */
|
||||
if ((settings->flags & GNOME_WM_SETTING_MOUSE_FOCUS) == 0)
|
||||
settings->focus_follows_mouse = FALSE;
|
||||
|
||||
if ((settings->flags & GNOME_WM_SETTING_AUTORAISE) == 0)
|
||||
settings->autoraise = FALSE;
|
||||
|
||||
if ((settings->flags & GNOME_WM_SETTING_AUTORAISE_DELAY) == 0)
|
||||
settings->autoraise_delay = 1000;
|
||||
|
||||
if ((settings->flags & GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER) == 0)
|
||||
settings->mouse_move_modifier = "Super";
|
||||
|
||||
printf ("got a list of %d wms\n", g_list_length (tmp_list));
|
||||
if ((settings->flags & GNOME_WM_SETTING_DOUBLE_CLICK_ACTION) == 0)
|
||||
settings->double_click_action = 0;
|
||||
}
|
||||
|
||||
for (tmp_list = gnome_wm_manager_get_list (); tmp_list != NULL; tmp_list = tmp_list->next) {
|
||||
wm = tmp_list->data;
|
||||
if (wm != NULL) wm_widget_add_wm (wm);
|
||||
static void
|
||||
set_alt_click_optionmenu_value (const GnomeWMSettings *settings)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (i < n_mouse_modifiers) {
|
||||
if (strcmp (mouse_modifiers[i].value,
|
||||
settings->mouse_move_modifier) == 0)
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
|
||||
in_fill = FALSE;
|
||||
|
||||
if (i < n_mouse_modifiers)
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (alt_click_optionmenu),
|
||||
i);
|
||||
}
|
||||
|
||||
static void
|
||||
apply_wm (GObject *object, gpointer data)
|
||||
rebuild_double_click_actions_menu (void)
|
||||
{
|
||||
gnome_wm_manager_set_current (selected_wm);
|
||||
setup_appearance_option_menu (appearance_option_menu, selected_wm);
|
||||
set_wm_change_pending (FALSE);
|
||||
}
|
||||
|
||||
static GladeXML *
|
||||
create_dialog (void)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
int i;
|
||||
GtkWidget *menu;
|
||||
|
||||
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-window-properties.glade", "prefs_widget", NULL);
|
||||
|
||||
apply_now_button = WID ("apply_now_button");
|
||||
g_signal_connect (G_OBJECT (apply_now_button), "clicked", (GCallback)apply_wm, NULL);
|
||||
|
||||
properties_box = WID ("properties_box");
|
||||
|
||||
set_wm_change_pending (FALSE);
|
||||
|
||||
wm_widget = wm_widget_new ();
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (WID ("wm_widget_box")), wm_widget, TRUE, TRUE, 0);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_appearance_option_menu (GtkWidget *appearance_option_menu, GnomeWindowManager *wm)
|
||||
{
|
||||
GtkWidget *menu, *menu_item;
|
||||
GList *themes, *node;
|
||||
const char *theme_name;
|
||||
char *current_theme_name;
|
||||
int index = 0;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
gtk_widget_show_all (menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (appearance_option_menu), menu);
|
||||
i = 0;
|
||||
while (i < n_double_click_actions) {
|
||||
GtkWidget *mi;
|
||||
|
||||
mi = gtk_menu_item_new_with_label (double_click_actions[i].human_readable_name);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
|
||||
mi);
|
||||
|
||||
gtk_widget_show (mi);
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
|
||||
menu);
|
||||
}
|
||||
|
||||
themes = gnome_window_manager_get_theme_list (wm);
|
||||
static void
|
||||
reload_settings (void)
|
||||
{
|
||||
GnomeWMSettings new_settings;
|
||||
|
||||
current_theme_name = gconf_client_get_string (gconf_client, THEME_KEY, NULL);
|
||||
g_assert (n_mouse_modifiers > 0);
|
||||
|
||||
if (current_wm != NULL) {
|
||||
new_settings.flags = GNOME_WM_SETTING_MOUSE_FOCUS |
|
||||
GNOME_WM_SETTING_AUTORAISE |
|
||||
GNOME_WM_SETTING_AUTORAISE_DELAY |
|
||||
GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER |
|
||||
GNOME_WM_SETTING_DOUBLE_CLICK_ACTION;
|
||||
|
||||
for (node = themes; node != NULL; node = node->next) {
|
||||
theme_name = (char *)node->data;
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label (theme_name);
|
||||
gtk_widget_show_all (menu_item);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
|
||||
if ((current_theme_name != NULL) && (theme_name != NULL) && (strcmp (theme_name, current_theme_name) == 0))
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (appearance_option_menu), index);
|
||||
|
||||
index++;
|
||||
/* this will clear any flags that don't get filled in */
|
||||
gnome_window_manager_get_settings (current_wm, &new_settings);
|
||||
} else {
|
||||
new_settings.flags = 0;
|
||||
}
|
||||
|
||||
g_free (current_theme_name);
|
||||
|
||||
theme_list = themes;
|
||||
}
|
||||
|
||||
static void
|
||||
appearance_changed (GtkOptionMenu *option_menu, gpointer data)
|
||||
{
|
||||
int index;
|
||||
const char *theme_name;
|
||||
|
||||
index = gtk_option_menu_get_history (option_menu);
|
||||
theme_name = (const char *) g_list_nth (theme_list, index)->data;
|
||||
|
||||
printf ("Setting theme to %s\n", theme_name);
|
||||
init_settings_struct (&new_settings);
|
||||
|
||||
gconf_client_set_string (gconf_client, THEME_KEY, theme_name, NULL);
|
||||
if (new_settings.focus_follows_mouse != settings.focus_follows_mouse)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_checkbutton),
|
||||
new_settings.focus_follows_mouse);
|
||||
|
||||
if (new_settings.autoraise != settings.autoraise)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autoraise_checkbutton),
|
||||
new_settings.autoraise);
|
||||
|
||||
if (new_settings.autoraise_delay != settings.autoraise_delay)
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (autoraise_delay_spinbutton),
|
||||
new_settings.autoraise_delay / 100);
|
||||
|
||||
if (n_double_click_actions > 0 &&
|
||||
new_settings.double_click_action != settings.double_click_action) {
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
|
||||
new_settings.double_click_action);
|
||||
}
|
||||
|
||||
|
||||
if (settings.mouse_move_modifier == NULL ||
|
||||
strcmp (settings.mouse_move_modifier,
|
||||
new_settings.mouse_move_modifier) != 0) {
|
||||
set_alt_click_optionmenu_value (&new_settings);
|
||||
}
|
||||
|
||||
settings = new_settings;
|
||||
|
||||
update_sensitivity ();
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dialog (GladeXML *dialog)
|
||||
{
|
||||
GObject *peditor;
|
||||
|
||||
update_gui ();
|
||||
|
||||
peditor = gconf_peditor_new_font (NULL, TITLEBAR_FONT_KEY,
|
||||
WID ("titlebar_font"),
|
||||
PEDITOR_FONT_COMBINED, NULL);
|
||||
|
||||
peditor = gconf_peditor_new_boolean (NULL, FOCUS_FOLLOWS_MOUSE_KEY,
|
||||
WID ("focus_follows_mouse"),
|
||||
NULL);
|
||||
|
||||
appearance_option_menu = WID ("window_border_appearance");
|
||||
setup_appearance_option_menu (appearance_option_menu, selected_wm);
|
||||
g_signal_connect (G_OBJECT (appearance_option_menu), "changed",
|
||||
(GCallback)appearance_changed, NULL);
|
||||
gtk_widget_show_all (appearance_option_menu);
|
||||
wm_settings_changed_callback (GnomeWindowManager *wm,
|
||||
void *data)
|
||||
{
|
||||
reload_settings ();
|
||||
}
|
||||
|
||||
static void
|
||||
update_wm (GdkScreen *screen,
|
||||
gboolean load_settings)
|
||||
{
|
||||
g_assert (n_mouse_modifiers > 0);
|
||||
|
||||
if (current_wm != NULL) {
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (current_wm),
|
||||
G_CALLBACK (wm_settings_changed_callback),
|
||||
NULL);
|
||||
current_wm = NULL;
|
||||
double_click_actions = NULL;
|
||||
n_double_click_actions = 0;
|
||||
}
|
||||
|
||||
current_wm = gnome_wm_manager_get_current (screen);
|
||||
|
||||
if (current_wm != NULL) {
|
||||
g_signal_connect (G_OBJECT (current_wm), "settings_changed",
|
||||
G_CALLBACK (wm_settings_changed_callback), NULL);
|
||||
|
||||
gnome_window_manager_get_double_click_actions (current_wm,
|
||||
&double_click_actions,
|
||||
&n_double_click_actions);
|
||||
|
||||
}
|
||||
|
||||
rebuild_double_click_actions_menu ();
|
||||
if (load_settings)
|
||||
reload_settings ();
|
||||
}
|
||||
|
||||
static void
|
||||
wm_changed_callback (GdkScreen *screen,
|
||||
void *data)
|
||||
{
|
||||
update_wm (screen, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
response_cb (GtkWidget *dialog_win,
|
||||
int response_id,
|
||||
void *data)
|
||||
{
|
||||
|
||||
if (response_id == GTK_RESPONSE_HELP) {
|
||||
|
||||
} else {
|
||||
gtk_widget_destroy (dialog_win);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
try_spawn_config_tool (GdkScreen *screen)
|
||||
{
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
gnome_wm_manager_spawn_config_tool_for_current (screen, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
GtkWidget *no_tool_dialog;
|
||||
char *str;
|
||||
char *escaped;
|
||||
|
||||
escaped = g_markup_escape_text (error->message, -1);
|
||||
|
||||
str = g_strdup_printf (_("<b>Cannot start the preferences application for your window manager</b>\n\n%s"),
|
||||
escaped);
|
||||
g_free (escaped);
|
||||
|
||||
no_tool_dialog =
|
||||
gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
" ");
|
||||
gtk_window_set_title (GTK_WINDOW (no_tool_dialog), "");
|
||||
gtk_window_set_resizable (GTK_WINDOW (no_tool_dialog), FALSE);
|
||||
|
||||
gtk_label_set_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (no_tool_dialog)->label),
|
||||
str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (no_tool_dialog));
|
||||
|
||||
gtk_widget_destroy (no_tool_dialog);
|
||||
g_error_free (error);
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* exit, let the config tool handle it */
|
||||
exit (0);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
GtkWidget *dialog_win;
|
||||
|
||||
GdkScreen *screen;
|
||||
GtkSizeGroup *size_group;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
gnome_program_init ("wm-properties", VERSION,
|
||||
gnome_program_init ("gnome-window-properties", VERSION,
|
||||
LIBGNOMEUI_MODULE, argc, argv,
|
||||
GNOME_PARAM_POPT_TABLE,
|
||||
NULL);
|
||||
|
||||
gconf_client = gconf_client_get_default ();
|
||||
|
||||
dialog_win = gtk_dialog_new_with_buttons
|
||||
(_("Window Preferences"), NULL, -1,
|
||||
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
||||
NULL);
|
||||
g_signal_connect (G_OBJECT (dialog_win), "response", (GCallback)response_cb, NULL);
|
||||
|
||||
gnome_wm_manager_init (dialog_win);
|
||||
selected_wm = gnome_wm_manager_get_current ();
|
||||
gnome_wm_manager_init ();
|
||||
|
||||
dialog = create_dialog ();
|
||||
setup_dialog (dialog);
|
||||
screen = gdk_display_get_default_screen (gdk_display_get_default ());
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
|
||||
gtk_widget_show_all (dialog_win);
|
||||
current_wm = gnome_wm_manager_get_current (screen);
|
||||
|
||||
if (current_wm == NULL) {
|
||||
try_spawn_config_tool (screen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dialog = glade_xml_new (GLADEDIR "/gnome-window-properties.glade",
|
||||
"main-dialog", GETTEXT_PACKAGE);
|
||||
|
||||
if (dialog == NULL) {
|
||||
g_warning ("Missing glade file for gnome-window-properties");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
dialog_win = WID ("main-dialog");
|
||||
focus_mode_checkbutton = WID ("focus-mode-checkbutton");
|
||||
autoraise_checkbutton = WID ("autoraise-checkbutton");
|
||||
autoraise_delay_spinbutton = WID ("autoraise-delay-spinbutton");
|
||||
autoraise_delay_hbox = WID ("autoraise-delay-hbox");
|
||||
double_click_titlebar_optionmenu = WID ("double-click-titlebar-optionmenu");
|
||||
double_click_titlebar_hbox = WID ("double-click-titlebar-hbox");
|
||||
alt_click_optionmenu = WID ("alt-click-optionmenu");
|
||||
|
||||
gtk_spin_button_set_range (GTK_SPIN_BUTTON (autoraise_delay_spinbutton),
|
||||
0, 100);
|
||||
|
||||
gtk_spin_button_set_increments (GTK_SPIN_BUTTON (autoraise_delay_spinbutton),
|
||||
1, 5);
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
gtk_size_group_add_widget (size_group, double_click_titlebar_optionmenu);
|
||||
gtk_size_group_add_widget (size_group, alt_click_optionmenu);
|
||||
g_object_unref (G_OBJECT (size_group));
|
||||
|
||||
settings.flags = 0;
|
||||
init_settings_struct (&settings);
|
||||
|
||||
reload_mouse_modifiers ();
|
||||
update_wm (screen, FALSE);
|
||||
|
||||
set_alt_click_optionmenu_value (&settings);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (autoraise_delay_spinbutton),
|
||||
settings.autoraise_delay / 100);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
|
||||
settings.double_click_action);
|
||||
|
||||
reload_settings (); /* must come before below signal connections */
|
||||
|
||||
g_signal_connect (G_OBJECT (dialog_win), "response",
|
||||
G_CALLBACK (response_cb), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (dialog_win), "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
|
||||
g_signal_connect (G_OBJECT (focus_mode_checkbutton), "toggled",
|
||||
G_CALLBACK (mouse_focus_toggled_callback), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (autoraise_checkbutton), "toggled",
|
||||
G_CALLBACK (autoraise_toggled_callback), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (autoraise_delay_spinbutton), "value_changed",
|
||||
G_CALLBACK (autoraise_delay_value_changed_callback), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (double_click_titlebar_optionmenu), "changed",
|
||||
G_CALLBACK (double_click_titlebar_changed_callback), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (alt_click_optionmenu), "changed",
|
||||
G_CALLBACK (alt_click_modifier_changed_callback), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (screen), "window_manager_changed",
|
||||
G_CALLBACK (wm_changed_callback), NULL);
|
||||
|
||||
gtk_widget_show (dialog_win);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
/* FIXME: we need to handle this through the library somehow
|
||||
if (restart_pending) {
|
||||
quit_pending = TRUE;
|
||||
gtk_main();
|
||||
}
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <gdk/gdkx.h>
|
||||
static void
|
||||
reload_mouse_modifiers (void)
|
||||
{
|
||||
XModifierKeymap *modmap;
|
||||
KeySym *keymap;
|
||||
int keysyms_per_keycode;
|
||||
int map_size;
|
||||
int i;
|
||||
gboolean have_meta;
|
||||
gboolean have_hyper;
|
||||
gboolean have_super;
|
||||
int min_keycode, max_keycode;
|
||||
|
||||
XDisplayKeycodes (gdk_display,
|
||||
&min_keycode,
|
||||
&max_keycode);
|
||||
|
||||
keymap = XGetKeyboardMapping (gdk_display,
|
||||
min_keycode,
|
||||
max_keycode - min_keycode,
|
||||
&keysyms_per_keycode);
|
||||
|
||||
modmap = XGetModifierMapping (gdk_display);
|
||||
|
||||
have_super = FALSE;
|
||||
have_meta = FALSE;
|
||||
have_hyper = FALSE;
|
||||
|
||||
/* there are 8 modifiers, and the first 3 are shift, shift lock,
|
||||
* and control
|
||||
*/
|
||||
map_size = 8 * modmap->max_keypermod;
|
||||
i = 3 * modmap->max_keypermod;
|
||||
while (i < map_size) {
|
||||
/* get the key code at this point in the map,
|
||||
* see if its keysym is one we're interested in
|
||||
*/
|
||||
int keycode = modmap->modifiermap[i];
|
||||
|
||||
if (keycode >= min_keycode &&
|
||||
keycode <= max_keycode) {
|
||||
int j = 0;
|
||||
KeySym *syms = keymap + (keycode - min_keycode) * keysyms_per_keycode;
|
||||
|
||||
while (j < keysyms_per_keycode) {
|
||||
if (syms[j] == XK_Super_L ||
|
||||
syms[j] == XK_Super_R)
|
||||
have_super = TRUE;
|
||||
else if (syms[j] == XK_Hyper_L ||
|
||||
syms[j] == XK_Hyper_R)
|
||||
have_hyper = TRUE;
|
||||
else if ((syms[j] == XK_Meta_L ||
|
||||
syms[j] == XK_Meta_R) &&
|
||||
(1 << ( i / modmap->max_keypermod)) != Mod1Mask)
|
||||
have_meta = TRUE;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
XFreeModifiermap (modmap);
|
||||
XFree (keymap);
|
||||
|
||||
i = 0;
|
||||
while (i < n_mouse_modifiers) {
|
||||
g_free (mouse_modifiers[i].name);
|
||||
++i;
|
||||
}
|
||||
g_free (mouse_modifiers);
|
||||
mouse_modifiers = NULL;
|
||||
|
||||
|
||||
n_mouse_modifiers = 2; /* control, alt */
|
||||
if (have_super)
|
||||
++n_mouse_modifiers;
|
||||
if (have_hyper)
|
||||
++n_mouse_modifiers;
|
||||
if (have_meta)
|
||||
++n_mouse_modifiers;
|
||||
|
||||
g_free (mouse_modifiers);
|
||||
|
||||
mouse_modifiers = g_new0 (MouseClickModifier, n_mouse_modifiers);
|
||||
|
||||
i = 0;
|
||||
|
||||
mouse_modifiers[i].number = i;
|
||||
mouse_modifiers[i].name = g_strdup (_("Control"));
|
||||
mouse_modifiers[i].value = "Control";
|
||||
++i;
|
||||
|
||||
mouse_modifiers[i].number = i;
|
||||
mouse_modifiers[i].name = g_strdup (_("Alt"));
|
||||
mouse_modifiers[i].value = "Alt";
|
||||
++i;
|
||||
|
||||
if (have_hyper) {
|
||||
mouse_modifiers[i].number = i;
|
||||
mouse_modifiers[i].name = g_strdup (_("Hyper"));
|
||||
mouse_modifiers[i].value = "Hyper";
|
||||
++i;
|
||||
}
|
||||
|
||||
if (have_super) {
|
||||
mouse_modifiers[i].number = i;
|
||||
mouse_modifiers[i].name = g_strdup (_("Super"));
|
||||
mouse_modifiers[i].value = "Super";
|
||||
++i;
|
||||
}
|
||||
|
||||
if (have_meta) {
|
||||
mouse_modifiers[i].number = i;
|
||||
mouse_modifiers[i].name = g_strdup (_("Meta"));
|
||||
mouse_modifiers[i].value = "Meta";
|
||||
++i;
|
||||
}
|
||||
|
||||
g_assert (i == n_mouse_modifiers);
|
||||
|
||||
/* Build modifier option menu */
|
||||
{
|
||||
GtkWidget *menu;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
i = 0;
|
||||
while (i < n_mouse_modifiers) {
|
||||
GtkWidget *mi;
|
||||
|
||||
mi = gtk_menu_item_new_with_label (mouse_modifiers[i].name);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
|
||||
mi);
|
||||
|
||||
gtk_widget_show (mi);
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (alt_click_optionmenu),
|
||||
menu);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,165 +2,131 @@
|
|||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<property name="visible">True</property>
|
||||
<widget class="GtkDialog" id="main-dialog">
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">Window Preferences</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="prefs_widget">
|
||||
<property name="border_width">5</property>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">9</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<widget class="GtkButton" id="helpbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-11</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="closebutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-7</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">12</property>
|
||||
<property name="n_columns">14</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="row_spacing">0</property>
|
||||
<property name="column_spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="focus-mode-checkbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Select windows when the mouse moves over them</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">14</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="autoraise-checkbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Raise selected windows after a short time</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">14</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="double-click-titlebar-hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">3</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<widget class="GtkLabel" id="double-click-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Window Manager:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="label" translatable="yes">_Double-click window titles to:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="wm_widget_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="apply_now_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Apply Now</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="properties_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">9</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">3</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Window Border Appearance</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkOptionMenu" id="window_border_appearance">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="history">-1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="mnemonic_widget">double-click-titlebar-optionmenu</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -170,92 +136,171 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Titlebar Font</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GnomeFontPicker" id="titlebar_font">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
|
||||
<property name="show_size">True</property>
|
||||
<property name="use_font_in_label">True</property>
|
||||
<property name="label_font_size">14</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="focus_follows_mouse">
|
||||
<widget class="GtkOptionMenu" id="double-click-titlebar-optionmenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Select windows when the mouse moves over them</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="history">-1</property>
|
||||
<accessibility>
|
||||
<atkrelation target="double-click-label" type="labelled-by"/>
|
||||
</accessibility>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu1">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">14</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="alt-click-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">To _move windows, click while holding down:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">alt-click-optionmenu</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkOptionMenu" id="alt-click-optionmenu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="history">-1</property>
|
||||
<accessibility>
|
||||
<atkrelation target="alt-click-label" type="labelled-by"/>
|
||||
</accessibility>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu2">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">14</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">12</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="autoraise-delay-hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="autoraise-delay-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Tenths of a second before raising the window:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">autoraise-delay-spinbutton</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSpinButton" id="autoraise-delay-spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="climb_rate">1</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="numeric">False</property>
|
||||
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
|
||||
<property name="snap_to_ticks">False</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="adjustment">1 0 100 1 10 10</property>
|
||||
<accessibility>
|
||||
<atkrelation target="autoraise-delay-label" type="labelled-by"/>
|
||||
</accessibility>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">14</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="height_request">10</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">1</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include "metacity-window-manager.h"
|
||||
|
||||
#define METACITY_THEME_KEY "/apps/metacity/general/theme"
|
||||
#define METACITY_FONT_KEY "/apps/metacity/general/titlebar_font"
|
||||
#define METACITY_FOCUS_KEY "/apps/metacity/general/focus_mode"
|
||||
#define METACITY_USE_SYSTEM_FONT_KEY "/apps/metacity/titlebar_uses_system_font"
|
||||
|
||||
static GnomeWindowManagerClass *parent_class;
|
||||
|
||||
struct _MetacityWindowManagerPrivate {
|
||||
int padding;
|
||||
};
|
||||
|
||||
/* this function is called when the shared lib is loaded */
|
||||
GObject *
|
||||
window_manager_new (void)
|
||||
{
|
||||
GObject *wm;
|
||||
|
||||
wm = g_object_new (metacity_window_manager_get_type (), NULL);
|
||||
|
||||
return wm;
|
||||
}
|
||||
|
||||
static void
|
||||
metacity_set_theme (GnomeWindowManager *wm, const char *theme_name)
|
||||
{
|
||||
gconf_client_set_string (gconf_client_get_default (),
|
||||
METACITY_THEME_KEY,
|
||||
theme_name, NULL);
|
||||
}
|
||||
|
||||
static GList *
|
||||
add_themes_from_dir (GList *current_list, const char *path)
|
||||
{
|
||||
DIR *theme_dir;
|
||||
struct dirent *entry;
|
||||
char *theme_file_path;
|
||||
GList *node;
|
||||
gboolean found = FALSE;
|
||||
|
||||
if (!(g_file_test (path, G_FILE_TEST_EXISTS) && g_file_test (path, G_FILE_TEST_IS_DIR))) {
|
||||
return current_list;
|
||||
}
|
||||
|
||||
theme_dir = opendir (path);
|
||||
|
||||
for (entry = readdir (theme_dir); entry != NULL; entry = readdir (theme_dir)) {
|
||||
theme_file_path = g_build_filename (path, entry->d_name, "metacity-theme-1.xml", NULL);
|
||||
|
||||
if (g_file_test (theme_file_path, G_FILE_TEST_EXISTS)) {
|
||||
|
||||
for (node = current_list; (node != NULL) && (!found); node = node->next) {
|
||||
found = (strcmp (node->data, entry->d_name) == 0);
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
current_list = g_list_prepend (current_list, g_strdup (entry->d_name));
|
||||
}
|
||||
}
|
||||
|
||||
/*g_free (entry);*/
|
||||
g_free (theme_file_path);
|
||||
}
|
||||
|
||||
closedir (theme_dir);
|
||||
|
||||
return current_list;
|
||||
}
|
||||
|
||||
static GList *
|
||||
metacity_get_theme_list (GnomeWindowManager *wm)
|
||||
{
|
||||
GList *themes = NULL;
|
||||
char *home_dir_themes;
|
||||
|
||||
home_dir_themes = g_build_filename (g_get_home_dir (), ".metacity/themes", NULL);
|
||||
|
||||
themes = add_themes_from_dir (themes, METACITY_THEME_DIR);
|
||||
themes = add_themes_from_dir (themes, "/usr/share/metacity/themes");
|
||||
themes = add_themes_from_dir (themes, home_dir_themes);
|
||||
|
||||
g_free (home_dir_themes);
|
||||
|
||||
return themes;
|
||||
}
|
||||
|
||||
static void
|
||||
metacity_set_font (GnomeWindowManager *wm, const char *font)
|
||||
{
|
||||
GConfClient *client;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
gconf_client_set_bool (client, METACITY_USE_SYSTEM_FONT_KEY, FALSE, NULL);
|
||||
gconf_client_set_string (client, METACITY_FONT_KEY, font, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
metacity_set_focus_follows_mouse (GnomeWindowManager *wm, gboolean focus_follows_mouse)
|
||||
{
|
||||
const char *focus_mode;
|
||||
|
||||
if (focus_follows_mouse) {
|
||||
focus_mode = "sloppy";
|
||||
} else {
|
||||
focus_mode = "click";
|
||||
}
|
||||
|
||||
gconf_client_set_string (gconf_client_get_default (),
|
||||
METACITY_FOCUS_KEY,
|
||||
focus_mode, NULL);
|
||||
}
|
||||
|
||||
static char *
|
||||
metacity_get_user_theme_folder (GnomeWindowManager *wm)
|
||||
{
|
||||
return g_build_filename (g_get_home_dir (), ".metacity/themes", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
metacity_window_manager_init (MetacityWindowManager *metacity_window_manager, MetacityWindowManagerClass *class)
|
||||
{
|
||||
metacity_window_manager->p = g_new0 (MetacityWindowManagerPrivate, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
metacity_window_manager_finalize (GObject *object)
|
||||
{
|
||||
MetacityWindowManager *metacity_window_manager;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (IS_METACITY_WINDOW_MANAGER (object));
|
||||
|
||||
metacity_window_manager = METACITY_WINDOW_MANAGER (object);
|
||||
|
||||
g_free (metacity_window_manager->p);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
metacity_window_manager_class_init (MetacityWindowManagerClass *class)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GnomeWindowManagerClass *wm_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (class);
|
||||
wm_class = GNOME_WINDOW_MANAGER_CLASS (class);
|
||||
|
||||
object_class->finalize = metacity_window_manager_finalize;
|
||||
|
||||
wm_class->set_theme = metacity_set_theme;
|
||||
wm_class->get_theme_list = metacity_get_theme_list;
|
||||
wm_class->set_font = metacity_set_font;
|
||||
wm_class->set_focus_follows_mouse = metacity_set_focus_follows_mouse;
|
||||
wm_class->get_user_theme_folder = metacity_get_user_theme_folder;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
}
|
||||
|
||||
GType
|
||||
metacity_window_manager_get_type (void)
|
||||
{
|
||||
static GType metacity_window_manager_type = 0;
|
||||
|
||||
if (!metacity_window_manager_type) {
|
||||
static GTypeInfo metacity_window_manager_info = {
|
||||
sizeof (MetacityWindowManagerClass),
|
||||
NULL, /* GBaseInitFunc */
|
||||
NULL, /* GBaseFinalizeFunc */
|
||||
(GClassInitFunc) metacity_window_manager_class_init,
|
||||
NULL, /* GClassFinalizeFunc */
|
||||
NULL, /* user-supplied data */
|
||||
sizeof (MetacityWindowManager),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) metacity_window_manager_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
metacity_window_manager_type =
|
||||
g_type_register_static (gnome_window_manager_get_type (),
|
||||
"MetacityWindowManager",
|
||||
&metacity_window_manager_info, 0);
|
||||
}
|
||||
|
||||
return metacity_window_manager_type;
|
||||
}
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef METACITY_WINDOW_MANAGER_H
|
||||
#define METACITY_WINDOW_MANAGER_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "gnome-window-manager.h"
|
||||
|
||||
#define METACITY_WINDOW_MANAGER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, metacity_window_manager_get_type (), MetacityWindowManager)
|
||||
#define METACITY_WINDOW_MANAGER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, metacity_window_manager_get_type (), MetacityWindowManagerClass)
|
||||
#define IS_METACITY_WINDOW_MANAGER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, metacity_window_manager_get_type ())
|
||||
|
||||
typedef struct _MetacityWindowManager MetacityWindowManager;
|
||||
typedef struct _MetacityWindowManagerClass MetacityWindowManagerClass;
|
||||
|
||||
typedef struct _MetacityWindowManagerPrivate MetacityWindowManagerPrivate;
|
||||
|
||||
struct _MetacityWindowManager
|
||||
{
|
||||
GnomeWindowManager parent;
|
||||
MetacityWindowManagerPrivate *p;
|
||||
};
|
||||
|
||||
struct _MetacityWindowManagerClass
|
||||
{
|
||||
GnomeWindowManagerClass klass;
|
||||
};
|
||||
|
||||
GType metacity_window_manager_get_type (void);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue