modify to use slider/radio instead of spinbutton/optionmenu.

2002-12-01  Havoc Pennington  <hp@pobox.com>

	* gnome-window-properties.c: modify to use slider/radio instead of
	spinbutton/optionmenu.

	* gnome-window-properties.glade: make UI review changes
This commit is contained in:
Havoc Pennington 2002-12-02 01:14:14 +00:00 committed by Havoc Pennington
parent f4b41ab794
commit 24a577acd6
3 changed files with 463 additions and 315 deletions

View file

@ -1,3 +1,10 @@
2002-12-01 Havoc Pennington <hp@pobox.com>
* gnome-window-properties.c: modify to use slider/radio instead of
spinbutton/optionmenu.
* gnome-window-properties.glade: make UI review changes
2002-11-23 Jody Goldberg <jody@gnome.org>
* Release 2.1.3

View file

@ -39,6 +39,7 @@ typedef struct
int number;
char *name;
const char *value; /* machine-readable name for storing config */
GtkWidget *radio;
} MouseClickModifier;
static GConfClient *gconf_client;
@ -47,11 +48,11 @@ 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_slider;
static GtkWidget *autoraise_delay_hbox;
static GtkWidget *double_click_titlebar_optionmenu;
static GtkWidget *double_click_titlebar_hbox;
static GtkWidget *alt_click_optionmenu;
static GtkWidget *alt_click_hbox;
static GnomeWMSettings settings;
static const GnomeWMDoubleClickAction *double_click_actions = NULL;
@ -92,14 +93,14 @@ autoraise_toggled_callback (GtkWidget *button,
}
static void
autoraise_delay_value_changed_callback (GtkWidget *spinbutton,
autoraise_delay_value_changed_callback (GtkWidget *slider,
void *data)
{
GnomeWMSettings new_settings;
new_settings.flags = GNOME_WM_SETTING_AUTORAISE_DELAY;
new_settings.autoraise_delay =
gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinbutton)) * 100;
gtk_range_get_value (GTK_RANGE (slider)) * 1000;
if (current_wm != NULL && new_settings.autoraise_delay != settings.autoraise_delay)
gnome_window_manager_change_settings (current_wm, &new_settings);
@ -119,6 +120,8 @@ double_click_titlebar_changed_callback (GtkWidget *optionmenu,
gnome_window_manager_change_settings (current_wm, &new_settings);
}
#if 0
/* This was for option menu */
static void
alt_click_modifier_changed_callback (GtkWidget *optionmenu,
void *data)
@ -139,6 +142,28 @@ alt_click_modifier_changed_callback (GtkWidget *optionmenu,
settings.mouse_move_modifier) != 0)
gnome_window_manager_change_settings (current_wm, &new_settings);
}
#else
static void
alt_click_radio_toggled_callback (GtkWidget *radio,
void *data)
{
GnomeWMSettings new_settings;
gboolean active;
MouseClickModifier *modifier = data;
new_settings.flags = GNOME_WM_SETTING_MOUSE_MOVE_MODIFIER;
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio));
if (active) {
new_settings.mouse_move_modifier = modifier->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);
}
}
#endif
static void
update_sensitivity (void)
@ -182,7 +207,7 @@ init_settings_struct (GnomeWMSettings *settings)
}
static void
set_alt_click_optionmenu_value (const GnomeWMSettings *settings)
set_alt_click_value (const GnomeWMSettings *settings)
{
int i;
@ -194,9 +219,10 @@ set_alt_click_optionmenu_value (const GnomeWMSettings *settings)
++i;
}
if (i < n_mouse_modifiers)
gtk_option_menu_set_history (GTK_OPTION_MENU (alt_click_optionmenu),
i);
if (i < n_mouse_modifiers) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mouse_modifiers[i].radio),
TRUE);
}
}
static void
@ -254,8 +280,8 @@ reload_settings (void)
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);
gtk_range_set_value (GTK_RANGE (autoraise_delay_slider),
new_settings.autoraise_delay / 1000.0);
if (n_double_click_actions > 0 &&
new_settings.double_click_action != settings.double_click_action) {
@ -267,7 +293,7 @@ reload_settings (void)
if (settings.mouse_move_modifier == NULL ||
strcmp (settings.mouse_move_modifier,
new_settings.mouse_move_modifier) != 0) {
set_alt_click_optionmenu_value (&new_settings);
set_alt_click_value (&new_settings);
}
settings = new_settings;
@ -383,7 +409,7 @@ int
main (int argc, char **argv)
{
GdkScreen *screen;
GtkSizeGroup *size_group;
int i;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
@ -417,22 +443,24 @@ main (int argc, char **argv)
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_slider = WID ("autoraise-delay-slider");
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");
alt_click_hbox = WID ("alt-click-box");
gtk_spin_button_set_range (GTK_SPIN_BUTTON (autoraise_delay_spinbutton),
0, 100);
gtk_range_set_range (GTK_RANGE (autoraise_delay_slider),
0, 10);
gtk_spin_button_set_increments (GTK_SPIN_BUTTON (autoraise_delay_spinbutton),
1, 5);
gtk_range_set_increments (GTK_RANGE (autoraise_delay_slider),
0.2, 1.0);
#if 0
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));
#endif
settings.flags = 0;
init_settings_struct (&settings);
@ -440,9 +468,9 @@ main (int argc, char **argv)
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);
set_alt_click_value (&settings);
gtk_range_set_value (GTK_RANGE (autoraise_delay_slider),
settings.autoraise_delay / 1000.0);
gtk_option_menu_set_history (GTK_OPTION_MENU (double_click_titlebar_optionmenu),
settings.double_click_action);
@ -461,18 +489,23 @@ main (int argc, char **argv)
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_signal_connect (G_OBJECT (autoraise_delay_slider), "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);
i = 0;
while (i < n_mouse_modifiers) {
g_signal_connect (G_OBJECT (mouse_modifiers[i].radio), "toggled",
G_CALLBACK (alt_click_radio_toggled_callback),
&mouse_modifiers[i]);
++i;
}
gtk_widget_show (dialog_win);
gtk_main ();
@ -483,6 +516,20 @@ main (int argc, char **argv)
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <gdk/gdkx.h>
static void
fill_radio (GtkRadioButton *group,
MouseClickModifier *modifier)
{
modifier->radio =
gtk_radio_button_new_with_label_from_widget (group,
modifier->name);
gtk_box_pack_start (GTK_BOX (alt_click_hbox),
modifier->radio, FALSE, FALSE, 0);
gtk_widget_show (modifier->radio);
}
static void
reload_mouse_modifiers (void)
{
@ -551,6 +598,8 @@ reload_mouse_modifiers (void)
i = 0;
while (i < n_mouse_modifiers) {
g_free (mouse_modifiers[i].name);
if (mouse_modifiers[i].radio)
gtk_widget_destroy (mouse_modifiers[i].radio);
++i;
}
g_free (mouse_modifiers);
@ -590,7 +639,7 @@ reload_mouse_modifiers (void)
if (have_super) {
mouse_modifiers[i].number = i;
mouse_modifiers[i].name = g_strdup (_("Super"));
mouse_modifiers[i].name = g_strdup (_("Super (or \"Windows logo\")"));
mouse_modifiers[i].value = "Super";
++i;
}
@ -604,6 +653,14 @@ reload_mouse_modifiers (void)
g_assert (i == n_mouse_modifiers);
i = 0;
while (i < n_mouse_modifiers) {
fill_radio (i == 0 ? NULL : GTK_RADIO_BUTTON (mouse_modifiers[i-1].radio),
&mouse_modifiers[i]);
++i;
}
#if 0
/* Build modifier option menu */
{
GtkWidget *menu;
@ -625,4 +682,5 @@ reload_mouse_modifiers (void)
gtk_option_menu_set_menu (GTK_OPTION_MENU (alt_click_optionmenu),
menu);
}
#endif
}

View file

@ -56,57 +56,21 @@
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<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="n_rows">11</property>
<property name="n_columns">20</property>
<property name="homogeneous">True</property>
<property name="row_spacing">0</property>
<property name="row_spacing">6</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>
@ -116,7 +80,7 @@
<child>
<widget class="GtkLabel" id="double-click-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Double-click window titles to:</property>
<property name="label" translatable="yes">_Double-click titlebar to perform this action:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -130,7 +94,7 @@
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@ -140,9 +104,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<accessibility>
<atkrelation target="double-click-label" type="labelled-by"/>
</accessibility>
<child>
<widget class="GtkMenu" id="menu1">
@ -152,19 +113,183 @@
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">14</property>
<property name="top_attach">7</property>
<property name="right_attach">20</property>
<property name="top_attach">6</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="autoraise-delay-hbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="autoraise-delay-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Interval before raising:</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>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="width_request">6</property>
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHScale" id="autoraise-delay-slider">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="draw_value">True</property>
<property name="value_pos">GTK_POS_RIGHT</property>
<property name="digits">1</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property>
<property name="adjustment">7.7 0 10 0.2 1 0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">seconds</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">4</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>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">20</property>
<property name="top_attach">4</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xscale">1</property>
<property name="yscale">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>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">20</property>
<property name="top_attach">0</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xscale">1</property>
<property name="yscale">0</property>
<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 an interval</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>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">20</property>
<property name="top_attach">2</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xscale">1</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox6">
<property name="visible">True</property>
@ -174,7 +299,7 @@
<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="label" translatable="yes">To _move a window, press-and-hold this key then grab the window:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -184,7 +309,6 @@
<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>
@ -192,57 +316,24 @@
<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="right_attach">20</property>
<property name="top_attach">9</property>
<property name="bottom_attach">11</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">6</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -252,33 +343,25 @@
</child>
<child>
<widget class="GtkSpinButton" id="autoraise-delay-spinbutton">
<widget class="GtkHBox" id="hbox7">
<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>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="alt-click-box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</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>
<property name="padding">9</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>