trauma spliting source into multiple files and applying autotools



I am recreating my app that was originally built from gtk+1/Glade v1
with hacked in gtk2 and has turned into a mess.

I'm working on Archlinux, GTK 2.16.2, Glade 3.6.7, anjuta 2.26.2.2,
autoconf 2.63, automake 1.11.

The source I have so far, I'm doing incremental additions, is based on
Micah Carrack's tutorial.

<code>
#include <gtk/gtk.h>


/* Globals */
GtkWidget               *chat_window;
GtkWidget               *logindialog;

/* Chat Window */
void on_chat_window_destroy(GtkObject *object, gpointer user_data)
{
        gtk_main_quit();
}

/* Connection Menu */
void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data)
{
        gtk_widget_show_all(logindialog);
}

void on_disconnect_activate(GtkMenuItem *menuitem, gpointer user_data)
{
        printf("on_disconnect_activate Under construction\n");
}

void on_quit_activate(GtkMenuItem *menuitem, gpointer user_data)
{
        gtk_main_quit();
}

/* Login Dialog*/
void on_invisiblebutton_toggled(GtkMenuItem *menuitem, gpointer
user_data) {
        printf("on_invisiblebutton_toggled Under construction\n");
}

void on_noroombutton_toggled(GtkMenuItem *menuitem, gpointer user_data)
{
        printf("on_noroombutton_toggled Under construction\n");
}

void on_loginbutton_clicked(GtkMenuItem *menuitem, gpointer user_data)
{
        printf("on_loginbutton_clicked Under construction\n");
}

void on_panicbutton_clicked(GtkMenuItem *menuitem, gpointer user_data)
{
        printf("on_panicbutton_clicked Under construction\n");
        gtk_widget_destroy(logindialog);
}

/***************************************************************/ 


int main(int argc, char *argv[])
{
        GtkBuilder              *builder;
        
        gtk_init(&argc, &argv);
        
        builder = gtk_builder_new();
        gtk_builder_add_from_file(builder, "tutor.xml", NULL);
 
        chat_window = GTK_WIDGET(gtk_builder_get_object (builder,
"chat_window")); logindialog = GTK_WIDGET(gtk_builder_get_object
(builder, "logindialog")); gtk_builder_connect_signals(builder,
NULL); g_object_unref(G_OBJECT (builder));
        
        gtk_widget_show(chat_window);       
        gtk_main();
        
        return 0;
}
</code>
compiling with:
gcc -Wall -g -o tutor main.c -export-dynamic `pkg-config --cflags
--libs gtk+-2.0` produces an executable that runs just as expected.

When I split the .c file into the main function as main.c and the
'callbacks' into callback.c and create the Makefile.am, configure.in,
etc compilation runs without error and the exec runs but hangs after
displaying: Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET
(widget)' failed

on:
 gtk_widget_show(chat_window); 

configure.in
<code>
AC_PREREQ([2.63])
AC_INIT([nuchimp], [0.1], [cheifchimp myemail])
AM_INIT_AUTOMAKE([nuchimp], [0.1])
AC_PREFIX_DEFAULT([$HOME])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC
GTK_CFLAGS="$GTK_CFLAGS `pkg-config --cflags --libs gtk+-2.0`
-export-dynamic" CFLAGS=" -g -O2"
# Checks for libraries.
AM_PATH_GTK_2_0(2.2.0,,AC_MSG_ERROR(BUMMER, I needs GTK+ 2.2.0))

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT
</code>

Makefile.am
<code>
## Process this file with automake to produce Makefile.in

bin_PROGRAMS = nuchimp

nuchimp_SOURCES = \
        callback.c callback.h \
        main.c main.h 

INCLUDES        = @GTK_CFLAGS@
LDADD           = @GTK_LIBS@
CLEANFILES      = *~
DISTCLEANFILES  = .deps/*.P
</code>

Obviously I have missed something critical but for the liff of me I
can't see what, any help welcomed



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]