2006-04-13 20:47:06 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <gdk-pixbuf/gdk-pixdata.h>
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "baselayer.h"
|
|
|
|
#include "build.h"
|
|
|
|
|
2006-07-01 01:40:18 +00:00
|
|
|
int gtkenabled = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
static GdkPixbuf *appicon = NULL;
|
|
|
|
|
|
|
|
int gtkbuild_msgbox(char *name, char *msg)
|
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
GtkWidget *dialog;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!gtkenabled) return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
dialog = gtk_message_dialog_new(NULL,
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
GTK_BUTTONS_OK,
|
|
|
|
msg);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog), name);
|
|
|
|
gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
gtk_widget_destroy(dialog);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int gtkbuild_ynbox(char *name, char *msg)
|
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
int r;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
if (!gtkenabled) return -1;
|
|
|
|
|
|
|
|
dialog = gtk_message_dialog_new(NULL,
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
GTK_BUTTONS_YES_NO,
|
|
|
|
msg);
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog), name);
|
|
|
|
r = gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
|
gtk_widget_destroy(dialog);
|
|
|
|
|
|
|
|
if (r == GTK_RESPONSE_YES) return 1;
|
|
|
|
return 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RENDERTYPESDL
|
|
|
|
#include "sdlayer.h"
|
|
|
|
extern struct sdlappicon sdlappicon;
|
|
|
|
#endif
|
2006-07-01 01:40:18 +00:00
|
|
|
void gtkbuild_init(int *argc, char ***argv)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
gtkenabled = gtk_init_check(argc, argv);
|
|
|
|
if (!gtkenabled) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
#ifdef RENDERTYPESDL
|
2006-04-24 19:04:22 +00:00
|
|
|
appicon = gdk_pixbuf_new_from_data((const guchar *)sdlappicon.pixels,
|
|
|
|
GDK_COLORSPACE_RGB, TRUE, 8, sdlappicon.width, sdlappicon.height,
|
|
|
|
sdlappicon.width*4, NULL, NULL);
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif
|
2006-04-24 19:04:22 +00:00
|
|
|
if (appicon) gtk_window_set_default_icon(appicon);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void gtkbuild_exit(int r)
|
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!gtkenabled) return;
|
|
|
|
if (appicon) g_object_unref((gpointer)appicon);
|
|
|
|
//gtk_exit(r);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|