summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-11-24 23:10:11 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-11-26 01:05:16 +0900
commit47a836e46d4e39793033888b561f4f9dd9f8239d (patch)
treeef72c4a91f7d47d98314ae59a075295f8d7d14b1
parent35d7395c4f9389cee8314e477dd7550b559af53a (diff)
downloadlibr-47a836e46d4e39793033888b561f4f9dd9f8239d.tar.gz
libr-47a836e46d4e39793033888b561f4f9dd9f8239d.zip
Remove libglade related code, since libglade is no longer available
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 0d2517aa9431164326a755f0f5dd95da142b55b4)
-rw-r--r--CMakeLists.txt8
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/libr-gtk.c155
-rw-r--r--src/libr-gtk.h7
4 files changed, 6 insertions, 167 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6c29ca..78d5571 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,10 +95,10 @@ if( NOT ZLIB_FOUND )
tde_message_fatal( "zlib are required, but not found on your system" )
endif( NOT ZLIB_FOUND )
-pkg_search_module( LIBGLADE libglade-2.0>=2.0.0 )
-if( NOT LIBGLADE_FOUND )
- tde_message_fatal( "libglade-2.0 are required, but not found on your system" )
-endif( NOT LIBGLADE_FOUND )
+pkg_search_module( GTK gtk+-2.0 )
+if( NOT GTK_FOUND )
+ tde_message_fatal( "gtk2 is required but was not found on your system" )
+endif( )
set( DL_LIBRARIES dl )
check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 56d1848..02d93e7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,9 +14,10 @@ include_directories(
${CMAKE_INSTALL_INCLUDEDIR}/libr
${CMAKE_BINARY_DIR}
${BACKEND_INCLUDE_DIRS}
- ${LIBGLADE_INCLUDE_DIRS}
+ ${GTK_INCLUDE_DIRS}
)
+
add_definitions(
-D__LIBR_BACKEND_${BACKEND_NAME}__
-D__LIBR_BUILD__
diff --git a/src/libr-gtk.c b/src/libr-gtk.c
index f746aa8..85e154c 100644
--- a/src/libr-gtk.c
+++ b/src/libr-gtk.c
@@ -35,9 +35,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
-/* For loading GLADE files */
-#include <glade/glade.h>
-
/* For loading GTK+ Builder files */
#include <gtk/gtk.h>
@@ -47,19 +44,12 @@
/* For string handling */
#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 gdk_pixbuf_loader_get_pixbuf
#pragma weak gtk_builder_add_from_string
#pragma weak gdk_pixbuf_loader_set_size
#pragma weak g_type_check_instance_cast
#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_close
#pragma weak gdk_pixbuf_loader_new
@@ -67,24 +57,13 @@ GladeFileCallback glade_set_file_callback(GladeFileCallback callback, gpointer u
#pragma weak g_signal_connect
#pragma weak gtk_builder_new
#pragma weak g_object_unref
-#pragma weak glade_xml_new
#pragma weak g_list_append
-#pragma weak glade_init
#pragma weak gtk_init
#pragma weak g_free
-#define GLADE_SECTION ".glade"
#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
*/
gboolean libr_gtk_read_resource(GtkBuilder *builder, const gchar *filename, gchar **data, gsize *size, GError **error, gpointer user_data)
@@ -98,41 +77,6 @@ gboolean libr_gtk_read_resource(GtkBuilder *builder, const gchar *filename, gcha
}
/*
- * 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
* (AKA, hurray hacks!)
*/
@@ -342,102 +286,3 @@ failed:
libr_close(handle);
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;
-}
diff --git a/src/libr-gtk.h b/src/libr-gtk.h
index fa6ba1b..124c952 100644
--- a/src/libr-gtk.h
+++ b/src/libr-gtk.h
@@ -28,11 +28,6 @@
#include "libr.h"
-#ifndef GLADE_H
- typedef void GladeHandle;
-#else
- typedef GladeXML GladeHandle;
-#endif
#ifndef __GTK_BUILDER_H__
typedef void BuilderHandle;
#else
@@ -48,8 +43,6 @@
IconList *libr_gtk_iconlist(libr_file *handle);
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_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 */