Remove libglade related code, since libglade is no longer available

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/11/head
Michele Calgaro 1 year ago
parent d47695232c
commit 0d2517aa94
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -95,10 +95,10 @@ if( NOT ZLIB_FOUND )
tde_message_fatal( "zlib are required, but not found on your system" ) tde_message_fatal( "zlib are required, but not found on your system" )
endif( NOT ZLIB_FOUND ) endif( NOT ZLIB_FOUND )
pkg_search_module( LIBGLADE libglade-2.0>=2.0.0 ) pkg_search_module( GTK gtk+-2.0 )
if( NOT LIBGLADE_FOUND ) if( NOT GTK_FOUND )
tde_message_fatal( "libglade-2.0 are required, but not found on your system" ) tde_message_fatal( "gtk2 is required but was not found on your system" )
endif( NOT LIBGLADE_FOUND ) endif( )
set( DL_LIBRARIES dl ) set( DL_LIBRARIES dl )
check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL ) check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )

@ -14,9 +14,10 @@ include_directories(
${CMAKE_INSTALL_INCLUDEDIR}/libr ${CMAKE_INSTALL_INCLUDEDIR}/libr
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${BACKEND_INCLUDE_DIRS} ${BACKEND_INCLUDE_DIRS}
${LIBGLADE_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}
) )
add_definitions( add_definitions(
-D__LIBR_BACKEND_${BACKEND_NAME}__ -D__LIBR_BACKEND_${BACKEND_NAME}__
-D__LIBR_BUILD__ -D__LIBR_BUILD__

@ -35,9 +35,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h> #include <glib.h>
/* For loading GLADE files */
#include <glade/glade.h>
/* For loading GTK+ Builder files */ /* For loading GTK+ Builder files */
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -47,19 +44,12 @@
/* For string handling */ /* For string handling */
#include <string.h> #include <string.h>
typedef gchar * (*GladeFileCallback)(GladeXML *, const gchar *, guint *);
GladeFileCallback glade_set_file_callback(GladeFileCallback callback, gpointer user_data);
/* Use weak binding for all glade and GTK+ requirements */
#pragma weak glade_set_file_callback
#pragma weak gtk_window_set_default_icon_list #pragma weak gtk_window_set_default_icon_list
#pragma weak gdk_pixbuf_loader_get_pixbuf #pragma weak gdk_pixbuf_loader_get_pixbuf
#pragma weak gtk_builder_add_from_string #pragma weak gtk_builder_add_from_string
#pragma weak gdk_pixbuf_loader_set_size #pragma weak gdk_pixbuf_loader_set_size
#pragma weak g_type_check_instance_cast #pragma weak g_type_check_instance_cast
#pragma weak gtk_builder_add_from_file #pragma weak gtk_builder_add_from_file
#pragma weak glade_xml_new_from_buffer
#pragma weak gdk_pixbuf_loader_write #pragma weak gdk_pixbuf_loader_write
#pragma weak gdk_pixbuf_loader_close #pragma weak gdk_pixbuf_loader_close
#pragma weak gdk_pixbuf_loader_new #pragma weak gdk_pixbuf_loader_new
@ -67,23 +57,12 @@ GladeFileCallback glade_set_file_callback(GladeFileCallback callback, gpointer u
#pragma weak g_signal_connect #pragma weak g_signal_connect
#pragma weak gtk_builder_new #pragma weak gtk_builder_new
#pragma weak g_object_unref #pragma weak g_object_unref
#pragma weak glade_xml_new
#pragma weak g_list_append #pragma weak g_list_append
#pragma weak glade_init
#pragma weak gtk_init #pragma weak gtk_init
#pragma weak g_free #pragma weak g_free
#define GLADE_SECTION ".glade"
#define BUILDER_SECTION ".ui" #define BUILDER_SECTION ".ui"
/*
* Handle the resource request from libglade
*/
gchar *libr_glade_read_resource(GladeXML *gladefile, const gchar *filename, guint *size, gpointer user_data)
{
return libr_malloc((libr_file *) user_data, (char *) filename, (size_t *) size);
}
/* /*
* Handle the resource request from GtkBuilder * Handle the resource request from GtkBuilder
*/ */
@ -97,41 +76,6 @@ gboolean libr_gtk_read_resource(GtkBuilder *builder, const gchar *filename, gcha
return TRUE; return TRUE;
} }
/*
* Load the libglade resource appropriately for the currently installed version
* (AKA, hurray hacks!)
*/
GladeXML *libr_new_glade(libr_file *handle, char *gladefile, size_t gladefile_size)
{
if(glade_set_file_callback) /* The not-yet (ever?) existing way */
{
/* Register a callback for libglade to load our resources */
if(glade_set_file_callback((GladeFileCallback) libr_glade_read_resource, handle) != NULL)
printf("warning: over-wrote an application callback!\n");
/* Initialize libglade almost as usual, just use a buffer instead of a file */
return glade_xml_new_from_buffer(gladefile, gladefile_size, NULL, NULL);
}
else /* The hacky way */
{
char *glade_file[PATH_MAX];
GladeXML *ret = NULL;
char *temp_folder;
temp_folder = libr_extract_resources(handle);
if(temp_folder == NULL)
return NULL;
strcpy((char*)glade_file, temp_folder);
strcat((char*)glade_file, "/");
strcat((char*)glade_file, GLADE_SECTION);
ret = glade_xml_new((char*)glade_file, NULL, NULL);
if(ret == NULL)
cleanup_folder(temp_folder);
else
register_folder_cleanup(temp_folder);
return ret;
}
}
/* /*
* Load the GtkBuilder resource appropriately for the currently installed version * Load the GtkBuilder resource appropriately for the currently installed version
* (AKA, hurray hacks!) * (AKA, hurray hacks!)
@ -342,102 +286,3 @@ failed:
libr_close(handle); libr_close(handle);
return ret; return ret;
} }
/*
* Shared libglade resource loading
*/
GladeXML *libr_glade_load_internal(libr_file *handle, char *resource_name)
{
GladeXML *glade = NULL;
size_t glade_length;
char *glade_data;
/* Obtain the GLADE XML definition */
glade_data = libr_malloc(handle, resource_name, &glade_length);
if(glade_data == NULL)
{
/* Failed to obtain embedded glade file */
goto failed;
}
/* Initialize libglade appropriate for the available version */
glade = libr_new_glade(handle, glade_data, glade_length);
if(glade == NULL)
{
/* Failed to initialize embedded glade file */
goto failed;
}
failed:
free(glade_data);
return glade;
}
/*
* Load the requested libglade resource and any applicable icons
*/
EXPORT_FN int libr_glade_load(GladeHandle **glade_ret, char *resource_name)
{
libr_file *handle;
int ret = false;
if(glade_ret == NULL)
{
/* Why on earth would you call this without obtaining the handle to the resource? */
return false;
}
if(glade_init == NULL)
{
/* libglade was not linked with the application */
return false;
}
/* Obtain the handle to the executable */
if((handle = libr_open(NULL, LIBR_READ)) == NULL)
{
/* "Failed to open this executable (%s) for resources", progname() */
return false;
}
register_internal_handle(handle);
*glade_ret = libr_glade_load_internal(handle, resource_name);
if(*glade_ret == NULL)
goto failed;
ret = true;
failed:
if(!ret)
libr_close(handle);
return ret;
}
/*
* Automatically load the ".glade" resource and any applicable icons
*/
EXPORT_FN int libr_glade_autoload(GladeHandle **glade_ret, IconList **icons_ret, int set_default_icon)
{
libr_file *handle = NULL;
GList *icons = NULL;
if(glade_ret == NULL)
{
/* Why on earth would you call this without obtaining the handle to the resource? */
return false;
}
if(glade_init == NULL)
{
/* libglade was not linked with the application */
return false;
}
/* Obtain the handle to the executable */
if((handle = libr_open(NULL, LIBR_READ)) == NULL)
{
/* "Failed to open this executable (%s) for resources", progname() */
return false;
}
register_internal_handle(handle);
icons = libr_gtk_iconlist(handle);
/* Set the embedded icons as the default icon list (if requested) */
if(icons != NULL && set_default_icon)
gtk_window_set_default_icon_list(icons);
/* Return the libglade and icon handles for the application */
*glade_ret = libr_glade_load_internal(handle, GLADE_SECTION);
if(icons_ret)
*icons_ret = icons;
return true;
}

@ -28,11 +28,6 @@
#include "libr.h" #include "libr.h"
#ifndef GLADE_H
typedef void GladeHandle;
#else
typedef GladeXML GladeHandle;
#endif
#ifndef __GTK_BUILDER_H__ #ifndef __GTK_BUILDER_H__
typedef void BuilderHandle; typedef void BuilderHandle;
#else #else
@ -48,8 +43,6 @@
IconList *libr_gtk_iconlist(libr_file *handle); IconList *libr_gtk_iconlist(libr_file *handle);
int libr_gtk_autoload(BuilderHandle **gtk_ret, IconList **icons_ret, int set_default_icon); int libr_gtk_autoload(BuilderHandle **gtk_ret, IconList **icons_ret, int set_default_icon);
int libr_gtk_load(BuilderHandle **gtk_ret, char *resource_name); int libr_gtk_load(BuilderHandle **gtk_ret, char *resource_name);
int libr_glade_autoload(GladeHandle **glade_ret, IconList **icons_ret, int set_default_icon);
int libr_glade_load(GladeHandle **glade_ret, char *resource_name);
#endif /* __LIBR_GTK_H */ #endif /* __LIBR_GTK_H */

Loading…
Cancel
Save