From 5f1f5d4d1e324ecd9ab173e708f6563c0fa8685e Mon Sep 17 00:00:00 2001 From: rephorm Date: Thu, 26 Jan 2006 05:56:34 +0000 Subject: [PATCH] add Configuration item to face menu (if the module defines e_modapi_config) SVN revision: 20038 --- src/bin/e_gadget.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/bin/e_gadget.c b/src/bin/e_gadget.c index 28e7a4f..f6eb5f2 100644 --- a/src/bin/e_gadget.c +++ b/src/bin/e_gadget.c @@ -17,6 +17,7 @@ */ static E_Gadget_Face *_e_gadget_face_new(E_Gadget *gad, E_Container *con, E_Zone *zone); +static void _e_gadget_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); 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); @@ -197,8 +198,17 @@ _e_gadget_face_menu_init(E_Gadget_Face *face) { E_Menu_Item *mi; + if (!face) return; + face->menu = e_menu_new(); + if (face->gad && face->gad->module && face->gad->module->func.config) + { + mi = e_menu_item_new(face->menu); + e_menu_item_label_set(mi, _("Configuration")); + e_menu_item_callback_set(mi, _e_gadget_cb_menu_configure, face->gad); + } + mi = e_menu_item_new(face->menu); e_menu_item_label_set(mi, _("Edit Mode")); e_menu_item_callback_set(mi, _e_gadget_cb_menu_edit, face); @@ -207,6 +217,20 @@ _e_gadget_face_menu_init(E_Gadget_Face *face) } static void +_e_gadget_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Gadget *gad; + E_Module *module; + + gad = data; + if (!gad) return; + module = gad->module; + if (!module) return; + + if (module->func.config) (module->func.config)(module); +} + +static void _e_gadget_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi) { E_Gadget_Face *face; -- 2.7.4