gadcon popup should lock shelf.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 10 Jan 2009 07:35:53 +0000 (07:35 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 10 Jan 2009 07:35:53 +0000 (07:35 +0000)
It's nasty to have shelf auto-hided when you have a popup like mixer
or battery warning, so gadcon popups will now lock shelf while they're
visible.

Developers can go back to old behaviour setting the appropriate flag
with e_gadcon_popup_shelf_lock_set().

SVN revision: 38530

src/bin/e_gadcon_popup.c
src/bin/e_gadcon_popup.h

index 633d72c..9776e9d 100644 (file)
@@ -5,6 +5,7 @@
 
 /* local subsystem functions */
 static void _e_gadcon_popup_free(E_Gadcon_Popup *pop);
+static void _e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool locked);
 
 /* externally accessible functions */
 
@@ -29,6 +30,8 @@ e_gadcon_popup_new(E_Gadcon_Client *gcc, void (*resize_func) (Evas_Object *obj,
    pop->o_bg = o;
 
    pop->gcc = gcc;
+   pop->shelf_lock = 1;
+   pop->shelf_was_locked = 0;
    pop->resize_func = resize_func;
 
    return pop;
@@ -153,6 +156,9 @@ e_gadcon_popup_show(E_Gadcon_Popup *pop)
        return;
      }
    e_popup_move_resize(pop->win, px - zx, py - zy, pop->w, pop->h);
+
+   if (!pop->shelf_was_locked)
+     _e_gadcon_popup_shelf_lock_set(pop, 1);
 }
 
 EAPI void
@@ -163,6 +169,8 @@ e_gadcon_popup_hide(E_Gadcon_Popup *pop)
    E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
    if (pop->pinned) return;
    e_popup_hide(pop->win);
+   if (pop->shelf_was_locked)
+     _e_gadcon_popup_shelf_lock_set(pop, 0);
 }
 
 EAPI void
@@ -184,12 +192,39 @@ e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop)
      }
 }
 
+EAPI void
+e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting)
+{
+   if (!pop) return;
+   E_OBJECT_CHECK(pop);
+   E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE);
+
+   setting = !!setting;
+   if (pop->shelf_lock == setting) return;
+   pop->shelf_lock = setting;
+
+   if ((!setting) && pop->shelf_was_locked)
+     _e_gadcon_popup_shelf_lock_set(pop, 0);
+}
+
 /* local subsystem functions */
 
 static void
 _e_gadcon_popup_free(E_Gadcon_Popup *pop)
 {
+   if (pop->shelf_was_locked)
+     _e_gadcon_popup_shelf_lock_set(pop, 0);
    pop->gcc = NULL;
    e_object_del(E_OBJECT(pop->win));
    free(pop);
 }
+
+static void
+_e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool locked)
+{
+   if ((!pop->gcc) || (!pop->gcc->gadcon) || (!pop->gcc->gadcon->shelf))
+     return;
+
+   e_shelf_locked_set(pop->gcc->gadcon->shelf, locked);
+   pop->shelf_was_locked = locked;
+}
index 9dba115..3e75c74 100644 (file)
@@ -20,7 +20,9 @@ struct _E_Gadcon_Popup
    Evas_Coord          w, h;
    Evas_Object        *o_bg;
 
-   int                 pinned : 1;
+   Eina_Bool            pinned : 1;
+   Eina_Bool            shelf_lock : 1;
+   Eina_Bool            shelf_was_locked : 1;
 
    void                        (*resize_func) (Evas_Object *obj, int *w, int *h);
 };
@@ -30,6 +32,7 @@ EAPI void e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o);
 EAPI void e_gadcon_popup_show(E_Gadcon_Popup *pop);
 EAPI void e_gadcon_popup_hide(E_Gadcon_Popup *pop);
 EAPI void e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop);
+EAPI void e_gadcon_popup_shelf_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting);
 
 #endif
 #endif