Callbacks when glade file is loaded using a dynamic library




Hi everyone, 

Currently, I have built my main application using glade. This file is then loaded by a C application. 

I then created another interface using Glade. When my main application loads, it loads a .so library which 
contains code for this subsection (kind of like a plugin). 

The .so file loads in the second glade file and attaches it into the interface of the main application. This 
all works problem. 

The problem I am facing now is that gtk_builder_connect_signals (builder, NULL); does not work. 

For my .so file, i have 3 files: 

   -libmyplugin.c 
   -libmyplugincallbacks.h 
   -libmyplugincallbacks.c 


My code for the libmyplugin.c file looks like this: 

   #include <stdlib.h> 
   #include <gtk/gtk.h> 
   #include "libmyplugincallbacks.h" 

   #define GUI "libmyplugingui.ui" 
   int startplugin(){
      extern *mainBuilder; 
      GtkBuilder *subbuilder; 

      //Do things like attach the glade file into the main glade file. 
      gtk_builder_connect_signals (builder, NULL);

   }

 

My libmyplugincallbacks.h

   #include <gtk/gtk.h> 

   void myfunc (GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data); 

 

My libplugincallbacks.c 

   #ifdef HAVE_CONFIG_H 
   #  include <config.h> 
   #endif 

   #include "libmyplugincallbacks.h" 
   #include <string.h> 

   void myfunc(GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path, gpointer data){ 
     if (GTK_IS_ENTRY (editable)) 
       { 
       //Do stuff 
       } 
   } 

 

When I compile my program, the .so file compiles properly. However, when ever I run the program, it loads the 
.so file. Once GTK builder gets to the stage where it connects the signals, it will complain that "myfunc" 
cannot be found. I have double checked the name of the function in my glade file and it is spelt and entered 
correctly.

 

Any ideas appreciated :)



                                          
_________________________________________________________________
Videos that have everyone talking! Now also in HD!
http://go.microsoft.com/?linkid=9724465


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