gtk2 gui support

This commit is contained in:
gbeauche 2005-06-19 15:52:09 +00:00
parent 7f3e40883a
commit d0fd88f7b2
2 changed files with 40 additions and 6 deletions

View File

@ -60,7 +60,14 @@ AC_ARG_ENABLE(addressing,
dnl External packages.
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]],
[case "$withval" in
gtk1) WANT_GTK="gtk";;
gtk|gtk2) WANT_GTK="$withval";;
yes) WANT_GTK="gtk2 gtk";;
*) WANT_GTK="no";;
esac],
[WANT_GTK="gtk2 gtk"])
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
dnl Canonical system information.
@ -239,7 +246,30 @@ fi
dnl We use GTK+ if possible.
UISRCS=../dummy/prefs_editor_dummy.cpp
if [[ "x$WANT_GTK" = "xyes" ]]; then
case "x$WANT_GTK" in
xgtk2*)
AM_PATH_GTK_2_0(1.3.15, [
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
UISRCS=prefs_editor_gtk.cpp
WANT_GTK=gtk2
], [
case "x${WANT_GTK}x" in
*gtkx)
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
WANT_GTK=gtk
;;
*)
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
WANT_GTK=no
;;
esac
])
;;
esac
if [[ "x$WANT_GTK" = "xgtk" ]]; then
AM_PATH_GTK(1.2.0, [
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"

View File

@ -189,7 +189,7 @@ static GtkWidget *make_file_entry(GtkWidget *top, int label_id, const char *pref
return entry;
}
static char *get_file_entry_path(GtkWidget *entry)
static const gchar *get_file_entry_path(GtkWidget *entry)
{
#ifdef HAVE_GNOMEUI
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(entry), false);
@ -387,7 +387,11 @@ bool PrefsEditor(void)
GtkAccelGroup *accel_group = gtk_accel_group_new();
GtkItemFactory *item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group);
gtk_item_factory_create_items(item_factory, sizeof(menu_items) / sizeof(menu_items[0]), menu_items, NULL);
#if GTK_CHECK_VERSION(1,3,15)
gtk_window_add_accel_group(GTK_WINDOW(win), accel_group);
#else
gtk_accel_group_attach(accel_group, GTK_OBJECT(win));
#endif
GtkWidget *menu_bar = gtk_item_factory_get_widget(item_factory, "<main>");
gtk_widget_show(menu_bar);
gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, TRUE, 0);
@ -442,7 +446,7 @@ struct file_req_assoc {
// Volume selected for addition
static void add_volume_ok(GtkWidget *button, file_req_assoc *assoc)
{
char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req));
gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req));
gtk_clist_append(GTK_CLIST(volume_list), &file);
gtk_widget_destroy(assoc->req);
delete assoc;
@ -451,9 +455,9 @@ static void add_volume_ok(GtkWidget *button, file_req_assoc *assoc)
// Volume selected for creation
static void create_volume_ok(GtkWidget *button, file_req_assoc *assoc)
{
char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req));
gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req));
char *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry));
const gchar *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry));
int size = atoi(str);
char cmd[1024];