2009-11-20 08:12:16 -08:00
|
|
|
/* Adding application icons */
|
2008-10-25 22:46:45 -07:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2009-01-05 18:10:45 -08:00
|
|
|
typedef struct _App App;
|
|
|
|
struct _App
|
|
|
|
{
|
|
|
|
const char *file; // must be unique - should normally be app name
|
|
|
|
const char *name, *generic, *comment; // fields we should provide
|
|
|
|
const char *exec; // the exec line
|
|
|
|
const char *icon; // icon file
|
|
|
|
const char *extra; // extra fields (tranlations etc.)
|
|
|
|
int found;
|
|
|
|
};
|
|
|
|
|
|
|
|
static App apps[] =
|
|
|
|
{
|
|
|
|
{ "firefox", "Firefox", "Web Browser", "Browse the Internet",
|
|
|
|
"firefox %u", "web_browser.png",
|
|
|
|
"StartupNotify=true\n"
|
|
|
|
"StartupWMClass=Firefox-bin\n"
|
|
|
|
"Categories=Application;Network;",
|
|
|
|
0 },
|
|
|
|
{ "xterm", "XTerm", "Terminal", "Run commands in a shell",
|
|
|
|
"xterm", "xterm.png",
|
|
|
|
"StartupWMClass=XTerm\n"
|
|
|
|
"Categories=Utility;TerminalEmulator;",
|
|
|
|
0 },
|
|
|
|
{ "eterm", "ETerm", "Terminal", "Run commands in a shell",
|
|
|
|
"Eterm", "xterm.png",
|
|
|
|
"StartupWMClass=Eterm\n"
|
|
|
|
"Categories=Utility;TerminalEmulator;",
|
|
|
|
0 },
|
|
|
|
{ "sylpheed", "Sylpheed", "E-Mail Client", "Read and write E-Mail",
|
|
|
|
"sylpheed", "mail_client.png",
|
|
|
|
"StartupNotify=true\n"
|
|
|
|
"StartupWMClass=Sylpheed\n"
|
|
|
|
"Categories=Application;Network;",
|
|
|
|
0 },
|
|
|
|
{ "xine", "Xine", "Movie Player", "Watch movies and videos",
|
|
|
|
"xine %U", "video_player.png",
|
|
|
|
"StartupWMClass=xine\n"
|
|
|
|
"Categories=Application;AudioVideo;Player;",
|
|
|
|
0 },
|
|
|
|
{ "mplayer", "MPlayer", "Movie Player", "Watch movies and videos",
|
|
|
|
"mplayer %U", "video_player.png",
|
|
|
|
"StartupWMClass=MPlayer\n"
|
|
|
|
"Categories=Application;AudioVideo;Player;",
|
|
|
|
0 },
|
|
|
|
{ "xmms", "XMMS", "Audio Player", "Listen to music",
|
|
|
|
"xmms %U", "audio_player.png",
|
|
|
|
"StartupWMClass=XMMS\n"
|
|
|
|
"Categories=Application;AudioVideo;Player;",
|
|
|
|
0 },
|
|
|
|
{ "beep-media-player", "BMP", "Audio Player", "Listen to music",
|
|
|
|
"beep-media-player %U", "audio_player.png",
|
|
|
|
"StartupWMClass=Beep-Media-Player\n"
|
|
|
|
"Categories=Application;AudioVideo;Player;",
|
|
|
|
0 },
|
|
|
|
{ "audacious", "Audacious", "Audio Player", "Listen to music",
|
|
|
|
"audacious %U", "audio_player.png",
|
|
|
|
"StartupWMClass=Audacious\n"
|
|
|
|
"Categories=Application;AudioVideo;Player;",
|
|
|
|
0 },
|
|
|
|
{ "gqview", "GQView", "Image Viewer", "Look at photos",
|
|
|
|
"gqview %U", "image_viewer.png",
|
|
|
|
"StartupWMClass=GQView\n"
|
|
|
|
"Categories=Application;Graphics;Viewer;",
|
|
|
|
0 },
|
|
|
|
{ "xjed", "X-Jed", "Text Editor", "Edit text files",
|
|
|
|
"xjed %U", "text_editor.png",
|
|
|
|
"StartupWMClass=XJed\n"
|
|
|
|
"Categories=Application;Utility;TextEditor;\n"
|
|
|
|
"MimeType=text/plain;",
|
|
|
|
0 }
|
|
|
|
// FIXME: add more apps to search for to add .desktops for OR add to ibar.
|
|
|
|
// feel free to have a pretty big list here. only list from the above ones
|
|
|
|
// that have a executable installed.
|
|
|
|
// FIXME: make sure these .desktop handle MimteType lists like xjed
|
|
|
|
// FIXME: this might be nice moved into a set of sample .desktops that get
|
|
|
|
// loaded and parsed to make it easier to add more in some dir somewhere
|
|
|
|
};
|
|
|
|
|
2009-09-03 09:32:48 -07:00
|
|
|
/* FIXME unused*/
|
|
|
|
#if 0
|
2009-01-05 18:10:45 -08:00
|
|
|
static int
|
|
|
|
_cb_sort_desks(Efreet_Desktop *d1, Efreet_Desktop *d2)
|
|
|
|
{
|
|
|
|
if (!d1->name) return 1;
|
|
|
|
if (!d2->name) return -1;
|
|
|
|
return strcmp(d1->name, d2->name);
|
|
|
|
}
|
2009-09-03 09:32:48 -07:00
|
|
|
#endif
|
2009-01-05 18:10:45 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_app_write(App *a)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s/applications",
|
|
|
|
efreet_data_home_get());
|
|
|
|
ecore_file_mkpath(buf);
|
|
|
|
snprintf(buf, sizeof(buf), "%s/applications/%s.desktop",
|
|
|
|
efreet_data_home_get(), a->file);
|
|
|
|
f = fopen(buf, "w");
|
|
|
|
if (!f) return;
|
|
|
|
fprintf(f,
|
|
|
|
"[Desktop Entry]\n"
|
|
|
|
"Encoding=UTF-8\n"
|
|
|
|
"Type=Application\n"
|
|
|
|
"Name=%s\n"
|
|
|
|
"GenericName=%s\n"
|
|
|
|
"Comment=%s\n"
|
|
|
|
"Exec=%s\n"
|
|
|
|
"Icon=%s\n",
|
|
|
|
a->name, a->generic, a->comment, a->exec, a->icon);
|
|
|
|
if (a->extra) fprintf(f, "%s\n", a->extra);
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
|
2008-10-25 22:46:45 -07:00
|
|
|
EAPI int
|
|
|
|
wizard_page_init(E_Wizard_Page *pg)
|
|
|
|
{
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
Eina_List *desks = NULL;
|
|
|
|
Efreet_Desktop *desk;
|
2009-01-05 18:10:45 -08:00
|
|
|
int i;
|
|
|
|
|
|
|
|
desks = efreet_util_desktop_name_glob_list("*");
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
EINA_LIST_FREE(desks, desk)
|
2009-01-05 18:10:45 -08:00
|
|
|
{
|
|
|
|
char dbuf[4096];
|
|
|
|
|
2010-03-25 22:34:34 -07:00
|
|
|
if (!desk->exec)
|
|
|
|
{
|
|
|
|
efreet_desktop_free(desk);
|
|
|
|
continue;
|
|
|
|
}
|
2009-01-05 18:10:45 -08:00
|
|
|
if (sscanf(desk->exec, "%4000s", dbuf) == 1)
|
|
|
|
{
|
|
|
|
for (i = 0; i < (sizeof(apps) / sizeof(App)); i++)
|
|
|
|
{
|
|
|
|
if (apps[i].found == 0)
|
|
|
|
{
|
|
|
|
char abuf[4096];
|
|
|
|
|
|
|
|
if (sscanf(apps[i].exec, "%4000s", abuf) == 1)
|
|
|
|
{
|
|
|
|
char *p1, *p2;
|
|
|
|
|
|
|
|
if (!ecore_file_app_installed(abuf))
|
|
|
|
{
|
|
|
|
/* can't find exe - mark as not available */
|
|
|
|
apps[i].found = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p1 = strrchr(dbuf, '/');
|
|
|
|
if (p1) p1++;
|
|
|
|
else p1 = dbuf;
|
|
|
|
p2 = strrchr(abuf, '/');
|
|
|
|
if (p2) p2++;
|
|
|
|
else p2 = abuf;
|
|
|
|
if (!strcmp(p1, p2))
|
|
|
|
/* mark as found in .desktops */
|
|
|
|
apps[i].found = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-03-25 22:34:34 -07:00
|
|
|
efreet_desktop_free(desk);
|
2009-01-05 18:10:45 -08:00
|
|
|
}
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
|
2009-01-05 18:10:45 -08:00
|
|
|
// FIXME: list all apps and of the apps either already installed, or to be
|
|
|
|
// created, offer them to be added to ibar by default. (actually should be
|
|
|
|
// page_080)
|
2008-10-25 22:46:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EAPI int
|
|
|
|
wizard_page_shutdown(E_Wizard_Page *pg)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EAPI int
|
|
|
|
wizard_page_show(E_Wizard_Page *pg)
|
|
|
|
{
|
2009-01-05 18:10:45 -08:00
|
|
|
Evas_Object *o, *of, *ob, *li, *ck;
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
int i;
|
|
|
|
int appnum = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < (sizeof(apps) / sizeof(App)); i++)
|
|
|
|
{
|
|
|
|
if (apps[i].found == 0) appnum++;
|
|
|
|
}
|
|
|
|
if (appnum == 0) return 0;
|
|
|
|
|
|
|
|
o = e_widget_list_add(pg->evas, 1, 0);
|
|
|
|
e_wizard_title_set(_("Applications"));
|
2008-10-26 02:04:05 -07:00
|
|
|
|
2009-01-05 18:10:45 -08:00
|
|
|
of = e_widget_framelist_add(pg->evas, _("Select Icons to Add"), 0);
|
|
|
|
|
|
|
|
li = e_widget_list_add(pg->evas, 1, 0);
|
|
|
|
ob = e_widget_scrollframe_simple_add(pg->evas, li);
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(ob, 140 * e_scale, 140 * e_scale);
|
2009-01-05 18:10:45 -08:00
|
|
|
|
|
|
|
for (i = 0; i < (sizeof(apps) / sizeof(App)); i++)
|
2008-10-26 02:04:05 -07:00
|
|
|
{
|
2009-01-05 18:10:45 -08:00
|
|
|
if (apps[i].found == 0)
|
|
|
|
{
|
|
|
|
char *icon;
|
|
|
|
|
|
|
|
apps[i].found = 1;
|
|
|
|
icon = efreet_icon_path_find(e_config->icon_theme,
|
|
|
|
apps[i].icon, 48);
|
|
|
|
ck = e_widget_check_icon_add(pg->evas, apps[i].name,
|
|
|
|
icon, 32 * e_scale, 32 * e_scale,
|
|
|
|
&(apps[i].found));
|
|
|
|
if (icon) free(icon);
|
|
|
|
e_widget_list_object_append(li, ck, 1, 1, 0.0);
|
|
|
|
evas_object_show(ck);
|
|
|
|
}
|
2008-10-26 02:04:05 -07:00
|
|
|
}
|
2009-01-05 18:10:45 -08:00
|
|
|
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_get(li, &mw, &mh);
|
2009-01-05 18:10:45 -08:00
|
|
|
evas_object_resize(li, mw, mh);
|
|
|
|
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
|
|
|
evas_object_show(ob);
|
|
|
|
evas_object_show(of);
|
|
|
|
evas_object_show(li);
|
|
|
|
|
|
|
|
e_wizard_page_show(o);
|
|
|
|
|
|
|
|
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
|
2008-10-25 22:46:45 -07:00
|
|
|
}
|
|
|
|
EAPI int
|
|
|
|
wizard_page_hide(E_Wizard_Page *pg)
|
|
|
|
{
|
2009-01-05 18:10:45 -08:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* .desktops are actually written here. this is because page_080 needs them
|
|
|
|
* to exist in the efreet desktops list to select what is to go in ibar */
|
|
|
|
for (i = 0; i < (sizeof(apps) / sizeof(App)); i++)
|
|
|
|
{
|
|
|
|
printf("%s %i\n", apps[i].name, apps[i].found);
|
|
|
|
if (apps[i].found == 1)
|
|
|
|
{
|
|
|
|
_app_write(&(apps[i]));
|
|
|
|
}
|
|
|
|
}
|
2008-10-25 22:46:45 -07:00
|
|
|
evas_object_del(pg->data);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EAPI int
|
|
|
|
wizard_page_apply(E_Wizard_Page *pg)
|
|
|
|
{
|
2009-01-05 18:10:45 -08:00
|
|
|
// FIXME: write ~/.e/e/applications/bar/default/.order
|
|
|
|
// which should contain whatever apps the user wants in their bar by
|
|
|
|
// default (should be page_080)
|
2008-10-25 22:46:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|