billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=6fd4e8c57a629b263a8f6fd56e6e27c909d987dc

commit 6fd4e8c57a629b263a8f6fd56e6e27c909d987dc
Author: Boris Faure <bill...@gmail.com>
Date:   Tue Apr 22 23:32:04 2014 +0200

    add an option to decide whether the bell rings
---
 data/themes/default.edc    |  2 +-
 data/themes/mild.edc       |  6 +++++-
 src/bin/config.c           |  6 ++++++
 src/bin/config.h           |  1 +
 src/bin/main.c             |  7 ++++++-
 src/bin/options_behavior.c | 19 +++++++++++++++++++
 src/bin/sel.c              |  3 +++
 src/bin/termio.c           |  2 ++
 8 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/data/themes/default.edc b/data/themes/default.edc
index e88f4f0..3bdd694 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -628,7 +628,7 @@ collections {
             }
          }
          program {
-            signal: "bell"; source: "terminology";
+            signal: "bell,ring"; source: "terminology";
 #if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 9)
             action: PLAY_SAMPLE "bell" 1.0 ALERT;
 #else
diff --git a/data/themes/mild.edc b/data/themes/mild.edc
index d1bfebe..df1ce05 100644
--- a/data/themes/mild.edc
+++ b/data/themes/mild.edc
@@ -203,8 +203,12 @@ collections {
             }
          }
          program {
-            signal: "bell"; source: "terminology";
+            signal: "bell,ring"; source: "terminology";
+#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 9)
+            action: PLAY_SAMPLE "bell" 1.0 ALERT;
+#else
             action: PLAY_SAMPLE "bell" 1.0;
+#endif
          }
          program {
             signal: "bell";
diff --git a/src/bin/config.c b/src/bin/config.c
index c80a3db..18da476 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -97,6 +97,8 @@ config_init(void)
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "disable_visual_bell", disable_visual_bell, 
EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC
+     (edd_base, Config, "bell_rings", bell_rings, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "active_links", active_links, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "translucent", translucent, EET_T_UCHAR);
@@ -212,6 +214,7 @@ config_sync(const Config *config_src, Config *config)
    config->flicker_on_key = config_src->flicker_on_key;
    config->disable_cursor_blink = config_src->disable_cursor_blink;
    config->disable_visual_bell = config_src->disable_visual_bell;
+   config->bell_rings = config_src->bell_rings;
    config->active_links = config_src->active_links;
    config->mute = config_src->mute;
    config->urg_bell = config_src->urg_bell;
@@ -289,6 +292,7 @@ config_load(const char *key)
 
                   /* upgrade to v3 */
                   config->active_links = EINA_TRUE;
+                  config->bell_rings = EINA_TRUE;
                   config->version = 3;
                   /*pass through*/
                 case CONF_VER: /* 3*/
@@ -508,6 +512,7 @@ config_load(const char *key)
              config->flicker_on_key = EINA_FALSE;
              config->disable_cursor_blink = EINA_FALSE;
              config->disable_visual_bell = EINA_FALSE;
+             config->bell_rings = EINA_TRUE;
              config->active_links = EINA_TRUE;
              s = eina_unicode_unicode_to_utf8(sep, &slen);
              if (s)
@@ -589,6 +594,7 @@ config_fork(Config *config)
    CPY(flicker_on_key);
    CPY(disable_cursor_blink);
    CPY(disable_visual_bell);
+   CPY(bell_rings);
    CPY(active_links);
    CPY(translucent);
    CPY(mute);
diff --git a/src/bin/config.h b/src/bin/config.h
index 027e0e4..e8a4324 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -42,6 +42,7 @@ struct _Config
    Eina_Bool         flicker_on_key;
    Eina_Bool         disable_cursor_blink;
    Eina_Bool         disable_visual_bell;
+   Eina_Bool         bell_rings;
    Eina_Bool         active_links;
    Eina_Bool         translucent;
    Eina_Bool         mute;
diff --git a/src/bin/main.c b/src/bin/main.c
index a122245..26741d6 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1003,9 +1003,14 @@ _cb_bell(void *data, Evas_Object *obj EINA_UNUSED, void 
*event EINA_UNUSED)
    if (!config->disable_visual_bell)
      {
         Split *sp;
-        
+
         edje_object_signal_emit(term->bg, "bell", "terminology");
         edje_object_signal_emit(term->base, "bell", "terminology");
+        if (config->bell_rings)
+          {
+             edje_object_signal_emit(term->bg, "bell,ring", "terminology");
+             edje_object_signal_emit(term->base, "bell,ring", "terminology");
+          }
         sp = _split_find(term->wn->win, term->term);
         if (sp)
           {
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 9e6bfdd..7c626ab 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -58,6 +58,15 @@ _cb_op_behavior_visual_bell_chg(void *data, Evas_Object 
*obj, void *event EINA_U
 }
 
 static void
+_cb_op_behavior_bell_rings_chg(void *data, Evas_Object *obj, void *event 
EINA_UNUSED)
+{
+   Evas_Object *term = data;
+   Config *config = termio_config_get(term);
+   config->bell_rings = elm_check_state_get(obj);
+   config_save(config, NULL);
+}
+
+static void
 _cb_op_behavior_flicker_chg(void *data, Evas_Object *obj, void *event 
EINA_UNUSED)
 {
    Evas_Object *term = data;
@@ -362,6 +371,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
    o = elm_check_add(bx);
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
+   elm_object_text_set(o, "Bell rings");
+   elm_check_state_set(o, !config->bell_rings);
+   elm_box_pack_end(bx, o);
+   evas_object_show(o);
+   evas_object_smart_callback_add(o, "changed",
+                                  _cb_op_behavior_bell_rings_chg, term);
+
+   o = elm_check_add(bx);
+   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
    elm_object_text_set(o, "Urgent Bell");
    elm_check_state_set(o, config->urg_bell);
    elm_box_pack_end(bx, o);
diff --git a/src/bin/sel.c b/src/bin/sel.c
index be707a6..c948dff 100644
--- a/src/bin/sel.c
+++ b/src/bin/sel.c
@@ -683,6 +683,9 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, 
Eina_Bool selected, Eina_Boo
    if (bell)
      {
         edje_object_signal_emit(en->bg, "bell", "terminology");
+        if (!config->bell_rings)
+          edje_object_signal_emit(en->bg, "bell,ring", "terminology");
+
         edje_object_message_signal_process(en->bg);
      }
    sd->interp = 1.0;
diff --git a/src/bin/termio.c b/src/bin/termio.c
index ee7213d..1c31424 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -4104,6 +4104,8 @@ _smart_pty_bell(void *data)
    EINA_SAFETY_ON_NULL_RETURN(sd);
    evas_object_smart_callback_call(data, "bell", NULL);
    edje_object_signal_emit(sd->cursor.obj, "bell", "terminology");
+   if (sd->config->bell_rings)
+     edje_object_signal_emit(sd->cursor.obj, "bell,ring", "terminology");
 }
 
 static void

-- 


Reply via email to