[vte] vteapp: Three-state bell option



commit 983b3840454267205ce789498f8d0941b41c8d60
Author: Egmont Koblinger <egmont gmail com>
Date:   Wed Aug 27 22:24:34 2014 +0200

    vteapp: Three-state bell option
    
    https://bugzilla.gnome.org/show_bug.cgi?id=602726

 src/app.vala |   12 ++++++------
 src/vteapp.c |   21 ++++++++++-----------
 2 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 8922af0..1588656 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -114,7 +114,7 @@ class Window : Gtk.ApplicationWindow
       }
     }
 
-    terminal.set_audible_bell(App.Options.audible);
+    terminal.set_audible_bell(App.Options.bell_string == "audible");
     terminal.set_cjk_ambiguous_width(App.Options.get_cjk_ambiguous_width());
     terminal.set_cursor_blink_mode(App.Options.get_cursor_blink_mode());
     terminal.set_cursor_shape(App.Options.get_cursor_shape());
@@ -123,7 +123,7 @@ class Window : Gtk.ApplicationWindow
     terminal.set_scroll_on_output(false);
     terminal.set_scroll_on_keystroke(true);
     terminal.set_scrollback_lines(App.Options.scrollback_lines);
-    terminal.set_visible_bell(!App.Options.audible);
+    terminal.set_visible_bell(App.Options.bell_string == "visual");
 
     /* Style */
     if (App.Options.font_string != null) {
@@ -537,7 +537,7 @@ class App : Gtk.Application
 
   public struct Options
   {
-    public static bool audible = false;
+    public static string? bell_string = null;
     public static string? command = null;
     private static string? cjk_ambiguous_width_string = null;
     private static string? cursor_blink_mode_string = null;
@@ -700,8 +700,8 @@ class App : Gtk.Application
     }
                
     public static const OptionEntry[] entries = {
-      { "audible-bell", 'a', 0, OptionArg.NONE, ref audible,
-        "Use audible terminal bell", null },
+      { "bell", 0, 0, OptionArg.STRING, ref bell_string,
+        "Set bell mode (none|audible|visual)", "MODE" },
       { "command", 'c', 0, OptionArg.STRING, ref command,
         "Execute a command in the terminal", null },
       { "cjk-width", 0, 0, OptionArg.STRING, ref cjk_ambiguous_width_string,
@@ -711,7 +711,7 @@ class App : Gtk.Application
       { "cursor-color", 0, 0, OptionArg.STRING, ref cursor_color_string,
         "Enable a colored cursor", null },
       { "cursor-shape", 0, 0, OptionArg.STRING, ref cursor_shape_string,
-        "Set cursor shape (block|underline|ibeam)", null },
+        "Set cursor shape (block|underline|ibeam)", "SHAPE" },
       { "dingu", 'D', 0, OptionArg.STRING_ARRAY, ref dingus,
         "Add regex highlight", null },
       { "debug", 'd', 0,OptionArg.NONE, ref debug,
diff --git a/src/vteapp.c b/src/vteapp.c
index d598a61..a4fe9d7 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -563,8 +563,7 @@ main(int argc, char **argv)
         char *transparent = NULL;
         char *encoding = NULL;
         char *cjk_ambiguous_width = NULL;
-       gboolean audible = TRUE,
-                debug = FALSE, no_builtin_dingus = FALSE, dbuffer = TRUE,
+       gboolean debug = FALSE, no_builtin_dingus = FALSE, dbuffer = TRUE,
                 console = FALSE, keep = FALSE,
                 icon_title = FALSE, shell = TRUE,
                 reverse = FALSE, use_geometry_hints = TRUE,
@@ -578,6 +577,7 @@ main(int argc, char **argv)
        const char *working_directory = NULL;
        const char *output_file = NULL;
        char *pty_flags_string = NULL;
+       char *bell_string = NULL;
        char *cursor_blink_mode_string = NULL;
        char *cursor_shape_string = NULL;
        char *scrollbar_policy_string = NULL;
@@ -624,12 +624,6 @@ main(int argc, char **argv)
                        "Disable double-buffering", NULL
                },
                {
-                       "audible", 'a', G_OPTION_FLAG_REVERSE,
-                       G_OPTION_ARG_NONE, &audible,
-                       "Use visible, instead of audible, terminal bell",
-                       NULL
-               },
-               {
                        "command", 'c', 0,
                        G_OPTION_ARG_STRING, &command,
                        "Execute a command in the terminal", NULL
@@ -675,6 +669,11 @@ main(int argc, char **argv)
                        "Specify the number of scrollback-lines", NULL
                },
                {
+                       "bell", 0, 0,
+                       G_OPTION_ARG_STRING, &bell_string,
+                       "Set bell mode (none|audible|visual)", "MODE"
+               },
+               {
                        "cursor-blink", 0, 0,
                        G_OPTION_ARG_STRING, &cursor_blink_mode_string,
                        "Cursor blink mode (system|on|off)", "MODE"
@@ -687,7 +686,7 @@ main(int argc, char **argv)
                {
                        "cursor-shape", 0, 0,
                        G_OPTION_ARG_STRING, &cursor_shape_string,
-                       "Set cursor shape (block|underline|ibeam)", NULL
+                       "Set cursor shape (block|underline|ibeam)", "SHAPE"
                },
                {
                        "encoding", 0, 0,
@@ -909,8 +908,8 @@ main(int argc, char **argv)
        }
 
        /* Set some defaults. */
-       vte_terminal_set_audible_bell(terminal, audible);
-       vte_terminal_set_visible_bell(terminal, !audible);
+       vte_terminal_set_audible_bell(terminal, g_strcmp0(bell_string, "audible") == 0);
+       vte_terminal_set_visible_bell(terminal, g_strcmp0(bell_string, "visual") == 0);
        vte_terminal_set_cursor_blink_mode(terminal, cursor_blink_mode);
        vte_terminal_set_scroll_on_output(terminal, FALSE);
        vte_terminal_set_scroll_on_keystroke(terminal, TRUE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]