Remove libsounds and esound usage, check for libcanberra instead (Closes:

2008-07-28  Bastien Nocera  <hadess@hadess.net>

	* Makefile.am:
	* configure.in: Remove libsounds and esound usage, check for
	libcanberra instead (Closes: #542979)

2008-07-28  Bastien Nocera  <hadess@hadess.net>

	* theme-util.c:
	* theme-util.h: Remove the directory deletion helpers, and
	move them to the common sub-directory

2008-07-28  Bastien Nocera  <hadess@hadess.net>

	* Makefile.am:
	* capplet-util.c (directory_delete_recursive),
	(capplet_file_delete_recursive):
	* capplet-util.h: Move directory deletion helper function
	from the appearance capplet into a common directory

2008-07-28  Bastien Nocera  <hadess@hadess.net>

	* Makefile.am:
	* sound-properties-capplet.c (create_dialog), (setup_dialog),
	(get_legacy_settings):
	* sound-properties.glade:
	* sound-theme-definition.h:
	* sound-theme-file-utils.[ch]:
	* sound-theme.[ch]: Remove separate bell settings tab, remove
	libsounds dependency, add freedesktop sound theme support through
	libcanberra (Closes: #542979)


svn path=/trunk/; revision=8802
This commit is contained in:
Bastien Nocera 2008-07-27 23:32:35 +00:00 committed by Bastien Nocera
parent 16ad9834ca
commit 2cac70eea3
17 changed files with 1743 additions and 381 deletions

View file

@ -1,3 +1,9 @@
2008-07-28 Bastien Nocera <hadess@hadess.net>
* Makefile.am:
* configure.in: Remove libsounds and esound usage, check for
libcanberra instead (Closes: #542979)
Thu Jul 24 15:34:50 2008 Søren Sandmann <sandmann@redhat.com>
* configure.in

View file

@ -1,3 +1,9 @@
2008-07-28 Bastien Nocera <hadess@hadess.net>
* theme-util.c:
* theme-util.h: Remove the directory deletion helpers, and
move them to the common sub-directory
2008-07-20 Jens Granseuer <jensgr@gmx.net>
* theme-util.c: (theme_delete): don't delete ~/.icons when deleting

View file

@ -28,67 +28,6 @@
#include "theme-util.h"
static gboolean
directory_delete_recursive (GFile *directory, GError **error)
{
GFileEnumerator *enumerator;
GFileInfo *info;
gboolean success = TRUE;
enumerator = g_file_enumerate_children (directory,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, error);
if (enumerator == NULL)
return FALSE;
while (success &&
(info = g_file_enumerator_next_file (enumerator, NULL, NULL))) {
GFile *child;
child = g_file_get_child (directory, g_file_info_get_name (info));
if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
success = directory_delete_recursive (child, error);
}
g_object_unref (info);
if (success)
success = g_file_delete (child, NULL, error);
}
g_file_enumerator_close (enumerator, NULL, NULL);
if (success)
success = g_file_delete (directory, NULL, error);
return success;
}
gboolean
file_delete_recursive (GFile *file, GError **error)
{
GFileInfo *info;
GFileType type;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, error);
if (info == NULL)
return FALSE;
type = g_file_info_get_file_type (info);
g_object_unref (info);
if (type == G_FILE_TYPE_DIRECTORY)
return directory_delete_recursive (file, error);
else
return g_file_delete (file, NULL, error);
}
gboolean
theme_is_writable (const gpointer theme)
{

View file

@ -61,4 +61,4 @@ gboolean theme_find_in_model (GtkTreeModel *model, const gchar *name, GtkTreeIte
void theme_install_file (GtkWindow *parent, const gchar *path);
gboolean packagekit_available (void);
gboolean file_delete_recursive (GFile *directory, GError **error);

View file

@ -1,3 +1,11 @@
2008-07-28 Bastien Nocera <hadess@hadess.net>
* Makefile.am:
* capplet-util.c (directory_delete_recursive),
(capplet_file_delete_recursive):
* capplet-util.h: Move directory deletion helper function
from the appearance capplet into a common directory
2008-07-15 Matthias Clasen <mclasen@redhat.com>
Bug 533611 - add notification themes to the metatheme format
@ -1827,7 +1835,7 @@ Sun Jan 6 02:52:59 2002 Jonathan Blandford <jrb@redhat.com>
(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>
2001-07-14 Carlos Perello Marin <carlos@gnome-db.org>
* .cvsignore: ssshhhh

View file

@ -11,7 +11,8 @@ INCLUDES = \
$(DBUS_CFLAGS) \
$(GNOME_DESKTOP_CFLAGS) \
$(METACITY_CFLAGS) \
$(GSD_DBUS_CFLAGS)
$(GSD_DBUS_CFLAGS) \
$(GIO_CFLAGS)
noinst_LTLIBRARIES = libcommon.la
@ -42,9 +43,10 @@ libcommon_la_SOURCES = \
libcommon_la_LIBADD = \
$(top_builddir)/libwindow-settings/libgnome-window-settings.la \
$(METACITY_LIBS) \
$(METACITY_LIBS) \
$(DBUS_LIBS) \
$(GNOME_DESKTOP_LIBS)
$(GNOME_DESKTOP_LIBS) \
$(GIO_LIBS)
gnome_theme_test_SOURCES = \
gnome-theme-test.c

View file

@ -96,3 +96,73 @@ capplet_set_icon (GtkWidget *window, char const *icon_file_name)
gtk_window_set_default_icon_name (icon_file_name);
gtk_window_set_icon_name (GTK_WINDOW (window), icon_file_name);
}
static gboolean
directory_delete_recursive (GFile *directory, GError **error)
{
GFileEnumerator *enumerator;
GFileInfo *info;
gboolean success = TRUE;
enumerator = g_file_enumerate_children (directory,
G_FILE_ATTRIBUTE_STANDARD_NAME ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, error);
if (enumerator == NULL)
return FALSE;
while (success &&
(info = g_file_enumerator_next_file (enumerator, NULL, NULL))) {
GFile *child;
child = g_file_get_child (directory, g_file_info_get_name (info));
if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
success = directory_delete_recursive (child, error);
}
g_object_unref (info);
if (success)
success = g_file_delete (child, NULL, error);
}
g_file_enumerator_close (enumerator, NULL, NULL);
if (success)
success = g_file_delete (directory, NULL, error);
return success;
}
/**
* capplet_file_delete_recursive :
* @file :
* @error :
*
* A utility routine to delete files and/or directories,
* including non-empty directories.
**/
gboolean
capplet_file_delete_recursive (GFile *file, GError **error)
{
GFileInfo *info;
GFileType type;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, error);
if (info == NULL)
return FALSE;
type = g_file_info_get_file_type (info);
g_object_unref (info);
if (type == G_FILE_TYPE_DIRECTORY)
return directory_delete_recursive (file, error);
else
return g_file_delete (file, NULL, error);
}

View file

@ -24,6 +24,7 @@
#ifndef __CAPPLET_UTIL_H
#define __CAPPLET_UTIL_H
#include <gio/gio.h>
#include <gnome.h>
#include <gconf/gconf.h>
#include <gconf/gconf-changeset.h>
@ -46,5 +47,6 @@
void capplet_help (GtkWindow *parent, char const *helpfile, char const *section);
void capplet_set_icon (GtkWidget *window, char const *icon_file_name);
gboolean capplet_file_delete_recursive (GFile *directory, GError **error);
#endif /* __CAPPLET_UTIL_H */

View file

@ -1,3 +1,15 @@
2008-07-28 Bastien Nocera <hadess@hadess.net>
* Makefile.am:
* sound-properties-capplet.c (create_dialog), (setup_dialog),
(get_legacy_settings):
* sound-properties.glade:
* sound-theme-definition.h:
* sound-theme-file-utils.[ch]:
* sound-theme.[ch]: Remove separate bell settings tab, remove
libsounds dependency, add freedesktop sound theme support through
libcanberra (Closes: #542979)
==================== 2.23.2 ====================
2008-04-25 Jens Granseuer <jensgr@gmx.net>

View file

@ -4,15 +4,23 @@ cappletname = sound
bin_PROGRAMS = gnome-sound-properties
gnome_sound_properties_LDADD = \
$(top_builddir)/libsounds/libsounds.la \
$(GNOMECC_CAPPLETS_LIBS) \
$(SOUND_CAPPLET_LIBS) \
$(CANBERRA_LIBS) $(SOUND_CAPPLET_LIBS) \
$(HAL_LIBS)
gnome_sound_properties_SOURCES = sound-properties-capplet.c pipeline-tests.h pipeline-tests.c mixer-support.h mixer-support.c
gnome_sound_properties_SOURCES = \
sound-properties-capplet.c \
pipeline-tests.h \
pipeline-tests.c \
mixer-support.h \
mixer-support.c \
sound-theme.c \
sound-theme.h \
sound-theme-file-utils.c \
sound-theme-file-utils.h
INCLUDES = \
$(GNOMECC_CAPPLETS_CFLAGS) \
$(SOUND_CAPPLET_CFLAGS) \
$(CANBERRA_CFLAGS) $(SOUND_CAPPLET_CFLAGS) \
$(HAL_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \

View file

@ -35,7 +35,6 @@
#include "capplet-util.h"
#include "gconf-property-editor.h"
#include "libsounds/sound-view.h"
#include <glade/glade.h>
@ -53,8 +52,8 @@
#include "activate-settings-daemon.h"
#include "pipeline-tests.h"
#include "mixer-support.h"
#include "sound-theme.h"
typedef enum {
AUDIO_PLAYBACK,
@ -72,13 +71,11 @@ typedef struct _DeviceChooser
const gchar *test_pipeline;
} DeviceChooser;
#define ENABLE_ESD_KEY "/desktop/gnome/sound/enable_esd"
#define EVENT_SOUNDS_KEY "/desktop/gnome/sound/event_sounds"
#define INPUT_SOUNDS_KEY "/desktop/gnome/sound/input_feedback_sounds"
#define DEFAULT_MIXER_DEVICE_KEY "/desktop/gnome/sound/default_mixer_device"
#define DEFAULT_MIXER_TRACKS_KEY "/desktop/gnome/sound/default_mixer_tracks"
#define VISUAL_BELL_KEY "/apps/metacity/general/visual_bell"
#define AUDIO_BELL_KEY "/apps/metacity/general/audible_bell"
#define VISUAL_BELL_TYPE_KEY "/apps/metacity/general/visual_bell_type"
#define GST_GCONF_DIR "/system/gstreamer/0.10"
#define AUDIO_TEST_SOURCE "audiotestsrc wave=sine freq=512"
@ -88,7 +85,6 @@ typedef struct _DeviceChooser
/* Capplet-specific prototypes */
static SoundProperties *props = NULL;
static GConfClient *gconf_client = NULL;
static GtkWidget *dialog_win = NULL;
static GList *device_choosers = NULL;
@ -111,78 +107,18 @@ CheckXKB (void)
return have_xkb;
}
static void
props_changed_cb (SoundProperties *p, SoundEvent *event, gpointer data)
{
sound_properties_user_save (p);
}
static GConfEnumStringPair bell_flash_enums[] = {
{ 0, "frame_flash" },
{ 1, "fullscreen" },
{ -1, NULL }
};
static GConfValue *
bell_flash_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
GConfValue *new_value;
new_value = gconf_value_new (GCONF_VALUE_STRING);
gconf_value_set_string (new_value,
gconf_enum_to_string (bell_flash_enums, gconf_value_get_int (value)));
return new_value;
}
static GConfValue *
bell_flash_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
GConfValue *new_value;
const gchar *str;
gint val = 2;
str = (value && (value->type == GCONF_VALUE_STRING)) ? gconf_value_get_string (value) : NULL;
new_value = gconf_value_new (GCONF_VALUE_INT);
if (value->type == GCONF_VALUE_STRING) {
gconf_string_to_enum (bell_flash_enums,
str,
&val);
}
gconf_value_set_int (new_value, val);
return new_value;
}
static GladeXML *
create_dialog (void)
{
GladeXML *dialog;
GtkWidget *widget, *box, *view, *image;
GtkWidget *image;
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/sound-properties.glade", "sound_prefs_dialog", NULL);
if (dialog == NULL)
return NULL;
widget = glade_xml_get_widget (dialog, "sound_prefs_dialog");
props = sound_properties_new ();
sound_properties_add_defaults (props, NULL);
g_signal_connect (G_OBJECT (props), "event_changed",
(GCallback) props_changed_cb, NULL);
view = sound_view_new (props);
box = glade_xml_get_widget (dialog, "events_vbox");
gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE, 0);
gtk_widget_show_all (view);
g_signal_connect_swapped (G_OBJECT (widget), "destroy",
(GCallback) gtk_object_destroy, props);
gtk_image_set_from_file (GTK_IMAGE (WID ("bell_image")),
GNOMECC_DATA_DIR "/pixmaps/visual-bell.png");
dialog = glade_xml_new ("sound-properties.glade", "sound_prefs_dialog", NULL);
if (dialog == NULL) {
dialog = glade_xml_new (GNOMECC_GLADE_DIR "/sound-properties.glade", "sound_prefs_dialog", NULL);
if (dialog == NULL)
return NULL;
}
image = gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (WID ("sounds_playback_test")), image);
@ -196,10 +132,6 @@ create_dialog (void)
image = gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (WID ("chat_audio_capture_test")), image);
if (!CheckXKB()) {
gtk_widget_set_sensitive (WID ("bell_flash_alignment"), FALSE);
}
return dialog;
}
@ -1082,29 +1014,16 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
WID ("chat_audio_capture_test"),
"gconfaudiosrc" AUDIO_TEST_IN_BETWEEN "gconfaudiosink profile=chat");
#ifdef HAVE_ESD
peditor = gconf_peditor_new_boolean (NULL, ENABLE_ESD_KEY, WID ("enable_toggle"), NULL);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("events_toggle"));
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("events_vbox"));
#else
gtk_widget_hide (WID ("enable_toggle"));
#endif
gconf_peditor_new_boolean (NULL, EVENT_SOUNDS_KEY, WID ("events_toggle"), NULL);
peditor = gconf_peditor_new_boolean (NULL, EVENT_SOUNDS_KEY, WID ("events_toggle"), NULL);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("input_feedback_toggle"));
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("sound_theme_combobox"));
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("sounds_treeview"));
gconf_peditor_new_boolean (NULL, INPUT_SOUNDS_KEY, WID ("input_feedback_toggle"), NULL);
gconf_peditor_new_boolean (NULL, AUDIO_BELL_KEY, WID ("bell_audible_toggle"), NULL);
peditor = gconf_peditor_new_boolean (NULL, VISUAL_BELL_KEY, WID ("bell_visual_toggle"), NULL);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("bell_flash_vbox"));
/* peditor not so convenient for the radiobuttons */
gconf_peditor_new_select_radio (NULL,
VISUAL_BELL_TYPE_KEY,
gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("bell_flash_window_radio"))),
"conv-to-widget-cb", bell_flash_to_widget,
"conv-from-widget-cb", bell_flash_from_widget,
NULL);
setup_default_mixer (dialog);
setup_sound_theme (dialog);
setup_sound_theme_custom (dialog, CheckXKB());
}
/* get_legacy_settings
@ -1123,7 +1042,6 @@ get_legacy_settings (void)
gboolean val_bool, def;
client = gconf_client_get_default ();
COPY_FROM_LEGACY (bool, "/desktop/gnome/sound/enable_esd", "/sound/system/settings/start_esd=false");
COPY_FROM_LEGACY (bool, "/desktop/gnome/sound/event_sounds", "/sound/system/settings/event_sounds=false");
g_object_unref (G_OBJECT (client));
}

View file

@ -211,7 +211,7 @@
<property name="enable_popup">False</property>
<child>
<widget class="GtkVBox" id="vbox13">
<widget class="GtkVBox" id="devices_vbox">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
@ -940,32 +940,12 @@
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<widget class="GtkVBox" id="sounds_vbox">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkCheckButton" id="enable_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">E_nable software sound mixing</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="enable_toggled_cb"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="events_toggle">
<property name="visible">True</property>
@ -987,29 +967,198 @@
</child>
<child>
<widget class="GtkAlignment" id="alignment4">
<widget class="GtkAlignment" id="alignment17">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">12</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="events_vbox">
<widget class="GtkVBox" id="vbox18">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
<widget class="GtkCheckButton" id="input_feedback_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Play sounds when buttons are pressed</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="bell_audible_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Play system beep sound</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment15">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">12</property>
<property name="bottom_padding">12</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkComboBox" id="sound_theme_combobox">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Sound theme&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment16">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">12</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="sounds_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;System sounds&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
@ -1045,189 +1194,6 @@
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="sound_events_vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkImage" id="bell_image">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
<property name="icon_size">4</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="bell_box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkCheckButton" id="bell_audible_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Enable system beep</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="bell_visual_toggle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Visual system beep</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="bell_flash_alignment">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="bell_flash_vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkRadioButton" id="bell_flash_window_radio">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Flash _window titlebar</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="bell_flash_screen_radio">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Flash _entire screen</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">bell_flash_window_radio</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">System Beep</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View file

@ -0,0 +1,71 @@
/* -*- mode: c; style: linux -*- */
/* -*- c-basic-offset: 2 -*- */
/* sound-theme-definition.h
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
*
* 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.
*/
typedef enum {
CATEGORY_INVALID,
CATEGORY_BELL,
CATEGORY_WINDOWS_BUTTONS,
CATEGORY_DESKTOP,
CATEGORY_ALERTS,
NUM_CATEGORIES
} CategoryType;
typedef enum {
SOUND_TYPE_NORMAL,
SOUND_TYPE_AUDIO_BELL,
SOUND_TYPE_VISUAL_BELL,
SOUND_TYPE_FEEDBACK
} SoundType;
static struct {
CategoryType category;
SoundType type;
const char *display_name;
const char *names[6];
} sounds[20] = {
/* Bell */
{ CATEGORY_BELL, SOUND_TYPE_AUDIO_BELL, N_("Audible bell"), { "bell-terminal", "bell-window-system", NULL } },
{ CATEGORY_BELL, SOUND_TYPE_VISUAL_BELL, N_("Visual bell"), { NULL } },
/* Windows and buttons */
{ CATEGORY_WINDOWS_BUTTONS, -1, N_("Windows and Buttons"), { NULL } },
{ CATEGORY_WINDOWS_BUTTONS, SOUND_TYPE_FEEDBACK, N_("Button clicked"), { "button-pressed", "menu-click", "menu-popup", "menu-popdown", "menu-replace", NULL } },
{ CATEGORY_WINDOWS_BUTTONS, SOUND_TYPE_FEEDBACK, N_("Button toggled"), { "button-toggle-off", "button-toggle-on", NULL } },
{ CATEGORY_WINDOWS_BUTTONS, SOUND_TYPE_FEEDBACK, N_("Window maximized"), { "window-maximized", NULL } },
{ CATEGORY_WINDOWS_BUTTONS, SOUND_TYPE_FEEDBACK, N_("Window unmaximized"), { "window-unmaximized", NULL } },
{ CATEGORY_WINDOWS_BUTTONS, SOUND_TYPE_FEEDBACK, N_("Window minimised"), { "window-minimized", NULL } },
/* Desktop */
{ CATEGORY_DESKTOP, -1, N_("Desktop"), { NULL } },
{ CATEGORY_DESKTOP, SOUND_TYPE_NORMAL, N_("Login"), { "desktop-login", NULL } },
{ CATEGORY_DESKTOP, SOUND_TYPE_NORMAL, N_("Logout"), { "desktop-logout", NULL } },
{ CATEGORY_DESKTOP, SOUND_TYPE_NORMAL, N_("New e-mail"), { "message-new-email", NULL } },
{ CATEGORY_DESKTOP, SOUND_TYPE_NORMAL, N_("Empty Trash"), { "trash-empty", NULL } },
{ CATEGORY_DESKTOP, SOUND_TYPE_NORMAL, N_("Long action completed (download, CD burning, etc.)"), { "complete-copy", "complete-download", "complete-media-burn", "complete-media-rip", "complete-scan", NULL } },
/* Alerts? */
{ CATEGORY_ALERTS, -1, N_("Alerts"), { NULL } },
{ CATEGORY_ALERTS, SOUND_TYPE_NORMAL, N_("Information or Question"), { "dialog-information", "dialog-question", NULL } },
{ CATEGORY_ALERTS, SOUND_TYPE_NORMAL, N_("Warning"), { "dialog-warning", NULL } },
{ CATEGORY_ALERTS, SOUND_TYPE_NORMAL, N_("Error"), { "dialog-error", NULL } },
{ CATEGORY_ALERTS, SOUND_TYPE_NORMAL, N_("Battery warning"), { "power-unplug-battery-low", "battery-low", "battery-caution", NULL } },
/* Finish off */
{ -1, -1, NULL, { NULL } }
};

View file

@ -0,0 +1,152 @@
/* -*- mode: c; style: linux -*- */
/* -*- c-basic-offset: 2 -*- */
/* sound-theme-file-utils.c
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <config.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
#include "capplet-util.h"
#define CUSTOM_THEME_NAME "__custom"
char *
custom_theme_dir_path (const char *child)
{
static char *dir = NULL;
const char *data_dir;
if (dir == NULL) {
data_dir = g_get_user_data_dir ();
dir = g_build_filename (data_dir, "sounds", CUSTOM_THEME_NAME, NULL);
}
if (child == NULL)
return g_strdup (dir);
return g_build_filename (dir, child, NULL);
}
void
delete_custom_theme_dir (void)
{
char *dir;
GFile *file;
dir = custom_theme_dir_path (NULL);
file = g_file_new_for_path (dir);
g_free (dir);
capplet_file_delete_recursive (file, NULL);
g_object_unref (file);
g_debug ("deleted the custom theme dir");
}
static void
delete_one_file (const char *sound_name, const char *pattern)
{
GFile *file;
char *name, *filename;
name = g_strdup_printf (pattern, sound_name);
filename = custom_theme_dir_path (name);
g_free (name);
file = g_file_new_for_path (filename);
g_free (filename);
capplet_file_delete_recursive (file, NULL);
g_object_unref (file);
}
void
delete_old_files (char **sounds)
{
guint i;
for (i = 0; sounds[i] != NULL; i++) {
delete_one_file (sounds[i], "%s.ogg");
}
}
void
delete_disabled_files (char **sounds)
{
guint i;
for (i = 0; sounds[i] != NULL; i++)
delete_one_file (sounds[i], "%s.disabled");
}
static void
create_one_file (GFile *file)
{
GFileOutputStream* stream;
stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, NULL);
if (stream != NULL) {
g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, NULL);
g_object_unref (stream);
}
}
void
add_disabled_file (char **sounds)
{
guint i;
for (i = 0; sounds[i] != NULL; i++) {
GFile *file;
char *name, *filename;
name = g_strdup_printf ("%s.disabled", sounds[i]);
filename = custom_theme_dir_path (name);
g_free (name);
file = g_file_new_for_path (filename);
g_free (filename);
create_one_file (file);
g_object_unref (file);
}
}
void
add_custom_file (char **sounds, const char *filename)
{
guint i;
for (i = 0; sounds[i] != NULL; i++) {
GFile *file;
char *name, *path;
/* We use *.ogg because it's the first type of file that
* libcanberra looks at */
name = g_strdup_printf ("%s.ogg", sounds[i]);
path = custom_theme_dir_path (name);
g_free (name);
/* In case there's already a link there, delete it */
g_unlink (path);
file = g_file_new_for_path (path);
g_free (path);
/* Create the link */
g_file_make_symbolic_link (file, filename, NULL, NULL);
g_object_unref (file);
}
}

View file

@ -0,0 +1,36 @@
/* -*- mode: c; style: linux -*- */
/* -*- c-basic-offset: 2 -*- */
/* sound-theme-file-utils.h
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
*
* 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 __SOUND_THEME_FILE_UTILSHH__
#define __SOUND_THEME_HH__
#include <gio/gio.h>
char *custom_theme_dir_path (const char *child);
void delete_custom_theme_dir (void);
void delete_old_files (char **sounds);
void delete_disabled_files (char **sounds);
void add_disabled_file (char **sounds);
void add_custom_file (char **sounds, const char *filename);
#endif /* __SOUND_THEME_FILE_UTILS_HH__ */

1135
capplets/sound/sound-theme.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
/* -*- mode: c; style: linux -*- */
/* -*- c-basic-offset: 2 -*- */
/* sound-theme.h
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
*
* 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 __SOUND_THEME_HH__
#define __SOUND_THEME_HH__
#include <gtk/gtk.h>
#include <glade/glade.h>
void setup_sound_theme (GladeXML *dialog);
void setup_sound_theme_custom (GladeXML *dialog, gboolean have_xkb);
#endif /* __SOUND_THEME_HH__ */