Add ability to set softkey size.
authorChristopher Michael <cpmichael1@comcast.net>
Fri, 2 Apr 2010 17:24:02 +0000 (17:24 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Fri, 2 Apr 2010 17:24:02 +0000 (17:24 +0000)
SVN revision: 47712

src/modules/illume-softkey/Makefile.am
src/modules/illume-softkey/e_mod_config.c [new file with mode: 0644]
src/modules/illume-softkey/e_mod_config.h [new file with mode: 0644]
src/modules/illume-softkey/e_mod_main.c
src/modules/illume-softkey/e_mod_sft_win.c
src/modules/illume-softkey/images/module_icon.png

index e9b26d9..7dbce3e 100644 (file)
@@ -32,6 +32,8 @@ pkg_LTLIBRARIES        = module.la
 module_la_SOURCES      = \
                        e_mod_sft_win.c \
                        e_mod_sft_win.h \
+                       e_mod_config.c \
+                       e_mod_config.h \
                        e_mod_main.c \
                        e_mod_main.h
 
diff --git a/src/modules/illume-softkey/e_mod_config.c b/src/modules/illume-softkey/e_mod_config.c
new file mode 100644 (file)
index 0000000..e808c63
--- /dev/null
@@ -0,0 +1,51 @@
+#include "e.h"
+#include "e_mod_main.h"
+#include "e_mod_config.h"
+
+/* local variables */
+EAPI Il_Sft_Config *il_sft_cfg = NULL;
+static E_Config_DD *conf_edd = NULL;
+
+int 
+il_sft_config_init(void) 
+{
+   conf_edd = E_CONFIG_DD_NEW("Illume-Softkey_Cfg", Il_Sft_Config);
+   #undef T
+   #undef D
+   #define T Il_Sft_Config
+   #define D conf_edd
+   E_CONFIG_VAL(D, T, version, INT);
+   E_CONFIG_VAL(D, T, height, INT);
+
+   il_sft_cfg = e_config_domain_load("module.illume-softkey", conf_edd);
+   if ((il_sft_cfg) && 
+       ((il_sft_cfg->version >> 16) < IL_CONFIG_MAJ))
+     {
+        E_FREE(il_sft_cfg);
+     }
+   if (!il_sft_cfg) 
+     {
+        il_sft_cfg = E_NEW(Il_Sft_Config, 1);
+        il_sft_cfg->version = 0;
+        il_sft_cfg->height = 32;
+     }
+   if (il_sft_cfg) 
+     il_sft_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
+
+   return 1;
+}
+
+int 
+il_sft_config_shutdown(void) 
+{
+   E_FREE(il_sft_cfg);
+   E_CONFIG_DD_FREE(conf_edd);
+
+   return 1;
+}
+
+int 
+il_sft_config_save(void) 
+{
+   return e_config_domain_save("module.illume-softkey", conf_edd, il_sft_cfg);
+}
diff --git a/src/modules/illume-softkey/e_mod_config.h b/src/modules/illume-softkey/e_mod_config.h
new file mode 100644 (file)
index 0000000..c4ea1e5
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef E_MOD_CONFIG_H
+#define E_MOD_CONFIG_H
+
+#define IL_CONFIG_MIN 0
+#define IL_CONFIG_MAJ 0
+
+typedef struct _Il_Sft_Config Il_Sft_Config;
+
+struct _Il_Sft_Config 
+{
+   int version, height;
+};
+
+int il_sft_config_init(void);
+int il_sft_config_shutdown(void);
+int il_sft_config_save(void);
+
+extern EAPI Il_Sft_Config *il_sft_cfg;
+
+#endif
index 0be948f..a4258a4 100644 (file)
@@ -1,5 +1,6 @@
 #include "e.h"
 #include "e_mod_main.h"
+#include "e_mod_config.h"
 #include "e_mod_sft_win.h"
 
 /* local variables */
@@ -22,6 +23,15 @@ e_modapi_init(E_Module *m)
    /* set module directory variable */
    _sft_mod_dir = eina_stringshare_add(m->dir);
 
+   /* init config subsystem */
+   if (!il_sft_config_init()) 
+     {
+        /* clear module directory variable */
+        if (_sft_mod_dir) eina_stringshare_del(_sft_mod_dir);
+        _sft_mod_dir = NULL;
+        return NULL;
+     }
+
    /* loop through the managers (root windows) */
    EINA_LIST_FOREACH(e_manager_list(), ml, man) 
      {
@@ -62,6 +72,9 @@ e_modapi_shutdown(E_Module *m)
    ecore_x_e_illume_softkey_geometry_set(ecore_x_window_root_first_get(), 
                                          0, 0, 0, 0);
 
+   /* shutdown config */
+   il_sft_config_shutdown();
+
    /* clear module directory variable */
    if (_sft_mod_dir) eina_stringshare_del(_sft_mod_dir);
    _sft_mod_dir = NULL;
@@ -72,5 +85,5 @@ e_modapi_shutdown(E_Module *m)
 EAPI int 
 e_modapi_save(E_Module *m) 
 {
-   return 1;
+   return il_sft_config_save();
 }
index c95840e..5d31889 100644 (file)
@@ -1,5 +1,6 @@
 #include "e.h"
 #include "e_mod_main.h"
+#include "e_mod_config.h"
 #include "e_mod_sft_win.h"
 
 /* local function prototypes */
@@ -76,11 +77,11 @@ e_mod_sft_win_new(E_Zone *zone)
    _e_mod_sft_win_create_default_buttons(swin);
 
    /* set minimum size of this window */
-   e_win_size_min_set(swin->win, zone->w, (32 * e_scale));
+   e_win_size_min_set(swin->win, zone->w, (il_sft_cfg->height * e_scale));
 
    /* position and resize this window */
    e_win_move_resize(swin->win, zone->x, (zone->y + zone->h - (32 * e_scale)), 
-                     zone->w, (32 * e_scale));
+                     zone->w, (il_sft_cfg->height * e_scale));
 
    /* show the window */
    e_win_show(swin->win);
@@ -93,8 +94,8 @@ e_mod_sft_win_new(E_Zone *zone)
 
    /* tell conformant apps our position and size */
    ecore_x_e_illume_softkey_geometry_set(zone->black_win, 
-                                         zone->x, (zone->h - (32 * e_scale)), 
-                                         zone->w, (32 * e_scale));
+                                         zone->x, (zone->h - (il_sft_cfg->height * e_scale)), 
+                                         zone->w, (il_sft_cfg->height * e_scale));
 
    return swin;
 }
@@ -165,7 +166,7 @@ _e_mod_sft_win_cb_win_prop(void *data, int type __UNUSED__, void *event)
    if (ev->atom != ATM_ENLIGHTENMENT_SCALE) return 1;
 
    /* set minimum size of this window */
-   e_win_size_min_set(swin->win, swin->zone->w, (32 * e_scale));
+   e_win_size_min_set(swin->win, swin->zone->w, (il_sft_cfg->height * e_scale));
 
    /* NB: Not sure why, but we need to tell this border to fetch icccm 
     * size position hints now :( (NOTE: This was not needed a few days ago) 
@@ -173,12 +174,12 @@ _e_mod_sft_win_cb_win_prop(void *data, int type __UNUSED__, void *event)
    swin->win->border->client.icccm.fetch.size_pos_hints = 1;
 
    /* resize this window */
-   e_win_resize(swin->win, swin->zone->w, (32 * e_scale));
+   e_win_resize(swin->win, swin->zone->w, (il_sft_cfg->height * e_scale));
 
    /* tell conformant apps our position and size */
    ecore_x_e_illume_softkey_geometry_set(swin->zone->black_win, 
                                          swin->win->x, swin->win->y, 
-                                         swin->win->w, (32 * e_scale));
+                                         swin->win->w, (il_sft_cfg->height * e_scale));
    return 1;
 }
 
@@ -193,7 +194,7 @@ _e_mod_sft_win_cb_zone_resize(void *data, int type __UNUSED__, void *event)
    if (ev->zone != swin->zone) return 1;
 
    /* set minimum size of this window */
-   e_win_size_min_set(swin->win, ev->zone->w, (32 * e_scale));
+   e_win_size_min_set(swin->win, ev->zone->w, (il_sft_cfg->height * e_scale));
 
    return 1;
 }
index 82c1b76..56691d0 100644 (file)
Binary files a/src/modules/illume-softkey/images/module_icon.png and b/src/modules/illume-softkey/images/module_icon.png differ