Rewritten to use bonobo-conf.
2001-07-18 Richard Hestilow <hestilow@ximian.com> * Rewritten to use bonobo-conf.
This commit is contained in:
parent
574cfdef9d
commit
59a807f174
9 changed files with 747 additions and 519 deletions
|
@ -0,0 +1,20 @@
|
|||
<oaf_info>
|
||||
|
||||
<oaf_server iid="OAFIID:Bonobo_Control_Capplet_keyboard_properties_Factory" type="exe" location="keyboard-properties-capplet">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/ObjectFactory:1.0"/>
|
||||
</oaf_attribute>
|
||||
|
||||
<oaf_attribute name="name" type="string" value="Keyboard properties capplet factory"/>
|
||||
</oaf_server>
|
||||
|
||||
<oaf_server iid="OAFIID:Bonobo_Control_Capplet_keyboard_properties" type="factory"
|
||||
location="OAFIID:Bonobo_Control_Capplet_keyboard_properties_Factory">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:Bonobo/PropertyControl:1.0"/>
|
||||
<item value="IDL:Bonobo/Unknown:1.0"/>
|
||||
</oaf_attribute>
|
||||
<oaf_attribute name="name" type="string" value="Keyboard properties capplet"/>
|
||||
</oaf_server>
|
||||
|
||||
</oaf_info>
|
|
@ -1,3 +1,7 @@
|
|||
2001-07-18 Richard Hestilow <hestilow@ximian.com>
|
||||
|
||||
* Rewritten to use bonobo-conf.
|
||||
|
||||
2001-07-18 Jakub Steiner <jimmac@ximian.com>
|
||||
|
||||
* keyboard-capplet.png: use the 3d version.
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
SUBDIRS =
|
||||
|
||||
defaultsdir= $(datadir)/control-center/defaults
|
||||
defaults_DATA = keyboard-properties.xml
|
||||
|
||||
oafdir = $(datadir)/oaf
|
||||
oaf_DATA = Bonobo_Control_Capplet_keyboard_properties.oaf
|
||||
|
||||
EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) $(oaf_DATA) $(defaults_DATA)
|
||||
|
||||
cappletname = keyboard
|
||||
bin_PROGRAMS = keyboard-properties
|
||||
|
||||
keyboard_properties_LDADD = @CAPPLET_LIBS@ $(XF86MISC_LIBS)
|
||||
keyboard_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(XF86MISC_LIBS)
|
||||
|
||||
keyboard_properties_SOURCES = \
|
||||
main.c \
|
||||
prefs-widget.c prefs-widget.h \
|
||||
preferences.c preferences.h
|
||||
bonobo-property-editor-range.c \
|
||||
bonobo-property-editor-range.h
|
||||
|
||||
##
|
||||
## You should not need to modify anything below this line
|
||||
|
|
70
capplets/keyboard/bonobo-property-editor-range.c
Normal file
70
capplets/keyboard/bonobo-property-editor-range.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <bonobo-conf/bonobo-property-editor.h>
|
||||
#include <gtk/gtkrange.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <bonobo.h>
|
||||
|
||||
static void
|
||||
changed_cb (GtkAdjustment *adj, BonoboPEditor *editor)
|
||||
{
|
||||
CORBA_Environment ev;
|
||||
DynamicAny_DynAny dyn;
|
||||
BonoboArg *arg;
|
||||
gulong val;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
val = adj->value;
|
||||
|
||||
dyn = CORBA_ORB_create_basic_dyn_any (bonobo_orb (), TC_ulong, &ev);
|
||||
DynamicAny_DynAny_insert_ulong (dyn, val, &ev);
|
||||
|
||||
if (BONOBO_EX (&ev) || dyn == NULL)
|
||||
return;
|
||||
|
||||
arg = DynamicAny_DynAny_to_any (dyn, &ev);
|
||||
bonobo_peditor_set_value (editor, arg, &ev);
|
||||
|
||||
bonobo_arg_release (arg);
|
||||
CORBA_Object_release ((CORBA_Object) dyn, &ev);
|
||||
CORBA_exception_free (&ev);
|
||||
}
|
||||
|
||||
static void
|
||||
adj_set_value_cb (BonoboPEditor *editor,
|
||||
BonoboArg *value,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
gulong v;
|
||||
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (bonobo_peditor_get_widget (editor)));
|
||||
|
||||
if (!bonobo_arg_type_is_equal (value->_type, TC_ulong, NULL))
|
||||
return;
|
||||
|
||||
v = BONOBO_ARG_GET_GENERAL (value, TC_ulong, CORBA_unsigned_long, NULL);
|
||||
|
||||
gtk_signal_handler_block_by_func (GTK_OBJECT (adj), changed_cb,
|
||||
editor);
|
||||
|
||||
gtk_adjustment_set_value (adj, v);
|
||||
|
||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), changed_cb,
|
||||
editor);
|
||||
}
|
||||
|
||||
GtkObject* bonobo_peditor_range_construct (GtkWidget *widget)
|
||||
{
|
||||
BonoboPEditor *editor;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_RANGE (widget), NULL);
|
||||
|
||||
editor = bonobo_peditor_construct (widget, adj_set_value_cb, TC_ulong);
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (changed_cb), editor);
|
||||
|
||||
return GTK_OBJECT (editor);
|
||||
}
|
8
capplets/keyboard/bonobo-property-editor-range.h
Normal file
8
capplets/keyboard/bonobo-property-editor-range.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef __BONOBO_PROPERTY_RANGE_SCALE_H__
|
||||
#define __BONOBO_PROPERTY_RANGE_SCALE_H__
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
GtkObject* bonobo_peditor_range_construct (GtkWidget *widget);
|
||||
|
||||
#endif /* __BONOBO_PROPERTY_RANGE_SCALE_H__ */
|
|
@ -10,6 +10,8 @@
|
|||
<language>C</language>
|
||||
<gnome_support>True</gnome_support>
|
||||
<gettext_support>True</gettext_support>
|
||||
<output_translatable_strings>True</output_translatable_strings>
|
||||
<translatable_strings_file>keyboard-properties.glade.h</translatable_strings_file>
|
||||
</project>
|
||||
|
||||
<widget>
|
||||
|
@ -24,8 +26,21 @@
|
|||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<class>GtkNotebook</class>
|
||||
<name>prefs_widget</name>
|
||||
<can_focus>True</can_focus>
|
||||
<show_tabs>True</show_tabs>
|
||||
<show_border>True</show_border>
|
||||
<tab_pos>GTK_POS_TOP</tab_pos>
|
||||
<scrollable>False</scrollable>
|
||||
<tab_hborder>2</tab_hborder>
|
||||
<tab_vborder>2</tab_vborder>
|
||||
<popup_enable>False</popup_enable>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>keyboard_vbox</name>
|
||||
<border_width>4</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>4</spacing>
|
||||
|
||||
|
@ -49,224 +64,125 @@
|
|||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>delay_frame</name>
|
||||
<label>Delay Until Repeat</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>repeat_table</name>
|
||||
<rows>2</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>4</row_spacing>
|
||||
<column_spacing>4</column_spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<padding>4</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox2</name>
|
||||
<border_width>4</border_width>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>4</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label5</name>
|
||||
<label></label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>delay0</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>....a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>delay1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>...a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>delay2</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>..a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>delay3</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>.a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label6</name>
|
||||
<label></label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>repeat_frame</name>
|
||||
<label>Key Repeat Rate</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<border_width>4</border_width>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>4</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label7</name>
|
||||
<label></label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>repeat0</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>a....a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>repeat1</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>a...a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>repeat2</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>a..a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkToggleButton</class>
|
||||
<name>repeat3</name>
|
||||
<can_focus>True</can_focus>
|
||||
<label>a.a</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<active>False</active>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8</name>
|
||||
<label></label>
|
||||
<label>Delay until repeat:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label9</name>
|
||||
<label>Key repeat rate:</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>delay_menu</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>Very long
|
||||
Long
|
||||
Medium
|
||||
Short
|
||||
</items>
|
||||
<initial_choice>2</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>repeat_menu</name>
|
||||
<can_focus>True</can_focus>
|
||||
<items>Very fast
|
||||
Fast
|
||||
Medium
|
||||
Slow
|
||||
</items>
|
||||
<initial_choice>2</initial_choice>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
|
@ -290,24 +206,16 @@
|
|||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>click_frame</name>
|
||||
<label>Keyboard click</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<class>GtkHBox</class>
|
||||
<name>click_hbox</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>4</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox4</name>
|
||||
<border_width>4</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>4</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label3</name>
|
||||
|
@ -346,16 +254,257 @@
|
|||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>test_entry</name>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>Notebook:tab</child_name>
|
||||
<name>label8</name>
|
||||
<label>Keyboard</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table1</name>
|
||||
<border_width>4</border_width>
|
||||
<rows>4</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>4</row_spacing>
|
||||
<column_spacing>4</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label11</name>
|
||||
<label>Volume</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label12</name>
|
||||
<label>Pitch (Hz)</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label13</name>
|
||||
<label>Duration (ms)</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHScale</class>
|
||||
<name>bell_volume_range</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text>Type here to test setting</text>
|
||||
<draw_value>True</draw_value>
|
||||
<value_pos>GTK_POS_TOP</value_pos>
|
||||
<digits>0</digits>
|
||||
<policy>GTK_UPDATE_CONTINUOUS</policy>
|
||||
<value>0</value>
|
||||
<lower>0</lower>
|
||||
<upper>100</upper>
|
||||
<step>0</step>
|
||||
<page>0</page>
|
||||
<page_size>0</page_size>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHScale</class>
|
||||
<name>bell_pitch_range</name>
|
||||
<can_focus>True</can_focus>
|
||||
<draw_value>True</draw_value>
|
||||
<value_pos>GTK_POS_TOP</value_pos>
|
||||
<digits>0</digits>
|
||||
<policy>GTK_UPDATE_CONTINUOUS</policy>
|
||||
<value>0</value>
|
||||
<lower>0</lower>
|
||||
<upper>2000</upper>
|
||||
<step>0</step>
|
||||
<page>0</page>
|
||||
<page_size>0</page_size>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHScale</class>
|
||||
<name>bell_duration_range</name>
|
||||
<can_focus>True</can_focus>
|
||||
<draw_value>True</draw_value>
|
||||
<value_pos>GTK_POS_TOP</value_pos>
|
||||
<digits>0</digits>
|
||||
<policy>GTK_UPDATE_CONTINUOUS</policy>
|
||||
<value>0</value>
|
||||
<lower>0</lower>
|
||||
<upper>500</upper>
|
||||
<step>0</step>
|
||||
<page>0</page>
|
||||
<page_size>0</page_size>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>bell_test_button</name>
|
||||
<border_width>4</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>3</top_attach>
|
||||
<bottom_attach>4</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>False</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox1</name>
|
||||
<border_width>4</border_width>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>bell_test_holder</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label14</name>
|
||||
<label>Test</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
|
@ -363,6 +512,22 @@
|
|||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>Notebook:tab</child_name>
|
||||
<name>label9</name>
|
||||
<label>Bell</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
|
26
capplets/keyboard/keyboard-properties.glade.h
Normal file
26
capplets/keyboard/keyboard-properties.glade.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Translatable strings file generated by Glade.
|
||||
* Add this file to your project's POTFILES.in.
|
||||
* DO NOT compile it as part of your application.
|
||||
*/
|
||||
|
||||
gchar *s = N_("window1");
|
||||
gchar *s = N_("Enable Keyboard Repeat");
|
||||
gchar *s = N_("Delay until repeat:");
|
||||
gchar *s = N_("Key repeat rate:");
|
||||
gchar *s = N_("Very long");
|
||||
gchar *s = N_("Long");
|
||||
gchar *s = N_("Medium");
|
||||
gchar *s = N_("Short");
|
||||
gchar *s = N_("Very fast");
|
||||
gchar *s = N_("Fast");
|
||||
gchar *s = N_("Medium");
|
||||
gchar *s = N_("Slow");
|
||||
gchar *s = N_("Enable Keyboard Click");
|
||||
gchar *s = N_("Click volume");
|
||||
gchar *s = N_("Keyboard");
|
||||
gchar *s = N_("Volume");
|
||||
gchar *s = N_("Pitch (Hz)");
|
||||
gchar *s = N_("Duration (ms)");
|
||||
gchar *s = N_("Test");
|
||||
gchar *s = N_("Bell");
|
12
capplets/keyboard/keyboard-properties.xml
Normal file
12
capplets/keyboard/keyboard-properties.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<bonobo-config>
|
||||
<section path="main">
|
||||
<entry name="repeat" type="boolean" value="true"/>
|
||||
<entry name="click" type="boolean" value="true"/>
|
||||
<entry name="delay" type="ulong" value="500"/>
|
||||
<entry name="volume" type="ulong" value="0"/>
|
||||
<entry name="bell_volume" type="ulong" value="54"/>
|
||||
<entry name="bell_pitch" type="ulong" value="400"/>
|
||||
<entry name="bell_duration" type="ulong" value="100"/>
|
||||
</section>
|
||||
</bonobo-config>
|
|
@ -1,10 +1,10 @@
|
|||
/* -*- mode: c; style: linux -*- */
|
||||
|
||||
/* main.c
|
||||
* Copyright (C) 2000 Helix Code, Inc.
|
||||
*
|
||||
* Written by Bradford Hovinen (hovinen@helixcode.com)
|
||||
* Copyright (C) 2000-2001 Ximian, Inc.
|
||||
*
|
||||
* Written by: Bradford Hovinen <hovinen@ximian.com>
|
||||
* Richard Hestilow <hestilow@ximian.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
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
|
@ -25,276 +25,190 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gnome.h>
|
||||
#include <libgnomeui/gnome-window-icon.h>
|
||||
#include <tree.h>
|
||||
#include <parser.h>
|
||||
#include <fcntl.h>
|
||||
#include "capplet-util.h"
|
||||
#include "bonobo-property-editor-range.h"
|
||||
|
||||
#include <glade/glade.h>
|
||||
#include <libgnomeui/gnome-window-icon.h>
|
||||
|
||||
#include <capplet-widget.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/X.h>
|
||||
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
# include <ximian-archiver/archive.h>
|
||||
# include <ximian-archiver/location.h>
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
|
||||
#include "preferences.h"
|
||||
#include "prefs-widget.h"
|
||||
|
||||
static Preferences *prefs;
|
||||
static Preferences *old_prefs;
|
||||
static PrefsWidget *prefs_widget;
|
||||
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
|
||||
static Archive *archive;
|
||||
static gboolean outside_location;
|
||||
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
||||
#include <X11/extensions/xf86misc.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
store_archive_data (void)
|
||||
apply_settings (Bonobo_ConfigDatabase db)
|
||||
{
|
||||
Location *location;
|
||||
xmlDocPtr xml_doc;
|
||||
gboolean repeat, click;
|
||||
int rate, delay, volume;
|
||||
int bell_volume, bell_pitch, bell_duration;
|
||||
|
||||
if (capplet_get_location () == NULL)
|
||||
location = archive_get_current_location (archive);
|
||||
else
|
||||
location = archive_get_location (archive,
|
||||
capplet_get_location ());
|
||||
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
||||
XF86MiscKbdSettings kbdsettings;
|
||||
#endif
|
||||
XKeyboardControl kbdcontrol;
|
||||
int event_base_return, error_base_return;
|
||||
|
||||
xml_doc = preferences_write_xml (prefs);
|
||||
location_store_xml (location, "keyboard-properties-capplet",
|
||||
xml_doc, STORE_MASK_PREVIOUS);
|
||||
xmlFreeDoc (xml_doc);
|
||||
archive_close (archive);
|
||||
}
|
||||
repeat = bonobo_config_get_boolean (db, "/main/repeat", NULL);
|
||||
click = bonobo_config_get_boolean (db, "/main/click", NULL);
|
||||
rate = bonobo_config_get_ulong (db, "/main/rate", NULL);
|
||||
delay = bonobo_config_get_ulong (db, "/main/delay", NULL);
|
||||
volume = bonobo_config_get_ulong (db, "/main/volume", NULL);
|
||||
bell_volume = bonobo_config_get_ulong (db, "/main/bell_volume", NULL);
|
||||
bell_pitch = bonobo_config_get_ulong (db, "/main/bell_pitch", NULL);
|
||||
bell_duration = bonobo_config_get_ulong (db, "/main/bell_duration", NULL);
|
||||
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
|
||||
static void
|
||||
ok_cb (GtkWidget *widget)
|
||||
{
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
if (!outside_location) {
|
||||
preferences_save (prefs);
|
||||
preferences_apply_now (prefs);
|
||||
}
|
||||
#else /* !HAVE_XIMIAN_ARCHIVER */
|
||||
preferences_save (old_prefs);
|
||||
preferences_apply_now (old_prefs);
|
||||
#endif /* !HAVE_XIMIAN_ARCHIVER */
|
||||
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
store_archive_data ();
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_cb (GtkWidget *widget)
|
||||
{
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
if (!outside_location) {
|
||||
preferences_save (old_prefs);
|
||||
preferences_apply_now (old_prefs);
|
||||
}
|
||||
#else /* !HAVE_XIMIAN_ARCHIVER */
|
||||
preferences_save (old_prefs);
|
||||
preferences_apply_now (old_prefs);
|
||||
#endif /* !HAVE_XIMIAN_ARCHIVER */
|
||||
}
|
||||
|
||||
static void
|
||||
setup_capplet_widget (void)
|
||||
{
|
||||
preferences_freeze (prefs);
|
||||
|
||||
prefs_widget = PREFS_WIDGET (prefs_widget_new (prefs));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (prefs_widget), "ok",
|
||||
GTK_SIGNAL_FUNC (ok_cb), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (prefs_widget), "cancel",
|
||||
GTK_SIGNAL_FUNC (cancel_cb), NULL);
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (prefs_widget));
|
||||
|
||||
preferences_thaw (prefs);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
|
||||
static void
|
||||
do_get_xml (void)
|
||||
{
|
||||
Preferences *prefs;
|
||||
xmlDocPtr doc;
|
||||
|
||||
prefs = PREFERENCES (preferences_new ());
|
||||
preferences_load (prefs);
|
||||
doc = preferences_write_xml (prefs);
|
||||
xmlDocDump (stdout, doc);
|
||||
gtk_object_destroy (GTK_OBJECT (prefs));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_set_xml (gboolean apply_settings)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
char buffer[16384];
|
||||
GString *doc_str;
|
||||
int t = 0;
|
||||
|
||||
fflush (stdin);
|
||||
|
||||
fcntl (fileno (stdin), F_SETFL, 0);
|
||||
|
||||
doc_str = g_string_new ("");
|
||||
|
||||
while ((t = read (fileno (stdin), buffer, sizeof (buffer) - 1)) != 0) {
|
||||
buffer[t] = '\0';
|
||||
g_string_append (doc_str, buffer);
|
||||
}
|
||||
|
||||
if (doc_str->len > 0) {
|
||||
doc = xmlParseDoc (doc_str->str);
|
||||
g_string_free (doc_str, TRUE);
|
||||
|
||||
if (doc != NULL) {
|
||||
prefs = preferences_read_xml (doc);
|
||||
|
||||
if (prefs != NULL) {
|
||||
if (apply_settings) {
|
||||
preferences_save (prefs);
|
||||
preferences_apply_now (prefs);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (prefs != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
xmlFreeDoc (doc);
|
||||
}
|
||||
if (repeat) {
|
||||
XAutoRepeatOn (GDK_DISPLAY ());
|
||||
#ifdef HAVE_X11_EXTENSIONS_XF86MISC_H
|
||||
if (XF86MiscQueryExtension (GDK_DISPLAY (),
|
||||
&event_base_return,
|
||||
&error_base_return) == True)
|
||||
{
|
||||
kbdsettings.rate = rate;
|
||||
kbdsettings.delay = delay;
|
||||
XF86MiscSetKbdSettings (GDK_DISPLAY (), &kbdsettings);
|
||||
} else {
|
||||
g_critical ("No data to apply");
|
||||
XAutoRepeatOff (GDK_DISPLAY ());
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
XAutoRepeatOff (GDK_DISPLAY ());
|
||||
}
|
||||
|
||||
return;
|
||||
kbdcontrol.key_click_percent =
|
||||
click ? volume : 0;
|
||||
kbdcontrol.bell_percent = bell_volume;
|
||||
kbdcontrol.bell_pitch = bell_pitch;
|
||||
kbdcontrol.bell_duration = bell_duration;
|
||||
XChangeKeyboardControl (GDK_DISPLAY (), KBKeyClickPercent,
|
||||
&kbdcontrol);
|
||||
}
|
||||
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
static gulong
|
||||
get_value_ulong (Bonobo_PropertyBag bag, const gchar *prop)
|
||||
{
|
||||
BonoboArg *arg;
|
||||
gulong val;
|
||||
|
||||
arg = bonobo_property_bag_client_get_value_any (bag, prop, NULL);
|
||||
val = BONOBO_ARG_GET_GENERAL (arg, TC_ulong, CORBA_unsigned_long, NULL);
|
||||
bonobo_arg_release (arg);
|
||||
return val;
|
||||
}
|
||||
|
||||
static void
|
||||
do_restore_from_defaults (void)
|
||||
bell_cb (GtkWidget *widget, Bonobo_PropertyBag bag)
|
||||
{
|
||||
prefs = PREFERENCES (preferences_new ());
|
||||
preferences_save (prefs);
|
||||
preferences_apply_now (prefs);
|
||||
XKeyboardState backup;
|
||||
XKeyboardControl kbdcontrol;
|
||||
|
||||
XGetKeyboardControl (GDK_DISPLAY (), &backup);
|
||||
|
||||
kbdcontrol.bell_percent = get_value_ulong (bag, "bell_volume");
|
||||
kbdcontrol.bell_pitch = get_value_ulong (bag, "bell_pitch");
|
||||
kbdcontrol.bell_duration = get_value_ulong (bag, "bell_duration");
|
||||
XChangeKeyboardControl (GDK_DISPLAY (),
|
||||
KBBellPercent | KBBellPitch | KBBellDuration,
|
||||
&kbdcontrol);
|
||||
XBell (GDK_DISPLAY (), 0);
|
||||
|
||||
kbdcontrol.bell_percent = backup.bell_percent;
|
||||
kbdcontrol.bell_pitch = backup.bell_pitch;
|
||||
kbdcontrol.bell_duration = backup.bell_duration;
|
||||
|
||||
XChangeKeyboardControl (GDK_DISPLAY (),
|
||||
KBBellPercent | KBBellPitch | KBBellDuration,
|
||||
&kbdcontrol);
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
create_dialog (Bonobo_PropertyBag bag)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
GtkWidget *widget, *pixmap;
|
||||
|
||||
dialog = glade_xml_new (GLADE_DATADIR "/keyboard-properties.glade", "prefs_widget");
|
||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
||||
gtk_object_set_data (GTK_OBJECT (widget), "glade-data", dialog);
|
||||
|
||||
/* Minor GUI addition */
|
||||
pixmap = gnome_stock_pixmap_widget (WID ("bell_test_button"),
|
||||
GNOME_STOCK_PIXMAP_VOLUME);
|
||||
gtk_box_pack_start (GTK_BOX (WID ("bell_test_holder")), pixmap,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (WID ("bell_test_button"));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (WID ("bell_test_button")),
|
||||
"clicked", bell_cb, bag);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (widget), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_object_destroy),
|
||||
GTK_OBJECT (dialog));
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dialog (GtkWidget *widget, Bonobo_PropertyBag bag)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
BonoboPEditor *ed;
|
||||
|
||||
dialog = gtk_object_get_data (GTK_OBJECT (widget), "glade-data");
|
||||
|
||||
CREATE_PEDITOR (boolean, "repeat", "repeat_toggle");
|
||||
|
||||
ed = BONOBO_PEDITOR (bonobo_peditor_option_construct (0, WID ("delay_menu")));
|
||||
bonobo_peditor_set_property (ed, bag, "delay", TC_ulong, NULL);
|
||||
|
||||
ed = BONOBO_PEDITOR (bonobo_peditor_option_construct (0, WID ("repeat_menu")));
|
||||
bonobo_peditor_set_property (ed, bag, "rate", TC_ulong, NULL);
|
||||
bonobo_peditor_set_guard (WID ("repeat_table"), bag, "repeat");
|
||||
|
||||
CREATE_PEDITOR (boolean, "click", "click_toggle");
|
||||
|
||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("click_volume_entry")));
|
||||
bonobo_peditor_set_property (ed, bag, "volume", TC_ulong, NULL);
|
||||
bonobo_peditor_set_guard (WID ("click_hbox"), bag, "click");
|
||||
|
||||
/* Bell properties */
|
||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("bell_volume_range")));
|
||||
bonobo_peditor_set_property (ed, bag, "bell_volume", TC_ulong, NULL);
|
||||
|
||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("bell_pitch_range")));
|
||||
bonobo_peditor_set_property (ed, bag, "bell_pitch", TC_ulong, NULL);
|
||||
|
||||
ed = BONOBO_PEDITOR (bonobo_peditor_range_construct (WID ("bell_duration_range")));
|
||||
bonobo_peditor_set_property (ed, bag, "bell_duration", TC_ulong, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
get_legacy_settings (Bonobo_ConfigDatabase db)
|
||||
{
|
||||
gboolean val_boolean, def;
|
||||
gulong val_ulong;
|
||||
|
||||
COPY_FROM_LEGACY (boolean, "/main/repeat", bool, "/Desktop/Keyboard/repeat=true");
|
||||
COPY_FROM_LEGACY (boolean, "/main/click", bool, "/Desktop/Keyboard/click=true");
|
||||
COPY_FROM_LEGACY (ulong, "/main/rate", int, "/Desktop/Keyboard/rate=30");
|
||||
COPY_FROM_LEGACY (ulong, "/main/delay", int, "/Desktop/Keyboard/delay=500");
|
||||
COPY_FROM_LEGACY (ulong, "/main/volume", int, "/Desktop/Keyboard/clickvolume=0");
|
||||
COPY_FROM_LEGACY (ulong, "/main/bell_volume", int, "/Desktop/Bell/percent=50");
|
||||
COPY_FROM_LEGACY (ulong, "/main/bell_pitch", int, "/Desktop/Bell/pitch=50");
|
||||
COPY_FROM_LEGACY (ulong, "/main/bell_duration", int, "/Desktop/Bell/duration=100");
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GnomeClient *client;
|
||||
GnomeClientFlags flags;
|
||||
gint token, res;
|
||||
gchar *restart_args[3];
|
||||
|
||||
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
glade_gnome_init ();
|
||||
res = gnome_capplet_init ("keyboard-properties-capplet",
|
||||
VERSION, argc, argv, NULL,
|
||||
0, NULL);
|
||||
|
||||
if (res < 0) {
|
||||
g_error ("Could not initialize the capplet.");
|
||||
}
|
||||
else if (res == 3) {
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
do_get_xml ();
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
return 0;
|
||||
}
|
||||
else if (res == 4) {
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
do_set_xml (TRUE);
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
return 0;
|
||||
}
|
||||
else if (res == 5) {
|
||||
do_restore_from_defaults ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
client = gnome_master_client ();
|
||||
flags = gnome_client_get_flags (client);
|
||||
|
||||
if (flags & GNOME_CLIENT_IS_CONNECTED) {
|
||||
token = gnome_startup_acquire_token
|
||||
("GNOME_KEYBOARD_PROPERTIES",
|
||||
gnome_client_get_id (client));
|
||||
|
||||
if (token) {
|
||||
gnome_client_set_priority (client, 20);
|
||||
gnome_client_set_restart_style (client,
|
||||
GNOME_RESTART_ANYWAY);
|
||||
restart_args[0] = argv[0];
|
||||
restart_args[1] = "--init-session-settings";
|
||||
restart_args[2] = NULL;
|
||||
gnome_client_set_restart_command (client, 2,
|
||||
restart_args);
|
||||
} else {
|
||||
gnome_client_set_restart_style (client,
|
||||
GNOME_RESTART_NEVER);
|
||||
}
|
||||
} else {
|
||||
token = 1;
|
||||
}
|
||||
capplet_init (argc, argv, apply_settings, create_dialog, setup_dialog, get_legacy_settings);
|
||||
|
||||
gnome_window_icon_set_default_from_file
|
||||
(GNOMECC_ICONS_DIR"keyboard-capplet.png.png");
|
||||
|
||||
#ifdef HAVE_XIMIAN_ARCHIVER
|
||||
archive = ARCHIVE (archive_load (FALSE));
|
||||
|
||||
if (capplet_get_location () != NULL &&
|
||||
strcmp (capplet_get_location (),
|
||||
archive_get_current_location_id (archive)))
|
||||
{
|
||||
outside_location = TRUE;
|
||||
do_set_xml (FALSE);
|
||||
if (prefs == NULL) return -1;
|
||||
preferences_freeze (prefs);
|
||||
} else {
|
||||
outside_location = FALSE;
|
||||
prefs = PREFERENCES (preferences_new ());
|
||||
preferences_load (prefs);
|
||||
}
|
||||
|
||||
if (!outside_location && token) {
|
||||
preferences_apply_now (prefs);
|
||||
}
|
||||
|
||||
#else /* !HAVE_XIMIAN_ARCHIVER */
|
||||
|
||||
prefs = PREFERENCES (preferences_new ());
|
||||
preferences_load (prefs);
|
||||
if (token) preferences_apply_now (prefs);
|
||||
|
||||
#endif /* HAVE_XIMIAN_ARCHIVER */
|
||||
|
||||
if (!res) {
|
||||
old_prefs = PREFERENCES (preferences_clone (prefs));
|
||||
setup_capplet_widget ();
|
||||
|
||||
capplet_gtk_main ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue