summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Berkman <jberkman@src.gnome.org>2000-12-26 19:41:33 +0000
committerJacob Berkman <jberkman@src.gnome.org>2000-12-26 19:41:33 +0000
commitd42affc965faa45228a91c6e8997927fcbc00b35 (patch)
tree1980d15877fa433c382aa401a20be452116ccc54
parent2749ba455bdfb374dd8345a3472c876cabd53855 (diff)
downloadgnome-control-center-d42affc965faa45228a91c6e8997927fcbc00b35.tar.gz
Merging of my tree.
This contains: * a few capplets were redone UI wise: ui-properties keyboard background-properties * splitting of libcapplet out of this modules (into libcapplet) * new html-based view in the control-center * initial import of functional root-manager This stuff isn't all done yet, but I wanted to get it in. TODO files will hopefully follow.
-rw-r--r--ChangeLog15
-rw-r--r--Makefile.am9
-rw-r--r--capplets/background/.cvsignore1
-rw-r--r--capplets/background/Makefile.am17
-rw-r--r--capplets/background/applier.c7
-rw-r--r--capplets/background/background-properties.glade973
-rw-r--r--capplets/background/background-properties.glade.h23
-rw-r--r--capplets/background/preferences.c76
-rw-r--r--capplets/background/preferences.h2
-rw-r--r--capplets/background/prefs-widget.c845
-rw-r--r--capplets/background/prefs-widget.h3
-rw-r--r--capplets/keyboard/.cvsignore2
-rw-r--r--capplets/keyboard/ChangeLog4
-rw-r--r--capplets/keyboard/Makefile.am23
-rw-r--r--capplets/keyboard/keyboard-properties.glade440
-rw-r--r--capplets/keyboard/keyboard-properties.glade.h20
-rw-r--r--capplets/keyboard/preferences.c38
-rw-r--r--capplets/keyboard/preferences.h7
-rw-r--r--capplets/keyboard/prefs-widget.c105
-rw-r--r--capplets/keyboard/prefs-widget.h3
-rw-r--r--capplets/mouse/.cvsignore1
-rw-r--r--capplets/mouse/Makefile.am17
-rw-r--r--capplets/screensaver/.cvsignore1
-rw-r--r--capplets/screensaver/Makefile.am23
-rw-r--r--capplets/sound/.cvsignore1
-rw-r--r--capplets/sound/Makefile.am18
-rw-r--r--capplets/theme-switcher/Makefile.am13
-rw-r--r--capplets/ui-properties/.cvsignore1
-rw-r--r--capplets/ui-properties/Makefile.am25
-rw-r--r--capplets/ui-properties/behavior.desktop (renamed from capplets/ui-properties/application.desktop)6
-rw-r--r--capplets/ui-properties/dialogs.desktop30
-rw-r--r--capplets/ui-properties/main.c31
-rw-r--r--capplets/ui-properties/mdi.desktop26
-rw-r--r--capplets/ui-properties/pixmaps/gnome-warning.pngbin0 -> 1968 bytes
-rw-r--r--capplets/ui-properties/preferences.c55
-rw-r--r--capplets/ui-properties/preferences.h104
-rw-r--r--capplets/ui-properties/prefs-widget.c104
-rw-r--r--capplets/ui-properties/prefs-widget.h4
-rw-r--r--capplets/ui-properties/ui-properties.glade1445
-rw-r--r--capplets/ui-properties/ui-properties.glade.h91
-rw-r--r--capplets/url-properties/Makefile.am13
-rw-r--r--capplets/wm-properties/Makefile.am13
-rw-r--r--configure.in42
-rw-r--r--control-center/.cvsignore4
-rw-r--r--control-center/ChangeLog5
-rw-r--r--control-center/Makefile.am22
-rw-r--r--control-center/capplet-dir-view-html.c215
-rw-r--r--control-center/capplet-dir-view-list.c175
-rw-r--r--control-center/capplet-dir-view-tree.c195
-rw-r--r--control-center/capplet-dir-view.c771
-rw-r--r--control-center/capplet-dir-view.h54
-rw-r--r--control-center/capplet-dir.c194
-rw-r--r--control-center/capplet-dir.h15
-rw-r--r--control-center/gnomecc-preferences.glade237
-rw-r--r--control-center/gnomecc.glade699
-rw-r--r--control-center/gnomecc.glade.h18
-rw-r--r--control-center/pixmaps/gnome-lockscreen.pngbin0 -> 2770 bytes
-rw-r--r--control-center/pixmaps/gnome-unlockscreen.pngbin0 -> 2617 bytes
-rw-r--r--control-center/preferences.c65
-rw-r--r--control-center/preferences.h5
-rw-r--r--control-center/root-manager.c80
-rw-r--r--root-manager/.cvsignore6
-rw-r--r--root-manager/Makefile.am26
-rw-r--r--root-manager/TODO1
-rw-r--r--root-manager/root-manager-helper.c71
-rw-r--r--root-manager/root-manager-wrap.c528
-rw-r--r--root-manager/root-manager-wrap.h68
-rw-r--r--root-manager/root-manager.c713
-rw-r--r--root-manager/root-manager.h53
-rw-r--r--root-manager/shvar.c377
-rw-r--r--root-manager/shvar.h100
-rw-r--r--root-manager/userdialogs.c229
-rw-r--r--root-manager/userdialogs.h42
73 files changed, 6445 insertions, 3200 deletions
diff --git a/ChangeLog b/ChangeLog
index a940239da..3d8adae45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-12-26 Jacob "Ulysses" Berkman <jacob@helixcode.com>
+
+ * root-manager/root-manager.c: tool based on usermode /
+ consolehelper to launch setup tools with root privaleges
+
+ * capplets/new-ui-properties/ui-properties.glade: merged the 3
+ capplets into one
+
+ * capplets/new-background-properties/background-properties.glade:
+ re-did the UI a bit. The code doesn't yet work correctly.
+
+ * configure.in: add checks for libcapplet and fixup directories
+
+ * Makefile.am: remove libcapplet and add root-manager
+
2000-12-22 Bradford Hovinen <hovinen@helixcode.com>
* capplets/new-background-properties/applier.c
diff --git a/Makefile.am b/Makefile.am
index 6e7c98bd8..18dd96e7c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,4 @@
-
-always_built_SUBDIRS = new-control-center libcapplet capplets idl
-
-SUBDIRS = intl \
- $(always_built_SUBDIRS) po
-
-#DIST_SUBDIRS = intl po macros $(always_built_SUBDIRS)
-
+SUBDIRS = intl po capplets root-manager new-control-center
EXTRA_DIST = control-center.spec.in
diff --git a/capplets/background/.cvsignore b/capplets/background/.cvsignore
index f299a28c8..fc867e961 100644
--- a/capplets/background/.cvsignore
+++ b/capplets/background/.cvsignore
@@ -5,3 +5,4 @@ Makefile.in
*.o
*.lo
*.la
+background-properties-capplet
diff --git a/capplets/background/Makefile.am b/capplets/background/Makefile.am
index 603085958..0e31ad5fe 100644
--- a/capplets/background/Makefile.am
+++ b/capplets/background/Makefile.am
@@ -2,6 +2,10 @@ Applicationsdir = $(datadir)/control-center/Desktop
Applications_DATA = \
background-properties.desktop
+pApplicationsdir = $(datadir)/gnome/apps/Settings/Desktop
+pApplications_DATA = \
+ background-properties.desktop
+
Gladedir = $(datadir)/control-center-data
Glade_DATA = \
background-properties.glade
@@ -16,10 +20,8 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DG_LOG_DOMAIN=\"background-properties\" \
-DGLADE_DATADIR=\""$(Gladedir)"\" \
- -I$(top_srcdir)/libcapplet \
$(GNOME_INCLUDEDIR) \
- $(LIBGLADE_CFLAGS) \
- $(XML_CFLAGS) \
+ $(BG_CAPPLET_CFLAGS) \
-I$(top_srcdir)/ \
-I$(top_srcdir)/intl
@@ -32,11 +34,4 @@ background_properties_capplet_SOURCES = \
main.c
background_properties_capplet_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(ORBIT_LIBS) \
- $(GNOME_XML_LIB) \
- $(LIBGLADE_LIBS) \
- -lgdk_pixbuf \
- -lgdk_pixbuf_xlib \
- ../../libcapplet/libcapplet.la
+ $(GNOME_LIBDIR) $(BG_CAPPLET_LIBS)
diff --git a/capplets/background/applier.c b/capplets/background/applier.c
index f57ee93fa..7527828fc 100644
--- a/capplets/background/applier.c
+++ b/capplets/background/applier.c
@@ -347,6 +347,13 @@ applier_apply_prefs (Applier *applier, Preferences *prefs,
g_strdup (prefs->wallpaper_filename);
applier->private->wallpaper_pixbuf =
gdk_pixbuf_new_from_file (prefs->wallpaper_filename);
+
+ if (!applier->private->wallpaper_pixbuf) {
+#warning FIXME: should be a dialog
+ g_warning (_("Could not load pixbuf \"%s\"; disabling wallpaper."),
+ prefs->wallpaper_filename);
+ prefs->wallpaper_enabled = FALSE;
+ }
}
if (do_preview) {
diff --git a/capplets/background/background-properties.glade b/capplets/background/background-properties.glade
index 9c2e1e53c..ccc4ba156 100644
--- a/capplets/background/background-properties.glade
+++ b/capplets/background/background-properties.glade
@@ -26,631 +26,455 @@
<auto_shrink>False</auto_shrink>
<widget>
- <class>GtkTable</class>
+ <class>GtkVBox</class>
<name>prefs_widget</name>
- <border_width>5</border_width>
- <rows>5</rows>
- <columns>2</columns>
<homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
+ <spacing>0</spacing>
<widget>
- <class>GtkFrame</class>
- <name>color_frame</name>
- <label>Color</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <class>GtkEventBox</class>
+ <name>monitor_frame</name>
<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>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
<widget>
- <class>GtkTable</class>
- <name>table2</name>
- <border_width>5</border_width>
- <rows>5</rows>
- <columns>3</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
- <widget>
- <class>GtkVSeparator</class>
- <name>vseparator1</name>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>disable_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>disable_toggled_cb</handler>
+ <last_modification_time>Wed, 06 Sep 2000 00:15:45 GMT</last_modification_time>
+ </signal>
+ <label>Use GNOME for setting background</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>Color 1</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</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>False</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox2</name>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
- <widget>
- <class>GtkLabel</class>
- <name>color2_label</name>
- <label>Color 2</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <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>
+ <widget>
+ <class>GtkFrame</class>
+ <name>color_frame</name>
+ <label>Colors</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
<widget>
- <class>GnomeColorPicker</class>
- <name>color1_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>color_set</name>
- <handler>color1_select_color_set_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:13:53 GMT</last_modification_time>
- </signal>
- <dither>True</dither>
- <use_alpha>False</use_alpha>
- <title>Pick a color</title>
- <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>False</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
+ <class>GtkTable</class>
+ <name>table4</name>
+ <border_width>4</border_width>
+ <rows>3</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
- <widget>
- <class>GnomeColorPicker</class>
- <name>color2_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>color_set</name>
- <handler>color2_select_color_set_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:14:05 GMT</last_modification_time>
- </signal>
- <dither>True</dither>
- <use_alpha>False</use_alpha>
- <title>Pick a color</title>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label5</name>
+ <label>Effect</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
<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>
+ <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>GtkRadioButton</class>
- <name>solid_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>solid_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:13:09 GMT</last_modification_time>
- </signal>
- <label>Solid</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>gradient_group</group>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label6</name>
+ <label>Color 1</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
<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>
+ <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>GtkRadioButton</class>
- <name>gradient_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>gradient_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:13:19 GMT</last_modification_time>
- </signal>
- <label>Gradient</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>gradient_group</group>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label7</name>
+ <label>Color 2</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
<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>
+ <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>GtkRadioButton</class>
- <name>vertical_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>vertical_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:13:28 GMT</last_modification_time>
- </signal>
- <label>Vertical</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>orientation_group</group>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</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>True</xfill>
- <yfill>False</yfill>
- </child>
+ <widget>
+ <class>GnomeColorPicker</class>
+ <name>color1_select</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>color_set</name>
+ <handler>color1_select_color_set_cb</handler>
+ <last_modification_time>Sat, 09 Dec 2000 01:18:26 GMT</last_modification_time>
+ </signal>
+ <dither>True</dither>
+ <use_alpha>False</use_alpha>
+ <title>Pick a color</title>
+ <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>
+ <class>GnomeColorPicker</class>
+ <name>color2_select</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>color_set</name>
+ <handler>color2_select_color_set_cb</handler>
+ <last_modification_time>Sat, 09 Dec 2000 01:18:35 GMT</last_modification_time>
+ </signal>
+ <dither>True</dither>
+ <use_alpha>False</use_alpha>
+ <title>Pick a color</title>
+ <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>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>color_option</name>
+ <can_focus>True</can_focus>
+ <items>Solid Color
+Vertical Gradient
+Horizontal Gradent
+</items>
+ <initial_choice>1</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>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>wallpaper_frame</name>
+ <label>Wallpaper</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
<widget>
- <class>GtkRadioButton</class>
- <name>horizontal_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>horizontal_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:13:39 GMT</last_modification_time>
- </signal>
- <label>Horizontal</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>orientation_group</group>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <class>GtkTable</class>
+ <name>table3</name>
+ <border_width>4</border_width>
+ <rows>2</rows>
+ <columns>3</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label3</name>
+ <label>File</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
<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>
+ <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>GtkHSeparator</class>
- <name>hseparator1</name>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label4</name>
+ <label>Effect</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
<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>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>wallpaper_frame</name>
- <label>Wallpaper</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <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>
- <class>GtkVBox</class>
- <name>vbox3</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
+ <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>GnomeFileEntry</class>
- <name>wallpaper_entry</name>
- <history_id>gnomecc_background_wallpaper_filename</history_id>
- <max_saved>10</max_saved>
- <directory>False</directory>
- <modal>False</modal>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>wp_effect_option</name>
+ <can_focus>True</can_focus>
+ <items>Tiled
+Centered
+Scaled (keep aspect ratio)
+Stretched (change aspect ratio)
+Embossed
+</items>
+ <initial_choice>0</initial_choice>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
<widget>
- <class>GtkEntry</class>
- <child_name>GnomeEntry:entry</child_name>
- <name>combo-entry1</name>
+ <class>GtkButton</class>
+ <name>browse_button</name>
<can_focus>True</can_focus>
<signal>
- <name>changed</name>
- <handler>wallpaper_entry_changed_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:14:44 GMT</last_modification_time>
+ <name>clicked</name>
+ <handler>browse_button_cb</handler>
+ <last_modification_time>Fri, 08 Dec 2000 21:55:52 GMT</last_modification_time>
</signal>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
+ <label>Browse...</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <child>
+ <left_attach>2</left_attach>
+ <right_attach>3</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>False</xfill>
+ <yfill>False</yfill>
+ </child>
</widget>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>tiled_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>tiled_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:15:01 GMT</last_modification_time>
- </signal>
- <label>Tiled</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>wallpaper_type_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- <widget>
- <class>GtkRadioButton</class>
- <name>centered_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>centered_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:15:10 GMT</last_modification_time>
- </signal>
- <label>Centered</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>wallpaper_type_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>scaled_aspect_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>scaled_aspect_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:15:18 GMT</last_modification_time>
- </signal>
- <label>Scaled (keep aspect)</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>wallpaper_type_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>scaled_select</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>scaled_select_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:15:28 GMT</last_modification_time>
- </signal>
- <label>Scaled</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>wallpaper_type_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>wp_file_option</name>
+ <width>66</width>
+ <can_focus>True</can_focus>
+ <items>(None)
+</items>
+ <initial_choice>0</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>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkCheckButton</class>
- <name>disable_toggle</name>
+ <name>adjust_opacity_toggle</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
- <handler>disable_toggled_cb</handler>
- <last_modification_time>Wed, 06 Sep 2000 00:15:45 GMT</last_modification_time>
+ <handler>adjust_opacity_toggled_cb</handler>
+ <last_modification_time>Thu, 21 Dec 2000 19:54:21 GMT</last_modification_time>
</signal>
- <label>Disable background selection</label>
+ <label>Adjust wallpaper's opacity</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
<widget>
- <class>GtkFrame</class>
- <name>monitor_frame</name>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
- <child>
- <left_attach>0</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>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>auto_apply</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>auto_apply_toggled_cb</handler>
- <last_modification_time>Sun, 17 Dec 2000 21:35:44 GMT</last_modification_time>
- </signal>
- <label>Apply changes automatically</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</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>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table3</name>
- <rows>2</rows>
- <columns>3</columns>
+ <class>GtkHBox</class>
+ <name>opacity_box</name>
<homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
+ <spacing>4</spacing>
<child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
<widget>
- <class>GtkCheckButton</class>
- <name>adjust_opacity_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>adjust_opacity_toggled_cb</handler>
- <last_modification_time>Mon, 18 Dec 2000 22:12:03 GMT</last_modification_time>
- </signal>
- <label>Adjust wallpaper's opacity</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <left_attach>0</left_attach>
- <right_attach>3</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>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkLabel</class>
- <name>opacity_low_label</name>
- <label>More Transparent</label>
- <justify>GTK_JUSTIFY_RIGHT</justify>
+ <name>label10</name>
+ <width>16</width>
+ <label></label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
- <xalign>1</xalign>
+ <xalign>0.5</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>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
- <name>opacity_high_label</name>
- <label>More Solid</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
+ <name>label8</name>
+ <label>More Transparent</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
- <xalign>0</xalign>
+ <xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
- <left_attach>2</left_attach>
- <right_attach>3</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>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
@@ -664,25 +488,52 @@
<policy>GTK_UPDATE_CONTINUOUS</policy>
<value>0</value>
<lower>0</lower>
- <upper>255</upper>
+ <upper>0</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>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label9</name>
+ <label>More Solid</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>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>auto_apply</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>auto_apply_toggled_cb</handler>
+ <last_modification_time>Thu, 21 Dec 2000 19:52:25 GMT</last_modification_time>
+ </signal>
+ <label>Apply changes automatically</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
</widget>
</widget>
</widget>
diff --git a/capplets/background/background-properties.glade.h b/capplets/background/background-properties.glade.h
index b04f8e03d..c4727bf86 100644
--- a/capplets/background/background-properties.glade.h
+++ b/capplets/background/background-properties.glade.h
@@ -5,22 +5,27 @@
*/
gchar *s = N_("window1");
-gchar *s = N_("Color");
+gchar *s = N_("Use GNOME for setting background");
+gchar *s = N_("Colors");
+gchar *s = N_("Effect");
gchar *s = N_("Color 1");
gchar *s = N_("Color 2");
gchar *s = N_("Pick a color");
gchar *s = N_("Pick a color");
-gchar *s = N_("Solid");
-gchar *s = N_("Gradient");
-gchar *s = N_("Vertical");
-gchar *s = N_("Horizontal");
+gchar *s = N_("Solid Color");
+gchar *s = N_("Vertical Gradient");
+gchar *s = N_("Horizontal Gradent");
gchar *s = N_("Wallpaper");
+gchar *s = N_("File");
+gchar *s = N_("Effect");
gchar *s = N_("Tiled");
gchar *s = N_("Centered");
-gchar *s = N_("Scaled (keep aspect)");
-gchar *s = N_("Scaled");
-gchar *s = N_("Disable background selection");
-gchar *s = N_("Apply changes automatically");
+gchar *s = N_("Scaled (keep aspect ratio)");
+gchar *s = N_("Stretched (change aspect ratio)");
+gchar *s = N_("Embossed");
+gchar *s = N_("Browse...");
+gchar *s = N_("(None)");
gchar *s = N_("Adjust wallpaper's opacity");
gchar *s = N_("More Transparent");
gchar *s = N_("More Solid");
+gchar *s = N_("Apply changes automatically");
diff --git a/capplets/background/preferences.c b/capplets/background/preferences.c
index be1317aee..c14873cc2 100644
--- a/capplets/background/preferences.c
+++ b/capplets/background/preferences.c
@@ -133,12 +133,8 @@ preferences_clone (Preferences *prefs)
if (prefs->color2)
new_prefs->color2 = gdk_color_copy (prefs->color2);
- if (prefs->wallpaper_filename)
- new_prefs->wallpaper_filename =
- g_strdup (prefs->wallpaper_filename);
- if (prefs->wallpaper_sel_path)
- new_prefs->wallpaper_sel_path =
- g_strdup (prefs->wallpaper_sel_path);;
+ new_prefs->wallpaper_filename = g_strdup (prefs->wallpaper_filename);
+ new_prefs->wallpaper_sel_path = g_strdup (prefs->wallpaper_sel_path);;
new_prefs->auto_apply = prefs->auto_apply;
new_prefs->adjust_opacity = prefs->adjust_opacity;
@@ -157,10 +153,8 @@ preferences_destroy (GtkObject *object)
prefs = PREFERENCES (object);
- if (prefs->wallpaper_filename)
- g_free (prefs->wallpaper_filename);
- if (prefs->wallpaper_sel_path)
- g_free (prefs->wallpaper_sel_path);
+ g_free (prefs->wallpaper_filename);
+ g_free (prefs->wallpaper_sel_path);
parent_class->destroy (object);
}
@@ -168,20 +162,21 @@ preferences_destroy (GtkObject *object)
void
preferences_load (Preferences *prefs)
{
- gchar *string;
+ gchar *string, *wp, *wp1;
+ int i, wps;
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
if (prefs->color1) g_free (prefs->color1);
string = gnome_config_get_string
- ("/Background/Default/color1=#005060");
+ ("/Background/Default/color1=#39374b");
prefs->color1 = read_color_from_string (string);
g_free (string);
if (prefs->color2) g_free (prefs->color2);
string = gnome_config_get_string
- ("/Background/Default/color2=#0000ff");
+ ("/Background/Default/color2=#42528f");
prefs->color2 = read_color_from_string (string);
g_free (string);
@@ -196,7 +191,7 @@ preferences_load (Preferences *prefs)
prefs->wallpaper_enabled = FALSE;
g_free (string);
- string = gnome_config_get_string ("/Background/Default/simple=solid");
+ string = gnome_config_get_string ("/Background/Default/simple=gradent");
if (!g_strcasecmp (string, "gradient"))
prefs->gradient_enabled = TRUE;
else if (g_strcasecmp (string, "solid"))
@@ -215,43 +210,46 @@ preferences_load (Preferences *prefs)
gnome_config_get_int ("/Background/Default/wallpaperAlign=0");
prefs->wallpaper_filename =
- gnome_config_get_string ("/Background/Default/wallpaper=none");
+ gnome_config_get_string ("/Background/Default/wallpaper=(None)");
prefs->wallpaper_sel_path =
gnome_config_get_string
("/Background/Default/wallpapers_dir=./");
- string = gnome_config_get_string
- ("/Background/Default/autoApply=true");
- if (!g_strcasecmp (string, "true"))
- prefs->auto_apply = TRUE;
- else if (g_strcasecmp (string, "false"))
- prefs->auto_apply = FALSE;
- g_free (string);
+ prefs->auto_apply = gnome_config_get_bool ("/Background/Default/autoApply=true");
- if (!g_strcasecmp (prefs->wallpaper_filename, "none")) {
+ if (!g_strcasecmp (prefs->wallpaper_filename, "(None)")) {
g_free(prefs->wallpaper_filename);
prefs->wallpaper_filename = NULL;
prefs->wallpaper_enabled = FALSE;
} else {
prefs->wallpaper_enabled = TRUE;
}
+
+ wps = gnome_config_get_int ("/Background/Default/wallpapers=0");
+
+ for (i = 0; i < wps; i++) {
+ wp = g_strdup_printf ("/Background/Default/wallpaper%d", i+1);
+ wp1 = gnome_config_get_string (wp);
+ g_free (wp);
- string = gnome_config_get_string
- ("/Background/Default/adjustOpacity=true");
- if (!g_strcasecmp (string, "true"))
- prefs->adjust_opacity = TRUE;
- else if (g_strcasecmp (string, "false"))
- prefs->adjust_opacity = FALSE;
- g_free (string);
+ if (!wp1) continue;
- prefs->opacity =
- gnome_config_get_int ("/Background/Default/opacity=255");
+ prefs->wallpapers = g_slist_prepend (prefs->wallpapers, wp1);
+ }
+ prefs->wallpapers = g_slist_reverse (prefs->wallpapers);
+
+ prefs->adjust_opacity = gnome_config_get_bool ("/Background/Default/adjustOpacity=true");
+
+ prefs->opacity = gnome_config_get_int ("/Background/Default/opacity=255");
}
void
preferences_save (Preferences *prefs)
{
char buffer[16];
+ char *wp;
+ GSList *item;
+ int i;
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
@@ -283,11 +281,17 @@ preferences_save (Preferences *prefs)
gnome_config_set_int ("/Background/Default/wallpaperAlign",
prefs->wallpaper_type);
- gnome_config_set_string ("/Background/Default/autoApply",
- prefs->auto_apply ? "True" : "False");
+ gnome_config_set_int ("/Background/Default/wallpapers",
+ g_slist_length (prefs->wallpapers));
+
+ for (i = 1, item = prefs->wallpapers; item; i++, item = item->next) {
+ wp = g_strdup_printf ("/Background/Default/wallpaper%d", i);
+ gnome_config_set_string (wp, (char *)item->data);
+ g_free (wp);
+ }
- gnome_config_set_string ("/Background/Default/adjustOpacity",
- prefs->adjust_opacity ? "True" : "False");
+ gnome_config_set_bool ("/Background/Default/autoApply", prefs->auto_apply);
+ gnome_config_set_bool ("/Background/Default/adjustOpacity", prefs->adjust_opacity);
gnome_config_set_int ("/Background/Default/opacity",
prefs->opacity);
diff --git a/capplets/background/preferences.h b/capplets/background/preferences.h
index 716319f2d..344eb575f 100644
--- a/capplets/background/preferences.h
+++ b/capplets/background/preferences.h
@@ -64,6 +64,8 @@ struct _Preferences
gchar *wallpaper_filename;
gchar *wallpaper_sel_path;
+ GSList *wallpapers;
+
gboolean adjust_opacity;
gint opacity;
};
diff --git a/capplets/background/prefs-widget.c b/capplets/background/prefs-widget.c
index 358f22419..156940626 100644
--- a/capplets/background/prefs-widget.c
+++ b/capplets/background/prefs-widget.c
@@ -39,293 +39,86 @@ enum {
static CappletWidgetClass *parent_class;
-static void prefs_widget_init (PrefsWidget *prefs_widget);
-static void prefs_widget_class_init (PrefsWidgetClass *class);
-
-static void prefs_widget_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void prefs_widget_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void prefs_widget_destroy (GtkObject *object);
-
-static void read_preferences (PrefsWidget *prefs_widget,
- Preferences *prefs);
-
-static void color1_select_color_set_cb (GnomeColorPicker *cp,
- guint r,
- guint g,
- guint b,
- guint a,
- PrefsWidget *prefs_widget);
-static void color2_select_color_set_cb (GnomeColorPicker *cp,
- guint r,
- guint g,
- guint b,
- guint a,
- PrefsWidget *prefs_widget);
-static void solid_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void gradient_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void vertical_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void horizontal_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void wallpaper_entry_changed_cb (GtkEntry *e,
- PrefsWidget *prefs_widget);
-static void tiled_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void centered_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void scaled_aspect_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-
-static void scaled_select_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void disable_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void auto_apply_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void adjust_opacity_toggled_cb (GtkToggleButton *tb,
- PrefsWidget *prefs_widget);
-static void opacity_adjust_changed_cb (GtkAdjustment *adjustment,
- PrefsWidget *prefs_widget);
-
-static void set_gradient_controls_sensitive (PrefsWidget *prefs_widget,
- gboolean s);
-static void set_wallpaper_controls_sensitive (PrefsWidget *prefs_widget,
- gboolean s);
-static void set_background_controls_sensitive (PrefsWidget *prefs_widget,
- gboolean s);
-static void set_opacity_controls_sensitive (PrefsWidget *prefs_widget,
- gboolean s);
-
-guint
-prefs_widget_get_type (void)
-{
- static guint prefs_widget_type = 0;
-
- if (!prefs_widget_type) {
- GtkTypeInfo prefs_widget_info = {
- "PrefsWidget",
- sizeof (PrefsWidget),
- sizeof (PrefsWidgetClass),
- (GtkClassInitFunc) prefs_widget_class_init,
- (GtkObjectInitFunc) prefs_widget_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- prefs_widget_type =
- gtk_type_unique (capplet_widget_get_type (),
- &prefs_widget_info);
- }
-
- return prefs_widget_type;
-}
-
static void
-prefs_widget_init (PrefsWidget *prefs_widget)
-{
- GtkWidget *widget;
- GtkAdjustment *adjustment;
-
- prefs_widget->dialog_data =
- glade_xml_new (GLADE_DATADIR "/background-properties.glade",
- "prefs_widget");
-
- widget = glade_xml_get_widget (prefs_widget->dialog_data,
- "prefs_widget");
- gtk_container_add (GTK_CONTAINER (prefs_widget), widget);
-
- widget = glade_xml_get_widget (prefs_widget->dialog_data,
- "monitor_frame");
- prefs_widget->preview = applier_class_get_preview_widget ();
- gtk_container_add (GTK_CONTAINER (widget), prefs_widget->preview);
-
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "color1_select_color_set_cb",
- color1_select_color_set_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "color2_select_color_set_cb",
- color2_select_color_set_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "solid_select_toggled_cb",
- solid_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "gradient_select_toggled_cb",
- gradient_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "vertical_select_toggled_cb",
- vertical_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "horizontal_select_toggled_cb",
- horizontal_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "wallpaper_entry_changed_cb",
- wallpaper_entry_changed_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "tiled_select_toggled_cb",
- tiled_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "centered_select_toggled_cb",
- centered_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "scaled_aspect_select_toggled_cb",
- scaled_aspect_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "scaled_select_toggled_cb",
- scaled_select_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "disable_toggled_cb",
- disable_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "auto_apply_toggled_cb",
- auto_apply_toggled_cb,
- prefs_widget);
- glade_xml_signal_connect_data (prefs_widget->dialog_data,
- "adjust_opacity_toggled_cb",
- adjust_opacity_toggled_cb,
- prefs_widget);
-
- adjustment = gtk_range_get_adjustment
- (GTK_RANGE (WID ("opacity_adjust")));
- gtk_signal_connect (GTK_OBJECT (adjustment), "value-changed",
- GTK_SIGNAL_FUNC (opacity_adjust_changed_cb),
- prefs_widget);
-
- gnome_entry_load_history
- (GNOME_ENTRY (gnome_file_entry_gnome_entry
- (GNOME_FILE_ENTRY (WID ("wallpaper_entry")))));
-}
-
-static void
-prefs_widget_class_init (PrefsWidgetClass *class)
+set_background_controls_sensitive (PrefsWidget *prefs_widget, gboolean s)
{
- GtkObjectClass *object_class;
-
- gtk_object_add_arg_type ("PrefsWidget::preferences",
- GTK_TYPE_POINTER,
- GTK_ARG_READWRITE,
- ARG_PREFERENCES);
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = prefs_widget_destroy;
- object_class->set_arg = prefs_widget_set_arg;
- object_class->get_arg = prefs_widget_get_arg;
-
- parent_class = CAPPLET_WIDGET_CLASS
- (gtk_type_class (capplet_widget_get_type ()));
+ gtk_widget_set_sensitive (WID ("color_frame"), s);
+ gtk_widget_set_sensitive (WID ("wallpaper_frame"), s);
+ gtk_widget_set_sensitive (WID ("adjust_opacity_toggle"), s);
+ gtk_widget_set_sensitive (WID ("opacity_box"), s && prefs_widget->prefs->adjust_opacity);
+ gtk_widget_set_sensitive (WID ("auto_apply"), s);
}
-static void
-prefs_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+GtkWidget *
+prefs_widget_new (Preferences *prefs)
{
- PrefsWidget *prefs_widget;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_PREFS_WIDGET (object));
-
- prefs_widget = PREFS_WIDGET (object);
-
- switch (arg_id) {
- case ARG_PREFERENCES:
- if (prefs_widget->prefs)
- gtk_object_unref (GTK_OBJECT (prefs_widget->prefs));
-
- prefs_widget->prefs = GTK_VALUE_POINTER (*arg);
-
- if (prefs_widget->prefs) {
- gtk_object_ref (GTK_OBJECT (prefs_widget->prefs));
- read_preferences (prefs_widget, prefs_widget->prefs);
- }
-
- break;
+ g_return_val_if_fail (prefs == NULL || IS_PREFERENCES (prefs), NULL);
- default:
- g_warning ("Bad argument set");
- break;
- }
+ return gtk_widget_new (prefs_widget_get_type (),
+ "preferences", prefs,
+ NULL);
}
-static void
-prefs_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+void
+prefs_widget_set_preferences (PrefsWidget *prefs_widget, Preferences *prefs)
{
- PrefsWidget *prefs_widget;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_PREFS_WIDGET (object));
-
- prefs_widget = PREFS_WIDGET (object);
-
- switch (arg_id) {
- case ARG_PREFERENCES:
- GTK_VALUE_POINTER (*arg) = prefs_widget->prefs;
- break;
+ g_return_if_fail (prefs_widget != NULL);
+ g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
+ g_return_if_fail (prefs != NULL);
+ g_return_if_fail (IS_PREFERENCES (prefs));
- default:
- g_warning ("Bad argument get");
- break;
- }
+ gtk_object_set (GTK_OBJECT (prefs_widget), "preferences", prefs, NULL);
}
static void
-prefs_widget_destroy (GtkObject *object)
+wallpaper_entry_changed_cb (GtkWidget *e, PrefsWidget *prefs_widget)
{
- PrefsWidget *prefs_widget;
+ char *filename;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_PREFS_WIDGET (object));
+ g_return_if_fail (prefs_widget != NULL);
+ g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
+ g_return_if_fail (prefs_widget->prefs != NULL);
+ g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
- prefs_widget = PREFS_WIDGET (object);
+ g_free (prefs_widget->prefs->wallpaper_filename);
- gnome_entry_save_history
- (GNOME_ENTRY (gnome_file_entry_gnome_entry
- (GNOME_FILE_ENTRY (WID ("wallpaper_entry")))));
+ prefs_widget->prefs->wallpaper_filename =
+ g_strdup (gtk_object_get_data (GTK_OBJECT (e), "wallpaper_filename"));
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ prefs_widget->prefs->wallpaper_enabled =
+ prefs_widget->prefs->wallpaper_filename &&
+ g_file_exists (prefs_widget->prefs->wallpaper_filename);
+
+ preferences_changed (prefs_widget->prefs);
+ capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
-GtkWidget *
-prefs_widget_new (Preferences *prefs)
-{
- g_return_val_if_fail (prefs == NULL || IS_PREFERENCES (prefs), NULL);
- return gtk_widget_new (prefs_widget_get_type (),
- "preferences", prefs,
- NULL);
-}
-void
-prefs_widget_set_preferences (PrefsWidget *prefs_widget, Preferences *prefs)
+static void
+append_wallpaper (GtkMenu *menu, char *label, char *path, PrefsWidget *prefs_widget)
{
- g_return_if_fail (prefs_widget != NULL);
- g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
- g_return_if_fail (prefs != NULL);
- g_return_if_fail (IS_PREFERENCES (prefs));
+ GtkWidget *item;
- gtk_object_set (GTK_OBJECT (prefs_widget), "preferences", prefs, NULL);
+ item = gtk_menu_item_new_with_label (label);
+ if (path)
+ gtk_object_set_data (GTK_OBJECT (item), "wallpaper_filename", path);
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (wallpaper_entry_changed_cb),
+ prefs_widget);
+
+ gtk_menu_append (menu, item);
}
static void
read_preferences (PrefsWidget *prefs_widget, Preferences *prefs)
{
- GtkWidget *widget, *entry;
+ GtkWidget *widget;
GtkAdjustment *adjustment;
+ GtkWidget *menu;
+ gint i;
+ gint thing;
+ GSList *item;
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
@@ -341,120 +134,69 @@ read_preferences (PrefsWidget *prefs_widget, Preferences *prefs)
prefs->color2->red, prefs->color2->green,
prefs->color2->blue, 0xffff);
- if (prefs->gradient_enabled) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("gradient_select")),
- TRUE);
- set_gradient_controls_sensitive (prefs_widget, TRUE);
- } else {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("solid_select")),
- TRUE);
- set_gradient_controls_sensitive (prefs_widget, FALSE);
- }
+ gtk_widget_set_sensitive (
+ glade_xml_get_widget (prefs_widget->dialog_data,
+ "color2_select"),
+ prefs_widget->prefs->gradient_enabled);
+
+ thing = prefs->gradient_enabled
+ ? (prefs->orientation == ORIENTATION_VERT
+ ? 1 : 2) : 0;
- if (prefs->orientation == ORIENTATION_VERT)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("vertical_select")),
- TRUE);
- else if (prefs->orientation == ORIENTATION_HORIZ)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("horizontal_select")),
- TRUE);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (WID ("color_option")), thing);
widget = WID ("wallpaper_entry");
+#if 0
if (prefs->wallpaper_sel_path)
gnome_file_entry_set_default_path
(GNOME_FILE_ENTRY (widget),
prefs->wallpaper_sel_path);
+#endif
- if (prefs->wallpaper_filename) {
- entry = gnome_file_entry_gtk_entry
- (GNOME_FILE_ENTRY (widget));
- gtk_entry_set_text (GTK_ENTRY (entry),
- prefs->wallpaper_filename);
- set_wallpaper_controls_sensitive (prefs_widget, TRUE);
- } else {
- set_wallpaper_controls_sensitive (prefs_widget, FALSE);
- }
-
- switch (prefs->wallpaper_type) {
- case WPTYPE_TILED:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("tiled_select")),
- TRUE);
- break;
+ menu = gtk_menu_new ();
+ append_wallpaper (GTK_MENU (menu), _("(None)"), NULL, prefs_widget);
- case WPTYPE_CENTERED:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("centered_select")),
- TRUE);
- break;
+#warning FIXME: add a small snapshot of the image? that would rule.
+ for (thing = 0, i = 1, item = prefs->wallpapers; item; i++, item = item->next) {
+ append_wallpaper (GTK_MENU (menu), g_basename (item->data),
+ item->data, prefs_widget);
+ if (prefs->wallpaper_filename &&
+ !strcmp (prefs->wallpaper_filename, item->data))
+ thing = i;
+ }
- case WPTYPE_SCALED_ASPECT:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("scaled_aspect_select")),
- TRUE);
- break;
+ if (!thing && prefs->wallpaper_filename) {
+ thing = 1;
+ append_wallpaper (GTK_MENU (menu),
+ g_basename (prefs->wallpaper_filename),
+ prefs->wallpaper_filename, prefs_widget);
+ }
+
+ gtk_option_menu_set_history (GTK_OPTION_MENU (WID ("wp_effect_option")),
+ prefs->wallpaper_type);
- case WPTYPE_SCALED:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("scaled_select")),
- TRUE);
- break;
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (WID ("wp_file_option")), menu);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (WID ("wp_file_option")), thing);
- default:
- g_error ("Bad wallpaper type");
- break;
- }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("disable_toggle")),
+ prefs->enabled);
- if (prefs->enabled) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("disable_toggle")),
- FALSE);
- set_background_controls_sensitive (prefs_widget, TRUE);
- } else {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("disable_toggle")),
- TRUE);
- set_background_controls_sensitive (prefs_widget, FALSE);
- }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (WID ("auto_apply")),
+ prefs->auto_apply);
- if (prefs->auto_apply)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("auto_apply")),
- TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("auto_apply")),
- FALSE);
-
- if (prefs->adjust_opacity)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("auto_apply")),
- TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (WID ("auto_apply")),
- FALSE);
-
- if (prefs->adjust_opacity) {
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (WID ("adjust_opacity_toggle")),
- TRUE);
- set_opacity_controls_sensitive (prefs_widget, TRUE);
- } else {
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (WID ("adjust_opacity_toggle")),
- FALSE);
- set_opacity_controls_sensitive (prefs_widget, FALSE);
- }
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (WID ("adjust_opacity_toggle")),
+ prefs->adjust_opacity);
+ gtk_widget_set_sensitive (GTK_WIDGET (WID ("opacity_box")),
+ prefs->adjust_opacity && prefs->enabled);
adjustment = gtk_range_get_adjustment
(GTK_RANGE (WID ("opacity_adjust")));
gtk_adjustment_set_value (adjustment, prefs->opacity);
-
+
preferences_apply_preview (prefs);
}
@@ -510,8 +252,6 @@ solid_select_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
if (gtk_toggle_button_get_active (tb)) {
prefs_widget->prefs->gradient_enabled = FALSE;
- set_gradient_controls_sensitive (prefs_widget, FALSE);
-
preferences_changed (prefs_widget->prefs);
}
@@ -528,8 +268,6 @@ gradient_select_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
if (gtk_toggle_button_get_active (tb)) {
prefs_widget->prefs->gradient_enabled = TRUE;
- set_gradient_controls_sensitive (prefs_widget, TRUE);
-
preferences_changed (prefs_widget->prefs);
}
@@ -569,44 +307,6 @@ horizontal_select_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
}
static void
-wallpaper_entry_changed_cb (GtkEntry *e, PrefsWidget *prefs_widget)
-{
- g_return_if_fail (prefs_widget != NULL);
- g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
- g_return_if_fail (prefs_widget->prefs == NULL ||
- IS_PREFERENCES (prefs_widget->prefs));
-
- if (prefs_widget->prefs == NULL) return;
-
- if (prefs_widget->prefs->wallpaper_filename)
- g_free (prefs_widget->prefs->wallpaper_filename);
-
- prefs_widget->prefs->wallpaper_filename =
- gnome_file_entry_get_full_path
- (GNOME_FILE_ENTRY (WID ("wallpaper_entry")), TRUE);
-
- if (!g_file_test (prefs_widget->prefs->wallpaper_filename,
- G_FILE_TEST_ISFILE)) {
- g_free (prefs_widget->prefs->wallpaper_filename);
- prefs_widget->prefs->wallpaper_filename = NULL;
- }
-
- if (prefs_widget->prefs->wallpaper_filename &&
- strlen (prefs_widget->prefs->wallpaper_filename) &&
- g_strcasecmp (prefs_widget->prefs->wallpaper_filename, "none"))
- {
- set_wallpaper_controls_sensitive (prefs_widget, TRUE);
- prefs_widget->prefs->wallpaper_enabled = TRUE;
- } else {
- set_wallpaper_controls_sensitive (prefs_widget, FALSE);
- prefs_widget->prefs->wallpaper_enabled = FALSE;
- }
-
- preferences_changed (prefs_widget->prefs);
- capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
-}
-
-static void
tiled_select_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
{
g_return_if_fail (prefs_widget != NULL);
@@ -679,10 +379,7 @@ disable_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
g_return_if_fail (prefs_widget->prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
- if (gtk_toggle_button_get_active (tb))
- prefs_widget->prefs->enabled = FALSE;
- else
- prefs_widget->prefs->enabled = TRUE;
+ prefs_widget->prefs->enabled = gtk_toggle_button_get_active (tb);
set_background_controls_sensitive (prefs_widget,
prefs_widget->prefs->enabled);
@@ -692,18 +389,170 @@ disable_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
}
static void
+color_effect_cb (GtkWidget *w, PrefsWidget *prefs_widget)
+{
+ switch (GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "index"))) {
+ case 0:
+ prefs_widget->prefs->gradient_enabled = FALSE;
+ break;
+ case 1:
+ prefs_widget->prefs->gradient_enabled = TRUE;
+ prefs_widget->prefs->orientation = ORIENTATION_VERT;
+ break;
+ case 2:
+ prefs_widget->prefs->gradient_enabled = TRUE;
+ prefs_widget->prefs->orientation = ORIENTATION_HORIZ;
+ break;
+ default:
+ break;
+ }
+
+ gtk_widget_set_sensitive (
+ glade_xml_get_widget (prefs_widget->dialog_data,
+ "color2_select"),
+ prefs_widget->prefs->gradient_enabled);
+
+ preferences_changed (prefs_widget->prefs);
+ capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
+}
+
+static void
+wallpaper_effect_cb (GtkWidget *w, PrefsWidget *prefs_widget)
+{
+ gint i;
+
+ i = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "index"));
+
+ prefs_widget->prefs->wallpaper_type = i;
+
+ preferences_changed (prefs_widget->prefs);
+ capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
+}
+
+static void
+setup_preview(GtkWidget *widget, PrefsWidget *prefs)
+{
+ char *p;
+ GList *l;
+ GtkWidget *pp = NULL;
+ GdkImlibImage *im;
+ int w,h;
+ GtkWidget *frame;
+ GtkFileSelection *fs;
+
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ frame = gtk_object_get_data(GTK_OBJECT(widget),"frame");
+ fs = gtk_object_get_data(GTK_OBJECT(frame),"fs");
+
+ if((l = gtk_container_children(GTK_CONTAINER(frame))) != NULL) {
+ pp = l->data;
+ g_list_free(l);
+ }
+
+ if(pp)
+ gtk_widget_destroy(pp);
+
+ p = gtk_file_selection_get_filename(fs);
+ if(!p || !g_file_test (p,G_FILE_TEST_ISLINK|G_FILE_TEST_ISFILE) ||
+ !(im = gdk_imlib_load_image (p)))
+ return;
+
+ w = im->rgb_width;
+ h = im->rgb_height;
+ if(w>h) {
+ if(w>100) {
+ h = h*(100.0/w);
+ w = 100;
+ }
+ } else {
+ if(h>100) {
+ w = w*(100.0/h);
+ h = 100;
+ }
+ }
+ pp = gnome_pixmap_new_from_imlib_at_size (im, w, h);
+ gtk_widget_show(pp);
+ gtk_container_add(GTK_CONTAINER(frame),pp);
+
+ gdk_imlib_destroy_image(im);
+}
+
+static void
+browse_button_cb (GtkWidget *w, PrefsWidget *prefs_widget)
+{
+ GtkWidget *hbox, *widg;
+ GtkFileSelection *filesel;
+
+ if (prefs_widget->filesel) {
+ gdk_window_show (prefs_widget->filesel->window);
+ gdk_window_raise (prefs_widget->filesel->window);
+ return;
+ }
+
+ prefs_widget->filesel = gtk_file_selection_new (_("Wallpaper Selection"));
+ filesel = GTK_FILE_SELECTION (prefs_widget->filesel);
+ hbox = filesel->file_list;
+
+ do {
+ hbox = hbox->parent;
+ if(!hbox) {
+ g_warning(_("Can't find an hbox, using a normal file "
+ "selection"));
+ goto signal_setup;
+ }
+ } while (!GTK_IS_HBOX (hbox));
+
+ widg = gtk_frame_new (_("Preview"));
+ gtk_widget_show (widg);
+ gtk_box_pack_end (GTK_BOX (hbox), widg, FALSE, FALSE, 0);
+ gtk_widget_set_usize (widg, 110, 110);
+
+ gtk_object_set_data (GTK_OBJECT (widg), "fs", filesel);
+ gtk_object_set_data (GTK_OBJECT (filesel->file_list), "frame", widg);
+ gtk_object_set_data (GTK_OBJECT (filesel->selection_entry), "frame", widg);
+
+ gtk_signal_connect (GTK_OBJECT (filesel->file_list),"select_row",
+ GTK_SIGNAL_FUNC (setup_preview), prefs_widget);
+
+ gtk_signal_connect (GTK_OBJECT (filesel->selection_entry), "changed",
+ GTK_SIGNAL_FUNC (setup_preview), prefs_widget);
+
+
+ signal_setup:
+#if 0
+ if (wpFileSelName)
+ gtk_file_selection_set_filename (filesel, wpFileSelName);
+ else if (origState.wpFileName)
+ gtk_file_selection_set_filename (filesel, origState.wpFileName);
+#endif
+ gtk_signal_connect (GTK_OBJECT (filesel), "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+ &prefs_widget->filesel);
+#if 0
+ gtk_signal_connect (GTK_OBJECT (filesel->ok_button), "clicked",
+ GTK_SIGNAL_FUNC (wp_selection_ok), prefs_widget);
+
+ gtk_signal_connect (GTK_OBJECT (filesel->cancel_button), "clicked",
+ GTK_SIGNAL_FUNC (wp_selection_cancel), prefs_widget);
+#endif
+ gtk_widget_show (filesel);
+}
+
+static void
auto_apply_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
{
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
g_return_if_fail (prefs_widget->prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
-
+
if (gtk_toggle_button_get_active (tb))
prefs_widget->prefs->auto_apply = TRUE;
else
prefs_widget->prefs->auto_apply = FALSE;
-
+
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
@@ -715,64 +564,198 @@ adjust_opacity_toggled_cb (GtkToggleButton *tb, PrefsWidget *prefs_widget)
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
g_return_if_fail (prefs_widget->prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
-
- if (gtk_toggle_button_get_active (tb)) {
- prefs_widget->prefs->adjust_opacity = TRUE;
- set_opacity_controls_sensitive (prefs_widget, TRUE);
- } else {
- prefs_widget->prefs->adjust_opacity = FALSE;
- set_opacity_controls_sensitive (prefs_widget, FALSE);
- }
-
+
+ prefs_widget->prefs->adjust_opacity = gtk_toggle_button_get_active (tb);
+ gtk_widget_set_sensitive (WID ("opacity_box"), prefs_widget->prefs->enabled && prefs_widget->prefs->adjust_opacity);
+
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
static void
opacity_adjust_changed_cb (GtkAdjustment *adjustment,
- PrefsWidget *prefs_widget)
+ PrefsWidget *prefs_widget)
{
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
g_return_if_fail (prefs_widget->prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
-
- prefs_widget->prefs->opacity = adjustment->value;
-
+
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
-
+
static void
-set_gradient_controls_sensitive (PrefsWidget *prefs_widget, gboolean s)
+prefs_widget_init (PrefsWidget *prefs_widget)
{
- gtk_widget_set_sensitive (WID ("vertical_select"), s);
- gtk_widget_set_sensitive (WID ("horizontal_select"), s);
- gtk_widget_set_sensitive (WID ("color2_label"), s);
- gtk_widget_set_sensitive (WID ("color2_select"), s);
+ GtkWidget *widget;
+ GtkAdjustment *adjustment;
+ GList *node;
+ int i;
+
+ prefs_widget->dialog_data =
+ glade_xml_new (GLADE_DATADIR "/background-properties.glade",
+ "prefs_widget");
+
+ widget = glade_xml_get_widget (prefs_widget->dialog_data,
+ "prefs_widget");
+ gtk_container_add (GTK_CONTAINER (prefs_widget), widget);
+
+ widget = glade_xml_get_widget (prefs_widget->dialog_data,
+ "monitor_frame");
+
+ prefs_widget->preview = applier_class_get_preview_widget ();
+ gtk_container_add (GTK_CONTAINER (widget), prefs_widget->preview);
+
+ glade_xml_signal_connect_data (prefs_widget->dialog_data,
+ "color1_select_color_set_cb",
+ color1_select_color_set_cb,
+ prefs_widget);
+ glade_xml_signal_connect_data (prefs_widget->dialog_data,
+ "color2_select_color_set_cb",
+ color2_select_color_set_cb,
+ prefs_widget);
+ glade_xml_signal_connect_data (prefs_widget->dialog_data,
+ "disable_toggled_cb",
+ disable_toggled_cb,
+ prefs_widget);
+ glade_xml_signal_connect_data (prefs_widget->dialog_data,
+ "browse_button_cb",
+ browse_button_cb,
+ prefs_widget);
+ glade_xml_signal_connect_data (prefs_widget->dialog_data,
+ "auto_apply_toggled_cb",
+ auto_apply_toggled_cb,
+ prefs_widget);
+ glade_xml_signal_connect_data (prefs_widget->dialog_data,
+ "adjust_opacity_toggled_cb",
+ adjust_opacity_toggled_cb,
+ prefs_widget);
+
+ /*adjustment = gtk_range_get_adjustment (GTK_RANGE (WID ("opacity_adjust")));*/
+ adjustment = gtk_adjustment_new (100.0, 0.0, 100.0, 1.0, 10.0, 10.0);
+ gtk_range_set_adjustment (GTK_RANGE (WID ("opacity_adjust")), adjustment);
+ gtk_signal_connect (GTK_OBJECT (adjustment), "value-changed",
+ GTK_SIGNAL_FUNC (opacity_adjust_changed_cb),
+ prefs_widget);
+
+
+ widget = WID ("color_option");
+ node = GTK_MENU_SHELL (gtk_option_menu_get_menu (GTK_OPTION_MENU (widget)))->children;
+
+ for (i=0; node; i++, node = node->next) {
+ gtk_signal_connect (GTK_OBJECT (node->data), "activate",
+ GTK_SIGNAL_FUNC (color_effect_cb),
+ prefs_widget);
+
+ gtk_object_set_data (GTK_OBJECT (node->data), "index",
+ GINT_TO_POINTER (i));
+ }
+
+
+ widget = WID ("wp_effect_option");
+ node = GTK_MENU_SHELL (gtk_option_menu_get_menu (GTK_OPTION_MENU (widget)))->children;
+
+ for (i=0; node; i++, node = node->next) {
+ gtk_signal_connect (GTK_OBJECT (node->data), "activate",
+ GTK_SIGNAL_FUNC (wallpaper_effect_cb),
+ prefs_widget);
+
+ gtk_object_set_data (GTK_OBJECT (node->data), "index",
+ GINT_TO_POINTER (i));
+ }
}
static void
-set_wallpaper_controls_sensitive (PrefsWidget *prefs_widget, gboolean s)
+prefs_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
- gtk_widget_set_sensitive (WID ("tiled_select"), s);
- gtk_widget_set_sensitive (WID ("centered_select"), s);
- gtk_widget_set_sensitive (WID ("scaled_aspect_select"), s);
- gtk_widget_set_sensitive (WID ("scaled_select"), s);
+ PrefsWidget *prefs_widget;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_PREFS_WIDGET (object));
+
+ prefs_widget = PREFS_WIDGET (object);
+
+ switch (arg_id) {
+ case ARG_PREFERENCES:
+ if (prefs_widget->prefs)
+ gtk_object_unref (GTK_OBJECT (prefs_widget->prefs));
+
+ prefs_widget->prefs = GTK_VALUE_POINTER (*arg);
+
+ if (prefs_widget->prefs) {
+ gtk_object_ref (GTK_OBJECT (prefs_widget->prefs));
+ read_preferences (prefs_widget, prefs_widget->prefs);
+ }
+
+ break;
+
+ default:
+ g_warning ("Bad argument set");
+ break;
+ }
}
static void
-set_background_controls_sensitive (PrefsWidget *prefs_widget, gboolean s)
+prefs_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
- gtk_widget_set_sensitive (WID ("color_frame"), s);
- gtk_widget_set_sensitive (WID ("wallpaper_frame"), s);
+ PrefsWidget *prefs_widget;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_PREFS_WIDGET (object));
+
+ prefs_widget = PREFS_WIDGET (object);
+
+ switch (arg_id) {
+ case ARG_PREFERENCES:
+ GTK_VALUE_POINTER (*arg) = prefs_widget->prefs;
+ break;
+
+ default:
+ g_warning ("Bad argument get");
+ break;
+ }
}
static void
-set_opacity_controls_sensitive (PrefsWidget *prefs_widget, gboolean s)
+prefs_widget_class_init (PrefsWidgetClass *class)
{
- gtk_widget_set_sensitive (WID ("opacity_low_label"), s);
- gtk_widget_set_sensitive (WID ("opacity_adjust"), s);
- gtk_widget_set_sensitive (WID ("opacity_high_label"), s);
+ GtkObjectClass *object_class;
+
+ gtk_object_add_arg_type ("PrefsWidget::preferences",
+ GTK_TYPE_POINTER,
+ GTK_ARG_READWRITE,
+ ARG_PREFERENCES);
+
+ object_class = GTK_OBJECT_CLASS (class);
+ object_class->set_arg = prefs_widget_set_arg;
+ object_class->get_arg = prefs_widget_get_arg;
+
+ parent_class = CAPPLET_WIDGET_CLASS
+ (gtk_type_class (capplet_widget_get_type ()));
}
+
+guint
+prefs_widget_get_type (void)
+{
+ static guint prefs_widget_type = 0;
+
+ if (!prefs_widget_type) {
+ GtkTypeInfo prefs_widget_info = {
+ "PrefsWidget",
+ sizeof (PrefsWidget),
+ sizeof (PrefsWidgetClass),
+ (GtkClassInitFunc) prefs_widget_class_init,
+ (GtkObjectInitFunc) prefs_widget_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
+ };
+
+ prefs_widget_type =
+ gtk_type_unique (capplet_widget_get_type (),
+ &prefs_widget_info);
+ }
+
+ return prefs_widget_type;
+}
diff --git a/capplets/background/prefs-widget.h b/capplets/background/prefs-widget.h
index 3e8ceb3b2..ac7748c7d 100644
--- a/capplets/background/prefs-widget.h
+++ b/capplets/background/prefs-widget.h
@@ -44,6 +44,9 @@ struct _PrefsWidget
Preferences *prefs;
GladeXML *dialog_data;
GtkWidget *preview;
+
+ GtkWidget *menu;
+ GtkWidget *filesel;
};
struct _PrefsWidgetClass
diff --git a/capplets/keyboard/.cvsignore b/capplets/keyboard/.cvsignore
index cacc3c5d5..d6107c235 100644
--- a/capplets/keyboard/.cvsignore
+++ b/capplets/keyboard/.cvsignore
@@ -5,3 +5,5 @@ Makefile.in
*.lo
*.la
*.o
+keyboard-properties
+keyboard-properties-capplet
diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog
index f14ea2848..b09187cfe 100644
--- a/capplets/keyboard/ChangeLog
+++ b/capplets/keyboard/ChangeLog
@@ -1,3 +1,7 @@
+2000-12-26 Jacob "Ulysses" Berkman <jacob@helixcode.com>
+
+ * keyboard-properties.glade: re-did the UI a bit
+
2000-10-08 Bradford Hovinen <hovinen@helixcode.com>
* Makefile.am (EXTRA_DIST): Add translation file
diff --git a/capplets/keyboard/Makefile.am b/capplets/keyboard/Makefile.am
index d937c4462..5e556121e 100644
--- a/capplets/keyboard/Makefile.am
+++ b/capplets/keyboard/Makefile.am
@@ -2,6 +2,10 @@ Applicationsdir = $(datadir)/control-center/Desktop
Applications_DATA = \
keyboard-properties.desktop
+pApplicationsdir = $(datadir)/gnome/apps/Settings/Desktop
+pApplications_DATA = \
+ keyboard-properties.desktop
+
Gladedir = $(datadir)/control-center-data
Glade_DATA = \
keyboard-properties.glade
@@ -16,26 +20,15 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DG_LOG_DOMAIN=\"keyboard-properties\" \
-DGLADE_DATADIR=\""$(Gladedir)"\" \
- -I$(top_srcdir)/libcapplet \
- $(GNOME_INCLUDEDIR) \
- $(XML_CFLAGS) \
- $(LIBGLADE_CFLAGS) \
+ $(CAPPLET_CFLAGS) \
-I$(top_srcdir)/ \
-I$(top_srcdir)/intl
-bin_PROGRAMS = keyboard-properties-capplet
+bin_PROGRAMS = keyboard-properties
-keyboard_properties_capplet_SOURCES = \
+keyboard_properties_SOURCES = \
prefs-widget.c prefs-widget.h \
preferences.c preferences.h \
main.c
-keyboard_properties_capplet_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(ORBIT_LIBS) \
- $(GNOME_XML_LIB) \
- $(LIBGLADE_LIBS) \
- $(XF86MISC_LIBS) \
- -lgdk_pixbuf \
- ../../libcapplet/libcapplet.la
+keyboard_properties_LDADD = $(CAPPLET_LIBS) $(XF86MISC_LIBS)
diff --git a/capplets/keyboard/keyboard-properties.glade b/capplets/keyboard/keyboard-properties.glade
index 65eacc70d..38ad5be1d 100644
--- a/capplets/keyboard/keyboard-properties.glade
+++ b/capplets/keyboard/keyboard-properties.glade
@@ -28,169 +28,134 @@
<widget>
<class>GtkVBox</class>
<name>prefs_widget</name>
- <border_width>5</border_width>
<homogeneous>False</homogeneous>
- <spacing>5</spacing>
+ <spacing>4</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>repeat_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>repeat_toggled_cb</handler>
+ <last_modification_time>Thu, 30 Nov 2000 23:56:30 GMT</last_modification_time>
+ </signal>
+ <label>Enable Keyboard Repeat</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
<widget>
<class>GtkFrame</class>
- <name>frame1</name>
- <label>Auto-repeat</label>
+ <name>delay_frame</name>
+ <label>Delay Until Repeat</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
<widget>
- <class>GtkTable</class>
- <name>table1</name>
- <border_width>5</border_width>
- <rows>3</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
+ <class>GtkHBox</class>
+ <name>hbox2</name>
+ <border_width>4</border_width>
+ <homogeneous>True</homogeneous>
+ <spacing>4</spacing>
<widget>
- <class>GtkHScale</class>
- <name>rate_entry</name>
+ <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>
- <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>255</upper>
- <step>0</step>
- <page>0</page>
- <page_size>0</page_size>
+ <label>....a</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <active>False</active>
<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>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkHScale</class>
- <name>delay_entry</name>
+ <class>GtkToggleButton</class>
+ <name>delay1</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>10000</upper>
- <step>0</step>
- <page>0</page>
- <page_size>0</page_size>
+ <label>...a</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <active>False</active>
<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>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkCheckButton</class>
- <name>repeat_toggle</name>
+ <class>GtkToggleButton</class>
+ <name>delay2</name>
<can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>repeat_toggled_cb</handler>
- <last_modification_time>Mon, 11 Sep 2000 02:12:19 GMT</last_modification_time>
- </signal>
- <label>Enable auto-repeat</label>
+ <label>..a</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
<active>False</active>
- <draw_indicator>True</draw_indicator>
<child>
- <left_attach>0</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>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>Repeat rate</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>1</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkToggleButton</class>
+ <name>delay3</name>
+ <can_focus>True</can_focus>
+ <label>.a</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <active>False</active>
<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>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
- <name>label2</name>
- <label>Repeat delay</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
+ <name>label6</name>
+ <label></label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>1</yalign>
+ <xalign>0.5</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>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
</widget>
@@ -198,138 +163,160 @@
<widget>
<class>GtkFrame</class>
- <name>frame2</name>
- <label>Keyboard click</label>
+ <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>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
<widget>
- <class>GtkTable</class>
- <name>table2</name>
- <border_width>5</border_width>
- <rows>2</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
+ <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>GtkCheckButton</class>
- <name>click_toggle</name>
+ <class>GtkToggleButton</class>
+ <name>repeat0</name>
<can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>click_toggled_cb</handler>
- <last_modification_time>Mon, 11 Sep 2000 02:02:18 GMT</last_modification_time>
- </signal>
- <label>Click on keypress</label>
+ <label>a....a</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
<active>False</active>
- <draw_indicator>True</draw_indicator>
<child>
- <left_attach>0</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>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>Click volume</label>
- <justify>GTK_JUSTIFY_RIGHT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>1</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkToggleButton</class>
+ <name>repeat1</name>
+ <can_focus>True</can_focus>
+ <label>a...a</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <active>False</active>
<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>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
<widget>
- <class>GtkHScale</class>
- <name>click_volume_entry</name>
+ <class>GtkToggleButton</class>
+ <name>repeat2</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>100</upper>
- <step>0</step>
- <page>0</page>
- <page_size>0</page_size>
+ <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>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<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>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
</widget>
</widget>
<widget>
+ <class>GtkCheckButton</class>
+ <name>click_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>click_toggled_cb</handler>
+ <last_modification_time>Mon, 11 Sep 2000 02:02:18 GMT</last_modification_time>
+ </signal>
+ <label>Enable Keyboard Click</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkFrame</class>
- <name>frame3</name>
- <label>Preview</label>
+ <name>click_frame</name>
+ <label>Keyboard click</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
- <name>hbox1</name>
- <border_width>5</border_width>
+ <name>hbox4</name>
+ <border_width>4</border_width>
<homogeneous>False</homogeneous>
- <spacing>5</spacing>
+ <spacing>4</spacing>
<widget>
<class>GtkLabel</class>
- <name>label4</name>
- <label>Test settings</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
+ <name>label3</name>
+ <label>Click volume</label>
+ <justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
- <xalign>0.5</xalign>
+ <xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
@@ -341,13 +328,19 @@
</widget>
<widget>
- <class>GtkEntry</class>
- <name>entry1</name>
+ <class>GtkHScale</class>
+ <name>click_volume_entry</name>
<can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
+ <draw_value>False</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>
<padding>0</padding>
<expand>True</expand>
@@ -356,6 +349,21 @@
</widget>
</widget>
</widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>test_entry</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>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
</widget>
</widget>
diff --git a/capplets/keyboard/keyboard-properties.glade.h b/capplets/keyboard/keyboard-properties.glade.h
index d82b83483..eadc5abce 100644
--- a/capplets/keyboard/keyboard-properties.glade.h
+++ b/capplets/keyboard/keyboard-properties.glade.h
@@ -5,12 +5,18 @@
*/
gchar *s = N_("window1");
-gchar *s = N_("Auto-repeat");
-gchar *s = N_("Enable auto-repeat");
-gchar *s = N_("Repeat rate");
-gchar *s = N_("Repeat delay");
+gchar *s = N_("Enable Keyboard Repeat");
+gchar *s = N_("Delay Until Repeat");
+gchar *s = N_("....a");
+gchar *s = N_("...a");
+gchar *s = N_("..a");
+gchar *s = N_(".a");
+gchar *s = N_("Key Repeat Rate");
+gchar *s = N_("a....a");
+gchar *s = N_("a...a");
+gchar *s = N_("a..a");
+gchar *s = N_("a.a");
+gchar *s = N_("Enable Keyboard Click");
gchar *s = N_("Keyboard click");
-gchar *s = N_("Click on keypress");
gchar *s = N_("Click volume");
-gchar *s = N_("Preview");
-gchar *s = N_("Test settings");
+gchar *s = N_("Type here to test setting");
diff --git a/capplets/keyboard/preferences.c b/capplets/keyboard/preferences.c
index 50eb8a444..ab9d3e2d9 100644
--- a/capplets/keyboard/preferences.c
+++ b/capplets/keyboard/preferences.c
@@ -126,8 +126,8 @@ preferences_clone (Preferences *prefs)
new_prefs->rate = prefs->rate;
new_prefs->delay = prefs->delay;
new_prefs->repeat = prefs->repeat;
- new_prefs->click_volume = prefs->click_volume;
- new_prefs->click_on_keypress = prefs->click_on_keypress;
+ new_prefs->volume = prefs->volume;
+ new_prefs->click = prefs->click;
return object;
}
@@ -159,9 +159,9 @@ preferences_load (Preferences *prefs)
prefs->delay = gnome_config_get_int ("/Desktop/Keyboard/delay=-1");
prefs->repeat = gnome_config_get_bool_with_default
("/Desktop/Keyboard/repeat=true", &repeat_default);
- prefs->click_volume = gnome_config_get_int
+ prefs->volume = gnome_config_get_int
("/Desktop/Keyboard/clickvolume=-1");
- prefs->click_on_keypress = gnome_config_get_bool_with_default
+ prefs->click = gnome_config_get_bool_with_default
("/Desktop/Keyboard/click=false", &click_default);
XGetKeyboardControl (GDK_DISPLAY (), &kbdstate);
@@ -190,10 +190,10 @@ preferences_load (Preferences *prefs)
}
if (click_default)
- prefs->click_on_keypress = (kbdstate.key_click_percent == 0);
+ prefs->click = (kbdstate.key_click_percent == 0);
- if (prefs->click_volume == -1)
- prefs->click_volume = kbdstate.key_click_percent;
+ if (prefs->volume == -1)
+ prefs->volume = kbdstate.key_click_percent;
}
void
@@ -205,10 +205,8 @@ preferences_save (Preferences *prefs)
gnome_config_set_bool ("/Desktop/Keyboard/repeat", prefs->repeat);
gnome_config_set_int ("/Desktop/Keyboard/delay", prefs->delay);
gnome_config_set_int ("/Desktop/Keyboard/rate", prefs->rate);
- gnome_config_set_bool ("/Desktop/Keyboard/click",
- prefs->click_on_keypress);
- gnome_config_set_int ("/Desktop/Keyboard/clickvolume",
- prefs->click_volume);
+ gnome_config_set_bool ("/Desktop/Keyboard/click", prefs->click);
+ gnome_config_set_int ("/Desktop/Keyboard/clickvolume", prefs->volume);
gnome_config_sync ();
}
@@ -257,7 +255,7 @@ preferences_apply_now (Preferences *prefs)
}
kbdcontrol.key_click_percent =
- prefs->click_on_keypress ? prefs->click_volume : 0;
+ prefs->click ? prefs->volume : 0;
XChangeKeyboardControl (GDK_DISPLAY (), KBKeyClickPercent,
&kbdcontrol);
}
@@ -292,10 +290,10 @@ preferences_read_xml (xmlDocPtr xml_doc)
prefs->delay = xml_read_int (node, NULL);
else if (!strcmp (node->name, "repeat"))
prefs->repeat = TRUE;
- else if (!strcmp (node->name, "click-volume"))
- prefs->click_volume = xml_read_int (node, NULL);
- else if (!strcmp (node->name, "click-on-keypress"))
- prefs->click_on_keypress = TRUE;
+ else if (!strcmp (node->name, "volume"))
+ prefs->volume = xml_read_int (node, NULL);
+ else if (!strcmp (node->name, "click"))
+ prefs->click = TRUE;
}
return prefs;
@@ -318,11 +316,11 @@ preferences_write_xml (Preferences *prefs)
if (prefs->repeat)
xmlNewChild (node, NULL, "repeat", NULL);
- xmlAddChild (node, xml_write_int ("click-volume", NULL,
- prefs->click_volume));
+ xmlAddChild (node, xml_write_int ("volume", NULL,
+ prefs->volume));
- if (prefs->click_on_keypress)
- xmlNewChild (node, NULL, "click-on-keypress", NULL);
+ if (prefs->click)
+ xmlNewChild (node, NULL, "click", NULL);
xmlDocSetRootElement (doc, node);
diff --git a/capplets/keyboard/preferences.h b/capplets/keyboard/preferences.h
index c8417b3ec..f7df8ee91 100644
--- a/capplets/keyboard/preferences.h
+++ b/capplets/keyboard/preferences.h
@@ -44,9 +44,10 @@ struct _Preferences
gint rate;
gint delay;
- gint repeat;
- gint click_volume;
- gint click_on_keypress;
+ gint volume;
+
+ gboolean repeat;
+ gboolean click;
};
struct _PreferencesClass
diff --git a/capplets/keyboard/prefs-widget.c b/capplets/keyboard/prefs-widget.c
index a3306e0e8..e27ffc382 100644
--- a/capplets/keyboard/prefs-widget.c
+++ b/capplets/keyboard/prefs-widget.c
@@ -51,9 +51,9 @@ static void read_preferences (PrefsWidget *prefs_widget,
static void repeat_toggled_cb (GtkToggleButton *button,
PrefsWidget *prefs_widget);
-static void rate_changed_cb (GtkAdjustment *adjustment,
+static void rate_changed_cb (GtkToggleButton *toggle,
PrefsWidget *prefs_widget);
-static void delay_changed_cb (GtkAdjustment *adjustment,
+static void delay_changed_cb (GtkToggleButton *toggle,
PrefsWidget *prefs_widget);
static void click_toggled_cb (GtkToggleButton *button,
PrefsWidget *prefs_widget);
@@ -87,6 +87,10 @@ prefs_widget_get_type (void)
static void
prefs_widget_init (PrefsWidget *prefs_widget)
{
+ char delays[] = "delay0";
+ char rates[] = "repeat0";
+ int i;
+
GtkWidget *widget;
GtkAdjustment *adjustment;
@@ -102,16 +106,6 @@ prefs_widget_init (PrefsWidget *prefs_widget)
"prefs_widget");
gtk_container_add (GTK_CONTAINER (prefs_widget), widget);
- adjustment = gtk_range_get_adjustment
- (GTK_RANGE (WID ("rate_entry")));
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- rate_changed_cb, prefs_widget);
-
- adjustment = gtk_range_get_adjustment
- (GTK_RANGE (WID ("delay_entry")));
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- delay_changed_cb, prefs_widget);
-
glade_xml_signal_connect_data
(prefs_widget->dialog_data, "click_toggled_cb",
click_toggled_cb, prefs_widget);
@@ -120,6 +114,19 @@ prefs_widget_init (PrefsWidget *prefs_widget)
(GTK_RANGE (WID ("click_volume_entry")));
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
click_volume_changed_cb, prefs_widget);
+
+
+ for (i = 0; i < 4; i++) {
+ rates[6] = delays[5] = '0' + i;
+ prefs_widget->delay[i] = WID (delays);
+ prefs_widget->rate[i] = WID (rates);
+
+ gtk_signal_connect (GTK_OBJECT (prefs_widget->delay[i]), "toggled",
+ GTK_SIGNAL_FUNC (delay_changed_cb), prefs_widget);
+
+ gtk_signal_connect (GTK_OBJECT (prefs_widget->rate[i]), "toggled",
+ GTK_SIGNAL_FUNC (rate_changed_cb), prefs_widget);
+ }
}
static void
@@ -216,6 +223,7 @@ static void
read_preferences (PrefsWidget *prefs_widget, Preferences *prefs)
{
GtkAdjustment *adjustment;
+ int i;
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
@@ -225,21 +233,24 @@ read_preferences (PrefsWidget *prefs_widget, Preferences *prefs)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (WID ("repeat_toggle")), prefs->repeat);
- adjustment = gtk_range_get_adjustment
- (GTK_RANGE (WID ("rate_entry")));
- gtk_adjustment_set_value (adjustment, prefs->rate);
-
- adjustment = gtk_range_get_adjustment
- (GTK_RANGE (WID ("delay_entry")));
- gtk_adjustment_set_value (adjustment, prefs->delay);
+ i = CLAMP (prefs->rate * 3 / 255, 0, 3);
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON (prefs_widget->rate[i]), TRUE);
+ i = CLAMP ((10000 - prefs->delay) * 3 / 10000, 0, 3);
gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (WID ("click_toggle")),
- prefs->click_on_keypress);
+ (GTK_TOGGLE_BUTTON (prefs_widget->delay[i]), TRUE);
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON (WID ("click_toggle")), prefs->click);
+
adjustment = gtk_range_get_adjustment
(GTK_RANGE (WID ("click_volume_entry")));
- gtk_adjustment_set_value (adjustment, prefs->click_volume);
+ gtk_adjustment_set_value (adjustment, prefs->volume);
+
+ gtk_widget_set_sensitive (WID ("click_frame"), prefs_widget->prefs->click);
+ gtk_widget_set_sensitive (WID ("delay_frame"), prefs_widget->prefs->repeat);
+ gtk_widget_set_sensitive (WID ("repeat_frame"), prefs_widget->prefs->repeat);
}
static void
@@ -255,37 +266,65 @@ repeat_toggled_cb (GtkToggleButton *button, PrefsWidget *prefs_widget)
prefs_widget->prefs->repeat =
gtk_toggle_button_get_active (button);
+ gtk_widget_set_sensitive (WID ("delay_frame"), prefs_widget->prefs->repeat);
+ gtk_widget_set_sensitive (WID ("repeat_frame"), prefs_widget->prefs->repeat);
+
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
+static int
+set_scale (GtkToggleButton *toggle, GtkWidget **arr)
+{
+ int i, retval = 0;
+
+ for (i = 0; i < 4; i++) {
+ if (arr[i] == toggle) retval = i;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arr[i]), arr[i] == toggle);
+ }
+
+ return retval;
+}
+
static void
-rate_changed_cb (GtkAdjustment *adjustment, PrefsWidget *prefs_widget)
+rate_changed_cb (GtkToggleButton *toggle, PrefsWidget *prefs_widget)
{
+ int i;
+
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
g_return_if_fail (prefs_widget->prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+ g_return_if_fail (toggle != NULL);
+ g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
- prefs_widget->prefs->rate = adjustment->value;
+ if (!toggle->active)
+ return;
+
+ i = set_scale (toggle, prefs_widget->rate);
+ prefs_widget->prefs->rate = i * 255 / 3;
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
static void
-delay_changed_cb (GtkAdjustment *adjustment, PrefsWidget *prefs_widget)
+delay_changed_cb (GtkToggleButton *toggle, PrefsWidget *prefs_widget)
{
+ int i;
+
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
g_return_if_fail (prefs_widget->prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs_widget->prefs));
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+ g_return_if_fail (toggle != NULL);
+ g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle));
- prefs_widget->prefs->delay = adjustment->value;
+ if (!toggle->active)
+ return;
+
+ i = set_scale (toggle, prefs_widget->delay);
+ prefs_widget->prefs->delay = (3 - i) * 10000 / 3;
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
@@ -301,9 +340,11 @@ click_toggled_cb (GtkToggleButton *button, PrefsWidget *prefs_widget)
g_return_if_fail (button != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
- prefs_widget->prefs->click_on_keypress =
+ prefs_widget->prefs->click =
gtk_toggle_button_get_active (button);
+ gtk_widget_set_sensitive (WID ("click_frame"), prefs_widget->prefs->click);
+
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
}
@@ -318,7 +359,7 @@ click_volume_changed_cb (GtkAdjustment *adjustment, PrefsWidget *prefs_widget)
g_return_if_fail (adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- prefs_widget->prefs->click_volume = adjustment->value;
+ prefs_widget->prefs->volume = adjustment->value;
preferences_changed (prefs_widget->prefs);
capplet_widget_state_changed (CAPPLET_WIDGET (prefs_widget), TRUE);
diff --git a/capplets/keyboard/prefs-widget.h b/capplets/keyboard/prefs-widget.h
index e642e030e..6f904fae9 100644
--- a/capplets/keyboard/prefs-widget.h
+++ b/capplets/keyboard/prefs-widget.h
@@ -43,6 +43,9 @@ struct _PrefsWidget
Preferences *prefs;
GladeXML *dialog_data;
+
+ GtkWidget *delay[4];
+ GtkWidget *rate[4];
};
struct _PrefsWidgetClass
diff --git a/capplets/mouse/.cvsignore b/capplets/mouse/.cvsignore
index f299a28c8..bad9709cd 100644
--- a/capplets/mouse/.cvsignore
+++ b/capplets/mouse/.cvsignore
@@ -5,3 +5,4 @@ Makefile.in
*.o
*.lo
*.la
+mouse-properties-capplet
diff --git a/capplets/mouse/Makefile.am b/capplets/mouse/Makefile.am
index 5f2391f3b..2ac2ba76a 100644
--- a/capplets/mouse/Makefile.am
+++ b/capplets/mouse/Makefile.am
@@ -2,6 +2,10 @@ Applicationsdir = $(datadir)/control-center/Desktop
Applications_DATA = \
mouse-properties.desktop
+pApplicationsdir = $(datadir)/gnome/apps/Settings/Desktop
+pApplications_DATA = \
+ mouse-properties.desktop
+
Gladedir = $(datadir)/control-center-data
Glade_DATA = \
mouse-properties.glade
@@ -16,10 +20,8 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DG_LOG_DOMAIN=\"mouse-properties\" \
-DGLADE_DATADIR=\""$(Gladedir)"\" \
- -I$(top_srcdir)/libcapplet \
$(GNOME_INCLUDEDIR) \
- $(XML_CFLAGS) \
- $(LIBGLADE_CFLAGS) \
+ $(CAPPLET_CFLAGS) \
-I$(top_srcdir)/ \
-I$(top_srcdir)/intl
@@ -31,10 +33,5 @@ mouse_properties_capplet_SOURCES = \
main.c
mouse_properties_capplet_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(ORBIT_LIBS) \
- $(GNOME_XML_LIB) \
- $(LIBGLADE_LIBS) \
- -lgdk_pixbuf \
- ../../libcapplet/libcapplet.la
+ $(GNOME_LIBDIR) \
+ $(CAPPLET_LIBS)
diff --git a/capplets/screensaver/.cvsignore b/capplets/screensaver/.cvsignore
index cacc3c5d5..9758635d5 100644
--- a/capplets/screensaver/.cvsignore
+++ b/capplets/screensaver/.cvsignore
@@ -5,3 +5,4 @@ Makefile.in
*.lo
*.la
*.o
+screensaver-properties-capplet
diff --git a/capplets/screensaver/Makefile.am b/capplets/screensaver/Makefile.am
index dccce060e..7ef199de0 100644
--- a/capplets/screensaver/Makefile.am
+++ b/capplets/screensaver/Makefile.am
@@ -6,6 +6,10 @@ Applicationsdir = $(datadir)/control-center/Desktop
Applications_DATA = \
screensaver-properties.desktop
+pApplicationsdir = $(datadir)/gnome/apps/Settings/Desktop
+pApplications_DATA = \
+ screensaver-properties.desktop
+
SUBDIRS = screensavers
EXTRA_DIST = ChangeLog $(Applications_DATA) $(pixmap_DATA) \
@@ -16,12 +20,9 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DSSPROP_DATADIR=\""${prefix}/share"\" \
-DG_LOG_DOMAIN=\"screensaver-properties\" \
- $(GNOME_INCLUDEDIR) \
- $(XML_CFLAGS) \
+ $(CAPPLET_CFLAGS) \
-I$(top_srcdir)/ \
- -I../intl \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/libcapplet
+ -I$(top_srcdir)/intl
bin_PROGRAMS = screensaver-properties-capplet
@@ -39,14 +40,4 @@ screensaver_properties_capplet_SOURCES = \
XScreenSaver_ad.h \
main.c
-screensaver_properties_capplet_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(ORBIT_LIBS) \
- $(GNOME_XML_LIB) \
- -lXt \
- -lgdk_pixbuf \
- ../../libcapplet/libcapplet.la
-
-install-data-local:
- $(INSTALL_DATA) $(srcdir)/screensaver-properties.desktop $(DESTDIR)$(datadir)/gnome/apps/Settings/Desktop/screensaver-properties.desktop
+screensaver_properties_capplet_LDADD = $(CAPPLET_LIBS) -lXt
diff --git a/capplets/sound/.cvsignore b/capplets/sound/.cvsignore
index cacc3c5d5..ac4742412 100644
--- a/capplets/sound/.cvsignore
+++ b/capplets/sound/.cvsignore
@@ -5,3 +5,4 @@ Makefile.in
*.lo
*.la
*.o
+sound-properties-capplet
diff --git a/capplets/sound/Makefile.am b/capplets/sound/Makefile.am
index a80ba04b5..f76275078 100644
--- a/capplets/sound/Makefile.am
+++ b/capplets/sound/Makefile.am
@@ -2,6 +2,10 @@ Applicationsdir = $(datadir)/control-center/Desktop
Applications_DATA = \
sound-properties.desktop
+pApplicationsdir = $(datadir)/gnome/apps/Settings/Desktop
+pApplications_DATA = \
+ sound-properties.desktop
+
Gladedir = $(datadir)/control-center-data
Glade_DATA = \
sound-properties.glade
@@ -16,10 +20,7 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DG_LOG_DOMAIN=\"sound-properties\" \
-DGLADE_DATADIR=\""$(Gladedir)"\" \
- -I$(top_srcdir)/libcapplet \
- $(GNOME_INCLUDEDIR) \
- $(XML_CFLAGS) \
- $(LIBGLADE_CFLAGS) \
+ $(CAPPLET_CFLAGS) \
-I$(top_srcdir)/ \
-I$(top_srcdir)/intl
@@ -30,11 +31,4 @@ sound_properties_capplet_SOURCES = \
preferences.c preferences.h \
main.c
-sound_properties_capplet_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(ORBIT_LIBS) \
- $(GNOME_XML_LIB) \
- $(LIBGLADE_LIBS) \
- -lgdk_pixbuf \
- ../../libcapplet/libcapplet.la
+sound_properties_capplet_LDADD = $(CAPPLET_LIBS)
diff --git a/capplets/theme-switcher/Makefile.am b/capplets/theme-switcher/Makefile.am
index 1c275174b..13769f482 100644
--- a/capplets/theme-switcher/Makefile.am
+++ b/capplets/theme-switcher/Makefile.am
@@ -2,7 +2,7 @@ INCLUDES = -I. -I$(srcdir) \
-I$(top_srcdir)/intl -I$(top_builddir)/intl \
-I$(srcdir)/../../libcapplet \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -I$(includedir) $(GNOME_INCLUDEDIR)
+ $(CAPPLET_CFLAGS)
bin_PROGRAMS = theme-selector-capplet
@@ -17,12 +17,7 @@ theme_selector_capplet_SOURCES = \
gui.c \
install.c
-theme_selector_capplet_LDFLAGS = ../../libcapplet/libcapplet.la `imlib-config --libs`
-
-theme_selector_capplet_LDADD = ../../libcapplet/libcapplet.la \
- $(GNOME_LIBS) $(ORBIT_LIBS) \
- $(GNOMEUI_LIBS) $(INTLLIBS) \
- -lImlib $(GNOME_LIBDIR)
+theme_selector_capplet_LDADD = $(CAPPLET_LIBS)
EXTRA_DIST = \
theme-selector.desktop
@@ -30,5 +25,5 @@ EXTRA_DIST = \
sysdir = $(datadir)/control-center/Desktop
sys_DATA = theme-selector.desktop
-install-data-local:
- $(INSTALL_DATA) $(srcdir)/theme-selector.desktop $(DESTDIR)$(datadir)/gnome/apps/Settings/Desktop/theme-selector.desktop
+psysdir = $(datadir)/gnome/apps/Settings/Desktop
+psys_DATA = theme-selector.desktop
diff --git a/capplets/ui-properties/.cvsignore b/capplets/ui-properties/.cvsignore
index cacc3c5d5..26f7fc814 100644
--- a/capplets/ui-properties/.cvsignore
+++ b/capplets/ui-properties/.cvsignore
@@ -5,3 +5,4 @@ Makefile.in
*.lo
*.la
*.o
+ui-properties-capplet
diff --git a/capplets/ui-properties/Makefile.am b/capplets/ui-properties/Makefile.am
index 055f03d37..93d8fea17 100644
--- a/capplets/ui-properties/Makefile.am
+++ b/capplets/ui-properties/Makefile.am
@@ -1,8 +1,8 @@
Applicationsdir = $(datadir)/control-center/Desktop
-Applications_DATA = \
- application.desktop
- dialogs.desktop
- mdi.desktop
+Applications_DATA = behavior.desktop
+
+pApplicationsdir = $(datadir)/gnome/apps/Settings/Desktop
+pApplications_DATA = behavior.desktop
Gladedir = $(datadir)/control-center-data
Glade_DATA = \
@@ -18,10 +18,7 @@ INCLUDES = \
-DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
-DG_LOG_DOMAIN=\"ui-properties\" \
-DGLADE_DATADIR=\""$(Gladedir)"\" \
- -I$(top_srcdir)/libcapplet \
- $(GNOME_INCLUDEDIR) \
- $(XML_CFLAGS) \
- $(LIBGLADE_CFLAGS) \
+ $(CAPPLET_CFLAGS) \
-I$(top_srcdir)/ \
-I$(top_srcdir)/intl
@@ -29,17 +26,7 @@ bin_PROGRAMS = ui-properties-capplet
ui_properties_capplet_SOURCES = \
prefs-widget.c prefs-widget.h \
- prefs-widget-app.c prefs-widget-app.h \
- prefs-widget-dialogs.c prefs-widget-dialogs.h \
- prefs-widget-mdi.c prefs-widget-mdi.h \
preferences.c preferences.h \
main.c
-ui_properties_capplet_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(ORBIT_LIBS) \
- $(GNOME_XML_LIB) \
- $(LIBGLADE_LIBS) \
- -lgdk_pixbuf \
- ../../libcapplet/libcapplet.la
+ui_properties_capplet_LDADD = $(CAPPLET_LIBS)
diff --git a/capplets/ui-properties/application.desktop b/capplets/ui-properties/behavior.desktop
index 7a04a4af4..3debe8121 100644
--- a/capplets/ui-properties/application.desktop
+++ b/capplets/ui-properties/behavior.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-Name=Applications
+Name=Behavior
Name[ca]=Aplicacions
Name[cs]=Aplikace
Name[da]=Applikationer
@@ -26,7 +26,7 @@ Name[uk]=ðÒÏÇÒÁÍÉ
Name[wa]=Programes
Name[zh_TW.Big5]=À³¥Îµ{¦¡ªº¹w³]­È
Name[zh_CN.GB2312]=Ó¦ÓóÌʽµÄÔ¤ÉèÖµ
-Comment=Sets the default feel of GNOME applications
+Comment=Sets the default behavior of GNOME applications
Comment[ca]=Establir el comportament de les aplicacions de GNOME.
Comment[cs]=Nastavení standardního vzhledu aplikací Gnome
Comment[da]=Indstil hvordan Gnome-programmer føles at bruge.
@@ -52,7 +52,7 @@ Comment[uk]=÷ÓÔÁÎÏ×ÌÅÎÎÑ ÔÉÐÏ×ÏÇÏ ×ÉÇÌÑÄÕ ÐÒÏÇÒÁÍ GNOME.
Comment[wa]=Apontyî kmint les programes GNOME vont ovrer
Comment[zh_TW.Big5]=³]©w GNOME À³¥Îµ{¦¡ªº¹w³]¥~Æ[¡C
Comment[zh_CN.GB2312]=É趨 GNOME Ó¦ÓóÌʽµÄÔ¤ÉèÍâ¹Û¡£
-Exec=ui-properties-capplet --cap-id=1
+Exec=ui-properties-capplet
Icon=gnome-applications.png
Terminal=0
Type=Application
diff --git a/capplets/ui-properties/dialogs.desktop b/capplets/ui-properties/dialogs.desktop
deleted file mode 100644
index c07500a6e..000000000
--- a/capplets/ui-properties/dialogs.desktop
+++ /dev/null
@@ -1,30 +0,0 @@
-[Desktop Entry]
-Name=Dialogs
-Name[cs]=Dialogy
-Name[ca]=Quadres de diàleg
-Name[da]=Dialogbokse
-Name[de]=Dialogfelder
-Name[el]=ÄéÜëïãïé
-Name[es]=Diálogos
-Name[et]=Dialoogid
-Name[fi]=Valintaikkunat
-Name[fr]=Dialogues
-Name[gl]=Diálogos
-Name[hu]=Párbeszédablakok
-Name[it]=Finestre di dialogo
-Name[ja]=¥À¥¤¥¢¥í¥°
-Name[ko]=´ëÈ­»óÀÚ
-Name[no]=Dialoger
-Name[pl]=Okna dialogowe
-Name[pt]=Diálogos
-Name[ru]=äÉÁÌÏÇÉ
-Name[sl]=Dialogi
-Name[sv]=Dialogrutor
-Name[tr]=Diyaloklar
-Name[uk]=ä¦ÁÌÏÇÉ
-Name[wa]=Purneas di dialogue
-Comment[fr]=Configuration du comportement des boîtes de dialogue GNOME
-Exec=ui-properties-capplet --cap-id=0
-Icon=gnome-ccdialog.png
-Terminal=0
-Type=Application
diff --git a/capplets/ui-properties/main.c b/capplets/ui-properties/main.c
index 1429c99ea..af4769cbc 100644
--- a/capplets/ui-properties/main.c
+++ b/capplets/ui-properties/main.c
@@ -62,24 +62,14 @@ setup_capplet_widget (void)
{
preferences_freeze (prefs);
- switch (capplet_widget_class_get_capid ()) {
- case 0:
- prefs_widget = PREFS_WIDGET (prefs_widget_dialogs_new (prefs));
- break;
- case 1:
- prefs_widget = PREFS_WIDGET (prefs_widget_app_new (prefs));
- break;
- case 2:
- prefs_widget = PREFS_WIDGET (prefs_widget_mdi_new (prefs));
- break;
- }
+ 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));
+ gtk_widget_show (GTK_WIDGET (prefs_widget));
preferences_thaw (prefs);
}
@@ -146,7 +136,7 @@ main (int argc, char **argv)
return 0;
}
else if (res == 4) {
- do_set_xml ();
+ do_set_xml ();
return 0;
}
@@ -175,20 +165,7 @@ main (int argc, char **argv)
token = 1;
}
- switch (capplet_widget_class_get_capid ()) {
- case 0:
- gnome_window_icon_set_default_from_file
- (GNOME_ICONDIR"/gnome-ccdialog.png");
- break;
- case 1:
- gnome_window_icon_set_default_from_file
- (GNOME_ICONDIR"/gnome-applications.png");
- break;
- case 2:
- gnome_window_icon_set_default_from_file
- (GNOME_ICONDIR"/gnome-mdi.png");
- break;
- }
+ gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnome-applications.png");
prefs = PREFERENCES (preferences_new ());
preferences_load (prefs);
diff --git a/capplets/ui-properties/mdi.desktop b/capplets/ui-properties/mdi.desktop
deleted file mode 100644
index 5f486584d..000000000
--- a/capplets/ui-properties/mdi.desktop
+++ /dev/null
@@ -1,26 +0,0 @@
-[Desktop Entry]
-Name=MDI
-Name[ca]=Multidocument
-Name[da]=Multidokument
-Name[de]=Multi-Dokument-Interface
-Name[el]=Ðïëý-ÍôïêïõìÝíôï
-Name[es]=Multidocumento
-Name[et]=Multidokument
-Name[fi]=Usean asiakirjan käyttö
-Name[fr]=Interface Multi Document
-Name[gl]=Multi-Documento
-Name[ja]=MDI
-Name[ko]=¿©·¯¹®¼­
-Name[no]=MDI
-Name[pl]=MDI
-Name[pt]=MDI
-Name[sl]=MDI (Veèdokumentni vmesnik)
-Name[sv]=MDI
-Name[tr]=ÇDY
-Name[uk]=MDI
-Name[wa]=Eterface multi-documints (MDI)
-Comment[fr]=Configuration du comportement des applications multidocument GNOME
-Exec=ui-properties-capplet --cap-id=2
-Icon=gnome-mdi.png
-Terminal=0
-Type=Application
diff --git a/capplets/ui-properties/pixmaps/gnome-warning.png b/capplets/ui-properties/pixmaps/gnome-warning.png
new file mode 100644
index 000000000..d6f2306db
--- /dev/null
+++ b/capplets/ui-properties/pixmaps/gnome-warning.png
Binary files differ
diff --git a/capplets/ui-properties/preferences.c b/capplets/ui-properties/preferences.c
index 935a574ca..34f617989 100644
--- a/capplets/ui-properties/preferences.c
+++ b/capplets/ui-properties/preferences.c
@@ -475,6 +475,16 @@ preferences_get_statusbar_meter_on_right (Preferences *prefs)
}
int
+preferences_get_statusbar_meter_on_left (Preferences *prefs)
+{
+ g_return_val_if_fail (prefs != NULL, 0);
+ g_return_val_if_fail (IS_PREFERENCES (prefs), 0);
+ g_return_val_if_fail (prefs->gnome_prefs != NULL, 0);
+
+ return !prefs->gnome_prefs->statusbar_meter_on_right;
+}
+
+int
preferences_get_menubar_detachable (Preferences *prefs)
{
g_return_val_if_fail (prefs != NULL, 0);
@@ -535,7 +545,17 @@ preferences_get_toolbar_lines (Preferences *prefs)
}
int
-preferences_get_toolbar_labels (Preferences *prefs)
+preferences_get_toolbar_icons_only (Preferences *prefs)
+{
+ g_return_val_if_fail (prefs != NULL, 0);
+ g_return_val_if_fail (IS_PREFERENCES (prefs), 0);
+ g_return_val_if_fail (prefs->gnome_prefs != NULL, 0);
+
+ return !prefs->gnome_prefs->toolbar_labels;
+}
+
+int
+preferences_get_toolbar_text_below (Preferences *prefs)
{
g_return_val_if_fail (prefs != NULL, 0);
g_return_val_if_fail (IS_PREFERENCES (prefs), 0);
@@ -635,8 +655,7 @@ preferences_get_dialog_icons (Preferences *prefs)
}
void
-preferences_set_dialog_buttons_style (Preferences *prefs,
- GtkButtonBoxStyle style)
+preferences_set_dialog_buttons_style (Preferences *prefs, int style)
{
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
@@ -716,6 +735,16 @@ preferences_set_statusbar_meter_on_right (Preferences *prefs, int s)
}
void
+preferences_set_statusbar_meter_on_left (Preferences *prefs, int s)
+{
+ g_return_if_fail (prefs != NULL);
+ g_return_if_fail (IS_PREFERENCES (prefs));
+ g_return_if_fail (prefs->gnome_prefs != NULL);
+
+ prefs->gnome_prefs->statusbar_meter_on_right = !s;
+}
+
+void
preferences_set_menubar_detachable (Preferences *prefs, int s)
{
g_return_if_fail (prefs != NULL);
@@ -776,7 +805,17 @@ preferences_set_toolbar_lines (Preferences *prefs, int s)
}
void
-preferences_set_toolbar_labels (Preferences *prefs, int s)
+preferences_set_toolbar_icons_only (Preferences *prefs, int s)
+{
+ g_return_if_fail (prefs != NULL);
+ g_return_if_fail (IS_PREFERENCES (prefs));
+ g_return_if_fail (prefs->gnome_prefs != NULL);
+
+ prefs->gnome_prefs->toolbar_labels = !s;
+}
+
+void
+preferences_set_toolbar_text_below (Preferences *prefs, int s)
{
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
@@ -826,7 +865,7 @@ preferences_set_disable_imlib_cache (Preferences *prefs, int s)
}
void
-preferences_set_dialog_type (Preferences *prefs, GtkWindowType type)
+preferences_set_dialog_type (Preferences *prefs, int type)
{
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
@@ -836,7 +875,7 @@ preferences_set_dialog_type (Preferences *prefs, GtkWindowType type)
}
void
-preferences_set_dialog_position (Preferences *prefs, GtkWindowPosition pos)
+preferences_set_dialog_position (Preferences *prefs, int pos)
{
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
@@ -846,7 +885,7 @@ preferences_set_dialog_position (Preferences *prefs, GtkWindowPosition pos)
}
void
-preferences_set_mdi_mode (Preferences *prefs, GnomeMDIMode mode)
+preferences_set_mdi_mode (Preferences *prefs, int mode)
{
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
@@ -856,7 +895,7 @@ preferences_set_mdi_mode (Preferences *prefs, GnomeMDIMode mode)
}
void
-preferences_set_mdi_tab_pos (Preferences *prefs, GtkPositionType type)
+preferences_set_mdi_tab_pos (Preferences *prefs, int type)
{
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_PREFERENCES (prefs));
diff --git a/capplets/ui-properties/preferences.h b/capplets/ui-properties/preferences.h
index 1ee562b01..2b1d989a0 100644
--- a/capplets/ui-properties/preferences.h
+++ b/capplets/ui-properties/preferences.h
@@ -72,59 +72,79 @@ xmlDocPtr preferences_write_xml (Preferences *prefs);
/* get/set functions. It's really stupid that we need these */
-GtkButtonBoxStyle preferences_get_dialog_buttons_style (Preferences *prefs);
-int preferences_get_property_box_buttons_ok (Preferences *prefs);
-int preferences_get_property_box_buttons_apply (Preferences *prefs);
-int preferences_get_property_box_buttons_close (Preferences *prefs);
-int preferences_get_property_box_buttons_help (Preferences *prefs);
+int preferences_get_menubar_detachable (Preferences *prefs);
+int preferences_get_menubar_relief (Preferences *prefs);
+int preferences_get_menus_have_tearoff (Preferences *prefs);
+int preferences_get_menus_have_icons (Preferences *prefs);
+
int preferences_get_statusbar_not_dialog (Preferences *prefs);
int preferences_get_statusbar_is_interactive (Preferences *prefs);
+int preferences_get_statusbar_meter_on_left (Preferences *prefs);
int preferences_get_statusbar_meter_on_right (Preferences *prefs);
-int preferences_get_menubar_detachable (Preferences *prefs);
-int preferences_get_menubar_relief (Preferences *prefs);
+
int preferences_get_toolbar_detachable (Preferences *prefs);
int preferences_get_toolbar_relief (Preferences *prefs);
int preferences_get_toolbar_relief_btn (Preferences *prefs);
int preferences_get_toolbar_lines (Preferences *prefs);
-int preferences_get_toolbar_labels (Preferences *prefs);
+int preferences_get_toolbar_icons_only (Preferences *prefs);
+int preferences_get_toolbar_text_below (Preferences *prefs);
+
+int preferences_get_dialog_icons (Preferences *prefs);
int preferences_get_dialog_centered (Preferences *prefs);
-int preferences_get_menus_have_tearoff (Preferences *prefs);
-int preferences_get_menus_have_icons (Preferences *prefs);
-int preferences_get_disable_imlib_cache (Preferences *prefs);
-GtkWindowType preferences_get_dialog_type (Preferences *prefs);
+
GtkWindowPosition preferences_get_dialog_position (Preferences *prefs);
+GtkWindowType preferences_get_dialog_type (Preferences *prefs);
+GtkButtonBoxStyle preferences_get_dialog_buttons_style (Preferences *prefs);
+
GnomeMDIMode preferences_get_mdi_mode (Preferences *prefs);
GtkPositionType preferences_get_mdi_tab_pos (Preferences *prefs);
-int preferences_get_dialog_icons (Preferences *prefs);
-void preferences_set_dialog_buttons_style (Preferences *prefs,
- GtkButtonBoxStyle);
-void preferences_set_property_box_buttons_ok (Preferences *prefs, int);
-void preferences_set_property_box_buttons_apply (Preferences *prefs, int);
-void preferences_set_property_box_buttons_close (Preferences *prefs, int);
-void preferences_set_property_box_buttons_help (Preferences *prefs, int);
-void preferences_set_statusbar_not_dialog (Preferences *prefs, int);
-void preferences_set_statusbar_is_interactive (Preferences *prefs, int);
-void preferences_set_statusbar_meter_on_right (Preferences *prefs, int);
-void preferences_set_menubar_detachable (Preferences *prefs, int);
-void preferences_set_menubar_relief (Preferences *prefs, int);
-void preferences_set_toolbar_detachable (Preferences *prefs, int);
-void preferences_set_toolbar_relief (Preferences *prefs, int);
-void preferences_set_toolbar_relief_btn (Preferences *prefs, int);
-void preferences_set_toolbar_lines (Preferences *prefs, int);
-void preferences_set_toolbar_labels (Preferences *prefs, int);
-void preferences_set_dialog_centered (Preferences *prefs, int);
-void preferences_set_menus_have_tearoff (Preferences *prefs, int);
-void preferences_set_menus_have_icons (Preferences *prefs, int);
-void preferences_set_disable_imlib_cache (Preferences *prefs, int);
-void preferences_set_dialog_type (Preferences *prefs,
- GtkWindowType);
-void preferences_set_dialog_position (Preferences *prefs,
- GtkWindowPosition);
-void preferences_set_mdi_mode (Preferences *prefs,
- GnomeMDIMode);
-void preferences_set_mdi_tab_pos (Preferences *prefs,
- GtkPositionType);
-void preferences_set_dialog_icons (Preferences *prefs, int);
+#if 0
+int preferences_get_property_box_buttons_ok (Preferences *prefs);
+int preferences_get_property_box_buttons_apply (Preferences *prefs);
+int preferences_get_property_box_buttons_close (Preferences *prefs);
+int preferences_get_property_box_buttons_help (Preferences *prefs);
+int preferences_get_disable_imlib_cache (Preferences *prefs);
+#endif
+
+
+
+
+
+
+void preferences_set_menubar_detachable (Preferences *prefs, int i);
+void preferences_set_menubar_relief (Preferences *prefs, int i);
+void preferences_set_menus_have_tearoff (Preferences *prefs, int i);
+void preferences_set_menus_have_icons (Preferences *prefs, int i);
+
+void preferences_set_statusbar_not_dialog (Preferences *prefs, int i);
+void preferences_set_statusbar_is_interactive (Preferences *prefs, int i);
+void preferences_set_statusbar_meter_on_left (Preferences *prefs, int i);
+void preferences_set_statusbar_meter_on_right (Preferences *prefs, int i);
+
+void preferences_set_toolbar_detachable (Preferences *prefs, int i);
+void preferences_set_toolbar_relief (Preferences *prefs, int i);
+void preferences_set_toolbar_relief_btn (Preferences *prefs, int i);
+void preferences_set_toolbar_lines (Preferences *prefs, int i);
+void preferences_set_toolbar_icons_only (Preferences *prefs, int i);
+void preferences_set_toolbar_text_below (Preferences *prefs, int i);
+
+void preferences_set_dialog_icons (Preferences *prefs, int i);
+void preferences_set_dialog_centered (Preferences *prefs, int i);
+
+void preferences_set_dialog_position (Preferences *prefs, int i);
+void preferences_set_dialog_type (Preferences *prefs, int i);
+void preferences_set_dialog_buttons_style (Preferences *prefs, int i);
+
+void preferences_set_mdi_mode (Preferences *prefs, int i);
+void preferences_set_mdi_tab_pos (Preferences *prefs, int i);
+
+#if 0
+void preferences_set_property_box_buttons_ok (Preferences *prefs, int i);
+void preferences_set_property_box_buttons_apply (Preferences *prefs, int i);
+void preferences_set_property_box_buttons_close (Preferences *prefs, int i);
+void preferences_set_property_box_buttons_help (Preferences *prefs, int i);
+void preferences_set_disable_imlib_cache (Preferences *prefs, int i);
+#endif
#endif /* __PREFERENCES_H */
diff --git a/capplets/ui-properties/prefs-widget.c b/capplets/ui-properties/prefs-widget.c
index 72e5f7bec..79b37af11 100644
--- a/capplets/ui-properties/prefs-widget.c
+++ b/capplets/ui-properties/prefs-widget.c
@@ -31,6 +31,37 @@
#define WID(str) (glade_xml_get_widget (prefs_widget->dialog_data, str))
+static widget_desc_t widget_desc[] = {
+ WD_CHECK (menubar_detachable, "menubar_detachable"),
+ WD_CHECK (menubar_relief, "menubar_relief"),
+ WD_CHECK (menus_have_tearoff, "menus_have_tearoff"),
+ WD_CHECK (menus_have_icons, "menus_have_icons"),
+
+ WD_CHECK (statusbar_not_dialog, "statusbar_not_dialog"),
+ WD_CHECK (statusbar_is_interactive, "statusbar_is_interactive"),
+ WD_CHECK (statusbar_meter_on_left , "statusbar_meter_on_left"),
+ WD_CHECK (statusbar_meter_on_right, "statusbar_meter_on_right"),
+
+ WD_CHECK (toolbar_detachable, "toolbar_detachable"),
+ WD_CHECK (toolbar_relief, "toolbar_relief"),
+ WD_CHECK (toolbar_relief_btn, "toolbar_relief_btn"),
+ WD_CHECK (toolbar_lines, "toolbar_lines"),
+ WD_CHECK (toolbar_icons_only, "toolbar_icons_only"),
+ WD_CHECK (toolbar_text_below, "toolbar_text_below"),
+
+ WD_CHECK (dialog_icons, "dialog_icons"),
+ WD_CHECK (dialog_centered, "dialog_centered"),
+
+ WD_OPTION (dialog_position, "dialog_position"),
+ WD_OPTION (dialog_type, "dialog_type"),
+ WD_OPTION (dialog_buttons_style, "dialog_buttons_style"),
+
+ WD_OPTION (mdi_mode, "mdi_mode"),
+ WD_OPTION (mdi_tab_pos, "mdi_tab_pos"),
+
+ WD_END
+};
+
enum {
ARG_0,
ARG_PREFERENCES,
@@ -134,6 +165,8 @@ prefs_widget_class_init (PrefsWidgetClass *class)
parent_class = CAPPLET_WIDGET_CLASS
(gtk_type_class (capplet_widget_get_type ()));
+
+ class->widget_desc = widget_desc;
}
static void
@@ -221,11 +254,22 @@ prefs_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GtkWidget *
prefs_widget_new (Preferences *prefs)
{
+ GtkWidget *widget, *dlg_widget;
+ GladeXML *dialog_data;
+
g_return_val_if_fail (prefs == NULL || IS_PREFERENCES (prefs), NULL);
- return gtk_widget_new (prefs_widget_get_type (),
- "preferences", prefs,
- NULL);
+ dialog_data = glade_xml_new (GLADE_DATADIR"/ui-properties.glade", "prefs_widget");
+
+ widget = gtk_widget_new (prefs_widget_get_type (),
+ "preferences", prefs,
+ "dialog_data", dialog_data,
+ NULL);
+
+ dlg_widget = glade_xml_get_widget (dialog_data, "prefs_widget");
+ gtk_container_add (GTK_CONTAINER (widget), dlg_widget);
+
+ return widget;
}
void
@@ -310,33 +354,31 @@ register_callbacks (PrefsWidget *prefs_widget, GladeXML *dialog_data)
g_return_if_fail (widget_desc[i].get_func != NULL);
g_return_if_fail (widget_desc[i].set_func != NULL);
- if (widget_desc[i].type == WDTYPE_OPTION) {
- menu = glade_xml_get_widget (dialog_data,
- widget_desc[i].name);
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (menu));
-
- node = GTK_MENU_SHELL (gtk_option_menu_get_menu
- (GTK_OPTION_MENU
- (menu)))->children;
-
- j = 0;
-
- while (node != NULL) {
- gtk_signal_connect (GTK_OBJECT (node->data),
- "activate",
- GTK_SIGNAL_FUNC
- (selected_cb),
- prefs_widget);
- gtk_object_set_data (GTK_OBJECT (node->data),
- "index", (gpointer) j);
- gtk_object_set_data (GTK_OBJECT (node->data),
- "name",
- widget_desc[i].name);
- j++;
- node = node->next;
- }
+ if (widget_desc[i].type != WDTYPE_OPTION)
+ continue;
+
+ menu = glade_xml_get_widget (dialog_data,
+ widget_desc[i].name);
+
+ g_return_if_fail (menu != NULL);
+ g_return_if_fail (GTK_IS_OPTION_MENU (menu));
+
+ node = GTK_MENU_SHELL (gtk_option_menu_get_menu
+ (GTK_OPTION_MENU
+ (menu)))->children;
+
+ for (j = 0; node; j++, node = node->next) {
+ gtk_signal_connect (GTK_OBJECT (node->data),
+ "activate",
+ GTK_SIGNAL_FUNC
+ (selected_cb),
+ prefs_widget);
+ gtk_object_set_data (GTK_OBJECT (node->data),
+ "index",
+ GINT_TO_POINTER (j));
+ gtk_object_set_data (GTK_OBJECT (node->data),
+ "name",
+ widget_desc[i].name);
}
}
}
@@ -400,7 +442,7 @@ selected_cb (GtkMenuItem *mi, PrefsWidget *prefs_widget)
g_return_if_fail (prefs_widget != NULL);
g_return_if_fail (IS_PREFS_WIDGET (prefs_widget));
- index = (gint) gtk_object_get_data (GTK_OBJECT (mi), "index");
+ index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (mi), "index"));
widget_name = gtk_object_get_data (GTK_OBJECT (mi), "name");
g_return_if_fail (widget_name != NULL);
widget_desc = find_widget_desc_with_name (prefs_widget, widget_name);
diff --git a/capplets/ui-properties/prefs-widget.h b/capplets/ui-properties/prefs-widget.h
index fa63d3d07..1392a6a65 100644
--- a/capplets/ui-properties/prefs-widget.h
+++ b/capplets/ui-properties/prefs-widget.h
@@ -33,7 +33,9 @@
/* Generic widget descriptors to make maintenance easier */
typedef enum _widget_desc_type_t {
- WDTYPE_NONE, WDTYPE_CHECK, WDTYPE_OPTION
+ WDTYPE_NONE,
+ WDTYPE_CHECK,
+ WDTYPE_OPTION
} widget_desc_type_t;
struct _widget_desc_t
diff --git a/capplets/ui-properties/ui-properties.glade b/capplets/ui-properties/ui-properties.glade
index 2eb0c58d0..e90d0824b 100644
--- a/capplets/ui-properties/ui-properties.glade
+++ b/capplets/ui-properties/ui-properties.glade
@@ -16,326 +16,8 @@
<widget>
<class>GtkWindow</class>
- <name>window1</name>
- <title>window1</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkHBox</class>
- <name>prefs_widget_app</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame1</name>
- <label>Menu Options</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox2</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>menubar_detachable_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:48:47 GMT</last_modification_time>
- </signal>
- <label>Can detach and move menus</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>menubar_relief_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:48:53 GMT</last_modification_time>
- </signal>
- <label>Menus have relieved border</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>menus_have_tearoff_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:03 GMT</last_modification_time>
- </signal>
- <label>Submenus can be torn off</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>menus_have_icons_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:11 GMT</last_modification_time>
- </signal>
- <label>Menu items have icons</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame2</name>
- <label>Statusbar Options</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox3</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>statusbar_is_interactive_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:20 GMT</last_modification_time>
- </signal>
- <label>Statusbar is interactive when possible</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>statusbar_meter_on_right_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:29 GMT</last_modification_time>
- </signal>
- <label>Statusbar progress meter is on the right</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox4</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame3</name>
- <label>Toolbar Options</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>GtkVBox</class>
- <name>vbox5</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>toolbar_detachable_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:38 GMT</last_modification_time>
- </signal>
- <label>Can detach and move toolbars</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>toolbar_relief_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:42 GMT</last_modification_time>
- </signal>
- <label>Toolbars have relieved border</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>toolbar_relief_btn_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:48 GMT</last_modification_time>
- </signal>
- <label>Toolbar buttons have relieved border</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>toolbar_lines_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:53 GMT</last_modification_time>
- </signal>
- <label>Toolbars have line separators</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>toolbar_labels_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 02:49:57 GMT</last_modification_time>
- </signal>
- <label>Toolbars have text labels</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GtkWindow</class>
- <name>window2</name>
- <title>window2</title>
+ <name>window4</name>
+ <title>window4</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
@@ -345,175 +27,43 @@
<widget>
<class>GtkVBox</class>
- <name>prefs_widget_dialogs</name>
- <border_width>5</border_width>
+ <name>prefs_widget</name>
<homogeneous>False</homogeneous>
- <spacing>5</spacing>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame4</name>
- <label>Dialog Layout</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox7</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>Dialog Buttons:</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>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>dialog_buttons_style_select</name>
- <can_focus>True</can_focus>
- <items>Default value
-Spread buttons out
-Put buttons on edges
-Left-justify buttons
-Right-justify buttons
-</items>
- <initial_choice>0</initial_choice>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>dialog_icons_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 05:08:48 GMT</last_modification_time>
- </signal>
- <label>Dialog buttons have icons</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>statusbar_not_dialog_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 05:09:02 GMT</last_modification_time>
- </signal>
- <label>Use statusbar instead of dialog when possible</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
+ <spacing>0</spacing>
<widget>
- <class>GtkFrame</class>
- <name>frame5</name>
- <label>Dialog Behavior</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <class>GtkNotebook</class>
+ <name>notebook1</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>
<child>
<padding>0</padding>
<expand>False</expand>
- <fill>True</fill>
+ <fill>False</fill>
</child>
<widget>
<class>GtkTable</class>
- <name>table1</name>
- <border_width>5</border_width>
- <rows>3</rows>
+ <name>table3</name>
+ <border_width>4</border_width>
+ <rows>2</rows>
<columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
+ <homogeneous>True</homogeneous>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
<widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>Dialog position:</label>
- <justify>GTK_JUSTIFY_RIGHT</justify>
- <wrap>False</wrap>
- <xalign>1</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>label3</name>
- <label>Dialog hints:</label>
- <justify>GTK_JUSTIFY_RIGHT</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkFrame</class>
+ <name>frame7</name>
+ <label>Menus</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
@@ -521,48 +71,105 @@ Right-justify buttons
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
- <yfill>False</yfill>
+ <yfill>True</yfill>
</child>
- </widget>
- <widget>
- <class>GtkOptionMenu</class>
- <name>dialog_position_select</name>
- <can_focus>True</can_focus>
- <items>Let window manager decide
-Center of the screen
-At the mouse pointer
-</items>
- <initial_choice>0</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>
+ <class>GtkVBox</class>
+ <name>vbox2</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>menubar_detachable_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:48:47 GMT</last_modification_time>
+ </signal>
+ <label>Menu bars are detachable</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>menubar_relief_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:48:53 GMT</last_modification_time>
+ </signal>
+ <label>Menu bars have a border</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>menus_have_tearoff_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:03 GMT</last_modification_time>
+ </signal>
+ <label>Menus can be torn off</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>menus_have_icons_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:11 GMT</last_modification_time>
+ </signal>
+ <label>Menu items have icons</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
</widget>
<widget>
- <class>GtkOptionMenu</class>
- <name>dialog_type_select</name>
- <can_focus>True</can_focus>
- <items>Dialogs are like other windows
-Dialogs are treated specially by the window manager
-</items>
- <initial_choice>0</initial_choice>
+ <class>GtkFrame</class>
+ <name>frame8</name>
+ <label>Status Bar</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
@@ -570,176 +177,744 @@ Dialogs are treated specially by the window manager
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
- <yfill>False</yfill>
+ <yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox3</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>statusbar_not_dialog_toggle</name>
+ <visible>False</visible>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 05:09:02 GMT</last_modification_time>
+ </signal>
+ <label>Use status bar instead of dialog when possible</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>statusbar_is_interactive_toggle</name>
+ <visible>False</visible>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:20 GMT</last_modification_time>
+ </signal>
+ <label>Status bar is interactive when possible</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator1</name>
+ <visible>False</visible>
+ <child>
+ <padding>2</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>statusbar_meter_on_left_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Fri, 08 Dec 2000 20:02:09 GMT</last_modification_time>
+ </signal>
+ <label>Progress bar is on the left</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>progressbar</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>statusbar_meter_on_right_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Fri, 08 Dec 2000 20:02:15 GMT</last_modification_time>
+ </signal>
+ <label>Progress bar is on the right</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>progressbar</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
</widget>
<widget>
- <class>GtkCheckButton</class>
- <name>dialog_centered_toggle</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>toggled_cb</handler>
- <last_modification_time>Sun, 24 Sep 2000 05:09:12 GMT</last_modification_time>
- </signal>
- <label>Place dialogs over application window when possible</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
+ <class>GtkFrame</class>
+ <name>frame6</name>
+ <label>Tool Bars</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<left_attach>0</left_attach>
<right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
- <yfill>False</yfill>
+ <yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table4</name>
+ <border_width>4</border_width>
+ <rows>4</rows>
+ <columns>2</columns>
+ <homogeneous>True</homogeneous>
+ <row_spacing>0</row_spacing>
+ <column_spacing>0</column_spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>toolbar_relief_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:42 GMT</last_modification_time>
+ </signal>
+ <label>Tool bars have a border</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <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>GtkCheckButton</class>
+ <name>toolbar_relief_btn_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:48 GMT</last_modification_time>
+ </signal>
+ <label>Tool bar buttons pop up on mouse over</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <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>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>toolbar_lines_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:53 GMT</last_modification_time>
+ </signal>
+ <label>Tool bars have line separators</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <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>GtkCheckButton</class>
+ <name>toolbar_detachable_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 02:49:38 GMT</last_modification_time>
+ </signal>
+ <label>Tool bars are detachable</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <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>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>toolbar_icons_only_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Fri, 08 Dec 2000 19:27:09 GMT</last_modification_time>
+ </signal>
+ <label>Tool bar buttons are icons only</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>toolbar_icons</group>
+ <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>GtkRadioButton</class>
+ <name>toolbar_text_below_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Fri, 08 Dec 2000 19:27:18 GMT</last_modification_time>
+ </signal>
+ <label>Tool bar buttons are text below icons</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>toolbar_icons</group>
+ <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>
</widget>
</widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GtkWindow</class>
- <name>window3</name>
- <title>window3</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkFrame</class>
- <name>prefs_widget_mdi</name>
- <border_width>5</border_width>
- <label>GNOME MDI Options</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
-
- <widget>
- <class>GtkTable</class>
- <name>table2</name>
- <border_width>5</border_width>
- <rows>2</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>5</row_spacing>
- <column_spacing>5</column_spacing>
<widget>
<class>GtkLabel</class>
- <name>label4</name>
- <label>Default MDI Mode:</label>
- <justify>GTK_JUSTIFY_RIGHT</justify>
+ <child_name>Notebook:tab</child_name>
+ <name>label6</name>
+ <label>Interface</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
- <xalign>1</xalign>
+ <xalign>0.5</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>GtkVBox</class>
+ <name>vbox8</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame9</name>
+ <label>Dialogs</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>GtkVBox</class>
+ <name>vbox9</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>dialog_icons_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 05:08:48 GMT</last_modification_time>
+ </signal>
+ <label>Dialog buttons have icons</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>dialog_centered_toggle</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>toggled_cb</handler>
+ <last_modification_time>Sun, 24 Sep 2000 05:09:12 GMT</last_modification_time>
+ </signal>
+ <label>Place dialogs over application window when possible</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table5</name>
+ <rows>3</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label2</name>
+ <label>Dialogs open</label>
+ <justify>GTK_JUSTIFY_RIGHT</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>GtkOptionMenu</class>
+ <name>dialog_position_select</name>
+ <can_focus>True</can_focus>
+ <items>Wherever the Window Manager places them
+At the center of the screen
+At the mouse pointer
+</items>
+ <initial_choice>0</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>GtkLabel</class>
+ <name>label3</name>
+ <label>Dialogs are treated</label>
+ <justify>GTK_JUSTIFY_RIGHT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0</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>dialog_type_select</name>
+ <can_focus>True</can_focus>
+ <items>Like any other window
+Specially by the window manager
+</items>
+ <initial_choice>0</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>
+ <class>GtkLabel</class>
+ <name>label1</name>
+ <label>Dialog Buttons</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>GtkOptionMenu</class>
+ <name>dialog_buttons_style_select</name>
+ <can_focus>True</can_focus>
+ <items>Default (Spread out - big)
+Spread out
+Spread out (big)
+Left aligned
+Right aligned
+</items>
+ <initial_choice>0</initial_choice>
+ <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>False</yfill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame10</name>
+ <label>Multiple Documents</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>GtkTable</class>
+ <name>table2</name>
+ <border_width>5</border_width>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>5</row_spacing>
+ <column_spacing>5</column_spacing>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>mdi_mode_select</name>
+ <can_focus>True</can_focus>
+ <items>Notebook tabs
+Seperate windows
+The same window
+</items>
+ <initial_choice>0</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>mdi_tab_pos_select</name>
+ <can_focus>True</can_focus>
+ <items>Left
+Right
+Top
+Bottom
+</items>
+ <initial_choice>0</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>
+ <class>GtkLabel</class>
+ <name>label8</name>
+ <label>When opening Multiple documents, use</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>label9</name>
+ <label>When using Notebook tabs, place the tabs on the</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>
+ </widget>
</widget>
<widget>
<class>GtkLabel</class>
- <name>label5</name>
- <label>MDI notebook tab position:</label>
- <justify>GTK_JUSTIFY_RIGHT</justify>
+ <child_name>Notebook:tab</child_name>
+ <name>label7</name>
+ <label>Miscellaneous</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
- <xalign>1</xalign>
+ <xalign>0.5</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>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox2</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
<widget>
- <class>GtkOptionMenu</class>
- <name>mdi_mode_select</name>
- <can_focus>True</can_focus>
- <items>Notebook
-Toplevel
-Modal
-</items>
- <initial_choice>0</initial_choice>
+ <class>GnomePixmap</class>
+ <name>pixmap1</name>
+ <filename>gnome-warning.png</filename>
<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>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
<widget>
- <class>GtkOptionMenu</class>
- <name>mdi_tab_pos_select</name>
- <can_focus>True</can_focus>
- <items>Left
-Right
-Top
-Bottom
-</items>
- <initial_choice>0</initial_choice>
+ <class>GtkLabel</class>
+ <name>label10</name>
+ <label>Settings will not take effect until applications restart</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<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>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
</widget>
</widget>
diff --git a/capplets/ui-properties/ui-properties.glade.h b/capplets/ui-properties/ui-properties.glade.h
index 568d5f06c..14a846355 100644
--- a/capplets/ui-properties/ui-properties.glade.h
+++ b/capplets/ui-properties/ui-properties.glade.h
@@ -4,53 +4,50 @@
* DO NOT compile it as part of your application.
*/
-gchar *s = N_("window1");
-gchar *s = N_("Menu Options");
-gchar *s = N_("Can detach and move menus");
-gchar *s = N_("Menus have relieved border");
-gchar *s = N_("Submenus can be torn off");
+gchar *s = N_("window4");
+gchar *s = N_("Menus");
+gchar *s = N_("Menu bars are detachable");
+gchar *s = N_("Menu bars have a border");
+gchar *s = N_("Menus can be torn off");
gchar *s = N_("Menu items have icons");
-gchar *s = N_("Statusbar Options");
-gchar *s = N_("Statusbar is interactive when possible");
-gchar *s = N_("Statusbar progress meter is on the right");
-gchar *s = N_("Toolbar Options");
-gchar *s = N_("Can detach and move toolbars");
-gchar *s = N_("Toolbars have relieved border");
-gchar *s = N_("Toolbar buttons have relieved border");
-gchar *s = N_("Toolbars have line separators");
-gchar *s = N_("Toolbars have text labels");
-gchar *s = N_("window2");
-gchar *s = N_("Dialog Layout");
-gchar *s = N_("Dialog Buttons:");
-gchar *s = N_("Default value\n"
- "Spread buttons out\n"
- "Put buttons on edges\n"
- "Left-justify buttons\n"
- "Right-justify buttons\n"
- "");
+gchar *s = N_("Status Bar");
+gchar *s = N_("Use status bar instead of dialog when possible");
+gchar *s = N_("Status bar is interactive when possible");
+gchar *s = N_("Progress bar is on the left");
+gchar *s = N_("Progress bar is on the right");
+gchar *s = N_("Tool Bars");
+gchar *s = N_("Tool bars have a border");
+gchar *s = N_("Tool bar buttons pop up on mouse over");
+gchar *s = N_("Tool bars have line separators");
+gchar *s = N_("Tool bars are detachable");
+gchar *s = N_("Tool bar buttons are icons only");
+gchar *s = N_("Tool bar buttons are text below icons");
+gchar *s = N_("Interface");
+gchar *s = N_("Dialogs");
gchar *s = N_("Dialog buttons have icons");
-gchar *s = N_("Use statusbar instead of dialog when possible");
-gchar *s = N_("Dialog Behavior");
-gchar *s = N_("Dialog position:");
-gchar *s = N_("Dialog hints:");
-gchar *s = N_("Let window manager decide\n"
- "Center of the screen\n"
- "At the mouse pointer\n"
- "");
-gchar *s = N_("Dialogs are like other windows\n"
- "Dialogs are treated specially by the window manager\n"
- "");
gchar *s = N_("Place dialogs over application window when possible");
-gchar *s = N_("window3");
-gchar *s = N_("GNOME MDI Options");
-gchar *s = N_("Default MDI Mode:");
-gchar *s = N_("MDI notebook tab position:");
-gchar *s = N_("Notebook\n"
- "Toplevel\n"
- "Modal\n"
- "");
-gchar *s = N_("Left\n"
- "Right\n"
- "Top\n"
- "Bottom\n"
- "");
+gchar *s = N_("Dialogs open");
+gchar *s = N_("Wherever the Window Manager places them");
+gchar *s = N_("At the center of the screen");
+gchar *s = N_("At the mouse pointer");
+gchar *s = N_("Dialogs are treated");
+gchar *s = N_("Like any other window");
+gchar *s = N_("Specially by the window manager");
+gchar *s = N_("Dialog Buttons");
+gchar *s = N_("Default (Spread out - big)");
+gchar *s = N_("Spread out");
+gchar *s = N_("Spread out (big)");
+gchar *s = N_("Left aligned");
+gchar *s = N_("Right aligned");
+gchar *s = N_("Multiple Documents");
+gchar *s = N_("Notebook tabs");
+gchar *s = N_("Seperate windows");
+gchar *s = N_("The same window");
+gchar *s = N_("Left");
+gchar *s = N_("Right");
+gchar *s = N_("Top");
+gchar *s = N_("Bottom");
+gchar *s = N_("When opening Multiple documents, use");
+gchar *s = N_("When using Notebook tabs, place the tabs on the");
+gchar *s = N_("Miscellaneous");
+gchar *s = N_("Settings will not take effect until applications restart");
diff --git a/capplets/url-properties/Makefile.am b/capplets/url-properties/Makefile.am
index c11367e48..dd10a90c1 100644
--- a/capplets/url-properties/Makefile.am
+++ b/capplets/url-properties/Makefile.am
@@ -2,23 +2,20 @@ INCLUDES = -I. -I$(srcdir) \
-I$(top_srcdir)/intl -I$(top_builddir)/intl \
-I$(srcdir)/../../libcapplet \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -I$(includedir) $(GNOME_INCLUDEDIR) \
+ $(CAPPLET_CFLAGS) \
-DGNOMESYSCONFDIR=\""$(sysconfdir)"\"
bin_PROGRAMS = url-properties
url_properties_SOURCES = url-properties.c
-url_properties_LDADD = ../../libcapplet/libcapplet.la \
- $(GNOME_LIBS) $(ORBIT_LIBS) \
- $(GNOMEUI_LIBS) $(GNOME_LIBDIR) $(INTLLIBS)
-
+url_properties_LDADD = $(CAPPLET_LIBS)
EXTRA_DIST = \
url-properties.desktop
-sysdir = $(datadir)/control-center
+sysdir = $(datadir)/control-center/Documents/
sys_DATA = url-properties.desktop
-install-data-local:
- $(INSTALL_DATA) $(srcdir)/url-properties.desktop $(DESTDIR)$(datadir)/gnome/apps/Settings/url-properties.desktop
+psysdir = $(datadir)/gnome/apps/Settings/Documents/
+psys_DATA = url-properties.desktop
diff --git a/capplets/wm-properties/Makefile.am b/capplets/wm-properties/Makefile.am
index 67e5001d9..bb65026fd 100644
--- a/capplets/wm-properties/Makefile.am
+++ b/capplets/wm-properties/Makefile.am
@@ -1,9 +1,7 @@
INCLUDES = -I. -I$(srcdir) \
-I$(top_srcdir)/intl -I$(top_builddir)/intl \
- -I$(srcdir)/../../libcapplet \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -I$(includedir) $(GNOME_INCLUDEDIR) $(IMLIB_CFLAGS) \
- $(XML_CFLAGS)
+ $(CAPPLET_CFLAGS)
bin_PROGRAMS = wm-properties-capplet
@@ -14,10 +12,7 @@ wm_properties_capplet_SOURCES = \
wm-list.c \
wm-exec.c
-wm_properties_capplet_LDADD = \
-../../libcapplet/libcapplet.la \
-$(GNOME_LIBS) $(ORBIT_LIBS) $(GNOMEUI_LIBS) $(GNOME_LIBDIR) $(INTLLIBS) \
-$(IMLIB_LIBS) $(GNOME_XML_LIB)
+wm_properties_capplet_LDADD = $(CAPPLET_LIBS)
EXTRA_DIST = wm-properties.desktop
@@ -26,5 +21,5 @@ SUBDIRS=wm-desktops
sysdir = $(datadir)/control-center/Desktop
sys_DATA = wm-properties.desktop
-Setdir = $(datadir)/gnome/apps/Settings/Desktop
-Set_DATA = wm-properties.desktop
+psysdir = $(datadir)/gnome/apps/Settings/Desktop
+psys_DATA = wm-properties.desktop
diff --git a/configure.in b/configure.in
index 4ea26d428..0cec0a1ba 100644
--- a/configure.in
+++ b/configure.in
@@ -12,7 +12,7 @@ gnome_cv_use_gnome=yes
AM_ACLOCAL_INCLUDE(macros)
-GNOME_INIT
+GNOME_INIT(capplet)
GNOME_COMPILE_WARNINGS
AC_ISC_POSIX
@@ -77,18 +77,54 @@ AC_MSG_ERROR([Fatal Error: no Imlib detected.])])
CFLAGS="-O2 -g -Wall $CFLAGS"
+dnl
+dnl CApplet, Note that the libs and all that is set up in gnome_init,
+dnl but gnome_init is truly dumb and doesn't require it, so we need to
+dnl do a separate check
+dnl
+AC_MSG_CHECKING(for capplet library)
+vers=`$GNOME_CONFIG --modversion capplet`
+case "x$vers" in
+ xcapplet-*)
+ AC_MSG_RESULT(found)
+ ;;
+ *)
+ AC_MSG_ERROR(Did not find capplet library, you probably need to install libcapplet first)
+ ;;
+esac
+
+CAPPLET_CFLAGS=`gnome-config --cflags libglade capplet gdk_pixbuf`
+CAPPLET_LIBS=`gnome-config --libs libglade capplet gdk_pixbuf`
+
+BG_CAPPLET_CFLAGS=`gnome-config --cflags libglade capplet gdk_pixbuf gdk_pixbuf_xlib`
+BG_CAPPLET_LIBS=`gnome-config --libs libglade capplet gdk_pixbuf gdk_pixbuf_xlib`
+
+GNOMECC_CFLAGS=`gnome-config --cflags gnomeui libglade xml gdk_pixbuf capplet gnomecanvaspixbuf gtkhtml`
+GNOMECC_LIBS=`gnome-config --libs gnomeui libglade xml gdk_pixbuf capplet gnomecanvaspixbuf gtkhtml`
+
+AC_SUBST(CAPPLET_CFLAGS)
+AC_SUBST(CAPPLET_LIBS)
+
+AC_SUBST(BG_CAPPLET_CFLAGS)
+AC_SUBST(BG_CAPPLET_LIBS)
+
+AC_SUBST(GNOMECC_CFLAGS)
+AC_SUBST(GNOMECC_LIBS)
+
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_OUTPUT([
+
control-center.spec
Makefile
po/Makefile.in
new-control-center/Makefile
-libcapplet/Makefile
+root-manager/Makefile
capplets/Makefile
capplets/mime-type/Makefile
capplets/desktop-links/Makefile
+capplets/orbit-settings/Makefile
capplets/new-background-properties/Makefile
capplets/new-bell-properties/Makefile
capplets/new-keyboard-properties/Makefile
@@ -103,6 +139,4 @@ capplets/url-properties/Makefile
capplets/gnome-edit-properties/Makefile
capplets/wm-properties/Makefile
capplets/wm-properties/wm-desktops/Makefile
-idl/Makefile
intl/Makefile])
-
diff --git a/control-center/.cvsignore b/control-center/.cvsignore
index 2787f6788..4e7ecb167 100644
--- a/control-center/.cvsignore
+++ b/control-center/.cvsignore
@@ -1,3 +1,7 @@
Makefile.in
Makefile
*.o
+.deps
+gnomecc
+.libs
+.thumbnails
diff --git a/control-center/ChangeLog b/control-center/ChangeLog
index 7db0bcb89..00f067804 100644
--- a/control-center/ChangeLog
+++ b/control-center/ChangeLog
@@ -1,3 +1,8 @@
+2000-12-26 Jacob "Ulysses" Berkman <jacob@helixcode.com>
+
+ * capplet-dir-view*.c: new html view, and split other views into
+ seperate parts
+
2000-10-14 Bradford Hovinen <hovinen@helixcode.com>
Courtesy John B Tunison <jtunison@andrew.cmu.edu>:
diff --git a/control-center/Makefile.am b/control-center/Makefile.am
index 2f81c8e30..4b3a2684a 100644
--- a/control-center/Makefile.am
+++ b/control-center/Makefile.am
@@ -8,7 +8,7 @@ sysdir = $(datadir)/gnome/apps/Settings
sys_DATA = gnomecc.desktop
gladedir = $(datadir)/control-center-data
-glade_DATA = gnomecc-preferences.glade
+glade_DATA = gnomecc.glade
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
@@ -20,26 +20,24 @@ INCLUDES = \
$(LIBGLADE_CFLAGS) \
-DPIXMAPS_DIR=\""$(appicondir)"\"
-bin_PROGRAMS = gnomecc root-manager
+bin_PROGRAMS = gnomecc
gnomecc_SOURCES = \
main.c \
capplet-dir.c capplet-dir.h \
capplet-dir-view.c capplet-dir-view.h \
- preferences.c preferences.h
+ preferences.c preferences.h \
+ capplet-dir-view-html.c \
+ capplet-dir-view-tree.c \
+ capplet-dir-view-list.c
gnomecc_LDADD = \
$(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
+ $(GNOME_CAPPLET_LIBS) \
$(INTLLIBS) \
$(LIBGLADE_LIBS) \
- -lgdk_pixbuf
-
-root_manager_SOURCES = \
- root-manager.c
-
-root_manager_LDADD = \
- $(GNOME_LIBDIR) \
- $(GNOME_LIBS)
+ -lgdk_pixbuf -lgnomecanvaspixbuf \
+ -lgtkhtml -lgnomeprint \
+ -lpspell -lstdc++
EXTRA_DIST = gnomecc.desktop $(appicon_DATA) $(splash_DATA) $(glade_DATA)
diff --git a/control-center/capplet-dir-view-html.c b/control-center/capplet-dir-view-html.c
new file mode 100644
index 000000000..38c906e6a
--- /dev/null
+++ b/control-center/capplet-dir-view-html.c
@@ -0,0 +1,215 @@
+/* -*- mode: c; style: linux -*- */
+
+/* capplet-dir-view-html.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * Written by Jacob Berkman <jacob@helixcode.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)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <gtkhtml/gtkhtml.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "capplet-dir-view.h"
+
+static void
+html_clear (CappletDirView *view)
+{
+ g_return_if_fail (GTK_IS_HTML (view->view));
+
+ gtk_html_load_empty (GTK_HTML (view->view));
+}
+
+static void
+html_clean (CappletDirView *view)
+{
+ g_return_if_fail (GTK_IS_HTML (view->view));
+
+ gtk_object_destroy (GTK_OBJECT (view->view));
+}
+
+#define BUFLEN 4096
+static void
+handle_url_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *stream, CappletDirView *view)
+{
+ char buf[BUFLEN];
+ int fd;
+ ssize_t s;
+
+ fd = open (url, O_RDONLY);
+ if (fd == -1)
+ goto loading_error;
+
+ while (1) {
+ s = read (fd, buf, BUFLEN);
+ switch (s) {
+ case -1:
+ if (! (errno == EINTR || errno == EAGAIN) )
+ goto loading_error;
+ break;
+ case 0:
+ gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
+ return;
+ default:
+ gtk_html_write (html, stream, buf, s);
+ break;
+ }
+ }
+
+ return;
+
+ loading_error:
+ gtk_html_end (html, stream, GTK_HTML_STREAM_ERROR);
+}
+#undef BUFLEN
+
+static void
+handle_link_cb (GtkHTML *html, const gchar *url, CappletDirView *view)
+{
+ CappletDirEntry *entry;
+
+ g_print ("activating: %s\n", url);
+
+ entry = capplet_lookup (url);
+ if (entry)
+ capplet_dir_entry_activate (entry, view);
+}
+
+static void
+write_parent_html (CappletDir *dir, GtkHTML *html, GtkHTMLStream *stream)
+{
+ char *s;
+
+ if (!dir)
+ return;
+
+ g_return_if_fail (html != NULL);
+ g_return_if_fail (stream != NULL);
+
+ write_parent_html (dir->entry.dir, html, stream);
+
+ s = g_strdup_printf ("%s <a href=\"%s\">%s</a>", dir->entry.dir ? " |" : "",
+ dir->entry.path, dir->entry.label);
+ gtk_html_write (html, stream, s, strlen (s));
+ g_free (s);
+}
+
+static void
+html_populate (CappletDirView *view)
+{
+ GtkHTMLStream *stream;
+ CappletDirEntry *entry;
+ GSList *item;
+ int i;
+ char *s;
+
+ g_return_if_fail (GTK_IS_HTML (view->view));
+
+ stream = gtk_html_begin (GTK_HTML (view->view));
+
+ s =
+"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
+"<html>\n"
+" <head>\n"
+" <title>GNOME Control Center</title>\n"
+" </head>\n"
+" <body marginheight=\"0\" marginwidth=\"0\">\n"
+#if 0
+" <table bgcolor=\"#292928\" width=\"100%%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" columns=\"2\">\n"
+" <tr>\n"
+" <td>\n"
+" <img src=\"%s\" height=\"24\" width=\"24\"></td>\n"
+" <td align=\"right\">\n"
+" <font size=\"+3\" color=\"#757575\"><b>%s</b></font>\n"
+" </td>\n"
+" </tr>\n"
+" </table>\n"
+#endif
+" <table width=\"100%%\" columns=\"4\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n"
+" <tr height=\"64\">\n"
+" <td colspan=\"4\">\n"
+" Select something you want to customize.\n"
+" </td>\n"
+" <\tr>\n"
+" <tr>\n"
+" <td colspan=\"4\">\n"
+" &nbsp;\n";
+
+ gtk_html_write (GTK_HTML (view->view), stream, s, strlen (s));
+
+ write_parent_html (view->capplet_dir->entry.dir, GTK_HTML (view->view), stream);
+
+ for (i = 0, item = view->capplet_dir->entries; item; item = item->next, i++) {
+ if (!(i%2)) {
+ s = " <tr>\n";
+ gtk_html_write (GTK_HTML (view->view), stream, s, strlen (s));
+ }
+
+ entry = CAPPLET_DIR_ENTRY (item->data);
+ s = g_strdup_printf (
+" <td width=\"36\">\n"
+" <a href=\"%s\"><img src=\"%s\" border=\"0\" height=\"36\" width=\"36\"></a></td>\n"
+" <td width=\"%%50\">\n"
+" <font size=\"+1\"><b><a href=\"%s\">%s</a></b></font><br>\n"
+" <font size=\"-1\">%s</font>\n"
+" </td>\n"
+, entry->path, entry->icon, entry->path, entry->label, entry->entry->comment);
+
+ gtk_html_write (GTK_HTML (view->view), stream, s, strlen (s));
+ g_free (s);
+
+ if (i%2 || !item->next) {
+ s = " </tr>\n";
+ gtk_html_write (GTK_HTML (view->view), stream, s, strlen (s));
+ }
+ }
+
+ s =
+" </table>\n"
+" </body>\n"
+"</html>\n";
+ gtk_html_write (GTK_HTML (view->view), stream, s, strlen (s));
+
+ gtk_html_end (GTK_HTML (view->view), stream, GTK_HTML_STREAM_OK);
+}
+
+static GtkWidget *
+html_create (CappletDirView *view)
+{
+ GtkWidget *w = gtk_html_new ();
+
+ gtk_signal_connect (GTK_OBJECT (w), "url_requested",
+ GTK_SIGNAL_FUNC (handle_url_cb), view);
+
+ gtk_signal_connect (GTK_OBJECT (w), "link_clicked",
+ GTK_SIGNAL_FUNC (handle_link_cb), view);
+
+ return w;
+}
+
+CappletDirViewImpl capplet_dir_view_html = {
+ html_clear,
+ html_clean,
+ html_populate,
+ html_create
+};
+
diff --git a/control-center/capplet-dir-view-list.c b/control-center/capplet-dir-view-list.c
new file mode 100644
index 000000000..8eeccabcd
--- /dev/null
+++ b/control-center/capplet-dir-view-list.c
@@ -0,0 +1,175 @@
+/* -*- mode: c; style: linux -*- */
+
+/* capplet-dir-view-list.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * Authors: Jacob Berkman <jacob@helixcode.com>
+ * Bradford Hovinen <hovinen@helixcode.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)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
+
+#include "capplet-dir-view.h"
+
+static void
+list_clear (CappletDirView *view)
+{
+ g_return_if_fail (GNOME_IS_ICON_LIST (view->view));
+
+ gnome_icon_list_clear (GNOME_ICON_LIST (view->view));
+}
+
+static void
+list_clean (CappletDirView *view)
+{
+ g_return_if_fail (GNOME_IS_ICON_LIST (view->view));
+
+ gtk_object_destroy (GTK_OBJECT (view->view));
+}
+
+/*
+ * Creates a 24-bits RGB value from a GdkColor
+ */
+static guint
+rgb_from_gdk_color (GdkColor *color)
+{
+ guint a =
+ (((color->red >> 8) << 16) |
+ ((color->green >> 8) << 8) |
+ ((color->blue >> 8)));
+
+ return a;
+}
+
+static GnomeCanvasItem *
+flatten_alpha (GdkPixbuf *image, GnomeCanvas *canvas)
+{
+ GnomeCanvasItem *item;
+ GtkStyle *style;
+ GdkPixbuf *flat;
+ guint rgb;
+
+ if (!image || !gdk_pixbuf_get_has_alpha (image))
+ return NULL;
+
+ if (!GTK_WIDGET_REALIZED (GTK_WIDGET (canvas)))
+ gtk_widget_realize (GTK_WIDGET (canvas));
+
+ style = gtk_widget_get_style (GTK_WIDGET (canvas));
+ rgb = rgb_from_gdk_color (&style->base[GTK_STATE_NORMAL]);
+
+ flat = gdk_pixbuf_composite_color_simple (
+ image,
+ gdk_pixbuf_get_width (image),
+ gdk_pixbuf_get_height (image),
+ GDK_INTERP_NEAREST,
+ 255,
+ 32,
+ rgb, rgb);
+
+ item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (canvas->root),
+ GNOME_TYPE_CANVAS_PIXBUF,
+ "pixbuf", flat,
+ "height", (double)gdk_pixbuf_get_height (flat),
+ "width", (double)gdk_pixbuf_get_width (flat),
+ NULL);
+
+ gdk_pixbuf_unref (flat);
+
+ return item;
+}
+
+static void
+list_populate (CappletDirView *view)
+{
+ GSList *list;
+ int i;
+ GnomeCanvasItem *item;
+
+ g_return_if_fail (GNOME_IS_ICON_LIST (view->view));
+
+ gnome_icon_list_freeze (GNOME_ICON_LIST (view->view));
+
+ for (i = 0, list = view->capplet_dir->entries; list; list = list->next, i++) {
+ item = flatten_alpha (CAPPLET_DIR_ENTRY (list->data)->pb,
+ GNOME_CANVAS (view->view));
+ gnome_icon_list_insert_item (GNOME_ICON_LIST (view->view), i, item,
+ CAPPLET_DIR_ENTRY (list->data)->label);
+ }
+ gnome_icon_list_thaw (GNOME_ICON_LIST (view->view));
+}
+
+static void
+select_icon_list_cb (GtkWidget *widget, gint arg1, GdkEvent *event,
+ CappletDirView *view)
+{
+ if (event->type == GDK_2BUTTON_PRESS &&
+ ((GdkEventButton *) event)->button == 1)
+ {
+ capplet_dir_entry_activate
+ (g_slist_nth_data (view->capplet_dir->entries, arg1), view);
+ view->selected = NULL;
+ } else {
+ view->selected = g_slist_nth_data (view->capplet_dir->entries, arg1);
+ }
+}
+
+static GtkWidget *
+list_create (CappletDirView *view)
+{
+ GtkAdjustment *adjustment;
+ GtkWidget *w;
+ GSList *list;
+ int i;
+
+ adjustment = gtk_scrolled_window_get_vadjustment
+ (GTK_SCROLLED_WINDOW (view->scrolled_win));
+
+
+ w = gnome_icon_list_new (72, adjustment, 0);
+
+ if (view->selected)
+ view->capplet_dir = view->selected->dir;
+
+#if 0
+ if (view->capplet_dir) populate_icon_list (view);
+
+ if (view->selected) {
+ for (i = 0, list = view->capplet_dir->entries; list; i++, list = list->next) {
+ if (list->data == view->selected) {
+ gnome_icon_list_select_icon (view->u.icon_list, i);
+ break;
+ }
+ }
+ }
+#endif
+
+ gtk_signal_connect (GTK_OBJECT (w), "select-icon",
+ GTK_SIGNAL_FUNC (select_icon_list_cb),
+ view);
+ return w;
+}
+
+CappletDirViewImpl capplet_dir_view_list = {
+ list_clear,
+ list_clean,
+ list_populate,
+ list_create
+};
diff --git a/control-center/capplet-dir-view-tree.c b/control-center/capplet-dir-view-tree.c
new file mode 100644
index 000000000..a8168ab80
--- /dev/null
+++ b/control-center/capplet-dir-view-tree.c
@@ -0,0 +1,195 @@
+/* -*- mode: c; style: linux -*- */
+
+/* capplet-dir-view-tree.c
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * Authors: Bradford Hovinen (hovinen@helixcode.com)
+ * Jacob Berkman <jacob@helixcode.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)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "capplet-dir-view.h"
+
+static void
+tree_clear (CappletDirView *view)
+{
+ g_return_if_fail (GTK_IS_CTREE (view->view));
+
+ gtk_clist_clear (GTK_CLIST (view->view));
+}
+
+static void
+tree_clean (CappletDirView *view)
+{
+ g_return_if_fail (GTK_IS_CTREE (view->view));
+
+ gtk_object_destroy (GTK_OBJECT (view->view));
+}
+
+static void
+populate_tree_branch (CappletDir *dir, GtkCTree *ctree, GtkCTreeNode *parent)
+{
+ CappletDirEntry *entry;
+ GdkPixbuf *pixbuf, *scaled;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+ GtkCTreeNode *current = NULL;
+ GSList *list;
+
+ capplet_dir_load (dir);
+
+ for (list = dir->entries; list; list = list->next) {
+ entry = CAPPLET_DIR_ENTRY (list->data);
+
+ pixbuf = gdk_pixbuf_new_from_file (entry->icon);
+ scaled = gdk_pixbuf_scale_simple (pixbuf, 16, 16,
+ GDK_INTERP_BILINEAR);
+ gdk_pixbuf_render_pixmap_and_mask (scaled, &pixmap, &mask, 128);
+ gdk_pixbuf_unref (pixbuf);
+ gdk_pixbuf_unref (scaled);
+
+#warning Should an array be created instead of passing &entry->label ?
+ current = gtk_ctree_insert_node
+ (ctree, parent, NULL,
+ &entry->label, 10,
+ pixmap, mask, pixmap, mask,
+ IS_CAPPLET (entry), FALSE);
+ gtk_ctree_node_set_row_data (ctree, current, entry);
+
+ if (IS_CAPPLET_DIR (entry))
+ populate_tree_branch (CAPPLET_DIR (entry), ctree, current);
+ }
+}
+
+static void
+tree_populate (CappletDirView *view)
+{
+ g_return_if_fail (GTK_IS_CTREE (view->view));
+
+ gtk_clist_freeze (GTK_CLIST (view->view));
+ populate_tree_branch (view->capplet_dir, GTK_CTREE (view->view), NULL);
+ gtk_clist_thaw (GTK_CLIST (view->view));
+}
+
+static void
+select_tree_cb (GtkCTree *ctree, GtkCTreeNode *node, gint column,
+ GdkEventButton *event, CappletDirView *view)
+{
+ CappletDirEntry *dir_entry;
+
+ dir_entry = gtk_ctree_node_get_row_data (ctree, node);
+ view->selected = dir_entry;
+}
+
+static gint
+tree_event_cb (GtkCTree *ctree, GdkEventButton *event,
+ CappletDirView *view)
+{
+ CappletDirEntry *entry;
+ GtkCTreeNode *node;
+ gint row, column;
+
+ if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
+ {
+ gtk_clist_get_selection_info (GTK_CLIST (ctree),
+ event->x, event->y,
+ &row, &column);
+ node = gtk_ctree_node_nth (ctree, row);
+ entry = gtk_ctree_node_get_row_data (ctree, node);
+ if (entry && IS_CAPPLET (entry))
+ capplet_dir_entry_activate (entry, view);
+ }
+ return FALSE;
+}
+
+static GtkWidget *
+tree_create (CappletDirView *view)
+{
+ GtkAdjustment *adjustment;
+ GtkWidget *w;
+
+ adjustment = gtk_scrolled_window_get_vadjustment
+ (GTK_SCROLLED_WINDOW (view->scrolled_win));
+
+ w = gtk_ctree_new (1, 0);
+
+ gtk_signal_connect (GTK_OBJECT (w), "tree-select-row",
+ GTK_SIGNAL_FUNC (select_tree_cb),
+ view);
+ gtk_signal_connect (GTK_OBJECT (w), "button_press_event",
+ GTK_SIGNAL_FUNC (tree_event_cb),
+ view);
+
+ return w;
+}
+
+#if 0
+static void
+switch_to_tree (CappletDirView *view)
+{
+ CappletDir *dir, *old_dir = NULL;
+ GtkCTreeNode *node;
+
+ if (view->layout != LAYOUT_TREE) {
+ if (view->capplet_dir) {
+ old_dir = view->capplet_dir;
+
+ while (CAPPLET_DIR_ENTRY (view->capplet_dir)->dir)
+ view->capplet_dir = CAPPLET_DIR_ENTRY
+ (view->capplet_dir)->dir;
+ }
+
+ clean (view);
+ create_tree (view);
+ view->layout = LAYOUT_TREE;
+
+ if (!view->capplet_dir) return;
+
+ if (view->selected) {
+ node = gtk_ctree_find_by_row_data (view->u.tree,
+ NULL,
+ view->selected);
+
+ gtk_ctree_select (view->u.tree, node);
+
+ dir = IS_CAPPLET_DIR (view->selected) ?
+ CAPPLET_DIR (view->selected) :
+ view->selected->dir;
+ } else {
+ dir = old_dir;
+ }
+
+ while (dir) {
+ node = gtk_ctree_find_by_row_data (view->u.tree,
+ NULL, dir);
+ if (!node) break;
+ gtk_ctree_expand (view->u.tree, node);
+ dir = CAPPLET_DIR_ENTRY (dir)->dir;
+ }
+ }
+}
+#endif
+
+CappletDirViewImpl capplet_dir_view_tree = {
+ tree_clear,
+ tree_clean,
+ tree_populate,
+ tree_create
+};
+
diff --git a/control-center/capplet-dir-view.c b/control-center/capplet-dir-view.c
index 75243c908..539ae486c 100644
--- a/control-center/capplet-dir-view.c
+++ b/control-center/capplet-dir-view.c
@@ -26,11 +26,22 @@
#endif
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <glade/glade.h>
#include "capplet-dir-view.h"
-static GnomeAppClass *parent_class;
-static GtkCTreeClass *ctree_class;
+extern CappletDirViewImpl capplet_dir_view_html;
+extern CappletDirViewImpl capplet_dir_view_list;
+extern CappletDirViewImpl capplet_dir_view_tree;
+
+CappletDirViewImpl *capplet_dir_view_impl[] = {
+ NULL,
+ &capplet_dir_view_list,
+ &capplet_dir_view_tree,
+ &capplet_dir_view_html
+};
+
+static GtkObjectClass *parent_class;
static GnomeCCPreferences *prefs;
@@ -42,100 +53,117 @@ enum {
static GList *window_list;
-static GtkWidget *about;
+static void
+capplet_dir_view_init (CappletDirView *view)
+{
+ /* nothing to do here */
+}
-static void capplet_dir_view_init (CappletDirView *view);
-static void capplet_dir_view_class_init (CappletDirViewClass *klass);
+static void
+capplet_dir_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ CappletDirView *view;
+ CappletDirViewLayout layout;
-static void capplet_dir_view_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
+ view = CAPPLET_DIR_VIEW (object);
-static void capplet_dir_view_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
+ switch (arg_id) {
+ case ARG_CAPPLET_DIR:
+ capplet_dir_view_load_dir (view, GTK_VALUE_POINTER (*arg));
+ break;
+ case ARG_LAYOUT:
+ layout = CLAMP (GTK_VALUE_UINT (*arg), 0, LAYOUT_HTML);
+ if (layout == view->layout)
+ break;
-static gint tree_event_cb (GtkCTree *ctree,
- GdkEventButton *event,
- CappletDirView *view);
+ if (view->impl && view->impl->clean)
+ view->impl->clean (view);
-static void clear (CappletDirView *view);
-static void clean (CappletDirView *view);
+ view->layout =layout;
+ view->impl = capplet_dir_view_impl[layout];
-static void switch_to_icon_list (CappletDirView *view);
-static void create_icon_list (CappletDirView *view);
-static void populate_icon_list (CappletDirView *view);
+ if (view->impl && view->impl->create) {
+ view->view = view->impl->create (view);
-static void switch_to_tree (CappletDirView *view);
-static void create_tree (CappletDirView *view);
-static void populate_tree_branch (CappletDir *dir, GtkCTree *ctree,
- GtkCTreeNode *parent);
-static void populate_tree (CappletDirView *view);
+ gtk_container_add (GTK_CONTAINER (view->scrolled_win),
+ view->view);
-static void select_icon_list_cb (GtkWidget *widget,
- gint arg1, GdkEvent *event,
- CappletDirView *view);
-static void select_tree_cb (GtkCTree *ctree,
- GtkCTreeNode *node, gint column,
- GdkEventButton *event,
- CappletDirView *view);
+ if (view->capplet_dir && view->impl->populate)
+ view->impl->populate (view);
-static void preferences_cb (GtkWidget *widget, CappletDirView *view);
-static void close_cb (GtkWidget *widget, CappletDirView *view);
-static void help_cb (GtkWidget *widget, CappletDirView *view);
-static void about_cb (GtkWidget *widget, CappletDirView *view);
+ gtk_signal_connect (GTK_OBJECT (view->view), "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+ &view->view);
-static void up_cb (GtkWidget *widget, CappletDirView *view);
-static void icons_cb (GtkWidget *widget, CappletDirView *view);
-static void tree_cb (GtkWidget *widget, CappletDirView *view);
+ gtk_widget_show (view->view);
+ }
-static void prefs_changed_cb (GnomeCCPreferences *prefs);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view->list_menu),
+ layout == LAYOUT_ICON_LIST);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view->tree_menu),
+ layout == LAYOUT_TREE);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view->html_menu),
+ layout == LAYOUT_HTML);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->list_toggle),
+ layout == LAYOUT_ICON_LIST);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->tree_toggle),
+ layout == LAYOUT_TREE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->html_toggle),
+ layout == LAYOUT_HTML);
+ break;
+ default:
+ break;
+ }
+}
-static void about_done_cb (GtkWidget *widget, gpointer user_data);
+static void
+capplet_dir_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ CappletDirView *view;
-CappletDirView *get_capplet_dir_view (CappletDir *dir,
- CappletDirView *launcher);
+ view = CAPPLET_DIR_VIEW (object);
-static GnomeUIInfo file_menu[] = {
- GNOMEUIINFO_MENU_PREFERENCES_ITEM (preferences_cb, NULL),
- GNOMEUIINFO_MENU_CLOSE_ITEM (close_cb, NULL),
- GNOMEUIINFO_END
-};
+ switch (arg_id) {
+ case ARG_CAPPLET_DIR:
+ GTK_VALUE_POINTER (*arg) = view->capplet_dir;
+ break;
+ case ARG_LAYOUT:
+ GTK_VALUE_UINT (*arg) = view->layout;
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
-static GnomeUIInfo help_menu[] = {
+static void
+capplet_dir_view_class_init (CappletDirViewClass *klass)
+{
+ GtkObjectClass *object_class;
- GNOMEUIINFO_ITEM_STOCK (N_("Help on control-center"),
- N_("Help with the GNOME control-center."),
- help_cb, GNOME_STOCK_PIXMAP_HELP),
- GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_STOCK (N_("About"),
- N_("About the GNOME control-center."),
- about_cb, GNOME_STOCK_MENU_ABOUT),
- GNOMEUIINFO_END
-};
+ parent_class = object_class = GTK_OBJECT_CLASS (klass);
-static GnomeUIInfo menu_bar[] = {
- GNOMEUIINFO_MENU_FILE_TREE (file_menu),
- GNOMEUIINFO_MENU_HELP_TREE (help_menu),
- GNOMEUIINFO_END
-};
+ object_class->destroy =
+ (void (*) (GtkObject *)) capplet_dir_view_destroy;
+ object_class->set_arg = capplet_dir_view_set_arg;
+ object_class->get_arg = capplet_dir_view_get_arg;
-static GnomeUIInfo tool_bar[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("Up"), N_("Parent Group"), up_cb,
- GNOME_STOCK_PIXMAP_UP),
- GNOMEUIINFO_ITEM_STOCK (N_("Preferences"),
- N_("Control Center Preferences"),
- preferences_cb,
- GNOME_STOCK_PIXMAP_PREFERENCES),
- GNOMEUIINFO_ITEM_STOCK (N_("Close"), N_("Close this Window"),
- close_cb, GNOME_STOCK_PIXMAP_CLOSE),
- GNOMEUIINFO_END
-};
+ gtk_object_add_arg_type ("CappletDirView::layout",
+ GTK_TYPE_UINT,
+ GTK_ARG_READWRITE,
+ ARG_LAYOUT);
+
+ gtk_object_add_arg_type ("CappletDirView::capplet_dir",
+ GTK_TYPE_POINTER,
+ GTK_ARG_READWRITE,
+ ARG_CAPPLET_DIR);
+}
guint
capplet_dir_view_get_type (void)
{
- static guint capplet_dir_view_type;
+ static guint capplet_dir_view_type = 0;
if (!capplet_dir_view_type) {
GtkTypeInfo capplet_dir_view_info = {
@@ -149,7 +177,7 @@ capplet_dir_view_get_type (void)
};
capplet_dir_view_type =
- gtk_type_unique (gnome_app_get_type (),
+ gtk_type_unique (gtk_object_get_type (),
&capplet_dir_view_info);
}
@@ -157,409 +185,296 @@ capplet_dir_view_get_type (void)
}
static void
-capplet_dir_view_init (CappletDirView *view)
+print_somthing (GtkObject *o, char *s)
{
- view->layout = LAYOUT_NONE;
-
- gnome_app_construct (GNOME_APP (view),
- "control-center",
- _("Control Center"));
-
- gtk_widget_set_usize (GTK_WIDGET (view), 400, 300);
-
- view->scrolled_win = GTK_SCROLLED_WINDOW
- (gtk_scrolled_window_new (NULL, NULL));
-
- gtk_scrolled_window_set_policy (view->scrolled_win,
- GTK_POLICY_NEVER,
- GTK_POLICY_ALWAYS);
-
- gnome_app_create_menus_with_data (GNOME_APP (view), menu_bar, view);
- gnome_app_create_toolbar_with_data (GNOME_APP (view), tool_bar, view);
- gnome_app_set_contents (GNOME_APP (view),
- GTK_WIDGET (view->scrolled_win));
-
- view->up_button = tool_bar[0].widget;
+ g_print ("somthing destroyed: %s\n", s);
}
static void
-capplet_dir_view_class_init (CappletDirViewClass *klass)
+destroy (GtkObject *o, GtkObject *o2)
{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->destroy =
- (void (*) (GtkObject *)) capplet_dir_view_destroy;
- object_class->set_arg = capplet_dir_view_set_arg;
- object_class->get_arg = capplet_dir_view_get_arg;
-
- gtk_object_add_arg_type ("CappletDirView::layout",
- GTK_TYPE_UINT,
- GTK_ARG_READWRITE,
- ARG_LAYOUT);
-
- gtk_object_add_arg_type ("CappletDirView::capplet_dir",
- GTK_TYPE_POINTER,
- GTK_ARG_READWRITE,
- ARG_CAPPLET_DIR);
+ gtk_object_destroy (o2);
+}
- parent_class = gtk_type_class (gnome_app_get_type ());
- ctree_class = gtk_type_class (gtk_ctree_get_type ());
+static void
+close_cb (GtkWidget *widget, CappletDirView *view)
+{
+ gtk_widget_destroy (GTK_WIDGET (CAPPLET_DIR_VIEW_W (view)));
}
static void
-capplet_dir_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+exit_cb (GtkWidget *w, gpointer data)
{
- CappletDirView *view;
-
- view = CAPPLET_DIR_VIEW (object);
-
- switch (arg_id) {
- case ARG_CAPPLET_DIR:
- capplet_dir_view_load_dir (view, GTK_VALUE_POINTER (*arg));
- break;
- case ARG_LAYOUT:
- switch (GTK_VALUE_UINT (*arg)) {
- case LAYOUT_ICON_LIST: switch_to_icon_list (view); break;
- case LAYOUT_TREE: switch_to_tree (view); break;
- }
- break;
- default:
- break;
- }
+ gtk_main_quit ();
}
-static void
-capplet_dir_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+static void
+menu_cb (GtkWidget *w, CappletDirView *view, CappletDirViewLayout layout)
{
- CappletDirView *view;
-
- view = CAPPLET_DIR_VIEW (object);
+ if (!GTK_CHECK_MENU_ITEM (w)->active)
+ return;
- switch (arg_id) {
- case ARG_CAPPLET_DIR:
- GTK_VALUE_POINTER (*arg) = view->capplet_dir;
- break;
- case ARG_LAYOUT:
- GTK_VALUE_UINT (*arg) = view->layout;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
+ gtk_object_set (GTK_OBJECT (view), "layout", layout, NULL);
}
-GtkWidget *
-capplet_dir_view_new (void)
+static void
+html_menu_cb (GtkWidget *w, CappletDirView *view)
{
- GtkWidget *widget;
-
- widget = gtk_widget_new (capplet_dir_view_get_type (),
- "layout", prefs->layout,
- NULL);
-
- window_list = g_list_append (window_list, widget);
-
- return widget;
+ menu_cb (w, view, LAYOUT_HTML);
}
-void
-capplet_dir_view_destroy (CappletDirView *view)
+static void
+icon_menu_cb (GtkWidget *w, CappletDirView *view)
{
- g_return_if_fail (view != NULL);
- g_return_if_fail (IS_CAPPLET_DIR_VIEW (view));
-
- view->capplet_dir->view = NULL;
-
- window_list = g_list_remove (window_list, view);
-
- if (g_list_length (window_list) == 0)
- gtk_main_quit ();
-
- GTK_OBJECT_CLASS (parent_class)->destroy (GTK_OBJECT (view));
+ menu_cb (w, view, LAYOUT_ICON_LIST);
}
-void
-capplet_dir_view_load_dir (CappletDirView *view, CappletDir *dir)
+static void
+tree_menu_cb (GtkWidget *w, CappletDirView *view)
{
- g_return_if_fail (view != NULL);
- g_return_if_fail (IS_CAPPLET_DIR_VIEW (view));
-
- view->capplet_dir = dir;
-
- clear (view);
-
- if (!dir || view->layout == LAYOUT_NONE) return;
+ menu_cb (w, view, LAYOUT_TREE);
+}
- switch (view->layout) {
- case LAYOUT_ICON_LIST: populate_icon_list (view); break;
- case LAYOUT_TREE: populate_tree (view); break;
- }
+static void
+button_cb (GtkWidget *w, CappletDirView *view, CappletDirViewLayout layout)
+{
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
+ return;
- if (CAPPLET_DIR_ENTRY (dir)->dir == NULL)
- gtk_widget_set_sensitive (view->up_button, FALSE);
- else
- gtk_widget_set_sensitive (view->up_button, TRUE);
+ gtk_object_set (GTK_OBJECT (view), "layout", layout, NULL);
}
-/* Clear all the icons/entries from the view */
-
static void
-clear (CappletDirView *view)
+html_toggle_cb (GtkWidget *w, CappletDirView *view)
{
- switch (view->layout) {
- case LAYOUT_ICON_LIST:
- gnome_icon_list_clear (view->u.icon_list);
- break;
- case LAYOUT_TREE:
- gtk_clist_clear (GTK_CLIST (view->u.tree));
- break;
- }
+ button_cb (w, view, LAYOUT_HTML);
}
-/* Destroy the object that holds the view */
+static void
+list_toggle_cb (GtkWidget *w, CappletDirView *view)
+{
+ button_cb (w, view, LAYOUT_ICON_LIST);
+}
static void
-clean (CappletDirView *view)
+tree_toggle_cb (GtkWidget *w, CappletDirView *view)
{
- switch (view->layout) {
- case LAYOUT_ICON_LIST:
- gtk_object_destroy (GTK_OBJECT (view->u.icon_list));
- break;
- case LAYOUT_TREE:
- gtk_object_destroy (GTK_OBJECT (view->u.tree));
- break;
- }
+ button_cb (w, view, LAYOUT_TREE);
}
static void
-switch_to_icon_list (CappletDirView *view)
+prefs_menu_cb (GtkWidget *widget, CappletDirView *view)
{
- if (view->layout != LAYOUT_ICON_LIST) {
- clean (view);
- create_icon_list (view);
- view->layout = LAYOUT_ICON_LIST;
- }
+ gnomecc_preferences_get_config_dialog (prefs);
}
static void
-create_icon_list (CappletDirView *view)
+about_menu_cb (GtkWidget *widget, CappletDirView *view)
{
- GtkAdjustment *adjustment;
- int i;
+ static GtkWidget *about = NULL;
+ static gchar *authors[] = {
+ "Bradford Hovinen <hovinen@helixcode.com>",
+ "Jacob Berkman <jacob@helixcode.com>",
+ "Johnathan Blandford <jrb@redhat.com>",
+ NULL
+ };
- adjustment = gtk_scrolled_window_get_vadjustment
- (GTK_SCROLLED_WINDOW (view->scrolled_win));
+ if (about) {
+ gdk_window_show (about->window);
+ gdk_window_raise (about->window);
+ return;
+ }
- view->u.icon_list =
- GNOME_ICON_LIST (gnome_icon_list_new (96, adjustment, 0));
- gtk_container_add (GTK_CONTAINER (view->scrolled_win),
- GTK_WIDGET (view->u.icon_list));
+ about = gnome_about_new
+ (_("GNOME Control Center"), VERSION,
+ _("Desktop properties manager."),
+ (const gchar **) authors,
+ "Copyright (C) 2000 Helix Code, Inc.\n"
+ "Copyright (C) 1999 Red Hat Software, Inc.",
+ NULL);
- if (view->selected)
- view->capplet_dir = view->selected->dir;
+ gtk_signal_connect (GTK_OBJECT (about), "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+ &about);
- if (view->capplet_dir) populate_icon_list (view);
+ gtk_widget_show (about);
+}
- if (view->selected) {
- for (i = 0; view->capplet_dir->entries[i]; i++)
- if (view->capplet_dir->entries[i] == view->selected)
- break;
- if (view->capplet_dir->entries[i])
- gnome_icon_list_select_icon (view->u.icon_list, i);
- }
+static void
+back_button_cb (GtkWidget *widget, CappletDirView *view)
+{
+ if (CAPPLET_DIR_ENTRY (view->capplet_dir)->dir)
+ capplet_dir_view_load_dir
+ (view, CAPPLET_DIR_ENTRY (view->capplet_dir)->dir);
+}
- gtk_signal_connect (GTK_OBJECT (view->u.icon_list),
- "select-icon",
- GTK_SIGNAL_FUNC (select_icon_list_cb),
- view);
- gtk_widget_show (GTK_WIDGET (view->u.icon_list));
+static void
+rootm_button_cb (GtkWidget *w, CappletDirView *view)
+{
+ if (GTK_WIDGET_VISIBLE (view->rootm_locked)) {
+ gtk_widget_hide (view->rootm_locked);
+ gtk_widget_show (view->rootm_unlocked);
+ } else {
+ gtk_widget_hide (view->rootm_unlocked);
+ gtk_widget_show (view->rootm_locked);
+ }
}
-static void
-populate_icon_list (CappletDirView *view)
+CappletDirView *
+capplet_dir_view_new (void)
{
- int i;
+ GladeXML *xml;
+ CappletDirView *view;
- gnome_icon_list_freeze (view->u.icon_list);
+ xml = glade_xml_new (GLADEDIR"/gnomecc.glade", "main_window");
+ if (!xml)
+ return NULL;
- for (i = 0; view->capplet_dir->entries[i]; i++)
- gnome_icon_list_insert
- (view->u.icon_list, i,
- view->capplet_dir->entries[i]->icon,
- view->capplet_dir->entries[i]->label);
- gnome_icon_list_thaw (view->u.icon_list);
-}
+ view = CAPPLET_DIR_VIEW (gtk_type_new (CAPPLET_DIR_VIEW_TYPE));
-static void
-switch_to_tree (CappletDirView *view)
-{
- CappletDir *dir, *old_dir;
- GtkCTreeNode *node;
+ window_list = g_list_append (window_list, view);
- if (view->layout != LAYOUT_TREE) {
- if (view->capplet_dir) {
- old_dir = view->capplet_dir;
+ view->app = glade_xml_get_widget (xml, "main_window");
+ view->scrolled_win = glade_xml_get_widget (xml, "scrolled_window");
+ view->up_button = glade_xml_get_widget (xml, "back_button");
+ view->parents_option = glade_xml_get_widget (xml, "parents_option");
+ view->html_toggle = glade_xml_get_widget (xml, "html_toggle");
+ view->list_toggle = glade_xml_get_widget (xml, "list_toggle");
+ view->tree_toggle = glade_xml_get_widget (xml, "tree_toggle");
+ view->html_menu = glade_xml_get_widget (xml, "html_menu");
+ view->list_menu = glade_xml_get_widget (xml, "list_menu");
+ view->tree_menu = glade_xml_get_widget (xml, "tree_menu");
+ view->rootm_button = glade_xml_get_widget (xml, "rootm_button");
+ view->rootm_locked = glade_xml_get_widget (xml, "rootm_locked");
+ view->rootm_unlocked = glade_xml_get_widget (xml, "rootm_unlocked");
- while (CAPPLET_DIR_ENTRY (view->capplet_dir)->dir)
- view->capplet_dir = CAPPLET_DIR_ENTRY
- (view->capplet_dir)->dir;
- }
+ if (!gnome_preferences_get_toolbar_relief_btn ())
+ gtk_button_set_relief (GTK_BUTTON (view->rootm_button), GTK_RELIEF_NONE);
- clean (view);
- create_tree (view);
- view->layout = LAYOUT_TREE;
+ gtk_signal_connect (GTK_OBJECT (view->app), "destroy",
+ GTK_SIGNAL_FUNC (destroy), view);
- if (!view->capplet_dir) return;
+ gtk_signal_connect (GTK_OBJECT (xml), "destroy",
+ GTK_SIGNAL_FUNC (print_somthing), "glade xml");
+ gtk_signal_connect (GTK_OBJECT (view->app), "destroy",
+ GTK_SIGNAL_FUNC (print_somthing), "main window");
+ gtk_signal_connect (GTK_OBJECT (view), "destroy",
+ GTK_SIGNAL_FUNC (print_somthing), "capplet dir view");
- if (view->selected) {
- node = gtk_ctree_find_by_row_data (view->u.tree,
- NULL,
- view->selected);
+ glade_xml_signal_connect_data (xml, "close_cb", close_cb, view);
+ glade_xml_signal_connect_data (xml, "exit_cb", exit_cb, view);
- gtk_ctree_select (view->u.tree, node);
+ glade_xml_signal_connect_data (xml, "html_menu_cb", html_menu_cb, view);
+ glade_xml_signal_connect_data (xml, "icon_menu_cb", icon_menu_cb, view);
+ glade_xml_signal_connect_data (xml, "tree_menu_cb", tree_menu_cb, view);
- dir = IS_CAPPLET_DIR (view->selected) ?
- CAPPLET_DIR (view->selected) :
- view->selected->dir;
- } else {
- dir = old_dir;
- }
+ glade_xml_signal_connect_data (xml, "html_toggle_cb", html_toggle_cb, view);
+ glade_xml_signal_connect_data (xml, "list_toggle_cb", list_toggle_cb, view);
+ glade_xml_signal_connect_data (xml, "tree_toggle_cb", tree_toggle_cb, view);
- while (dir) {
- node = gtk_ctree_find_by_row_data (view->u.tree,
- NULL, dir);
- if (!node) break;
- gtk_ctree_expand (view->u.tree, node);
- dir = CAPPLET_DIR_ENTRY (dir)->dir;
- }
- }
+ glade_xml_signal_connect_data (xml, "prefs_menu_cb", prefs_menu_cb, view);
+ glade_xml_signal_connect_data (xml, "about_menu_cb", about_menu_cb, view);
+ glade_xml_signal_connect_data (xml, "back_button_cb", back_button_cb, view);
+
+ glade_xml_signal_connect_data (xml, "rootm_button_cb", rootm_button_cb, view);
+
+ gtk_object_unref (GTK_OBJECT (xml));
+
+ gtk_object_set (GTK_OBJECT (view), "layout", prefs->layout, NULL);
+
+ return view;
}
-static void
-create_tree (CappletDirView *view)
+void
+capplet_dir_view_destroy (CappletDirView *view)
{
- GtkAdjustment *adjustment;
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (IS_CAPPLET_DIR_VIEW (view));
+
+ view->capplet_dir->view = NULL;
- adjustment = gtk_scrolled_window_get_vadjustment
- (GTK_SCROLLED_WINDOW (view->scrolled_win));
+ window_list = g_list_remove (window_list, view);
- view->u.tree = GTK_CTREE (gtk_ctree_new (1, 0));
- gtk_container_add (GTK_CONTAINER (view->scrolled_win),
- GTK_WIDGET (view->u.tree));
- if (view->capplet_dir) populate_tree (view);
- gtk_signal_connect (GTK_OBJECT (view->u.tree),
- "tree-select-row",
- GTK_SIGNAL_FUNC (select_tree_cb),
- view);
- gtk_signal_connect (GTK_OBJECT (view->u.tree),
- "button_press_event",
- GTK_SIGNAL_FUNC (tree_event_cb),
- view);
- gtk_widget_show (GTK_WIDGET (view->u.tree));
+ if (g_list_length (window_list) == 0)
+ gtk_main_quit ();
+
+ /* GTK_OBJECT_CLASS (parent_class)->destroy (GTK_OBJECT (view)); */
}
static void
-populate_tree_branch (CappletDir *dir, GtkCTree *ctree, GtkCTreeNode *parent)
+option_menu_activate (GtkWidget *w, CappletDirEntry *entry)
{
- GdkPixbuf *pixbuf, *scaled;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GtkCTreeNode *current = NULL;
- int i;
-
- capplet_dir_load (dir);
-
- for (i = 0; dir->entries[i]; i++) {
- pixbuf = gdk_pixbuf_new_from_file (dir->entries[i]->icon);
- scaled = gdk_pixbuf_scale_simple (pixbuf, 16, 16,
- GDK_INTERP_TILES);
- gdk_pixbuf_render_pixmap_and_mask (scaled, &pixmap, &mask, 1);
- gdk_pixbuf_unref (pixbuf);
- gdk_pixbuf_unref (scaled);
-
- current = gtk_ctree_insert_node
- (ctree, parent, NULL,
- &(dir->entries[i]->label),
- 10, pixmap, mask, pixmap, mask,
- IS_CAPPLET (dir->entries[i]), FALSE);
- gtk_ctree_node_set_row_data (ctree, current, dir->entries[i]);
-
- if (IS_CAPPLET_DIR (dir->entries[i]))
- populate_tree_branch (CAPPLET_DIR (dir->entries[i]),
- ctree, current);
- }
-}
+ CappletDirView *view;
-static void
-populate_tree (CappletDirView *view)
-{
- gtk_clist_freeze (GTK_CLIST (view->u.tree));
- populate_tree_branch (view->capplet_dir, view->u.tree, NULL);
- gtk_clist_thaw (GTK_CLIST (view->u.tree));
+ view = gtk_object_get_user_data (GTK_OBJECT (w));
+ if (!IS_CAPPLET_DIR_VIEW (view))
+ return;
+
+ capplet_dir_entry_activate (entry, view);
}
-static gint
-tree_event_cb (GtkCTree *ctree, GdkEventButton *event,
- CappletDirView *view)
+void
+capplet_dir_view_load_dir (CappletDirView *view, CappletDir *dir)
{
+ GtkWidget *menu, *menuitem, *w, *hbox;
+ GdkPixbuf *pb, *scaled;
+ GdkPixmap *pixmap;
+ GdkBitmap *bitmap;
CappletDirEntry *entry;
- GtkCTreeNode *node;
- gint row, column;
-
- if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
- {
- gtk_clist_get_selection_info (GTK_CLIST (ctree),
- event->x, event->y,
- &row, &column);
- node = gtk_ctree_node_nth (ctree, row);
- entry = gtk_ctree_node_get_row_data (ctree, node);
- if (entry && IS_CAPPLET (entry))
- capplet_dir_entry_activate (entry, view);
- }
-}
+ int parents = 0;
-static void
-select_icon_list_cb (GtkWidget *widget, gint arg1, GdkEvent *event,
- CappletDirView *view)
-{
- if (event->type == GDK_2BUTTON_PRESS &&
- ((GdkEventButton *) event)->button == 1)
- {
- capplet_dir_entry_activate
- (view->capplet_dir->entries[arg1], view);
- view->selected = NULL;
- } else {
- view->selected = view->capplet_dir->entries[arg1];
- }
-}
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (IS_CAPPLET_DIR_VIEW (view));
-static void
-select_tree_cb (GtkCTree *ctree, GtkCTreeNode *node, gint column,
- GdkEventButton *event, CappletDirView *view)
-{
- CappletDirEntry *dir_entry;
+ view->capplet_dir = dir;
- dir_entry = gtk_ctree_node_get_row_data (ctree, node);
- view->selected = dir_entry;
-}
+ if (view->impl && view->impl->clear)
+ view->impl->clear (view);
-static void
-preferences_cb (GtkWidget *widget, CappletDirView *view)
-{
- gnomecc_preferences_get_config_dialog (prefs);
-}
+ if (!dir || view->layout == LAYOUT_NONE) return;
+
+ if (view->impl && view->impl->populate)
+ view->impl->populate (view);
+
+ if (CAPPLET_DIR_ENTRY (dir)->dir == NULL)
+ gtk_widget_set_sensitive (view->up_button, FALSE);
+ else
+ gtk_widget_set_sensitive (view->up_button, TRUE);
+
+ menu = gtk_menu_new ();
+
+ for (entry = CAPPLET_DIR_ENTRY (dir); entry; entry = CAPPLET_DIR_ENTRY (entry->dir), parents++) {
+ menuitem = gtk_menu_item_new ();
+ hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
+
+ w = gnome_pixmap_new_from_file_at_size (entry->icon, 16, 16);
+ gtk_box_pack_start (GTK_BOX (hbox), w,
+ FALSE, FALSE, 0);
+
+ w = gtk_label_new (entry->label);
+ gtk_box_pack_start (GTK_BOX (hbox), w,
+ FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (menuitem), hbox);
+
+ if (entry != CAPPLET_DIR_ENTRY (dir)) {
+ gtk_object_set_user_data (GTK_OBJECT (menuitem), view);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (option_menu_activate),
+ entry);
+ }
+
+ gtk_menu_prepend (GTK_MENU (menu), menuitem);
+ }
+ gtk_widget_show_all (menu);
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (view->parents_option), menu);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (view->parents_option), parents-1);
-static void
-close_cb (GtkWidget *widget, CappletDirView *view)
-{
- gtk_object_destroy (GTK_OBJECT (view));
}
+
+
static void
help_cb (GtkWidget *widget, CappletDirView *view)
{
@@ -583,43 +498,8 @@ help_cb (GtkWidget *widget, CappletDirView *view)
}
}
-static void
-about_cb (GtkWidget *widget, CappletDirView *view)
-{
- static gchar *authors[] = {
- "Bradford Hovinen <hovinen@helixcode.com>",
- NULL
- };
-
- if (about == NULL) {
- about = gnome_about_new
- (_("GNOME Control Center"), VERSION,
- "Copyright (C) 2000 Helix Code, Inc.\n",
- (const gchar **) authors,
- _("Desktop Properties manager."),
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (about), "destroy",
- about_done_cb, NULL);
- }
-
- gtk_widget_show (about);
-}
-
-static void
-about_done_cb (GtkWidget *widget, gpointer user_data)
-{
- gtk_widget_hide (about);
-}
-
-static void
-up_cb (GtkWidget *widget, CappletDirView *view)
-{
- if (CAPPLET_DIR_ENTRY (view->capplet_dir)->dir)
- capplet_dir_view_load_dir
- (view, CAPPLET_DIR_ENTRY (view->capplet_dir)->dir);
-}
+#if 0
static void
icons_cb (GtkWidget *widget, CappletDirView *view)
{
@@ -631,6 +511,7 @@ tree_cb (GtkWidget *widget, CappletDirView *view)
{
switch_to_tree (view);
}
+#endif
static void
prefs_changed_cb (GnomeCCPreferences *prefs)
@@ -638,31 +519,17 @@ prefs_changed_cb (GnomeCCPreferences *prefs)
GList *node;
CappletDirView *view;
- switch (prefs->layout) {
- case LAYOUT_ICON_LIST:
- for (node = window_list; node; node = node->next)
- switch_to_icon_list (CAPPLET_DIR_VIEW (node->data));
- break;
- case LAYOUT_TREE:
- node = window_list;
-
- switch_to_tree (CAPPLET_DIR_VIEW (node->data));
- capplet_dir_view_load_dir
- (CAPPLET_DIR_VIEW (node->data),
- get_root_capplet_dir ());
- node = node->next;
-
- while (node) {
- view = CAPPLET_DIR_VIEW (node->data);
- node = node->next;
- gtk_object_destroy (GTK_OBJECT (view));
- }
+ for (node = window_list; node; node = node->next)
+ gtk_object_set (GTK_OBJECT (node->data), "layout", prefs->layout, NULL);
+}
- break;
- }
+void
+capplet_dir_view_show (CappletDirView *view)
+{
+ gtk_widget_show (GTK_WIDGET (CAPPLET_DIR_VIEW_W (view)));
}
-CappletDirView *
+static CappletDirView *
get_capplet_dir_view (CappletDir *dir, CappletDirView *launcher)
{
if (prefs->single_window && launcher)
diff --git a/control-center/capplet-dir-view.h b/control-center/capplet-dir-view.h
index 85349f790..ebc4f70c2 100644
--- a/control-center/capplet-dir-view.h
+++ b/control-center/capplet-dir-view.h
@@ -26,26 +26,46 @@
#include <gnome.h>
+#include <gtkhtml/gtkhtml.h>
#include "capplet-dir.h"
#include "preferences.h"
-#define CAPPLET_DIR_VIEW(obj) GTK_CHECK_CAST (obj, capplet_dir_view_get_type (), CappletDirView)
-#define CAPPLET_DIR_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, capplet_dir_view_get_type (), CappletDirViewClass)
-#define IS_CAPPLET_DIR_VIEW(obj) GTK_CHECK_TYPE (obj, capplet_dir_view_get_type ())
+#define CAPPLET_DIR_VIEW_TYPE (capplet_dir_view_get_type ())
+#define CAPPLET_DIR_VIEW(obj) (GTK_CHECK_CAST (obj, CAPPLET_DIR_VIEW_TYPE, CappletDirView))
+#define CAPPLET_DIR_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, CAPPLET_DIR_VIEW_TYPE, CappletDirViewClass))
+#define IS_CAPPLET_DIR_VIEW(obj) (GTK_CHECK_TYPE (obj, CAPPLET_DIR_VIEW_TYPE))
+#define CAPPLET_DIR_VIEW_W(obj) (CAPPLET_DIR_VIEW (obj)->app)
typedef struct _CappletDirViewClass CappletDirViewClass;
+typedef struct _CappletDirViewImpl CappletDirViewImpl;
+
+typedef void (*CDVFunc) (CappletDirView *);
+
+struct _CappletDirViewImpl
+{
+ /* remove entries from view */
+ CDVFunc clear;
+
+ /* clean up (destroy widgets */
+ CDVFunc clean;
+
+ CDVFunc populate;
+
+ GtkWidget *(*create) (CappletDirView *);
+};
+
struct _CappletDirView
{
- GnomeApp app;
+ GtkObject object;
+ GnomeApp *app;
CappletDir *capplet_dir;
CappletDirEntry *selected;
- union {
- GnomeIconList *icon_list;
- GtkCTree *tree;
- } u;
+ CappletDirViewImpl *impl;
+
+ GtkWidget *view;
gboolean destroyed;
CappletDirViewLayout layout;
@@ -53,19 +73,33 @@ struct _CappletDirView
GtkScrolledWindow *scrolled_win;
GtkWidget *up_button;
+ GtkWidget *parents_option;
+
+ GtkWidget *html_toggle;
+ GtkWidget *list_toggle;
+ GtkWidget *tree_toggle;
+
+ GtkWidget *html_menu;
+ GtkWidget *list_menu;
+ GtkWidget *tree_menu;
+
+ GtkWidget *rootm_button;
+ GtkWidget *rootm_locked;
+ GtkWidget *rootm_unlocked;
};
struct _CappletDirViewClass
{
- GnomeAppClass parent;
+ GtkObjectClass parent;
};
guint capplet_dir_view_get_type (void);
-GtkWidget *capplet_dir_view_new (void);
+CappletDirView *capplet_dir_view_new (void);
void capplet_dir_view_destroy (CappletDirView *view);
void capplet_dir_view_load_dir (CappletDirView *view, CappletDir *dir);
+void capplet_dir_view_show (CappletDirView *view);
void gnomecc_init (void);
diff --git a/control-center/capplet-dir.c b/control-center/capplet-dir.c
index aa41cf446..b50ebedab 100644
--- a/control-center/capplet-dir.c
+++ b/control-center/capplet-dir.c
@@ -23,12 +23,12 @@
* 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
+
+#include <glib.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
@@ -42,38 +42,56 @@ static void capplet_dir_activate (CappletDir *capplet_dir,
static void capplet_shutdown (Capplet *capplet);
static void capplet_dir_shutdown (CappletDir *capplet_dir);
-static CappletDirEntry **read_entries (CappletDir *dir);
+static GSList *read_entries (CappletDir *dir);
static void start_capplet_through_root_manager (GnomeDesktopEntry *gde);
CappletDirView *(*get_view_cb) (CappletDir *dir, CappletDirView *launcher);
+/* nice global table for capplet lookup */
+GHashTable *capplet_hash = NULL;
+
CappletDirEntry *
capplet_new (CappletDir *dir, gchar *desktop_path)
{
Capplet *capplet;
CappletDirEntry *entry;
-
+ GdkPixbuf *pb;
+ GnomeDesktopEntry *dentry;
+
g_return_val_if_fail (desktop_path != NULL, NULL);
+ g_print ("reading %s\n", desktop_path);
+
+ entry = g_hash_table_lookup (capplet_hash, desktop_path);
+ if (entry) {
+ g_print ("hash hit!!\n");
+ return entry;
+ }
+
+ dentry = gnome_desktop_entry_load (desktop_path);
+ if (!dentry || !strcmp ("gnomecc", dentry->exec[0]))
+ return NULL;
+
capplet = g_new0 (Capplet, 1);
entry = CAPPLET_DIR_ENTRY (capplet);
entry->type = TYPE_CAPPLET;
- entry->entry = gnome_desktop_entry_load (desktop_path);
+ entry->entry = dentry;
+
entry->label = entry->entry->name;
entry->icon = entry->entry->icon;
- entry->dir = dir;
+ entry->path = entry->entry->location;
- /* Don't continue if this is just the control center again */
- if (!strcmp (entry->entry->exec[0], "gnomecc")) {
- capplet_dir_entry_destroy (entry);
- return NULL;
- }
+ entry->dir = dir;
if (!entry->icon)
entry->icon = PIXMAPS_DIR "/control-center.png";
+ entry->pb = gdk_pixbuf_new_from_file (entry->icon);
+
+ g_hash_table_insert (capplet_hash, g_strdup (desktop_path), entry);
+
return entry;
}
@@ -86,6 +104,12 @@ capplet_dir_new (CappletDir *dir, gchar *dir_path)
g_return_val_if_fail (dir_path != NULL, NULL);
+ entry = g_hash_table_lookup (capplet_hash, dir_path);
+ if (entry) {
+ g_print ("hash hit!\n");
+ return entry;
+ }
+
desktop_path = g_concat_dir_and_file (dir_path, ".directory");
capplet_dir = g_new0 (CappletDir, 1);
@@ -94,6 +118,7 @@ capplet_dir_new (CappletDir *dir, gchar *dir_path)
entry->type = TYPE_CAPPLET_DIR;
entry->entry = gnome_desktop_entry_load (desktop_path);
entry->dir = dir;
+ entry->path = g_strdup (dir_path);
g_free (desktop_path);
@@ -103,17 +128,29 @@ capplet_dir_new (CappletDir *dir, gchar *dir_path)
if (!entry->icon)
entry->icon = PIXMAPS_DIR "/control-center.png";
+
+ entry->pb = gdk_pixbuf_new_from_file (entry->icon);
} else {
/* If the .directory file could not be found or read, abort */
g_free (capplet_dir);
return NULL;
}
- capplet_dir->path = g_strdup (dir_path);
+ entry->dir = dir;
+
+ g_hash_table_insert (capplet_hash, entry->path, entry);
+
+ capplet_dir_load (entry);
return entry;
}
+CappletDirEntry *
+capplet_lookup (const char *path)
+{
+ return g_hash_table_lookup (capplet_hash, path);
+}
+
void
capplet_dir_entry_destroy (CappletDirEntry *entry)
{
@@ -121,7 +158,7 @@ capplet_dir_entry_destroy (CappletDirEntry *entry)
capplet_shutdown (CAPPLET (entry));
} else {
capplet_dir_shutdown (CAPPLET_DIR (entry));
- g_free (CAPPLET_DIR (entry)->path);
+ g_free (entry->path);
}
gnome_desktop_entry_free (entry->entry);
@@ -160,7 +197,7 @@ capplet_activate (Capplet *capplet)
entry = CAPPLET_DIR_ENTRY (capplet)->entry;
- if (!strcmp (entry->exec[0], "root-manager"))
+ if (!strcmp (entry->exec[0], "root-manager-helper"))
start_capplet_through_root_manager (entry);
else
gnome_desktop_entry_launch (entry);
@@ -180,7 +217,7 @@ capplet_dir_activate (CappletDir *capplet_dir, CappletDirView *launcher)
capplet_dir->view = get_view_cb (capplet_dir, launcher);
capplet_dir_view_load_dir (capplet_dir->view, capplet_dir);
- gtk_widget_show_all (GTK_WIDGET (capplet_dir->view));
+ capplet_dir_view_show (capplet_dir->view);
}
static void
@@ -190,19 +227,20 @@ capplet_shutdown (Capplet *capplet)
}
static void
-capplet_dir_shutdown (CappletDir *capplet_dir)
+cde_destroy (CappletDirEntry *e, gpointer null)
{
- int i;
+ capplet_dir_entry_destroy (e);
+}
+static void
+capplet_dir_shutdown (CappletDir *capplet_dir)
+{
if (capplet_dir->view)
gtk_object_unref (GTK_OBJECT (capplet_dir->view));
- if (capplet_dir->entries) {
- for (i = 0; capplet_dir->entries[i]; i++)
- capplet_dir_entry_destroy
- (capplet_dir->entries[i]);
- g_free (capplet_dir->entries);
- }
+ g_slist_foreach (capplet_dir->entries, cde_destroy, NULL);
+
+ g_slist_free (capplet_dir->entries);
}
static gint
@@ -214,80 +252,60 @@ node_compare (gconstpointer a, gconstpointer b)
/* Adapted from the original control center... */
-static CappletDirEntry **
+static GSList *
read_entries (CappletDir *dir)
{
DIR *parent_dir;
struct dirent *child_dir;
struct stat filedata;
- GList *list_head, *list_tail;
+ GSList *list = NULL;
CappletDirEntry *entry;
- gchar *fullpath;
+ gchar *fullpath, *test;
CappletDirEntry **entry_array;
int i;
- parent_dir = opendir (dir->path);
+ parent_dir = opendir (CAPPLET_DIR_ENTRY (dir)->path);
if (parent_dir == NULL)
return NULL;
- list_head = list_tail = NULL;
-
- while ((child_dir = readdir (parent_dir)) != NULL) {
- if (child_dir->d_name[0] != '.') {
- /* we check to see if it is interesting. */
- fullpath = g_concat_dir_and_file (dir->path,
- child_dir->d_name);
-
- if (stat (fullpath, &filedata) != -1) {
- gchar* test;
-
- entry = NULL;
-
- if (S_ISDIR (filedata.st_mode)) {
- entry = capplet_dir_new
- (dir, fullpath);
- } else {
- test = rindex(child_dir->d_name, '.');
-
- if (test &&
- !strcmp (".desktop", test))
- /* it's a .desktop file --
- * it's interesting for sure! */
- entry = capplet_new
- (dir, fullpath);
- }
-
- if (entry) {
- list_tail = g_list_append
- (list_tail, entry);
- if (!list_head)
- list_head = list_tail;
- else
- list_tail = list_tail->next;
- }
- }
+ while ( (child_dir = readdir (parent_dir)) ) {
+ if (child_dir->d_name[0] == '.')
+ continue;
+ /* we check to see if it is interesting. */
+ fullpath = g_concat_dir_and_file (CAPPLET_DIR_ENTRY (dir)->path, child_dir->d_name);
+
+ if (stat (fullpath, &filedata) == -1) {
g_free (fullpath);
- }
+ continue;
+ }
+
+ entry = NULL;
+
+ if (S_ISDIR (filedata.st_mode)) {
+ entry = capplet_dir_new (dir, fullpath);
+ } else {
+ test = rindex(child_dir->d_name, '.');
+
+ /* if it's a .desktop file, it's interesting for sure! */
+ if (test && !strcmp (".desktop", test))
+ entry = capplet_new (dir, fullpath);
+ }
+
+ if (entry)
+ list = g_slist_prepend (list, entry);
+
+ g_free (fullpath);
}
closedir (parent_dir);
- list_head = g_list_sort (list_head, node_compare);
-
- /* Allocate the array and copy the list contents over */
- entry_array = g_new0 (CappletDirEntry *,
- g_list_length (list_head) + 1);
-
- i = 0;
- while (list_head) {
- entry_array[i++] = list_head->data;
- list_head = g_list_remove_link (list_head, list_head);
- }
-
- entry_array[i] = NULL;
+ list = g_slist_sort (list, node_compare);
- return entry_array;
+ /* remove FALSE for parent entry */
+ return FALSE && CAPPLET_DIR_ENTRY (dir)->dir
+ ? g_slist_prepend (list, CAPPLET_DIR_ENTRY (dir)->dir)
+ : list;
}
static void
@@ -296,6 +314,7 @@ start_capplet_through_root_manager (GnomeDesktopEntry *gde)
static FILE *output = NULL;
pid_t pid;
char *cmdline;
+ char *oldexec;
if (!output) {
gint pipe_fd[2];
@@ -310,11 +329,11 @@ start_capplet_through_root_manager (GnomeDesktopEntry *gde)
char *arg[2];
int i;
- dup2 (pipe_fd[0], 0);
+ dup2 (pipe_fd[0], STDIN_FILENO);
for (i = 3; i < FOPEN_MAX; i++) close(i);
- arg[0] = gnome_is_program_in_path ("root-manager");
+ arg[0] = gnome_is_program_in_path ("root-manager-helper");
arg[1] = NULL;
execv (arg[0], arg);
}
@@ -324,7 +343,17 @@ start_capplet_through_root_manager (GnomeDesktopEntry *gde)
}
}
+
+ oldexec = gde->exec[1];
+ gde->exec[1] = gnome_is_program_in_path (oldexec);
+
cmdline = g_strjoinv (" ", gde->exec + 1);
+
+ g_free (gde->exec[1]);
+ gde->exec[1] = oldexec;
+
+ g_print ("trying: %s\n", cmdline);
+
fprintf (output, "%s\n", cmdline);
fflush (output);
g_free (cmdline);
@@ -334,6 +363,7 @@ void
capplet_dir_init (CappletDirView *(*cb) (CappletDir *, CappletDirView *))
{
get_view_cb = cb;
+ capplet_hash = g_hash_table_new (g_str_hash, g_str_equal);
}
CappletDir *
diff --git a/control-center/capplet-dir.h b/control-center/capplet-dir.h
index 1fdc18773..bba56084e 100644
--- a/control-center/capplet-dir.h
+++ b/control-center/capplet-dir.h
@@ -25,6 +25,7 @@
#define __CAPPLET_DIR_H
#include <gnome.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#define CAPPLET_DIR_ENTRY(obj) ((CappletDirEntry *) obj)
#define CAPPLET_DIR(obj) ((CappletDir *) obj)
@@ -40,7 +41,8 @@ typedef struct _Capplet Capplet;
typedef struct _CappletDirView CappletDirView;
typedef enum {
- TYPE_CAPPLET, TYPE_CAPPLET_DIR
+ TYPE_CAPPLET,
+ TYPE_CAPPLET_DIR
} CappletEntryType;
struct _CappletDirEntry
@@ -49,14 +51,15 @@ struct _CappletDirEntry
GnomeDesktopEntry *entry;
gchar *label;
gchar *icon;
- CappletDir *dir;
+ gchar *path;
+ GdkPixbuf *pb;
+ CappletDir *dir;
};
struct _CappletDir
{
CappletDirEntry entry;
- gchar *path;
- CappletDirEntry **entries;
+ GSList *entries;
CappletDirView *view;
};
@@ -69,6 +72,10 @@ CappletDirEntry *capplet_new (CappletDir *dir,
gchar *desktop_path);
CappletDirEntry *capplet_dir_new (CappletDir *dir, gchar *dir_path);
+CappletDirEntry *capplet_lookup (const char *path);
+
+char *capplet_dir_entry_get_html (CappletDirEntry *entry);
+
void capplet_dir_entry_destroy (CappletDirEntry *entry);
void capplet_dir_entry_activate (CappletDirEntry *entry,
diff --git a/control-center/gnomecc-preferences.glade b/control-center/gnomecc-preferences.glade
deleted file mode 100644
index d974d6be3..000000000
--- a/control-center/gnomecc-preferences.glade
+++ /dev/null
@@ -1,237 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>New-control-center</name>
- <program_name>new-control-center</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>preferences_dialog</name>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkNotebook</class>
- <name>notebook1</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>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <border_width>5</border_width>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>no_embed_widget</name>
- <can_focus>True</can_focus>
- <label>Launch control panels in separate windows</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>embed_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>embed_widget</name>
- <can_focus>True</can_focus>
- <label>Put control panels in the control center's window</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>embed_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator1</name>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>tree_widget</name>
- <can_focus>True</can_focus>
- <signal>
- <name>toggled</name>
- <handler>tree_widget_toggled_cb</handler>
- <last_modification_time>Fri, 11 Aug 2000 17:13:59 GMT</last_modification_time>
- </signal>
- <label>Display control panels as a tree</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>display_type_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>icon_list_widget</name>
- <can_focus>True</can_focus>
- <label>Display control panels as a set of icons</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>display_type_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator2</name>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>single_widget</name>
- <can_focus>True</can_focus>
- <label>Browse with single window</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>browse_type</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>multiple_widget</name>
- <can_focus>True</can_focus>
- <label>Browse with multiple windows</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>browse_type</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>label1</name>
- <label>Appearance</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>
-</widget>
-
-</GTK-Interface>
diff --git a/control-center/gnomecc.glade b/control-center/gnomecc.glade
new file mode 100644
index 000000000..ae352a9d1
--- /dev/null
+++ b/control-center/gnomecc.glade
@@ -0,0 +1,699 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>New-control-center</name>
+ <program_name>new-control-center</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <output_translatable_strings>True</output_translatable_strings>
+ <translatable_strings_file>gnomecc.glade.h</translatable_strings_file>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>preferences_dialog</name>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>False</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button2</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button3</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>notebook1</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>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox1</name>
+ <border_width>5</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>5</spacing>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>no_embed_widget</name>
+ <can_focus>True</can_focus>
+ <label>Launch control panels in separate windows</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>embed_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>embed_widget</name>
+ <can_focus>True</can_focus>
+ <label>Put control panels in the control center's window</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>embed_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator1</name>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>html_widget</name>
+ <can_focus>True</can_focus>
+ <label>Display control panels as HTML</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <group>display_type_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>icon_list_widget</name>
+ <can_focus>True</can_focus>
+ <label>Display control panels as a set of icons</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>display_type_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>tree_widget</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>toggled</name>
+ <handler>tree_widget_toggled_cb</handler>
+ <last_modification_time>Fri, 11 Aug 2000 17:13:59 GMT</last_modification_time>
+ </signal>
+ <label>Display control panels as a tree</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>display_type_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator2</name>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>single_widget</name>
+ <can_focus>True</can_focus>
+ <label>Browse with single window</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>browse_type</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>multiple_widget</name>
+ <can_focus>True</can_focus>
+ <label>Browse with multiple windows</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>browse_type</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label1</name>
+ <label>Appearance</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>
+</widget>
+
+<widget>
+ <class>GnomeApp</class>
+ <name>main_window</name>
+ <visible>False</visible>
+ <title>New-control-center</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <default_height>300</default_height>
+ <allow_shrink>True</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <enable_layout_config>True</enable_layout_config>
+
+ <widget>
+ <class>GnomeDock</class>
+ <child_name>GnomeApp:dock</child_name>
+ <name>dock1</name>
+ <allow_floating>True</allow_floating>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GnomeDockItem</class>
+ <name>dockitem1</name>
+ <border_width>2</border_width>
+ <placement>GNOME_DOCK_TOP</placement>
+ <band>0</band>
+ <position>0</position>
+ <offset>0</offset>
+ <locked>False</locked>
+ <exclusive>True</exclusive>
+ <never_floating>False</never_floating>
+ <never_vertical>True</never_vertical>
+ <never_horizontal>False</never_horizontal>
+ <shadow_type>GTK_SHADOW_OUT</shadow_type>
+
+ <widget>
+ <class>GtkMenuBar</class>
+ <name>menubar1</name>
+ <shadow_type>GTK_SHADOW_NONE</shadow_type>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>file1</name>
+ <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>file1_menu</name>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>exit1</name>
+ <signal>
+ <name>activate</name>
+ <handler>close_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_CLOSE_ITEM</stock_item>
+ </widget>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>exit2</name>
+ <signal>
+ <name>activate</name>
+ <handler>exit_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>view1</name>
+ <stock_item>GNOMEUIINFO_MENU_VIEW_TREE</stock_item>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>view1_menu</name>
+
+ <widget>
+ <class>GtkRadioMenuItem</class>
+ <name>html_menu</name>
+ <signal>
+ <name>activate</name>
+ <handler>html_menu_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <label>HTML</label>
+ <active>False</active>
+ <always_show_toggle>False</always_show_toggle>
+ <group>view_group</group>
+ </widget>
+
+ <widget>
+ <class>GtkRadioMenuItem</class>
+ <name>list_menu</name>
+ <signal>
+ <name>activate</name>
+ <handler>icon_menu_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <label>Icon List</label>
+ <active>False</active>
+ <always_show_toggle>False</always_show_toggle>
+ <group>view_group</group>
+ </widget>
+
+ <widget>
+ <class>GtkRadioMenuItem</class>
+ <name>tree_menu</name>
+ <signal>
+ <name>activate</name>
+ <handler>tree_menu_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <label>Tree</label>
+ <active>True</active>
+ <always_show_toggle>False</always_show_toggle>
+ <group>view_group</group>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>settings1</name>
+ <stock_item>GNOMEUIINFO_MENU_SETTINGS_TREE</stock_item>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>settings1_menu</name>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>preferences1</name>
+ <signal>
+ <name>activate</name>
+ <handler>prefs_menu_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_PREFERENCES_ITEM</stock_item>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkMenuItem</class>
+ <name>help1</name>
+ <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item>
+
+ <widget>
+ <class>GtkMenu</class>
+ <name>help1_menu</name>
+
+ <widget>
+ <class>GtkPixmapMenuItem</class>
+ <name>about1</name>
+ <signal>
+ <name>activate</name>
+ <handler>about_menu_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:53:49 GMT</last_modification_time>
+ </signal>
+ <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeDockItem</class>
+ <name>dockitem3</name>
+ <placement>GNOME_DOCK_TOP</placement>
+ <band>1</band>
+ <position>0</position>
+ <offset>0</offset>
+ <locked>False</locked>
+ <exclusive>True</exclusive>
+ <never_floating>False</never_floating>
+ <never_vertical>False</never_vertical>
+ <never_horizontal>False</never_horizontal>
+ <shadow_type>GTK_SHADOW_OUT</shadow_type>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox1</name>
+ <homogeneous>True</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox3</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkToolbar</class>
+ <name>toolbar4</name>
+ <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
+ <type>GTK_TOOLBAR_ICONS</type>
+ <space_size>5</space_size>
+ <space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <tooltips>True</tooltips>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>rootm_button</name>
+ <can_focus>True</can_focus>
+ <signal>
+ <name>clicked</name>
+ <handler>rootm_button_cb</handler>
+ <last_modification_time>Thu, 07 Dec 2000 22:22:55 GMT</last_modification_time>
+ </signal>
+ <relief>GTK_RELIEF_NONE</relief>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox3</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+
+ <widget>
+ <class>GnomePixmap</class>
+ <name>rootm_locked</name>
+ <width>24</width>
+ <height>24</height>
+ <filename>gnome-lockscreen.png</filename>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GnomePixmap</class>
+ <name>rootm_unlocked</name>
+ <width>24</width>
+ <height>24</height>
+ <visible>False</visible>
+ <filename>gnome-unlockscreen.png</filename>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label3</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>
+ <class>GtkToolbar</class>
+ <name>toolbar1</name>
+ <border_width>1</border_width>
+ <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
+ <type>GTK_TOOLBAR_ICONS</type>
+ <space_size>8</space_size>
+ <space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style>
+ <relief>GTK_RELIEF_NONE</relief>
+ <tooltips>True</tooltips>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>back_button</name>
+ <signal>
+ <name>clicked</name>
+ <handler>back_button_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:56:16 GMT</last_modification_time>
+ </signal>
+ <label></label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_BACK</stock_pixmap>
+ </widget>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>parents_option</name>
+ <can_focus>True</can_focus>
+ <items></items>
+ <initial_choice>0</initial_choice>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox2</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label2</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>GtkToolbar</class>
+ <name>toolbar3</name>
+ <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
+ <type>GTK_TOOLBAR_ICONS</type>
+ <space_size>5</space_size>
+ <space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ <tooltips>True</tooltips>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkToggleButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>html_toggle</name>
+ <signal>
+ <name>toggled</name>
+ <handler>html_toggle_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:56:32 GMT</last_modification_time>
+ </signal>
+ <label></label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_ALIGN_LEFT</stock_pixmap>
+ <active>True</active>
+ </widget>
+
+ <widget>
+ <class>GtkToggleButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>list_toggle</name>
+ <signal>
+ <name>toggled</name>
+ <handler>list_toggle_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:56:48 GMT</last_modification_time>
+ </signal>
+ <label></label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_ALIGN_CENTER</stock_pixmap>
+ <active>False</active>
+ </widget>
+
+ <widget>
+ <class>GtkToggleButton</class>
+ <child_name>Toolbar:button</child_name>
+ <name>tree_toggle</name>
+ <signal>
+ <name>toggled</name>
+ <handler>tree_toggle_cb</handler>
+ <last_modification_time>Tue, 05 Dec 2000 02:56:59 GMT</last_modification_time>
+ </signal>
+ <label></label>
+ <stock_pixmap>GNOME_STOCK_PIXMAP_ALIGN_RIGHT</stock_pixmap>
+ <active>False</active>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkScrolledWindow</class>
+ <child_name>GnomeDock:contents</child_name>
+ <name>scrolled_window</name>
+ <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
+ <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
+ <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
+ <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GnomeAppBar</class>
+ <child_name>GnomeApp:appbar</child_name>
+ <name>appbar1</name>
+ <has_progress>False</has_progress>
+ <has_status>True</has_status>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/control-center/gnomecc.glade.h b/control-center/gnomecc.glade.h
new file mode 100644
index 000000000..59a16df77
--- /dev/null
+++ b/control-center/gnomecc.glade.h
@@ -0,0 +1,18 @@
+/*
+ * 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_("Launch control panels in separate windows");
+gchar *s = N_("Put control panels in the control center's window");
+gchar *s = N_("Display control panels as HTML");
+gchar *s = N_("Display control panels as a set of icons");
+gchar *s = N_("Display control panels as a tree");
+gchar *s = N_("Browse with single window");
+gchar *s = N_("Browse with multiple windows");
+gchar *s = N_("Appearance");
+gchar *s = N_("New-control-center");
+gchar *s = N_("HTML");
+gchar *s = N_("Icon List");
+gchar *s = N_("Tree");
diff --git a/control-center/pixmaps/gnome-lockscreen.png b/control-center/pixmaps/gnome-lockscreen.png
new file mode 100644
index 000000000..548b4e99b
--- /dev/null
+++ b/control-center/pixmaps/gnome-lockscreen.png
Binary files differ
diff --git a/control-center/pixmaps/gnome-unlockscreen.png b/control-center/pixmaps/gnome-unlockscreen.png
new file mode 100644
index 000000000..76d9f4c5a
--- /dev/null
+++ b/control-center/pixmaps/gnome-unlockscreen.png
Binary files differ
diff --git a/control-center/preferences.c b/control-center/preferences.c
index f6bc463c7..af3140101 100644
--- a/control-center/preferences.c
+++ b/control-center/preferences.c
@@ -133,8 +133,8 @@ gnomecc_preferences_load (GnomeCCPreferences *prefs)
gnome_config_push_prefix ("/control-center/appearance");
prefs->embed = gnome_config_get_bool ("embed=false");
- prefs->single_window = gnome_config_get_bool ("single_window=false");
- prefs->layout = gnome_config_get_int ("layout=2");
+ prefs->single_window = gnome_config_get_bool ("single_window=true");
+ prefs->layout = gnome_config_get_int ("layout=3");
gnome_config_pop_prefix ();
}
@@ -156,40 +156,27 @@ static void
place_preferences (GladeXML *prefs_data, GnomeCCPreferences *prefs)
{
GtkWidget *widget;
+ char *w;
- if (prefs->embed) {
- widget = glade_xml_get_widget (prefs_data, "embed_widget");
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (widget), TRUE);
- } else {
- widget = glade_xml_get_widget (prefs_data, "no_embed_widget");
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (widget), TRUE);
- }
+ widget = glade_xml_get_widget (prefs_data, prefs->embed
+ ? "embed_widget" : "no_embed_widget");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- if (prefs->single_window) {
- widget = glade_xml_get_widget (prefs_data, "single_widget");
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (widget), TRUE);
- } else {
- widget = glade_xml_get_widget (prefs_data, "multiple_widget");
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (widget), TRUE);
- }
+ widget = glade_xml_get_widget (prefs_data, prefs->single_window
+ ? "single_widget" : "multiple_widget");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- if (prefs->layout == LAYOUT_TREE) {
- widget = glade_xml_get_widget (prefs_data, "tree_widget");
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (widget), TRUE);
- set_single_window_controls_sensitive
- (prefs_dialog_data, FALSE);
- } else if (prefs->layout == LAYOUT_ICON_LIST) {
- widget = glade_xml_get_widget (prefs_data, "icon_list_widget");
- gtk_toggle_button_set_active
- (GTK_TOGGLE_BUTTON (widget), TRUE);
- set_single_window_controls_sensitive
- (prefs_dialog_data, TRUE);
+ switch (prefs->layout) {
+ case LAYOUT_HTML: w = "html_widget"; break;
+ case LAYOUT_TREE: w = "tree_widget"; break;
+ case LAYOUT_ICON_LIST: w = "icon_list_widget"; break;
+ default: w = NULL; break;
}
+
+ if (!w) return;
+
+ widget = glade_xml_get_widget (prefs_data, w);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
}
static void
@@ -208,8 +195,13 @@ read_preferences (GladeXML *prefs_data, GnomeCCPreferences *prefs)
widget = glade_xml_get_widget (prefs_data, "tree_widget");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
prefs->layout = LAYOUT_TREE;
- else
- prefs->layout = LAYOUT_ICON_LIST;
+ else {
+ widget = glade_xml_get_widget (prefs_data, "html_widget");
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ prefs->layout = LAYOUT_HTML;
+ else
+ prefs->layout = LAYOUT_ICON_LIST;
+ }
gnomecc_preferences_save (prefs);
@@ -257,11 +249,12 @@ static void
set_single_window_controls_sensitive (GladeXML *data, gboolean s)
{
GtkWidget *widget;
-
+#if 0
widget = glade_xml_get_widget (prefs_dialog_data, "single_widget");
gtk_widget_set_sensitive (widget, s);
widget = glade_xml_get_widget (prefs_dialog_data, "multiple_widget");
gtk_widget_set_sensitive (widget, s);
+#endif
}
void
@@ -282,7 +275,7 @@ gnomecc_preferences_get_config_dialog (GnomeCCPreferences *prefs)
old_prefs = gnomecc_preferences_clone (prefs);
prefs_dialog_data =
- glade_xml_new (GLADEDIR "/gnomecc-preferences.glade", NULL);
+ glade_xml_new (GLADEDIR "/gnomecc.glade", "preferences_dialog");
if (!prefs_dialog_data) {
g_warning ("Could not find data for preferences dialog");
diff --git a/control-center/preferences.h b/control-center/preferences.h
index 8e38e23f5..cfa3f7dda 100644
--- a/control-center/preferences.h
+++ b/control-center/preferences.h
@@ -25,7 +25,10 @@
#define __PREFERENCES_H
typedef enum _CappletDirViewLayout {
- LAYOUT_NONE, LAYOUT_ICON_LIST, LAYOUT_TREE
+ LAYOUT_NONE,
+ LAYOUT_ICON_LIST,
+ LAYOUT_TREE,
+ LAYOUT_HTML
} CappletDirViewLayout;
#define GNOMECC_PREFERENCES(obj) GTK_CHECK_CAST (obj, gnomecc_preferences_get_type (), GnomeCCPreferences)
diff --git a/control-center/root-manager.c b/control-center/root-manager.c
deleted file mode 100644
index eab55270f..000000000
--- a/control-center/root-manager.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* root-manager.c
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Written by Bradford Hovinen (hovinen@helixcode.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)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <glib.h>
-
-#include <libgnome/libgnome.h>
-
-int
-main (int argc, char **argv)
-{
- char *buffer, *tmp;
- char **args;
- gint buf_size = 1024;
- pid_t pid;
-
- if (argc > 1) {
- execv (gnome_is_program_in_path (argv[1]), argv + 1);
- g_error ("%s", g_strerror (errno));
- }
-
- buffer = g_new (char, buf_size);
-
- while (!feof(stdin)) {
- buffer[0] = buffer[1] = 0;
- tmp = buffer;
- fgets (tmp, 1023, stdin);
-
- while (strlen (tmp) == 1023) {
- buf_size *= 2;
- buffer = g_renew (char, buffer, buf_size);
- tmp += 1023;
- fgets (tmp, 1023, stdin);
- }
-
- if (!strlen(buffer)) continue;
-
- pid = fork ();
-
- if (pid == (pid_t) -1) {
- g_error ("%s", g_strerror (errno));
- }
- else if (pid == 0) {
- buffer[strlen (buffer) - 1] = '\0';
- args = g_strsplit (buffer, " ", -1);
- printf ("Output: %s", args[0]);
- execv (gnome_is_program_in_path (args[0]), args);
- g_error ("%s", g_strerror (errno));
- }
- }
-
- return 0;
-}
diff --git a/root-manager/.cvsignore b/root-manager/.cvsignore
new file mode 100644
index 000000000..bbd68bb89
--- /dev/null
+++ b/root-manager/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+.libs
+.deps
+root-manager
+root-manager-helper
diff --git a/root-manager/Makefile.am b/root-manager/Makefile.am
new file mode 100644
index 000000000..f90add8d9
--- /dev/null
+++ b/root-manager/Makefile.am
@@ -0,0 +1,26 @@
+INCLUDES = \
+ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+ -I$(top_srcdir)/intl -I$(top_builddir)/intl \
+ -I$(includedir) $(shell gtk-config --cflags) \
+ -DDEBUG_USERHELPER
+
+bin_PROGRAMS = root-manager-helper
+
+sbin_PROGRAMS = root-manager
+
+root_manager_SOURCES = \
+ root-manager.c \
+ root-manager.h
+
+root_manager_LDADD = -lpam -lpam_misc -ldl
+
+root_manager_LDFLAGS = $(shell glib-config --libs)
+
+root_manager_helper_SOURCES = \
+ root-manager-helper.c \
+ root-manager-wrap.c \
+ root-manager-wrap.h \
+ userdialogs.c \
+ userdialogs.h
+
+root_manager_helper_LDFLAGS = $(shell gtk-config --libs)
diff --git a/root-manager/TODO b/root-manager/TODO
new file mode 100644
index 000000000..297ea0fd2
--- /dev/null
+++ b/root-manager/TODO
@@ -0,0 +1 @@
+1: write TODO file
diff --git a/root-manager/root-manager-helper.c b/root-manager/root-manager-helper.c
new file mode 100644
index 000000000..7c86c7195
--- /dev/null
+++ b/root-manager/root-manager-helper.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 1999 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <libintl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <gtk/gtk.h>
+#include "userdialogs.h"
+#include "root-manager-wrap.h"
+
+void
+userhelper_fatal_error(int signal)
+{
+ gtk_main_quit();
+}
+
+int
+main(int argc, char* argv[])
+{
+ char *argv2[] = { UH_PATH, "0", NULL };
+ char **argv_fake;
+ int argc_fake = 2;
+
+ int new_fd;
+
+ /* first set up our locale info for gettext. */
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GNOMELOCALEDIR);
+ textdomain (PACKAGE);
+
+ argv_fake = g_new0 (char *, 3);
+ argv_fake[0] = UH_PATH;
+ argv_fake[1] = "0";
+
+ if (!gtk_init_check(&argc_fake, &argv_fake)) {
+ g_error ("Must be run with $DISPLAY");
+ }
+
+ new_fd = dup (STDIN_FILENO);
+ if (new_fd < 0)
+ g_error ("error dup()'ing");
+
+ signal(SIGCHLD, userhelper_fatal_error);
+
+ userhelper_runv (UH_PATH, new_fd);
+
+ gtk_main();
+
+ g_print ("back...\n");
+
+ return 0;
+}
diff --git a/root-manager/root-manager-wrap.c b/root-manager/root-manager-wrap.c
new file mode 100644
index 000000000..5f5c67b7f
--- /dev/null
+++ b/root-manager/root-manager-wrap.c
@@ -0,0 +1,528 @@
+/* -*-Mode: c-*- */
+/* Copyright (C) 1997 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <unistd.h>
+#include <locale.h>
+#include <libintl.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <gdk/gdkx.h>
+#include "root-manager-wrap.h"
+#include "userdialogs.h"
+
+#define MAXLINE 512
+
+int childout[2];
+int childin[2];
+int childout_tag;
+
+void
+userhelper_runv(char *path, int new_fd)
+{
+ pid_t pid;
+ int retval;
+ int i;
+ int stdin_save = STDIN_FILENO;
+ int stdout_save = STDOUT_FILENO;
+ int stderr_save = STDERR_FILENO;
+ char *nargs[256]; /* only used internally, we know this will not overflow */
+
+ if((pipe(childout) == -1) || (pipe(childin) == -1))
+ {
+ fprintf(stderr, _("Pipe error.\n"));
+ exit(1);
+ }
+
+ if((pid = fork()) < 0)
+ {
+ fprintf(stderr, _("Cannot fork().\n"));
+ }
+ else if(pid > 0) /* parent */
+ {
+ close(childout[1]);
+ close(childin[0]);
+ close (new_fd);
+
+ childout_tag = gdk_input_add(childout[0], GDK_INPUT_READ, (GdkInputFunction) userhelper_read_childout, NULL);
+
+ }
+ else /* child */
+ {
+ close(childout[0]);
+ close(childin[1]);
+
+ if(childout[1] != STDOUT_FILENO)
+ {
+ if(((stdout_save = dup(STDOUT_FILENO)) == -1) ||
+ (dup2(childout[1], STDOUT_FILENO) != STDOUT_FILENO))
+ {
+ fprintf(stderr, _("dup2() error.\n"));
+ exit(2);
+ }
+ close(childout[1]);
+ }
+ if(childin[0] != STDIN_FILENO)
+ {
+ if(((stdin_save = dup(STDIN_FILENO)) == -1) ||
+ (dup2(childin[0], STDIN_FILENO) != STDIN_FILENO))
+ {
+ fprintf(stderr, _("dup2() error.\n"));
+ exit(2);
+ }
+ }
+
+ memset(&nargs, 0, sizeof(nargs));
+ nargs[0] = UH_PATH;
+ nargs[1] = g_strdup_printf ("%d", new_fd);
+#if 0
+ nargs[1] = "-d";
+ nargs[2] = g_strdup_printf("%d,%d,%d", stdin_save, stdout_save,
+ stderr_save);
+ for(i = 3; i < sizeof(nargs) / sizeof(nargs[0]); i++) {
+ nargs[i] = args[i - 2];
+ if(nargs[i] == NULL) {
+ break;
+ }
+ }
+#endif
+#ifdef DEBUG_USERHELPER
+ for(i = 0; i < sizeof(nargs) / sizeof(nargs[0]); i++) {
+ if(nargs[i] == NULL) {
+ break;
+ }
+ fprintf(stderr, "Exec arg = \"%s\".\n", nargs[i]);
+ }
+#endif
+ retval = execv(path, nargs);
+
+ if(retval < 0) {
+ fprintf(stderr, _("execl() error, errno=%d\n"), errno);
+ }
+
+ _exit(0);
+
+ }
+}
+void
+userhelper_run(char *path, ...)
+{
+ va_list ap;
+ char *args[256]; /* only used internally, we know this will not overflow */
+ int i = 0;
+
+ va_start(ap, path);
+ while((i < 255) && ((args[i++] = va_arg(ap, char *)) != NULL));
+ va_end(ap);
+
+ userhelper_runv(path, args);
+}
+
+void
+userhelper_parse_exitstatus(int exitstatus)
+{
+ GtkWidget* message_box;
+
+ switch(exitstatus)
+ {
+ case 0:
+ message_box = create_message_box(_("Information updated."), NULL);
+ break;
+ case ERR_PASSWD_INVALID:
+ message_box = create_error_box(_("The password you typed is invalid.\nPlease try again."), NULL);
+ break;
+ case ERR_FIELDS_INVALID:
+ message_box = create_error_box(_("One or more of the changed fields is invalid.\nThis is probably due to either colons or commas in one of the fields.\nPlease remove those and try again."), NULL);
+ break;
+ case ERR_SET_PASSWORD:
+ message_box = create_error_box(_("Password resetting error."), NULL);
+ break;
+ case ERR_LOCKS:
+ message_box = create_error_box(_("Some systems files are locked.\nPlease try again in a few moments."), NULL);
+ break;
+ case ERR_NO_USER:
+ message_box = create_error_box(_("Unknown user."), NULL);
+ break;
+ case ERR_NO_RIGHTS:
+ message_box = create_error_box(_("Insufficient rights."), NULL);
+ break;
+ case ERR_INVALID_CALL:
+ message_box = create_error_box(_("Invalid call to sub process."), NULL);
+ break;
+ case ERR_SHELL_INVALID:
+ message_box = create_error_box(_("Your current shell is not listed in /etc/shells.\nYou are not allowed to change your shell.\nConsult your system administrator."), NULL);
+ break;
+ case ERR_NO_MEMORY:
+ /* well, this is unlikely to work either, but at least we tried... */
+ message_box = create_error_box(_("Out of memory."), NULL);
+ break;
+ case ERR_EXEC_FAILED:
+ message_box = create_error_box(_("The exec() call failed."), NULL);
+ break;
+ case ERR_NO_PROGRAM:
+ message_box = create_error_box(_("Failed to find selected program."), NULL);
+ break;
+ case ERR_UNK_ERROR:
+ message_box = create_error_box(_("Unknown error."), NULL);
+ break;
+ default:
+ message_box = create_error_box(_("Unknown exit code."), NULL);
+ break;
+ }
+
+ gtk_signal_connect(GTK_OBJECT(message_box), "destroy", (GtkSignalFunc) userhelper_fatal_error, NULL);
+ gtk_signal_connect(GTK_OBJECT(message_box), "delete_event", (GtkSignalFunc) userhelper_fatal_error, NULL);
+ gtk_widget_show(message_box);
+
+}
+
+static void
+userhelper_grab_focus(GtkWidget *widget, GdkEvent *map_event, gpointer data)
+{
+ int ret;
+ GtkWidget *toplevel;
+ /* grab focus for the toplevel of this widget, so that peers can
+ * get events too */
+ toplevel = gtk_widget_get_toplevel(widget);
+ ret = gdk_keyboard_grab(toplevel->window, TRUE, GDK_CURRENT_TIME);
+}
+
+static void
+mark_void(GtkWidget *widget, gpointer target)
+{
+ if(target != NULL) {
+ *(gpointer*)target = NULL;
+ }
+}
+
+void
+userhelper_parse_childout(char* outline)
+{
+ char *prompt;
+ char *rest = NULL;
+ char *title;
+ int prompt_type;
+ static response *resp = NULL;
+ GdkPixmap *pixmap;
+
+ if (resp != NULL) {
+ if(!GTK_IS_WINDOW(resp->top)) {
+ g_free(resp->user);
+ g_free(resp);
+ resp = NULL;
+ }
+ }
+
+ if (resp == NULL) {
+ GtkWidget *vbox, *hbox, *sbox;
+
+ resp = g_malloc0(sizeof(response));
+
+ resp->user = g_strdup(getlogin());
+ resp->top = gtk_window_new(GTK_WINDOW_DIALOG);
+ gtk_signal_connect(GTK_OBJECT(resp->top), "destroy",
+ GTK_SIGNAL_FUNC(mark_void), &resp->top);
+ gtk_window_set_title(GTK_WINDOW(resp->top), _("Input"));
+ gtk_window_position(GTK_WINDOW(resp->top), GTK_WIN_POS_CENTER);
+ gtk_container_set_border_width(GTK_CONTAINER(resp->top), 5);
+ gtk_signal_connect(GTK_OBJECT(resp->top), "map",
+ GTK_SIGNAL_FUNC(userhelper_grab_focus), NULL);
+
+ resp->table = gtk_table_new(1, 2, FALSE);
+ resp->rows = 1;
+
+ vbox = gtk_vbox_new(FALSE, 4);
+ sbox = gtk_hbox_new(TRUE, 4);
+ hbox = gtk_hbutton_box_new();
+ gtk_object_set_data(GTK_OBJECT(resp->top), UH_ACTION_AREA, hbox);
+ gtk_box_pack_start(GTK_BOX(vbox), resp->table, TRUE, TRUE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox), sbox, FALSE, FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(sbox), hbox, FALSE, FALSE, 4);
+ gtk_container_add(GTK_CONTAINER(resp->top), vbox);
+
+ pixmap = gdk_pixmap_create_from_xpm(gdk_window_foreign_new(GDK_ROOT_WINDOW()),
+ NULL, NULL, UH_KEY_PIXMAP_PATH);
+ if(pixmap != NULL) {
+ GtkWidget *pm = gtk_pixmap_new(pixmap, NULL);
+ if(pm != NULL) {
+ GtkWidget *frame = NULL;
+ frame = gtk_frame_new(NULL);
+ gtk_container_add(GTK_CONTAINER(frame), pm);
+ gtk_table_attach(GTK_TABLE(resp->table), frame,
+ 0, 1, 1, 2, GTK_SHRINK, GTK_SHRINK, 2, 2);
+ resp->left = 1;
+ }
+ }
+
+ resp->ok = gtk_button_new_with_label(_(UD_OK_TEXT));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(resp->ok)->child), 4, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), resp->ok, FALSE, FALSE, 0);
+
+ resp->cancel = gtk_button_new_with_label(_(UD_CANCEL_TEXT));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(resp->cancel)->child), 4, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), resp->cancel, FALSE, FALSE, 0);
+
+ gtk_signal_connect(GTK_OBJECT(resp->top), "delete_event",
+ (GtkSignalFunc) userhelper_fatal_error, NULL);
+ gtk_signal_connect(GTK_OBJECT(resp->cancel), "clicked",
+ (GtkSignalFunc) userhelper_fatal_error, NULL);
+
+ gtk_signal_connect(GTK_OBJECT(resp->ok), "clicked",
+ (GtkSignalFunc) userhelper_write_childin, resp);
+
+ gtk_object_set_user_data(GTK_OBJECT(resp->top), resp);
+ }
+
+ if(isdigit(outline[0])) {
+ gboolean echo = TRUE;
+ message *msg = g_malloc(sizeof(message));
+
+ prompt_type = strtol(outline, &prompt, 10);
+ if((prompt != NULL) && (strlen(prompt) > 0)) {
+ while((isspace(prompt[0]) && (prompt[0] != '\0') && (prompt[0] != '\n'))){
+ prompt++;
+ }
+ }
+
+ /* snip off terminating newlines in the prompt string and save a pointer to
+ * interate the parser along */
+ rest = strchr(prompt, '\n');
+ if(rest != NULL) {
+ *rest = '\0';
+ rest++;
+ if (rest[0] == '\0') {
+ rest = NULL;
+ }
+ }
+#ifdef DEBUG_USERHELPER
+ g_print("(%d) \"%s\"\n", prompt_type, prompt);
+#endif
+
+ msg->type = prompt_type;
+ msg->message = prompt;
+ msg->data = NULL;
+ msg->entry = NULL;
+
+ echo = TRUE;
+ switch(prompt_type) {
+ case UH_ECHO_OFF_PROMPT:
+ echo = FALSE;
+ /* fall through */
+ case UH_ECHO_ON_PROMPT:
+ msg->label = gtk_label_new(prompt);
+ gtk_label_set_line_wrap(GTK_LABEL(msg->label), FALSE);
+ gtk_misc_set_alignment(GTK_MISC(msg->label), 1.0, 1.0);
+
+ msg->entry = gtk_entry_new();
+ gtk_entry_set_visibility(GTK_ENTRY(msg->entry), echo);
+
+ if(resp->head == NULL) resp->head = msg->entry;
+ resp->tail = msg->entry;
+
+ gtk_table_attach(GTK_TABLE(resp->table), msg->label,
+ resp->left + 0, resp->left + 1, resp->rows, resp->rows + 1,
+ GTK_EXPAND | GTK_FILL, 0, 2, 2);
+ gtk_table_attach(GTK_TABLE(resp->table), msg->entry,
+ resp->left + 1, resp->left + 2, resp->rows, resp->rows + 1,
+ GTK_EXPAND | GTK_FILL, 0, 2, 2);
+
+ resp->message_list = g_slist_append(resp->message_list, msg);
+ resp->responses++;
+ resp->rows++;
+#ifdef DEBUG_USERHELPER
+ g_print(_("Need %d responses.\n"), resp->responses);
+#endif
+ break;
+
+ case UH_FALLBACK:
+#if 0
+ msg->label = gtk_label_new(prompt);
+ gtk_label_set_line_wrap(GTK_LABEL(msg->label), FALSE);
+ gtk_table_attach(GTK_TABLE(resp->table), msg->label,
+ resp->left + 0, resp->left + 2, resp->rows, resp->rows + 1,
+ 0, 0, 2, 2);
+ resp->message_list = g_slist_append(resp->message_list, msg);
+#else
+ resp->fallback = atoi(prompt) != 0;
+#endif
+ break;
+
+ case UH_USER:
+ if(strstr(prompt, "<user>") == NULL) {
+ g_free(resp->user);
+ resp->user = g_strdup(prompt);
+ }
+ break;
+
+ case UH_SERVICE_NAME:
+ title = g_strdup_printf(_("In order to run \"%s\" with root's "
+ "privileges, additional information is "
+ "required."),
+ prompt);
+ msg->label = gtk_label_new(title);
+ gtk_label_set_line_wrap(GTK_LABEL(msg->label), FALSE);
+ gtk_table_attach(GTK_TABLE(resp->table), msg->label,
+ 0, resp->left + 2, 0, 1,
+ GTK_EXPAND | GTK_FILL, 0, 2, 2);
+ resp->message_list = g_slist_append(resp->message_list, msg);
+ break;
+
+ case UH_ERROR_MSG:
+ gtk_window_set_title(GTK_WINDOW(resp->top), _("Error"));
+ /* fall through */
+ case UH_INFO_MSG:
+ msg->label = gtk_label_new(prompt);
+ gtk_label_set_line_wrap(GTK_LABEL(msg->label), FALSE);
+ gtk_table_attach(GTK_TABLE(resp->table), msg->label,
+ resp->left + 0, resp->left + 2, resp->rows, resp->rows + 1, 0, 0, 2, 2);
+ resp->message_list = g_slist_append(resp->message_list, msg);
+ resp->rows++;
+ break;
+
+ case UH_EXPECT_RESP:
+ g_free(msg); /* useless */
+ if (resp->responses != atoi(prompt)) {
+ g_print(_("You want %d response(s) from %d entry fields!?!?!\n"),
+ atoi(prompt), resp->responses);
+ exit (1);
+ }
+
+ if (resp->fallback) {
+ gpointer a = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(resp->top),
+ UH_ACTION_AREA));
+ GtkWidget *hbox = GTK_WIDGET(a);
+ resp->unprivileged = gtk_button_new_with_label(_(UD_FALLBACK_TEXT));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(resp->unprivileged)->child),
+ 4, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), resp->unprivileged,
+ FALSE, FALSE, 0);
+ if(resp->unprivileged != NULL) {
+ gtk_signal_connect(GTK_OBJECT(resp->unprivileged), "clicked",
+ GTK_SIGNAL_FUNC(userhelper_write_childin), resp);
+ }
+ }
+
+ gtk_widget_show_all(resp->top);
+ if(GTK_IS_ENTRY(resp->head)) {
+ gtk_widget_grab_focus(resp->head);
+ }
+ if(GTK_IS_ENTRY(resp->tail)) {
+ gtk_signal_connect_object(GTK_OBJECT(resp->tail), "activate",
+ gtk_button_clicked, GTK_OBJECT(resp->ok));
+ }
+ break;
+ default:
+ /* ignore, I guess... */
+ break;
+ }
+ }
+
+ if(rest != NULL) userhelper_parse_childout(rest);
+}
+
+void
+userhelper_read_childout(gpointer data, int source, GdkInputCondition cond)
+{
+ char* output;
+ int count;
+
+ if(cond != GDK_INPUT_READ)
+ {
+ /* Serious error, this is. Panic. */
+ exit (1);
+ }
+
+ output = g_malloc(MAXLINE + 1);
+
+ count = read(source, output, MAXLINE);
+ if (count == -1)
+ {
+ exit (0);
+ }
+ if (count == 0)
+ {
+ gdk_input_remove(childout_tag);
+ childout_tag = -1;
+ }
+ output[count] = '\0';
+
+ userhelper_parse_childout(output);
+ g_free(output);
+}
+
+void
+userhelper_write_childin(GtkWidget *widget, response *resp)
+{
+ char* input;
+ int len;
+ guchar byte;
+ GSList *message_list = resp->message_list;
+
+ if(widget == resp->unprivileged) {
+ byte = UH_ABORT;
+ for (message_list = resp->message_list;
+ (message_list != NULL) && (message_list->data != NULL);
+ message_list = g_slist_next(message_list)) {
+ message *m = (message*)message_list->data;
+#ifdef DEBUG_USERHELPER
+ fprintf(stderr, "message %d, \"%s\"\n", m->type, m->message);
+#endif
+ if(GTK_IS_ENTRY(m->entry)) {
+ write(childin[1], &byte, 1);
+ write(childin[1], "\n", 1);
+ }
+ }
+ }
+ if(widget == resp->ok) {
+ byte = UH_TEXT;
+ for (message_list = resp->message_list;
+ (message_list != NULL) && (message_list->data != NULL);
+ message_list = g_slist_next(message_list)) {
+ message *m = (message*)message_list->data;
+#ifdef DEBUG_USERHELPER
+ fprintf(stderr, "message %d, \"%s\"\n", m->type, m->message);
+#endif
+ if(GTK_IS_ENTRY(m->entry)) {
+ input = gtk_entry_get_text(GTK_ENTRY(m->entry));
+ len = strlen(input);
+ write(childin[1], &byte, 1);
+ write(childin[1], input, len);
+ write(childin[1], "\n", 1);
+ }
+ }
+ }
+ gtk_widget_destroy(resp->top);
+}
+
+void
+userhelper_sigchld()
+{
+ pid_t pid;
+ int status;
+
+ signal(SIGCHLD, userhelper_sigchld);
+
+ pid = waitpid(0, &status, WNOHANG);
+
+ if(WIFEXITED(status))
+ {
+ userhelper_parse_exitstatus(WEXITSTATUS(status));
+ }
+}
diff --git a/root-manager/root-manager-wrap.h b/root-manager/root-manager-wrap.h
new file mode 100644
index 000000000..8dca81847
--- /dev/null
+++ b/root-manager/root-manager-wrap.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 1997-1999 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __USERHELPER_WRAP_H__
+#define __USERHELPER_WRAP_H__
+
+/* lots 'o includes. */
+#include "userdialogs.h"
+#include <signal.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+
+#include "root-manager.h"
+#define UH_ACTION_AREA "userhelper-action-area"
+
+typedef struct message {
+ int type;
+ char *message;
+ char *data;
+ GtkWidget *entry;
+ GtkWidget *label;
+} message;
+
+typedef struct response {
+ int responses;
+ int left;
+ int rows;
+ gboolean fallback;
+ char *user;
+ GSList *message_list; /* contains pointers to messages */
+ GtkWidget *head;
+ GtkWidget *tail;
+ GtkWidget *top;
+ GtkWidget *table;
+ GtkWidget *ok;
+ GtkWidget *cancel;
+ GtkWidget *unprivileged;
+} response;
+
+void userhelper_run(char *path, ...);
+void userhelper_runv(char *path, int new_fd);
+void userhelper_parse_exitstatus(int exitstatus);
+void userhelper_parse_childout();
+void userhelper_read_childout(gpointer data, int source, GdkInputCondition cond);
+void userhelper_write_childin(GtkWidget* widget, response *resp);
+
+void userhelper_sigchld(); /* sigchld handler */
+
+void userhelper_fatal_error(int ignored);
+
+#endif /* __USERHELPER_WRAP_H__ */
diff --git a/root-manager/root-manager.c b/root-manager/root-manager.c
new file mode 100644
index 000000000..9d4cdf17f
--- /dev/null
+++ b/root-manager/root-manager.c
@@ -0,0 +1,713 @@
+/* -*-Mode: c-*- */
+/* Copyright (C) 1997 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * UserTool suid helper program
+ */
+
+#if 0
+#define USE_MCHECK 1
+#endif
+
+#define DEBUG_USERHELPER 1
+#define ROOT_MANAGER 1
+
+#include "config.h"
+
+#include <assert.h>
+#include <errno.h>
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifdef USE_MCHECK
+#include <mcheck.h>
+#endif
+
+#include <locale.h>
+#include <libintl.h>
+#include <unistd.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include <security/pam_appl.h>
+#include <security/pam_misc.h>
+
+#include "root-manager.h"
+#include "shvar.h"
+
+/* Total GECOS field length... is this enough ? */
+#define GECOS_LENGTH 80
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+/* ------ some static data objects ------- */
+
+static char *full_name = NULL; /* full user name */
+static char *office = NULL; /* office */
+static char *office_ph = NULL; /* office phone */
+static char *home_ph = NULL; /* home phone */
+static char *user_name = NULL; /* the account name */
+static char *shell_path = NULL; /* shell path */
+
+static char *the_username = NULL; /* used to mangle the conversation function */
+
+/* manipulate the environment directly */
+extern char **environ;
+
+/* command line flags */
+static int f_flg = 0; /* -f flag = change full name */
+static int o_flg = 0; /* -o flag = change office name */
+static int p_flg = 0; /* -p flag = change office phone */
+static int h_flg = 0; /* -h flag = change home phone number */
+static int c_flg = 0; /* -c flag = change password */
+static int s_flg = 0; /* -s flag = change shell */
+static int t_flg = 0; /* -t flag = direct text-mode -- exec'ed */
+static int w_flg = 0; /* -w flag = act as a wrapper for next args */
+static int d_flg = 0; /* -d flag = three descriptor numbers for us */
+
+/*
+ * A handy fail exit function we can call from many places
+ */
+static int fail_error(int retval)
+{
+ /* this is a temporary kludge.. will be fixed shortly. */
+ if(retval == ERR_SHELL_INVALID)
+ exit(ERR_SHELL_INVALID);
+
+ if (retval != PAM_SUCCESS) {
+#ifdef DEBUG_USERHELPER
+ g_print(_("Got error %d.\n"), retval);
+#endif
+ switch(retval) {
+ case PAM_AUTH_ERR:
+ case PAM_PERM_DENIED:
+ exit (ERR_PASSWD_INVALID);
+ case PAM_AUTHTOK_LOCK_BUSY:
+ exit (ERR_LOCKS);
+ case PAM_CRED_INSUFFICIENT:
+ case PAM_AUTHINFO_UNAVAIL:
+ exit (ERR_NO_RIGHTS);
+ case PAM_ABORT:
+ default:
+ exit(ERR_UNK_ERROR);
+ }
+ }
+ exit (0);
+}
+
+/*
+ * Read a string from stdin, returns a malloced copy of it
+ */
+static char *read_string(void)
+{
+ char *buffer = NULL;
+ char *check = NULL;
+ int slen = 0;
+
+ buffer = g_malloc(BUFSIZ);
+ if (buffer == NULL)
+ return NULL;
+
+ check = fgets(buffer, BUFSIZ, stdin);
+ if (!check)
+ return NULL;
+ slen = strlen(buffer);
+ if((slen > 0) && ((buffer[slen - 1] == '\n') || isspace(buffer[slen - 1]))){
+ buffer[slen-1] = '\0';
+ }
+ if(buffer[0] == UH_TEXT) {
+ memmove(buffer, buffer + 1, BUFSIZ - 1);
+ }
+ return buffer;
+}
+
+/* Application data with some hints. */
+static struct app_data_t {
+ int fallback;
+ char *user;
+ char *service;
+} app_data = {0, NULL, NULL};
+static gboolean fallback_flag = FALSE;
+
+/*
+ * Conversation function for the boring change password stuff
+ */
+static int conv_func(int num_msg, const struct pam_message **msg,
+ struct pam_response **resp, void *appdata_ptr)
+{
+ int count = 0;
+ int responses = 0;
+ struct pam_response *reply = NULL;
+ char *noecho_message;
+
+ reply = (struct pam_response *)
+ calloc(num_msg, sizeof(struct pam_response));
+ if (reply == NULL)
+ return PAM_CONV_ERR;
+
+ if(appdata_ptr != NULL) {
+ struct app_data_t *app_data = (struct app_data_t*) appdata_ptr;
+
+ g_print("%d %d\n", UH_FALLBACK, app_data->fallback);
+ if(app_data->user == NULL) {
+ g_print("%d %s\n", UH_USER, "root");
+ } else {
+ g_print("%d %s\n", UH_USER, app_data->user);
+ }
+ if(app_data->service != NULL) {
+ g_print("%d %s\n", UH_SERVICE_NAME, app_data->service);
+ }
+ }
+
+ /*
+ * We do first a pass on all items and output them;
+ * then we do a second pass and read what we have to read
+ * from stdin
+ */
+ for (count = responses = 0; count < num_msg; count++) {
+ switch (msg[count]->msg_style) {
+ case PAM_PROMPT_ECHO_ON:
+ g_print("%d %s\n", UH_ECHO_ON_PROMPT, msg[count]->msg);
+ responses++;
+ break;
+ case PAM_PROMPT_ECHO_OFF:
+ if (the_username && !strncasecmp(msg[count]->msg, "password", 8)) {
+ noecho_message = g_strdup_printf(_("Password for %s"),
+ the_username);
+ } else {
+ noecho_message = g_strdup(msg[count]->msg);
+ }
+ g_print("%d %s\n", UH_ECHO_OFF_PROMPT, noecho_message);
+ g_free(noecho_message);
+ responses++;
+ break;
+ case PAM_TEXT_INFO:
+ g_print("%d %s\n", UH_INFO_MSG, msg[count]->msg);
+ break;
+ case PAM_ERROR_MSG:
+ g_print("%d %s\n", UH_ERROR_MSG, msg[count]->msg);
+ break;
+ default:
+ g_print("0 %s\n", msg[count]->msg);
+ }
+ }
+
+ /* tell the other side how many messages we expect responses for */
+ g_print("%d %d\n", UH_EXPECT_RESP, responses);
+ fflush(NULL);
+
+ /* now the second pass */
+ for (count = 0; count < num_msg; count++) {
+ switch (msg[count]->msg_style) {
+ case PAM_TEXT_INFO:
+ /* ignore it... */
+ break;
+ case PAM_ERROR_MSG:
+ /* also ignore it... */
+ break;
+ case PAM_PROMPT_ECHO_ON:
+ /* fall through */
+ case PAM_PROMPT_ECHO_OFF:
+ reply[count].resp_retcode = PAM_SUCCESS;
+ reply[count].resp = read_string();
+ if((reply[count].resp != NULL) &&
+ (reply[count].resp[0] == UH_ABORT)) {
+ fallback_flag = TRUE;
+ free (reply);
+ return PAM_MAXTRIES; /* Shrug. */
+ }
+ break;
+ default:
+ /* Must be an error of some sort... */
+ free (reply);
+ return PAM_CONV_ERR;
+ }
+ }
+ if (reply)
+ *resp = reply;
+ return PAM_SUCCESS;
+}
+
+/*
+ * the structure pointing at the conversation function for
+ * auth and changing the password
+ */
+static struct pam_conv pipe_conv = {
+ conv_func,
+ &app_data,
+};
+static struct pam_conv text_conv = {
+ misc_conv,
+ &app_data,
+};
+
+/*
+ * A function to process already existing gecos information
+ */
+static void process_gecos(char *gecos)
+{
+ char *idx;
+
+ if (gecos == NULL)
+ return;
+
+ if (!full_name)
+ full_name = gecos;
+ idx = strchr(gecos, ',');
+ if (idx != NULL) {
+ *idx = '\0';
+ gecos = idx+1;
+ }
+ if ((idx == NULL) || (*gecos == '\0')) {
+ /* no more fields */
+ return;
+ }
+
+ if (!office)
+ office = gecos;
+ idx = strchr(gecos, ',');
+ if (idx != NULL) {
+ *idx = '\0';
+ gecos = idx+1;
+ }
+
+ if (!office_ph)
+ office_ph = gecos;
+ idx = strchr(gecos, ',');
+ if (idx != NULL) {
+ *idx = '\0';
+ gecos = idx+1;
+ }
+ if ((idx == NULL) || (*gecos == '\0')) {
+ /* no more fields */
+ return;
+ }
+
+ if (!home_ph)
+ home_ph = gecos;
+ idx = strchr(gecos, ',');
+ if (idx != NULL) {
+ *idx = '\0';
+ }
+}
+
+/*
+ * invalid_field - insure that a field contains all legal characters
+ *
+ * The supplied field is scanned for non-printing and other illegal
+ * characters. If any illegal characters are found, invalid_field
+ * returns -1. Zero is returned for success.
+ */
+
+int invalid_field(const char *field, const char *illegal)
+{
+ const char *cp;
+
+ for (cp = field; *cp && isprint (*cp) && ! strchr (illegal, *cp); cp++)
+ ;
+ if (*cp)
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * A simple function to compute the gecos field size
+ */
+static int gecos_size(void)
+{
+ int len = 0;
+
+ if (full_name != NULL)
+ len += strlen(full_name);
+ if (office != NULL)
+ len += strlen(office);
+ if (office_ph != NULL)
+ len += strlen(office_ph);
+ if (home_ph != NULL)
+ len += strlen(home_ph);
+ return len;
+}
+
+/* Snagged straight from the util-linux source... May want to clean up
+ * a bit and possibly merge with the code in userinfo that parses to
+ * get a list. -Otto
+ *
+ * get_shell_list () -- if the given shell appears in the list of valid shells,
+ * return true. if not, return false.
+ * if the given shell is NULL, the list of shells is outputted to stdout.
+ */
+static int get_shell_list(char* shell_name)
+{
+ gboolean found;
+ char *shell;
+
+ found = FALSE;
+ setusershell();
+ for(shell = getusershell(); shell != NULL; shell = getusershell()) {
+#ifdef DEBUG_USERHELPER
+ fprintf(stderr, "got shell \"%s\"\n", shell);
+#endif
+ if (shell_name) {
+ if (! strcmp (shell_name, shell)) {
+ found = TRUE;
+ break;
+ }
+ }
+ else g_print("%s\n", shell);
+ }
+ endusershell();
+ return found;
+}
+
+#ifdef USE_MCHECK
+void
+mcheck_out(enum mcheck_status reason) {
+ char *explanation;
+
+ switch (reason) {
+ case MCHECK_DISABLED:
+ explanation = _("Consistency checking is not turned on."); break;
+ case MCHECK_OK:
+ explanation = _("Block is fine."); break;
+ case MCHECK_FREE:
+ explanation = _("Block freed twice."); break;
+ case MCHECK_HEAD:
+ explanation = _("Memory before the block was clobbered."); break;
+ case MCHECK_TAIL:
+ explanation = _("Memory after the block was clobbered."); break;
+ }
+ g_print("%d %s\n", UH_ERROR_MSG, explanation);
+ g_print("%d 1\n", UH_EXPECT_RESP);
+}
+#endif
+
+/* ------- the application itself -------- */
+int main(int argc, char *argv[])
+{
+ int arg;
+ int retval;
+ char *progname = NULL;
+ pam_handle_t *pamh = NULL;
+ struct passwd *pw;
+ struct pam_conv *conv;
+ int stdin_fileno = -1, stdout_fileno = -1, stderr_fileno = -1;
+ int fd;
+ FILE *fp;
+
+#ifdef USE_MCHECK
+ mtrace();
+ mcheck(mcheck_out);
+#endif
+
+ /* first set up our locale info for gettext. */
+ setlocale(LC_ALL, "");
+ bindtextdomain (PACKAGE, GNOMELOCALEDIR);
+ textdomain (PACKAGE);
+
+ if (geteuid() != 0) {
+ fprintf(stderr, _("userhelper must be setuid root\n"));
+ exit(ERR_NO_RIGHTS);
+ }
+
+ if (argc < 2)
+ g_error ("Usage: root-helper fd");
+
+ fd = atoi (argv[1]);
+ if (fd <= STDERR_FILENO)
+ g_error ("Usage: root-helper fd");
+
+#ifdef DEBUG_USERHELPER
+ fprintf (stderr, "fd is %d\n", fd);
+#endif
+ fp = fdopen (fd, "r");
+
+ conv = &pipe_conv;
+
+ /* now try to identify the username we are doing all this work for */
+ user_name = getlogin();
+ if (user_name == NULL) {
+ struct passwd *tmp;
+
+ tmp = getpwuid(getuid());
+ if ((tmp != NULL) && (tmp->pw_name != NULL)) {
+ user_name = g_strdup(tmp->pw_name);
+ } else {
+ /* weirdo, bail out */
+ exit (ERR_UNK_ERROR);
+ }
+ }
+#ifdef DEBUG_USERHELPER
+ fprintf(stderr, "user is %s\n", user_name);
+#endif
+
+ {
+ /* pick the first existing of /usr/sbin/<progname> and /sbin/<progname>
+ * authenticate <progname>
+ * argv[optind-1] = <progname> (boondoggle unless -- used)
+ * (we know there is at least one open slot in argv for this)
+ * execv(constructed_path, argv+optind);
+ */
+ char *constructed_path;
+ char *apps_filename;
+ char *user, *apps_user;
+ char *retry;
+ char *env_home, *env_term, *env_display, *env_shell;
+ char *env_user, *env_logname, *env_lang, *env_lcall, *env_lcmsgs;
+ char *env_xauthority;
+ int session, fallback, try;
+ size_t aft;
+ struct stat sbuf;
+ shvarFile *s;
+
+ env_home = getenv("HOME");
+ env_term = getenv("TERM");
+ env_display = getenv("DISPLAY");
+ env_shell = getenv("SHELL");
+ env_user = getenv("USER");
+ env_logname = getenv("LOGNAME");
+ env_lang = getenv("LANG");
+ env_lcall = getenv("LC_ALL");
+ env_lcmsgs = getenv("LC_MESSAGES");
+ env_xauthority = getenv("XAUTHORITY");
+
+ if (env_home && (strstr(env_home, "..") || strchr(env_home, '%')))
+ env_home=NULL;
+ if (env_shell && (strstr(env_shell, "..") || strchr(env_shell, '%')))
+ env_shell=NULL;
+ if (env_term && (strstr(env_term, "..") || strchr(env_term, '%')))
+ env_term="dumb";
+ if (env_lang && (strchr(env_lang, '/') || strchr(env_lang, '%')))
+ env_lang=NULL;
+ if (env_lcall && (strchr(env_lcall, '/') || strchr(env_lcall, '%')))
+ env_lcall=NULL;
+ if (env_lcmsgs && (strchr(env_lcmsgs, '/') || strchr(env_lcmsgs, '%')))
+ env_lcmsgs=NULL;
+
+ environ = (char **) calloc (1, 2 * sizeof (char *));
+ /* note that XAUTHORITY not copied -- do not let attackers get at
+ * others' X authority records
+ */
+ if (env_home) setenv("HOME", env_home, 1);
+ if (env_term) setenv("TERM", env_term, 1);
+ if (env_display) setenv("DISPLAY", env_display, 1);
+ if (env_shell) setenv("SHELL", env_shell, 1);
+ if (env_user) setenv("USER", env_user, 1);
+ if (env_logname) setenv("LOGNAME", env_logname, 1);
+ /* we want _, but only if it is safe */
+ if (env_lang) setenv("LANG", env_lang, 1);
+ if (env_lcall) setenv("LC_ALL", env_lcall, 1);
+ if (env_lcmsgs) setenv("LC_MESSAGES", env_lcmsgs, 1);
+
+ setenv("PATH",
+ "/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/root/bin", 1);
+
+ progname = "root-manager";
+ user = "root";
+ constructed_path = "cat";
+
+ retval = pam_start(progname, user, conv, &pamh);
+ if (retval != PAM_SUCCESS)
+ fail_error(retval);
+
+ session = TRUE;
+ app_data.fallback = fallback = FALSE;
+ app_data.user = user;
+ app_data.service = progname;
+
+ do {
+#ifdef DEBUG_USERHELPER
+ fprintf(stderr, _("PAM returned = %d\n"), retval);
+ fprintf(stderr, _("about to authenticate \"%s\"\n"), user);
+#endif
+ retval = pam_authenticate(pamh, 0);
+ } while (--try && retval != PAM_SUCCESS && !fallback_flag);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ if (fallback) {
+ g_assert_not_reached ();
+ setuid(getuid());
+ if(geteuid() != getuid()) {
+ exit (ERR_EXEC_FAILED);
+ }
+ argv[optind-1] = progname;
+ if(d_flg) {
+ dup2(stdin_fileno, STDIN_FILENO);
+ dup2(stdout_fileno, STDOUT_FILENO);
+ dup2(stderr_fileno, STDERR_FILENO);
+ }
+ execv(constructed_path, argv+optind-1);
+ exit (ERR_EXEC_FAILED);
+ } else {
+ fail_error(retval);
+ }
+ }
+
+ retval = pam_acct_mgmt(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ fail_error(retval);
+ }
+
+ /* reset the XAUTHORITY so that X stuff will work now */
+ if (env_xauthority) setenv("XAUTHORITY", env_xauthority, 1);
+
+ if (session) {
+ int child, status;
+
+ retval = pam_open_session(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ fail_error(retval);
+ }
+
+ if ((child = fork()) == 0) {
+ struct passwd *pw;
+ setuid(0);
+ pw = getpwuid(getuid());
+ if (pw) setenv("HOME", pw->pw_dir, 1);
+
+#define BUFSIZE 1024
+ {
+ char buf[BUFSIZE];
+#ifdef DEBUG_USERHELPER
+ fprintf (stderr, "looping for input\n");
+#endif
+
+ while (fgets (buf, BUFSIZE, fp)) {
+ if (!fork ()) {
+ char **args;
+ buf[strlen (buf) - 1] = '\0';
+ args = g_strsplit (buf, " ", -1);
+#ifdef DEBUG_USERHELPER
+ fprintf (stderr, "running: %s\n", args[0]);
+#endif
+
+ setenv("PATH",
+ "/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/root/bin", 1);
+
+ execv (args[0], args);
+ g_error ("s", g_strerror (errno));
+ }
+ }
+ }
+
+ argv[optind-1] = progname;
+#ifdef DEBUG_USERHELPER
+ g_print(_("about to exec \"%s\"\n"), constructed_path);
+#endif
+ if(d_flg) {
+ dup2(stdin_fileno, STDIN_FILENO);
+ dup2(stdout_fileno, STDOUT_FILENO);
+ dup2(stderr_fileno, STDERR_FILENO);
+ }
+ execv(constructed_path, argv+optind-1);
+ exit (ERR_EXEC_FAILED);
+ }
+
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+
+ wait4 (child, &status, 0, NULL);
+
+ retval = pam_close_session(pamh, 0);
+ if (retval != PAM_SUCCESS) {
+ pam_end(pamh, retval);
+ fail_error(retval);
+ }
+
+ if (WIFEXITED(status) && (WEXITSTATUS(status) == 0)) {
+ pam_end(pamh, PAM_SUCCESS);
+ retval = 1;
+ } else {
+ pam_end(pamh, PAM_SUCCESS);
+ retval = ERR_EXEC_FAILED;
+ }
+ exit (retval);
+
+ } else {
+ /* this is not a session, so do not do session management */
+
+ pam_end(pamh, PAM_SUCCESS);
+
+
+#define BUFSIZE 1024
+ {
+ char buf[BUFSIZE];
+#ifdef DEBUG_USERHELPER
+ fprintf (stderr, "looping for input\n");
+#endif
+
+ while (fgets (buf, BUFSIZE, fp)) {
+ if (!fork ()) {
+ char **args;
+ buf[strlen (buf) - 1] = '\0';
+ args = g_strsplit (buf, " ", -1);
+#ifdef DEBUG_USERHELPER
+ fprintf (stderr, "running: %s\n", args[0]);
+#endif
+
+ setenv("PATH",
+ "/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/root/bin", 1);
+
+ execv (args[0], args);
+ g_error ("s", g_strerror (errno));
+ }
+ }
+ }
+
+
+ /* time for an exec */
+ setuid(0);
+ argv[optind-1] = progname;
+#ifdef DEBUG_USERHELPER
+ g_print(_("about to exec \"%s\"\n"), constructed_path);
+#endif
+ if(d_flg) {
+ dup2(stdin_fileno, STDIN_FILENO);
+ dup2(stdout_fileno, STDOUT_FILENO);
+ dup2(stderr_fileno, STDERR_FILENO);
+ }
+ execv(constructed_path, argv+optind-1);
+
+ exit (ERR_EXEC_FAILED);
+ }
+
+ }
+
+ /* all done */
+ if (pamh != NULL)
+ retval = pam_end(pamh, PAM_SUCCESS);
+ if (retval != PAM_SUCCESS)
+ fail_error(retval);
+ exit (0);
+}
diff --git a/root-manager/root-manager.h b/root-manager/root-manager.h
new file mode 100644
index 000000000..dd4fde4e9
--- /dev/null
+++ b/root-manager/root-manager.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 1997-1999 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __USERHELPER_H__
+#define __USERHELPER_H__
+
+#define _(String) gettext(String)
+
+#define UH_ECHO_ON_PROMPT 1
+#define UH_ECHO_OFF_PROMPT 2
+#define UH_INFO_MSG 3
+#define UH_ERROR_MSG 4
+#define UH_EXPECT_RESP 5
+#define UH_SERVICE_NAME 6
+#define UH_FALLBACK 7
+#define UH_USER 8
+
+#define UH_TEXT 1
+#define UH_ABORT 2
+
+#define ERR_PASSWD_INVALID 1 /* password is not right */
+#define ERR_FIELDS_INVALID 2 /* gecos fields invalid or
+ * sum(lengths) too big */
+#define ERR_SET_PASSWORD 3 /* password resetting error */
+#define ERR_LOCKS 4 /* some files are locked */
+#define ERR_NO_USER 5 /* user unknown ... */
+#define ERR_NO_RIGHTS 6 /* insufficient rights */
+#define ERR_INVALID_CALL 7 /* invalid call to this program */
+#define ERR_SHELL_INVALID 8 /* invalid call to this program */
+#define ERR_NO_MEMORY 9 /* out of memory */
+#define ERR_NO_PROGRAM 10 /* -w progname not found */
+#define ERR_EXEC_FAILED 11 /* exec failed for some reason */
+#define ERR_UNK_ERROR 255 /* unknown error */
+
+#define UH_PATH "/gnome/sbin/root-manager"
+#define UH_KEY_PIXMAP_PATH "/usr/share/pixmaps/userhelper-keys.xpm"
+/*#define UH_PATH "./root-manager"*/
+
+#endif /* __USERHELPER_H__ */
diff --git a/root-manager/shvar.c b/root-manager/shvar.c
new file mode 100644
index 000000000..29424c4a2
--- /dev/null
+++ b/root-manager/shvar.c
@@ -0,0 +1,377 @@
+/* copied from rp3 -- DO NOT EDIT HERE, ONLY COPY FROM rp3 */
+/*
+ * shvar.c
+ *
+ * Implementation of non-destructively reading/writing files containing
+ * only shell variable declarations and full-line comments.
+ *
+ * Includes explicit inheritance mechanism intended for use with
+ * Red Hat Linux ifcfg-* files. There is no protection against
+ * inheritance loops; they will generally cause stack overflows.
+ * Furthermore, they are only intended for one level of inheritance;
+ * the value setting algorithm assumes this.
+ *
+ * Copyright 1999 Red Hat, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <assert.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "shvar.h"
+
+/* Open the file <name>, return shvarFile on success, NULL on failure */
+shvarFile *
+svNewFile(char *name)
+{
+ shvarFile *s = NULL;
+ int closefd = 0;
+
+ s = calloc(sizeof(shvarFile), 1);
+ if (!s) return NULL;
+
+ s->fd = open(name, O_RDWR); /* NOT O_CREAT */
+ if (s->fd == -1) {
+ /* try read-only */
+ s->fd = open(name, O_RDONLY); /* NOT O_CREAT */
+ if (s->fd) closefd = 1;
+ }
+ s->fileName = strdup(name);
+
+ if (s->fd != -1) {
+ struct stat buf;
+ char *tmp;
+
+ if (fstat(s->fd, &buf) < 0) goto bail;
+ s->arena = calloc(buf.st_size, 1);
+ if (!s->arena) goto bail;
+ if (read(s->fd, s->arena, buf.st_size) < 0) goto bail;
+ /* Yes, I know that strtok is evil, except that this is
+ * precisely what it was intended for in the first place...
+ */
+ tmp = strtok(s->arena, "\n");
+ while (tmp) {
+ s->lineList = g_list_append(s->lineList, tmp);
+ tmp = strtok(NULL, "\n");
+ }
+ if (closefd) {
+ close(s->fd);
+ s->fd = -1;
+ }
+ }
+
+ return s;
+
+bail:
+ if (s->fd != -1) close(s->fd);
+ if (s->arena) free (s->arena);
+ if (s->fileName) free (s->fileName);
+ free (s);
+ return NULL;
+}
+
+/* remove escaped characters in place */
+static void
+unescape(char *s) {
+ int len, i;
+
+ len = strlen(s);
+ if ((s[0] == '"' || s[0] == '\'') && s[0] == s[len-1]) {
+ i = len - 2;
+ memmove(s, s+1, i);
+ s[i+1] = '\0';
+ len = i;
+ }
+ for (i = 0; i < len; i++) {
+ if (s[i] == '\\') {
+ memmove(s+i, s+i+1, len-(i+1));
+ len--;
+ }
+ s[len] = '\0';
+ }
+}
+
+
+/* create a new string with all necessary characters escaped.
+ * caller must free returned string
+ */
+static const char escapees[] = "\"'\\$~`"; /* must be escaped */
+static const char spaces[] = " \t"; /* only require "" */
+static char *
+escape(char *s) {
+ char *new;
+ int i, j, mangle = 0, space = 0;
+ int newlen, slen;
+ static int esclen, splen;
+
+ if (!esclen) esclen = strlen(escapees);
+ if (!splen) splen = strlen(spaces);
+ for (i = 0; i < esclen; i++) {
+ if (strchr(s, escapees[i])) mangle++;
+ }
+ for (i = 0; i < splen; i++) {
+ if (strchr(s, spaces[i])) space++;
+ }
+ if (!mangle && !space) return strdup(s);
+
+ slen = strlen(s);
+ newlen = slen + mangle + 3; /* 3 is extra ""\0 */
+ new = calloc(newlen, 1);
+ if (!new) return NULL;
+
+ new[0] = '"';
+ for (i = 0, j = 1; i < slen; i++, j++) {
+ if (strchr(escapees, s[i])) {
+ new[j++] = '\\';
+ }
+ new[j] = s[i];
+ }
+ new[j] = '"';
+
+ return new;
+}
+
+/* Get the value associated with the key, and leave the current pointer
+ * pointing at the line containing the value. The char* returned MUST
+ * be freed by the caller.
+ */
+char *
+svGetValue(shvarFile *s, char *key)
+{
+ char *value = NULL;
+ char *line;
+ char *keyString;
+ int len;
+
+ assert(s);
+ assert(key);
+
+ keyString = calloc (strlen(key) + 2, 1);
+ if (!keyString) return NULL;
+ strcpy(keyString, key);
+ keyString[strlen(key)] = '=';
+ len = strlen(keyString);
+
+ for (s->current = s->lineList; s->current; s->current = s->current->next) {
+ line = s->current->data;
+ if (!strncmp(keyString, line, len)) {
+ value = strdup(line + len);
+ unescape(value);
+ break;
+ }
+ }
+ free(keyString);
+
+ if (value) {
+ if (value[0]) {
+ return value;
+ } else {
+ free (value);
+ return NULL;
+ }
+ }
+ if (s->parent) value = svGetValue(s->parent, key);
+ return value;
+}
+
+/* return 1 if <key> resolves to any truth value (e.g. "yes", "y", "true")
+ * return 0 if <key> resolves to any non-truth value (e.g. "no", "n", "false")
+ * return <default> otherwise
+ */
+int
+svTrueValue(shvarFile *s, char *key, int def)
+{
+ char *tmp;
+ int returnValue = def;
+
+ tmp = svGetValue(s, key);
+ if (!tmp) return returnValue;
+
+ if ( (!strcasecmp("yes", tmp)) ||
+ (!strcasecmp("true", tmp)) ||
+ (!strcasecmp("t", tmp)) ||
+ (!strcasecmp("y", tmp)) ) returnValue = 1;
+ else
+ if ( (!strcasecmp("no", tmp)) ||
+ (!strcasecmp("false", tmp)) ||
+ (!strcasecmp("f", tmp)) ||
+ (!strcasecmp("n", tmp)) ) returnValue = 0;
+
+ free (tmp);
+ return returnValue;
+}
+
+
+/* Set the variable <key> equal to the value <value>.
+ * If <key> does not exist, and the <current> pointer is set, append
+ * the key=value pair after that line. Otherwise, prepend the pair
+ * to the top of the file. Here's the algorithm, as the C code
+ * seems to be rather dense:
+ *
+ * if (value == NULL), then:
+ * if val2 (parent): change line to key= or append line key=
+ * if val1 (this) : delete line
+ * else noop
+ * else use this table:
+ * val2
+ * NULL value other
+ * v NULL append line noop append line
+ * a
+ * l value noop noop noop
+ * 1
+ * other change line delete line change line
+ *
+ * No changes are ever made to the parent config file, only to the
+ * specific file passed on the command line.
+ *
+ */
+void
+svSetValue(shvarFile *s, char *key, char *value)
+{
+ char *val1 = NULL, *val2 = NULL;
+ char *keyValue;
+
+ assert(s);
+ assert(key);
+ /* value may be NULL */
+
+ if (value) value = escape(value);
+ keyValue = g_malloc (strlen(key) + (value?strlen(value):0) + 2);
+ if (!keyValue) return;
+ sprintf(keyValue, "%s=%s", key, value?value:"");
+
+ val1 = svGetValue(s, key);
+ if (val1 && value && !strcmp(val1, value)) goto bail;
+ if (s->parent) val2 = svGetValue(s->parent, key);
+
+ if (!value) {
+ /* delete value somehow */
+ if (val2) {
+ /* change/append line to get key= */
+ if (s->current) s->current->data = keyValue;
+ else s->lineList = g_list_append(s->lineList, keyValue);
+ s->freeList = g_list_append(s->freeList, keyValue);
+ s->modified = 1;
+ } else if (val1) {
+ /* delete line */
+ s->lineList = g_list_remove_link(s->lineList, s->current);
+ g_list_free_1(s->current);
+ s->modified = 1;
+ goto bail; /* do not need keyValue */
+ }
+ goto end;
+ }
+
+ if (!val1) {
+ if (val2 && !strcmp(val2, value)) goto end;
+ /* append line */
+ s->lineList = g_list_append(s->lineList, keyValue);
+ s->freeList = g_list_append(s->freeList, keyValue);
+ s->modified = 1;
+ goto end;
+ }
+
+ /* deal with a whole line of noops */
+ if (val1 && !strcmp(val1, value)) goto end;
+
+ /* At this point, val1 && val1 != value */
+ if (val2 && !strcmp(val2, value)) {
+ /* delete line */
+ s->lineList = g_list_remove_link(s->lineList, s->current);
+ g_list_free_1(s->current);
+ s->modified = 1;
+ goto bail; /* do not need keyValue */
+ } else {
+ /* change line */
+ if (s->current) s->current->data = keyValue;
+ else s->lineList = g_list_append(s->lineList, keyValue);
+ s->freeList = g_list_append(s->freeList, keyValue);
+ s->modified = 1;
+ }
+
+end:
+ if (value) free(value);
+ if (val1) free(val1);
+ if (val2) free(val2);
+ return;
+
+bail:
+ if (keyValue) free (keyValue);
+ goto end;
+}
+
+/* Write the current contents iff modified. Returns -1 on error
+ * and 0 on success. Do not write if no values have been modified.
+ * The mode argument is only used if creating the file, not if
+ * re-writing an existing file, and is passed unchanged to the
+ * open() syscall.
+ */
+int
+svWriteFile(shvarFile *s, int mode)
+{
+ FILE *f;
+ int tmpfd;
+
+ if (s->modified) {
+ if (s->fd == -1)
+ s->fd = open(s->fileName, O_WRONLY|O_CREAT, mode);
+ if (s->fd == -1)
+ return -1;
+ if (ftruncate(s->fd, 0) < 0)
+ return -1;
+
+ tmpfd = dup(s->fd);
+ f = fdopen(tmpfd, "w");
+ fseek(f, 0, SEEK_SET);
+ for (s->current = s->lineList; s->current; s->current = s->current->next) {
+ char *line = s->current->data;
+ fprintf(f, "%s\n", line);
+ }
+ fclose(f);
+ }
+
+ return 0;
+}
+
+
+/* Close the file descriptor (if open) and delete the shvarFile.
+ * Returns -1 on error and 0 on success.
+ */
+int
+svCloseFile(shvarFile *s)
+{
+
+ assert(s);
+
+ if (s->fd != -1) close(s->fd);
+
+ free(s->arena);
+ for (s->current = s->freeList; s->current; s->current = s->current->next) {
+ free(s->current->data);
+ }
+ free(s->fileName);
+ g_list_free(s->freeList);
+ g_list_free(s->lineList); /* implicitly frees s->current */
+ free(s);
+ return 0;
+}
diff --git a/root-manager/shvar.h b/root-manager/shvar.h
new file mode 100644
index 000000000..ee60e12b2
--- /dev/null
+++ b/root-manager/shvar.h
@@ -0,0 +1,100 @@
+/* copied from rp3 -- DO NOT EDIT HERE, ONLY COPY FROM rp3 */
+/*
+ * shvar.h
+ *
+ * Interface for non-destructively reading/writing files containing
+ * only shell variable declarations and full-line comments.
+ *
+ * Includes explicit inheritance mechanism intended for use with
+ * Red Hat Linux ifcfg-* files. There is no protection against
+ * inheritance loops; they will generally cause stack overflows.
+ * Furthermore, they are only intended for one level of inheritance;
+ * the value setting algorithm assumes this.
+ *
+ * Copyright 1999 Red Hat, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#ifndef _SHVAR_H
+#define _SHVAR_H
+
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _shvarFile shvarFile;
+struct _shvarFile {
+ char *fileName; /* read-only */
+ int fd; /* read-only */
+ char *arena; /* ignore */
+ GList *lineList; /* read-only */
+ GList *freeList; /* ignore */
+ GList *current; /* set implicitly or explicitly,
+ points to element of lineList */
+ shvarFile *parent; /* set explicitly */
+ int modified; /* ignore */
+};
+
+
+/* Open the file <name>, return shvarFile on success, NULL on failure */
+shvarFile *
+svNewFile(char *name);
+
+/* Get the value associated with the key, and leave the current pointer
+ * pointing at the line containing the value. The char* returned MUST
+ * be freed by the caller.
+ */
+char *
+svGetValue(shvarFile *s, char *key);
+
+/* return 1 if <key> resolves to any truth value (e.g. "yes", "y", "true")
+ * return 0 if <key> resolves to any non-truth value (e.g. "no", "n", "false")
+ * return <def> otherwise
+ */
+int
+svTrueValue(shvarFile *s, char *key, int def);
+
+/* Set the variable <key> equal to the value <value>.
+ * If <key> does not exist, and the <current> pointer is set, append
+ * the key=value pair after that line. Otherwise, prepend the pair
+ * to the top of the file.
+ */
+void
+svSetValue(shvarFile *s, char *key, char *value);
+
+
+/* Write the current contents iff modified. Returns -1 on error
+ * and 0 on success. Do not write if no values have been modified.
+ * The mode argument is only used if creating the file, not if
+ * re-writing an existing file, and is passed unchanged to the
+ * open() syscall.
+ */
+int
+svWriteFile(shvarFile *s, int mode);
+
+/* Close the file descriptor (if open) and delete the shvarFile.
+ * Returns -1 on error and 0 on success.
+ */
+int
+svCloseFile(shvarFile *s);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* ! _SHVAR_H */
diff --git a/root-manager/userdialogs.c b/root-manager/userdialogs.c
new file mode 100644
index 000000000..2d8861fc7
--- /dev/null
+++ b/root-manager/userdialogs.c
@@ -0,0 +1,229 @@
+/* -*-Mode: c-*- */
+/* Copyright (C) 1997 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include <locale.h>
+#include <libintl.h>
+#define _(String) gettext(String)
+#include "userdialogs.h"
+
+GtkWidget*
+create_message_box(gchar* message, gchar* title)
+{
+ GtkWidget* message_box;
+ GtkWidget* label;
+ GtkWidget* hbox;
+ GtkWidget* ok;
+
+ message_box = gtk_dialog_new();
+ gtk_window_position(GTK_WINDOW(message_box), GTK_WIN_POS_CENTER);
+ gtk_container_set_border_width(GTK_CONTAINER(message_box), 5);
+ if(title == NULL)
+ gtk_window_set_title(GTK_WINDOW(message_box), _("Message"));
+ else
+ gtk_window_set_title(GTK_WINDOW(message_box), title);
+
+ label = gtk_label_new(message);
+ hbox = gtk_hbox_new(TRUE, 5);
+ ok = gtk_button_new_with_label(_(UD_OK_TEXT));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(ok)->child), 4, 0);
+ gtk_signal_connect_object(GTK_OBJECT(ok), "clicked",
+ (GtkSignalFunc) gtk_widget_destroy,
+ (gpointer) message_box);
+ gtk_widget_set_usize(ok, 50, 0);
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(message_box)->vbox), hbox,
+ FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(message_box)->action_area), ok,
+ FALSE, FALSE, 0);
+
+ GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(ok);
+
+ gtk_widget_show(ok);
+ gtk_widget_show(label);
+ gtk_widget_show(hbox);
+ gtk_widget_show(message_box);
+
+ return message_box;
+
+}
+
+/* conslidate error_box and message_box.. they're the same damn thing
+ * with a different default title.
+ */
+GtkWidget*
+create_error_box(gchar* error, gchar* title)
+{
+ GtkWidget* error_box;
+ GtkWidget* label;
+ GtkWidget* hbox;
+ GtkWidget* ok;
+
+ error_box = gtk_dialog_new();
+ gtk_window_position(GTK_WINDOW(error_box), GTK_WIN_POS_CENTER);
+ gtk_container_set_border_width(GTK_CONTAINER(error_box), 5);
+ if(title == NULL)
+ gtk_window_set_title(GTK_WINDOW(error_box), _("Error"));
+ else
+ gtk_window_set_title(GTK_WINDOW(error_box), title);
+
+ label = gtk_label_new(error);
+ hbox = gtk_hbox_new(TRUE, 5);
+ ok = gtk_button_new_with_label(_(UD_OK_TEXT));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(ok)->child), 4, 0);
+ gtk_signal_connect_object(GTK_OBJECT(ok), "clicked",
+ (GtkSignalFunc) gtk_widget_destroy,
+ (gpointer) error_box);
+ gtk_widget_set_usize(ok, 50, 0);
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(error_box)->vbox), hbox,
+ FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(error_box)->action_area), ok,
+ FALSE, FALSE, 0);
+
+ GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(ok);
+
+ gtk_widget_show(ok);
+ gtk_widget_show(label);
+ gtk_widget_show(hbox);
+ gtk_widget_show(error_box);
+
+ return error_box;
+}
+
+GtkWidget*
+create_query_box(gchar* prompt, gchar* title, GtkSignalFunc func)
+{
+ GtkWidget* query_box;
+ GtkWidget* label;
+ GtkWidget* entry;
+ GtkWidget* hbox;
+ GtkWidget* ok;
+
+ query_box = gtk_dialog_new();
+ gtk_window_position(GTK_WINDOW(query_box), GTK_WIN_POS_CENTER);
+ gtk_container_set_border_width(GTK_CONTAINER(query_box), 5);
+ if(title == NULL)
+ gtk_window_set_title(GTK_WINDOW(query_box), _("Prompt"));
+ else
+ gtk_window_set_title(GTK_WINDOW(query_box), _("Prompt"));
+
+ label = gtk_label_new(prompt);
+ entry = gtk_entry_new();
+ ok = gtk_button_new_with_label(_(UD_OK_TEXT));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(ok)->child), 4, 0);
+ gtk_widget_set_usize(ok, 50, 0);
+
+ hbox = gtk_hbox_new(TRUE, 0);
+
+ gtk_signal_connect_object(GTK_OBJECT(entry), "activate",
+ (GtkSignalFunc) gtk_button_clicked,
+ (gpointer) GTK_BUTTON(ok));
+
+ /* FIXME: memory leak... well, not really. Just rely on the caller
+ * to free the widget... 'cept that's not nice either. :-S
+ */
+ gtk_signal_connect_object(GTK_OBJECT(ok), "clicked",
+ (GtkSignalFunc) gtk_widget_hide,
+ (gpointer) query_box);
+ if(func != NULL)
+ {
+ gtk_signal_connect(GTK_OBJECT(ok), "clicked", func, entry);
+ }
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(query_box)->vbox), label,
+ FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(query_box)->vbox), hbox,
+ FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(query_box)->action_area), ok,
+ TRUE, FALSE, 0);
+
+ GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(ok);
+
+ gtk_widget_grab_focus(entry);
+
+ gtk_widget_show(ok);
+ gtk_widget_show(label);
+ gtk_widget_show(entry);
+ gtk_widget_show(hbox);
+ gtk_widget_show(query_box);
+
+ return query_box;
+}
+
+GtkWidget*
+create_invisible_query_box(gchar* prompt, gchar* title, GtkSignalFunc func)
+{
+ GtkWidget* query_box;
+ GtkWidget* label;
+ GtkWidget* entry;
+ GtkWidget* hbox;
+ GtkWidget* ok;
+
+ query_box = gtk_dialog_new();
+ gtk_window_position(GTK_WINDOW(query_box), GTK_WIN_POS_CENTER);
+ gtk_container_set_border_width(GTK_CONTAINER(query_box), 5);
+ gtk_window_set_title(GTK_WINDOW(query_box), _("Prompt"));
+/* gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(query_box)->vbox), 5); */
+ label = gtk_label_new(prompt);
+ entry = gtk_entry_new();
+ gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
+
+ hbox = gtk_hbox_new(TRUE, 5);
+
+ ok = gtk_button_new_with_label(_("OK"));
+ gtk_misc_set_padding(GTK_MISC(GTK_BIN(ok)->child), 4, 0);
+
+ gtk_signal_connect_object(GTK_OBJECT(entry), "activate",
+ (GtkSignalFunc) gtk_button_clicked,
+ (gpointer) GTK_BUTTON(ok));
+ gtk_signal_connect_object(GTK_OBJECT(ok), "clicked",
+ (GtkSignalFunc) gtk_widget_hide,
+ (gpointer) query_box);
+ gtk_widget_set_usize(ok, 50, 0);
+
+ if(func != NULL)
+ {
+ gtk_signal_connect(GTK_OBJECT(ok), "clicked", func, entry);
+ }
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(query_box)->vbox), label,
+ FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(query_box)->vbox), hbox,
+ FALSE, FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(query_box)->action_area), ok,
+ TRUE, FALSE, 0);
+
+ GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(ok);
+
+ gtk_widget_grab_focus(entry);
+
+ gtk_widget_show(ok);
+ gtk_widget_show(label);
+ gtk_widget_show(entry);
+ gtk_widget_show(hbox);
+ gtk_widget_show(query_box);
+
+ return query_box;
+}
diff --git a/root-manager/userdialogs.h b/root-manager/userdialogs.h
new file mode 100644
index 000000000..13ee1ece3
--- /dev/null
+++ b/root-manager/userdialogs.h
@@ -0,0 +1,42 @@
+/* -*-Mode: c-*- */
+/* Copyright (C) 1997 Red Hat Software, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __USERDIALOGS_H__
+#define __USERDIALOGS_H__
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <locale.h>
+#include <libintl.h>
+#define i18n(String) gettext(String)
+#define N_(String) String
+
+#define UD_OK_TEXT N_("OK")
+#define UD_HELP_TEXT N_("Help")
+#define UD_CANCEL_TEXT N_("Cancel")
+#define UD_EXIT_TEXT N_("Exit")
+#define UD_FALLBACK_TEXT N_("Run Unprivileged")
+
+/* consider a "has args" arg, so I can use the arg argument or not at will */
+GtkWidget* create_message_box(gchar* message, gchar* title);
+GtkWidget* create_error_box(gchar* error, gchar* title);
+GtkWidget* create_query_box(gchar* prompt, gchar* title, GtkSignalFunc func);
+GtkWidget* create_invisible_query_box(gchar* prompt, gchar* title,
+ GtkSignalFunc func);
+
+#endif /* __USERDIALOGS_H__ */