diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 22 | ||||
-rw-r--r-- | lib/ephy-glade.c | 150 | ||||
-rw-r--r-- | lib/ephy-glade.h | 44 |
4 files changed, 13 insertions, 205 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index cec961f04..10a357a2e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -13,7 +13,6 @@ NOINST_H_FILES = \ ephy-dnd.h \ ephy-file-chooser.h \ ephy-file-helpers.h \ - ephy-glade.h \ ephy-gui.h \ ephy-langs.h \ ephy-module.h \ @@ -48,7 +47,6 @@ libephymisc_la_SOURCES = \ ephy-dnd.c \ ephy-file-chooser.c \ ephy-file-helpers.c \ - ephy-glade.c \ ephy-gui.c \ ephy-langs.c \ ephy-loader.c \ diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 9cd0518a3..ef264845c 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.c @@ -22,7 +22,6 @@ #include "config.h" #include "ephy-dialog.h" -#include "ephy-glade.h" #include "ephy-state.h" #include "ephy-gui.h" #include "eel-gconf-extensions.h" @@ -36,6 +35,9 @@ #include <gtk/gtkspinbutton.h> #include <gtk/gtkeditable.h> #include <gtk/gtkentry.h> +#include <gtk/gtksizegroup.h> +#include <gtk/gtkdialog.h> +#include <glade/glade-xml.h> enum { @@ -1035,14 +1037,18 @@ impl_construct (EphyDialog *dialog, const char *name, const char *domain) { + EphyDialogPrivate *priv = dialog->priv; GladeXML *gxml; - gxml = ephy_glade_widget_new - (file, name, &(dialog->priv->dialog), dialog, domain); + gxml = glade_xml_new (file, name, domain); + g_return_if_fail (gxml != NULL); - if (dialog->priv->name == NULL) + priv->dialog = glade_xml_get_widget (gxml, name); + g_return_if_fail (priv->dialog != NULL); + + if (priv->name == NULL) { - dialog->priv->name = g_strdup (name); + priv->name = g_strdup (name); } if (properties) @@ -1050,10 +1056,8 @@ impl_construct (EphyDialog *dialog, init_props (dialog, properties, gxml); } - g_signal_connect_object (dialog->priv->dialog, - "destroy", - G_CALLBACK(dialog_destroy_cb), - dialog, 0); + g_signal_connect_object (dialog->priv->dialog, "destroy", + G_CALLBACK(dialog_destroy_cb), dialog, 0); g_object_unref (gxml); } diff --git a/lib/ephy-glade.c b/lib/ephy-glade.c deleted file mode 100644 index 75dc067e3..000000000 --- a/lib/ephy-glade.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2000, 2004 Marco Pesenti Gritti - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -#include "config.h" - -#include "ephy-glade.h" - -#include <glade/glade-xml.h> -#include <gtk/gtkmenu.h> -#include <gmodule.h> - -static void -glade_signal_connect_func (const gchar *cb_name, GObject *obj, - const gchar *signal_name, const gchar *signal_data, - GObject *conn_obj, gboolean conn_after, - gpointer user_data); - -/** - * ephy_glade_widget_new: - * @file: a Glade XML file - * @widget_name: the name of a widget within @file - * @root: the returned root #GtkWidget pointer, or %NULL if not wanted - * @data: callback data to connect to all @root's signal callbacks - * @domain: the translation domain for the XML file (or %NULL for default) - * - * Builds a new #GladeXML object from the given @file with root widget - * @widget_name. The widget can also be aquired by passing @root, a pointer - * to a #GtkWidget pointer. - * - * The signal callbacks underneath the desired root widget in @file will all be - * automatically connected; the callback data will be @data. - * - * Libglade automatically caches @file; it is not inefficient to call - * ephy_glade_widget_new() several times on the same XML file. - * - * Return value: the desired #GladeXML object, or %NULL on failure - **/ -GladeXML * -ephy_glade_widget_new (const char *file, - const char *widget_name, - GtkWidget **root, - gpointer data, - const char *domain) -{ - GladeXML *gxml; - - /* build the widget */ - gxml = glade_xml_new (file, widget_name, domain); - g_return_val_if_fail (gxml != NULL, NULL); - - /* lookup the root widget if requested */ - if (root != NULL) - { - *root = glade_xml_get_widget (gxml, widget_name); - } - - /* connect signals and data */ - glade_xml_signal_autoconnect_full - (gxml, (GladeXMLConnectFunc)glade_signal_connect_func, data); - - /* return xml document for subsequent widget lookups */ - return gxml; -} - -/* - * glade_signal_connect_func: used by glade_xml_signal_autoconnect_full - */ -static void -glade_signal_connect_func (const gchar *cb_name, GObject *obj, - const gchar *signal_name, const gchar *signal_data, - GObject *conn_obj, gboolean conn_after, - gpointer user_data) -{ - /** Module with all the symbols of the program */ - static GModule *mod_self = NULL; - gpointer handler_func; - - /* initialize gmodule */ - if (mod_self == NULL) - { - mod_self = g_module_open (NULL, G_MODULE_BIND_LAZY); - g_assert (mod_self != NULL); - } - - /*g_print( "glade_signal_connect_func: cb_name = '%s', signal_name = '%s', signal_data = '%s'\n", - cb_name, signal_name, signal_data ); */ - - if (g_module_symbol (mod_self, cb_name, &handler_func)) - { - /* found callback */ - if (conn_obj) - { - if (conn_after) - { - g_signal_connect_object - (obj, signal_name, - handler_func, conn_obj, - G_CONNECT_AFTER); - } - else - { - g_signal_connect_object - (obj, signal_name, - handler_func, conn_obj, - G_CONNECT_SWAPPED); - } - } - else - { - /* no conn_obj; use standard connect */ - gpointer data = NULL; - - data = user_data; - - if (conn_after) - { - g_signal_connect_after - (obj, signal_name, - handler_func, data); - } - else - { - g_signal_connect - (obj, signal_name, - handler_func, data); - } - } - } - else - { - g_warning("callback function not found: %s", cb_name); - } -} diff --git a/lib/ephy-glade.h b/lib/ephy-glade.h deleted file mode 100644 index 324fe315e..000000000 --- a/lib/ephy-glade.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2000, 2004 Marco Pesenti Gritti - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -#ifndef EPHY_GLADE_H -#define EPHY_GLADE_H - -#include <glib.h> -#include <gtk/gtk.h> -#include <glade/glade-xml.h> - -G_BEGIN_DECLS - -typedef struct -{ - const gchar *name; - GtkWidget **ptr; -} WidgetLookup; - -GladeXML *ephy_glade_widget_new (const char *file, - const char *widget_name, - GtkWidget **root, - gpointer data, - const char *domain); - -G_END_DECLS - -#endif |