summaryrefslogtreecommitdiff
path: root/capplets/common
diff options
context:
space:
mode:
Diffstat (limited to 'capplets/common')
-rw-r--r--capplets/common/.cvsignore5
-rw-r--r--capplets/common/Bonobo_Control_Capplet_generic.oaf.in21
-rw-r--r--capplets/common/ChangeLog810
-rw-r--r--capplets/common/Makefile.am42
-rw-r--r--capplets/common/activate-settings-daemon.c58
-rw-r--r--capplets/common/activate-settings-daemon.h9
-rw-r--r--capplets/common/bonobo-property-editor-range.c70
-rw-r--r--capplets/common/bonobo-property-editor-range.h8
-rw-r--r--capplets/common/capplet-stock-icons.c137
-rw-r--r--capplets/common/capplet-stock-icons.h62
-rw-r--r--capplets/common/capplet-util.c400
-rw-r--r--capplets/common/capplet-util.h91
-rw-r--r--capplets/common/file-transfer-dialog.c420
-rw-r--r--capplets/common/file-transfer-dialog.h69
-rw-r--r--capplets/common/gconf-property-editor-marshal.c41
-rw-r--r--capplets/common/gconf-property-editor-marshal.h15
-rw-r--r--capplets/common/gconf-property-editor.c1764
-rw-r--r--capplets/common/gconf-property-editor.h157
-rw-r--r--capplets/common/gnome-theme-apply.c65
-rw-r--r--capplets/common/gnome-theme-apply.h33
-rw-r--r--capplets/common/gnome-theme-info.c1692
-rw-r--r--capplets/common/gnome-theme-info.h129
-rw-r--r--capplets/common/gnome-theme-test.c122
-rw-r--r--capplets/common/theme-thumbnail.c623
-rw-r--r--capplets/common/theme-thumbnail.h24
-rw-r--r--capplets/common/wm-common.c149
-rw-r--r--capplets/common/wm-common.h13
-rw-r--r--capplets/common/wrapper-script.in9
28 files changed, 0 insertions, 7038 deletions
diff --git a/capplets/common/.cvsignore b/capplets/common/.cvsignore
deleted file mode 100644
index 784cc6632..000000000
--- a/capplets/common/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-Makefile.in
-.deps
-gnome-theme-test
-stamp-h.in
diff --git a/capplets/common/Bonobo_Control_Capplet_generic.oaf.in b/capplets/common/Bonobo_Control_Capplet_generic.oaf.in
deleted file mode 100644
index 4cef098ad..000000000
--- a/capplets/common/Bonobo_Control_Capplet_generic.oaf.in
+++ /dev/null
@@ -1,21 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Bonobo_@SHORT_CAPPLET_NAME@_properties_Factory" type="exe"
- location="@BINDIR@/@CAPPLET_BINARY_NAME@">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string" value="@SHORT_CAPPLET_NAME@ properties capplet factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Bonobo_Control_Capplet_@SHORT_CAPPLET_NAME@_properties" type="factory"
- location="OAFIID:Bonobo_@SHORT_CAPPLET_NAME@_properties_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/PropertyControl:1.0"/>
- <item value="IDL:Bonobo/Unknown:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" value="@SHORT_CAPPLET_NAME@ capplet"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog
deleted file mode 100644
index 712070ee8..000000000
--- a/capplets/common/ChangeLog
+++ /dev/null
@@ -1,810 +0,0 @@
-2005-03-02 Shakti Sen <shprasad@novell.com>
-
- * gnome-theme-info.c (read_icon_theme): Do not add the Icon Theme if
- the key 'Hidden' is 'true' in the index.theme file.
-
- Fixes bug #168348
-
-2005-05-22 Sebastien Bacher <seb128@debian.org>
-
- * gconf-property-editor.c: (peditor_font_value_changed),
- (peditor_font_widget_changed), (gconf_peditor_new_font):
- * gconf-property-editor.h:
- port of the font capplet to gtk_font_button and some cleanup,
- patch from paolo borelli <pborelli@katamail.com> (Closes: #160016).
-
-2005-05-22 Sebastien Bacher <seb128@debian.org>
-
- * theme-thumbnail.c: (create_image): fix the theme preview crasher with
- xorg/composite, patch from Colin Gibbs <colin@gibbsonline.net>
- (Closes: #152490).
-
-2005-02-08 Sebastien Bacher <seb128@debian.org>
-
- * gnome-theme-info.c: (update_common_theme_dir_index):
- * theme-thumbnail.c: (create_image):
- patch by Kjartan Maraas <kmaraas@gnome.org>, move to use GtkIconTheme
- and remove a load of leaks in the theme manager code (Closes: #166267).
-
-2005-02-03 Kjartan Maraas <kmaraas@gnome.org>
-
- * gnome-theme-info.c: (update_theme_index),
- (top_theme_dir_changed), (top_icon_theme_dir_changed),
- (real_add_top_theme_dir_monitor): Revert the previous
- two commits. It looks like the fix in gnome-vfs to make
- sure gnome_vfs_uri_extract_short_name() doesn't return
- NULL was what we really needed. Please retest to see if
- you can still reproduce the crashes in the theme-manager
- after this change and with the latest gnome-vfs from CVS.
-
-2005-02-02 Kjartan Maraas <kmaraas@gnome.org>
-
- * gnome-theme-info.c: (update_theme_index),
- (real_add_top_theme_dir_monitor): More bandaids for test
- purposes.
-
-2005-01-27 Kjartan Maraas <kmaraas@gnome.org>
-
- * gnome-theme-info.c: (top_theme_dir_changed),
- (top_icon_theme_dir_changed), (real_add_top_theme_dir_monitor):
- Try to fix bug #149236 by not freeing stuff already being free'd
- by the hash destroy_func. It will leak a bit more, but that can
- be fixed later. Please test this and report success in the report
- mentioned above.
-
-2005-01-02 Thomas Cataldo <thomas.cataldo@aliacom.fr>
-
- * gconf-property-editor.c: (gconf_property_editor_finalize): plug
- gconf key leak.
-
-2004-11-24 Kjartan Maraas <kmaraas@gnome.org>
-
- * activate-settings-daemon.c: (popup_error_message):
- ANSIfication.
-
-2004-10-14 Jody Goldberg <jody@gnome.org>
-
- * Release 2.8.1
-
-2004-04-15 Jody Goldberg <jody@gnome.org>
-
- * Release 2.6.1
-
-2004-04-07 Jody Goldberg <jody@gnome.org>
-
- http://bugzilla.gnome.org/show_bug.cgi?id=130623
- * capplet-util.c (capplet_set_icon) : respect the icon theme
-
-2004-04-01 Jody Goldberg <jody@gnome.org>
-
- * Release 2.6.0.3
-
-2004-03-30 Jody Goldberg <jody@gnome.org>
-
- * Release 2.6.0.1
-
-2004-03-23 Jody Goldberg <jody@gnome.org>
-
- * Release 2.6.0
-
-2004-03-11 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.4
-
-2004-02-16 Jody Goldberg <jody@gnome.org>
-
- * gconf-property-editor.c (peditor_image_clicked_cb) : Use the monitor
- size kludge for the vertical size of the new file selector.
-
-2003-12-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
-
- * gconf-property-editor.c: (peditor_image_set_filename),
- (peditor_image_chooser_response_cb),
- (peditor_image_chooser_update_preview_cb),
- (peditor_image_clicked_cb): replace
- PreviewFileSelection (GtkFileSelection) with GtkFileChooser, use new
- gdk_pixbuf_new_from_file_at_size method to load a scaled image.
-
-2004-02-13 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.3
-
-2004-01-14 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.2
-
-2003-12-30 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.1.1
-
-2003-12-30 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.1
-
-2003-10-28 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.0
-
-Thu Aug 7 15:23:08 2003 Jonathan Blandford <jrb@redhat.com>
-
- * gconf-property-editor.c (gconf_property_editor_set_prop): damn
- it Jonathan. Save the @#*&$@# file before committing.
-
-Mon Aug 4 14:35:22 2003 Jonathan Blandford <jrb@redhat.com>
-
- * gconf-property-editor.c (gconf_property_editor_init): Reset the
- old connection when setting a new one, #116232
-
-2003-07-07 Jody Goldberg <jody@gnome.org>
-
- * Release 2.3.4
-
-2003-07-03 Kjartan Maraas <kmaraas@gnome.org>
-
- * gconf-property-editor.c: (gconf_property_editor_finalize):
- Merge Anders' fix from stable.
-
-2003-07-02 Mark McLoughlin <mark@skynet.ie>
-
- Handle crashes of the thumbnailer child process a
- little more gracefully.
-
- * theme-thumbnail.c:
- (generate_theme_thumbnail): if we get an EOF from
- the child close the pipe, return NULL and return
- NULL from any subsequent calls.
- (generate_theme_thumbnail_async): return NULL if
- the pipe has been closed.
- (theme_thumbnail_factory_init): set pipe descriptos
- to zero after closing them.
-
-2003-06-24 Jody Goldberg <jody@gnome.org>
-
- * Release 2.3.3
-
-2003-05-13 Andrew Sobala <aes@gnome.org>
-
- * Makefile.am: build fixes for the below
- * gnome-theme-apply.c: pulled out from gnome-theme-manager.c
- * gnome-theme-apply.h: pulled out from gnome-theme-manager.c
- * theme-thumbnail.c: moved to libcommon
- * theme-thumbnail.h: moved to libcommon
-
-2003-05-07 Jody Goldberg <jody@gnome.org>
-
- * Release 2.3.1
-
-2003-05-01 Ross Burton <ross@burtonini.com>
-
- * gnome-theme-info.c (real_add_top_theme_dir_monitor):
- Monitor directories and symbolic links instead of just
- directories. Fixes #111990.
-
-2003-04-29 Kjartan Maraas <kmaraas@gnome.org>
-
- * gconf-property-editor.c: (gconf_peditor_new): Plug a leak
- * gnome-theme-info.c: (top_theme_dir_changed),
- (top_icon_theme_dir_changed), (real_add_top_theme_dir_monitor):
- Plug leaks and fix invalid reads reported by valgrind.
-
-2003-03-27 Andrew Sobala <aes@gnome.org>
-
- * gnome-theme-info.c: (gnome_theme_read_meta_theme),
- (update_common_theme_dir_index):
- s/read_meta_theme/gnome_theme_read_meta_theme/; enable the reading of
- themes that just use [X-GNOME-Metatheme] without pretending to be a
- .desktop file
- * gnome-theme-info.h: exposed gnome_theme_read_meta_theme
-
-Tue Feb 4 17:09:18 2003 Jonathan Blandford <jrb@redhat.com>
-
- * Release 2.2.0.1
-
-2003-02-03 Kjartan Maraas <kmaraas@gnome.org>
-
- * gnome-theme-info.c (read_meta_theme): Fix a glaring bug
- that caused the theme descriptions etc not to be localised.
- Fix from Dmitry G. Mastrukov <dmitry@taurussoft.org>. Fixes
- #104296
-
-2003-01-27 Bastien Nocera <hadess@hadess.net>
-
- * gnome-theme-test.c: (main): C ninety what ?
-
-Tue Jan 21 01:15:14 2003 Jonathan Blandford <jrb@gnome.org>
-
- * Release 2.2.0
-
-Sun Jan 19 02:14:35 2003 Jonathan Blandford <jrb@gnome.org>
-
- * gnome-theme-test.c (main): add more debugging output.
-
-Thu Jan 16 15:51:33 2003 Jonathan Blandford <jrb@redhat.com>
-
- * gnome-theme-test.c: new little test program for helping people
- debug their installation.
-
-Thu Jan 16 02:41:09 2003 Jonathan Blandford <jrb@gnome.org>
-
- * Release 2.1.7
-
-Wed Jan 15 20:16:21 2003 Jonathan Blandford <jrb@redhat.com>
-
- * gnome-theme-info.c (remove_data_from_hash_by_name): call
- correctly in all the right places.
-
-Mon Jan 13 15:04:47 2003 Jonathan Blandford <jrb@redhat.com>
-
- * gnome-theme-info.c: rewrote to handle fam more correctly. Still
- a little broken in places, but much, much better than before.
-
-2003-01-10 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.6
-
-2002-12-28 Seth Nickell <snickell@stanford.edu>
-
- * Makefile.am:
- * gnome-theme-info.c: (gnome_theme_info_init):
-
- Update icon theme directory code so it looks in
- PREFIX/share/icons rather than PREFIX/share/theme,
- as per freedesktop icon spec.
-
-2002-12-18 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.5
-
-Fri Dec 6 16:13:54 2002 Jonathan Blandford <jrb@redhat.com>
-
- * gnome-theme-info.c (top_theme_dir_changed_callback): I know C.
- Really, I do.
-
-2002-11-23 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.3
-
-Tue Nov 5 15:48:33 2002 Jonathan Blandford <jrb@gnome.org>
-
- * gnome-theme-info.c: Change the file format a bunch.
-
-2002-11-02 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.2
-
-Fri Nov 1 11:03:34 2002 Jonathan Blandford <jrb@gnome.org>
-
- * gnome-theme-info.[ch]: Moved theme-common, and gave more
- features.
-
-2002-10-21 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.1
-
-2002-10-01 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.0.1
-
-2002-08-21 Jody Goldberg <jody@gnome.org>
-
- * Release 2.1.0
-
-2002-07-16 Jody Goldberg <jody@gnome.org>
-
- * gconf-property-editor.c (gconf_value_int_to_float) : add a peditor
- arg so that these can be used without wrappers.
- (gconf_value_float_to_int) : ditto.
-
-2002-07-10 Jody Goldberg <jody@gnome.org>
-
- * capplet-util.c (capplet_set_icon) : look in more places.
-
-2002-07-02 Jody Goldberg <jody@gnome.org>
-
- http://bugzilla.gnome.org/show_bug.cgi?id=86018
- * gconf-property-editor.c (peditor_image_set_filename) : Patch from
- Chema. We should only assign the filename to the label if the file
- is valid.
-
-2002-06-27 Jody Goldberg <jody@gnome.org>
-
- * capplet-util.c (capplet_set_icon) : new util.
-
-2002-06-21 Stephen Browne <stephen.browne@sun.com>
-
- * wm-common.[ch] : added new files to expose
- wm_common_get_current_window_manager and
- wm_common_register_window_manager_change
-
-2002-06-13 Jody Goldberg <jody@gnome.org>
-
- * capplet-util.c (capplet_help) : Use the new utility.
- (capplet_error_dialog) : split out into a new utility.
-
-2002-06-17 Jody Goldberg <jody@gnome.org>
-
- * Release 2.0.0
-
-2002-05-28 Satyajit Kanungo <satyajit.kanungo@wipro.com>
-
- * capplet-util.c : capplet_help () The Help directory is changed to
- user-guide.
-
-2002-05-26 Jody Goldberg <jody@gnome.org>
-
- * capplet-util.c (capplet_help) : new utility.
-
-2002-05-16 jacob berkman <jacob@ximian.com>
-
- * gconf-property-editor.c (peditor_image_set_filename): if we
- haven't been initting, don't pop up an error message. if we are,
- set our image to GTK_STOCK_MISSING_IMAGE. fixes bug exposed by
- fix for #76993
-
-Tue May 14 12:08:17 2002 Jonathan Blandford <jrb@redhat.com>
-
- * theme-common.c (theme_common_init): confirm that the ~/.themes/
- directory exists.
-
-2002-04-29 Rachel Hestilow <hestilow@ximian.com>
-
- * file-transfer-dialog.c (file_transfer_dialog_update_cb):
- Set dialog title to current phase.
-
-2002-04-29 Rachel Hestilow <hestilow@ximian.com>
-
- * file-transfer-dialog.[ch]: Added.
-
- * Makefile.am: Compile file-transfer-dialog.[ch].
-
-2002-04-19 Mark McLoughlin <mark@skynet.ie>
-
- * gconf-property-editor.[ch]: (peditor_integer_value_changed),
- (peditor_integer_widget_changed), (gconf_peditor_new_integer_valist),
- (gconf_peditor_new_integer): implement GtkEntry based integer
- peditor.
-
-2002-04-21 Rachel Hestilow <hestilow@ximian.com>
-
- * gconf-property-editor.c
- (gconf_peditor_new_select_menu_with_enum,
- gconf_peditor_new_enum_toggle,
- gconf_peditor_new_select_radio_with_enum): Add in an explicit
- 'use_nick' parameter. Implicit guessing can break badly if
- the gconf data gets corrupted.
- (peditor_enum_int_from_string): Change use_nick to copy-by-value,
- do not try to guess it.
- (peditor_enum_conv_to_widget, guard_get_bool,
- peditor_enum_toggle_conv_to_widget): Do not pass in use_nick
- as a reference.
-
-Thu Apr 18 17:56:25 2002 Jonathan Blandford <jrb@redhat.com>
-
- * theme-common.c: Notify when the theme changes.
-
-2002-04-18 Jody Goldberg <jody@gnome.org>
-
- * activate-settings-daemon.c (static) : message dialogs must have
- separators.
-
-2002-04-10 Rachel Hestilow <hestilow@ximian.com>
-
- * gconf-proprerty-editor.h: Add FontType enum, and a font_type
- parameter to gconf_peditor_new_font.
-
- * gconf-property-editor.c:
- (peditor_font_value_changed): Call peditor_font_merge_setting
- instead of setting the properties explicitly.
- (peditor_font_widget_changed): Switch on font_type to determine
- what to set for a GConfValue.
-
-2002-03-28 Richard Hestilow <hestilow@ximian.com>
-
- * gconf-property-editor.c (peditor_image_clicked_cb): Set
- fsel to modal, it seems to fix a weird grabbing bug.
-
-2003-03-26 Kjartan Maraas <kmaraas@gnome.org>
-
- * activate-settings-daemon.c: Fix a string.
-
-2002-03-25 Lauris Kaplinski <lauris@ximian.com>
-
- * gconf-property-editor.c (gconf_peditor_widget_set_guard): Test for NULL
- gconf value
-
-2002-03-19 Richard Hestilow <hestilow@ximian.com>
-
- * Makefile.am: Include libbackground (used for preview-file-selector).
- Change into a libtool library so we can link against libbackground.
-
- * gconf-property-editor.c:
- (peditor_enum_int_from_string): Added argument use_nick; set to true
- if the string was a nick.
- (peditor_enum_string_from_int): Use nick only if use_nick is true.
- (gconf_peditor_new_image): Added.
- (gconf_peditor_new_select_radio_with_enum): Added.
- (peditor_select_radio_value_changed): Reverse radio group.
- (peditor_select_radio_widget_changed): Reverse radio group.
-
-2002-03-17 Kjartan Maraas <kmaraas@gnome.org>
-
- * activate-settings-daemon.c: Mark a string. #include <config.h>
-
-2002-03-17 Jonathan Blandford <set EMAIL_ADDRESS environment variable>
-
- reviewed by: <delete if not using a buddy>
-
- * Makefile.am:
- * theme-common.c: (themes_common_list_add_dir),
- (theme_common_get_list), (theme_common_list_free):
- * theme-common.h:
-
-2002-03-14 Richard Hestilow <hestilow@ximian.com>
-
- * gconf-property-editor.c:
- (gconf_property_editor_new_option_menu_with_enum):
- (gconf_property_editor_new_enum_toggle): Added.
- (gconf_property_editor_new): Accept custom arguments from the
- editor "subclass".
- (gconf_property_editor_class_init): Add arguments "data"
- and "data-free-cb", for custom "subclass" data.
- (gconf_property_editor_finalize): Free custom data.
- (*_new): Add NULL at the end of gconf_property_editor_new.
- (guard_value_changed, peditor_widget_set_guard): Use the
- enum->boolean mapping if the gconf value is a string.
-
-2002-03-10 Seth Nickell <snickell@stanford.edu>
-
- * Makefile.am:
- * activate-settings-daemon.c: (popup_error_message),
- (activate_settings_daemon):
- * activate-settings-daemon.h:
-
- Add new client interface for activating the settings daemon
- if its not already running.
-
-2002-02-27 Kjartan Maraas <kmaraas@gnome.org>
-
- * capplet-util.c: s/PACKAGE/GETTEXT_PACKAGE/g
-
-2002-02-12 Lauris Kaplinski <lauris@ximian.com>
-
- * gconf-property-editor.c (peditor_font_value_changed): Kill warning
-
-2002-02-10 Richard Hestilow <hestilow@ximian.com>
-
- * gconf-property-editor.[ch]: Added font editor.
-
-Sun Jan 6 02:52:59 2002 Jonathan Blandford <jrb@redhat.com>
-
- * gconf-property-editor.c (peditor_select_radio_widget_changed):
- avoid recursive loops by only setting the UI if we're active.
-
-2002-01-05 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c (peditor_*_value_changed): Only remove
- from changeset if the changeset is non-NULL
-
-2002-01-04 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c (peditor_set_gconf_value):
- Implement. Sets the GConf value either in the changeset, or if
- changeset is NULL, directly
- (peditor_*_widget_changed): Use peditor_set_gconf_value
- (gconf_peditor_new_*): Don't complain if changeset is NULL
-
-2001-12-20 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c: Eliminate compiler warnings
-
- * capplet-util.c: Eliminate compiler warnings
-
- * gconf-property-editor.c (gconf_peditor_new): Fold the callback
- back in; accept variable argument list with extra parameters
- (gconf_peditor_new_filename): Return the property editor
- (gconf_peditor_new_string_valist): Split this out
- (gconf_peditor_new_string): Call _valist variant
- (gconf_peditor_new*): Update
-
-2001-12-19 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c (gconf_peditor_new_float_range)
- (gconf_peditor_new_int_range): Connect to value_changed signal Add
- properties conv-{to|from}-widget-cb and use those for conversion
- of values to and from the widget
- (peditor_{int|float}_range_value_changed, friends): Combine into
- peditor_numeric_*
- (gconf_peditor_new): Implement. Factor out some common code from
- the various type-specific constructors
- (peditor_*_value_changed): Don't check if the value is the same as
- what is already in the widget; it's not very important
- (peditor_*_value_changed): Remove the key from the changeset
- (gconf_peditor_new_*): Add g_return_val_if_fail macros
- (gconf_peditor_widget_set_guard): Add g_return_if_fail macros
- (gconf_value_float_to_int, gconf_value_int_to_float): Implement
- (gconf_property_editor_set_prop): Store the callback in the
- property editor proper
- (gconf_peditor_new): Put initialization code in an idle handler
- (peditor_string_value_changed): Free the value created from
- conversion
- (init_widget_cb): Return FALSE
- (peditor_*_widget_changed): Just return if we are not fully
- initialized
- (init_widget_cb): Set initialized flag
- (struct _GConfPropertyEditorPrivate): Add inited
-
- * gconf-property-editor.c: Add ui-control property storing the
- object (normally a widget) that controls the property; remove
- object property and replace its function with ui-control
-
- * capplet-util.c: Comment out most of this file
-
- * gconf-property-editor.c (gconf_peditor_new_int_range): Convert
- to ~_float_range
- (gconf_peditor_new_float_range): Add callbacks for conversion
- between widget's values and GConf values in the signature
- (peditor_float_range_widget_changed): Issue callback, if
- available, to convert from widget's values to GConf values
- (peditor_float_range_value_changed): Vice verca above
- (gconf_peditor_new_int_range, peditor_int_range_widget_changed)
- (peditor_int_range_value_changed): Implement. Copy from float
- versions
-
-2001-12-18 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.h: Don't #include bonobo*.h
-
- * gconf-property-editor.c (peditor_string_widget_changed): Use
- actual signature for the changed signal Use gconf_client rather
- than gconf_engine
- (gconf_property_editor_set_prop): Use weak_ref rather than destroy
- signal
- (peditor_int_range_value_changed)
- (peditor_int_range_widget_changed, gconf_peditor_new_int_range):
- Implement
-
-2001-12-17 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c (peditor_color_value_changed): Use a
- local stack variable for the color rather than a pointer. Duh.
- (peditor_select_menu_widget_changed): Use
- gtk_option_menu_get_history
- (peditor_select_menu_widget_changed): Accept option_menu as
- parameter
- (gconf_peditor_new_select_menu): Connect changed signal rather
- than activate signal on the menu items
- (gconf_property_editor_get_key): Implement
- (peditor_color_widget_changed): Use correct signature for the
- signal handler
- (peditor_select_menu_value_changed): Use
- gtk_option_menu_set_history
- (guard_value_changed, gconf_peditor_widget_set_guard): Implement
- (peditor_string_widget_changed): Work correctly with multiple
- callback signatures
- (gconf_peditor_new_string): Use changed signal
-
-2001-12-08 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c (peditor_*_widget_changed): Don't call
- gconf_value_free
-
-2001-12-07 Bradford Hovinen <hovinen@ximian.com>
-
- * gconf-property-editor.c (gconf_property_editor_class_init): Use
- correct ordering of setup
- (gconf_peditor_new_*): Terminate the parameter list passed to
- g_object_new with NULL
- (gconf_property_editor_class_init): Make the changeset property a
- pointer
- (gconf_property_editor_set_prop): Use g_value_get_object for the
- destroy notify object
- (peditor_*_value_changed): Make sure value is non-NULL
-
-2001-11-03 Bradford Hovinen <hovinen@ximian.com>
-
- * Makefile.am (libcommon_a_SOURCES): Added gconf-property-editor.[ch]
-
-2001-10-27 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (get_default_moniker): Switch to gconf: moniker
- (capplet_init): Remove legacy file hack
-
-2001-10-18 Bradford Hovinen <hovinen@ximian.com>
-
- * Bonobo_Control_Capplet_generic.oaf.in: Update listener name
-
- * capplet-util.c (create_control_cb): Use correct prefix for listener
-
-2001-10-12 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (get_factory_name): Updated factory name to
- reflect new, expanded roles
-
- * Bonobo_Control_Capplet_generic.oaf.in: Create
-
-2001-09-29 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (create_control_cb): Elimite reference counter --
- it's not necessary
- (create_control_cb): Make this a multi-factory so that we can
- return the listener when needed
- (capplet_init): Set up the listener here rather than in
- get_control_cb; also remove the listener and unref the database
- here
- (quit_cb, real_quit_cb): Remove (thank the gods)
-
-2001-09-28 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (get_default_moniker): Remove -control from the
- end of the string as well as -capplet
- (get_factory_name): Ditto
- (get_property_name): Ditto
-
-2001-09-24 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (legacy_is_modified): Improved error checking and
- cleaned up the logic a bit
-
-2001-09-14 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (set_moniker_cb): Don't call setup_cb after the
- first time
-
-2001-09-03 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (set_moniker_cb): Free the full moniker to
- correct memory leak
- (set_moniker_cb): Disconnect old signal handler
-
-2001-08-20 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (get_default_moniker): Update moniker being used
-
-2001-07-30 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (capplet_init): Don't sync if we need legacy
- values
- (capplet_init): Call setup_session_mgmt if --apply or
- --init-session-settings was passed
-
-2001-07-27 Bradford Hovinen <hovinen@ximian.com>
-
- * RELEASE : 1.5.2
-
-2001-07-26 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (capplet_init): Don't sync the database if
- retrieving legacy setings before creating the factory
- (create_control_cb): Create the config database ourselves
- (pf_destroy_cb): Remove evil hackery
- (get_control_cb): Ditto
- (create_control_cb): Support multiple property control objects --
- use a GtkObject called ref_obj to make sure the program quits when
- there are no such objects left
- (capplet_init): Pass default_moniker to factory callback;
- release_unref the db ourselves
- (get_control_cb): Support multiple controls; soak in global
- control and widget variables
- (legacy_is_modified): Remember to unref the property bag
- (quit_cb): Allow being called more than once
- (quit_cb): Unref ref_obj here
- (create_control_cb): Eliminate second signal connection
- (real_quit_cb): Free the pair structure
- (all_done_cb): Implement. Just add gtk_main_quit to the idle
- handler list
- (create_control_cb): Connect destroy signal of ref_obj to
- all_done_cb
-
-2001-07-24 Richard Hestilow <hestilow@ximian.com>
-
- * capplet-util.c (get_control_cb): Set control data on PropertyFrame
- as part of evil hack.
- (quit_cb): Work if called multiple times...also evil.
- (pf_destroy_cb): unref the control...evil evil evil.
-
-2001-07-24 Richard Hestilow <hestilow@ximian.com>
-
- * capplet-util.c: Remove debugging cruft.
- (capplet_init): Check for legacy with --init-session-settings too.
-
-2001-07-24 Richard Hestilow <hestilow@ximian.com>
-
- * capplet-util.[ch] (capplet_init): New argument of legacy files to
- check for changes.
-
- * capplet-util.c (legacy_is_modified): New function that checks
- a legacy file against the archiver modification date.
- (capplet_init): Pass legacy_files to legacy_is_modified, and sync
- our database with the legacy one if one has been.
-
-2001-07-24 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (real_quit_cb): Reenable disabled code
- (quit_cb): Put the db an id objects in a pair structure and pass
- that to the callback
- (real_quit_cb): Extract the db and id objects from the pair
- (create_control_cb): Set up listener for sync event rather than
- change event
-
-2001-07-23 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (set_moniker_cb): Set InvalidValue exception if
- the program could not resolve the moniker
-
-2001-07-20 Chema Celorio <chema@celorio.com>
-
- * RELEASE : 1.5.0
-
-2001-07-19 Richard Hestilow <hestilow@ximian.com>
-
- * capplet-util.c (quit_cb): Add an idle handler to call the real
- quit cb.
- (real_quit_cb): Added, it is what quit_cb used to be.
-
-2001-07-19 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (create_control_cb): Use a static variable for
- the control and return NULL if the control was already created
-
-2001-07-18 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (create_control_cb): Store listener id in
- property control
- (quit_cb): Remove listener before releasing database
- (set_moniker_cb): Kill any existing db object in case the moniker
- is set more than once
- (set_moniker_cb): Connect destroy signal on pf to pf_destroy_cb
- (pf_destroy_cb): Implement
-
-2001-07-18 Richard Hestilow <hestilow@ximian.com>
-
- * capplet-util.[ch]: Revert my last proxy-related change.
-
-2001-07-18 Richard Hestilow <hestilow@ximian.com>
-
- * capplet-util.h (CreateDialogFn): Add a PropertyBag argument so
- capplet authors can hook up to the proxy.
-
- * capplet-util.c (get_control_cb): Pass the proxy bag to setup_cb.
- (capplet_init): Don't free default_moniker until after we print it.
-
-2001-07-17 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (capplet_init): Support --init-session-settings
- for compatibility reasons
- (setup_session_mgmt): Implement. Make sure capplet runs the next
- time the user logs in
- (capplet_init): Call setup_session_mgmt for --get-legacy and
- standard execution
- (get_property_name): Implement. Return the property name
- associated with the capplet
- (set_moniker_cb): Use GTK_BIN (pf)->child rather than
- bonobo_control_get_widget
- (get_control_cb): Destroy the property control when the control or
- the widget are destroyed
- (quit_cb): Implement
- (create_control_cb): Connect destroy signal of property control to
- quit_cb
- (get_factory_name):
- (get_default_moniker):
- (get_property_name): Use correct names when the full path was
- specified for the executable
-
- * Makefile.am (INCLUDES): Removed -DGLADE_DATADIR
-
- * capplet-util.c (create_dialog_cb): Use create_widget_cb rather
- than loading from Glade
- (capplet_init): Accept CreateDialogFn and initialize
- create_dialog_cb
- (close_cb): Don't call gtk_object_destroy (dialog)
- (get_control_cb): Rename from create_dialog_cb
-
-2001-07-14 Carlos Perelló Marín <carlos@gnome-db.org>
-
- * .cvsignore: ssshhhh
-
-2001-07-13 Bradford Hovinen <hovinen@ximian.com>
-
- * capplet-util.c (create_dialog_cb): Return NULL in the case that
- the control is already present
-
diff --git a/capplets/common/Makefile.am b/capplets/common/Makefile.am
deleted file mode 100644
index 1c4715ff7..000000000
--- a/capplets/common/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-EXTRA_DIST = ChangeLog wrapper-script.in Bonobo_Control_Capplet_generic.oaf.in
-
-INCLUDES = \
- -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DGNOME_ICONDIR=\""${prefix}/share/pixmaps"\" \
- -DG_LOG_DOMAIN=\"capplet-common\" \
- -DINSTALL_PREFIX=\"$(prefix)\" \
- -I$(top_srcdir)/libbackground \
- -I$(top_srcdir)/libwindow-settings \
- @VFS_CAPPLET_CFLAGS@ \
- @GNOME_DESKTOP_CFLAGS@ \
- @METACITY_CFLAGS@
-
-
-noinst_LTLIBRARIES = libcommon.la
-
-libcommon_la_SOURCES = \
- activate-settings-daemon.c activate-settings-daemon.h \
- capplet-util.c capplet-util.h \
- gconf-property-editor.c gconf-property-editor.h \
- gconf-property-editor-marshal.c gconf-property-editor-marshal.h \
- file-transfer-dialog.c file-transfer-dialog.h \
- gnome-theme-info.c gnome-theme-info.h \
- wm-common.c wm-common.h \
- capplet-stock-icons.c capplet-stock-icons.h \
- theme-thumbnail.c theme-thumbnail.h \
- gnome-theme-apply.c gnome-theme-apply.h
-
-libcommon_la_LIBADD = $(top_builddir)/libbackground/libbackground.la \
- $(top_builddir)/libwindow-settings/libgnome-window-settings.la \
- @METACITY_LIBS@ \
- @GNOME_DESKTOP_LIBS@
-
-gnome_theme_test_SOURCES = \
- gnome-theme-test.c
-
-gnome_theme_test_LDADD = \
- libcommon.la \
- $(GNOMECC_CAPPLETS_LIBS)
-
-noinst_PROGRAMS = \
- gnome-theme-test
diff --git a/capplets/common/activate-settings-daemon.c b/capplets/common/activate-settings-daemon.c
deleted file mode 100644
index 186eb82a7..000000000
--- a/capplets/common/activate-settings-daemon.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libbonobo.h>
-#include <gtk/gtk.h>
-
-#include "activate-settings-daemon.h"
-
-
-/*#include "GNOME_SettingsDaemon.h"*/
-
-static void popup_error_message (void)
-{
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK, _("Unable to start the settings manager 'gnome-settings-daemon'.\n"
- "Without the GNOME settings manager running, some preferences may not take effect. This could "
- "indicate a problem with Bonobo, or a non-GNOME (e.g. KDE) settings manager may already "
- "be active and conflicting with the GNOME settings manager."));
-
- gtk_widget_show (dialog);
- gtk_widget_destroy (dialog);
-}
-
-/* Returns FALSE if activation failed, else TRUE */
-gboolean
-activate_settings_daemon (void)
-{
- CORBA_Environment ev;
- CORBA_Object object;
-
- /*GNOME_SettingsDaemon corba_foo;*/
-
- bonobo_init (NULL, NULL);
-
- CORBA_exception_init (&ev);
-
- object = bonobo_activation_activate_from_id ("OAFIID:GNOME_SettingsDaemon",
- 0, NULL, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- popup_error_message ();
- return FALSE;
- }
-
- if (object == CORBA_OBJECT_NIL) {
- popup_error_message ();
- return FALSE;
- }
-
- /*bool = GNOME_SettingsDaemon_awake (corba_foo, "MyService", &ev);
- printf ("bool is %d\n", bool);*/
-
-
- return TRUE;
-}
diff --git a/capplets/common/activate-settings-daemon.h b/capplets/common/activate-settings-daemon.h
deleted file mode 100644
index fc1558d82..000000000
--- a/capplets/common/activate-settings-daemon.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef ACTIVATE_SETINGS_DAEMON
-#define ACTIVATE_SETINGS_DAEMON
-
-#include <glib.h>
-
-/* Returns FALSE if activation failed, else TRUE */
-gboolean activate_settings_daemon (void);
-
-#endif
diff --git a/capplets/common/bonobo-property-editor-range.c b/capplets/common/bonobo-property-editor-range.c
deleted file mode 100644
index f4069b63e..000000000
--- a/capplets/common/bonobo-property-editor-range.c
+++ /dev/null
@@ -1,70 +0,0 @@
-#include <bonobo-conf/bonobo-property-editor.h>
-#include <gtk/gtkrange.h>
-#include <gtk/gtksignal.h>
-#include <bonobo.h>
-
-static void
-changed_cb (GtkAdjustment *adj, BonoboPEditor *editor)
-{
- CORBA_Environment ev;
- DynamicAny_DynAny dyn;
- BonoboArg *arg;
- gulong val;
-
- CORBA_exception_init (&ev);
-
- val = adj->value;
-
- dyn = CORBA_ORB_create_basic_dyn_any (bonobo_orb (), TC_ulong, &ev);
- DynamicAny_DynAny_insert_ulong (dyn, val, &ev);
-
- if (BONOBO_EX (&ev) || dyn == NULL)
- return;
-
- arg = DynamicAny_DynAny_to_any (dyn, &ev);
- bonobo_peditor_set_value (editor, arg, &ev);
-
- bonobo_arg_release (arg);
- CORBA_Object_release ((CORBA_Object) dyn, &ev);
- CORBA_exception_free (&ev);
-}
-
-static void
-adj_set_value_cb (BonoboPEditor *editor,
- BonoboArg *value,
- CORBA_Environment *ev)
-{
- GtkAdjustment *adj;
- gulong v;
-
- adj = gtk_range_get_adjustment (GTK_RANGE (bonobo_peditor_get_widget (editor)));
-
- if (!bonobo_arg_type_is_equal (value->_type, TC_ulong, NULL))
- return;
-
- v = BONOBO_ARG_GET_GENERAL (value, TC_ulong, CORBA_unsigned_long, NULL);
-
- gtk_signal_handler_block_by_func (GTK_OBJECT (adj), changed_cb,
- editor);
-
- gtk_adjustment_set_value (adj, v);
-
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (adj), changed_cb,
- editor);
-}
-
-GtkObject* bonobo_peditor_range_construct (GtkWidget *widget)
-{
- BonoboPEditor *editor;
- GtkAdjustment *adj;
-
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_RANGE (widget), NULL);
-
- editor = bonobo_peditor_construct (widget, adj_set_value_cb, TC_ulong);
- adj = gtk_range_get_adjustment (GTK_RANGE (widget));
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (changed_cb), editor);
-
- return GTK_OBJECT (editor);
-}
diff --git a/capplets/common/bonobo-property-editor-range.h b/capplets/common/bonobo-property-editor-range.h
deleted file mode 100644
index a0167d48d..000000000
--- a/capplets/common/bonobo-property-editor-range.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __BONOBO_PROPERTY_RANGE_SCALE_H__
-#define __BONOBO_PROPERTY_RANGE_SCALE_H__
-
-#include <gtk/gtkwidget.h>
-
-GtkObject* bonobo_peditor_range_construct (GtkWidget *widget);
-
-#endif /* __BONOBO_PROPERTY_RANGE_SCALE_H__ */
diff --git a/capplets/common/capplet-stock-icons.c b/capplets/common/capplet-stock-icons.c
deleted file mode 100644
index 7e8ee4591..000000000
--- a/capplets/common/capplet-stock-icons.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * capplet-stock-icons.c
- *
- * Copyright (C) 2002 Sun Microsystems, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Rajkumar Sivasamy <rajkumar.siva@wipro.com>
- * Taken bits of code from panel-stock-icons.c, Thanks Mark <mark@skynet.ie>
- */
-
-#include <gtk/gtkstock.h>
-#include <gtk/gtkiconfactory.h>
-#include <gnome.h>
-
-#include "capplet-stock-icons.h"
-
-static GtkIconSize keyboard_capplet_icon_size = 0;
-static GtkIconSize mouse_capplet_icon_size = 0;
-static GtkIconSize mouse_capplet_dblclck_icon_size = 0;
-
-GtkIconSize
-keyboard_capplet_icon_get_size (void)
-{
- return keyboard_capplet_icon_size;
-}
-
-GtkIconSize
-mouse_capplet_icon_get_size (void)
-{
- return mouse_capplet_icon_size;
-}
-
-GtkIconSize
-mouse_capplet_dblclck_icon_get_size (void)
-{
- return mouse_capplet_dblclck_icon_size;
-}
-
-typedef struct
-{
- char *stock_id;
- char *name;
-} CappletStockIcon;
-
-
-static CappletStockIcon items [] = {
- { KEYBOARD_REPEAT, "keyboard-repeat.png" },
- { KEYBOARD_CURSOR, "keyboard-cursor.png" },
- { KEYBOARD_VOLUME, "keyboard-volume.png" },
- { KEYBOARD_BELL, "keyboard-bell.png" },
- { ACCESSX_KEYBOARD_BOUNCE, "accessibility-keyboard-bouncekey.png"},
- { ACCESSX_KEYBOARD_SLOW, "accessibility-keyboard-slowkey.png"},
- { ACCESSX_KEYBOARD_MOUSE, "accessibility-keyboard-mousekey.png"},
- { ACCESSX_KEYBOARD_STICK, "accessibility-keyboard-stickykey.png"},
- { ACCESSX_KEYBOARD_TOGGLE, "accessibility-keyboard-togglekey.png"},
- { MOUSE_DBLCLCK_MAYBE, "double-click-maybe.png"},
- { MOUSE_DBLCLCK_ON, "double-click-on.png"},
- { MOUSE_DBLCLCK_OFF, "double-click-off.png"},
- { MOUSE_RIGHT_HANDED, "mouse-right.png"},
- { MOUSE_LEFT_HANDED, "mouse-left.png"}
-};
-
-static void
-capplet_register_stock_icons (GtkIconFactory *factory)
-{
- gint i;
- GtkIconSource *source;
- GnomeProgram *program;
-
- source = gtk_icon_source_new ();
- program = gnome_program_get ();
-
- for (i = 0; i < G_N_ELEMENTS (items); ++i) {
- GtkIconSet *icon_set;
- char *filename;
- filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP, items[i].name, TRUE, NULL);
-
- if (!filename) {
- g_warning (_("Unable to load capplet stock icon '%s'\n"), items[i].name);
- icon_set = gtk_icon_factory_lookup_default (GTK_STOCK_MISSING_IMAGE);
- gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
- continue;
- }
-
- gtk_icon_source_set_filename (source, filename);
- g_free (filename);
-
- icon_set = gtk_icon_set_new ();
- gtk_icon_set_add_source (icon_set, source);
- gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
- gtk_icon_set_unref (icon_set);
- }
- gtk_icon_source_free (source);
-}
-
-void
-capplet_init_stock_icons (void)
-{
- GtkIconFactory *factory;
- static gboolean initialized = FALSE;
-
- if (initialized)
- return;
- initialized = TRUE;
-
- factory = gtk_icon_factory_new ();
- gtk_icon_factory_add_default (factory);
- capplet_register_stock_icons (factory);
-
- keyboard_capplet_icon_size = gtk_icon_size_register ("keyboard-capplet",
- KEYBOARD_CAPPLET_DEFAULT_ICON_SIZE,
- KEYBOARD_CAPPLET_DEFAULT_ICON_SIZE);
-
- mouse_capplet_icon_size = gtk_icon_size_register ("mouse-capplet",
- MOUSE_CAPPLET_DEFAULT_WIDTH,
- MOUSE_CAPPLET_DEFAULT_HEIGHT);
-
- mouse_capplet_dblclck_icon_size = gtk_icon_size_register ("mouse-capplet-dblclck-icon",
- MOUSE_CAPPLET_DBLCLCK_ICON_SIZE,
- MOUSE_CAPPLET_DBLCLCK_ICON_SIZE);
- g_object_unref (factory);
-}
diff --git a/capplets/common/capplet-stock-icons.h b/capplets/common/capplet-stock-icons.h
deleted file mode 100644
index 1c316c8ff..000000000
--- a/capplets/common/capplet-stock-icons.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * capplet-stock-icons.h
- *
- * Copyright (C) 2002 Sun Microsystems, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Rajkumar Sivasamy <rajkumar.siva@wipro.com>
- * Taken bits of code from panel-stock-icons.h, Thanks Mark <mark@skynet.ie>
- */
-
-#ifndef __CAPPLET_STOCK_ICONS_H__
-#define __CAPPLET_STOCK_ICONS_H__
-
-#include <glib/gmacros.h>
-#include <gtk/gtkenums.h>
-
-G_BEGIN_DECLS
-
-#define KEYBOARD_CAPPLET_DEFAULT_ICON_SIZE 48
-#define MOUSE_CAPPLET_DEFAULT_WIDTH 120
-#define MOUSE_CAPPLET_DEFAULT_HEIGHT 100
-#define MOUSE_CAPPLET_DBLCLCK_ICON_SIZE 100
-
-/* stock icons */
-#define KEYBOARD_REPEAT "keyboard-repeat"
-#define KEYBOARD_CURSOR "keyboard-cursor"
-#define KEYBOARD_VOLUME "keyboard-volume"
-#define KEYBOARD_BELL "keyboard-bell"
-#define ACCESSX_KEYBOARD_BOUNCE "accessibility-keyboard-bouncekey"
-#define ACCESSX_KEYBOARD_SLOW "accessibility-keyboard-slowkey"
-#define ACCESSX_KEYBOARD_MOUSE "accessibility-keyboard-mousekey"
-#define ACCESSX_KEYBOARD_STICK "accessibility-keyboard-stickykey"
-#define ACCESSX_KEYBOARD_TOGGLE "accessibility-keyboard-togglekey"
-#define MOUSE_DBLCLCK_MAYBE "mouse-dblclck-maybe"
-#define MOUSE_DBLCLCK_ON "mouse-dblclck-on"
-#define MOUSE_DBLCLCK_OFF "mouse-dblclck-off"
-#define MOUSE_RIGHT_HANDED "mouse-right-handed"
-#define MOUSE_LEFT_HANDED "mouse-left-handed"
-
-void capplet_init_stock_icons (void);
-GtkIconSize keyboard_capplet_icon_get_size (void);
-GtkIconSize mouse_capplet_icon_get_size (void);
-GtkIconSize mouse_capplet_dblclck_icon_get_size (void);
-
-G_END_DECLS
-
-#endif /* __CAPPLET_STOCK_ICONS_H__ */
diff --git a/capplets/common/capplet-util.c b/capplets/common/capplet-util.c
deleted file mode 100644
index 4277c7021..000000000
--- a/capplets/common/capplet-util.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* capplet-util.c
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Written by Bradford Hovinen <hovinen@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * 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 <ctype.h>
-
-/* For stat */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "capplet-util.h"
-
-#if 0
-
-/* apply_cb
- *
- * Callback issued when the user clicks "Apply" or "Ok". This function is
- * responsible for making sure the current settings are properly saved.
- */
-
-static void
-apply_cb (BonoboPropertyControl *pc, Bonobo_PropertyControl_Action action)
-{
- if (action == Bonobo_PropertyControl_APPLY)
- gconf_engine_commit_change_set (gconf_engine_get_default (),
- changeset, TRUE, NULL);
-}
-
-/* properties_changed_cb
- *
- * Callback issued when some setting has changed
- */
-
-static void
-properties_changed_cb (GConfEngine *engine, guint cnxn_id, GConfEntry *entry, gpointer user_data)
-{
- if (apply_settings_cb != NULL)
- apply_settings_cb ();
-}
-
-/* get_control_cb
- *
- * Callback to construct the main dialog box for this capplet; invoked by Bonobo
- * whenever capplet activation is requested. Returns a BonoboObject representing
- * the control that encapsulates the object.
- */
-
-static BonoboObject *
-get_control_cb (BonoboPropertyControl *property_control, gint page_number)
-{
- BonoboControl *control;
- GtkWidget *widget;
-
- widget = create_dialog_cb ();
-
- if (widget == NULL)
- return NULL;
-
- control = bonobo_control_new (widget);
- setup_property_editors_cb (widget, changeset);
-
- bonobo_control_set_automerge (control, TRUE);
-
- return BONOBO_OBJECT (control);
-}
-
-/* create_control_cb
- *
- * Small function to create the PropertyControl and return it.
- */
-
-static BonoboObject *
-create_control_cb (BonoboGenericFactory *factory, const gchar *component_id)
-{
- BonoboObject *obj;
- BonoboPropertyControl *property_control;
-
- static const gchar *prefix1 = "OAFIID:Bonobo_Control_Capplet_";
-
- g_message ("%s: Enter", G_GNUC_FUNCTION);
-
- if (!strncmp (component_id, prefix1, strlen (prefix1))) {
- property_control = bonobo_property_control_new
- ((BonoboPropertyControlGetControlFn) get_control_cb, 1, NULL);
- g_signal_connect (G_OBJECT (property_control), "action",
- G_CALLBACK (apply_cb), NULL);
- obj = BONOBO_OBJECT (property_control);
- } else {
- g_critical ("Not creating %s", component_id);
- obj = NULL;
- }
-
- return obj;
-}
-
-/* get_factory_name
- *
- * Construct the OAF IID of the factory from the binary name
- */
-
-static gchar *
-get_factory_name (const gchar *binary)
-{
- gchar *s, *tmp, *tmp1, *res;
-
- s = g_strdup (binary);
- tmp = strrchr (s, '/');
- if (tmp == NULL) tmp = s;
- else tmp++;
- if ((tmp1 = strstr (tmp, "-control")) != NULL) *tmp1 = '\0';
- if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0';
- while ((tmp1 = strchr (tmp, '-')) != NULL) *tmp1 = '_';
-
- res = g_strconcat ("OAFIID:Bonobo_", tmp, "_Factory", NULL);
- g_free (s);
- return res;
-}
-
-/* get_property_name
- *
- * Get the property name associated with this capplet
- */
-
-static gchar *
-get_property_name (const gchar *binary)
-{
- gchar *s, *tmp, *tmp1, *res;
-
- s = g_strdup (binary);
- tmp = strrchr (s, '/');
- if (tmp == NULL) tmp = s;
- else tmp++;
- if ((tmp1 = strstr (tmp, "-control")) != NULL) *tmp1 = '\0';
- if ((tmp1 = strstr (tmp, "-capplet")) != NULL) *tmp1 = '\0';
-
- for (tmp1 = tmp; *tmp1 != '\0'; tmp1++) {
- *tmp1 = toupper (*tmp1);
- if (*tmp1 == '-') *tmp1 = '_';
- }
-
- res = g_strconcat ("GNOME_", tmp, NULL);
- g_free (s);
- return res;
-}
-
-#endif
-
-/* setup_session_mgmt
- *
- * Make sure the capplet launches and applies its settings next time the user
- * logs in
- */
-
-void
-setup_session_mgmt (const gchar *binary_name)
-{
-/* Disabled. I never really understood this code anyway, and I am absolutely
- * unclear about how to port it to GNOME 2.0 */
-#if 0
- GnomeClient *client;
- GnomeClientFlags flags;
- gint token;
- gchar *restart_args[3];
- gchar *prop_name;
-
- g_return_if_fail (binary_name != NULL);
-
- client = gnome_master_client ();
- flags = gnome_client_get_flags (client);
-
- if (flags & GNOME_CLIENT_IS_CONNECTED) {
- prop_name = get_property_name (binary_name);
- token = gnome_startup_acquire_token
- (prop_name, gnome_client_get_id (client));
- g_free (prop_name);
-
- if (token) {
- gnome_client_set_priority (client, 20);
- gnome_client_set_restart_style
- (client, GNOME_RESTART_ANYWAY);
- restart_args[0] = g_strdup (binary_name);
- restart_args[1] = "--init-session-settings";
- restart_args[2] = NULL;
- gnome_client_set_restart_command
- (client, 2, restart_args);
- g_free (restart_args[0]);
- } else {
- gnome_client_set_restart_style
- (client, GNOME_RESTART_NEVER);
- }
- }
-#endif
-}
-
-#if 0
-
-/* capplet_init -- see documentation in capplet-util.h
- */
-
-void
-capplet_init (int argc,
- char **argv,
- ApplySettingsFn apply_fn,
- CreateDialogFn create_dialog_fn,
- SetupPropertyEditorsFn setup_fn,
- GetLegacySettingsFn get_legacy_fn)
-{
- gchar *factory_iid;
- BonoboGenericFactory *factory;
-
- static gboolean apply_only;
- static gboolean get_legacy;
- static struct poptOption cap_options[] = {
- { "apply", '\0', POPT_ARG_NONE, &apply_only, 0,
- N_("Just apply settings and quit"), NULL },
- { "init-session-settings", '\0', POPT_ARG_NONE, &apply_only, 0,
- N_("Just apply settings and quit"), NULL },
- { "get-legacy", '\0', POPT_ARG_NONE, &get_legacy, 0,
- N_("Retrieve and store legacy settings"), NULL },
- { NULL, '\0', 0, NULL, 0, NULL, NULL }
- };
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- gnome_program_init (argv[0], VERSION, LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PARAM_POPT_TABLE, cap_options,
- NULL);
-
- if (!bonobo_init (&argc, argv))
- g_error ("Cannot initialize bonobo");
-
- if (apply_only && apply_fn != NULL) {
- setup_session_mgmt (argv[0]);
- apply_fn ();
- }
- else if (get_legacy && get_legacy_fn != NULL) {
- setup_session_mgmt (argv[0]);
- get_legacy_fn ();
- } else {
- setup_session_mgmt (argv[0]);
-
- create_dialog_cb = create_dialog_fn;
- apply_settings_cb = apply_fn;
- setup_property_editors_cb = setup_fn;
-
- factory_iid = get_factory_name (argv[0]);
- factory = bonobo_generic_factory_new
- (factory_iid, (BonoboFactoryCallback) create_control_cb, NULL);
- g_free (factory_iid);
- bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-
- changeset = gconf_change_set_new ();
-
- bonobo_main ();
-
- gconf_change_set_unref (changeset);
- }
-}
-
-#endif
-
-
-/**
- * capplet_error_dialog :
- *
- * @parent :
- * @msg : already translated.
- * @err :
- *
- */
-void
-capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err)
-{
- if (err != NULL) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- msg, err->message);
-
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_widget_show (dialog);
- g_error_free (err);
- }
-}
-
-/**
- * capplet_help :
- * @parent :
- * @helpfile :
- * @section :
- *
- * A quick utility routine to display help for capplets, and handle errors in a
- * Havoc happy way.
- **/
-void
-capplet_help (GtkWindow *parent, char const *helpfile, char const *section)
-{
- GError *error = NULL;
-
- g_return_if_fail (helpfile != NULL);
- g_return_if_fail (section != NULL);
-
- gnome_help_display_desktop (NULL,
- "user-guide",
- helpfile, section, &error);
- if (error != NULL)
- capplet_error_dialog (parent,
- _("There was an error displaying help: %s"),
- error);
-}
-
-/**
- * capplet_set_icon :
- * @window :
- * @file_name :
- *
- * A quick utility routine to avoid the cut-n-paste of bogus code
- * that caused several bugs.
- **/
-void
-capplet_set_icon (GtkWidget *window, char const *icon_file_name)
-{
- char *path;
- char *tmp;
- char *p;
- GdkPixbuf *icon_pixbuf = NULL;
- GnomeIconTheme *icon_theme;
-
- /* First look up from the icon theme */
- icon_theme = gnome_icon_theme_new ();
-
- tmp = g_strdup (icon_file_name);
- p = strrchr (tmp, '.');
- if (p)
- p[0] = '\0';
-
- path = gnome_icon_theme_lookup_icon (icon_theme, tmp, 48, NULL, NULL);
-
- if (path != NULL) {
- icon_pixbuf = gdk_pixbuf_new_from_file (path, NULL);
- g_free (path);
- }
-
- g_free (tmp);
- g_object_unref (icon_theme);
-
- if (icon_pixbuf == NULL) {
- /* Then we fallback to the control center icon location */
- path = g_strconcat (GNOMECC_DATA_DIR "/icons/", icon_file_name, NULL);
-
- icon_pixbuf = gdk_pixbuf_new_from_file (path, NULL);
- g_free (path);
- }
-
- if (icon_pixbuf == NULL) {
- /* Then we fallback to the gnome program discovery stuff */
- path = gnome_pixmap_file (icon_file_name);
- if (path != NULL) {
- icon_pixbuf = gdk_pixbuf_new_from_file (path, NULL);
- g_free (path);
- }
- }
-
- if (icon_pixbuf != NULL) {
- gtk_window_set_icon (GTK_WINDOW (window), icon_pixbuf);
- g_object_unref (icon_pixbuf);
- }
-}
diff --git a/capplets/common/capplet-util.h b/capplets/common/capplet-util.h
deleted file mode 100644
index 5fa179d2f..000000000
--- a/capplets/common/capplet-util.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* capplet-util.h
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Written by Bradford Hovinen <hovinen@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * 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.
- */
-
-#ifndef __CAPPLET_UTIL_H
-#define __CAPPLET_UTIL_H
-
-#include <gnome.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-changeset.h>
-
-/* Macros to make certain repetitive tasks a bit easier */
-
-/* Retrieve a widget from the Glade object */
-
-#define WID(s) glade_xml_get_widget (dialog, s)
-
-/* Copy a setting from the legacy gnome-config settings to the ConfigDatabase */
-
-#define COPY_FROM_LEGACY(type, key, legacy_key) \
- val_##type = gnome_config_get_##type##_with_default (legacy_key, &def); \
- \
- if (!def) \
- gconf_client_set_##type (client, key, val_##type, NULL);
-
-/* Callback to apply the settings in the given database */
-typedef void (*ApplySettingsFn) (void);
-
-/* Callback to set up the dialog proper */
-typedef GtkWidget *(*CreateDialogFn) (void);
-
-/* Callback to set up property editors for the dialog */
-typedef void (*SetupPropertyEditorsFn) (GtkWidget *dialog, GConfChangeSet *changeset);
-
-/* Callback to retrieve legacy settings and store them in the new configuration
- * database */
-typedef void (*GetLegacySettingsFn) (void);
-
-/* Set up the session management so that this capplet will apply its
- * settings on every startup
- */
-
-void setup_session_mgmt (const gchar *binary_name);
-
-/* Wrapper function for the entire capplet. This handles all initialization and
- * runs the capplet for you. Just supply the appropriate callbacks and your argc
- * and argv from main()
- *
- * This function makes several assumptions, requiring that all capplets follow a
- * particular convention. In particular, suppose the name of the capplet binary
- * is foo-properties-capplet. Then:
- *
- * - The factory IID is Bonobo_Control_Capplet_foo_properties_Factory
- * - The default configuration moniker is archiver:foo-properties
- *
- * Following this convention yields capplets that are more uniform and thus
- * easier to maintain, and simplifies the interfaces quite a bit. All capplet in
- * this package are required to follow this convention.
- */
-
-void capplet_init (int argc,
- gchar **argv,
- ApplySettingsFn apply_fn,
- CreateDialogFn create_dialog_fn,
- SetupPropertyEditorsFn setup_property_editors_fn,
- GetLegacySettingsFn get_legacy_settings_fn);
-
-void capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err);
-void capplet_help (GtkWindow *parent, char const *helpfile, char const *section);
-void capplet_set_icon (GtkWidget *window, char const *icon_file_name);
-
-#endif /* __CAPPLET_UTIL_H */
diff --git a/capplets/common/file-transfer-dialog.c b/capplets/common/file-transfer-dialog.c
deleted file mode 100644
index 307c90bb5..000000000
--- a/capplets/common/file-transfer-dialog.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* file-transfer-dialog.c
- * Copyright (C) 2002 Ximian, Inc.
- *
- * Written by Rachel Hestilow <hestilow@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * 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 "file-transfer-dialog.h"
-#include <libgnomevfs/gnome-vfs-async-ops.h>
-#include <libgnome/libgnome.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkstock.h>
-#include <limits.h>
-
-enum
-{
- PROP_0,
- PROP_FROM_URI,
- PROP_TO_URI,
- PROP_FRACTION_COMPLETE,
- PROP_NTH_URI,
- PROP_TOTAL_URIS
-};
-
-enum
-{
- CANCEL,
- DONE,
- LAST_SIGNAL
-};
-
-guint file_transfer_dialog_signals[LAST_SIGNAL] = {0, };
-
-struct _FileTransferDialogPrivate
-{
- GtkWidget *progress;
- GtkWidget *status;
- GtkWidget *num_files;
- GtkWidget *current;
- GtkWidget *from;
- GtkWidget *to;
- guint nth;
- guint total;
- GnomeVFSAsyncHandle *handle;
-};
-
-static GObjectClass *parent_class;
-
-static void
-file_transfer_dialog_cancel (FileTransferDialog *dlg)
-{
- if (dlg->priv->handle)
- {
- gnome_vfs_async_cancel (dlg->priv->handle);
- dlg->priv->handle = NULL;
- }
-}
-
-static void
-file_transfer_dialog_finalize (GObject *obj)
-{
- FileTransferDialog *dlg = FILE_TRANSFER_DIALOG (obj);
-
- g_free (dlg->priv);
-
- if (parent_class->finalize)
- parent_class->finalize (G_OBJECT (dlg));
-}
-
-static void
-file_transfer_dialog_update_num_files (FileTransferDialog *dlg)
-{
- gchar *str = g_strdup_printf (_("%i of %i"),
- dlg->priv->nth, dlg->priv->total);
- gtk_label_set_text (GTK_LABEL (dlg->priv->num_files), str);
- g_free (str);
-}
-
-static void
-file_transfer_dialog_response (GtkDialog *dlg, gint response_id)
-{
- g_signal_emit (G_OBJECT (dlg),
- file_transfer_dialog_signals[CANCEL], 0, NULL);
-}
-
-static void
-file_transfer_dialog_set_prop (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- FileTransferDialog *dlg = FILE_TRANSFER_DIALOG (object);
- gchar *str;
- gchar *base;
-
- switch (prop_id)
- {
- case PROP_FROM_URI:
- base = g_path_get_basename (g_value_get_string (value));
- str = g_strdup_printf (_("Transferring: %s"), base);
- gtk_label_set_text (GTK_LABEL (dlg->priv->current),
- str);
- g_free (base);
- g_free (str);
-
- base = g_path_get_dirname (g_value_get_string (value));
- str = g_strdup_printf (_("From: %s"), base);
- gtk_label_set_text (GTK_LABEL (dlg->priv->from),
- str);
- g_free (base);
- g_free (str);
- break;
- case PROP_TO_URI:
- base = g_path_get_dirname (g_value_get_string (value));
- str = g_strdup_printf (_("To: %s"), base);
- gtk_label_set_text (GTK_LABEL (dlg->priv->to),
- str);
- g_free (base);
- g_free (str);
- break;
- case PROP_FRACTION_COMPLETE:
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (dlg->priv->progress), g_value_get_double (value));
- break;
- case PROP_NTH_URI:
- dlg->priv->nth = g_value_get_uint (value);
- file_transfer_dialog_update_num_files (dlg);
- break;
- case PROP_TOTAL_URIS:
- dlg->priv->total = g_value_get_uint (value);
- file_transfer_dialog_update_num_files (dlg);
- break;
- }
-}
-
-static void
-file_transfer_dialog_get_prop (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- FileTransferDialog *dlg = FILE_TRANSFER_DIALOG (object);
-
- switch (prop_id)
- {
- case PROP_NTH_URI:
- g_value_set_uint (value, dlg->priv->nth);
- break;
- case PROP_TOTAL_URIS:
- g_value_set_uint (value, dlg->priv->total);
- break;
- }
-}
-
-static void
-file_transfer_dialog_class_init (FileTransferDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- klass->cancel = file_transfer_dialog_cancel;
- object_class->finalize = file_transfer_dialog_finalize;
- object_class->get_property = file_transfer_dialog_get_prop;
- object_class->set_property = file_transfer_dialog_set_prop;
-
- GTK_DIALOG_CLASS (klass)->response = file_transfer_dialog_response;
-
- g_object_class_install_property
- (object_class, PROP_FROM_URI,
- g_param_spec_string ("from_uri",
- _("From URI"),
- _("URI currently transferring from"),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property
- (object_class, PROP_TO_URI,
- g_param_spec_string ("to_uri",
- _("To URI"),
- _("URI currently transferring to"),
- NULL,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property
- (object_class, PROP_FRACTION_COMPLETE,
- g_param_spec_double ("fraction_complete",
- _("Fraction completed"),
- _("Fraction of transfer currently completed"),
- 0, 1, 0,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property
- (object_class, PROP_NTH_URI,
- g_param_spec_uint ("nth_uri",
- _("Current URI index"),
- _("Current URI index - starts from 1"),
- 1, INT_MAX, 1,
- G_PARAM_READWRITE));
-
- g_object_class_install_property
- (object_class, PROP_TOTAL_URIS,
- g_param_spec_uint ("total_uris",
- _("Total URIs"),
- _("Total number of URIs"),
- 1, INT_MAX, 1,
- G_PARAM_READWRITE));
-
- file_transfer_dialog_signals[CANCEL] =
- g_signal_new ("cancel",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (FileTransferDialogClass, cancel),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- file_transfer_dialog_signals[DONE] =
- g_signal_new ("done",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (FileTransferDialogClass, done),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- parent_class =
- G_OBJECT_CLASS (g_type_class_ref (GTK_TYPE_DIALOG));
-}
-
-static void
-file_transfer_dialog_init (FileTransferDialog *dlg)
-{
- GtkWidget *hbox;
-
- dlg->priv = g_new0 (FileTransferDialogPrivate, 1);
-
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox),
- 4);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 4);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
- hbox, FALSE, FALSE, 0);
-
- dlg->priv->status = gtk_label_new ("");
- gtk_label_set_justify (GTK_LABEL (dlg->priv->status),
- GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->status), 0.0, 0.5);
-
- gtk_box_pack_start (GTK_BOX (hbox),
- dlg->priv->status, TRUE, TRUE, 0);
-
- dlg->priv->num_files = gtk_label_new ("");
- gtk_label_set_justify (GTK_LABEL (dlg->priv->num_files),
- GTK_JUSTIFY_RIGHT);
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->num_files), 1.0, 0.5);
-
- gtk_box_pack_start (GTK_BOX (hbox),
- dlg->priv->num_files, TRUE, TRUE, 0);
-
- dlg->priv->progress = gtk_progress_bar_new ();
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
- dlg->priv->progress, FALSE, FALSE, 0);
-
- dlg->priv->current = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
- dlg->priv->current, FALSE, FALSE, 0);
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->current), 0.0, 0.5);
-
- dlg->priv->from = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
- dlg->priv->from, FALSE, FALSE, 0);
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->from), 0.0, 0.5);
-
- dlg->priv->to = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
- dlg->priv->to, FALSE, FALSE, 0);
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->to), 0.0, 0.5);
-
- gtk_dialog_add_button (GTK_DIALOG (dlg),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-
- gtk_widget_show_all (GTK_DIALOG (dlg)->vbox);
-}
-
-GType
-file_transfer_dialog_get_type (void)
-{
- static GType file_transfer_dialog_type = 0;
-
- if (!file_transfer_dialog_type)
- {
- static GTypeInfo file_transfer_dialog_info =
- {
- sizeof (FileTransferDialogClass),
- NULL, /* GBaseInitFunc */
- NULL, /* GBaseFinalizeFunc */
- (GClassInitFunc) file_transfer_dialog_class_init,
- NULL, /* GClassFinalizeFunc */
- NULL, /* data */
- sizeof (FileTransferDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) file_transfer_dialog_init,
- NULL
- };
-
- file_transfer_dialog_type =
- g_type_register_static (GTK_TYPE_DIALOG,
- "FileTransferDialog",
- &file_transfer_dialog_info,
- 0);
- }
-
- return file_transfer_dialog_type;
-}
-
-GtkWidget*
-file_transfer_dialog_new (void)
-{
- return GTK_WIDGET (g_object_new (file_transfer_dialog_get_type (),
- NULL));
-}
-
-static int
-file_transfer_dialog_update_cb (GnomeVFSAsyncHandle *handle,
- GnomeVFSXferProgressInfo *info,
- gpointer data)
-{
- FileTransferDialog *dlg = FILE_TRANSFER_DIALOG (data);
-
- if (info->status == GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR)
- return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
-
- if (info->source_name)
- g_object_set (G_OBJECT (dlg),
- "from_uri", info->source_name,
- NULL);
- if (info->target_name)
- g_object_set (G_OBJECT (dlg),
- "to_uri", info->target_name,
- NULL);
-
- if (info->bytes_total)
- g_object_set (G_OBJECT (dlg),
- "fraction_complete", (double) info->total_bytes_copied / (double) info->bytes_total,
- NULL);
-
- if (info->file_index && info->files_total)
- g_object_set (G_OBJECT (dlg),
- "nth_uri", info->file_index,
- "total_uris", info->files_total,
- NULL);
-
- switch (info->phase)
- {
- case GNOME_VFS_XFER_PHASE_INITIAL:
- gtk_label_set_text (GTK_LABEL (dlg->priv->status),
- _("Connecting..."));
- gtk_window_set_title (GTK_WINDOW (dlg),
- _("Connecting..."));
- break;
- case GNOME_VFS_XFER_PHASE_READYTOGO:
- case GNOME_VFS_XFER_PHASE_OPENSOURCE:
- gtk_label_set_text (GTK_LABEL (dlg->priv->status),
- _("Downloading..."));
- gtk_window_set_title (GTK_WINDOW (dlg),
- _("Downloading..."));
- break;
- case GNOME_VFS_XFER_PHASE_COMPLETED:
- g_signal_emit (G_OBJECT (dlg),
- file_transfer_dialog_signals[DONE],
- 0, NULL);
- return 0;
- default:
- break;
- }
-
- return 1;
-}
-
-GnomeVFSResult
-file_transfer_dialog_wrap_async_xfer (FileTransferDialog *dlg,
- GList *source_uri_list,
- GList *target_uri_list,
- GnomeVFSXferOptions xfer_options,
- GnomeVFSXferErrorMode error_mode,
- GnomeVFSXferOverwriteMode overwrite_mode,
- int priority)
-{
- g_return_val_if_fail (IS_FILE_TRANSFER_DIALOG (dlg),
- GNOME_VFS_ERROR_BAD_PARAMETERS);
-
- return gnome_vfs_async_xfer (&dlg->priv->handle,
- source_uri_list,
- target_uri_list,
- xfer_options,
- error_mode,
- overwrite_mode,
- priority,
- file_transfer_dialog_update_cb,
- dlg,
- NULL,
- NULL
- );
-}
-
diff --git a/capplets/common/file-transfer-dialog.h b/capplets/common/file-transfer-dialog.h
deleted file mode 100644
index 2ef095804..000000000
--- a/capplets/common/file-transfer-dialog.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* file-transfer-dialog.h
- * Copyright (C) 2002 Ximian, Inc.
- *
- * Written by Rachel Hestilow <hestilow@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * 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.
- */
-
-#ifndef __FILE_TRANSFER_DIALOG_H__
-#define __FILE_TRANSFER_DIALOG_H__
-
-#include <gtk/gtkdialog.h>
-#include <libgnomevfs/gnome-vfs-xfer.h>
-
-G_BEGIN_DECLS
-
-#define FILE_TRANSFER_DIALOG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, file_transfer_dialog_get_type (), FileTransferDialog)
-#define FILE_TRANSFER_DIALOG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, file_transfer_dialog_get_type (), FileTransferDialogClass)
-#define IS_FILE_TRANSFER_DIALOG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, file_transfer_dialog_get_type ())
-
-typedef struct _FileTransferDialog FileTransferDialog;
-typedef struct _FileTransferDialogClass FileTransferDialogClass;
-typedef struct _FileTransferDialogPrivate FileTransferDialogPrivate;
-
-struct _FileTransferDialog
-{
- GtkDialog dialog;
-
- FileTransferDialogPrivate *priv;
-};
-
-struct _FileTransferDialogClass
-{
- GtkDialogClass parent_class;
-
- void (*cancel) (FileTransferDialog *dlg);
- void (*done) (FileTransferDialog *dlg);
-};
-
-GType file_transfer_dialog_get_type (void);
-GtkWidget* file_transfer_dialog_new (void);
-
-GnomeVFSResult file_transfer_dialog_wrap_async_xfer (FileTransferDialog *dlg,
- GList *source_uri_list,
- GList *target_uri_list,
- GnomeVFSXferOptions xfer_options,
- GnomeVFSXferErrorMode error_mode,
- GnomeVFSXferOverwriteMode overwrite_mode,
- int priority);
-
-
-G_END_DECLS
-
-#endif /* __FILE_TRANSFER_DIALOG_H__ */
diff --git a/capplets/common/gconf-property-editor-marshal.c b/capplets/common/gconf-property-editor-marshal.c
deleted file mode 100644
index bb6c9b056..000000000
--- a/capplets/common/gconf-property-editor-marshal.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <glib.h>
-#include <glib-object.h>
-#include "gconf-property-editor-marshal.h"
-
-/* VOID:STRING,POINTER (peditor-marshal.list:25) */
-void
-gconf_property_editor_marshal_VOID__STRING_POINTER (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
-{
- typedef void (*GMarshalFunc_VOID__STRING_POINTER) (gpointer data1,
- gpointer arg_1,
- gpointer arg_2,
- gpointer data2);
- register GMarshalFunc_VOID__STRING_POINTER callback;
- register GCClosure *cc = (GCClosure*) closure;
- register gpointer data1, data2;
-
- g_return_if_fail (n_param_values == 3);
-
- if (G_CCLOSURE_SWAP_DATA (closure))
- {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- }
- else
- {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback = (GMarshalFunc_VOID__STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
-
- callback (data1,
- (char*) g_value_get_string (param_values + 1),
- g_value_get_pointer (param_values + 2),
- data2);
-}
-
diff --git a/capplets/common/gconf-property-editor-marshal.h b/capplets/common/gconf-property-editor-marshal.h
deleted file mode 100644
index 78306b2ab..000000000
--- a/capplets/common/gconf-property-editor-marshal.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-#include <gobject/gmarshal.h>
-
-G_BEGIN_DECLS
-
-/* VOID:STRING,POINTER (peditor-marshal.list:25) */
-extern void gconf_property_editor_marshal_VOID__STRING_POINTER (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data);
-
-G_END_DECLS
-
diff --git a/capplets/common/gconf-property-editor.c b/capplets/common/gconf-property-editor.c
deleted file mode 100644
index 034a09cf8..000000000
--- a/capplets/common/gconf-property-editor.c
+++ /dev/null
@@ -1,1764 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* gconf-property-editor.c
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Written by Bradford Hovinen <hovinen@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * 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 <string.h>
-#include <stdarg.h>
-
-#include "gconf-property-editor.h"
-#include "gconf-property-editor-marshal.h"
-
-enum {
- VALUE_CHANGED,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_KEY,
- PROP_CALLBACK,
- PROP_CHANGESET,
- PROP_CONV_TO_WIDGET_CB,
- PROP_CONV_FROM_WIDGET_CB,
- PROP_UI_CONTROL,
- PROP_DATA,
- PROP_DATA_FREE_CB
-};
-
-typedef void (*GConfPropertyEditorDataFreeCb) (gpointer data);
-
-struct _GConfPropertyEditorPrivate
-{
- gchar *key;
- guint handler_id;
- GConfChangeSet *changeset;
- GObject *ui_control;
- GConfPEditorValueConvFn conv_to_widget_cb;
- GConfPEditorValueConvFn conv_from_widget_cb;
- GConfClientNotifyFunc callback;
- gboolean inited;
-
- gpointer data;
- GConfPropertyEditorDataFreeCb data_free_cb;
-};
-
-typedef struct
-{
- GType enum_type;
- GConfPEditorGetValueFn enum_val_true_fn;
- gpointer enum_val_true_fn_data;
- guint enum_val_false;
- gboolean use_nick;
-} GConfPropertyEditorEnumData;
-
-static guint peditor_signals[LAST_SIGNAL];
-
-static GObjectClass *parent_class;
-
-static void gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor,
- GConfPropertyEditorClass *class);
-static void gconf_property_editor_class_init (GConfPropertyEditorClass *class);
-static void gconf_property_editor_base_init (GConfPropertyEditorClass *class);
-
-static void gconf_property_editor_set_prop (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gconf_property_editor_get_prop (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gconf_property_editor_finalize (GObject *object);
-
-static GObject *gconf_peditor_new (gchar *key,
- GConfClientNotifyFunc cb,
- GConfChangeSet *changeset,
- GObject *ui_control,
- const gchar *first_prop_name,
- va_list var_args,
- const gchar *first_custom,
- ...);
-
-GType
-gconf_property_editor_get_type (void)
-{
- static GType gconf_property_editor_type = 0;
-
- if (!gconf_property_editor_type) {
- GTypeInfo gconf_property_editor_info = {
- sizeof (GConfPropertyEditorClass),
- (GBaseInitFunc) gconf_property_editor_base_init,
- NULL, /* GBaseFinalizeFunc */
- (GClassInitFunc) gconf_property_editor_class_init,
- NULL, /* GClassFinalizeFunc */
- NULL, /* user-supplied data */
- sizeof (GConfPropertyEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gconf_property_editor_init,
- NULL
- };
-
- gconf_property_editor_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GConfPropertyEditor",
- &gconf_property_editor_info, 0);
- }
-
- return gconf_property_editor_type;
-}
-
-static GConfValue*
-gconf_property_editor_conv_default (GConfPropertyEditor *peditor,
- const GConfValue *value)
-{
- return gconf_value_copy (value);
-}
-
-static void
-gconf_property_editor_init (GConfPropertyEditor *gconf_property_editor,
- GConfPropertyEditorClass *class)
-{
- gconf_property_editor->p = g_new0 (GConfPropertyEditorPrivate, 1);
- gconf_property_editor->p->conv_to_widget_cb = gconf_property_editor_conv_default;
- gconf_property_editor->p->conv_from_widget_cb = gconf_property_editor_conv_default;
- gconf_property_editor->p->inited = FALSE;
-}
-
-static void
-gconf_property_editor_base_init (GConfPropertyEditorClass *class)
-{
-}
-
-static void
-gconf_property_editor_class_init (GConfPropertyEditorClass *class)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (class);
-
- object_class->finalize = gconf_property_editor_finalize;
- object_class->set_property = gconf_property_editor_set_prop;
- object_class->get_property = gconf_property_editor_get_prop;
-
- g_object_class_install_property
- (object_class, PROP_KEY,
- g_param_spec_string ("key",
- _("Key"),
- _("GConf key to which this property editor is attached"),
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property
- (object_class, PROP_CALLBACK,
- g_param_spec_pointer ("callback",
- _("Callback"),
- _("Issue this callback when the value associated with key gets changed"),
- G_PARAM_WRITABLE));
- g_object_class_install_property
- (object_class, PROP_CHANGESET,
- g_param_spec_pointer ("changeset",
- _("Change set"),
- _("GConf change set containing data to be forwarded to the gconf client on apply"),
- G_PARAM_READWRITE));
- g_object_class_install_property
- (object_class, PROP_CONV_TO_WIDGET_CB,
- g_param_spec_pointer ("conv-to-widget-cb",
- _("Conversion to widget callback"),
- _("Callback to be issued when data are to be converted from GConf to the widget"),
- G_PARAM_WRITABLE));
- g_object_class_install_property
- (object_class, PROP_CONV_FROM_WIDGET_CB,
- g_param_spec_pointer ("conv-from-widget-cb",
- _("Conversion from widget callback"),
- _("Callback to be issued when data are to be converted to GConf from the widget"),
- G_PARAM_WRITABLE));
- g_object_class_install_property
- (object_class, PROP_UI_CONTROL,
- g_param_spec_object ("ui-control",
- _("UI Control"),
- _("Object that controls the property (normally a widget)"),
- G_TYPE_OBJECT,
- G_PARAM_WRITABLE));
-
- peditor_signals[VALUE_CHANGED] =
- g_signal_new ("value-changed",
- G_TYPE_FROM_CLASS (object_class), 0,
- G_STRUCT_OFFSET (GConfPropertyEditorClass, value_changed),
- NULL, NULL,
- (GSignalCMarshaller) gconf_property_editor_marshal_VOID__STRING_POINTER,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);
-
- g_object_class_install_property
- (object_class, PROP_DATA,
- g_param_spec_pointer ("data",
- _("Property editor object data"),
- _("Custom data required by the specific property editor"),
- G_PARAM_WRITABLE));
-
- g_object_class_install_property
- (object_class, PROP_DATA_FREE_CB,
- g_param_spec_pointer ("data-free-cb",
- _("Property editor data freeing callback"),
- _("Callback to be issued when property editor object data is to be freed"),
- G_PARAM_WRITABLE));
-
- parent_class = G_OBJECT_CLASS
- (g_type_class_ref (G_TYPE_OBJECT));
-}
-
-static void
-gconf_property_editor_set_prop (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GConfPropertyEditor *peditor;
- GConfClient *client;
- GConfNotifyFunc cb;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (object));
-
- peditor = GCONF_PROPERTY_EDITOR (object);
-
- switch (prop_id) {
- case PROP_KEY:
- peditor->p->key = g_value_dup_string (value);
- break;
-
- case PROP_CALLBACK:
- client = gconf_client_get_default ();
- cb = g_value_get_pointer (value);
- peditor->p->callback = (GConfClientNotifyFunc) cb;
- if (peditor->p->handler_id != 0) {
- gconf_client_notify_remove (client,
- peditor->p->handler_id);
- }
- peditor->p->handler_id =
- gconf_client_notify_add (client, peditor->p->key,
- peditor->p->callback,
- peditor, NULL, NULL);
- g_object_unref (client);
- break;
-
- case PROP_CHANGESET:
- peditor->p->changeset = g_value_get_pointer (value);
- break;
-
- case PROP_CONV_TO_WIDGET_CB:
- peditor->p->conv_to_widget_cb = g_value_get_pointer (value);
- break;
-
- case PROP_CONV_FROM_WIDGET_CB:
- peditor->p->conv_from_widget_cb = g_value_get_pointer (value);
- break;
-
- case PROP_UI_CONTROL:
- peditor->p->ui_control = g_value_get_object (value);
- g_object_weak_ref (peditor->p->ui_control, (GWeakNotify) g_object_unref, object);
- break;
- case PROP_DATA:
- peditor->p->data = g_value_get_pointer (value);
- break;
- case PROP_DATA_FREE_CB:
- peditor->p->data_free_cb = g_value_get_pointer (value);
- break;
- default:
- g_warning ("Bad argument set");
- break;
- }
-}
-
-static void
-gconf_property_editor_get_prop (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GConfPropertyEditor *peditor;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (object));
-
- peditor = GCONF_PROPERTY_EDITOR (object);
-
- switch (prop_id) {
- case PROP_KEY:
- g_value_set_string (value, peditor->p->key);
- break;
-
- case PROP_CHANGESET:
- g_value_set_pointer (value, peditor->p->changeset);
- break;
-
- default:
- g_warning ("Bad argument get");
- break;
- }
-}
-
-static void
-gconf_property_editor_finalize (GObject *object)
-{
- GConfPropertyEditor *gconf_property_editor;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (object));
-
- gconf_property_editor = GCONF_PROPERTY_EDITOR (object);
-
- g_free (gconf_property_editor->p->key);
-
- if (gconf_property_editor->p->data_free_cb)
- gconf_property_editor->p->data_free_cb (gconf_property_editor->p->data);
-
- if (gconf_property_editor->p->handler_id != 0) {
- GConfClient *client;
-
- client = gconf_client_get_default ();
- gconf_client_notify_remove (client,
- gconf_property_editor->p->handler_id);
- g_object_unref (client);
- }
-
- g_free (gconf_property_editor->p);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GObject *
-gconf_peditor_new (gchar *key,
- GConfClientNotifyFunc cb,
- GConfChangeSet *changeset,
- GObject *ui_control,
- const gchar *first_prop_name,
- va_list var_args,
- const gchar *first_custom,
- ...)
-{
- GObject *obj;
- GConfClient *client;
- GConfEntry *gconf_entry;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (cb != NULL, NULL);
-
- obj = g_object_new (gconf_property_editor_get_type (),
- "key", key,
- "callback", cb,
- "changeset", changeset,
- "ui-control", ui_control,
- NULL);
-
- g_object_set_valist (obj, first_prop_name, var_args);
-
- if (first_custom)
- {
- va_list custom_args;
- va_start (custom_args, first_custom);
- g_object_set_valist (obj, first_custom, custom_args);
- va_end (custom_args);
- }
-
- client = gconf_client_get_default ();
- gconf_entry = gconf_client_get_entry (client, GCONF_PROPERTY_EDITOR (obj)->p->key, NULL, TRUE, NULL);
- GCONF_PROPERTY_EDITOR (obj)->p->callback (client, 0, gconf_entry, obj);
- GCONF_PROPERTY_EDITOR (obj)->p->inited = TRUE;
- gconf_entry_free (gconf_entry);
- g_object_unref (G_OBJECT (client));
-
- return obj;
-}
-
-const gchar *
-gconf_property_editor_get_key (GConfPropertyEditor *peditor)
-{
- return peditor->p->key;
-}
-
-GObject *
-gconf_property_editor_get_ui_control (GConfPropertyEditor *peditor)
-{
- return peditor->p->ui_control;
-}
-
-static void
-peditor_set_gconf_value (GConfPropertyEditor *peditor,
- const gchar *key,
- GConfValue *value)
-{
- GConfClient *client = gconf_client_get_default();
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_set (peditor->p->changeset, peditor->p->key, value);
- else
- gconf_client_set (client, peditor->p->key, value, NULL);
-
- g_object_unref (client);
-}
-
-static void
-peditor_boolean_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (peditor->p->ui_control), gconf_value_get_bool (value_wid));
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_boolean_widget_changed (GConfPropertyEditor *peditor,
- GtkToggleButton *tb)
-{
- GConfValue *value, *value_wid;
-
- if (!peditor->p->inited) return;
- value_wid = gconf_value_new (GCONF_VALUE_BOOL);
- gconf_value_set_bool (value_wid, gtk_toggle_button_get_active (tb));
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-GObject *
-gconf_peditor_new_boolean (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *checkbox,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (checkbox != NULL, NULL);
- g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (checkbox), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_boolean_value_changed,
- changeset,
- G_OBJECT (checkbox),
- first_property_name,
- var_args,
- NULL);
-
- va_end (var_args);
-
- g_signal_connect_swapped (G_OBJECT (checkbox), "toggled",
- (GCallback) peditor_boolean_widget_changed, peditor);
-
- return peditor;
-}
-
-static void
-peditor_integer_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
- const char *entry_current_text;
- int entry_current_integer;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- entry_current_text = gtk_entry_get_text (GTK_ENTRY (peditor->p->ui_control));
- entry_current_integer = strtol (entry_current_text, NULL, 10);
- if (entry_current_integer != gconf_value_get_int (value)) {
- char *buf = g_strdup_printf ("%d", gconf_value_get_int (value_wid));
- gtk_entry_set_text (GTK_ENTRY (peditor->p->ui_control), buf);
- g_free (buf);
- }
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_integer_widget_changed (GConfPropertyEditor *peditor,
- GtkEntry *entry)
-{
- GConfValue *value, *value_wid;
-
- if (!peditor->p->inited) return;
-
- value_wid = gconf_value_new (GCONF_VALUE_INT);
-
- gconf_value_set_int (value_wid, strtol (gtk_entry_get_text (entry), NULL, 10));
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
-
- peditor_set_gconf_value (peditor, peditor->p->key, value);
-
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-static GObject *
-gconf_peditor_new_integer_valist (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *entry,
- gchar *first_property_name,
- va_list var_args)
-{
- GObject *peditor;
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_integer_value_changed,
- changeset,
- G_OBJECT (entry),
- first_property_name,
- var_args, NULL);
-
- g_signal_connect_swapped (G_OBJECT (entry), "changed",
- (GCallback) peditor_integer_widget_changed, peditor);
-
- return peditor;
-}
-
-GObject *
-gconf_peditor_new_integer (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *entry,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (entry != NULL, NULL);
- g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new_integer_valist
- (changeset, key, entry,
- first_property_name, var_args);
-
- va_end (var_args);
-
- return peditor;
-}
-
-static void
-peditor_string_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
- const char *entry_current_text;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- entry_current_text = gtk_entry_get_text (GTK_ENTRY (peditor->p->ui_control));
- if (strcmp (entry_current_text, gconf_value_get_string (value)) != 0) {
- gtk_entry_set_text (GTK_ENTRY (peditor->p->ui_control), gconf_value_get_string (value_wid));
- }
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_string_widget_changed (GConfPropertyEditor *peditor,
- GtkEntry *entry)
-{
- GConfValue *value, *value_wid;
-
- if (!peditor->p->inited) return;
-
- value_wid = gconf_value_new (GCONF_VALUE_STRING);
-
- gconf_value_set_string (value_wid, gtk_entry_get_text (entry));
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
-
- peditor_set_gconf_value (peditor, peditor->p->key, value);
-
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-static GObject *
-gconf_peditor_new_string_valist (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *entry,
- gchar *first_property_name,
- va_list var_args)
-{
- GObject *peditor;
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_string_value_changed,
- changeset,
- G_OBJECT (entry),
- first_property_name,
- var_args, NULL);
-
- g_signal_connect_swapped (G_OBJECT (entry), "changed",
- (GCallback) peditor_string_widget_changed, peditor);
-
- return peditor;
-}
-
-GObject *
-gconf_peditor_new_string (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *entry,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (entry != NULL, NULL);
- g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new_string_valist
- (changeset, key, entry,
- first_property_name, var_args);
-
- va_end (var_args);
-
- return peditor;
-}
-
-GObject *
-gconf_peditor_new_filename (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *file_entry,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (file_entry != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_FILE_ENTRY (file_entry), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new_string_valist
- (changeset, key,
- gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (file_entry)),
- first_property_name, var_args);
-
- va_end (var_args);
-
- return peditor;
-}
-
-static void
-peditor_color_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
- GdkColor color;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- gdk_color_parse (gconf_value_get_string (value_wid), &color);
- gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (peditor->p->ui_control), color.red, color.green, color.blue, 65535);
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_color_widget_changed (GConfPropertyEditor *peditor,
- guint r,
- guint g,
- guint b,
- guint a,
- GnomeColorPicker *cp)
-{
- gchar *str;
- GConfValue *value, *value_wid;
-
- if (!peditor->p->inited) return;
-
- value_wid = gconf_value_new (GCONF_VALUE_STRING);
- str = g_strdup_printf ("#%02x%02x%02x", r >> 8, g >> 8, b >> 8);
- gconf_value_set_string (value_wid, str);
- g_free (str);
-
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
-
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
-
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-GObject *
-gconf_peditor_new_color (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *cp,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (cp != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_COLOR_PICKER (cp), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_color_value_changed,
- changeset,
- G_OBJECT (cp),
- first_property_name,
- var_args, NULL);
-
- va_end (var_args);
-
- g_signal_connect_swapped (G_OBJECT (cp), "color_set",
- (GCallback) peditor_color_widget_changed, peditor);
-
- return peditor;
-}
-
-static int
-peditor_enum_int_from_string (GType type, const gchar *str, gboolean use_nick)
-{
- GEnumClass *klass;
- GEnumValue *val;
- int ret = -1;
-
- klass = g_type_class_ref (type);
- if (use_nick)
- val = g_enum_get_value_by_nick (klass, str);
- else
- val = g_enum_get_value_by_name (klass, str);
-
- g_type_class_unref (klass);
-
- if (val)
- ret = val->value;
-
- return ret;
-}
-
-static gchar*
-peditor_enum_string_from_int (GType type, const int index, gboolean use_nick)
-{
- GEnumClass *klass;
- GEnumValue *val;
- gchar *ret = NULL;
-
- klass = g_type_class_ref (type);
- val = g_enum_get_value (klass, index);
- if (val)
- {
- if (val->value_nick && use_nick)
- ret = g_strdup (val->value_nick);
- else
- ret = g_strdup (val->value_name);
- }
-
- g_type_class_unref (klass);
-
- return ret;
-}
-
-static GConfValue*
-peditor_enum_conv_to_widget (GConfPropertyEditor *peditor,
- const GConfValue *value)
-{
- GConfValue *ret;
- GConfPropertyEditorEnumData *data = peditor->p->data;
- int index;
-
- if (value->type == GCONF_VALUE_INT)
- return gconf_value_copy (value);
-
- ret = gconf_value_new (GCONF_VALUE_INT);
-
- index = peditor_enum_int_from_string (data->enum_type,
- gconf_value_get_string (value),
- data->use_nick);
-
- gconf_value_set_int (ret, index);
-
- return ret;
-}
-
-static GConfValue*
-peditor_enum_conv_from_widget (GConfPropertyEditor *peditor,
- const GConfValue *value)
-{
- GConfValue *ret;
- GConfPropertyEditorEnumData *data = peditor->p->data;
- gchar *str;
-
- if (value->type == GCONF_VALUE_STRING)
- return gconf_value_copy (value);
-
- ret = gconf_value_new (GCONF_VALUE_STRING);
- str = peditor_enum_string_from_int (data->enum_type,
- gconf_value_get_int (value),
- data->use_nick);
- gconf_value_set_string (ret, str);
- g_free (str);
-
- return ret;
-}
-
-static void
-peditor_select_menu_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- gtk_option_menu_set_history (GTK_OPTION_MENU (peditor->p->ui_control), gconf_value_get_int (value_wid));
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_select_menu_widget_changed (GConfPropertyEditor *peditor,
- GtkOptionMenu *option_menu)
-{
- GConfValue *value, *value_wid;
-
- if (!peditor->p->inited) return;
- value_wid = gconf_value_new (GCONF_VALUE_INT);
- gconf_value_set_int (value_wid, gtk_option_menu_get_history (option_menu));
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-GObject *
-gconf_peditor_new_select_menu (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *option_menu,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (option_menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_select_menu_value_changed,
- changeset,
- G_OBJECT (option_menu),
- first_property_name,
- var_args, NULL);
-
- va_end (var_args);
-
- g_signal_connect_swapped (G_OBJECT (option_menu), "changed",
- (GCallback) peditor_select_menu_widget_changed, peditor);
-
- return peditor;
-}
-
-GObject *
-gconf_peditor_new_select_menu_with_enum (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *option_menu,
- GType enum_type,
- gboolean use_nick,
- gchar *first_property_name,
- ...)
-{
- GConfPropertyEditor *peditor;
- GConfPropertyEditorEnumData *data;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (option_menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), NULL);
- g_return_val_if_fail (enum_type != G_TYPE_NONE, NULL);
-
- data = g_new0 (GConfPropertyEditorEnumData, 1);
- data->enum_type = enum_type;
- data->use_nick = use_nick;
-
- va_start (var_args, first_property_name);
-
- peditor = GCONF_PROPERTY_EDITOR (
- gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_select_menu_value_changed,
- changeset,
- G_OBJECT (option_menu),
- first_property_name,
- var_args,
- "conv-to-widget-cb",
- peditor_enum_conv_to_widget,
- "conv-from-widget-cb",
- peditor_enum_conv_from_widget,
- "data",
- data,
- "data-free-cb",
- g_free,
- NULL
- ));
-
- va_end (var_args);
-
- g_signal_connect_swapped (G_OBJECT (option_menu), "changed",
- (GCallback) peditor_select_menu_widget_changed, peditor);
-
- return G_OBJECT (peditor);
-}
-
-static void
-peditor_select_radio_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GSList *group, *link;
- GConfValue *value, *value_wid;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
- group = g_slist_reverse (group);
- link = g_slist_nth (group, gconf_value_get_int (value_wid));
- if (link && link->data)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (link->data), TRUE);
- gconf_value_free (value_wid);
- g_slist_free (group);
- }
-}
-
-static void
-peditor_select_radio_widget_changed (GConfPropertyEditor *peditor,
- GtkToggleButton *tb)
-{
- GSList *group;
- GConfValue *value, *value_wid;
-
- if (!peditor->p->inited) return;
- if (!tb->active) return;
-
- value_wid = gconf_value_new (GCONF_VALUE_INT);
- group = g_slist_copy (gtk_radio_button_get_group (GTK_RADIO_BUTTON (peditor->p->ui_control)));
- group = g_slist_reverse (group);
-
- gconf_value_set_int (value_wid, g_slist_index (group, tb));
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
-
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
-
- gconf_value_free (value_wid);
- gconf_value_free (value);
- g_slist_free (group);
-}
-
-GObject *
-gconf_peditor_new_select_radio (GConfChangeSet *changeset,
- gchar *key,
- GSList *radio_group,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- GtkRadioButton *first_button;
- GSList *item;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (radio_group != NULL, NULL);
- g_return_val_if_fail (radio_group->data != NULL, NULL);
- g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_group->data), NULL);
-
- first_button = GTK_RADIO_BUTTON (radio_group->data);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_select_radio_value_changed,
- changeset,
- G_OBJECT (first_button),
- first_property_name,
- var_args, NULL);
-
- va_end (var_args);
-
- for (item = radio_group; item != NULL; item = item->next)
- g_signal_connect_swapped (G_OBJECT (item->data), "toggled",
- (GCallback) peditor_select_radio_widget_changed, peditor);
-
- return peditor;
-}
-
-static void
-peditor_numeric_range_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
-
- switch (value_wid->type) {
- case GCONF_VALUE_FLOAT:
- gtk_adjustment_set_value (GTK_ADJUSTMENT (peditor->p->ui_control), gconf_value_get_float (value_wid));
- break;
- case GCONF_VALUE_INT:
- gtk_adjustment_set_value (GTK_ADJUSTMENT (peditor->p->ui_control), gconf_value_get_int (value_wid));
- break;
- default:
- g_warning ("Unknown type in range peditor: %d\n", value_wid->type);
- }
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor,
- GtkAdjustment *adjustment)
-{
- GConfValue *value, *value_wid, *default_value;
- GConfClient *client;
-
- if (!peditor->p->inited) return;
-
- /* We try to get the default type from the schemas. if not, we default
- * to a float.
- */
- client = gconf_client_get_default();
-
- default_value = gconf_client_get_default_from_schema (client,
- peditor->p->key,
- NULL);
- g_object_unref (client);
-
- if (default_value)
- value_wid = gconf_value_new (default_value->type);
- else {
- g_warning ("Unable to find a default value for key for %s.\n"
- "I'll assume it is an integer, but that may break things.\n"
- "Please be sure that the associated schema is installed",
- peditor->p->key);
- value_wid = gconf_value_new (GCONF_VALUE_INT);
- }
-
- gconf_value_free (default_value);
-
- g_assert (value_wid);
-
- if (value_wid->type == GCONF_VALUE_INT)
- gconf_value_set_int (value_wid, gtk_adjustment_get_value (adjustment));
- else if (value_wid->type == GCONF_VALUE_FLOAT)
- gconf_value_set_float (value_wid, gtk_adjustment_get_value (adjustment));
- else {
- g_warning ("unable to set a gconf key for %s of type %d\n",
- peditor->p->key,
- value_wid->type);
- gconf_value_free (value_wid);
- return;
- }
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-GObject *
-gconf_peditor_new_numeric_range (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *range,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- GObject *adjustment = NULL;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (range != NULL, NULL);
- g_return_val_if_fail (GTK_IS_RANGE (range)||GTK_IS_SPIN_BUTTON (range), NULL);
-
- if (GTK_IS_RANGE (range))
- adjustment = G_OBJECT (gtk_range_get_adjustment (GTK_RANGE (range)));
- else if (GTK_IS_SPIN_BUTTON (range))
- adjustment = G_OBJECT (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (range)));
- else
- g_assert_not_reached ();
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_numeric_range_value_changed,
- changeset,
- G_OBJECT (adjustment),
- first_property_name,
- var_args, NULL);
-
- va_end (var_args);
-
- g_signal_connect_swapped (adjustment, "value_changed",
- (GCallback) peditor_numeric_range_widget_changed, peditor);
-
- return peditor;
-}
-
-static gboolean
-guard_get_bool (GConfPropertyEditor *peditor, const GConfValue *value)
-{
- if (value->type == GCONF_VALUE_BOOL)
- return gconf_value_get_bool (value);
- else
- {
- GConfPropertyEditorEnumData *data = peditor->p->data;
- int index = peditor_enum_int_from_string (data->enum_type, gconf_value_get_string (value), data->use_nick);
- return (index != data->enum_val_false);
- }
-}
-
-static void
-guard_value_changed (GConfPropertyEditor *peditor,
- const gchar *key,
- const GConfValue *value,
- GtkWidget *widget)
-{
- gtk_widget_set_sensitive (widget, guard_get_bool (peditor, value));
-}
-
-void
-gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor,
- GtkWidget *widget)
-{
- GConfClient *client;
- GConfValue *value;
-
- g_return_if_fail (peditor != NULL);
- g_return_if_fail (IS_GCONF_PROPERTY_EDITOR (peditor));
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- client = gconf_client_get_default ();
-
- value = gconf_client_get (client, peditor->p->key, NULL);
- g_object_unref (client);
-
- if (value) {
- gtk_widget_set_sensitive (widget, guard_get_bool (peditor, value));
- gconf_value_free (value);
- } else {
- g_warning ("NULL GConf value: %s: possibly incomplete setup", peditor->p->key);
- }
-
- g_signal_connect (G_OBJECT (peditor), "value-changed", (GCallback) guard_value_changed, widget);
-}
-
-GConfValue *
-gconf_value_int_to_float (GConfPropertyEditor *ignored, const GConfValue *value)
-{
- GConfValue *new_value;
-
- new_value = gconf_value_new (GCONF_VALUE_FLOAT);
- gconf_value_set_float (new_value, gconf_value_get_int (value));
- return new_value;
-}
-
-GConfValue *
-gconf_value_float_to_int (GConfPropertyEditor *ignored, const GConfValue *value)
-{
- GConfValue *new_value;
-
- new_value = gconf_value_new (GCONF_VALUE_INT);
- gconf_value_set_int (new_value, gconf_value_get_float (value));
- return new_value;
-}
-
-static void
-peditor_font_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
- if (value != NULL) {
- const gchar *font;
-
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- font = gconf_value_get_string (value_wid);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (peditor->p->ui_control),
- font);
- gconf_value_free (value_wid);
- }
-}
-
-static void
-peditor_font_widget_changed (GConfPropertyEditor *peditor,
- GtkFontButton *font_button)
-{
- const gchar *font_name;
- GConfValue *value, *value_wid = NULL;
-
- if (!peditor->p->inited)
- return;
-
- font_name = gtk_font_button_get_font_name (font_button);
-
- value_wid = gconf_value_new (GCONF_VALUE_STRING);
- gconf_value_set_string (value_wid, font_name);
-
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
-
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
-
- gconf_value_free (value_wid);
- gconf_value_free (value);
-}
-
-GObject *
-gconf_peditor_new_font (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *font_button,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (GTK_IS_FONT_BUTTON (font_button), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new (key,
- (GConfClientNotifyFunc) peditor_font_value_changed,
- changeset,
- G_OBJECT (font_button),
- first_property_name,
- var_args,
- NULL);
-
- va_end (var_args);
-
- g_signal_connect_swapped (font_button, "font_set",
- (GCallback) peditor_font_widget_changed, peditor);
-
- return peditor;
-}
-
-static GConfValue*
-peditor_enum_toggle_conv_to_widget (GConfPropertyEditor *peditor,
- const GConfValue *value)
-{
- GConfValue *ret;
- GConfPropertyEditorEnumData *data = peditor->p->data;
- int index;
-
- if (value->type == GCONF_VALUE_BOOL)
- return gconf_value_copy (value);
-
- ret = gconf_value_new (GCONF_VALUE_BOOL);
-
- index = peditor_enum_int_from_string (data->enum_type,
- gconf_value_get_string (value),
- data->use_nick);
- gconf_value_set_bool (ret, (index != data->enum_val_false));
-
- return ret;
-}
-
-static GConfValue*
-peditor_enum_toggle_conv_from_widget (GConfPropertyEditor *peditor,
- const GConfValue *value)
-{
- GConfValue *ret;
- GConfPropertyEditorEnumData *data = peditor->p->data;
- gchar *str;
- int index;
-
- if (value->type == GCONF_VALUE_STRING)
- return gconf_value_copy (value);
-
- ret = gconf_value_new (GCONF_VALUE_STRING);
- if (gconf_value_get_bool (value))
- index = data->enum_val_true_fn (peditor, data->enum_val_true_fn_data);
- else
- index = data->enum_val_false;
-
- str = peditor_enum_string_from_int (data->enum_type, index, data->use_nick);
- gconf_value_set_string (ret, str);
- g_free (str);
-
- return ret;
-}
-
-GObject *
-gconf_peditor_new_enum_toggle (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *checkbox,
- GType enum_type,
- GConfPEditorGetValueFn val_true_fn,
- guint val_false,
- gboolean use_nick,
- gpointer data,
- gchar *first_property_name,
- ...)
-{
- GConfPropertyEditor *peditor;
- GConfPropertyEditorEnumData *enum_data;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (checkbox != NULL, NULL);
- g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (checkbox), NULL);
-
- enum_data = g_new0 (GConfPropertyEditorEnumData, 1);
- enum_data->enum_type = enum_type;
- enum_data->enum_val_true_fn = val_true_fn;
- enum_data->enum_val_true_fn_data = data;
- enum_data->enum_val_false = val_false;
- enum_data->use_nick = use_nick;
-
- va_start (var_args, first_property_name);
-
- peditor = GCONF_PROPERTY_EDITOR (
- gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_boolean_value_changed,
- changeset,
- G_OBJECT (checkbox),
- first_property_name,
- var_args,
- "conv-to-widget-cb",
- peditor_enum_toggle_conv_to_widget,
- "conv-from-widget-cb",
- peditor_enum_toggle_conv_from_widget,
- "data",
- enum_data,
- "data-free-cb",
- g_free,
- NULL));
-
- va_end (var_args);
-
- g_signal_connect_swapped (G_OBJECT (checkbox), "toggled",
- (GCallback) peditor_boolean_widget_changed, peditor);
-
- return G_OBJECT (peditor);
-}
-
-gboolean
-peditor_image_set_filename (GConfPropertyEditor *peditor, const gchar *filename)
-{
- GdkPixbuf *pixbuf = NULL;
- GtkImage *image = NULL;
- const int scale = 100;
- gchar *message = NULL;
- GList *l;
-
- /* NULL is not valid, however "" is, but not an error (it's
- * the default) */
- g_return_val_if_fail (filename != NULL, FALSE);
-
-
- if (!g_file_test (filename, G_FILE_TEST_EXISTS))
- {
- message = g_strdup_printf (_("Couldn't find the file '%s'.\n\nPlease make "
- "sure it exists and try again, "
- "or choose a different background picture."),
- filename);
-
- }
- else if (!(pixbuf = gdk_pixbuf_new_from_file_at_size (filename, scale, scale, NULL)))
- {
- message = g_strdup_printf (_("I don't know how to open the file '%s'.\n"
- "Perhaps it's "
- "a kind of picture that is not yet supported.\n\n"
- "Please select a different picture instead."),
- filename);
- }
-
- if (GTK_IS_IMAGE (GTK_BIN (peditor->p->ui_control)->child))
- image = GTK_IMAGE (GTK_BIN (peditor->p->ui_control)->child);
- else
- {
- for (l = gtk_container_get_children (GTK_CONTAINER (GTK_BIN (peditor->p->ui_control)->child)); l != NULL; l = l->next)
- {
- if (GTK_IS_IMAGE (l->data))
- image = GTK_IMAGE (l->data);
- else if (GTK_IS_LABEL (l->data) && message == NULL)
- {
- gchar *base = g_path_get_basename (filename);
- gtk_label_set_text (GTK_LABEL (l->data), base);
- g_free (base);
- }
- }
- }
-
- if (message)
- {
- if (peditor->p->inited)
- {
- GtkWidget *box;
-
- box = gtk_message_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- message);
- gtk_dialog_run (GTK_DIALOG (box));
- gtk_widget_destroy (box);
- } else {
- gtk_image_set_from_stock (image, GTK_STOCK_MISSING_IMAGE,
- GTK_ICON_SIZE_BUTTON);
- }
- g_free (message);
-
- return FALSE;
- }
-
- gtk_image_set_from_pixbuf (image, pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
-
- return TRUE;
-}
-
-void
-peditor_image_chooser_response_cb (GtkWidget *chooser,
- gint response,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
- gchar *filename;
-
- if (response == GTK_RESPONSE_CANCEL ||
- response == GTK_RESPONSE_DELETE_EVENT)
- {
- gtk_widget_destroy (chooser);
- return;
- }
-
- if (!peditor->p->inited)
- return;
-
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
- if (!(filename && peditor_image_set_filename (peditor, filename)))
- {
- g_free (filename);
- return;
- }
-
- value_wid = gconf_value_new (GCONF_VALUE_STRING);
- gconf_value_set_string (value_wid, filename);
- value = peditor->p->conv_from_widget_cb (peditor, value_wid);
-
- peditor_set_gconf_value (peditor, peditor->p->key, value);
- g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value);
-
- gconf_value_free (value_wid);
- gconf_value_free (value);
- g_free (filename);
- gtk_widget_destroy (chooser);
-}
-
-void
-peditor_image_chooser_update_preview_cb (GtkFileChooser *chooser,
- GtkImage *preview)
-{
- char *filename;
- GdkPixbuf *pixbuf = NULL;
- const int scale = 100;
-
- filename = gtk_file_chooser_get_preview_filename (chooser);
-
- if (filename != NULL && g_file_test (filename, G_FILE_TEST_IS_REGULAR))
- pixbuf = gdk_pixbuf_new_from_file_at_size (filename, scale, scale, NULL);
-
- gtk_image_set_from_pixbuf (preview, pixbuf);
-
- g_free (filename);
-
- if (pixbuf != NULL)
- gdk_pixbuf_unref (pixbuf);
-}
-
-void
-peditor_image_clicked_cb (GConfPropertyEditor *peditor, GtkButton *button)
-{
- GConfValue *value = NULL, *value_wid;
- const gchar *filename;
- GtkWidget *chooser, *toplevel, *preview, *preview_box;
-
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
- chooser = gtk_file_chooser_dialog_new (_("Please select an image."),
- GTK_IS_WINDOW (toplevel) ? GTK_WINDOW (toplevel)
- : NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- _("_Select"), GTK_RESPONSE_OK,
- NULL);
-
- preview = gtk_image_new ();
-
- preview_box = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (preview_box), preview, FALSE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (preview_box), 6);
-
- gtk_widget_show_all (preview_box);
- gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (chooser),
- preview_box);
- gtk_file_chooser_set_preview_widget_active (GTK_FILE_CHOOSER (chooser),
- TRUE);
-
- gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
- gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
- gtk_window_set_modal (GTK_WINDOW (chooser), TRUE);
-
- /* need the current filename */
- if (peditor->p->changeset)
- gconf_change_set_check_value (peditor->p->changeset, peditor->p->key, &value);
-
- if (value)
- {
- /* the one we got is not a copy */
- value = gconf_value_copy (value);
- }
- else
- {
- GConfClient *client = gconf_client_get_default ();
- value = gconf_client_get (client, peditor->p->key, NULL);
- g_object_unref (client);
- }
-
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- filename = gconf_value_get_string (value_wid);
-
- if (filename && strcmp (filename, ""))
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), filename);
-
- g_signal_connect (G_OBJECT (chooser), "update-preview",
- G_CALLBACK (peditor_image_chooser_update_preview_cb),
- preview);
- g_signal_connect (G_OBJECT (chooser), "response",
- G_CALLBACK (peditor_image_chooser_response_cb),
- peditor);
-
- if (gtk_grab_get_current ())
- gtk_grab_add (chooser);
-
- gtk_widget_show (chooser);
-
- gconf_value_free (value);
- gconf_value_free (value_wid);
-}
-
-static void
-peditor_image_value_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- GConfPropertyEditor *peditor)
-{
- GConfValue *value, *value_wid;
-
- if (peditor->p->changeset != NULL)
- gconf_change_set_remove (peditor->p->changeset, peditor->p->key);
-
- value = gconf_entry_get_value (entry);
-
- if (value != NULL) {
- const gchar *filename;
-
- value_wid = peditor->p->conv_to_widget_cb (peditor, value);
- filename = gconf_value_get_string (value_wid);
- peditor_image_set_filename (peditor, filename);
- gconf_value_free (value_wid);
- }
-}
-
-GObject *
-gconf_peditor_new_image (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *button,
- gchar *first_property_name,
- ...)
-{
- GObject *peditor;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (button != NULL, NULL);
- g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
-
- va_start (var_args, first_property_name);
-
- peditor = gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_image_value_changed,
- changeset,
- G_OBJECT (button),
- first_property_name,
- var_args, NULL);
-
- va_end (var_args);
-
- g_signal_connect_swapped (G_OBJECT (button), "clicked",
- (GCallback) peditor_image_clicked_cb, peditor);
-
- return peditor;
-}
-
-GObject *
-gconf_peditor_new_select_radio_with_enum (GConfChangeSet *changeset,
- gchar *key,
- GSList *radio_group,
- GType enum_type,
- gboolean use_nick,
- gchar *first_property_name,
- ...)
-{
- GConfPropertyEditor *peditor;
- GConfPropertyEditorEnumData *enum_data;
- GtkRadioButton *first_button;
- GSList *item;
- va_list var_args;
-
- g_return_val_if_fail (key != NULL, NULL);
- g_return_val_if_fail (radio_group != NULL, NULL);
- g_return_val_if_fail (radio_group->data != NULL, NULL);
- g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_group->data), NULL);
-
- enum_data = g_new0 (GConfPropertyEditorEnumData, 1);
- enum_data->enum_type = enum_type;
- enum_data->use_nick = use_nick;
-
- first_button = GTK_RADIO_BUTTON (radio_group->data);
-
- va_start (var_args, first_property_name);
-
- peditor = GCONF_PROPERTY_EDITOR (
- gconf_peditor_new
- (key,
- (GConfClientNotifyFunc) peditor_select_radio_value_changed,
- changeset,
- G_OBJECT (first_button),
- first_property_name,
- var_args,
- "conv-to-widget-cb",
- peditor_enum_conv_to_widget,
- "conv-from-widget-cb",
- peditor_enum_conv_from_widget,
- "data",
- enum_data,
- "data-free-cb",
- g_free,
- NULL));
-
- va_end (var_args);
-
- for (item = radio_group; item != NULL; item = item->next)
- g_signal_connect_swapped (G_OBJECT (item->data), "toggled",
- (GCallback) peditor_select_radio_widget_changed, peditor);
-
- return G_OBJECT (peditor);
-}
-
diff --git a/capplets/common/gconf-property-editor.h b/capplets/common/gconf-property-editor.h
deleted file mode 100644
index 8a39e02cb..000000000
--- a/capplets/common/gconf-property-editor.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- mode: c; style: linux -*- */
-
-/* gconf-property-editor.h
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Written by Bradford Hovinen <hovinen@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * 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.
- */
-
-#ifndef __GCONF_PROPERTY_EDITOR_H
-#define __GCONF_PROPERTY_EDITOR_H
-
-#include <gnome.h>
-#include <gconf/gconf-client.h>
-#include <gconf/gconf-changeset.h>
-
-G_BEGIN_DECLS
-
-#define GCONF_PROPERTY_EDITOR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gconf_property_editor_get_type (), GConfPropertyEditor)
-#define GCONF_PROPERTY_EDITOR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gconf_property_editor_get_type (), GConfPropertyEditorClass)
-#define IS_GCONF_PROPERTY_EDITOR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gconf_property_editor_get_type ())
-
-typedef struct _GConfPropertyEditor GConfPropertyEditor;
-typedef struct _GConfPropertyEditorClass GConfPropertyEditorClass;
-typedef struct _GConfPropertyEditorPrivate GConfPropertyEditorPrivate;
-
-typedef GConfValue *(*GConfPEditorValueConvFn) (GConfPropertyEditor *peditor, const GConfValue *);
-typedef int (*GConfPEditorGetValueFn) (GConfPropertyEditor *peditor, gpointer data);
-
-struct _GConfPropertyEditor
-{
- GObject parent;
-
- GConfPropertyEditorPrivate *p;
-};
-
-struct _GConfPropertyEditorClass
-{
- GObjectClass g_object_class;
-
- void (*value_changed) (GConfPropertyEditor *peditor, gchar *key, GConfValue *value);
-};
-
-GType gconf_property_editor_get_type (void);
-
-const gchar *gconf_property_editor_get_key (GConfPropertyEditor *peditor);
-GObject *gconf_property_editor_get_ui_control (GConfPropertyEditor *peditor);
-
-GObject *gconf_peditor_new_boolean (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *checkbox,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_enum_toggle (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *checkbox,
- GType enum_type,
- GConfPEditorGetValueFn val_true_fn,
- guint val_false,
- gboolean use_nick,
- gpointer data,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_integer (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *entry,
- gchar *first_property_name,
- ...);
-GObject *gconf_peditor_new_string (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *entry,
- gchar *first_property_name,
- ...);
-GObject *gconf_peditor_new_filename (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *file_entry,
- gchar *first_property_name,
- ...);
-GObject *gconf_peditor_new_color (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *color_entry,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_select_menu (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *option_menu,
- gchar *first_property_name,
- ...);
-
-
-GObject *gconf_peditor_new_select_menu_with_enum (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *option_menu,
- GType enum_type,
- gboolean use_nick,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_select_radio (GConfChangeSet *changeset,
- gchar *key,
- GSList *radio_group,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_select_radio_with_enum (GConfChangeSet *changeset,
- gchar *key,
- GSList *radio_group,
- GType enum_type,
- gboolean use_nick,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_numeric_range (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *range,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_font (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *font_button,
- gchar *first_property_name,
- ...);
-
-GObject *gconf_peditor_new_image (GConfChangeSet *changeset,
- gchar *key,
- GtkWidget *button,
- gchar *first_property,
- ...);
-
-void gconf_peditor_widget_set_guard (GConfPropertyEditor *peditor,
- GtkWidget *widget);
-
-/* some convenience callbacks to map int <-> float */
-GConfValue *gconf_value_int_to_float (GConfPropertyEditor *ignored, GConfValue const *value);
-GConfValue *gconf_value_float_to_int (GConfPropertyEditor *ignored, GConfValue const *value);
-
-G_END_DECLS
-
-#endif /* __GCONF_PROPERTY_EDITOR_H */
diff --git a/capplets/common/gnome-theme-apply.c b/capplets/common/gnome-theme-apply.c
deleted file mode 100644
index e11b25fa8..000000000
--- a/capplets/common/gnome-theme-apply.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- mode: C; c-basic-offset: 4 -*-
- * themus - utilities for GNOME themes
- * Copyright (C) 2002 Jonathan Blandford <aes@gnome.org>
- *
- * This library 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.1 of the License, or (at your option) any later version.
- *
- * This library 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 library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include <string.h>
-#include <gconf/gconf-client.h>
-#include <gnome-wm-manager.h>
-#include "gnome-theme-apply.h"
-
-#define GTK_THEME_KEY "/desktop/gnome/interface/gtk_theme"
-#define ICON_THEME_KEY "/desktop/gnome/interface/icon_theme"
-#define FONT_KEY "/desktop/gnome/interface/font_name"
-
-void
-gnome_meta_theme_set (GnomeThemeMetaInfo *meta_theme_info)
-{
- GConfClient *client;
- gchar *old_key;
- GnomeWindowManager *window_manager;
- GnomeWMSettings wm_settings;
-
- gnome_wm_manager_init ();
-
- window_manager = gnome_wm_manager_get_current (gdk_display_get_default_screen (gdk_display_get_default ()));
-
- client = gconf_client_get_default ();
-
- /* Set the gtk+ key */
- old_key = gconf_client_get_string (client, GTK_THEME_KEY, NULL);
- if (old_key && strcmp (old_key, meta_theme_info->gtk_theme_name))
- {
- gconf_client_set_string (client, GTK_THEME_KEY, meta_theme_info->gtk_theme_name, NULL);
- }
- g_free (old_key);
-
- /* Set the wm key */
- wm_settings.flags = GNOME_WM_SETTING_THEME;
- wm_settings.theme = meta_theme_info->metacity_theme_name;
- if (window_manager)
- gnome_window_manager_change_settings (window_manager, &wm_settings);
-
- /* set the icon theme */
- old_key = gconf_client_get_string (client, ICON_THEME_KEY, NULL);
- if (old_key && strcmp (old_key, meta_theme_info->icon_theme_name))
- {
- gconf_client_set_string (client, ICON_THEME_KEY, meta_theme_info->icon_theme_name, NULL);
- }
- g_free (old_key);
- g_object_unref (client);
-}
diff --git a/capplets/common/gnome-theme-apply.h b/capplets/common/gnome-theme-apply.h
deleted file mode 100644
index e1228dc7b..000000000
--- a/capplets/common/gnome-theme-apply.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* gnome-theme-info.h - GNOME Theme information
-
- Copyright (C) 2002 Jonathan Blandford <jrb@gnome.org>
- All rights reserved.
-
- This file is part of the Gnome Library.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-/*
- @NOTATION@
- */
-
-#ifndef THEME_APPLY_H
-#define THEME_APPLY_H
-
-#include "gnome-theme-info.h"
-
-void gnome_meta_theme_set (GnomeThemeMetaInfo *meta_theme_info);
-
-#endif /* THEME_APPLY_H */
diff --git a/capplets/common/gnome-theme-info.c b/capplets/common/gnome-theme-info.c
deleted file mode 100644
index d109a8658..000000000
--- a/capplets/common/gnome-theme-info.c
+++ /dev/null
@@ -1,1692 +0,0 @@
-#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-directory.h>
-#include <string.h>
-#include <libgnome/gnome-desktop-item.h>
-#include "gnome-theme-info.h"
-
-#define THEME_NAME "X-GNOME-Metatheme/Name"
-#define THEME_COMMENT "X-GNOME-Metatheme/Comment"
-#define GTK_THEME_KEY "X-GNOME-Metatheme/GtkTheme"
-#define METACITY_THEME_KEY "X-GNOME-Metatheme/MetacityTheme"
-#define SAWFISH_THEME_KEY "X-GNOME-Metatheme/SawfishTheme"
-#define ICON_THEME_KEY "X-GNOME-Metatheme/IconTheme"
-#define SOUND_THEME_KEY "X-GNOME-Metatheme/SoundTheme"
-#define APPLICATION_FONT_KEY "X-GNOME-Metatheme/ApplicationFont"
-#define BACKGROUND_IMAGE_KEY "X-GNOME-Metatheme/BackgroundImage"
-
-/* Terminology used in this lib:
- *
- * /usr/share/themes, ~/.themes -- top_theme_dir
- * top_theme_dir/theme_name/ -- common_theme_dir
- * /usr/share/icons, ~/.icons -- top_icon_theme_dir
- * top_icon_theme_dir/theme_name/ -- icon_common_theme_dir
- *
- */
-
-typedef struct _ThemeCallbackData
-{
- GFunc func;
- gpointer data;
-} ThemeCallbackData;
-
-typedef struct {
- GnomeVFSMonitorHandle *common_theme_dir_handle;
- GnomeVFSMonitorHandle *gtk2_dir_handle;
- GnomeVFSMonitorHandle *keybinding_dir_handle;
- GnomeVFSMonitorHandle *metacity_dir_handle;
- gint priority;
-} CommonThemeDirMonitorData;
-
-typedef struct {
- GnomeVFSMonitorHandle *common_icon_theme_dir_handle;
- gint priority;
-} CommonIconThemeDirMonitorData;
-
-typedef struct {
- GHashTable *handle_hash;
- gint priority;
-} CallbackTuple;
-
-
-/* Hash tables */
-
-/* The hashes_by_dir are indexed by an escaped uri of the common_theme_dir that
- * that particular theme is part of. The data pointed to by them is a
- * GnomeTheme{Meta,Icon,}Info struct. Note that the uri is of the form
- * "file:///home/username/.themes/foo", and not "/home/username/.themes/foo"
- */
-
-/* The hashes_by_name are hashed by the index of the theme. The data pointed to
- * by them is a GList whose data elements are GnomeTheme{Meta,Icon,}Info
- * structs. This is because a theme can be found both in the users ~/.theme as
- * well as globally in $prefix. All access to them must be done via helper
- * functions.
- */
-static GList *callbacks = NULL;
-
-static GHashTable *meta_theme_hash_by_uri;
-static GHashTable *meta_theme_hash_by_name;
-static GHashTable *icon_theme_hash_by_uri;
-static GHashTable *icon_theme_hash_by_name;
-static GHashTable *theme_hash_by_uri;
-static GHashTable *theme_hash_by_name;
-static gboolean initting = FALSE;
-
-/* prototypes */
-static gint safe_strcmp (gchar *a_str,
- gchar *b_str);
-static gint get_priority_from_data_by_hash (GHashTable *hash_table,
- gpointer data);
-static void add_data_to_hash_by_name (GHashTable *hash_table,
- gchar *name,
- gpointer data);
-static void remove_data_from_hash_by_name (GHashTable *hash_table,
- const gchar *name,
- gpointer data);
-static gpointer get_data_from_hash_by_name (GHashTable *hash_table,
- const gchar *name,
- gint priority);
-
-static GnomeThemeIconInfo *read_icon_theme (GnomeVFSURI *icon_theme_uri);
-static void handle_change_signal (GnomeThemeType type,
- gpointer theme,
- GnomeThemeChangeType change_type,
- GnomeThemeElement element);
-static void update_theme_index (GnomeVFSURI *index_uri,
- GnomeThemeElement key_element,
- gint priority);
-static void update_gtk2_index (GnomeVFSURI *gtk2_index_uri,
- gint priority);
-static void update_keybinding_index (GnomeVFSURI *keybinding_index_uri,
- gint priority);
-static void update_metacity_index (GnomeVFSURI *metacity_index_uri,
- gint priority);
-static void update_common_theme_dir_index (GnomeVFSURI *theme_index_uri,
- gboolean icon_theme,
- gint priority);
-static void update_meta_theme_index (GnomeVFSURI *meta_theme_index_uri,
- gint priority);
-static void update_icon_theme_index (GnomeVFSURI *icon_theme_index_uri,
- gint priority);
-static void gtk2_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static void keybinding_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static void metacity_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static void common_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static void common_icon_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static void top_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static void top_icon_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data);
-static GnomeVFSResult add_common_theme_dir_monitor (GnomeVFSURI *theme_dir_uri,
- gboolean *monitor_not_added,
- CommonThemeDirMonitorData *monitor_data,
- GError **error);
-static GnomeVFSResult add_common_icon_theme_dir_monitor (GnomeVFSURI *theme_dir_uri,
- gboolean *monitor_not_added,
- CommonIconThemeDirMonitorData *monitor_data,
- GError **error);
-static void remove_common_theme_dir_monitor (CommonThemeDirMonitorData *monitor_data);
-static void remove_common_icon_theme_dir_monitor (CommonIconThemeDirMonitorData *monitor_data);
-static GnomeVFSResult real_add_top_theme_dir_monitor (GnomeVFSURI *uri,
- gboolean *monitor_not_added,
- gint priority,
- gboolean icon_theme,
- GError **error);
-static GnomeVFSResult add_top_theme_dir_monitor (GnomeVFSURI *uri,
- gboolean *monitor_not_added,
- gint priority,
- GError **error);
-static GnomeVFSResult add_top_icon_theme_dir_monitor (GnomeVFSURI *uri,
- gboolean *monitor_not_added,
- gint priority,
- GError **error);
-
-/* private functions */
-static gint
-safe_strcmp (gchar *a_str,
- gchar *b_str)
-{
- if (a_str == NULL && b_str != NULL)
- return -1;
- if (a_str != NULL && b_str == NULL)
- return 1;
- if (a_str == NULL && b_str == NULL)
- return 0;
- return strcmp (a_str, b_str);
-}
-
-static gint
-get_priority_from_data_by_hash (GHashTable *hash_table,
- gpointer data)
-{
- gint theme_priority = 0;
- if (hash_table == meta_theme_hash_by_name)
- theme_priority = ((GnomeThemeMetaInfo *)data)->priority;
- else if (hash_table == icon_theme_hash_by_name)
- theme_priority = ((GnomeThemeIconInfo *)data)->priority;
- else if (hash_table == theme_hash_by_name)
- theme_priority = ((GnomeThemeInfo *)data)->priority;
- else
- g_assert_not_reached ();
-
- return theme_priority;
-}
-
-
-static void
-add_data_to_hash_by_name (GHashTable *hash_table,
- gchar *name,
- gpointer data)
-{
- GList *list;
-
- list = g_hash_table_lookup (hash_table, name);
- if (list == NULL)
- {
- list = g_list_append (list, data);
- }
- else
- {
- GList *list_ptr = list;
- gboolean added = FALSE;
- gint priority;
-
- priority = get_priority_from_data_by_hash (hash_table, data);
- while (list_ptr)
- {
- gint theme_priority;
-
- theme_priority = get_priority_from_data_by_hash (hash_table, list_ptr->data);
-
- if (theme_priority == priority)
- {
- /* Swap it in */
- list_ptr->data = data;
- added = TRUE;
- break;
- }
- if (theme_priority > priority)
- {
- list = g_list_insert_before (list, list_ptr, data);
- added = TRUE;
- break;
- }
- list_ptr = list_ptr->next;
- }
- if (! added)
- list = g_list_append (list, data);
- }
- g_hash_table_insert (hash_table, g_strdup (name), list);
-}
-
-static void
-remove_data_from_hash_by_name (GHashTable *hash_table,
- const gchar *name,
- gpointer data)
-{
- GList *list;
-
- list = g_hash_table_lookup (hash_table, name);
-
- list = g_list_remove (list, data);
- if (list == NULL)
- g_hash_table_remove (hash_table, name);
- else
- g_hash_table_insert (hash_table, g_strdup (name), list);
-
-}
-
-static gpointer
-get_data_from_hash_by_name (GHashTable *hash_table,
- const gchar *name,
- gint priority)
-{
- GList *list;
-
- list = g_hash_table_lookup (hash_table, name);
-
- /* -1 implies return the first one */
- if (priority == -1)
- {
- if (list)
- return list->data;
-
- return NULL;
- }
- while (list)
- {
- gint theme_priority ;
-
- theme_priority = get_priority_from_data_by_hash (hash_table, list->data);
-
- if (theme_priority == priority)
- return list->data;
-
- list = list->next;
- }
- return NULL;
-}
-
-GnomeThemeMetaInfo *
-gnome_theme_read_meta_theme (GnomeVFSURI *meta_theme_uri)
-{
- GnomeThemeMetaInfo *meta_theme_info;
- GnomeVFSURI *common_theme_dir_uri;
- GnomeDesktopItem *meta_theme_ditem;
- gchar *meta_theme_file;
- const gchar *str;
-
- meta_theme_file = gnome_vfs_uri_to_string (meta_theme_uri, GNOME_VFS_URI_HIDE_NONE);
- meta_theme_ditem = gnome_desktop_item_new_from_uri (meta_theme_file, 0, NULL);
- if (meta_theme_ditem == NULL)
- {
- g_free (meta_theme_file);
- return NULL;
- }
- common_theme_dir_uri = gnome_vfs_uri_get_parent (meta_theme_uri);
-
- meta_theme_info = gnome_theme_meta_info_new ();
- meta_theme_info->path = meta_theme_file;
- meta_theme_info->name = gnome_vfs_uri_extract_short_name (common_theme_dir_uri);
- gnome_vfs_uri_unref (common_theme_dir_uri);
- str = gnome_desktop_item_get_localestring (meta_theme_ditem, THEME_NAME);
-
- if (!str)
- {
- str = gnome_desktop_item_get_localestring (meta_theme_ditem, GNOME_DESKTOP_ITEM_NAME);
- if (!str) /* shouldn't reach */
- {
- gnome_theme_meta_info_free (meta_theme_info);
- return NULL;
- }
- }
-
- meta_theme_info->readable_name = g_strdup (str);
-
- str = gnome_desktop_item_get_localestring (meta_theme_ditem, THEME_COMMENT);
- if (str == NULL)
- str = gnome_desktop_item_get_localestring (meta_theme_ditem, GNOME_DESKTOP_ITEM_COMMENT);
- if (str != NULL)
- meta_theme_info->comment = g_strdup (str);
-
- str = gnome_desktop_item_get_string (meta_theme_ditem, GNOME_DESKTOP_ITEM_ICON);
- if (str != NULL)
- meta_theme_info->icon_file = g_strdup (str);
-
- str = gnome_desktop_item_get_string (meta_theme_ditem, GTK_THEME_KEY);
- if (str == NULL)
- {
- gnome_theme_meta_info_free (meta_theme_info);
- return NULL;
- }
- meta_theme_info->gtk_theme_name = g_strdup (str);
-
- str = gnome_desktop_item_get_string (meta_theme_ditem, METACITY_THEME_KEY);
- if (str == NULL)
- {
- gnome_theme_meta_info_free (meta_theme_info);
- return NULL;
- }
- meta_theme_info->metacity_theme_name = g_strdup (str);
-
- str = gnome_desktop_item_get_string (meta_theme_ditem, ICON_THEME_KEY);
- if (str == NULL)
- {
- gnome_theme_meta_info_free (meta_theme_info);
- return NULL;
- }
- meta_theme_info->icon_theme_name = g_strdup (str);
-
- str = gnome_desktop_item_get_string (meta_theme_ditem, APPLICATION_FONT_KEY);
- if (str != NULL)
- meta_theme_info->application_font = g_strdup (str);
-
- str = gnome_desktop_item_get_string (meta_theme_ditem, BACKGROUND_IMAGE_KEY);
- if (str != NULL)
- meta_theme_info->background_image = g_strdup (str);
-
- gnome_desktop_item_unref (meta_theme_ditem);
-
- return meta_theme_info;
-}
-
-static GnomeThemeIconInfo *
-read_icon_theme (GnomeVFSURI *icon_theme_uri)
-{
- GnomeThemeIconInfo *icon_theme_info;
- GnomeDesktopItem *icon_theme_ditem;
- char *icon_theme_file;
- const gchar *name;
- const gchar *hidden_theme_icon;
-
- icon_theme_file = gnome_vfs_uri_to_string (icon_theme_uri, GNOME_VFS_URI_HIDE_NONE);
- icon_theme_ditem = gnome_desktop_item_new_from_uri (icon_theme_file, 0, NULL);
- if (icon_theme_ditem == NULL)
- {
- g_free (icon_theme_file);
- return NULL;
- }
-
- name = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Name");
- if (name == NULL)
- {
- gnome_desktop_item_unref (icon_theme_ditem);
- g_free (icon_theme_file);
- return NULL;
- }
- hidden_theme_icon = gnome_desktop_item_get_string (icon_theme_ditem, "Icon Theme/Hidden");
-
- if (hidden_theme_icon == NULL ||
- strcmp (hidden_theme_icon, "false") == 0)
- {
- icon_theme_info = gnome_theme_icon_info_new ();
- icon_theme_info->name = g_strdup (name);
- icon_theme_info->path = icon_theme_file;
- }
- else
- {
- gnome_desktop_item_unref (icon_theme_ditem);
- return NULL;
- }
-
- gnome_desktop_item_unref (icon_theme_ditem);
-
- return icon_theme_info;
-}
-
-static void
-handle_change_signal (GnomeThemeType type,
- gpointer theme,
- GnomeThemeChangeType change_type,
- GnomeThemeElement element)
-{
-#ifdef DEBUG
- gchar *type_str = NULL;
- gchar *element_str = NULL;
-#endif
- gchar *uri = NULL;
- GList *list;
-
- if (initting)
- return;
-
- if (type == GNOME_THEME_TYPE_REGULAR)
- uri = g_strdup (((GnomeThemeInfo *)theme)->path);
- else if (type == GNOME_THEME_TYPE_METATHEME)
- uri = g_strdup (((GnomeThemeMetaInfo *)theme)->path);
- else if (type == GNOME_THEME_TYPE_ICON)
- uri = g_strdup (((GnomeThemeIconInfo *)theme)->path);
-
- for (list = callbacks; list; list = list->next)
- {
- ThemeCallbackData *callback_data = list->data;
- (* callback_data->func) (uri, callback_data->data);
- }
-
-#ifdef DEBUG
- if (change_type == GNOME_THEME_CHANGE_CREATED)
- type_str = "created";
- else if (change_type == GNOME_THEME_CHANGE_CHANGED)
- type_str = "changed";
- else if (change_type == GNOME_THEME_CHANGE_DELETED)
- type_str = "deleted";
-
- if (element & GNOME_THEME_GTK_2)
- element_str = "gtk-2";
- else if (element & GNOME_THEME_GTK_2_KEYBINDING)
- element_str = "keybinding";
- if (element & GNOME_THEME_METACITY)
- element_str = "metacity";
-
- if (type == GNOME_THEME_TYPE_REGULAR)
- {
- g_print ("theme \"%s\" has a theme of type %s (priority %d) has been %s\n",
- ((GnomeThemeInfo *) theme)->name,
- element_str,
- ((GnomeThemeInfo *) theme)->priority,
- type_str);
- }
- else if (type == GNOME_THEME_TYPE_METATHEME)
- {
- g_print ("meta theme \"%s\" (priority %d) has been %s\n",
- ((GnomeThemeMetaInfo *) theme)->name,
- ((GnomeThemeMetaInfo *) theme)->priority,
- type_str);
- }
- else if (type == GNOME_THEME_TYPE_ICON)
- {
- g_print ("icon theme \"%s\" (priority %d) has been %s\n",
- ((GnomeThemeIconInfo *) theme)->name,
- ((GnomeThemeIconInfo *) theme)->priority,
- type_str);
- }
-#endif
-}
-
-/* gtk2_index_uri should point to the gtkrc file that was modified */
-static void
-update_theme_index (GnomeVFSURI *index_uri,
- GnomeThemeElement key_element,
- gint priority)
-{
- GnomeVFSFileInfo *file_info;
- GnomeVFSResult result;
- gboolean theme_exists;
- GnomeThemeInfo *theme_info;
- GnomeVFSURI *parent;
- GnomeVFSURI *common_theme_dir_uri;
- gchar *common_theme_dir;
-
- /* First, we determine the new state of the file. We do no more
- * sophisticated a test than "files exists and is a file" */
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (index_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK && file_info->type == GNOME_VFS_FILE_TYPE_REGULAR)
- theme_exists = TRUE;
- else
- theme_exists = FALSE;
- gnome_vfs_file_info_unref (file_info);
-
- /* Next, we see what currently exists */
- parent = gnome_vfs_uri_get_parent (index_uri);
- common_theme_dir_uri = gnome_vfs_uri_get_parent (parent);
- common_theme_dir = gnome_vfs_uri_to_string (common_theme_dir_uri, GNOME_VFS_URI_HIDE_NONE);
-
- theme_info = g_hash_table_lookup (theme_hash_by_uri, common_theme_dir);
- if (theme_info == NULL)
- {
- if (theme_exists)
- {
- theme_info = gnome_theme_info_new ();
- theme_info->path = g_strdup (common_theme_dir);
- theme_info->name = gnome_vfs_uri_extract_short_name (common_theme_dir_uri);
- theme_info->priority = priority;
- if (key_element & GNOME_THEME_GTK_2)
- theme_info->has_gtk = TRUE;
- else if (key_element & GNOME_THEME_GTK_2_KEYBINDING)
- theme_info->has_keybinding = TRUE;
- else if (key_element & GNOME_THEME_METACITY)
- theme_info->has_metacity = TRUE;
-
- g_hash_table_insert (theme_hash_by_uri, g_strdup (common_theme_dir), theme_info);
- add_data_to_hash_by_name (theme_hash_by_name, theme_info->name, theme_info);
- handle_change_signal (GNOME_THEME_TYPE_REGULAR, theme_info, GNOME_THEME_CHANGE_CREATED, key_element);
- }
- }
- else
- {
- gboolean theme_used_to_exist = FALSE;
-
- if (key_element & GNOME_THEME_GTK_2)
- {
- theme_used_to_exist = theme_info->has_gtk;
- theme_info->has_gtk = theme_exists;
- }
- else if (key_element & GNOME_THEME_GTK_2_KEYBINDING)
- {
- theme_used_to_exist = theme_info->has_keybinding;
- theme_info->has_keybinding = theme_exists;
- }
- else if (key_element & GNOME_THEME_METACITY)
- {
- theme_used_to_exist = theme_info->has_metacity;
- theme_info->has_metacity = theme_exists;
- }
-
- if (!theme_info->has_metacity && !theme_info->has_keybinding && !theme_info->has_gtk)
- {
- g_hash_table_remove (theme_hash_by_uri, common_theme_dir);
- remove_data_from_hash_by_name (theme_hash_by_name, theme_info->name, theme_info);
- }
-
- if (theme_exists && theme_used_to_exist)
- {
- handle_change_signal (GNOME_THEME_TYPE_REGULAR, theme_info, GNOME_THEME_CHANGE_CHANGED, key_element);
- }
- else if (theme_exists && !theme_used_to_exist)
- {
- handle_change_signal (GNOME_THEME_TYPE_REGULAR, theme_info, GNOME_THEME_CHANGE_CREATED, key_element);
- }
- else if (! theme_exists && theme_used_to_exist)
- {
- handle_change_signal (GNOME_THEME_TYPE_REGULAR, theme_info, GNOME_THEME_CHANGE_DELETED, key_element);
- }
-
- if (!theme_info->has_metacity && !theme_info->has_keybinding && !theme_info->has_gtk)
- {
- gnome_theme_info_free (theme_info);
- }
- }
-
- g_free (common_theme_dir);
- gnome_vfs_uri_unref (parent);
- gnome_vfs_uri_unref (common_theme_dir_uri);
-}
-
-
-static void
-update_gtk2_index (GnomeVFSURI *gtk2_index_uri,
- gint priority)
-{
- update_theme_index (gtk2_index_uri, GNOME_THEME_GTK_2, priority);
-}
-
-static void
-update_keybinding_index (GnomeVFSURI *keybinding_index_uri,
- gint priority)
-{
- update_theme_index (keybinding_index_uri, GNOME_THEME_GTK_2_KEYBINDING, priority);
-}
-
-static void
-update_metacity_index (GnomeVFSURI *metacity_index_uri,
- gint priority)
-{
- update_theme_index (metacity_index_uri, GNOME_THEME_METACITY, priority);
-}
-
-static void
-update_common_theme_dir_index (GnomeVFSURI *theme_index_uri,
- gboolean icon_theme,
- gint priority)
-{
- GnomeVFSFileInfo *file_info;
- GnomeVFSResult result;
- gboolean theme_exists;
- gpointer theme_info;
- gpointer old_theme_info;
- GnomeVFSURI *common_theme_dir_uri;
- gchar *common_theme_dir;
- GHashTable *hash_by_uri;
- GHashTable *hash_by_name;
- gchar *name = NULL;
-
- if (icon_theme)
- {
- hash_by_uri = icon_theme_hash_by_uri;
- hash_by_name = icon_theme_hash_by_name;
- }
- else
- {
- hash_by_uri = meta_theme_hash_by_uri;
- hash_by_name = meta_theme_hash_by_name;
- }
- /* First, we determine the new state of the file. */
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (theme_index_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK && file_info->type == GNOME_VFS_FILE_TYPE_REGULAR)
- {
- /* It's an interesting file. Lets try to load it. */
- if (icon_theme)
- {
- theme_info = read_icon_theme (theme_index_uri);
- if (theme_info)
- {
- ((GnomeThemeIconInfo *) theme_info)->priority = priority;
- theme_exists = TRUE;
- }
- else
- {
- theme_exists = FALSE;
- }
- }
- else
- {
- theme_info = gnome_theme_read_meta_theme (theme_index_uri);
- if (theme_info)
- {
- ((GnomeThemeMetaInfo *) theme_info)->priority = priority;
- theme_exists = TRUE;
- }
- else
- {
- theme_exists = FALSE;
- }
- }
- }
- else
- {
- theme_info = NULL;
- theme_exists = FALSE;
- }
- gnome_vfs_file_info_unref (file_info);
-
- /* Next, we see what currently exists */
- common_theme_dir_uri = gnome_vfs_uri_get_parent (theme_index_uri);
- common_theme_dir = gnome_vfs_uri_to_string (common_theme_dir_uri, GNOME_VFS_URI_HIDE_NONE);
-
- old_theme_info = g_hash_table_lookup (hash_by_uri, common_theme_dir);
-
- if (theme_exists)
- {
- if (icon_theme)
- name = ((GnomeThemeIconInfo *)theme_info)->name;
- else
- name = ((GnomeThemeMetaInfo *)theme_info)->name;
- }
- if (old_theme_info == NULL)
- {
- if (theme_exists)
- {
- g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
- add_data_to_hash_by_name (hash_by_name, name, theme_info);
- handle_change_signal (icon_theme?GNOME_THEME_TYPE_ICON:GNOME_THEME_TYPE_METATHEME,
- theme_info, GNOME_THEME_CHANGE_CREATED, 0);
- }
- }
- else
- {
- if (theme_exists)
- {
- gint cmp;
-
- if (icon_theme)
- cmp = gnome_theme_icon_info_compare (theme_info, old_theme_info);
- else
- cmp = gnome_theme_meta_info_compare (theme_info, old_theme_info);
- if (cmp != 0)
- {
- g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
- add_data_to_hash_by_name (hash_by_name, name, theme_info);
- handle_change_signal (icon_theme?GNOME_THEME_TYPE_ICON:GNOME_THEME_TYPE_METATHEME,
- theme_info, GNOME_THEME_CHANGE_CHANGED, 0);
- if (icon_theme)
- gnome_theme_icon_info_free (old_theme_info);
- else
- gnome_theme_meta_info_free (old_theme_info);
- }
- else
- {
- if (icon_theme)
- gnome_theme_icon_info_free (theme_info);
- else
- gnome_theme_meta_info_free (theme_info);
- }
- }
- else
- {
- if (icon_theme)
- name = ((GnomeThemeIconInfo *)old_theme_info)->name;
- else
- name = ((GnomeThemeMetaInfo *)old_theme_info)->name;
-
- g_hash_table_remove (hash_by_uri, common_theme_dir);
- remove_data_from_hash_by_name (hash_by_name, name, old_theme_info);
- handle_change_signal (icon_theme?GNOME_THEME_TYPE_ICON:GNOME_THEME_TYPE_METATHEME,
- old_theme_info, GNOME_THEME_CHANGE_DELETED, 0);
- if (icon_theme)
- gnome_theme_icon_info_free (old_theme_info);
- else
- gnome_theme_meta_info_free (old_theme_info);
- }
- }
-
- g_free (common_theme_dir);
- gnome_vfs_uri_unref (common_theme_dir_uri);
-}
-
-static void
-update_meta_theme_index (GnomeVFSURI *meta_theme_index_uri,
- gint priority)
-{
- update_common_theme_dir_index (meta_theme_index_uri, FALSE, priority);
-}
-static void
-update_icon_theme_index (GnomeVFSURI *icon_theme_index_uri,
- gint priority)
-{
- update_common_theme_dir_index (icon_theme_index_uri, TRUE, priority);
-}
-
-static void
-gtk2_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSURI *gtk2_dir_uri;
- gchar *affected_file;
- CommonThemeDirMonitorData *monitor_data;
-
- monitor_data = user_data;
-
- gtk2_dir_uri = gnome_vfs_uri_new (info_uri);
- affected_file = gnome_vfs_uri_extract_short_name (gtk2_dir_uri);
-
- /* The only file we care about is gtkrc */
- if (strcmp (affected_file, "gtkrc"))
- {
- g_free (affected_file);
- gnome_vfs_uri_unref (gtk2_dir_uri);
- return;
- }
-
- update_gtk2_index (gtk2_dir_uri, monitor_data->priority);
-
- g_free (affected_file);
- gnome_vfs_uri_unref (gtk2_dir_uri);
-}
-
-
-static void
-keybinding_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSURI *keybinding_dir_uri;
- gchar *affected_file;
- CommonThemeDirMonitorData *monitor_data;
-
- monitor_data = user_data;
-
- keybinding_dir_uri = gnome_vfs_uri_new (info_uri);
- affected_file = gnome_vfs_uri_extract_short_name (keybinding_dir_uri);
-
- /* The only file we care about is gtkrc */
- if (strcmp (affected_file, "gtkrc"))
- {
- g_free (affected_file);
- gnome_vfs_uri_unref (keybinding_dir_uri);
- return;
- }
-
- update_keybinding_index (keybinding_dir_uri, monitor_data->priority);
-
- g_free (affected_file);
- gnome_vfs_uri_unref (keybinding_dir_uri);
-}
-
-static void
-metacity_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSURI *metacity_dir_uri;
- gchar *affected_file;
- CommonThemeDirMonitorData *monitor_data;
-
- monitor_data = user_data;
-
- metacity_dir_uri = gnome_vfs_uri_new (info_uri);
- affected_file = gnome_vfs_uri_extract_short_name (metacity_dir_uri);
-
- /* The only file we care about is gtkrc */
- if (strcmp (affected_file, "metacity-theme-1.xml"))
- {
- g_free (affected_file);
- gnome_vfs_uri_unref (metacity_dir_uri);
- return;
- }
-
- update_metacity_index (metacity_dir_uri, monitor_data->priority);
-
- g_free (affected_file);
- gnome_vfs_uri_unref (metacity_dir_uri);
-}
-
-static void
-common_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSURI *meta_theme_dir_uri;
- gchar *affected_file;
- CommonThemeDirMonitorData *monitor_data;
-
- monitor_data = user_data;
-
- meta_theme_dir_uri = gnome_vfs_uri_new (info_uri);
- affected_file = gnome_vfs_uri_extract_short_name (meta_theme_dir_uri);
-
- /* The only file we care about is index.theme */
- if (strcmp (affected_file, "index.theme"))
- {
- gnome_vfs_uri_unref (meta_theme_dir_uri);
- g_free (affected_file);
- return;
- }
-
- update_meta_theme_index (meta_theme_dir_uri, monitor_data->priority);
-
- g_free (affected_file);
- gnome_vfs_uri_unref (meta_theme_dir_uri);
-}
-
-static void
-common_icon_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSURI *icon_theme_dir_uri;
- gchar *affected_file;
- CommonIconThemeDirMonitorData *monitor_data;
-
- monitor_data = user_data;
-
- icon_theme_dir_uri = gnome_vfs_uri_new (info_uri);
- affected_file = gnome_vfs_uri_extract_short_name (icon_theme_dir_uri);
-
- /* The only file we care about is index.theme*/
- if (strcmp (affected_file, "index.theme"))
- {
- gnome_vfs_uri_unref (icon_theme_dir_uri);
- g_free (affected_file);
- return;
- }
- update_icon_theme_index (icon_theme_dir_uri, monitor_data->priority);
-
- g_free (affected_file);
- gnome_vfs_uri_unref (icon_theme_dir_uri);
-}
-
-static void
-top_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSResult result;
- CallbackTuple *tuple;
- GHashTable *handle_hash;
- CommonThemeDirMonitorData *monitor_data;
- GnomeVFSURI *common_theme_dir_uri;
- gint priority;
-
- common_theme_dir_uri = gnome_vfs_uri_new (info_uri);
- tuple = user_data;
- handle_hash = tuple->handle_hash;
- priority = tuple->priority;
-
- if (event_type == GNOME_VFS_MONITOR_EVENT_CREATED)
- {
- GnomeVFSFileInfo *file_info;
-
- monitor_data = g_new0 (CommonThemeDirMonitorData, 1);
- monitor_data->priority = priority;
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (common_theme_dir_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK && file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- {
- add_common_theme_dir_monitor (common_theme_dir_uri, NULL, monitor_data, NULL);
- g_hash_table_insert (handle_hash, g_strdup(file_info->name), monitor_data);
- }
- gnome_vfs_file_info_unref (file_info);
- }
- else if (event_type == GNOME_VFS_MONITOR_EVENT_DELETED)
- {
- gchar *name;
- CommonThemeDirMonitorData *monitor_data;
-
- name = gnome_vfs_uri_extract_short_name (common_theme_dir_uri);
- monitor_data = g_hash_table_lookup (handle_hash, name);
- if (monitor_data != NULL)
- {
- remove_common_theme_dir_monitor (monitor_data);
- g_hash_table_remove (handle_hash, name);
- g_free (monitor_data);
- }
- g_free (name);
- }
- gnome_vfs_uri_unref (common_theme_dir_uri);
-}
-
-static void
-top_icon_theme_dir_changed (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
-{
- GnomeVFSResult result;
- GHashTable *handle_hash;
- CallbackTuple *tuple;
- CommonIconThemeDirMonitorData *monitor_data;
- GnomeVFSURI *common_icon_theme_dir_uri;
- gint priority;
-
- common_icon_theme_dir_uri = gnome_vfs_uri_new (info_uri);
- tuple = user_data;
- handle_hash = tuple->handle_hash;
- priority = tuple->priority;
-
- if (event_type == GNOME_VFS_MONITOR_EVENT_CREATED)
- {
- GnomeVFSFileInfo *file_info;
-
- monitor_data = g_new0 (CommonIconThemeDirMonitorData, 1);
- monitor_data->priority = priority;
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (common_icon_theme_dir_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK && file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- {
- add_common_icon_theme_dir_monitor (common_icon_theme_dir_uri, NULL, monitor_data, NULL);
- g_hash_table_insert (handle_hash, g_strdup(file_info->name), monitor_data);
- }
- gnome_vfs_file_info_unref (file_info);
- }
- else if (event_type == GNOME_VFS_MONITOR_EVENT_DELETED)
- {
- gchar *name;
- CommonIconThemeDirMonitorData *monitor_data;
-
- name = gnome_vfs_uri_extract_short_name (common_icon_theme_dir_uri);
- monitor_data = g_hash_table_lookup (handle_hash, name);
- if (monitor_data != NULL)
- {
- remove_common_icon_theme_dir_monitor (monitor_data);
- g_hash_table_remove (handle_hash, name);
- g_free (monitor_data);
- }
- g_free (name);
- }
- gnome_vfs_uri_unref (common_icon_theme_dir_uri);
-}
-
-/* Add a monitor to a common_theme_dir.
- */
-static GnomeVFSResult
-add_common_theme_dir_monitor (GnomeVFSURI *theme_dir_uri,
- gboolean *monitor_not_added,
- CommonThemeDirMonitorData *monitor_data,
- GError **error)
-{
- GnomeVFSResult result;
- gchar *uri_string;
- gboolean real_monitor_not_added = FALSE;
- GnomeVFSURI *subdir;
- GnomeVFSURI *index_uri;
- GnomeVFSFileInfo *file_info;
-
- index_uri = gnome_vfs_uri_append_file_name (theme_dir_uri, "index.theme");
- update_meta_theme_index (index_uri, monitor_data->priority);
- gnome_vfs_uri_unref (index_uri);
-
- /* Add the handle for this directory */
- uri_string = gnome_vfs_uri_to_string (theme_dir_uri, GNOME_VFS_URI_HIDE_NONE);
- result = gnome_vfs_monitor_add (& (monitor_data->common_theme_dir_handle),
- uri_string,
- GNOME_VFS_MONITOR_DIRECTORY,
- common_theme_dir_changed,
- monitor_data);
- g_free (uri_string);
-
- if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
- real_monitor_not_added = TRUE;
- else if (result != GNOME_VFS_OK)
- return result;
-
- /* gtk-2 theme subdir */
- subdir = gnome_vfs_uri_append_path (theme_dir_uri, "gtk-2.0");
- file_info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (theme_dir_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK && file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- {
- index_uri = gnome_vfs_uri_append_file_name (subdir, "gtkrc");
- update_gtk2_index (index_uri, monitor_data->priority);
- gnome_vfs_uri_unref (index_uri);
- }
- uri_string = gnome_vfs_uri_to_string (subdir, GNOME_VFS_URI_HIDE_NONE);
- result = gnome_vfs_monitor_add (& (monitor_data->gtk2_dir_handle),
- uri_string,
- GNOME_VFS_MONITOR_DIRECTORY,
- gtk2_dir_changed,
- monitor_data);
- if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
- real_monitor_not_added = TRUE;
- g_free (uri_string);
- gnome_vfs_uri_unref (subdir);
-
- /* keybinding theme subdir */
- subdir = gnome_vfs_uri_append_path (theme_dir_uri, "gtk-2.0-key");
- gnome_vfs_file_info_clear (file_info);
- result = gnome_vfs_get_file_info_uri (theme_dir_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK && file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- {
- index_uri = gnome_vfs_uri_append_file_name (subdir, "gtkrc");
- update_keybinding_index (index_uri, monitor_data->priority);
- gnome_vfs_uri_unref (index_uri);
- }
- uri_string = gnome_vfs_uri_to_string (subdir, GNOME_VFS_URI_HIDE_NONE);
- result = gnome_vfs_monitor_add (& (monitor_data->keybinding_dir_handle),
- uri_string,
- GNOME_VFS_MONITOR_DIRECTORY,
- keybinding_dir_changed,
- monitor_data);
- if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
- real_monitor_not_added = TRUE;
- g_free (uri_string);
- gnome_vfs_uri_unref (subdir);
-
- /* metacity theme subdir */
- subdir = gnome_vfs_uri_append_path (theme_dir_uri, "metacity-1");
- gnome_vfs_file_info_clear (file_info);
- result = gnome_vfs_get_file_info_uri (theme_dir_uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
- {
- index_uri = gnome_vfs_uri_append_file_name (subdir, "metacity-theme-1.xml");
- update_metacity_index (index_uri, monitor_data->priority);
- gnome_vfs_uri_unref (index_uri);
- }
- uri_string = gnome_vfs_uri_to_string (subdir, GNOME_VFS_URI_HIDE_NONE);
- result = gnome_vfs_monitor_add (& (monitor_data->metacity_dir_handle),
- uri_string,
- GNOME_VFS_MONITOR_DIRECTORY,
- metacity_dir_changed,
- monitor_data);
- g_free (uri_string);
- if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
- real_monitor_not_added = TRUE;
- gnome_vfs_file_info_unref (file_info);
- gnome_vfs_uri_unref (subdir);
-
- if (monitor_not_added)
- *monitor_not_added = real_monitor_not_added;
-
- return GNOME_VFS_OK;
-}
-
-static GnomeVFSResult
-add_common_icon_theme_dir_monitor (GnomeVFSURI *theme_dir_uri,
- gboolean *monitor_not_added,
- CommonIconThemeDirMonitorData *monitor_data,
- GError **error)
-{
- GnomeVFSResult result;
- gchar *uri_string;
- gboolean real_monitor_not_added = FALSE;
- GnomeVFSURI *index_uri;
-
- /* Add the handle for this directory */
- index_uri = gnome_vfs_uri_append_file_name (theme_dir_uri, "index.theme");
- update_icon_theme_index (index_uri, monitor_data->priority);
- gnome_vfs_uri_unref (index_uri);
-
- uri_string = gnome_vfs_uri_to_string (theme_dir_uri, GNOME_VFS_URI_HIDE_NONE);
- result = gnome_vfs_monitor_add (& (monitor_data->common_icon_theme_dir_handle),
- uri_string,
- GNOME_VFS_MONITOR_DIRECTORY,
- common_icon_theme_dir_changed,
- monitor_data);
- g_free (uri_string);
-
- if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
- real_monitor_not_added = TRUE;
- else if (result != GNOME_VFS_OK)
- return result;
-
- if (monitor_not_added)
- *monitor_not_added = real_monitor_not_added;
-
- return GNOME_VFS_OK;
-}
-
-static void
-remove_common_theme_dir_monitor (CommonThemeDirMonitorData *monitor_data)
-{
- /* None of the possible errors here are interesting */
- gnome_vfs_monitor_cancel (monitor_data->common_theme_dir_handle);
- gnome_vfs_monitor_cancel (monitor_data->gtk2_dir_handle);
- gnome_vfs_monitor_cancel (monitor_data->keybinding_dir_handle);
- gnome_vfs_monitor_cancel (monitor_data->metacity_dir_handle);
-
-}
-
-static void
-remove_common_icon_theme_dir_monitor (CommonIconThemeDirMonitorData *monitor_data)
-{
- /* None of the possible errors here are interesting */
- gnome_vfs_monitor_cancel (monitor_data->common_icon_theme_dir_handle);
-}
-
-/* Add a monitor to a top dir. These monitors persist for the duration of the
- * lib.
- */
-static GnomeVFSResult
-real_add_top_theme_dir_monitor (GnomeVFSURI *uri,
- gboolean *monitor_not_added,
- gint priority,
- gboolean icon_theme,
- GError **error)
-{
- GnomeVFSMonitorHandle *monitor_handle = NULL;
- GnomeVFSDirectoryHandle *directory_handle = NULL;
- GnomeVFSResult result;
- GnomeVFSFileInfo *file_info;
- gchar *uri_string;
- CallbackTuple *tuple;
-
- /* handle_hash is a hash of common_theme_dir names to their monitor_data. We
- * use it to remove the monitor handles when a dir is removed.
- */
- tuple = g_new0 (CallbackTuple, 1);
- tuple->handle_hash = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, NULL);
- tuple->priority = priority;
-
- /* Check the URI */
- file_info = gnome_vfs_file_info_new ();
- gnome_vfs_get_file_info_uri (uri, file_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (file_info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) {
- gnome_vfs_file_info_unref (file_info);
- return GNOME_VFS_ERROR_NOT_A_DIRECTORY;
- }
- gnome_vfs_file_info_unref (file_info);
- /* Monitor the top directory */
- uri_string = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
-
- result = gnome_vfs_monitor_add (&monitor_handle,
- uri_string,
- GNOME_VFS_MONITOR_DIRECTORY,
- icon_theme?top_icon_theme_dir_changed:top_theme_dir_changed,
- tuple);
-
- g_free (uri_string);
-
- /* We can deal with NOT_SUPPORTED manually */
- if (result == GNOME_VFS_ERROR_NOT_SUPPORTED)
- *monitor_not_added = TRUE;
- else if (result != GNOME_VFS_OK)
- return result;
-
- /* Go through the directory to add monitoring */
- result = gnome_vfs_directory_open_from_uri (&directory_handle, uri, GNOME_VFS_FILE_INFO_DEFAULT);
- if (result != GNOME_VFS_OK)
- return result;
-
- file_info = gnome_vfs_file_info_new ();
- while (gnome_vfs_directory_read_next (directory_handle, file_info) == GNOME_VFS_OK)
- {
- GnomeVFSURI *theme_dir_uri;
- gpointer monitor_data;
-
- if (!(file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY || file_info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK)) {
- gnome_vfs_file_info_clear (file_info);
- continue;
- }
- if (file_info->name[0] == '.') {
- gnome_vfs_file_info_clear (file_info);
- continue;
- }
-
- /* Add the directory */
- theme_dir_uri = gnome_vfs_uri_append_path (uri, file_info->name);
- if (icon_theme)
- {
- monitor_data = g_new0 (CommonIconThemeDirMonitorData, 1);
- ((CommonIconThemeDirMonitorData *)monitor_data)->priority = priority;
- add_common_icon_theme_dir_monitor (theme_dir_uri, monitor_not_added, monitor_data, error);
- }
- else
- {
- monitor_data = g_new0 (CommonThemeDirMonitorData, 1);
- ((CommonThemeDirMonitorData *)monitor_data)->priority = priority;
- add_common_theme_dir_monitor (theme_dir_uri, monitor_not_added, monitor_data, error);
- }
-
-
- g_hash_table_insert (tuple->handle_hash, g_strdup(file_info->name), monitor_data);
- gnome_vfs_file_info_clear (file_info);
- gnome_vfs_uri_unref (theme_dir_uri);
- }
-
- gnome_vfs_file_info_unref (file_info);
- gnome_vfs_directory_close (directory_handle);
- if (result != GNOME_VFS_ERROR_EOF)
- return result;
-
- return GNOME_VFS_OK;
-}
-
-static GnomeVFSResult
-add_top_theme_dir_monitor (GnomeVFSURI *uri,
- gboolean *monitor_not_added,
- gint priority,
- GError **error)
-{
- return real_add_top_theme_dir_monitor (uri, monitor_not_added, priority, FALSE, error);
-}
-
-static GnomeVFSResult
-add_top_icon_theme_dir_monitor (GnomeVFSURI *uri,
- gboolean *monitor_not_added,
- gint priority,
- GError **error)
-{
- return real_add_top_theme_dir_monitor (uri, monitor_not_added, priority, TRUE, error);
-}
-
-/* Public functions */
-
-
-/* Generic Themes */
-GnomeThemeInfo *
-gnome_theme_info_new (void)
-{
- GnomeThemeInfo *theme_info;
-
- theme_info = g_new0 (GnomeThemeInfo, 1);
-
- return theme_info;
-}
-
-void
-gnome_theme_info_free (GnomeThemeInfo *theme_info)
-{
- g_free (theme_info->path);
- g_free (theme_info->name);
- g_free (theme_info);
-}
-
-GnomeThemeInfo *
-gnome_theme_info_find (const gchar *theme_name)
-{
- return get_data_from_hash_by_name (theme_hash_by_name, theme_name, -1);
-}
-
-
-struct GnomeThemeInfoHashData
-{
- gconstpointer user_data;
- GList *list;
-};
-
-static void
-gnome_theme_info_find_by_type_helper (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GList *list;
- GnomeThemeInfo *theme_info;
- struct GnomeThemeInfoHashData *hash_data = user_data;
- guint elements = GPOINTER_TO_INT (hash_data->user_data);
- gboolean add_theme = FALSE;
-
- list = value;
- theme_info = list->data;
-
- if (elements & GNOME_THEME_METACITY &&
- theme_info->has_metacity)
- add_theme = TRUE;
- if (elements & GNOME_THEME_GTK_2 &&
- theme_info->has_gtk)
- add_theme = TRUE;
- if (elements & GNOME_THEME_GTK_2_KEYBINDING &&
- theme_info->has_keybinding)
- add_theme = TRUE;
-
- if (add_theme)
- hash_data->list = g_list_prepend (hash_data->list, theme_info);
-}
-
-GList *
-gnome_theme_info_find_by_type (guint elements)
-{
- struct GnomeThemeInfoHashData data;
- data.user_data = GINT_TO_POINTER (elements);
- data.list = NULL;
-
- g_hash_table_foreach (theme_hash_by_name,
- gnome_theme_info_find_by_type_helper,
- &data);
-
- return data.list;
-}
-
-GnomeThemeInfo *
-gnome_theme_info_find_by_uri (const gchar *theme_uri)
-{
- g_return_val_if_fail (theme_uri != NULL, NULL);
-
- return g_hash_table_lookup (theme_hash_by_uri, theme_uri);
-}
-
-
-/* Icon themes */
-GnomeThemeIconInfo *
-gnome_theme_icon_info_new (void)
-{
- GnomeThemeIconInfo *icon_theme_info;
-
- icon_theme_info = g_new0 (GnomeThemeIconInfo, 1);
-
- return icon_theme_info;
-}
-
-void
-gnome_theme_icon_info_free (GnomeThemeIconInfo *icon_theme_info)
-{
- g_free (icon_theme_info->name);
- g_free (icon_theme_info->path);
- g_free (icon_theme_info);
-}
-
-GnomeThemeInfo *
-gnome_theme_icon_info_find (const gchar *icon_theme_name)
-{
- g_return_val_if_fail (icon_theme_name != NULL, NULL);
-
- return get_data_from_hash_by_name (icon_theme_hash_by_name, icon_theme_name, -1);
-
-}
-
-static void
-gnome_theme_icon_info_find_all_helper (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GList *list = value;
- struct GnomeThemeInfoHashData *hash_data;
-
- list = value;
- hash_data = user_data;
-
- hash_data->list = g_list_prepend (hash_data->list, list->data);
-}
-
-GList *
-gnome_theme_icon_info_find_all (void)
-{
-
- struct GnomeThemeInfoHashData data;
- data.list = NULL;
-
- g_hash_table_foreach (icon_theme_hash_by_name,
- gnome_theme_icon_info_find_all_helper,
- &data);
-
- return data.list;
-}
-
-
-gint
-gnome_theme_icon_info_compare (GnomeThemeIconInfo *a,
- GnomeThemeIconInfo *b)
-{
- gint cmp = 0;
-
- cmp = safe_strcmp (a->path, b->path);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->name, b->name);
- return cmp;
-}
-
-
-/* Meta themes*/
-GnomeThemeMetaInfo *
-gnome_theme_meta_info_new (void)
-{
- GnomeThemeMetaInfo *meta_theme_info;
-
- meta_theme_info = g_new0 (GnomeThemeMetaInfo, 1);
-
- return meta_theme_info;
-}
-
-void
-gnome_theme_meta_info_free (GnomeThemeMetaInfo *meta_theme_info)
-{
- g_free (meta_theme_info->path);
- g_free (meta_theme_info->readable_name);
- g_free (meta_theme_info->name);
- g_free (meta_theme_info->comment);
- g_free (meta_theme_info->application_font);
- g_free (meta_theme_info->background_image);
- g_free (meta_theme_info->gtk_theme_name);
- g_free (meta_theme_info->icon_theme_name);
- g_free (meta_theme_info->metacity_theme_name);
-
- g_free (meta_theme_info);
-}
-
-void
-gnome_theme_meta_info_print (GnomeThemeMetaInfo *meta_theme_info)
-{
- g_print ("path: %s\n", meta_theme_info->path);
- g_print ("readable_name: %s\n", meta_theme_info->readable_name);
- g_print ("name: %s\n", meta_theme_info->name);
- g_print ("comment: %s\n", meta_theme_info->comment);
- g_print ("icon_file: %s\n", meta_theme_info->icon_file);
- g_print ("gtk_theme_name: %s\n", meta_theme_info->gtk_theme_name);
- g_print ("metacity_theme_name: %s\n", meta_theme_info->metacity_theme_name);
- g_print ("icon_theme_name: %s\n", meta_theme_info->icon_theme_name);
- g_print ("sawfish_theme_name: %s\n", meta_theme_info->sawfish_theme_name);
- g_print ("sound_theme_name: %s\n", meta_theme_info->sound_theme_name);
- g_print ("application_font: %s\n", meta_theme_info->application_font);
- g_print ("background_image: %s\n", meta_theme_info->background_image);
-}
-
-GnomeThemeMetaInfo *
-gnome_theme_meta_info_find (const char *meta_theme_name)
-{
- g_return_val_if_fail (meta_theme_name != NULL, NULL);
-
- return get_data_from_hash_by_name (meta_theme_hash_by_name, meta_theme_name, -1);
-}
-
-GnomeThemeMetaInfo *
-gnome_theme_meta_info_find_by_uri (const char *theme_uri)
-{
- g_return_val_if_fail (theme_uri != NULL, NULL);
-
- return g_hash_table_lookup (meta_theme_hash_by_uri, theme_uri);
-}
-
-static void
-gnome_theme_meta_info_find_all_helper (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GList *list = value;
- struct GnomeThemeInfoHashData *hash_data = user_data;
-
- hash_data->list = g_list_prepend (hash_data->list, list->data);
-}
-
-GList *
-gnome_theme_meta_info_find_all (void)
-{
-
- struct GnomeThemeInfoHashData data;
- data.list = NULL;
-
- g_hash_table_foreach (meta_theme_hash_by_name,
- gnome_theme_meta_info_find_all_helper,
- &data);
-
- return data.list;
-}
-
-gint
-gnome_theme_meta_info_compare (GnomeThemeMetaInfo *a,
- GnomeThemeMetaInfo *b)
-{
- gint cmp = 0;
-
- cmp = safe_strcmp (a->path, b->path);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->readable_name, b->readable_name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->name, b->name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->comment, b->comment);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->icon_file, b->icon_file);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->gtk_theme_name, b->gtk_theme_name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->metacity_theme_name, b->metacity_theme_name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->icon_theme_name, b->icon_theme_name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->sawfish_theme_name, b->sawfish_theme_name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->sound_theme_name, b->sound_theme_name);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->application_font, b->application_font);
- if (cmp != 0) return cmp;
-
- cmp = safe_strcmp (a->background_image, b->background_image);
- return cmp;
-}
-
-void
-gnome_theme_info_register_theme_change (GFunc func,
- gpointer data)
-{
- ThemeCallbackData *callback_data;
-
- g_return_if_fail (func != NULL);
-
- callback_data = g_new0 (ThemeCallbackData, 1);
- callback_data->func = func;
- callback_data->data = data;
-
- callbacks = g_list_prepend (callbacks, callback_data);
-}
-
-void
-gnome_theme_init (gboolean *monitor_not_added)
-{
- GnomeVFSURI *top_theme_dir_uri;
- gchar *top_theme_dir_string;
- gboolean real_monitor_not_added = FALSE;
- static gboolean initted = FALSE;
- GnomeVFSResult result;
- const gchar *gtk_data_dir;
- if (initted)
- return;
-
- initting = TRUE;
-
- meta_theme_hash_by_uri = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- meta_theme_hash_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- icon_theme_hash_by_uri = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- icon_theme_hash_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- theme_hash_by_uri = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- theme_hash_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
-
- /* Add all the toplevel theme dirs. */
- /* $datadir/themes */
- top_theme_dir_string = gtk_rc_get_theme_dir ();
- top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
- result = add_top_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 1, NULL);
- g_free (top_theme_dir_string);
- gnome_vfs_uri_unref (top_theme_dir_uri);
-
- /* ~/.themes */
- top_theme_dir_string = g_build_filename (g_get_home_dir (), ".themes", NULL);
- top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
- g_free (top_theme_dir_string);
- if (!gnome_vfs_uri_exists (top_theme_dir_uri))
- gnome_vfs_make_directory_for_uri (top_theme_dir_uri, 0775);
- result = add_top_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 0, NULL);
- gnome_vfs_uri_unref (top_theme_dir_uri);
-
- /* The weird /usr/share/icons */
- top_theme_dir_uri = gnome_vfs_uri_new ("/usr/share/icons");
- if (!gnome_vfs_uri_exists (top_theme_dir_uri))
- gnome_vfs_make_directory_for_uri (top_theme_dir_uri, 0775);
- result = add_top_icon_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 2, NULL);
- gnome_vfs_uri_unref (top_theme_dir_uri);
-
- /* $datadir/icons */
- gtk_data_dir = g_getenv ("GTK_DATA_PREFIX");
- if (gtk_data_dir)
- {
- top_theme_dir_string = g_build_filename (gtk_data_dir, "share", "icons", NULL);
- }
- else
- {
- top_theme_dir_string = g_build_filename (INSTALL_PREFIX, "share", "icons", NULL);
- }
- top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
- g_free (top_theme_dir_string);
-
- if (!gnome_vfs_uri_exists (top_theme_dir_uri))
- gnome_vfs_make_directory_for_uri (top_theme_dir_uri, 0775);
- result = add_top_icon_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 1, NULL);
- gnome_vfs_uri_unref (top_theme_dir_uri);
-
- /* ~/.icons */
- top_theme_dir_string = g_build_filename (g_get_home_dir (), ".icons", NULL);
- top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
- g_free (top_theme_dir_string);
-
- if (!gnome_vfs_uri_exists (top_theme_dir_uri))
- gnome_vfs_make_directory_for_uri (top_theme_dir_uri, 0775);
- result = add_top_icon_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 0, NULL);
- gnome_vfs_uri_unref (top_theme_dir_uri);
-
- /* done */
- initted = TRUE;
- initting = FALSE;
-
- if (monitor_not_added)
- *monitor_not_added = real_monitor_not_added;
-}
-
-#if 0
-int
-main (int argc, char *argv[])
-{
- gtk_init (&argc, &argv);
- gnome_vfs_init ();
- gboolean monitor_not_added = FALSE;
-
- gnome_theme_init (&monitor_not_added);
-
- gtk_main ();
-
- return 0;
-}
-#endif
diff --git a/capplets/common/gnome-theme-info.h b/capplets/common/gnome-theme-info.h
deleted file mode 100644
index 245a52ef3..000000000
--- a/capplets/common/gnome-theme-info.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* gnome-theme-info.h - GNOME Theme information
-
- Copyright (C) 2002 Jonathan Blandford <jrb@gnome.org>
- All rights reserved.
-
- This file is part of the Gnome Library.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-/*
- @NOTATION@
- */
-
-#ifndef GNOME_THEME_INFO_H
-#define GNOME_THEME_INFO_H
-
-#include <glib.h>
-#include <libgnomevfs/gnome-vfs.h>
-
-
-typedef enum {
- GNOME_THEME_TYPE_METATHEME,
- GNOME_THEME_TYPE_ICON,
- GNOME_THEME_TYPE_REGULAR
-} GnomeThemeType;
-
-typedef enum {
- GNOME_THEME_CHANGE_CREATED,
- GNOME_THEME_CHANGE_DELETED,
- GNOME_THEME_CHANGE_CHANGED
-} GnomeThemeChangeType;
-
-
-typedef enum {
- GNOME_THEME_METACITY = 1 << 0,
- GNOME_THEME_GTK_2 = 1 << 1,
- GNOME_THEME_GTK_2_KEYBINDING = 1 << 2
-} GnomeThemeElement;
-
-
-typedef struct _GnomeThemeInfo GnomeThemeInfo;
-struct _GnomeThemeInfo
-{
- gchar *path;
- gchar *name;
- gint priority;
- guint has_gtk : 1;
- guint has_keybinding : 1;
- guint has_metacity : 1;
- guint user_writable : 1;
-};
-
-typedef struct _GnomeThemeIconInfo GnomeThemeIconInfo;
-struct _GnomeThemeIconInfo
-{
- gchar *path;
- gchar *name;
- gint priority;
-};
-
-typedef struct _GnomeThemeMetaInfo GnomeThemeMetaInfo;
-struct _GnomeThemeMetaInfo
-{
- gchar *path;
- gchar *name;
- gint priority;
- gchar *readable_name;
- gchar *comment;
- gchar *icon_file;
-
- gchar *gtk_theme_name;
- gchar *metacity_theme_name;
- gchar *icon_theme_name;
- gchar *sawfish_theme_name;
- gchar *sound_theme_name;
-
- gchar *application_font;
- gchar *background_image;
-};
-
-
-/* Generic Themes */
-GnomeThemeInfo *gnome_theme_info_new (void);
-void gnome_theme_info_free (GnomeThemeInfo *theme_info);
-GnomeThemeInfo *gnome_theme_info_find (const gchar *theme_name);
-GList *gnome_theme_info_find_by_type (guint elements);
-/* Expected to be in the form "file:///usr/share/..." */
-GnomeThemeInfo *gnome_theme_info_find_by_uri (const gchar *theme_uri);
-
-
-/* Icon Themes */
-GnomeThemeIconInfo *gnome_theme_icon_info_new (void);
-void gnome_theme_icon_info_free (GnomeThemeIconInfo *icon_theme_info);
-GnomeThemeInfo *gnome_theme_icon_info_find (const gchar *icon_theme_name);
-GList *gnome_theme_icon_info_find_all (void);
-gint gnome_theme_icon_info_compare (GnomeThemeIconInfo *a,
- GnomeThemeIconInfo *b);
-
-
-/* Meta themes*/
-GnomeThemeMetaInfo *gnome_theme_meta_info_new (void);
-void gnome_theme_meta_info_free (GnomeThemeMetaInfo *meta_theme_info);
-void gnome_theme_meta_info_print (GnomeThemeMetaInfo *meta_theme_info);
-GnomeThemeMetaInfo *gnome_theme_meta_info_find (const char *meta_theme_name);
-GnomeThemeMetaInfo *gnome_theme_meta_info_find_by_uri (const char *uri);
-GList *gnome_theme_meta_info_find_all (void);
-gint gnome_theme_meta_info_compare (GnomeThemeMetaInfo *a,
- GnomeThemeMetaInfo *b);
-GnomeThemeMetaInfo *gnome_theme_read_meta_theme (GnomeVFSURI *meta_theme_uri);
-
-/* Other */
-void gnome_theme_init (gboolean *monitor_not_added);
-void gnome_theme_info_register_theme_change (GFunc func,
- gpointer data);
-
-
-#endif /* GNOME_THEME_INFO_H */
diff --git a/capplets/common/gnome-theme-test.c b/capplets/common/gnome-theme-test.c
deleted file mode 100644
index 71b1cd852..000000000
--- a/capplets/common/gnome-theme-test.c
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-directory.h>
-#include <string.h>
-#include <libgnome/gnome-desktop-item.h>
-#include "gnome-theme-info.h"
-
-int
-main (int argc, char *argv[])
-{
- gboolean monitor_not_added = FALSE;
- GList *themes, *list;
-
- gtk_init (&argc, &argv);
- gnome_vfs_init ();
- gnome_theme_init (&monitor_not_added);
-
- themes = gnome_theme_meta_info_find_all ();
- if (themes == NULL)
- {
- g_print ("No meta themes were found.\n");
- }
- else
- {
- g_print ("%d meta themes were found:\n", g_list_length (themes));
- for (list = themes; list; list = list->next)
- {
- GnomeThemeMetaInfo *meta_theme_info;
-
- meta_theme_info = list->data;
- g_print ("\t%s\n", meta_theme_info->readable_name);
- }
- }
- g_list_free (themes);
-
- themes = gnome_theme_icon_info_find_all ();
- if (themes == NULL)
- {
- g_print ("No icon themes were found.\n");
- }
- else
- {
- g_print ("%d icon themes were found:\n", g_list_length (themes));
- for (list = themes; list; list = list->next)
- {
- GnomeThemeIconInfo *icon_theme_info;
-
- icon_theme_info = list->data;
- g_print ("\t%s\n", icon_theme_info->name);
- }
- }
- g_list_free (themes);
-
- themes = gnome_theme_info_find_by_type (GNOME_THEME_METACITY);
- if (themes == NULL)
- {
- g_print ("No metacity themes were found.\n");
- }
- else
- {
- g_print ("%d metacity themes were found:\n", g_list_length (themes));
- for (list = themes; list; list = list->next)
- {
- GnomeThemeInfo *theme_info;
-
- theme_info = list->data;
- g_print ("\t%s\n", theme_info->name);
- }
- }
- g_list_free (themes);
-
- themes = gnome_theme_info_find_by_type (GNOME_THEME_GTK_2);
- if (themes == NULL)
- {
- gchar *str;
-
- g_print ("No gtk-2 themes were found. The following directories were tested:\n");
- str = gtk_rc_get_theme_dir ();
- g_print ("\t%s\n", str);
- g_free (str);
- str = g_build_filename (g_get_home_dir (), ".themes", NULL);
- g_print ("\t%s\n", str);
- g_free (str);
- }
- else
- {
- g_print ("%d gtk-2 themes were found:\n", g_list_length (themes));
- for (list = themes; list; list = list->next)
- {
- GnomeThemeInfo *theme_info;
-
- theme_info = list->data;
- g_print ("\t%s\n", theme_info->name);
- }
- }
- g_list_free (themes);
-
- themes = gnome_theme_info_find_by_type (GNOME_THEME_GTK_2_KEYBINDING);
- if (themes == NULL)
- {
- g_print ("No keybinding themes were found.\n");
- }
- else
- {
- g_print ("%d keybinding themes were found:\n", g_list_length (themes));
- for (list = themes; list; list = list->next)
- {
- GnomeThemeInfo *theme_info;
-
- theme_info = list->data;
- g_print ("\t%s\n", theme_info->name);
- }
- }
- g_list_free (themes);
-
- gtk_main ();
-
- return 0;
-}
-
diff --git a/capplets/common/theme-thumbnail.c b/capplets/common/theme-thumbnail.c
deleted file mode 100644
index aa94b9671..000000000
--- a/capplets/common/theme-thumbnail.c
+++ /dev/null
@@ -1,623 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include <metacity-private/util.h>
-#include <metacity-private/theme.h>
-#include <metacity-private/theme-parser.h>
-#include <metacity-private/preview-widget.h>
-#include <signal.h>
-#include <errno.h>
-
-/* We have to #undef this as metacity #defines these. */
-#undef _
-#undef N_
-
-#include <libgnomeui/gnome-icon-theme.h>
-#include <config.h>
-
-#include "theme-thumbnail.h"
-#include "capplet-util.h"
-
-static gint child_pid;
-#define ICON_SIZE_WIDTH 150
-#define ICON_SIZE_HEIGHT 150
-
-typedef struct
-{
- gboolean set;
- GByteArray *data;
- gchar *meta_theme_name;
- ThemeThumbnailFunc func;
- gpointer user_data;
- GDestroyNotify destroy;
- GIOChannel *channel;
- guint watch_id;
-} ThemeThumbnailAsyncData;
-
-
-GHashTable *theme_hash = NULL;
-ThemeThumbnailAsyncData async_data;
-
-
-/* Protocol */
-
-/* Our protocol is pretty simple. The parent process will write four strings
- * (separated by a '\000') They are the widget theme, the wm theme, the icon
- * theme, and the font string. Then, it will wait for the child to write back
- * the data. The parent expects ICON_SIZE_WIDTH * ICON_SIZE_HEIGHT * 4 bytes of
- * information. After that, the child is ready for the next theme to render.
- */
-
-enum
-{
- READY_FOR_THEME,
- READING_CONTROL_THEME_NAME,
- READING_WM_THEME_NAME,
- READING_ICON_THEME_NAME,
- READING_APPLICATION_FONT,
- WRITING_PIXBUF_DATA
-};
-
-typedef struct
-{
- gint status;
- GByteArray *control_theme_name;
- GByteArray *wm_theme_name;
- GByteArray *icon_theme_name;
- GByteArray *application_font;
-} ThemeThumbnailData;
-
-int pipe_to_factory_fd[2];
-int pipe_from_factory_fd[2];
-
-static void
-fake_expose_widget (GtkWidget *widget,
- GdkPixmap *pixmap)
-{
- GdkWindow *tmp_window;
- GdkEventExpose event;
-
- event.type = GDK_EXPOSE;
- event.window = pixmap;
- event.send_event = FALSE;
- event.area = widget->allocation;
- event.region = NULL;
- event.count = 0;
-
- tmp_window = widget->window;
- widget->window = pixmap;
- gtk_widget_send_expose (widget, (GdkEvent *) &event);
- widget->window = tmp_window;
-}
-
-
-
-static void
-hbox_foreach (GtkWidget *widget,
- gpointer data)
-{
- gtk_widget_realize (widget);
- gtk_widget_map (widget);
- gtk_widget_ensure_style (widget);
- fake_expose_widget (widget, (GdkPixmap *) data);
-}
-
-static void
-create_image (ThemeThumbnailData *theme_thumbnail_data,
- GdkPixbuf *pixbuf)
-{
- GtkWidget *window;
- GtkWidget *preview;
- GtkWidget *align;
- GtkWidget *stock_button;
-
- GtkRequisition requisition;
- GtkAllocation allocation;
- GdkPixmap *pixmap;
- GdkVisual *visual;
- MetaFrameFlags flags;
- MetaTheme *theme = NULL;
- GtkSettings *settings;
- GtkIconTheme *icon_theme;
- GdkPixbuf *folder_icon;
- GtkIconInfo *folder_icon_info;
- const gchar *filename;
-
- settings = gtk_settings_get_default ();
- g_object_set (G_OBJECT (settings),
- "gtk-theme-name", (char *) theme_thumbnail_data->control_theme_name->data,
- "gtk-font-name", (char *) theme_thumbnail_data->application_font->data,
- NULL);
- theme = meta_theme_load ((char *) theme_thumbnail_data->wm_theme_name->data, NULL);
-
- flags = META_FRAME_ALLOWS_DELETE |
- META_FRAME_ALLOWS_MENU |
- META_FRAME_ALLOWS_MINIMIZE |
- META_FRAME_ALLOWS_MAXIMIZE |
- META_FRAME_ALLOWS_VERTICAL_RESIZE |
- META_FRAME_ALLOWS_HORIZONTAL_RESIZE |
- META_FRAME_HAS_FOCUS |
- META_FRAME_ALLOWS_SHADE |
- META_FRAME_ALLOWS_MOVE;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- preview = meta_preview_new ();
- gtk_container_add (GTK_CONTAINER (window), preview);
- gtk_widget_realize (window);
- gtk_widget_realize (preview);
- align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
- gtk_container_add (GTK_CONTAINER (preview), align);
- gtk_container_set_border_width (GTK_CONTAINER (align), 5);
- stock_button = gtk_button_new_from_stock (GTK_STOCK_OPEN);
- gtk_container_add (GTK_CONTAINER (align), stock_button);
-
- gtk_widget_show_all (preview);
- gtk_widget_realize (align);
- gtk_widget_realize (stock_button);
- gtk_widget_realize (GTK_BIN (stock_button)->child);
- gtk_widget_map (stock_button);
- gtk_widget_map (GTK_BIN (stock_button)->child);
-
- meta_preview_set_frame_flags (META_PREVIEW (preview), flags);
- meta_preview_set_theme (META_PREVIEW (preview), theme);
- meta_preview_set_title (META_PREVIEW (preview), "");
-
-
- gtk_window_set_default_size (GTK_WINDOW (window), ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
-
- gtk_widget_size_request (window, &requisition);
- allocation.x = 0;
- allocation.y = 0;
- allocation.width = ICON_SIZE_WIDTH;
- allocation.height = ICON_SIZE_HEIGHT;
- gtk_widget_size_allocate (window, &allocation);
- gtk_widget_size_request (window, &requisition);
-
- /* Create a pixmap */
- visual = gtk_widget_get_visual (window);
- pixmap = gdk_pixmap_new (NULL, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT, visual->depth);
- gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (window));
-
- /* Draw the window */
- gtk_widget_ensure_style (window);
- g_assert (window->style);
- g_assert (window->style->font_desc);
-
- fake_expose_widget (window, pixmap);
- fake_expose_widget (preview, pixmap);
- fake_expose_widget (stock_button, pixmap);
- gtk_container_foreach (GTK_CONTAINER (GTK_BIN (GTK_BIN (stock_button)->child)->child),
- hbox_foreach,
- pixmap);
- fake_expose_widget (GTK_BIN (stock_button)->child, pixmap);
-
-
- gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
-
- /* Handle the icon theme */
- icon_theme = gtk_icon_theme_new ();
- gtk_icon_theme_set_custom_theme (icon_theme, (char *) theme_thumbnail_data->icon_theme_name->data);
-
- /* Have to try both "folder" and "gnome-fs-directory" seems themes seem to use either name */
- folder_icon_info = gtk_icon_theme_lookup_icon (icon_theme, "folder", 48, GTK_ICON_LOOKUP_FORCE_SVG);
- if (folder_icon_info == NULL) {
- folder_icon_info = gtk_icon_theme_lookup_icon (icon_theme, "gnome-fs-directory", 48, GTK_ICON_LOOKUP_FORCE_SVG);
- }
-
- g_object_unref (icon_theme);
-
- filename = gtk_icon_info_get_filename (folder_icon_info);
-
- if (filename != NULL)
- {
- folder_icon = gdk_pixbuf_new_from_file (filename, NULL);
- }
- else
- {
- folder_icon = NULL;
- }
-
- gtk_icon_info_free (folder_icon_info);
-
- /* render the icon to the thumbnail */
- if (folder_icon)
- {
- gdk_pixbuf_composite (folder_icon,
- pixbuf,
- align->allocation.x + align->allocation.width - gdk_pixbuf_get_width (folder_icon) - 5,
- align->allocation.y + align->allocation.height - gdk_pixbuf_get_height (folder_icon) - 5,
- gdk_pixbuf_get_width (folder_icon),
- gdk_pixbuf_get_height (folder_icon),
- align->allocation.x + align->allocation.width - gdk_pixbuf_get_width (folder_icon) - 5,
- align->allocation.y + align->allocation.height - gdk_pixbuf_get_height (folder_icon) - 5,
- 1.0, 1.0, GDK_INTERP_BILINEAR, 255);
- g_object_unref (folder_icon);
- }
-}
-
-static void
-handle_bytes (const gchar *buffer,
- gint bytes_read,
- ThemeThumbnailData *theme_thumbnail_data)
-{
- const gchar *ptr;
- ptr = buffer;
-
- while (bytes_read > 0)
- {
- char *nil;
- switch (theme_thumbnail_data->status)
- {
- case READY_FOR_THEME:
- case READING_CONTROL_THEME_NAME:
- theme_thumbnail_data->status = READING_CONTROL_THEME_NAME;
- nil = memchr (ptr, '\000', bytes_read);
- if (nil == NULL)
- {
- g_byte_array_append (theme_thumbnail_data->control_theme_name, ptr, bytes_read);
- bytes_read = 0;
- }
- else
- {
- g_byte_array_append (theme_thumbnail_data->control_theme_name, ptr, nil - ptr + 1);
- bytes_read -= (nil - ptr + 1);
- ptr = nil + 1;
- theme_thumbnail_data->status = READING_WM_THEME_NAME;
- }
- break;
- case READING_WM_THEME_NAME:
- nil = memchr (ptr, '\000', bytes_read);
- if (nil == NULL)
- {
- g_byte_array_append (theme_thumbnail_data->wm_theme_name, ptr, bytes_read);
- bytes_read = 0;
- }
- else
- {
- g_byte_array_append (theme_thumbnail_data->wm_theme_name, ptr, nil - ptr + 1);
- bytes_read -= (nil - ptr + 1);
- ptr = nil + 1;
- theme_thumbnail_data->status = READING_ICON_THEME_NAME;
- }
- break;
- case READING_ICON_THEME_NAME:
- nil = memchr (ptr, '\000', bytes_read);
- if (nil == NULL)
- {
- g_byte_array_append (theme_thumbnail_data->icon_theme_name, ptr, bytes_read);
- bytes_read = 0;
- }
- else
- {
- g_byte_array_append (theme_thumbnail_data->icon_theme_name, ptr, nil - ptr + 1);
- bytes_read -= (nil - ptr + 1);
- ptr = nil + 1;
- theme_thumbnail_data->status = READING_APPLICATION_FONT;
- }
- break;
- case READING_APPLICATION_FONT:
- nil = memchr (ptr, '\000', bytes_read);
- if (nil == NULL)
- {
- g_byte_array_append (theme_thumbnail_data->application_font, ptr, bytes_read);
- bytes_read = 0;
- }
- else
- {
- g_byte_array_append (theme_thumbnail_data->application_font, ptr, nil - ptr + 1);
- bytes_read -= (nil - ptr + 1);
- ptr = nil + 1;
- theme_thumbnail_data->status = WRITING_PIXBUF_DATA;
- }
- break;
- default:
- g_assert_not_reached ();
- }
- }
-}
-
-static gboolean
-message_from_capplet (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
-{
- gchar buffer[1024];
- GIOStatus status;
- gsize bytes_read;
- GdkPixbuf *pixbuf;
- gint i, rowstride;
- char *pixels;
- ThemeThumbnailData *theme_thumbnail_data;
-
- theme_thumbnail_data = (ThemeThumbnailData *)data;
-
- status = g_io_channel_read_chars (source,
- buffer,
- 1024,
- &bytes_read,
- NULL);
-
- switch (status)
- {
- case G_IO_STATUS_NORMAL:
- handle_bytes (buffer, bytes_read, theme_thumbnail_data);
-
- if (theme_thumbnail_data->status == WRITING_PIXBUF_DATA)
- {
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
- create_image (theme_thumbnail_data, pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- for (i = 0; i < ICON_SIZE_HEIGHT; i ++)
- {
- write (pipe_from_factory_fd[1], pixels + (rowstride)*i, ICON_SIZE_WIDTH * gdk_pixbuf_get_n_channels (pixbuf));
- }
- g_object_unref (pixbuf);
- theme_thumbnail_data->status = READY_FOR_THEME;
- g_byte_array_set_size (theme_thumbnail_data->control_theme_name, 0);
- g_byte_array_set_size (theme_thumbnail_data->wm_theme_name, 0);
- g_byte_array_set_size (theme_thumbnail_data->icon_theme_name, 0);
- g_byte_array_set_size (theme_thumbnail_data->application_font, 0);
- }
- return TRUE;
- case G_IO_STATUS_AGAIN:
- return TRUE;
- case G_IO_STATUS_EOF:
- case G_IO_STATUS_ERROR:
- _exit (0);
- default:
- g_assert_not_reached ();
- }
-
- return TRUE;
-}
-
-static gboolean
-message_from_child (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
-{
-
- gchar buffer[1024];
- GIOStatus status;
- gsize bytes_read;
-
- if (async_data.set == FALSE)
- return TRUE;
-
- status = g_io_channel_read_chars (source,
- buffer,
- 1024,
- &bytes_read,
- NULL);
- switch (status)
- {
- case G_IO_STATUS_NORMAL:
- g_byte_array_append (async_data.data, buffer, bytes_read);
- if (async_data.data->len == ICON_SIZE_WIDTH * ICON_SIZE_HEIGHT * 4)
- {
- GdkPixbuf *pixbuf;
- GdkPixbuf *scaled_pixbuf;
- gchar *pixels;
- gint i, rowstride;
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- for (i = 0; i < ICON_SIZE_HEIGHT; i++)
- memcpy (pixels + rowstride * i, async_data.data->data + 4 * ICON_SIZE_WIDTH * i, ICON_SIZE_WIDTH * 4);
-
- scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf, ICON_SIZE_WIDTH/2, ICON_SIZE_HEIGHT/2, GDK_INTERP_BILINEAR);
- g_hash_table_insert (theme_hash, g_strdup(async_data.meta_theme_name), scaled_pixbuf);
- g_object_unref (pixbuf);
-
- (* async_data.func) (scaled_pixbuf, async_data.user_data);
- if (async_data.destroy)
- (* async_data.destroy) (async_data.user_data);
-
- /* Clean up async_data */
- g_free (async_data.meta_theme_name);
- g_source_remove (async_data.watch_id);
- g_io_channel_unref (async_data.channel);
-
- /* reset async_data */
- async_data.meta_theme_name = NULL;
- async_data.channel = NULL;
- async_data.func = NULL;
- async_data.user_data = NULL;
- async_data.destroy = NULL;
- async_data.set = FALSE;
- g_byte_array_set_size (async_data.data, 0);
- }
- return TRUE;
- case G_IO_STATUS_AGAIN:
- return TRUE;
-
- case G_IO_STATUS_EOF:
- case G_IO_STATUS_ERROR:
- return TRUE;
- default:
- g_assert_not_reached ();
- }
-
- return TRUE;
-}
-
-void
-theme_thumbnail_invalidate_cache (GnomeThemeMetaInfo *meta_theme_info)
-{
- gboolean success;
-
- success = g_hash_table_remove (theme_hash, meta_theme_info->name);
- printf ("Success is %d\n", success);
-}
-
-GdkPixbuf *
-generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info,
- gboolean clear_cache)
-{
- GdkPixbuf *retval = NULL;
- GdkPixbuf *pixbuf = NULL;
- gint i, rowstride;
- char *pixels;
-
- g_return_val_if_fail (async_data.set == FALSE, NULL);
-
- pixbuf = g_hash_table_lookup (theme_hash, meta_theme_info->name);
- if (pixbuf != NULL)
- {
- if (clear_cache)
- g_hash_table_remove (theme_hash, meta_theme_info->name);
- else
- return pixbuf;
- }
-
- if (!pipe_to_factory_fd[1] || !pipe_from_factory_fd[0])
- return NULL;
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
- write (pipe_to_factory_fd[1], meta_theme_info->gtk_theme_name, strlen (meta_theme_info->gtk_theme_name) + 1);
- write (pipe_to_factory_fd[1], meta_theme_info->metacity_theme_name, strlen (meta_theme_info->metacity_theme_name) + 1);
- write (pipe_to_factory_fd[1], meta_theme_info->icon_theme_name, strlen (meta_theme_info->icon_theme_name) + 1);
- if (meta_theme_info->application_font == NULL)
- write (pipe_to_factory_fd[1], "Sans 10", strlen ("Sans 10") + 1);
- else
- write (pipe_to_factory_fd[1], meta_theme_info->application_font, strlen (meta_theme_info->application_font) + 1);
-
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- for (i = 0; i < ICON_SIZE_HEIGHT; i++)
- {
- gint j = 0;
- gint bytes_read;
-
- do
- {
- bytes_read = read (pipe_from_factory_fd[0], pixels + (rowstride)*i + j, ICON_SIZE_WIDTH * gdk_pixbuf_get_n_channels (pixbuf) - j);
- if (bytes_read > 0)
- j += bytes_read;
- else if (bytes_read == 0)
- {
- g_warning ("Received EOF while reading thumbnail for gtk: '%s', metacity '%s', icon: '%s', font: '%s'\n",
- meta_theme_info->gtk_theme_name,
- meta_theme_info->metacity_theme_name,
- meta_theme_info->icon_theme_name,
- meta_theme_info->application_font ? meta_theme_info->application_font : "Sans 10");
- g_object_unref (pixbuf);
- close (pipe_to_factory_fd[1]);
- pipe_to_factory_fd[1] = 0;
- close (pipe_from_factory_fd[0]);
- pipe_from_factory_fd[0] = 0;
- return NULL;
- }
- }
- while (j < ICON_SIZE_WIDTH * gdk_pixbuf_get_n_channels (pixbuf));
- }
-
- retval = gdk_pixbuf_scale_simple (pixbuf, ICON_SIZE_WIDTH/2, ICON_SIZE_HEIGHT/2, GDK_INTERP_BILINEAR);
- g_object_unref (pixbuf);
-
- g_hash_table_insert (theme_hash, g_strdup (meta_theme_info->name), retval);
- return retval;
-}
-
-void
-generate_theme_thumbnail_async (GnomeThemeMetaInfo *meta_theme_info,
- ThemeThumbnailFunc func,
- gpointer user_data,
- GDestroyNotify destroy)
-{
- GdkPixbuf *pixbuf;
-
- g_return_if_fail (async_data.set == FALSE);
-
- pixbuf = g_hash_table_lookup (theme_hash, meta_theme_info->name);
- if (pixbuf != NULL)
- {
- (* func) (pixbuf, user_data);
- if (destroy)
- (* destroy) (user_data);
- return;
- }
-
- if (!pipe_to_factory_fd[1] || !pipe_from_factory_fd[0])
- {
- (* func) (NULL, user_data);
- if (destroy)
- (* destroy) (user_data);
- return;
- }
-
- if (async_data.channel == NULL)
- {
- async_data.channel = g_io_channel_unix_new (pipe_from_factory_fd[0]);
- g_io_channel_set_flags (async_data.channel, g_io_channel_get_flags (async_data.channel) |
- G_IO_FLAG_NONBLOCK, NULL);
- g_io_channel_set_encoding (async_data.channel, NULL, NULL);
- async_data.watch_id = g_io_add_watch (async_data.channel, G_IO_IN | G_IO_HUP, message_from_child, NULL);
- }
-
-
- async_data.set = TRUE;
- async_data.meta_theme_name = g_strdup (meta_theme_info->name);
- async_data.func = func;
- async_data.user_data = user_data;
- async_data.destroy = destroy;
-
- write (pipe_to_factory_fd[1], meta_theme_info->gtk_theme_name, strlen (meta_theme_info->gtk_theme_name) + 1);
- write (pipe_to_factory_fd[1], meta_theme_info->metacity_theme_name, strlen (meta_theme_info->metacity_theme_name) + 1);
- write (pipe_to_factory_fd[1], meta_theme_info->icon_theme_name, strlen (meta_theme_info->icon_theme_name) + 1);
- if (meta_theme_info->application_font == NULL)
- write (pipe_to_factory_fd[1], "Sans 10", strlen ("Sans 10") + 1);
- else
- write (pipe_to_factory_fd[1], meta_theme_info->application_font, strlen (meta_theme_info->application_font) + 1);
-}
-
-void
-theme_thumbnail_factory_init (int argc, char *argv[])
-{
- pipe (pipe_to_factory_fd);
- pipe (pipe_from_factory_fd);
-
- child_pid = fork ();
- if (child_pid == 0)
- {
- ThemeThumbnailData data;
- GIOChannel *channel;
-
- /* Child */
- gtk_init (&argc, &argv);
-
- close (pipe_to_factory_fd[1]);
- pipe_to_factory_fd[1] = 0;
- close (pipe_from_factory_fd[0]);
- pipe_from_factory_fd[0] = 0;
-
- data.status = READY_FOR_THEME;
- data.control_theme_name = g_byte_array_new ();
- data.wm_theme_name = g_byte_array_new ();
- data.icon_theme_name = g_byte_array_new ();
- data.application_font = g_byte_array_new ();
-
- channel = g_io_channel_unix_new (pipe_to_factory_fd[0]);
- g_io_channel_set_flags (channel, g_io_channel_get_flags (channel) |
- G_IO_FLAG_NONBLOCK, NULL);
- g_io_channel_set_encoding (channel, NULL, NULL);
- g_io_add_watch (channel, G_IO_IN | G_IO_HUP, message_from_capplet, &data);
- g_io_channel_unref (channel);
-
- gtk_main ();
- _exit (0);
- }
-
- g_assert (child_pid > 0);
-
- /* Parent */
- close (pipe_to_factory_fd[0]);
- close (pipe_from_factory_fd[1]);
- async_data.set = FALSE;
- async_data.meta_theme_name = NULL;
- async_data.data = g_byte_array_new ();
-
- theme_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
-}
diff --git a/capplets/common/theme-thumbnail.h b/capplets/common/theme-thumbnail.h
deleted file mode 100644
index 9b86a51cf..000000000
--- a/capplets/common/theme-thumbnail.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __THEME_THUMBNAIL_H__
-#define __THEME_THUMBNAIL_H__
-
-
-#include <gtk/gtk.h>
-#include "gnome-theme-info.h"
-
-typedef void (* ThemeThumbnailFunc) (GdkPixbuf *pixbuf,
- gpointer data);
-
-
-GdkPixbuf *generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info,
- gboolean clear_cache);
-void generate_theme_thumbnail_async (GnomeThemeMetaInfo *meta_theme_info,
- ThemeThumbnailFunc func,
- gpointer data,
- GDestroyNotify destroy);
-void theme_thumbnail_invalidate_cache (GnomeThemeMetaInfo *meta_theme_info);
-void theme_thumbnail_factory_init (int argc,
- char *argv[]);
-
-
-
-#endif /* __THEME_THUMBNAIL_H__ */
diff --git a/capplets/common/wm-common.c b/capplets/common/wm-common.c
deleted file mode 100644
index c8ddf462d..000000000
--- a/capplets/common/wm-common.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include <X11/Xatom.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdk.h>
-#include <string.h>
-#include <glib.h>
-#include <glib-object.h>
-#include "wm-common.h"
-
-typedef struct _WMCallbackData
-{
- GFunc func;
- gpointer data;
-} WMCallbackData;
-
-/* Our WM Window */
-static Window wm_window = None;
-
-char*
-wm_common_get_current_window_manager (void)
-{
- Atom utf8_string, atom, type;
- int result;
- char *retval;
- int format;
- gulong nitems;
- gulong bytes_after;
- guchar *val;
-
- if (wm_window == None)
- return WM_COMMON_UNKNOWN;
-
- utf8_string = XInternAtom (GDK_DISPLAY (), "UTF8_STRING", False);
- atom = XInternAtom (GDK_DISPLAY (), "_NET_WM_NAME", False);
-
- gdk_error_trap_push ();
-
- result = XGetWindowProperty (GDK_DISPLAY (),
- wm_window,
- atom,
- 0, G_MAXLONG,
- False, utf8_string,
- &type, &format, &nitems,
- &bytes_after, (guchar **)&val);
-
- if (gdk_error_trap_pop () || result != Success)
- return WM_COMMON_UNKNOWN;
-
- if (type != utf8_string ||
- format !=8 ||
- nitems == 0)
- {
- if (val)
- XFree (val);
- return WM_COMMON_UNKNOWN;
- }
-
- if (!g_utf8_validate (val, nitems, NULL))
- {
- XFree (val);
- return WM_COMMON_UNKNOWN;
- }
-
- retval = g_strndup (val, nitems);
-
- XFree (val);
-
- return retval;
-}
-
-static void
-update_wm_window (void)
-{
- Window *xwindow;
- Atom type;
- gint format;
- gulong nitems;
- gulong bytes_after;
-
- XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
- XInternAtom (GDK_DISPLAY (), "_NET_SUPPORTING_WM_CHECK", False),
- 0, G_MAXLONG, False, XA_WINDOW, &type, &format,
- &nitems, &bytes_after, (guchar **) &xwindow);
-
- if (type != XA_WINDOW)
- {
- wm_window = None;
- return;
- }
-
- gdk_error_trap_push ();
- XSelectInput (GDK_DISPLAY (), *xwindow, StructureNotifyMask | PropertyChangeMask);
- XSync (GDK_DISPLAY (), False);
-
- if (gdk_error_trap_pop ())
- {
- XFree (xwindow);
- wm_window = None;
- return;
- }
-
- wm_window = *xwindow;
- XFree (xwindow);
-}
-
-static GdkFilterReturn
-wm_window_event_filter (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
-{
- WMCallbackData *ncb_data = (WMCallbackData*) data;
- XEvent *xevent = (XEvent *)xev;
-
- if ((xevent->type == DestroyNotify &&
- wm_window != None && xevent->xany.window == wm_window) ||
- (xevent->type == PropertyNotify &&
- xevent->xany.window == GDK_ROOT_WINDOW () &&
- xevent->xproperty.atom == (XInternAtom (GDK_DISPLAY (), "_NET_SUPPORTING_WM_CHECK", False))) ||
- (xevent->type == PropertyNotify &&
- wm_window != None && xevent->xany.window == wm_window &&
- xevent->xproperty.atom == (XInternAtom (GDK_DISPLAY (), "_NET_WM_NAME", False))))
- {
- update_wm_window ();
- (* ncb_data->func) ((gpointer)wm_common_get_current_window_manager(),
- ncb_data->data);
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-void
-wm_common_register_window_manager_change (GFunc func,
- gpointer data)
-{
- WMCallbackData *ncb_data;
-
- ncb_data = g_new0 (WMCallbackData, 1);
-
- ncb_data->func = func;
- ncb_data->data = data;
-
- gdk_window_add_filter (NULL, wm_window_event_filter, ncb_data);
-
- update_wm_window ();
-
- XSelectInput (GDK_DISPLAY (), GDK_ROOT_WINDOW (), PropertyChangeMask);
- XSync (GDK_DISPLAY (), False);
-}
-
-
diff --git a/capplets/common/wm-common.h b/capplets/common/wm-common.h
deleted file mode 100644
index 08c7145d0..000000000
--- a/capplets/common/wm-common.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef WM_COMMON_H
-#define WM_COMMON_H
-
-#define WM_COMMON_METACITY "Metacity"
-#define WM_COMMON_SAWFISH "Sawfish"
-#define WM_COMMON_UNKNOWN "Unknown"
-
-gchar *wm_common_get_current_window_manager (void);
-void wm_common_register_window_manager_change (GFunc func,
- gpointer data);
-
-#endif /* WM_COMMON_H */
-
diff --git a/capplets/common/wrapper-script.in b/capplets/common/wrapper-script.in
deleted file mode 100644
index 15de09ddd..000000000
--- a/capplets/common/wrapper-script.in
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-if test "x$#" = "x0"
-then
- @BINDIR@/gnomecc --run-capplet @CAPPLET_NAME@
-else
- @BINDIR@/@CAPPLET_NAME@-control $@
-fi
-