Enlightenment CVS committal
Author : onefang
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_fdo_menu_to_order.c e_fdo_menu_to_order.h
e_int_config_apps.c e_main.c
Log Message:
Part one of the quick'n'dirty "save our menu costumizations" hack.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fdo_menu_to_order.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- e_fdo_menu_to_order.c 13 Nov 2006 21:47:05 -0000 1.24
+++ e_fdo_menu_to_order.c 14 Nov 2006 21:44:34 -0000 1.25
@@ -3,8 +3,10 @@
//#define DEBUG 1
+// FIXME: Scan through ~/.e/e/applications/all, nuke any dangling links.
Start simple, add smarts later.
// FIXME: If there is only one top level menu, likely called "Applications",
then throw it away. The top level is already called "Applications".
+
struct order_data
{
char order_path[PATH_MAX];
@@ -28,22 +30,27 @@
static int menu_count;
static int item_count;
+static int _do_nuke;
EAPI void
-e_fdo_menu_to_order(void)
+e_fdo_menu_to_order(int do_nuke)
{
char dir[PATH_MAX];
- ecore_desktop_instrumentation_reset();
- /* Nuke the old menus. */
- snprintf(dir, sizeof(dir), "%s/.e/e/applications/menu/all/",
e_user_homedir_get());
- ecore_file_recursive_rm(dir);
menu_count = 0;
item_count = 0;
+ _do_nuke = do_nuke;
+ ecore_desktop_instrumentation_reset();
+ if (do_nuke)
+ {
+ /* Nuke the old menus. */
+ snprintf(dir, sizeof(dir), "%s/.e/e/applications/menu/all/",
e_user_homedir_get());
+ ecore_file_recursive_rm(dir);
+ }
ecore_desktop_menu_for_each(_e_fdo_menu_to_order_make_apps);
ecore_desktop_instrumentation_print();
/* This is a hueristic to guess if there are not enough apps. Feel free to
tweak it. */
- if ((item_count < 50) || (menu_count > (item_count * 3)))
+ if ((do_nuke) && ((item_count < 50) || (menu_count > (item_count * 3))) )
{
struct category_data cat_data;
@@ -119,12 +126,22 @@
Ecore_Hash_Node *node;
Ecore_Desktop *desktop;
const char *file, *key;
+ char path2[PATH_MAX];
+ int do_add, exists = 0;
order_data = (struct order_data *)user_data;
node = (Ecore_Hash_Node *) value;
key = (char *)node->key;
file = (char *)node->value;
- desktop = ecore_desktop_get(file, NULL);
+ do_add = _do_nuke;
+ snprintf(path2, sizeof(path2), "%s/.e/e/applications/all/%s",
e_user_homedir_get(), key);
+ if (ecore_file_exists(path2))
+ {
+ desktop = ecore_desktop_get(path2, NULL);
+ exists = 1;
+ }
+ else
+ desktop = ecore_desktop_get(file, NULL);
/* Check if we process */
if (!desktop) return;
if ( (!desktop->hidden) && (!desktop->no_display)
@@ -132,16 +149,17 @@
&& ((desktop->OnlyShowIn == NULL) ||(ecore_hash_get(desktop->OnlyShowIn,
"Enlightenment") != NULL))
&& ((desktop->NotShowIn == NULL) ||(ecore_hash_get(desktop->NotShowIn,
"Enlightenment") == NULL)) )
{
- char path2[PATH_MAX];
-
+ item_count++;
+ if (!exists)
+ {
#ifdef DEBUG
- printf("MAKING MENU ITEM %s -> %s (%s)\n", order_data->order_path,
file, key);
+ printf("MAKING MENU ITEM %s -> %s (%s)\n",
order_data->order_path, file, key);
#endif
- item_count++;
- snprintf(path2, sizeof(path2), "%s/.e/e/applications/all/%s",
e_user_homedir_get(), key);
- if (!ecore_file_exists(path2))
- ecore_file_symlink(file, path2);
- ecore_sheap_insert(order_data->sheap, strdup(key));
+ ecore_file_symlink(file, path2);
+ do_add = 1;
+ }
+ if (do_add)
+ ecore_sheap_insert(order_data->sheap, strdup(key));
}
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fdo_menu_to_order.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_fdo_menu_to_order.h 22 Aug 2006 23:20:12 -0000 1.2
+++ e_fdo_menu_to_order.h 14 Nov 2006 21:44:34 -0000 1.3
@@ -6,7 +6,7 @@
#ifndef E_FDO_MENU_TO_ORDER_H
#define E_FDO_MENU_TO_ORDER_H
-EAPI void e_fdo_menu_to_order(void);
+EAPI void e_fdo_menu_to_order(int do_nuke);
#endif
#endif
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_apps.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- e_int_config_apps.c 11 Nov 2006 22:20:36 -0000 1.42
+++ e_int_config_apps.c 14 Nov 2006 21:44:34 -0000 1.43
@@ -515,20 +515,21 @@
static E_Dialog *_e_int_config_apps_regen_dialog = NULL;
static void
-_e_int_config_apps_cb_regen_dialog_ok(void *data, E_Dialog *dia)
+_e_int_config_apps_cb_regen_dialog_regen(void *data, E_Dialog *dia)
{
e_object_del(E_OBJECT(_e_int_config_apps_regen_dialog));
_e_int_config_apps_regen_dialog = NULL;
- e_fdo_menu_to_order();
+ e_fdo_menu_to_order(1);
// if (cfdata->gui.o_fm_all) e_fm2_refresh(cfdata->gui.o_fm_all);
// if (cfdata->gui.o_fm) e_fm2_refresh(cfdata->gui.o_fm);
}
static void
-_e_int_config_apps_cb_regen_dialog_cancel(void *data, E_Dialog *dia)
+_e_int_config_apps_cb_regen_dialog_update(void *data, E_Dialog *dia)
{
e_object_del(E_OBJECT(_e_int_config_apps_regen_dialog));
_e_int_config_apps_regen_dialog = NULL;
+ e_fdo_menu_to_order(0);
}
static void
@@ -537,7 +538,8 @@
E_Dialog *dia;
dia = win->data;
- _e_int_config_apps_cb_regen_dialog_cancel(NULL, dia);
+ e_object_del(E_OBJECT(_e_int_config_apps_regen_dialog));
+ _e_int_config_apps_regen_dialog = NULL;
}
static void
@@ -550,19 +552,21 @@
_e_int_config_apps_regen_dialog =
e_dialog_new(e_container_current_get(e_manager_current_get()), "E",
"_menu_regen_dialog");
if (!_e_int_config_apps_regen_dialog) return;
e_win_delete_callback_set(_e_int_config_apps_regen_dialog->win,
_e_int_config_apps_cb_regen_dialog_delete);
- e_dialog_title_set(_e_int_config_apps_regen_dialog, _("Are you sure you
want to regenerate your Applications menus?"));
+ e_dialog_title_set(_e_int_config_apps_regen_dialog, _("Regenerate or update
your Applications menu?"));
e_dialog_text_set(_e_int_config_apps_regen_dialog,
- _("You are about to regenerate your Applications
menus.<br>"
+ _("You can regenerate your Applications menu.<br>"
"This will delete any customizations you have made.<br>"
- "This will replace the Applications menu with the system
menus.<br>"
+ "This will replace the Applications menu with the system
menu.<br>"
"<br>"
- "Are you sure you want to do this?"
+ "Or you could just update your Applications menu.<br>"
+ "This will add any new Applications, and remove any old
ones from<br>"
+ "your Applications menu. Customizations you have made
will remain."
));
e_dialog_icon_set(_e_int_config_apps_regen_dialog,
"enlightenment/regenerate_menus", 64);
- e_dialog_button_add(_e_int_config_apps_regen_dialog, _("Yes"), NULL,
- _e_int_config_apps_cb_regen_dialog_ok, NULL);
- e_dialog_button_add(_e_int_config_apps_regen_dialog, _("No"), NULL,
- _e_int_config_apps_cb_regen_dialog_cancel, NULL);
+ e_dialog_button_add(_e_int_config_apps_regen_dialog, _("Regenerate"), NULL,
+ _e_int_config_apps_cb_regen_dialog_regen, NULL);
+ e_dialog_button_add(_e_int_config_apps_regen_dialog, _("Update"), NULL,
+ _e_int_config_apps_cb_regen_dialog_update, NULL);
e_dialog_button_focus_num(_e_int_config_apps_regen_dialog, 1);
e_win_centered_set(_e_int_config_apps_regen_dialog->win, 1);
e_dialog_show(_e_int_config_apps_regen_dialog);
@@ -741,7 +745,7 @@
*/
if (!once)
{
- mt = e_widget_button_add(evas, _("Regenerate \"Applications\" Menu"),
"enlightenment/regenerate_menus",
+ mt = e_widget_button_add(evas, _("Regenerate/update \"Applications\"
Menu"), "enlightenment/regenerate_menus",
_cb_button_regen, cfdata, NULL);
cfdata->gui.o_regen_button = mt;
e_widget_framelist_object_append(of, mt);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_main.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -3 -r1.197 -r1.198
--- e_main.c 13 Nov 2006 14:47:56 -0000 1.197
+++ e_main.c 14 Nov 2006 21:44:34 -0000 1.198
@@ -996,13 +996,8 @@
snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/all/.order", homedir);
if (!ecore_file_exists(buf))
{
- e_fdo_menu_to_order();
+ e_fdo_menu_to_order(1);
}
- /* FIXME: Add another temporary hack to keep the users happy.
- * Move ~/.e/e/applications/all/*.eap to ~/.e/e/icons/*.edj
- * Read the non .edj info from them and construct a matching
~/.e/e/applications/all/*.desktop
- * Add an icon path to these .desktop files that points to the
~/.e/e/icons/*.edj files.
- */
/* FIXME: THIS is to get people started - shoudl be in a wizard */
snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites", homedir);
if (!ecore_file_exists(buf))
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs