X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmain.c;h=5d7c6a3591e306c84c19aab073ebb7d2dfa3c110;hb=b2b735205d9b6c57635a052c8d4af1329bfda723;hp=41d770f7eb485b3493adaa8f21b747e00da7506d;hpb=0eacb2babbab14c5318e883963073b32079a9aff;p=melted_gui diff --git a/src/main.c b/src/main.c index 41d770f..5d7c6a3 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* - * main.c -- GTK+ 2 omnplay - * Copyright (C) 2011 Maksym Veremeyenko + * main.c -- GTK+ 2 melted gui + * Copyright (C) 2012 Maksym Veremeyenko * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,13 +31,38 @@ #include #include "ui.h" -#include "omnplay.h" +#include "instance.h" #include "support.h" +#ifdef _WIN32 +#include +#include + +char *strcasestr(char *haystack, char *needle) +{ + char *p, *startn = 0, *np = 0; + + for (p = haystack; *p; p++) { + if (np) { + if (toupper(*p) == toupper(*np)) { + if (!*++np) + return startn; + } else + np = 0; + } else if (toupper(*p) == toupper(*needle)) { + np = needle + 1; + startn = p; + } + } + + return 0; +}; +#endif /* _WIN32 */ + int main(int argc, char **argv) { char path[ 512 ], *buf; - omnplay_instance_t *app = NULL; + instance_t *app = NULL; #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); @@ -50,42 +75,48 @@ int main(int argc, char **argv) gtk_set_locale(); gtk_init(&argc, &argv); + memset(path, 0, sizeof(path)); #ifdef _WIN32 + GetModuleFileName(NULL, path, sizeof(path)); +// g_warning("GetModuleFileName [%s]\n", path); + if((buf = strstr(path, "\\bin\\" PACKAGE ".exe"))) + { + buf[0] = 0; + strcat(path, "\\share\\" PACKAGE "\\pixmaps"); + } #else // Linux hack to determine path of the executable - memset(path, 0, sizeof(path)); readlink( "/proc/self/exe", path, sizeof(path)); g_warning ("path=(%s)\n", path); - if((buf = strstr(path, "/bin/omnplay"))) + if((buf = strstr(path, "/bin/" PACKAGE))) { buf[0] = 0; - strcat(path, "/share/rugen/pixmaps"); + strcat(path, "/share/" PACKAGE "/pixmaps"); } - else if((buf = strstr(path, "/src/omnplay"))) + else if((buf = strstr(path, "/src/" PACKAGE))) { buf[0] = 0; strcat( path, "/pixmaps" ); } else snprintf(path, sizeof(path), "%s/%s/pixmaps", PACKAGE_DATA_DIR, PACKAGE); +#endif /* _WIN32 */ add_pixmap_directory( path ); g_warning ("add_pixmap_directory(%s)\n", path); -#endif /* _WIN32 */ - - app = omnplay_create(argc, argv); + app = instance_create(argc, argv); if(app->window) { gtk_widget_show (app->window); gdk_threads_enter(); - omnplay_init(app); + instance_init(app); gtk_main (); gdk_threads_leave(); }; - omnplay_destroy(app); + instance_destroy(app); return 0; }