Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/modules/ibar


Modified Files:
        e_mod_main.c 


Log Message:


a temperature monitor module for acpi... it's simple... and really only
handles 1 temperature guage - but it's useful. fixed stuff in battery
modules, added config menus... ibar size change menu only works after a
restart for now.. need to fix that.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_mod_main.c        25 Dec 2004 15:33:48 -0000      1.5
+++ e_mod_main.c        2 Jan 2005 02:39:44 -0000       1.6
@@ -32,9 +32,11 @@
 static void    _ibar_cb_width_fixed(void *data, E_Menu *m, E_Menu_Item *mi);
 static void    _ibar_cb_width_auto(void *data, E_Menu *m, E_Menu_Item *mi);
 static void    _ibar_cb_width_fill(void *data, E_Menu *m, E_Menu_Item *mi);
+static void    _ibar_bar_iconsize_change(IBar_Bar *ibb);
 static IBar_Icon *_ibar_bar_icon_find(IBar_Bar *ibb, E_App *a);
 static void    _ibar_bar_icon_del(IBar_Icon *ic);
 static IBar_Icon *_ibar_bar_icon_new(IBar_Bar *ibb, E_App *a);
+static void    _ibar_bar_icon_resize(IBar_Icon *ic);
 static void    _ibar_bar_icon_reorder_before(IBar_Icon *ic, IBar_Icon *before);
 static void    _ibar_bar_icon_reorder_after(IBar_Icon *ic, IBar_Icon *after);
 static void    _ibar_bar_frame_resize(IBar_Bar *ibb);
@@ -360,6 +362,216 @@
      }
 }
 
+/* FIXME: none of these work runtime... only on restart */
+static void
+_ibar_cb_iconsize_microscopic(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 8;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_tiny(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 12;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_very_small(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 16;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_small(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 24;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_medium(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 32;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_large(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 40;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_very_large(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 48;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_extremely_large(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 56;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_huge(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 64;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_enormous(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 96;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
+static void
+_ibar_cb_iconsize_gigantic(void *data, E_Menu *m, E_Menu_Item *mi)
+{
+   IBar *ib;
+   Evas_List *l;
+   
+   ib = data;
+   ib->conf->iconsize = 128;
+   for (l = ib->bars; l; l = l->next)
+     {
+       IBar_Bar *ibb;
+       
+       ibb = l->data;
+       _ibar_bar_iconsize_change(ibb);
+       _ibar_bar_edge_change(ibb, ib->conf->edge);
+     }
+   e_config_save_queue();
+}
+
 static E_Menu *
 _ibar_config_menu_new(IBar *ib)
 {
@@ -372,29 +584,106 @@
    mi = e_menu_item_new(mn);
    e_menu_item_label_set(mi, "Fixed width");
    e_menu_item_radio_set(mi, 1);
-   e_menu_item_radio_group_set(mi, 2);
+   e_menu_item_radio_group_set(mi, 1);
    if (ib->conf->width > 0) e_menu_item_toggle_set(mi, 1);
    e_menu_item_callback_set(mi, _ibar_cb_width_fixed, ib);
 
    mi = e_menu_item_new(mn);
    e_menu_item_label_set(mi, "Auto fit icons");
    e_menu_item_radio_set(mi, 1);
-   e_menu_item_radio_group_set(mi, 2);
+   e_menu_item_radio_group_set(mi, 1);
    if (ib->conf->width < 0) e_menu_item_toggle_set(mi, 1);
    e_menu_item_callback_set(mi, _ibar_cb_width_auto, ib);
 
    mi = e_menu_item_new(mn);
    e_menu_item_label_set(mi, "Fill edge");
    e_menu_item_radio_set(mi, 1);
-   e_menu_item_radio_group_set(mi, 2);
+   e_menu_item_radio_group_set(mi, 1);
    if (ib->conf->width == 0) e_menu_item_toggle_set(mi, 1);
    e_menu_item_callback_set(mi, _ibar_cb_width_fill, ib);
    
-/*   
    mi = e_menu_item_new(mn);
    e_menu_item_separator_set(mi, 1);
 
    mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Microscopic");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 8) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_microscopic, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Tiny");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 12) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_tiny, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Very Small");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 16) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_very_small, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Small");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 24) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_small, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Medium");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 32) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_medium, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Large");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 40) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_large, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Very Large");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 48) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_very_large, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Exteremely Large");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 56) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_extremely_large, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Huge");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 64) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_huge, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Enormous");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 96) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_enormous, ib);
+   
+   mi = e_menu_item_new(mn);
+   e_menu_item_label_set(mi, "Gigantic");
+   e_menu_item_radio_set(mi, 1);
+   e_menu_item_radio_group_set(mi, 2);
+   if (ib->conf->iconsize == 128) e_menu_item_toggle_set(mi, 1);
+   e_menu_item_callback_set(mi, _ibar_cb_iconsize_gigantic, ib);
+   
+/*   
+   mi = e_menu_item_new(mn);
    e_menu_item_label_set(mi, "Auto hide");
    e_menu_item_check_set(mi, 1);
    if (ib->conf->autohide == 0) e_menu_item_toggle_set(mi, 1);
@@ -484,6 +773,22 @@
    e_config_save_queue();
 }
 
+static void
+_ibar_bar_iconsize_change(IBar_Bar *ibb)
+{
+   Evas_List *l;
+   
+   for (l = ibb->icons; l; l = l->next)
+     {
+       IBar_Icon *ic;
+       
+       ic = l->data;
+       _ibar_bar_icon_resize(ic);
+     }
+   _ibar_bar_convert_move_resize_to_config(ibb);
+   _ibar_bar_frame_resize(ibb);
+}
+
 static IBar_Icon *
 _ibar_bar_icon_find(IBar_Bar *ibb, E_App *a)
 {
@@ -609,6 +914,28 @@
 }
 
 static void
+_ibar_bar_icon_resize(IBar_Icon *ic)
+{
+   Evas_Object *o;
+   Evas_Coord bw, bh;
+   
+   e_box_freeze(ic->ibb->box_object);
+   o = ic->icon_object;
+   edje_extern_object_min_size_set(o, ic->ibb->ibar->conf->iconsize, 
ic->ibb->ibar->conf->iconsize);
+   edje_object_part_swallow(ic->bg_object, "item", o);
+   edje_object_size_min_calc(ic->bg_object, &bw, &bh);
+
+   e_box_pack_options_set(ic->bg_object,
+                         1, 1, /* fill */
+                         0, 0, /* expand */
+                         0.5, 0.5, /* align */
+                         bw, bh, /* min */
+                         bw, bh /* max */
+                         );
+   e_box_thaw(ic->ibb->box_object);
+}
+
+static void
 _ibar_bar_icon_reorder_before(IBar_Icon *ic, IBar_Icon *before)
 {
    Evas_Coord bw, bh;




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to