From: <enl...@li...> - 2006-01-26 05:17:59
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/e Dir : e17/apps/e/src/bin Modified Files: e_gadget.c e_gadget.h Log Message: Remove module menu from gadget code since it is no longer used. Include face count to ease matching config data to a face. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadget.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- e_gadget.c 12 Jan 2006 01:18:16 -0000 1.7 +++ e_gadget.c 26 Jan 2006 05:17:51 -0000 1.8 @@ -17,11 +17,9 @@ */ static E_Gadget_Face *_e_gadget_face_new(E_Gadget *gad, E_Container *con, E_Zone *zone); -static void _e_gadget_menu_init(E_Gadget *gad); static void _e_gadget_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_gadget_free(E_Gadget *gad); static void _e_gadget_face_cb_gmc_change(void * data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _e_gadget_menu_init(E_Gadget *gad); static void _e_gadget_face_menu_init(E_Gadget_Face *face); static void _e_gadget_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -32,20 +30,24 @@ * func_face_free should be defined. The possible fields api fields are: * * E_Module *module - the module that contains this gadget + * * char *name - a unique name for this module + * * void (*func_face_init) (void *data, E_Gadget_Face *gadget_face) - * A function that initializes the gadget's face. All evas objects should * be drawn on gadget_face->evas. + * * void (*func_face_free) (void *data, E_Gadget_Face *gadget_face) - * A function that frees all memory allocated in func_face_init + * * void (*func_change) (void *data, E_Gadget_Face *gadget_face, * E_Gadman_Client *gmc, E_Gadman_Change change) - * A function that is called whenever the gadget is resized. - * void (*func_menu_init) (void *data, E_Gadget *gadget) - - * A function that initializes the gadget's main menu. + * * void (*func_face_menu_init) (void *data, E_Gadget_Face *gadget_face) - * A function that initializes the gadget's face menu. This is displayed * when the user right clicks on the gadget's face. + * * void *data - a pointer to some data to be passed to all callbacks. * */ @@ -69,11 +71,9 @@ gad->funcs.face_init = api->func_face_init; gad->funcs.face_free = api->func_face_free; gad->funcs.change = api->func_change; - gad->funcs.menu_init = api->func_menu_init; gad->funcs.face_menu_init = api->func_face_menu_init; gad->data = api->data; - /* get all desktop evases, and call init function on them */ managers = e_manager_list(); for(l = managers; l; l = l->next) @@ -103,7 +103,6 @@ } } } - _e_gadget_menu_init(gad); return gad; } @@ -142,20 +141,7 @@ snprintf(buf, sizeof(buf), "module.%s", gad->name); face->gmc = e_gadman_client_new(con->gadman); e_gadman_client_zone_set(face->gmc, face->zone); - e_gadman_client_domain_set(face->gmc, buf, evas_list_count(gad->faces)); - - /* call the user init */ - if (gad->funcs.face_init) (gad->funcs.face_init)(gad->data, face); - - _e_gadget_face_menu_init(face); - - change = E_NEW(E_Gadget_Change, 1); - if (change) - { - printf("set change func\n"); - change->gadget = gad; - change->face = face; - } + e_gadman_client_domain_set(face->gmc, buf, gad->num_faces); /* set up some gadman defaults */ e_gadman_client_policy_set(face->gmc, @@ -169,11 +155,27 @@ e_gadman_client_auto_size_set(face->gmc, 40, 40); e_gadman_client_align_set(face->gmc, 1.0, 1.0); e_gadman_client_resize(face->gmc, 40, 40); + + change = E_NEW(E_Gadget_Change, 1); + if (change) + { + change->gadget = gad; + change->face = face; + } e_gadman_client_change_func_set(face->gmc, _e_gadget_face_cb_gmc_change, change); + + gad->faces = evas_list_append(gad->faces, face); + face->face_num = gad->num_faces; + gad->num_faces++; + + /* call the user init */ + if (gad->funcs.face_init) (gad->funcs.face_init)(gad->data, face); + + _e_gadget_face_menu_init(face); + e_gadman_client_load(face->gmc); evas_event_thaw(face->evas); - gad->faces = evas_list_append(gad->faces, face); return face; } @@ -191,13 +193,6 @@ } static void -_e_gadget_menu_init(E_Gadget *gad) -{ - gad->module->config_menu = gad->menu = e_menu_new(); - if (gad->funcs.menu_init) (gad->funcs.menu_init)(gad->data, gad); -} - -static void _e_gadget_face_menu_init(E_Gadget_Face *face) { E_Menu_Item *mi; @@ -242,7 +237,6 @@ evas_list_free(gad->faces); gad->module->config_menu = NULL; e_object_unref(E_OBJECT(gad->module)); - e_object_del(E_OBJECT(gad->menu)); if (gad->name) evas_stringshare_del(gad->name); free(gad); @@ -303,7 +297,7 @@ face = data; if (!face) return; - if (ev->button == 3 && face->gad->menu) + if (ev->button == 3 && face->menu) { e_menu_activate_mouse(face->menu, e_zone_current_get(face->con), ev->output.x, ev->output.y, 1, 1, =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadget.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_gadget.h 7 Jan 2006 10:39:45 -0000 1.4 +++ e_gadget.h 26 Jan 2006 05:17:51 -0000 1.5 @@ -18,9 +18,8 @@ int per_zone; /* 1 - one face per zone, 0 - one per container */ void (*func_face_init) (void *data, E_Gadget_Face *gadget_face); void (*func_face_free) (void *data, E_Gadget_Face *gadget_face); - void (*func_change) (void *data, E_Gadget_Face *gadget_face, E_Gadman_Client *gmc, E_Gadman_Change change); - void (*func_menu_init) (void *data, E_Gadget *gadget); void (*func_face_menu_init) (void *data, E_Gadget_Face *gadget_face); + void (*func_change) (void *data, E_Gadget_Face *gadget_face, E_Gadman_Client *gmc, E_Gadman_Change change); void *data; }; @@ -31,16 +30,17 @@ E_Module *module; const char *name; - E_Menu *menu; struct { void (*face_init) (void *data, E_Gadget_Face *gadget_face); void (*face_free) (void *data, E_Gadget_Face *gadget_face); - void (*change) (void *data, E_Gadget_Face *gadget_face, E_Gadman_Client *gmc, E_Gadman_Change change); - void (*menu_init) (void *data, E_Gadget *gadget); void (*face_menu_init) (void *data, E_Gadget_Face *gadget_face); + void (*change) (void *data, E_Gadget_Face *gadget_face, E_Gadman_Client *gmc, E_Gadman_Change change); } funcs; + int num_faces; + + void *conf; void *data; }; @@ -50,6 +50,7 @@ E_Container *con; E_Zone *zone; Evas *evas; + int face_num; E_Menu *menu; void *conf; |