Bug#598132: gdm3: Should beep or permit to configure a beep

Samuel Thibault sthibault at debian.org
Sun Oct 17 14:58:44 UTC 2010


tags 598132 + patch
clone 598132 -1
reassign -1 gnome-settings-daemon
tags -1 + patch
thanks

Samuel Thibault, le Sun 17 Oct 2010 16:06:45 +0200, a écrit :
> Josselin Mouette, le Mon 27 Sep 2010 18:20:38 +0200, a écrit :
> > I would definitely accept a patch to do that.
> 
> Here is the part that adds the beep.

Here is the part that adds the configuration checkbox in the
accessibility panel.  That's in the gnome-settings-daemon package, thus
cloning.

Samuel
-------------- next part --------------
--- ./plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c.original	2010-10-17 15:31:30.000000000 +0200
+++ ./plugins/a11y-keyboard/gsd-a11y-preferences-dialog.c	2010-10-17 15:34:27.000000000 +0200
@@ -55,6 +55,7 @@
 #define KEY_AT_SCREEN_KEYBOARD_ENABLED  KEY_AT_DIR "/screen_keyboard_enabled"
 #define KEY_AT_SCREEN_MAGNIFIER_ENABLED KEY_AT_DIR "/screen_magnifier_enabled"
 #define KEY_AT_SCREEN_READER_ENABLED    KEY_AT_DIR "/screen_reader_enabled"
+#define KEY_AT_BEEP_ENABLED             KEY_AT_DIR "/beep_enabled"
 
 #define FONT_RENDER_DIR        "/desktop/gnome/font_rendering"
 #define KEY_FONT_DPI           FONT_RENDER_DIR "/dpi"
@@ -95,6 +96,7 @@
         GtkWidget *screen_reader_checkbutton;
         GtkWidget *screen_keyboard_checkbutton;
         GtkWidget *screen_magnifier_checkbutton;
+        GtkWidget *beep_checkbutton;
 
         guint      a11y_dir_cnxn;
         guint      gsd_a11y_dir_cnxn;
@@ -469,6 +471,12 @@
         return config_get_bool (KEY_AT_SCREEN_MAGNIFIER_ENABLED, is_writable);
 }
 
+static gboolean
+config_get_at_beep (gboolean *is_writable)
+{
+        return config_get_bool (KEY_AT_BEEP_ENABLED, is_writable);
+}
+
 static void
 config_set_at_screen_reader (gboolean enabled)
 {
@@ -500,6 +508,16 @@
 }
 
 static void
+config_set_at_beep (gboolean enabled)
+{
+        GConfClient *client;
+
+        client = gconf_client_get_default ();
+        gconf_client_set_bool (client, KEY_AT_BEEP_ENABLED, enabled, NULL);
+        g_object_unref (client);
+}
+
+static void
 on_sticky_keys_checkbutton_toggled (GtkToggleButton          *button,
                                     GsdA11yPreferencesDialog *dialog)
 {
@@ -549,6 +567,13 @@
 }
 
 static void
+on_at_beep_checkbutton_toggled (GtkToggleButton          *button,
+                                GsdA11yPreferencesDialog *dialog)
+{
+        config_set_at_beep (gtk_toggle_button_get_active (button));
+}
+
+static void
 on_large_print_checkbutton_toggled (GtkToggleButton          *button,
                                     GsdA11yPreferencesDialog *dialog)
 {
@@ -640,6 +665,18 @@
 }
 
 static void
+ui_set_at_beep (GsdA11yPreferencesDialog *dialog,
+                gboolean                  enabled)
+{
+        gboolean active;
+
+        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->beep_checkbutton));
+        if (active != enabled) {
+                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->beep_checkbutton), enabled);
+        }
+}
+
+static void
 ui_set_large_print (GsdA11yPreferencesDialog *dialog,
                     gboolean                  enabled)
 {
@@ -723,6 +760,16 @@
                         g_warning ("Error retrieving configuration key '%s': Invalid type",
                                    key);
                 }
+        } else if (strcmp (key, KEY_AT_BEEP_ENABLED) == 0) {
+                if (value->type == GCONF_VALUE_BOOL) {
+                        gboolean enabled;
+
+                        enabled = gconf_value_get_bool (value);
+                        ui_set_at_beep (dialog, enabled);
+                } else {
+                        g_warning ("Error retrieving configuration key '%s': Invalid type",
+                                   key);
+                }
         } else {
                 g_debug ("Config key not handled: %s", key);
         }
@@ -844,6 +891,25 @@
                 gtk_widget_show_all (widget);
         } else {
                 gtk_widget_hide (widget);
+        }
+
+        widget = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                     "at_beep_checkbutton"));
+        dialog->priv->beep_checkbutton = widget;
+        g_signal_connect (widget,
+                          "toggled",
+                          G_CALLBACK (on_at_beep_checkbutton_toggled),
+                          NULL);
+        enabled = config_get_at_beep (&is_writable);
+        ui_set_at_beep (dialog, enabled);
+        if (! is_writable) {
+                gtk_widget_set_sensitive (widget, FALSE);
+        }
+        gtk_widget_set_no_show_all (widget, TRUE);
+        if (config_have_at_gconf_condition ("GNOME " KEY_AT_BEEP_ENABLED)) {
+                gtk_widget_show_all (widget);
+        } else {
+                gtk_widget_hide (widget);
         }
 
         widget = GTK_WIDGET (gtk_builder_get_object (builder,
--- ./plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui.original	2010-10-17 15:05:44.000000000 +0200
+++ ./plugins/a11y-keyboard/gsd-a11y-preferences-dialog.ui	2010-10-17 16:42:35.000000000 +0200
@@ -151,6 +151,20 @@
                     <property name="position">7</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkCheckButton" id="at_beep_checkbutton">
+                    <property name="label" translatable="yes">Emit _beep at login prompt</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="position">8</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
--- ./data/gnome-settings-daemon.schemas.in.original	2010-10-17 15:36:35.000000000 +0200
+++ ./data/gnome-settings-daemon.schemas.in	2010-10-17 16:00:28.000000000 +0200
@@ -416,6 +416,45 @@
       </locale>
     </schema>
     <schema>
+      <key>/schemas/desktop/gnome/keybindings/beep/name</key>
+      <applyto>/desktop/gnome/keybindings/beep/name</applyto>
+      <owner>gnome-settings-daemon</owner>
+      <type>string</type>
+      <locale name="C">
+        <default>Toggle beep</default>
+        <short>The name of the keyboard shortcut to toggle the beep</short>
+        <long>
+          This is the name of the keyboard shortcut to toggle the beep. This name will be shown in the keyboard shortcut preferences dialog.
+        </long>
+      </locale>
+    </schema>
+    <schema>
+      <key>/schemas/desktop/gnome/keybindings/beep/action</key>
+      <applyto>/desktop/gnome/keybindings/beep/action</applyto>
+      <owner>gnome-settings-daemon</owner>
+      <type>string</type>
+      <default>gconftool-2 --toggle /desktop/gnome/applications/at/beep_enabled</default>
+      <locale name="C">
+        <short>Toggle beep</short>
+        <long>
+          Command used to turn the beep on or off.
+        </long>
+      </locale>
+    </schema>
+    <schema>
+      <key>/schemas/desktop/gnome/keybindings/onscreenkeyboard/name</key>
+      <applyto>/desktop/gnome/keybindings/onscreenkeyboard/name</applyto>
+      <owner>gnome-settings-daemon</owner>
+      <type>string</type>
+      <locale name="C">
+        <default>Toggle on-screen keyboard</default>
+        <short>The name of the keyboard shortcut to toggle the on-screen keyboard</short>
+        <long>
+          This is the name of the keyboard shortcut to toggle the on-screen keyboard. This name will be shown in the keyboard shortcut preferences dialog.
+        </long>
+      </locale>
+    </schema>
+    <schema>
       <key>/schemas/desktop/gnome/keybindings/onscreenkeyboard/binding</key>
       <applyto>/desktop/gnome/keybindings/onscreenkeyboard/binding</applyto>
       <owner>gnome-settings-daemon</owner>


More information about the pkg-gnome-maintainers mailing list