devilhorns pushed a commit to branch master.

commit c48e7d21cea3a516591d61b7eb55cd8b1914307f
Author: Chris Michael <[email protected]>
Date:   Fri Aug 2 11:04:21 2013 +0100

    When we have finished creating all monitors, if there is only One
    monitor existing, then disable the ability to toggle the indicator.
    
    NB: This is for silly people who (for whatever reason) decide that
    it's a good idea to try and turn off their Only monitor.
    
    NB: Fixes Phab Ticket T257
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/conf_randr/e_smart_randr.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/modules/conf_randr/e_smart_randr.c 
b/src/modules/conf_randr/e_smart_randr.c
index c0df86e..7156c0f 100644
--- a/src/modules/conf_randr/e_smart_randr.c
+++ b/src/modules/conf_randr/e_smart_randr.c
@@ -174,7 +174,9 @@ e_smart_randr_monitors_create(Evas_Object *obj)
    Ecore_X_Window root = 0;
    Evas_Coord gx = 0, gy = 0, gw = 0, gh = 0;
    Ecore_X_Randr_Output *outputs;
-   int noutputs = 0;
+   Evas_Object *mon;
+   Eina_List *l = NULL;
+   int noutputs = 0, count = 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -205,7 +207,6 @@ e_smart_randr_monitors_create(Evas_Object *obj)
         /* loop these outputs */
         for (i = 0; i < noutputs; i++)
           {
-             Evas_Object *mon;
              Ecore_X_Randr_Crtc crtc = 0;
              Evas_Coord mw = 0, mh = 0, crtcx = 0, crtcy = 0;
              Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
@@ -332,6 +333,17 @@ e_smart_randr_monitors_create(Evas_Object *obj)
 
         free(outputs);
      }
+
+   /* check if we have only one monitor. If so, we will disable the 
+    * indicator toggle so dumb people cannot turn off their only monitor */
+   count = eina_list_count(sd->monitors);
+   EINA_LIST_FOREACH(sd->monitors, l, mon)
+     {
+        if (count > 1)
+          e_smart_monitor_indicator_available_set(mon, EINA_TRUE);
+        else
+          e_smart_monitor_indicator_available_set(mon, EINA_FALSE);
+     }
 }
 
 void 

-- 

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

Reply via email to