Commit 612e183b authored by Tristan Van Berkom's avatar Tristan Van Berkom

Added gnome catalog relevent files for translation.


	* po/POTFILES.in: Added gnome catalog relevent files for translation.

	* src/glade-devhelp.[ch]: Removed.

	* configure.in, src/Makefile.am: shuffled, devhelp removed

	* src/glade-project-window.c, src/glade-utils.[ch]: implement
	  devhelp search as `devhelp -s \"search string\"`. (spawn it)
parent 025d0b53
2006-05-22 Tristan Van Berkom <tvb@gnome.org>
* po/POTFILES.in: Added gnome catalog relevent files for translation.
* src/glade-devhelp.[ch]: Removed.
* configure.in, src/Makefile.am: shuffled, devhelp removed
* src/glade-project-window.c, src/glade-utils.[ch]: implement
devhelp search as `devhelp -s \"search string\"`. (spawn it)
2006-05-22 Tristan Van Berkom <tvb@gnome.org>
* src/Makefile.am, widgets/Makefile.am: Installed unwanted garbage
......
......@@ -46,17 +46,43 @@ ALL_LINGUAS="az da en_CA es fr ja ms nb nn pl pt pt_BR ru sk sv ta tr uk vi zh_C
AM_GLIB_GNU_GETTEXT
dnl ================================================================
dnl Check for gtk-doc
dnl ================================================================
GTK_DOC_CHECK(1.4)
dnl ================================================================
dnl Start of pkg-config checks
dnl Check for gtk+
dnl ================================================================
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8.0 libxml-2.0 >= 2.4.0)
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
PKG_CHECK_MODULES(DEVHELP, libdevhelp-1.0 >= 0.12,
[have_devhelp=yes],[have_devhelp=no])
dnl ================================================================
dnl Check for optional gnome libs
dnl ================================================================
PKG_CHECK_MODULES(GNOME, libbonoboui-2.0 libgnomeui-2.0,
[have_gnome=yes],[have_gnome=no])
AC_SUBST(GNOME_LIBS)
AC_SUBST(GNOME_CFLAGS)
AM_CONDITIONAL(BUILD_GNOME, test x"$have_gnome" = "xyes")
dnl ================================================================
dnl Check for windows
dnl ================================================================
case $host_os in
*mingw* | pw32* | cygwin*)
win32=yes
;;
esac
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
AM_CONDITIONAL(WITH_DEVHELP, test x"$have_devhelp" = "xyes")
glade_version="${VERSION}"
dnl ================================================================
dnl Misc substitutions
dnl ================================================================
de_version="${VERSION}"
glade_datadir='${datadir}/${PACKAGE}'
glade_libdir='${libdir}/${PACKAGE}'
glade_catalogsdir='${glade_datadir}/catalogs'
......@@ -65,12 +91,6 @@ glade_modulesdir='${glade_libdir}/modules'
glade_pluginsdir='${glade_libdir}/plugins'
glade_icondir='${datadir}/pixmaps'
glade_localedir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(DEVHELP_LIBS)
AC_SUBST(DEVHELP_CFLAGS)
AC_SUBST(glade_version)
AC_SUBST(glade_datadir)
AC_SUBST(glade_libdir)
......@@ -81,21 +101,6 @@ AC_SUBST(glade_pixmapsdir)
AC_SUBST(glade_icondir)
AC_SUBST(glade_localedir)
case $host_os in
*mingw* | pw32* | cygwin*)
win32=yes
;;
esac
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
PKG_CHECK_MODULES(GNOME, libbonoboui-2.0 libgnomeui-2.0,
[have_gnome=yes],[have_gnome=no])
AC_SUBST(GNOME_LIBS)
AC_SUBST(GNOME_CFLAGS)
AM_CONDITIONAL(BUILD_GNOME, test x"$have_gnome" = "xyes")
GTK_DOC_CHECK(1.4)
AC_OUTPUT([
Makefile
pixmaps/Makefile
......@@ -114,9 +119,7 @@ echo "
Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
Devhelp module: ${have_devhelp}
GnomeUI Catalog: ${have_gnome}
"
......@@ -35,7 +35,13 @@ src/glade-xml-utils.c
src/glade-project-view.c
src/glade-custom.c
# gladegtk plugin backend
# gtk plugin backend
src/glade-gtk.c
widgets/gtk+.xml.in
# gnome plugin backend
src/glade-gnome.c
widgets/gnome.xml.in
widgets/bonobo.xml.in
widgets/canvas.xml.in
......@@ -44,27 +44,6 @@ libgladegtk_la_LIBADD = libgladeui-1.la $(GTK_LIBS)
libgladegtkincludedir = $(includedir)/libgladeui-1.0/libgladeui
libgladegtkinclude_HEADERS = glade-gtk.h
# The Devhelp plugin
if WITH_DEVHELP
gladedevhelp_LTLIBRARIES = libgladedevhelp.la
gladedevhelpdir = $(glade_pluginsdir)
libgladedevhelp_la_CFLAGS = \
-g -Wall \
-I$(top_srcdir) \
-I$(top_builddir) \
$(DEVHELP_CFLAGS)
libgladedevhelp_la_SOURCES = glade-devhelp.c
libgladedevhelp_la_LDFLAGS = -module -avoid-version
libgladedevhelp_la_LIBADD = $(DEVHELP_LIBS)
libgladedevhelpincludedir = $(includedir)/libgladeui-1.0/libgladeui
libgladedevhelpinclude_HEADERS = glade-devhelp.h
endif
# The glade-3 core library
libgladeui_1_la_SOURCES = \
glade-debug.c \
......@@ -160,10 +139,6 @@ if WITH_WIN32
libgladegtk_la_LDFLAGS += -no-undefined
libgladeui_1_la_LDFLAGS += -no-undefined
if WITH_DEVHELP
libgladedevhelp_la_LDFLAGS += -no-undefined
endif
if BUILD_GNOME
libgladegnome_la_LDFLAGS += -no-undefined
endif
......
......@@ -64,8 +64,6 @@ struct _GladeProjectWindowPriv {
GtkWindow *palette_window; /* The window that will contain the palette */
GtkWindow *editor_window; /* The window that will contain the editor */
GtkWidget *devhelp; /* The embedded devhelp widget */
GtkWidget *devhelp_paned; /* A handle to control the devhelp paned window. */
GtkWidget *expand; /* Expand/Collapse the treeview */
GtkWidget *collapse;
......@@ -977,15 +975,7 @@ gpw_doc_search_cb (GladeEditor *editor,
const gchar *search,
GladeProjectWindow *gpw)
{
GtkWidget *item =
gtk_ui_manager_get_widget (gpw->priv->ui,
"/MenuBar/ViewMenu/HelpWindow");
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
gtk_widget_show (gpw->priv->devhelp);
gtk_paned_set_position (GTK_PANED (gpw->priv->devhelp_paned), 0);
glade_util_search_devhelp (gpw->priv->devhelp, book, page, search);
glade_util_search_devhelp (book, page, search);
}
static void
......@@ -1233,37 +1223,10 @@ gpw_toggle_editor_help_cb (GtkAction *action, GladeProjectWindow *gpw)
glade_editor_hide_context_info (glade_app_get_editor ());
}
static void
gpw_toggle_help_window_cb (GtkAction *action, GladeProjectWindow *gpw)
{
GtkWidget *editor_item;
if (glade_util_have_devhelp() == FALSE)
return;
editor_item = gtk_ui_manager_get_widget (gpw->priv->ui,
"/MenuBar/ViewMenu/HelpWindow");
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (editor_item)))
gtk_widget_show (gpw->priv->devhelp);
else
gtk_widget_hide (gpw->priv->devhelp);
}
static void
gpw_documentation_cb (GtkAction *action, GladeProjectWindow *gpw)
{
GtkWidget *item =
gtk_ui_manager_get_widget (gpw->priv->ui,
"/MenuBar/ViewMenu/HelpWindow");
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
gtk_widget_show (gpw->priv->devhelp);
gtk_paned_set_position (GTK_PANED (gpw->priv->devhelp_paned), 0);
glade_util_search_devhelp (gpw->priv->devhelp, "gladeui", NULL, NULL);
glade_util_search_devhelp ("gladeui", NULL, NULL);
}
static void
......@@ -1354,7 +1317,6 @@ static const gchar *ui_info =
" <menuitem action='Clipboard'/>\n"
" <separator/>\n"
" <menuitem action='PropertyEditorHelp'/>\n"
" <menuitem action='HelpWindow'/>\n"
" </menu>\n"
" <menu action='ProjectMenu'>\n"
" <placeholder name='ProjectsListPlaceholder'/>\n"
......@@ -1455,11 +1417,6 @@ static GtkToggleActionEntry view_entries[] = {
{ "PropertyEditorHelp", NULL, "Context _Help", NULL,
"Show or hide contextual help buttons in the editor",
G_CALLBACK (gpw_toggle_editor_help_cb), FALSE },
{ "HelpWindow", NULL, "Help _Window", NULL,
"Show or hide the help window",
G_CALLBACK (gpw_toggle_help_window_cb), FALSE }
};
static guint n_view_entries = G_N_ELEMENTS (view_entries);
......@@ -1648,7 +1605,7 @@ glade_project_window_create (GladeProjectWindow *gpw)
GtkWidget *toolbar;
GtkWidget *project_view;
GtkWidget *statusbar;
GtkWidget *editor_item, *help_item, *docs_item;
GtkWidget *editor_item, *docs_item;
app = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_move (GTK_WINDOW (app), 0, 0);
......@@ -1675,57 +1632,25 @@ glade_project_window_create (GladeProjectWindow *gpw)
editor_item = gtk_ui_manager_get_widget (gpw->priv->ui,
"/MenuBar/ViewMenu/PropertyEditorHelp");
help_item = gtk_ui_manager_get_widget (gpw->priv->ui,
"/MenuBar/ViewMenu/HelpWindow");
docs_item = gtk_ui_manager_get_widget (gpw->priv->ui,
"/MenuBar/HelpMenu/Manual");
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (editor_item), FALSE);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (help_item), FALSE);
if ((gpw->priv->devhelp = glade_util_load_devhelp ()) != NULL)
if (glade_util_have_devhelp ())
{
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
GList *devhelp_buttons, *list;
gpw->priv->devhelp_paned = gtk_hpaned_new();
gtk_widget_show (gpw->priv->devhelp_paned);
gtk_paned_add1 (GTK_PANED (gpw->priv->devhelp_paned),
project_view);
gtk_paned_add2 (GTK_PANED (gpw->priv->devhelp_paned),
gpw->priv->devhelp);
gtk_box_pack_start (GTK_BOX (vbox), gpw->priv->devhelp_paned,
TRUE, TRUE, 0);
devhelp_buttons = glade_util_get_devhelp_hbuttons (gpw->priv->devhelp);
for (list = devhelp_buttons; list; list = list->next)
gtk_size_group_add_widget (group, GTK_WIDGET (list->data));
gtk_size_group_add_widget (group, gpw->priv->expand);
gtk_size_group_add_widget (group, gpw->priv->collapse);
g_object_unref (G_OBJECT (group));
g_list_free (devhelp_buttons);
glade_editor_show_info (glade_app_get_editor ());
glade_editor_hide_context_info (glade_app_get_editor ());
g_signal_connect (G_OBJECT (glade_app_get_editor ()), "gtk-doc-search",
G_CALLBACK (gpw_doc_search_cb), gpw);
/* Put a decent default page */
glade_util_search_devhelp (gpw->priv->devhelp, "gtk", NULL, NULL);
gtk_widget_hide (gpw->priv->devhelp);
}
else
{
gtk_widget_set_sensitive (editor_item, FALSE);
gtk_widget_set_sensitive (help_item, FALSE);
gtk_widget_set_sensitive (docs_item, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), project_view, TRUE, TRUE, 0);
}
gtk_box_pack_start (GTK_BOX (vbox), project_view, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (vbox), statusbar, FALSE, TRUE, 0);
gtk_widget_show (vbox);
......
......@@ -1611,116 +1611,58 @@ glade_util_file_is_writeable (const gchar *path)
return FALSE;
}
/* The devhelp module api here
*/
static GModule *devhelp_mod = NULL;
static GtkWidget *(* glade_dh_widget_new) (void) = NULL;
static GList *(* glade_dh_get_hbuttons) (GtkWidget *) = NULL;
static void (* glade_dh_widget_search) (GtkWidget *, const gchar *) = NULL;
/**
* glade_util_load_devhelp:
*
* Attempts to load the devhelp module
*
* Returns: the devhelp widget if successfull (%NULL otherwise)
* glade_util_have_devhelp:
*
* Returns: whether the devhelp module is loaded
*/
GtkWidget *
glade_util_load_devhelp (void)
gboolean
glade_util_have_devhelp (void)
{
static GtkWidget *widget = NULL;
gchar *path;
static gint have_devhelp = -1;
gchar *ptr;
gint cnt, ret, major, minor;
GError *error = NULL;
if (devhelp_mod == NULL &&
(path = g_module_build_path (glade_plugins_dir,
"gladedevhelp")) != NULL)
if (have_devhelp < 0 &&
(ptr = g_find_program_in_path ("devhelp")) != NULL)
{
if ((devhelp_mod =
g_module_open (path, G_MODULE_BIND_LOCAL)) != NULL)
{
if (!g_module_symbol (devhelp_mod,
"glade_dh_widget_new",
(gpointer)&glade_dh_widget_new))
{
g_critical ("Failed to load 'glade_dh_widget_new' "
"symbol from the devhelp module (%s)",
g_module_error ());
g_module_close (devhelp_mod);
devhelp_mod = NULL;
return NULL;
}
g_free (ptr);
if (!g_module_symbol (devhelp_mod,
"glade_dh_widget_search",
(gpointer)&glade_dh_widget_search))
{
g_critical ("Failed to load 'glade_dh_widget_search' "
"symbol from the devhelp module (%s)",
g_module_error ());
have_devhelp = 0;
g_module_close (devhelp_mod);
devhelp_mod = NULL;
return NULL;
}
if (!g_module_symbol (devhelp_mod,
"glade_dh_get_hbuttons",
(gpointer)&glade_dh_get_hbuttons))
if (g_spawn_command_line_sync ("devhelp --version",
&ptr, NULL, &ret, &error))
{
/* If we have a successfull return code.. parse the output.
*/
if (ret == 0)
{
g_critical ("Failed to load 'glade_dh_get_hbuttons' "
"symbol from the devhelp module (%s)",
g_module_error ());
g_module_close (devhelp_mod);
devhelp_mod = NULL;
return NULL;
if ((cnt = sscanf (ptr, "DevHelp %d.%d\n",
&major, &minor)) == 2)
{
/* Devhelp 0.12 required.
*/
if (major >= 0 &&
minor >= 12)
have_devhelp = 1;
} else {
g_warning ("devhelp had unparsable output: "
"'%s' (parsed %d)", ptr, cnt);
}
} else {
g_warning ("devhelp had bad return code: '%d'",
ret);
}
/* Load the widget */
widget = glade_dh_widget_new ();
} else {
g_critical ("Failed to load module %s (%s)",
path, g_module_error ());
g_warning ("Error trying to launch devhelp: %s",
error->message);
g_error_free (error);
}
g_free (path);
}
return widget;
}
/**
* glade_util_get_devhelp_hbuttons:
* @widget: The devhelp widget
*
* Used to align the buttons with the expand/colapse buttons
*
* Returns: a list of buttons in the hbox
*/
GList *
glade_util_get_devhelp_hbuttons (GtkWidget *devhelp)
{
g_return_val_if_fail (glade_util_have_devhelp (), NULL);
return glade_dh_get_hbuttons (devhelp);
}
/**
* glade_util_have_devhelp:
*
* Returns: whether the devhelp module is loaded
*/
gboolean
glade_util_have_devhelp (void)
{
return (devhelp_mod != NULL);
return have_devhelp;
}
/**
......@@ -1730,30 +1672,37 @@ glade_util_have_devhelp (void)
* @page: the page in the book (or %NULL)
* @search: the search string (or %NULL)
*
* Sets the current notebook page to the devhelp
* page and sets the search string.
* Envokes devhelp with the appropriate search string
*
*/
void
glade_util_search_devhelp (GtkWidget *devhelp,
const gchar *book,
glade_util_search_devhelp (const gchar *book,
const gchar *page,
const gchar *search)
{
gchar *book_comm = NULL, *page_comm = NULL;
gchar *string;
/* XXX
* g_spawn_command_line_somethingorother.
*/
GError *error = NULL;
gchar *book_comm = NULL, *page_comm = NULL;
gchar *string;
g_return_if_fail (glade_util_have_devhelp ());
if (book) book_comm = g_strdup_printf ("book:%s ", book);
if (page) page_comm = g_strdup_printf ("page:%s ", page);
string = g_strdup_printf ("%s%s%s",
string = g_strdup_printf ("devhelp -s \"%s%s%s\"",
book_comm ? book_comm : "",
page_comm ? page_comm : "",
search ? search : "");
glade_dh_widget_search (devhelp, string);
if (g_spawn_command_line_async (string, &error) == FALSE)
{
g_warning ("Error envoking devhelp: %s", error->message);
g_error_free (error);
}
g_free (string);
if (book_comm) g_free (book_comm);
......
......@@ -132,19 +132,12 @@ GModule *glade_util_load_library (const gchar *library_name);
LIBGLADEUI_API
gboolean glade_util_file_is_writeable (const gchar *path);
LIBGLADEUI_API
GtkWidget *glade_util_load_devhelp (void);
LIBGLADEUI_API
gboolean glade_util_have_devhelp (void);
LIBGLADEUI_API
void glade_util_search_devhelp (GtkWidget *devhelp,
const gchar *book,
void glade_util_search_devhelp (const gchar *book,
const gchar *page,
const gchar *search);
LIBGLADEUI_API
GList *glade_util_get_devhelp_hbuttons (GtkWidget *devhelp);
G_END_DECLS
#endif /* __GLADE_UTILS_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment