gnome-build backend restructured
- From: Jeroen Zwartepoorte <jeroen xs4all nl>
- To: gnome-devtools gnome org
- Subject: gnome-build backend restructured
- Date: 17 Aug 2002 13:33:37 +0200
Hi all,
I've been busy the last week getting the gnome-build backend (just the
automake/autoconf project) to use glue instead of bonobo for activating
& communicating with a project. Using glue has some significant
advantages over bonobo in this case (no CORBA marshalling when
communicating with the project backend).
Glue is a simple plugin system, already being used for the anjuta2
plugins.
I've attached a patch against gnome-build and anjuta2 (project-tool &
symbol-browser plugins) so people can look at it and provide feedback
(before i commit anything).
The functionality is still the same as with bonobo, but it should be
easier getting additional functionality (like building a project)
working now (i did some hacking on this a while ago and the CORBA
marshalling was slowing things down significantly).
There's still a bug somewhere that causes anjuta2 to segfault when you
close a project and click in the editor (glimmer). I have no idea what's
causing that. This is a new bug.
The anjuta2 patch also still contains the terminal plugin changes.
Hopefully i can commit those real soon now.
Looking forward to comments,
Jeroen
? .tm_project.cache
? anjuta2.patch
? anjuta2.schemas
? autom4te-2.53.cache
? stamp-h1
? terminal.patch
? libanjuta/anjuta-marshal.c
? libanjuta/anjuta-marshal.h
? libanjuta/libanjuta-1.0.pc
? plugins/terminal/Makefile
? plugins/terminal/Makefile.in
? plugins/terminal/anjuta-terminal.server
? plugins/terminal/terminal-tool.c.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/anjuta2/ChangeLog,v
retrieving revision 1.221
diff -u -r1.221 ChangeLog
--- ChangeLog 14 Jul 2002 17:08:36 -0000 1.221
+++ ChangeLog 17 Aug 2002 11:28:09 -0000
@@ -1,3 +1,13 @@
+2002-08-08 Jeroen Zwartepoorte <jeroen xs4all nl>
+
+ * configure.in: Built terminal plugin only if vte is available.
+ * plugins/Makefile.am: Idem.
+ * plugins/terminal/Makefile.am: Use VTE_CFLAGS/LIBS.
+ * plugins/terminal/terminal-tool.c: (new_terminal), (term_init_cb),
+ (term_exited_cb), (term_destroy_cb), (term_new), (shell_set): Uses vte
+ now instead of zvt. Uses gnome-terminal gconf keys for font, colors and
+ behavior. Implemented creation of more than 1 terminal.
+
2002-07-14 Jeroen Zwartepoorte <jeroen xs4all nl>
* plugins/document-manager/anjuta-document-manager.c:
Index: configure.in
===================================================================
RCS file: /cvs/gnome/anjuta2/configure.in,v
retrieving revision 1.78
diff -u -r1.78 configure.in
--- configure.in 26 Jun 2002 16:25:27 -0000 1.78
+++ configure.in 17 Aug 2002 11:28:09 -0000
@@ -33,7 +33,7 @@
GNOME_VFS_REQUIRED=1.9.4
LIBXML_REQUIRED=2.4.12
LIBGTKHTML2_REQUIRED=1.99.2
-LIBZVT_REQUIRED=2.0.0
+VTE_REQUIRED=0.7.0
AC_SUBST(GTK_REQUIRED)
AC_SUBST(LIBGNOME_REQUIRED)
@@ -46,7 +46,7 @@
AC_SUBST(GNOME_VFS_REQUIRED)
AC_SUBST(LIBXML_REQUIRED)
AC_SUBST(LIBGTKHTML2_REQUIRED)
-AC_SUBST(LIBZVT_REQUIRED)
+AC_SUBST(VTE_REQUIRED)
dnl ==========================================================================
@@ -54,7 +54,9 @@
PKG_CHECK_MODULES(ANJUTA, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gdl-1.0 >= $GDL_REQUIRED libbonobo-2.0 >= $LIBBONOBO_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED)
-PKG_CHECK_MODULES(COMPONENT, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gdl-1.0 >= $GDL_REQUIRED libbonobo-2.0 >= $LIBBONOBO_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED gnome-build-1.0 >= $GNOME_BUILD_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED libgtkhtml-2.0 >= $LIBGTKHTML2_REQUIRED libzvt-2.0 >= $LIBZVT_REQUIRED)
+PKG_CHECK_MODULES(COMPONENT, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gdl-1.0 >= $GDL_REQUIRED libbonobo-2.0 >= $LIBBONOBO_REQUIRED libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED gnome-build-1.0 >= $GNOME_BUILD_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED libgtkhtml-2.0 >= $LIBGTKHTML2_REQUIRED)
+
+PKG_CHECK_MODULES(VTE, vte >= $VTE_REQUIRED, ENABLE_VTE="yes", ENABLE_VTE="no")
AC_SUBST(ANJUTA_CFLAGS)
AC_SUBST(ANJUTA_LIBS)
@@ -62,6 +64,14 @@
AC_SUBST(LIBANJUTA_LIBS)
AC_SUBST(COMPONENT_CFLAGS)
AC_SUBST(COMPONENT_LIBS)
+AC_SUBST(VTE_CFLAGS)
+AC_SUBST(VTE_LIBS)
+
+if test "x$ENABLE_VTE" = "xno"; then
+ AC_MSG_WARN(not building terminal plugin)
+fi
+
+AM_CONDITIONAL(ENABLE_TERMINAL, test "x$ENABLE_VTE" = "xyes")
# Devhelp idl
AC_MSG_CHECKING([for Devhelp IDL])
Index: plugins/Makefile.am
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/Makefile.am,v
retrieving revision 1.26
diff -u -r1.26 Makefile.am
--- plugins/Makefile.am 26 Jun 2002 16:25:28 -0000 1.26
+++ plugins/Makefile.am 17 Aug 2002 11:28:09 -0000
@@ -4,6 +4,12 @@
DEVHELP=
endif
+if ENABLE_TERMINAL
+TERMINAL=terminal
+else
+TERMINAL=
+endif
+
#if ENABLE_EVOLUTION
# Until a new evolution is released, this shouldn't be compiled.
#MAIL=evo-mail
@@ -20,7 +26,7 @@
shell-output \
symbol-browser \
text \
- terminal
+ $(TERMINAL)
XXX = debugger asciitable \
calculator docstat files functions
Index: plugins/project-manager/anjuta-project-manager.xml
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/project-manager/anjuta-project-manager.xml,v
retrieving revision 1.9
diff -u -r1.9 anjuta-project-manager.xml
--- plugins/project-manager/anjuta-project-manager.xml 21 May 2002 23:00:25 -0000 1.9
+++ plugins/project-manager/anjuta-project-manager.xml 17 Aug 2002 11:28:09 -0000
@@ -17,27 +17,57 @@
<cmd name="ProjectRemoveSource" _label="_Remove Source"
_tip="Remove source from project"/>
+
+ <cmd name="BuildAll" _label="All" _tip="Build the project"
+ pixtype="filename" pixname="gbf-build.png" sensitive="0"/>
+
+ <cmd name="BuildInstall" _label="Install" _tip="Install the project"
+ pixtype="filename" pixname="gbf-install.png" sensitive="0"/>
+
+ <cmd name="BuildRun" _label="Run" _tip="Run the project"
+ stockid="gtk-execute" sensitive="0"/>
+
+ <cmd name="BuildParameters" _label="Parameters"
+ _tip="Set the run parameters" sensitive="0"/>
</commands>
<menu>
- <submenu name="File" _label="_File">
- <placeholder name="ProjectOps">
+ <submenu name="File" _label="_File">
+ <placeholder name="ProjectOps">
<menuitem name="ProjectNew" _label="Ne_w Project" verb=""/>
<menuitem name="ProjectOpen" _label="Op_en Project" verb=""/>
<menuitem name="ProjectClose" _label="C_lose Project" verb=""/>
-</placeholder>
- </submenu>
-<submenu name="Project">
-<placeholder name="Sources">
+ </placeholder>
+ </submenu>
+ <submenu name="Project">
+ <placeholder name="Sources">
<menuitem name="ProjectAddSource" verb=""/>
<menuitem name="ProjectRemoveSource" verb=""/>
-</placeholder>
-</submenu>
+ </placeholder>
+ </submenu>
+
+ <placeholder name="BuildMenu">
+ <submenu name="Build" _label="_Build">
+ <menuitem name="BuildAll" verb=""/>
+ <menuitem name="BuildInstall" verb=""/>
+ <separator/>
+ <menuitem name="BuildRun" verb=""/>
+ <menuitem name="BuildParameters" verb=""/>
+ </submenu>
+ </placeholder>
</menu>
<dockitem name="Project" homogeneous="0" band_num="1" in_new_band="0" look="both_horiz">
<toolitem name="ProjectNew" verb=""/>
<toolitem name="ProjectOpen" verb="" priority="1"/>
<toolitem name="ProjectClose" verb=""/>
+ </dockitem>
+
+ <dockitem name="Build" homogeneous="0" band_num="2" in_new_band="0" look="both_horiz">
+ <placeholder name="BuildToolbar">
+ <toolitem name="BuildAll" verb=""/>
+ <toolitem name="BuildInstall" verb=""/>
+ <toolitem name="BuildRun" verb=""/>
+ </placeholder>
</dockitem>
</Root>
Index: plugins/project-manager/project-tool.c
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/project-manager/project-tool.c,v
retrieving revision 1.31
diff -u -r1.31 project-tool.c
--- plugins/project-manager/project-tool.c 8 Jun 2002 23:15:53 -0000 1.31
+++ plugins/project-manager/project-tool.c 17 Aug 2002 11:28:10 -0000
@@ -1,40 +1,51 @@
-/* Anjuta Project Manager component, based on gnome-build2 */
+/* Anjuta
+ * Copyright (C) 2001 JP Rosevear
+ *
+ * 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
#include <config.h>
-
-#include <bonobo/bonobo-shlib-factory.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-ui-component.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <string.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-file-selector-util.h>
-#include <bonobo/bonobo-widget.h>
-#include <bonobo/bonobo-window.h>
-#include <gbf/gnome-build.h>
+#include <gconf/gconf-client.h>
+#include <gdl/gdl.h>
+#include <gbf/gbf-backend.h>
+#include <gbf/gbf-project-tree.h>
+#include <gbf/gbf-target-tree.h>
+#include <gbf/gbf-build-info.h>
#if 0
#include <gbf-project-druid/gbf-project-druid.h>
#include <gbf-project-druid/gbf-druid-bonobo-project.h>
#endif
-#include <gconf/gconf-client.h>
-#include <gdl/gdl.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libanjuta/libanjuta.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <string.h>
+#include <libgnomevfs/gnome-vfs.h>
#define RECENT_PROJECTS_LIMIT "/apps/anjuta2/plugins/project_manager/recent_projects_limit"
typedef struct {
AnjutaTool parent;
- Bonobo_Control file_tree;
- Bonobo_Control target_tree;
- Bonobo_Control build_info;
-
- GNOME_Development_Project project;
- GNOME_Development_Target *current_target;
+ GtkWidget *file_tree;
+ GtkWidget *target_tree;
+ GtkWidget *build_info;
+
+ GbfProject *project;
+ GbfProjectTarget *current_target;
GdlRecent *recent;
} ProjectTool;
@@ -44,35 +55,35 @@
} ProjectToolClass;
static void
-open_file (ProjectTool *tool, GNOME_Development_Source source, int line_num, CORBA_Environment *ev)
+open_file (ProjectTool *tool,
+ const char *filename,
+ int line_num)
{
gboolean res;
- res = anjuta_show_file (ANJUTA_TOOL (tool), source);
+ res = anjuta_show_file (ANJUTA_TOOL (tool), filename);
if (!res) {
anjuta_dialog_error (_("Unable to open file."));
return;
}
-
+
if (line_num != 0)
anjuta_set_line_num (ANJUTA_TOOL (tool), line_num);
}
static void
-set_current_target (ProjectTool *tool, GNOME_Development_Target *target)
+set_current_target (ProjectTool *tool, GbfProjectTarget *target)
{
if (tool->current_target) {
anjuta_shell_remove_value (ANJUTA_TOOL (tool)->shell,
"CurrentTarget",
NULL);
-
- CORBA_free (tool->current_target);
+
tool->current_target = NULL;
}
-
+
if (target) {
- tool->current_target = ORBit_copy_value (target,
- TC_GNOME_Development_Target);
+ tool->current_target = target;
anjuta_shell_add (ANJUTA_TOOL (tool)->shell,
"CurrentTarget",
G_TYPE_POINTER,
@@ -82,148 +93,81 @@
}
static void
-event_cb (BonoboListener *listener, const char *event,
- CORBA_any *any, CORBA_Environment *ev,
- gpointer user_data)
-{
- ProjectTool *tool = (ProjectTool*)user_data;
-
- if (!strcmp (event, "file-selected")) {
- GNOME_Development_Source source = BONOBO_ARG_GET_STRING (any);
-
- open_file (tool, source, 0, ev);
- } else if (!strcmp (event, "target-selected")) {
- set_current_target (tool, any->_value);
- } else if (!strcmp (event, "error-selected")) {
- GNOME_Development_BuildError *build_err = any->_value;
-
- open_file (tool, build_err->source, build_err->line, ev);
- }
-}
-
-static GNOME_Development_Project
-activate_id (const Bonobo_ActivationID id)
-{
- CORBA_Object object = CORBA_OBJECT_NIL;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- object = bonobo_get_object (id, "IDL:GNOME/Development/Project:1.0", &ev);
-
- if (BONOBO_EX (&ev))
- object = CORBA_OBJECT_NIL;
-
- CORBA_exception_free (&ev);
-
- return (GNOME_Development_Project) object;
-}
-
-static void
set_build (ProjectTool *proj_tool, const gchar *path)
{
AnjutaTool *tool = ANJUTA_TOOL (proj_tool);
- CORBA_Environment ev;
- Bonobo_PropertyBag pb;
- BonoboArg *arg;
- GNOME_Development_Project project = CORBA_OBJECT_NIL;
-
+ GbfProject *project = NULL;
+ GSList *l;
+ GError *err = NULL;
+
g_return_if_fail (tool != NULL);
g_return_if_fail (ANJUTA_IS_TOOL (tool));
-
- GDL_TRACE_EXTRA ("%s", path);
- CORBA_exception_init (&ev);
+ GDL_TRACE_EXTRA ("%s", path);
+ /* Close any open project first. */
if (proj_tool->project) {
anjuta_shell_remove_value (tool->shell,
- "CurrentProject",
- NULL);
- bonobo_object_release_unref (proj_tool->project, &ev);
- proj_tool->project = CORBA_OBJECT_NIL;
+ "CurrentProject",
+ NULL);
+ g_object_unref (proj_tool->project);
+ proj_tool->project = NULL;
}
if (path != NULL) {
- Bonobo_ServerInfoList *result = NULL;
- gboolean bail_out = FALSE;
+ GbfBackend *backend = NULL;
- /* Get a project */
- result = bonobo_activation_query (
- "repo_ids.has ('IDL:GNOME/Development/Build:1.0')", NULL, &ev);
-
- if (BONOBO_EX (&ev) ||
- result->_length == 0 ||
- (project = activate_id (result->_buffer[0].iid))
- == CORBA_OBJECT_NIL) {
- bail_out = TRUE;
+ gbf_backend_init ();
+
+ /* FIXME: Allow different project backends (use druid). */
+ for (l = gbf_backend_get_backends (); l; l = l->next) {
+ backend = l->data;
+ if (!strcmp (backend->id, "gbf-am:GbfAmProject"))
+ break;
+ backend = NULL;
}
-
- if (result)
- CORBA_free (result);
- if (bail_out) {
- anjuta_dialog_error (_("Could not activate the "
- "project component"));
- CORBA_exception_free (&ev);
+ if (!backend) {
+ anjuta_dialog_error (_("No project backends found"));
return;
- };
+ }
+
+ project = gbf_backend_new_project (backend->id);
+ if (!project) {
+ anjuta_dialog_error (_("Could not create project object"));
+ return;
+ }
/* Try to load the project */
- GNOME_Development_Project_load (project, path, &ev);
- if (BONOBO_EX (&ev)) {
- if (BONOBO_USER_EX (&ev, ex_GNOME_Development_Project_DoesntExist))
+ GBF_PROJECT_GET_CLASS (project)->load (project, path, &err);
+ if (err != NULL) {
+ if (g_error_matches (err, gbf_project_error_quark (),
+ GBF_PROJECT_ERROR_DOESNT_EXIST)) {
anjuta_dialog_error (_("Project does not exist!"));
- else if (BONOBO_USER_EX (&ev, ex_GNOME_Development_Project_Malformed))
+ } else if (g_error_matches (err, gbf_project_error_quark (),
+ GBF_PROJECT_ERROR_PROJECT_MALFORMED)) {
anjuta_dialog_error (_("Not a proper project!"));
- else
- anjuta_dialog_error (_("Unable to load project!"));
-
- CORBA_exception_free (&ev);
- bonobo_object_release_unref (project, &ev);
+ } else {
+ anjuta_dialog_error (_("Unable to load project"));
+ }
+ g_error_free (err);
return;
- };
+ }
+
+ g_print ("project loaded\n");
anjuta_shell_add (tool->shell,
"CurrentProject",
G_TYPE_POINTER,
project,
NULL);
-
- proj_tool->project = project;
- }
-
- arg = bonobo_arg_new (TC_GNOME_Development_Project);
- BONOBO_ARG_SET_GENERAL (arg, project, TC_GNOME_Development_Project,
- GNOME_Development_Project, NULL);
- arg->_release = FALSE;
-
- pb = Bonobo_Control_getProperties (proj_tool->file_tree, &ev);
- bonobo_pbclient_set_value (pb, "project", arg, &ev);
- if (BONOBO_EX (&ev)) {
- anjuta_dialog_error (_("Unexpected error while binding the "
- "project to the tree control"));
- CORBA_exception_free (&ev);
- }
-
- pb = Bonobo_Control_getProperties (proj_tool->target_tree, &ev);
- bonobo_pbclient_set_value (pb, "project", arg, &ev);
- if (BONOBO_EX (&ev)) {
- anjuta_dialog_error (_("Unexpected error while binding the "
- "project to the target control"));
- CORBA_exception_free (&ev);
- }
- pb = Bonobo_Control_getProperties (proj_tool->build_info, &ev);
- bonobo_pbclient_set_value (pb, "project", arg, &ev);
- if (BONOBO_EX (&ev)) {
- anjuta_dialog_error (_("Unexpected error while binding the "
- "project to the build info control"));
- CORBA_exception_free (&ev);
+ proj_tool->project = project;
}
- bonobo_arg_release (arg);
-
- CORBA_exception_free (&ev);
+ g_object_set (G_OBJECT (proj_tool->file_tree), "project", project, NULL);
+ g_object_set (G_OBJECT (proj_tool->target_tree), "project", project, NULL);
+ g_object_set (G_OBJECT (proj_tool->build_info), "project", project, NULL);
}
static void
@@ -402,6 +346,30 @@
#endif
}
+static void
+build_all (GtkWidget *widget,
+ gpointer data)
+{
+}
+
+static void
+build_install (GtkWidget *widget,
+ gpointer data)
+{
+}
+
+static void
+build_run (GtkWidget *widget,
+ gpointer data)
+{
+}
+
+static void
+build_params (GtkWidget *widget,
+ gpointer data)
+{
+}
+
static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ProjectNew", project_new),
BONOBO_UI_UNSAFE_VERB ("ProjectOpen", project_open),
@@ -409,122 +377,104 @@
BONOBO_UI_UNSAFE_VERB ("ProjectAddSource", project_add_source),
BONOBO_UI_UNSAFE_VERB ("ProjectRemoveSource", project_remove_source),
+
+ BONOBO_UI_UNSAFE_VERB ("BuildAll", build_all),
+ BONOBO_UI_UNSAFE_VERB ("BuildInstall", build_install),
+ BONOBO_UI_UNSAFE_VERB ("BuildRun", build_run),
+ BONOBO_UI_UNSAFE_VERB ("BuildParameters", build_params),
+
BONOBO_UI_VERB_END
};
static void
-add_event_listener (AnjutaTool *tool, Bonobo_Control ctrl)
+file_selected_cb (GtkWidget *widget,
+ const char *filename,
+ gpointer user_data)
{
- BonoboListener *listener;
- CORBA_Object source;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- listener = bonobo_listener_new (NULL, NULL);
- g_signal_connect (G_OBJECT (listener), "event_notify",
- G_CALLBACK (event_cb), tool);
- source = Bonobo_Unknown_queryInterface (ctrl,
- "IDL:Bonobo/EventSource:1.0",
- &ev);
- if (!CORBA_Object_is_nil (source, &ev) && ev._major == CORBA_NO_EXCEPTION) {
- Bonobo_EventSource_addListener (source, bonobo_object_corba_objref (BONOBO_OBJECT (listener)), &ev);
- } else {
- g_error ("couldn't get event source for project tree widget");
- }
-
- CORBA_exception_free (&ev);
+ open_file (user_data, filename, 0);
}
static void
init_project_tree (AnjutaTool *tool)
{
- GtkWidget *widget;
- ProjectTool *proj_tool = (ProjectTool*)tool;
+ ProjectTool *proj_tool = (ProjectTool *)tool;
- widget = bonobo_widget_new_control
- ("OAFIID:GNOME_Development_ProjectTree",
- BONOBO_OBJREF (bonobo_window_get_ui_container (BONOBO_WINDOW (tool->shell))));
+ proj_tool->file_tree = gbf_project_tree_new ();
+ gtk_widget_show (proj_tool->file_tree);
- if (widget) {
- gtk_widget_show (widget);
-
- anjuta_shell_add_widget (tool->shell, widget,
- "ProjectFileTree",
- _("Files"),
- NULL);
-
- proj_tool->file_tree =
- bonobo_widget_get_objref (BONOBO_WIDGET (widget));
- add_event_listener (tool, proj_tool->file_tree);
- } else {
- g_warning ("Could not initialize project manager.");
- }
+ anjuta_shell_add_widget (tool->shell, proj_tool->file_tree,
+ "ProjectFileTree",
+ _("Files"),
+ NULL);
+
+ g_signal_connect (G_OBJECT (proj_tool->file_tree),
+ "file_selected",
+ G_CALLBACK (file_selected_cb),
+ tool);
}
static void
init_target_tree (AnjutaTool *tool)
{
- GtkWidget *widget;
- ProjectTool *proj_tool = (ProjectTool*)tool;
+ ProjectTool *proj_tool = (ProjectTool *)tool;
- widget = bonobo_widget_new_control
- ("OAFIID:GNOME_Development_TargetTree",
- BONOBO_OBJREF (bonobo_window_get_ui_container (BONOBO_WINDOW (tool->shell))));
-
- if (widget) {
- gtk_widget_show (widget);
-
- anjuta_shell_add_widget (tool->shell, widget,
- "ProjectTargetTree",
- _("Targets"),
- NULL);
-
- proj_tool->target_tree =
- bonobo_widget_get_objref (BONOBO_WIDGET (widget));
- add_event_listener (tool, proj_tool->target_tree);
- } else {
- g_warning ("Could not initialize project manager.");
- }
+ proj_tool->target_tree = gbf_target_tree_new ();
+ gtk_widget_show (proj_tool->target_tree);
+
+ anjuta_shell_add_widget (tool->shell,
+ proj_tool->target_tree,
+ "ProjectTargetTree",
+ _("Targets"),
+ NULL);
+
+ g_signal_connect (G_OBJECT (proj_tool->target_tree),
+ "file_selected",
+ G_CALLBACK (file_selected_cb),
+ tool);
+ /*g_signal_connect (G_OBJECT (proj_tool->file_tree),
+ "target_selected",
+ G_CALLBACK (target_selected_cb),
+ tool);*/
+}
+
+static void
+error_selected_cb (GtkWidget *widget,
+ const char *filename,
+ int line,
+ gpointer user_data)
+{
+ open_file (user_data, filename, line);
}
static void
init_build_info (AnjutaTool *tool)
{
- GtkWidget *widget;
- ProjectTool *proj_tool = (ProjectTool*)tool;
+ ProjectTool *proj_tool = (ProjectTool *)tool;
- widget = bonobo_widget_new_control
- ("OAFIID:GNOME_Development_BuildInfo",
- BONOBO_OBJREF (bonobo_window_get_ui_container (BONOBO_WINDOW (tool->shell))));
-
- if (widget) {
- gtk_widget_show (widget);
-
- anjuta_shell_add_widget (tool->shell, widget,
- "ProjectBuildInfo",
- _("Build"),
- NULL);
-
- proj_tool->build_info =
- bonobo_widget_get_objref (BONOBO_WIDGET (widget));
- add_event_listener (tool, proj_tool->build_info);
- } else {
- g_warning ("Could not initialize project manager.");
- }
+ proj_tool->build_info = gbf_build_info_new ();
+ gtk_widget_show (proj_tool->build_info);
+
+ anjuta_shell_add_widget (tool->shell,
+ proj_tool->build_info,
+ "ProjectBuildInfo",
+ _("Build"),
+ NULL);
+
+ g_signal_connect (G_OBJECT (proj_tool->build_info),
+ "error_selected",
+ G_CALLBACK (error_selected_cb),
+ tool);
}
static void
shell_set (AnjutaTool *tool)
{
- CORBA_Environment ev;
GConfClient *client;
GdlRecent *recent;
ProjectTool *proj_tool = (ProjectTool*)tool;
g_return_if_fail (tool != NULL);
g_return_if_fail (ANJUTA_IS_TOOL (tool));
-
- CORBA_exception_init (&ev);
anjuta_tool_merge_ui (tool, "anjuta-project-manager",
DATADIR,
@@ -551,8 +501,6 @@
gdl_recent_set_ui_component (recent, tool->uic);
proj_tool->recent = recent;
-
- CORBA_exception_free (&ev);
}
static void
@@ -560,11 +508,7 @@
{
AnjutaTool *tool = ANJUTA_TOOL (obj);
ProjectTool *proj_tool = (ProjectTool*)obj;
-
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
-
if (proj_tool->file_tree) {
anjuta_shell_remove_value (tool->shell,
"ProjectFileTree",
@@ -590,9 +534,8 @@
anjuta_shell_remove_value (tool->shell,
"CurrentProject",
NULL);
- bonobo_object_release_unref (proj_tool->build_info, &ev);
+ g_object_unref (proj_tool->project);
proj_tool->project = NULL;
-
}
if (proj_tool->recent) {
@@ -601,8 +544,6 @@
}
anjuta_tool_unmerge_ui (tool);
-
- CORBA_exception_free (&ev);
}
static void
@@ -614,7 +555,7 @@
project_tool_class_init (GObjectClass *klass)
{
AnjutaToolClass *tool_class = ANJUTA_TOOL_CLASS (klass);
-
+
tool_class->shell_set = shell_set;
klass->dispose = dispose;
}
Index: plugins/symbol-browser/symbol-browser-tool.c
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/symbol-browser/symbol-browser-tool.c,v
retrieving revision 1.8
diff -u -r1.8 symbol-browser-tool.c
--- plugins/symbol-browser/symbol-browser-tool.c 8 Jun 2002 23:12:24 -0000 1.8
+++ plugins/symbol-browser/symbol-browser-tool.c 17 Aug 2002 11:28:10 -0000
@@ -22,7 +22,7 @@
#include <gnome.h>
#include <bonobo.h>
#include <gdl/gdl.h>
-#include <gbf/gnome-build.h>
+#include <gbf/gbf-project.h>
#include <bonobo-activation/bonobo-activation.h>
#include <libanjuta/libanjuta.h>
@@ -91,31 +91,22 @@
gpointer user_data)
{
CORBA_Environment ev;
- GNOME_Development_Project project;
- Bonobo_PropertyBag pb;
- CORBA_char *dir;
+ GbfProject *project;
+ char *dir;
SymbolBrowserTool *tool = (SymbolBrowserTool *)user_data;
- CORBA_exception_init (&ev);
-
project = g_value_get_pointer (value);
-
- pb = Bonobo_Unknown_queryInterface (project,
- "IDL:Bonobo/PropertyBag:1.0",
- &ev);
- g_assert (!BONOBO_EX (&ev));
-
+ g_assert (GBF_IS_PROJECT (project));
+
/* get directory of current project. */
- dir = bonobo_pbclient_get_string (pb, "project-dir", &ev);
- g_assert (!BONOBO_EX (&ev));
-
+ g_object_get (G_OBJECT (project), "project-dir", &dir, NULL);
+
+ CORBA_exception_init (&ev);
+
/* load the symbols for the current project. */
GNOME_Development_SymbolBrowser_openDirectory (tool->symbol_browser,
dir,
&ev);
- bonobo_object_release_unref (pb, &ev);
-
- g_free (dir);
g_assert (!BONOBO_EX (&ev));
CORBA_exception_free (&ev);
Index: plugins/terminal/Makefile.am
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/terminal/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- plugins/terminal/Makefile.am 26 Jun 2002 16:25:28 -0000 1.1
+++ plugins/terminal/Makefile.am 17 Aug 2002 11:28:10 -0000
@@ -3,6 +3,7 @@
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"\
-DANJUTA_DATADIR=\""$(datadir)"\" \
$(COMPONENT_CFLAGS) \
+ $(VTE_CFLAGS) \
$(WARN_FLAGS)
anjuta2_plugindir = $(anjuta2_plugin_dir)
@@ -14,7 +15,8 @@
terminal-tool.c
libanjuta_terminal_la_LIBADD = \
- $(COMPONENT_LIBS)
+ $(COMPONENT_LIBS) \
+ $(VTE_LIBS)
server_in_files = anjuta-terminal.server.in
Index: plugins/terminal/terminal-tool.c
===================================================================
RCS file: /cvs/gnome/anjuta2/plugins/terminal/terminal-tool.c,v
retrieving revision 1.1
diff -u -r1.1 terminal-tool.c
--- plugins/terminal/terminal-tool.c 26 Jun 2002 16:25:28 -0000 1.1
+++ plugins/terminal/terminal-tool.c 17 Aug 2002 11:28:11 -0000
@@ -20,12 +20,29 @@
#include <config.h>
#include <pwd.h>
#include <bonobo.h>
+#include <gconf/gconf-client.h>
#include <libanjuta/anjuta-tool.h>
#include <libanjuta/glue-plugin.h>
-#include <libzvt/libzvt.h>
+#include <vte/vte.h>
-#define ZVT_FONT "-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1"
-#define ZVT_SCROLLSIZE 200
+/* Number of terminals created. */
+#define TERMINAL_LIST "/apps/anjuta2/plugins/terminal/terminals"
+
+/* Some desktop/gnome-terminal gconf keys. */
+#define MONOSPACE_FONT "/desktop/gnome/interface/monospace_font_name"
+#define BACKGROUND_COLOR "/apps/gnome-terminal/profiles/Default/background_color"
+#define BACKSPACE_BINDING "/apps/gnome-terminal/profiles/Default/backspace_binding"
+#define CURSOR_BLINK "/apps/gnome-terminal/profiles/Default/cursor_blink"
+#define DELETE_BINDING "/apps/gnome-terminal/profiles/Default/delete_binding"
+#define EXIT_ACTION "/apps/gnome-terminal/profiles/Default/exit_action"
+#define TERMINAL_FONT "/apps/gnome-terminal/profiles/Default/font"
+#define FOREGROUND_COLOR "/apps/gnome-terminal/profiles/Default/foreground_color"
+#define SCROLLBACK_LINES "/apps/gnome-terminal/profiles/Default/scrollback_lines"
+#define SCROLL_ON_KEYSTROKE "/apps/gnome-terminal/profiles/Default/scroll_on_keystroke"
+#define SCROLL_ON_OUTPUT "/apps/gnome-terminal/profiles/Default/scroll_on_output"
+#define SILENT_BELL "/apps/gnome-terminal/profiles/Default/silent_bell"
+#define USE_SYSTEM_FONT "/apps/gnome-terminal/profiles/Default/use_system_font"
+#define WORD_CHARS "/apps/gnome-terminal/profiles/Default/word_chars"
gpointer parent_class;
extern char **environ;
@@ -38,10 +55,51 @@
AnjutaToolClass parent;
} TerminalToolClass;
+static GtkWidget *term_new (AnjutaTool *tool,
+ const char *name);
+
+static void term_g_slist_deep_free (GSList *list);
+
static void
new_terminal (GtkWidget *widget,
gpointer data)
{
+ AnjutaTool *tool = ANJUTA_TOOL (data);
+ GConfClient *client;
+ GSList *term_list, *l;
+ int i;
+ GtkWidget *terminal_widget;
+ char *name;
+
+ client = gconf_client_get_default ();
+ term_list = gconf_client_get_list (client, TERMINAL_LIST,
+ GCONF_VALUE_STRING, NULL);
+
+ i = 1;
+ while (TRUE) {
+ name = g_strdup_printf ("Terminal%d", i);
+ l = g_slist_find_custom (term_list, name, (GCompareFunc) strcmp);
+ if (!l)
+ break;
+ g_free (name);
+ i++;
+ }
+
+ /* Create new terminal. */
+ terminal_widget = term_new (tool, name);
+ anjuta_shell_add_widget (tool->shell,
+ terminal_widget,
+ name,
+ _("Terminal"),
+ NULL);
+
+ /* Save terminal list. */
+ term_list = g_slist_append (term_list, name);
+ gconf_client_set_list (client, TERMINAL_LIST, GCONF_VALUE_STRING,
+ term_list, NULL);
+ term_g_slist_deep_free (term_list);
+
+ g_object_unref (client);
}
static BonoboUIVerb verbs[] = {
@@ -89,85 +147,189 @@
term_init_cb (GtkWidget *widget,
gpointer data)
{
- ZvtTerm *term = ZVT_TERM (widget);
+ VteTerminal *term = VTE_TERMINAL (widget);
struct passwd *pw;
const char *shell;
const char *name;
char **env;
+ GConfClient *client;
+ GdkColor color;
+ char *colorname;
+
+ vte_terminal_reset (term, TRUE, TRUE);
+
+ pw = getpwuid (getuid ());
+ if (pw) {
+ shell = pw->pw_shell;
+ name = "-";
+ } else {
+ shell = "/bin/sh";
+ name = "-sh";
+ }
+ env = get_child_environment (widget);
+ vte_terminal_fork_command (term, shell, NULL, env);
+ g_strfreev (env);
+
+ client = gconf_client_get_default ();
+
+ /* Set fore- and background colors. */
+ colorname = gconf_client_get_string (client, BACKGROUND_COLOR, NULL);
+ gdk_color_parse (colorname, &color);
+ vte_terminal_set_color_background (term, &color);
+ colorname = gconf_client_get_string (client, FOREGROUND_COLOR, NULL);
+ gdk_color_parse (colorname, &color);
+ vte_terminal_set_color_foreground (term, &color);
- zvt_term_reset (term, TRUE);
- switch (zvt_term_forkpty (term, ZVT_TERM_DO_UTMP_LOG | ZVT_TERM_DO_WTMP_LOG)) {
- case -1:
- break;
- case 0:
- pw = getpwuid (getuid ());
- if (pw) {
- shell = pw->pw_shell;
- name = "-";
- } else {
- shell = "/bin/sh";
- name = "-sh";
+ g_object_unref (client);
+}
+
+static GSList *
+term_delete_from_list (GSList *list,
+ const char *name)
+{
+ GSList *l, *ret_list;
+
+ /* Return list is maintained separately so that list
+ with deleted node could be returned */
+ ret_list = list;
+ for (l = list; l != NULL; l = l->next) {
+ char *text = l->data;
+
+ if (!strcmp (text, name)) {
+ ret_list = g_slist_delete_link (ret_list, l);
+ g_free (text);
+
+ /* Start the loop all over again to remove any more
+ duplicates */
+ l = ret_list;
+ if (!l)
+ break;
}
- env = get_child_environment (widget);
- execle (shell, name, NULL, env);
- g_strfreev (env);
- default:
- break;
}
+
+ return ret_list;
}
-static gboolean
-term_focus_cb (GtkWidget *widget,
- GdkEvent *event,
- gpointer data)
+static void
+term_exited_cb (GtkWidget *widget,
+ gpointer data)
{
- gtk_widget_grab_focus (widget);
+ AnjutaTool *tool = ANJUTA_TOOL (data);
+ GConfClient *client;
+ const char *exit_action, *name;
+ GSList *term_list;
+
+ client = gconf_client_get_default ();
+ exit_action = gconf_client_get_string (client, EXIT_ACTION, NULL);
+
+ if (!strcmp (exit_action, "close")) {
+ name = g_object_get_data (G_OBJECT (widget), "name");
+ anjuta_shell_remove_value (tool->shell, name, NULL);
+ term_list = gconf_client_get_list (client, TERMINAL_LIST,
+ GCONF_VALUE_STRING, NULL);
+ term_list = term_delete_from_list (term_list, name);
+ gconf_client_set_list (client, TERMINAL_LIST,
+ GCONF_VALUE_STRING, term_list, NULL);
+ term_g_slist_deep_free (term_list);
+ } else if (!strcmp (exit_action, "restart")) {
+ term_init_cb (widget, data);
+ }
- return TRUE;
+ g_object_unref (client);
}
static void
term_destroy_cb (GtkWidget *widget,
gpointer data)
{
+ char *name;
+
+ name = g_object_get_data (G_OBJECT (widget), "name");
+ g_free (name);
+
g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
G_CALLBACK (term_init_cb), NULL);
- zvt_term_closepty (ZVT_TERM (widget));
}
-static void
-shell_set (AnjutaTool *tool)
+static GtkWidget *
+term_new (AnjutaTool *tool,
+ const char *name)
{
- GtkWidget *zvt, *sb, *frame, *hbox;
- BonoboControl *control;
-
- anjuta_tool_merge_ui (tool,
- "anjuta-terminal-tool",
- ANJUTA_DATADIR,
- "anjuta-terminal-plugin.xml",
- verbs,
- tool);
+ GConfClient *client;
+ char *text;
+ int value;
+ gboolean setting;
+ GtkWidget *vte, *sb, *frame, *hbox;
+
+ client = gconf_client_get_default ();
+
+ /* Create new terminal. */
+ vte = vte_terminal_new ();
+ vte_terminal_set_size (VTE_TERMINAL (vte), 30, 1);
+ vte_terminal_set_mouse_autohide (VTE_TERMINAL (vte), TRUE);
+
+ /* Set terminal font either using the desktop wide font or g-t one. */
+ setting = gconf_client_get_bool (client, USE_SYSTEM_FONT, NULL);
+ if (setting) {
+ text = gconf_client_get_string (client, MONOSPACE_FONT, NULL);
+ if (!text)
+ text = gconf_client_get_string (client, TERMINAL_FONT, NULL);
+ } else {
+ text = gconf_client_get_string (client, TERMINAL_FONT, NULL);
+ }
+ vte_terminal_set_font_from_string (VTE_TERMINAL (vte), text);
- zvt = zvt_term_new ();
- zvt_term_set_font_name (ZVT_TERM (zvt), ZVT_FONT);
- zvt_term_set_blink (ZVT_TERM (zvt), FALSE);
- zvt_term_set_bell (ZVT_TERM (zvt), TRUE);
- zvt_term_set_scrollback (ZVT_TERM (zvt), ZVT_SCROLLSIZE);
- zvt_term_set_scroll_on_keystroke (ZVT_TERM (zvt), TRUE);
- zvt_term_set_scroll_on_output (ZVT_TERM (zvt), FALSE);
- zvt_term_set_background (ZVT_TERM (zvt), NULL, 0, 0);
- zvt_term_set_wordclass (ZVT_TERM (zvt), (unsigned char *) "-A-Za-z0-9,./?%&#:_");
- zvt_term_set_del_key_swap (ZVT_TERM (zvt), TRUE);
- zvt_term_set_del_is_del (ZVT_TERM (zvt), FALSE);
-
- g_signal_connect (G_OBJECT (zvt), "child_died",
- G_CALLBACK (term_init_cb), tool);
- g_signal_connect(G_OBJECT (zvt), "button_press_event",
- G_CALLBACK (term_focus_cb), tool);
- g_signal_connect (G_OBJECT (zvt), "destroy",
- G_CALLBACK (term_destroy_cb), tool);
+ setting = gconf_client_get_bool (client, CURSOR_BLINK, NULL);
+ vte_terminal_set_cursor_blinks (VTE_TERMINAL (vte), setting);
+ setting = gconf_client_get_bool (client, SILENT_BELL, NULL);
+ vte_terminal_set_audible_bell (VTE_TERMINAL (vte), !setting);
+ value = gconf_client_get_int (client, SCROLLBACK_LINES, NULL);
+ vte_terminal_set_scrollback_lines (VTE_TERMINAL (vte), value);
+ setting = gconf_client_get_bool (client, SCROLL_ON_KEYSTROKE, NULL);
+ vte_terminal_set_scroll_on_keystroke (VTE_TERMINAL (vte), setting);
+ setting = gconf_client_get_bool (client, SCROLL_ON_OUTPUT, NULL);
+ vte_terminal_set_scroll_on_output (VTE_TERMINAL (vte), TRUE);
+ text = gconf_client_get_string (client, WORD_CHARS, NULL);
+ vte_terminal_set_word_chars (VTE_TERMINAL (vte), text);
+
+ text = gconf_client_get_string (client, BACKSPACE_BINDING, NULL);
+ if (!strcmp (text, "ascii-del"))
+ vte_terminal_set_backspace_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_ASCII_DELETE);
+ else if (!strcmp (text, "escape-sequence"))
+ vte_terminal_set_backspace_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_DELETE_SEQUENCE);
+ else if (!strcmp (text, "control-h"))
+ vte_terminal_set_backspace_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_ASCII_BACKSPACE);
+ else
+ vte_terminal_set_backspace_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_AUTO);
+
+ text = gconf_client_get_string (client, DELETE_BINDING, NULL);
+ if (!strcmp (text, "ascii-del"))
+ vte_terminal_set_delete_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_ASCII_DELETE);
+ else if (!strcmp (text, "escape-sequence"))
+ vte_terminal_set_delete_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_DELETE_SEQUENCE);
+ else if (!strcmp (text, "control-h"))
+ vte_terminal_set_delete_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_ASCII_BACKSPACE);
+ else
+ vte_terminal_set_delete_binding (VTE_TERMINAL (vte),
+ VTE_ERASE_AUTO);
+
+ g_object_unref (client);
+
+ g_object_set_data (G_OBJECT (vte), "name", g_strdup (name));
+
+ g_signal_connect (G_OBJECT (vte), "child-exited",
+ G_CALLBACK (term_exited_cb), tool);
+ g_signal_connect (G_OBJECT (vte), "destroy",
+ G_CALLBACK (term_destroy_cb), NULL);
- sb = gtk_vscrollbar_new (GTK_ADJUSTMENT (ZVT_TERM (zvt)->adjustment));
+ sb = gtk_vscrollbar_new (GTK_ADJUSTMENT (VTE_TERMINAL (vte)->adjustment));
GTK_WIDGET_UNSET_FLAGS (sb, GTK_CAN_FOCUS);
frame = gtk_frame_new (NULL);
@@ -176,19 +338,63 @@
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), zvt, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vte, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), sb, FALSE, TRUE, 0);
gtk_widget_show_all (frame);
- control = bonobo_control_new (frame);
+ term_init_cb (vte, NULL);
+
+ return frame;
+}
+
+static void
+term_g_slist_deep_free (GSList *list)
+{
+ GSList *lst;
+
+ if (list == NULL)
+ return;
+
+ lst = list;
+ while (lst) {
+ g_free (lst->data);
+ lst->data = NULL;
+ lst = lst->next;
+ }
+
+ g_slist_free (list);
+}
- anjuta_shell_add_control (tool->shell,
- BONOBO_OBJREF (control),
- "Terminal",
- _("Terminal"),
- NULL);
+static void
+shell_set (AnjutaTool *tool)
+{
+ GConfClient *client;
+ GSList *term_list, *l;
+
+ anjuta_tool_merge_ui (tool,
+ "anjuta-terminal-tool",
+ ANJUTA_DATADIR,
+ "anjuta-terminal-plugin.xml",
+ verbs,
+ tool);
+
+ client = gconf_client_get_default ();
+ term_list = gconf_client_get_list (client, TERMINAL_LIST,
+ GCONF_VALUE_STRING, NULL);
+ g_object_unref (client);
+
+ /* Recreate terminals. */
+ for (l = term_list; l; l = l->next) {
+ char *name = l->data;
+
+ anjuta_shell_add_widget (tool->shell,
+ term_new (tool, name),
+ name,
+ _("Terminal"),
+ NULL);
+ }
- term_init_cb (zvt, NULL);
+ term_g_slist_deep_free (term_list);
}
static void
? .tm_project.cache
? autom4te-2.53.cache
? gbf.patch
? stamp-h1
? src/lib
? src/lib_old
? src/backends/libgbf_am/gbf-am-parse
? src/backends/libgbf_am/gbf-am.server.in
? src/backends/libgbf_am/GBF/Makefile
? src/backends/libgbf_am/GBF/Makefile.in
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-build/configure.in,v
retrieving revision 1.26
diff -u -r1.26 configure.in
--- configure.in 1 Aug 2002 23:03:08 -0000 1.26
+++ configure.in 17 Aug 2002 11:28:52 -0000
@@ -132,6 +132,17 @@
AC_DEFINE_UNQUOTED(SCRIPTS_DIR, "${prefix}/bin")
fi
+dnl Set PREFIX
+if test "x${prefix}" = "xNONE"; then
+ packageprefix=${ac_default_prefix}
+else
+ packageprefix=${prefix}
+fi
+
+# Set the path to the backends directory so we don't litter $(prefix)/lib :-)
+gbf_backends_dir="${packageprefix}/lib/gnome-build/backends"
+AC_SUBST(gbf_backends_dir)
+
AC_OUTPUT([
Makefile
src/Makefile
Index: gnome-build-1.0.pc.in
===================================================================
RCS file: /cvs/gnome/gnome-build/gnome-build-1.0.pc.in,v
retrieving revision 1.3
diff -u -r1.3 gnome-build-1.0.pc.in
--- gnome-build-1.0.pc.in 14 Mar 2002 07:45:31 -0000 1.3
+++ gnome-build-1.0.pc.in 17 Aug 2002 11:28:52 -0000
@@ -7,6 +7,6 @@
Name: gnome-build
Description: Gnome Build Framework
Version: @VERSION@
-Requires: libbonoboui-2.0 libgnome-2.0 gtk+-2.0 libgtkhtml-2.0 libxml-2.0
-Libs: -L${libdir} -lgbf-1
+Requires: libgnome-2.0 gtk+-2.0 libgtkhtml-2.0 libxml-2.0
+Libs: -L${libdir} -lgbf-1 -lgbf-widgets-1
Cflags: -I${includedir}
Index: src/backends/libgbf_am/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/Makefile.am,v
retrieving revision 1.13
diff -u -r1.13 Makefile.am
--- src/backends/libgbf_am/Makefile.am 12 Jul 2002 04:38:45 -0000 1.13
+++ src/backends/libgbf_am/Makefile.am 17 Aug 2002 11:28:53 -0000
@@ -4,38 +4,40 @@
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"\
-DG_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
- -I$(top_srcdir)/src/controls \
$(WARN_CFLAGS) \
$(GBF_AM_BACKEND_CFLAGS) \
-I$(top_builddir)/src/lib
-bin_PROGRAMS = gbf-am-project
-noinst_PROGRAMS = test
bin_SCRIPTS = gbf-am-parse gbf-am-build
-gbf_am_project_SOURCES = \
- gbf-am-project.c \
- gbf-am-project.h \
- gbf-am-config.c \
- gbf-am-config.h \
- main.c
+gbf_backenddir = $(gbf_backends_dir)
+
+gbf_backend_LTLIBRARIES = \
+ libgbf-am.la
+
+libgbf_am_la_SOURCES = \
+ gbf-am-project.c \
+ gbf-am-project.h \
+ gbf-am-config.c \
+ gbf-am-config.h
-gbf_am_project_LDADD = \
- $(top_builddir)/src/lib/libgbf-1.la \
+libgbf_am_la_LIBADD = \
+ $(top_builddir)/src/lib/libgbf-1.la \
$(GBF_AM_BACKEND_LIBS)
-test_SOURCES = \
+noinst_PROGRAMS = test
+
+test_SOURCES = \
test.c
-test_LDADD = \
- $(top_builddir)/src/lib/libgbf-1.la \
+test_LDADD = \
+ $(top_builddir)/src/lib/libgbf-1.la \
$(GBF_AM_BACKEND_LIBS)
-serverdir = $(libdir)/bonobo/servers
-server_in_files = GNOME_Development_Project_Automake.server.in
-server_DATA = $(server_in_files:.server.in=.server)
+server_in_files = gbf-am.server.in
+gbf_backend_DATA = $(server_in_files:.server.in=.server)
@INTLTOOL_SERVER_RULE@
-EXTRA_DIST = \
- $(server_DATA)
+EXTRA_DIST = \
+ $(gbf_backend_DATA)
Index: src/backends/libgbf_am/gbf-am-project.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/gbf-am-project.c,v
retrieving revision 1.25
diff -u -r1.25 gbf-am-project.c
--- src/backends/libgbf_am/gbf-am-project.c 12 Jul 2002 04:38:46 -0000 1.25
+++ src/backends/libgbf_am/gbf-am-project.c 17 Aug 2002 11:28:54 -0000
@@ -32,19 +32,20 @@
#include <bonobo/bonobo-property-bag.h>
#include <bonobo/bonobo-event-source.h>
#include <fcntl.h>
+#include <libgnome/gnome-macros.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
+#include "gbf-am-project.h"
+#include "gbf-am-config.h"
+#include "gbf-project.h"
+#include "glue-plugin.h"
+
#include "program.xpm"
#include "shared.xpm"
#include "static.xpm"
#include "unknown.xpm"
-#include "gnome-build.h"
-#include "gbf-am-project.h"
-#include "gbf-am-config.h"
-
-
-#define EMPTY_STRING ""
+#define UNIMPLEMENTED /* g_warning (G_STRLOC": unimplemented") */
typedef enum {
BUILD
@@ -55,7 +56,7 @@
GbfAmProject *prj;
GbfAmProjectOpType type;
- GNOME_Development_BuildType build_type;
+ GbfBuildType build_type;
} GbfAmProjectOp;
/* structures for holding project data */
@@ -158,7 +159,8 @@
BonoboEventSource *event_source;
};
-enum Properties {
+enum {
+ PROP_0,
PROP_PROJECT_DIR
};
@@ -201,19 +203,11 @@
* Private prototypes -------------------------------------
*/
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-static BonoboObjectClass *parent_class = NULL;
-
-static void gbf_am_project_get_prop (BonoboPropertyBag *bag, BonoboArg *arg,
- guint arg_id, CORBA_Environment *ev,
- gpointer user_data);
-static void gbf_am_project_set_prop (BonoboPropertyBag *bag, const BonoboArg *arg,
- guint arg_id, CORBA_Environment *ev,
- gpointer user_data);
-
static void build_project_op (GbfAmProject *prj,
- GNOME_Development_BuildType type);
+ GbfBuildType type);
+static GbfProject *parent_class;
+/*GNOME_CLASS_BOILERPLATE (GbfAmProject, gbf_am_project, GbfProject, GBF_TYPE_PROJECT);*/
/*
* Queue operations ------------------------
@@ -1373,6 +1367,7 @@
bonobo_event_source_notify_listeners (priv->event_source, "build-file", arg, NULL);
bonobo_arg_release (arg);
} else if (!strncmp (line, "ERROR: ", 6)) {
+#if 0
GNOME_Development_BuildError build_err;
int i, max = 3;
g_print ("Line: %s\n", line);
@@ -1405,6 +1400,7 @@
"build-error",
arg, NULL);
bonobo_arg_release (arg);
+#endif
}
if (tokens != NULL)
g_strfreev (tokens);
@@ -1498,22 +1494,24 @@
}
static void
-build_project_op (GbfAmProject *prj,
- GNOME_Development_BuildType type)
+build_project_op (GbfAmProject *prj,
+ GbfBuildType type)
{
BonoboArg *arg;
char *argv[] = { BUILD_SCRIPT_NAME, "--build", "", prj->priv->project_dir, 0 };
switch (type) {
- case GNOME_Development_ALL:
+ case GBF_BUILD_ALL:
argv[2] = "all";
break;
- case GNOME_Development_CURRENT:
+ case GBF_BUILD_CURRENT:
argv[2] = "all";
break;
- case GNOME_Development_INSTALL:
+ case GBF_BUILD_INSTALL:
argv[2] = "install";
break;
+ default:
+ break;
}
if (launch_build_script (argv, prj) != 0) {
@@ -1641,371 +1639,264 @@
}
/*
- * IDL methods ------------------------------------------
+ * GbfProjectIface methods ------------------------------------------
*/
static void
-impl_load (PortableServer_Servant servant,
- const CORBA_char *path,
- CORBA_Environment *ev)
+impl_load (GbfProject *project,
+ const char *path,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_if_fail (prj != NULL, ev);
- priv = prj->priv;
-
- if (priv->project_dir) {
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
+
+ if (prj->priv->project_dir) {
/* FIXME: do we really want to allow object reutilization */
project_unload (prj);
project_init (prj);
}
-
- if (!g_file_test (path, G_FILE_TEST_IS_DIR)) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
+
+ if (!g_file_test (path, G_FILE_TEST_IS_DIR)) {
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Project doesn't exist"));
+ }
return;
}
-
- if (get_project (prj, (char *)path) < 0)
- bonobo_exception_set (ev, ex_GNOME_Development_Project_Malformed);
+
+ if (get_project (prj, (char *)path) < 0) {
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_PROJECT_MALFORMED,
+ _("Malformed project"));
+ }
+ }
}
static void
-impl_build (PortableServer_Servant servant,
- GNOME_Development_BuildType type,
- CORBA_Environment *ev)
+impl_build (GbfProject *project,
+ GbfBuildType type,
+ GError **error)
{
- GbfAmProject *prj;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
GbfAmProjectOp *op;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_if_fail (prj != NULL, ev);
op = g_new0 (GbfAmProjectOp, 1);
op->prj = prj;
op->type = BUILD;
op->build_type = type;
-
+
queue_op (prj, op);
}
-static GNOME_Development_Group *
-impl_get_group (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+static GbfProjectGroup *
+impl_get_group (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
- GNOME_Development_Group *corba_group;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
GbfAmGroup *group;
- GList *lp;
- gint i;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
+ GbfProjectGroup *grp;
+ GList *l;
- group = g_hash_table_lookup (priv->groups, id);
+ group = g_hash_table_lookup (prj->priv->groups, id);
if (group == NULL) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
- return CORBA_OBJECT_NIL;
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Group doesn't exist"));
+ }
+ return NULL;
}
- /* create CORBA group structure */
- corba_group = GNOME_Development_Group__alloc ();
-
- corba_group->id = CORBA_string_dup (group->id);
+ grp = g_new0 (GbfProjectGroup, 1);
+ grp->id = g_strdup (group->id);
+ grp->name = g_strdup (group->name);
+
if (group->parent)
- corba_group->parent_id = CORBA_string_dup (group->parent->id);
+ grp->parent_id = g_strdup (group->parent->id);
else
- corba_group->parent_id = CORBA_string_dup (EMPTY_STRING);
-
- corba_group->name = CORBA_string_dup (group->name);
+ grp->parent_id = NULL;
- /* build children groups list */
- corba_group->groups._maximum = corba_group->groups._length =
- g_list_length (group->groups);
- corba_group->groups._buffer = GNOME_Development_TargetList_allocbuf (
- corba_group->groups._maximum);
- corba_group->groups._release = CORBA_TRUE;
-
- for (lp = group->groups, i = 0; lp; lp = lp->next, i++)
- corba_group->groups._buffer [i] =
- CORBA_string_dup (((GbfAmGroup *) lp->data)->id);
-
- /* build targets list */
- corba_group->targets._maximum = corba_group->targets._length =
- g_list_length (group->targets);
- corba_group->targets._buffer = GNOME_Development_TargetList_allocbuf (
- corba_group->targets._maximum);
- corba_group->targets._release = CORBA_TRUE;
-
- for (lp = group->targets, i = 0; lp; lp = lp->next, i++)
- corba_group->targets._buffer [i] =
- CORBA_string_dup (((GbfAmTarget *) lp->data)->id);
-
- return corba_group;
-}
-
-static Bonobo_Control
-impl_configure_new_group (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
+ grp->groups = NULL;
+ for (l = group->groups; l; l = l->next) {
+ GbfAmGroup *group2 = l->data;
+ grp->groups = g_list_append (grp->groups, g_strdup (group2->id));
+ }
+
+ grp->targets = NULL;
+ for (l = group->targets; l; l = l->next) {
+ GbfAmTarget *target = l->data;
+ grp->targets = g_list_append (grp->targets, g_strdup (target->id));
+ }
- return CORBA_OBJECT_NIL;
+ return grp;
}
-static Bonobo_Control
-impl_configure_group (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+static GtkWidget *
+impl_configure_new_group (GbfProject *project,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
+ UNIMPLEMENTED;
+
+ return NULL;
+}
- prj = NULL;
+static GtkWidget *
+impl_configure_group (GbfProject *project,
+ const char *id,
+ GError **error)
+{
+ UNIMPLEMENTED;
- return CORBA_OBJECT_NIL;
+ return NULL;
}
-static CORBA_char *
-impl_add_group (PortableServer_Servant servant,
- const CORBA_char *parent_id,
- const CORBA_char *name,
- CORBA_Environment *ev)
+static const char *
+impl_add_group (GbfProject *project,
+ const char *parent_id,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
+ UNIMPLEMENTED;
return NULL;
}
static void
-impl_remove_group (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+impl_remove_group (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_if_fail (prj != NULL, ev);
- priv = prj->priv;
+ UNIMPLEMENTED;
}
-static GNOME_Development_Target *
-impl_get_target (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+static GbfProjectTarget *
+impl_get_target (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
- GNOME_Development_Target *corba_target;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
GbfAmTarget *target;
- GList *lp;
- gint i;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
+ GbfProjectTarget *trgt;
+ GList *l;
- target = g_hash_table_lookup (priv->targets, id);
+ target = g_hash_table_lookup (prj->priv->targets, id);
if (target == NULL) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
- return CORBA_OBJECT_NIL;
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Target doesn't exist"));
+ }
+ return NULL;
}
-
- corba_target = GNOME_Development_Target__alloc ();
-
- corba_target->id = CORBA_string_dup (target->id);
+
+ trgt = g_new0 (GbfProjectTarget, 1);
+ trgt->id = g_strdup (target->id);
+ trgt->name = g_strdup (target->name);
+ trgt->type = g_strdup (target->type);
+
if (target->group)
- corba_target->group_id = CORBA_string_dup (target->group->id);
+ trgt->group_id = g_strdup (target->group->id);
else
- corba_target->group_id = CORBA_string_dup (EMPTY_STRING);
-
- corba_target->name = CORBA_string_dup (target->name);
- corba_target->type = CORBA_string_dup (target->type);
- corba_target->sources._maximum = corba_target->sources._length =
- g_list_length (target->sources);
- corba_target->sources._buffer = GNOME_Development_TargetList_allocbuf (
- corba_target->sources._maximum);
- corba_target->sources._release = CORBA_TRUE;
-
- for (lp = target->sources, i = 0; lp; lp = lp->next, i++)
- corba_target->sources._buffer [i] =
- CORBA_string_dup (((GbfAmTargetSource *) lp->data)->id);
-
- return corba_target;
+ trgt->group_id = NULL;
+
+ trgt->sources = NULL;
+ for (l = target->sources; l; l = l->next) {
+ GbfAmTargetSource *source = l->data;
+ trgt->sources = g_list_append (trgt->sources, g_strdup (source->id));
+ }
+
+ return trgt;
}
static void
foreach_target (gpointer key, gpointer value, gpointer data)
{
- GNOME_Development_SourceList *source_list;
+ GList **targets = data;
- source_list = data;
- source_list->_buffer[source_list->_length] = CORBA_string_dup (key);
- source_list->_length++;
+ *targets = g_list_append (*targets, key);
}
-static GNOME_Development_TargetList *
-impl_get_all_targets (PortableServer_Servant servant,
- CORBA_Environment *ev)
+static GList *
+impl_get_all_targets (GbfProject *project,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
- GNOME_Development_TargetList *target_list;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
+ GList *targets = NULL;
- target_list = GNOME_Development_TargetList__alloc ();
-
- target_list->_maximum = g_hash_table_size (priv->targets);
- target_list->_length = 0;
- target_list->_buffer = GNOME_Development_TargetList_allocbuf (target_list->_maximum);
- CORBA_sequence_set_release (target_list, CORBA_TRUE);
-
- g_hash_table_foreach (priv->targets, foreach_target, target_list);
+ g_hash_table_foreach (prj->priv->targets, foreach_target, &targets);
- return target_list;
+ return targets;
}
-static Bonobo_Control
-impl_configure_new_target (PortableServer_Servant servant,
- CORBA_Environment *ev)
+static GtkWidget *
+impl_configure_new_target (GbfProject *project,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
-
- prj = NULL;
+ UNIMPLEMENTED;
- return CORBA_OBJECT_NIL;
+ return NULL;
}
-static Bonobo_Control
-impl_configure_target (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+static GtkWidget *
+impl_configure_target (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
-
- prj = NULL;
+ UNIMPLEMENTED;
- return CORBA_OBJECT_NIL;
+ return NULL;
}
-static CORBA_char *
-impl_add_target (PortableServer_Servant servant,
- const CORBA_char *group_id,
- const CORBA_char *name,
- const CORBA_char *type,
- CORBA_Environment *ev)
+static const char *
+impl_add_target (GbfProject *project,
+ const char *group_id,
+ const char *name,
+ const char *type,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
-
- prj = NULL;
+ UNIMPLEMENTED;
return NULL;
}
static void
-impl_remove_target (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+impl_remove_target (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
-
- prj = NULL;
+ UNIMPLEMENTED;
}
-static CORBA_char *
-impl_name_for_type (PortableServer_Servant servant,
- const CORBA_char *type,
- CORBA_Environment *ev)
+static const char *
+impl_name_for_type (GbfProject *project,
+ const char *type)
{
- CORBA_char *type_name;
-
if (!strcmp (type, "static_lib")) {
- type_name = CORBA_string_dup ("Static Library");
+ return _("Static Library");
} else if (!strcmp (type, "shared_lib")) {
- type_name = CORBA_string_dup ("Shared Library");
+ return _("Shared Library");
} else if (!strcmp (type, "man")) {
- type_name = CORBA_string_dup ("Man Documentation");
+ return _("Man Documentation");
} else if (!strcmp (type, "data")) {
- type_name = CORBA_string_dup ("Miscellaneous Data");
+ return _("Miscellaneous Data");
} else if (!strcmp (type, "program")) {
- type_name = CORBA_string_dup ("Program");
+ return _("Program");
} else if (!strcmp (type, "script")) {
- type_name = CORBA_string_dup ("Script");
+ return _("Script");
} else if (!strcmp (type, "info")) {
- type_name = CORBA_string_dup ("Info Documenation");
+ return _("Info Documenation");
} else {
- type_name = CORBA_string_dup ("Unknown");
+ return _("Unknown");
}
-
- return type_name;
}
-static GNOME_Development_Icon *
-create_icon_from_pixbuf (GdkPixbuf *pixbuf)
+static GdkPixbuf *
+impl_icon_for_type (GbfProject *project,
+ const char *type)
{
- GNOME_Development_Icon *icon;
- const char *sp;
- CORBA_octet *dp;
- int width, height, total_width, rowstride;
- int i, j;
- gboolean has_alpha;
-
- icon = GNOME_Development_Icon__alloc ();
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
-
- if (has_alpha)
- total_width = 4 * width;
- else
- total_width = 3 * width;
-
- icon->width = width;
- icon->height = height;
- icon->hasAlpha = has_alpha;
-
- icon->rgbaData._length = icon->height * total_width;
- icon->rgbaData._maximum = icon->rgbaData._length;
- icon->rgbaData._buffer = CORBA_sequence_CORBA_octet_allocbuf (icon->rgbaData._maximum);
- icon->rgbaData._release = CORBA_TRUE;
-
- sp = gdk_pixbuf_get_pixels (pixbuf);
- dp = icon->rgbaData._buffer;
- for (i = 0; i < height; i ++) {
- for (j = 0; j < total_width; j++)
- *(dp ++) = sp[j];
- sp += rowstride;
- }
-
- return icon;
-}
-
-static GNOME_Development_Icon *
-impl_icon_for_type (PortableServer_Servant servant,
- const CORBA_char *type,
- CORBA_Environment *ev)
-{
- GNOME_Development_Icon *icon;
GdkPixbuf *pixbuf;
if (!strcmp (type, "static_lib")) {
@@ -2018,101 +1909,77 @@
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)unknown_xpm);
}
- icon = create_icon_from_pixbuf (pixbuf);
- gdk_pixbuf_unref (pixbuf);
-
- return icon;
+ return pixbuf;
}
-static GNOME_Development_TargetSource *
-impl_get_source (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+static GbfProjectTargetSource *
+impl_get_source (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
- GNOME_Development_TargetSource *corba_source;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
GbfAmTargetSource *source;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
+ GbfProjectTargetSource *src;
- source = g_hash_table_lookup (priv->sources, id);
+ source = g_hash_table_lookup (prj->priv->sources, id);
if (source == NULL) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
- return CORBA_OBJECT_NIL;
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Source doesn't exist"));
+ }
+ return NULL;
}
-
- corba_source = GNOME_Development_TargetSource__alloc ();
-
- corba_source->id = CORBA_string_dup (source->id);
+
+ src = g_new0 (GbfProjectTargetSource, 1);
+ src->id = g_strdup (source->id);
+ src->source_uri = g_strdup (source->uri);
+
if (source->target)
- corba_source->target_id = CORBA_string_dup (source->target->id);
+ src->target_id = g_strdup (source->target->id);
else
- corba_source->target_id = CORBA_string_dup (EMPTY_STRING);
-
- corba_source->source = CORBA_string_dup (source->uri);
-
- return corba_source;
+ src->target_id = NULL;
+
+ return src;
}
static void
foreach_source (gpointer key, gpointer value, gpointer data)
{
- GNOME_Development_SourceList *source_list;
+ GList **sources = data;
- source_list = data;
- source_list->_buffer [source_list->_length] = CORBA_string_dup (key);
- source_list->_length++;
+ *sources = g_list_append (*sources, key);
}
-static GNOME_Development_SourceList *
-impl_get_all_sources (PortableServer_Servant servant,
- CORBA_Environment *ev)
+static GList *
+impl_get_all_sources (GbfProject *project,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
- GNOME_Development_SourceList *source_list;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
-
- source_list = GNOME_Development_SourceList__alloc ();
-
- source_list->_maximum = g_hash_table_size (priv->sources);
- source_list->_length = 0;
- source_list->_buffer = GNOME_Development_SourceList_allocbuf (
- source_list->_maximum);
- CORBA_sequence_set_release (source_list, CORBA_TRUE);
-
- g_hash_table_foreach (priv->sources, foreach_source, source_list);
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
+ GList *sources = NULL;
- return source_list;
+ g_hash_table_foreach (prj->priv->sources, foreach_source, &sources);
+
+ return sources;
}
-static Bonobo_Control
-impl_configure_new_source (PortableServer_Servant servant,
- CORBA_Environment *ev)
+static GtkWidget *
+impl_configure_new_source (GbfProject *project,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
-
- prj = NULL;
+ UNIMPLEMENTED;
- return CORBA_OBJECT_NIL;
+ return NULL;
}
-static Bonobo_Control
-impl_configure_source (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+static GtkWidget *
+impl_configure_source (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
+ UNIMPLEMENTED;
- prj = NULL;
-
- return CORBA_OBJECT_NIL;
+ return NULL;
}
/**
@@ -2126,21 +1993,16 @@
*
* Return value:
**/
-static CORBA_char *
-impl_add_source (PortableServer_Servant servant,
- const CORBA_char *target_id,
- const CORBA_char *uri,
- CORBA_Environment *ev)
+static const char *
+impl_add_source (GbfProject *project,
+ const char *target_id,
+ const char *uri,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
GbfAmTargetSource *source;
xmlDocPtr doc;
char id[1024];
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_val_if_fail (prj != NULL, NULL, ev);
- priv = prj->priv;
/* FIXME: check that the source is inside the project dir */
@@ -2154,15 +2016,19 @@
/* Compute the id */
g_snprintf (id, 1024, "%s%s", target_id, source->uri);
source->id = g_strdup (id);
- source->target = g_hash_table_lookup (priv->targets, target_id);
-
- /* --- */
-
+ source->target = g_hash_table_lookup (prj->priv->targets, target_id);
+
/* Create the update xml */
doc = create_change_xml (prj);
- if (!write_add_source (prj, doc, source))
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
+ if (!write_add_source (prj, doc, source)) {
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Source couldn't be added"));
+ }
+ return NULL;
+ }
#if 1
xmlSetDocCompressMode (doc, 0);
@@ -2170,50 +2036,62 @@
#endif
/* Update the project */
- if (update_project (doc, priv->project_dir) != 0) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_Malformed);
+ if (update_project (doc, prj->priv->project_dir) != 0) {
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_PROJECT_MALFORMED,
+ _("Unable to update project"));
+ }
return NULL;
}
-
- return CORBA_string_dup (source->id);
+
+ return source->id;
}
static void
-impl_remove_source (PortableServer_Servant servant,
- const CORBA_char *id,
- CORBA_Environment *ev)
+impl_remove_source (GbfProject *project,
+ const char *id,
+ GError **error)
{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
+ GbfAmProject *prj = GBF_AM_PROJECT (project);
GbfAmTargetSource *source;
xmlDocPtr doc;
-
- prj = GBF_AM_PROJECT (bonobo_object_from_servant (servant));
- bonobo_return_if_fail (prj != NULL, ev);
- priv = prj->priv;
-
+
/* Find the source */
- source = g_hash_table_lookup (priv->sources, id);
+ source = g_hash_table_lookup (prj->priv->sources, id);
if (source == NULL) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Source doesn't exist"));
+ }
return;
}
-
+
/* Create the update xml */
doc = create_change_xml (prj);
if (!write_remove_source (prj, doc, source)) {
- bonobo_exception_set (ev, ex_GNOME_Development_Project_DoesntExist);
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_DOESNT_EXIST,
+ _("Source coudn't be removed"));
+ }
return;
}
-
+
#if 1
xmlSetDocCompressMode (doc, 0);
xmlSaveFile ("/tmp/remove-source.xml", doc);
#endif
/* Update the project */
- if (update_project (doc, priv->project_dir) != 0)
- bonobo_exception_set (ev, ex_GNOME_Development_Project_Malformed);
+ if (update_project (doc, prj->priv->project_dir) != 0) {
+ if (error) {
+ *error = g_error_new (GBF_PROJECT_ERROR,
+ GBF_PROJECT_ERROR_PROJECT_MALFORMED,
+ _("Unable to update project"));
+ }
+ }
}
static void
@@ -2221,7 +2099,7 @@
{
GbfAmProject *prj;
GbfAmProjectPrivate *priv;
-
+
g_return_if_fail (object != NULL);
g_return_if_fail (GBF_IS_AM_PROJECT (object));
@@ -2233,117 +2111,89 @@
g_free (priv->buffer);
priv->buffer = NULL;
}
-
- BONOBO_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+
+ GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gbf_am_project_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GbfAmProject *project = GBF_AM_PROJECT (object);
+
+ switch (prop_id) {
+ case PROP_PROJECT_DIR:
+ g_value_set_string (value, project->priv->project_dir);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
gbf_am_project_class_init (GbfAmProjectClass *klass)
{
GObjectClass *object_class;
- POA_GNOME_Development_Project__epv *epv = &klass->epv;
+ GbfProjectClass *project_class;
object_class = G_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (PARENT_TYPE);
+ project_class = GBF_PROJECT_CLASS (klass);
+ parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gbf_am_project_dispose;
-
- epv->load = impl_load;
- epv->build = impl_build;
- epv->getGroup = impl_get_group;
- epv->configureNewGroup = impl_configure_new_group;
- epv->configureGroup = impl_configure_group;
- epv->addGroup = impl_add_group;
- epv->removeGroup = impl_remove_group;
- epv->nameForType = impl_name_for_type;
- epv->iconForType = impl_icon_for_type;
- epv->getTarget = impl_get_target;
- epv->getAllTargets = impl_get_all_targets;
- epv->configureNewTarget = impl_configure_new_target;
- epv->configureTarget = impl_configure_target;
- epv->addTarget = impl_add_target;
- epv->removeTarget = impl_remove_target;
- epv->getSource = impl_get_source;
- epv->getAllSources = impl_get_all_sources;
- epv->configureNewSource = impl_configure_new_source;
- epv->configureSource = impl_configure_source;
- epv->addSource = impl_add_source;
- epv->removeSource = impl_remove_source;
+ object_class->get_property = gbf_am_project_get_property;
+
+ project_class->load = impl_load;
+ project_class->build = impl_build;
+ project_class->add_group = impl_add_group;
+ project_class->remove_group = impl_remove_group;
+ project_class->get_group = impl_get_group;
+ project_class->configure_group = impl_configure_group;
+ project_class->configure_new_group = impl_configure_new_group;
+ project_class->add_target = impl_add_target;
+ project_class->remove_target = impl_remove_target;
+ project_class->get_target = impl_get_target;
+ project_class->get_all_targets = impl_get_all_targets;
+ project_class->configure_target = impl_configure_target;
+ project_class->configure_new_target = impl_configure_new_target;
+ project_class->add_source = impl_add_source;
+ project_class->remove_source = impl_remove_source;
+ project_class->get_source = impl_get_source;
+ project_class->get_all_sources = impl_get_all_sources;
+ project_class->configure_source = impl_configure_source;
+ project_class->configure_new_source = impl_configure_new_source;
+ project_class->name_for_type = impl_name_for_type;
+ project_class->icon_for_type = impl_icon_for_type;
+
+ g_object_class_install_property
+ (object_class, PROP_PROJECT_DIR,
+ g_param_spec_string ("project-dir",
+ _("Project directory"),
+ _("Project directory"),
+ "",
+ G_PARAM_READABLE));
}
static void
-gbf_am_project_init (GbfAmProject *prj)
+gbf_am_project_instance_init (GbfAmProject *prj)
{
GbfAmProjectPrivate *priv;
priv = g_new0 (GbfAmProjectPrivate, 1);
-
prj->priv = priv;
project_init (prj);
-
- /* setup aggregate interfaces */
- priv->event_source = bonobo_event_source_new ();
- bonobo_object_add_interface (BONOBO_OBJECT (prj),
- BONOBO_OBJECT (priv->event_source));
-
- priv->property_bag = bonobo_property_bag_new (gbf_am_project_get_prop,
- gbf_am_project_set_prop,
- prj);
- bonobo_property_bag_add (priv->property_bag, "project-dir",
- PROP_PROJECT_DIR, BONOBO_ARG_STRING,
- NULL, "The top-level project directory", 0);
- bonobo_object_add_interface (BONOBO_OBJECT (prj),
- BONOBO_OBJECT (priv->property_bag));
}
-/*
- * Property bag methods -----------------------------
- */
-
-static void
-gbf_am_project_get_prop (BonoboPropertyBag *bag, BonoboArg *arg,
- guint arg_id, CORBA_Environment *ev,
- gpointer data)
-{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
-
- prj = data;
- priv = prj->priv;
-
- switch (arg_id) {
- case PROP_PROJECT_DIR:
- BONOBO_ARG_SET_STRING (arg, priv->project_dir);
- break;
- }
-}
-
-static void
-gbf_am_project_set_prop (BonoboPropertyBag *bag, const BonoboArg *arg,
- guint arg_id, CORBA_Environment *ev,
- gpointer data)
-{
- GbfAmProject *prj;
- GbfAmProjectPrivate *priv;
-
- prj = data;
- priv = prj->priv;
-
- switch (arg_id) {
- case PROP_PROJECT_DIR:
- break;
- }
-}
-
-
-BONOBO_TYPE_FUNC_FULL (GbfAmProject, GNOME_Development_Project, PARENT_TYPE, gbf_am_project);
-
-
GbfAmProject *
gbf_am_project_new (void)
{
- g_message ("Creating project object");
-
return GBF_AM_PROJECT (g_object_new (GBF_TYPE_AM_PROJECT, NULL));
}
+
+GBF_BACKEND_BOILERPLATE (GbfAmProject, gbf_am_project);
+
+GBF_SIMPLE_BACKEND (GbfAmProject, gbf_am_project);
Index: src/backends/libgbf_am/gbf-am-project.h
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/gbf-am-project.h,v
retrieving revision 1.9
diff -u -r1.9 gbf-am-project.h
--- src/backends/libgbf_am/gbf-am-project.h 23 Feb 2002 05:30:37 -0000 1.9
+++ src/backends/libgbf_am/gbf-am-project.h 17 Aug 2002 11:28:55 -0000
@@ -24,36 +24,33 @@
#ifndef _GBF_AM_PROJECT_H_
#define _GBF_AM_PROJECT_H_
-#include <bonobo/bonobo-object.h>
-#include "gnome-build.h"
+#include <glib-object.h>
+#include "gbf-project.h"
+#include "glue-plugin.h"
G_BEGIN_DECLS
-#define GBF_TYPE_AM_PROJECT (gbf_am_project_get_type ())
-#define GBF_AM_PROJECT(obj) (GTK_CHECK_CAST ((obj), GBF_TYPE_AM_PROJECT, GbfAmProject))
-#define GBF_AM_PROJECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GBF_TYPE_AM_PROJECT, GbfAmProjectClass))
-#define GBF_IS_AM_PROJECT(obj) (GTK_CHECK_TYPE ((obj), GBF_TYPE_AM_PROJECT))
-#define GBF_IS_AM_PROJECT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GBF_TYPE_AM_PROJECT))
-
+#define GBF_TYPE_AM_PROJECT (gbf_am_project_get_type (NULL))
+#define GBF_AM_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GBF_TYPE_AM_PROJECT, GbfAmProject))
+#define GBF_AM_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GBF_TYPE_AM_PROJECT, GbfAmProjectClass))
+#define GBF_IS_AM_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GBF_TYPE_AM_PROJECT))
+#define GBF_IS_AM_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GBF_TYPE_AM_PROJECT))
typedef struct _GbfAmProject GbfAmProject;
typedef struct _GbfAmProjectPrivate GbfAmProjectPrivate;
typedef struct _GbfAmProjectClass GbfAmProjectClass;
struct _GbfAmProject {
- BonoboObject parent;
+ GbfProject parent;
GbfAmProjectPrivate *priv;
};
struct _GbfAmProjectClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Development_Project__epv epv;
+ GbfProjectClass parent_class;
};
-
-GType gbf_am_project_get_type (void);
+GType gbf_am_project_get_type (GluePlugin *plugin);
GbfAmProject *gbf_am_project_new (void);
G_END_DECLS
Index: src/backends/libgbf_am/test.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/test.c,v
retrieving revision 1.4
diff -u -r1.4 test.c
--- src/backends/libgbf_am/test.c 12 Jul 2002 04:38:46 -0000 1.4
+++ src/backends/libgbf_am/test.c 17 Aug 2002 11:28:55 -0000
@@ -1,197 +1,71 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gbf-am-project.c
- *
- * Copyright (C) 2000 JP Rosevear
- *
- * 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 of the
- * License, 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.
- *
- * Author: JP Rosevear
- */
-
#include <config.h>
#include <gnome.h>
-#include <bonobo.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include "gnome-build.h"
+#include "gbf-backend.h"
-static GNOME_Development_Project
-activate_id (const char *id)
-{
- CORBA_Object object = CORBA_OBJECT_NIL;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- object = bonobo_activation_activate_from_id (id, Bonobo_ACTIVATION_FLAG_PRIVATE, NULL, &ev);
-
- if (BONOBO_EX (&ev))
- g_error ("Unable to activate object");
-
- CORBA_exception_free (&ev);
-
- return (GNOME_Development_Project) object;
-}
-
-static void
-print_group (GNOME_Development_Project project,
- gint depth,
- CORBA_char *group_id)
+int
+main (int argc, char *argv[])
{
- GNOME_Development_Group *group;
- CORBA_Environment ev;
- int i;
-
- CORBA_exception_init (&ev);
-
- group = GNOME_Development_Project_getGroup (project, group_id, &ev);
- if (!BONOBO_EX (&ev)) {
- for (i = 0; i < depth; i++)
- g_print (" ");
-
- g_print ("%s\n", group->name);
- for (i = 0; i < group->groups._length; i++)
- print_group (project, depth + 1, group->groups._buffer [i]);
+ GSList *l;
+ GbfBackend *backend;
+ GbfProject *project;
+ GList *sources, *targets;
+
+ gnome_program_init ("libgbf-am-test", VERSION, LIBGNOME_MODULE,
+ argc, argv, NULL);
+
+#if 0
+ if (argc == 1) {
+ g_print ("you need to specify a project path\n");
+ return 0;
+ }
+#endif
+
+ g_print ("initializing gbf backend...\n");
+ gbf_backend_init ();
- CORBA_free (group);
+ for (l = gbf_backend_get_backends (); l; l = l->next) {
+ backend = l->data;
+ if (!strcmp (backend->id, "gbf-am:GbfAmProject"))
+ break;
+ backend = NULL;
}
- CORBA_exception_free (&ev);
-}
+ if (!backend) {
+ g_print ("no automake/autoconf backend available\n");
+ return 0;
+ }
-int
-main (int argc, char *argv[])
-{
- GNOME_Development_Project project;
- Bonobo_ServerInfoList *result;
- GNOME_Development_SourceList *source_list;
- GNOME_Development_TargetList *target_list;
- CORBA_char *remove_id = NULL;
- CORBA_char *target_id = NULL;
- CORBA_char *uri = NULL;
- CORBA_Environment ev;
- int i;
-
- gnome_program_init ("test-gbf-libgbf-am-backend", VERSION, LIBGNOME_MODULE,
- argc, argv, GNOME_PARAM_POPT_TABLE,
- bonobo_activation_popt_options, NULL);
-
- CORBA_exception_init (&ev);
-
- /* Get a project */
- result = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Development/Build:1.0')", NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_error ("Unable to activate GNOME_Development_Build\n");
- return -1;
- }
-
- g_print ("Activation ID: %s\n", result->_buffer[0].iid);
-
- project = activate_id (result->_buffer[0].iid);
- if (project == CORBA_OBJECT_NIL)
- return -1;
-
- CORBA_free (result);
-
- /* Do stuff with it */
- if (argc > 1)
- GNOME_Development_Project_load (project, argv [1], &ev);
- if (BONOBO_EX (&ev))
- g_error ("Unable to load project");
+ g_print ("creating new gbf-am project\n");
+ project = gbf_backend_new_project (backend->id);
+ if (!project) {
+ g_print ("project creation failed\n");
+ return 0;
+ }
+
+ g_print ("loading project %s\n\n", ""/*argv[1]*/);
+ GBF_PROJECT_GET_CLASS (project)->load (project, "/home/jeroen/Projects/gtksourceview", NULL);
g_print ("*** Sources\n\n");
- source_list = GNOME_Development_Project_getAllSources (project, &ev);
- if (BONOBO_EX (&ev)) {
- g_error ("Unable to get sources");
- } else {
- for (i = 0; i < source_list->_length; i++) {
- GNOME_Development_TargetSource *source;
-
- source = GNOME_Development_Project_getSource (project, source_list->_buffer[i], &ev);
- if (!BONOBO_EX (&ev)) {
- g_print ("%s\n", source->source);
- CORBA_free (source);
- }
- }
- CORBA_free (source_list);
+ sources = GBF_PROJECT_GET_CLASS (project)->get_all_sources (project, NULL);
+
+ for (l = sources; l; l = l->next) {
+ const char *source = l->data;
+ g_print ("%s\n", source);
+ }
+
+#if 0
+ g_print ("\n\n*** Targets\n\n");
+ targets = GBF_PROJECT_GET_CLASS (project)->get_all_targets (project, NULL);
+
+ for (l = targets; l; l = l->next) {
+ const char *target = l->data;
+ g_print ("%s\n", target);
}
+#endif
g_print ("\n\n");
- g_print ("*** Targets\n\n");
- target_list = GNOME_Development_Project_getAllTargets (project, &ev);
- if (BONOBO_EX (&ev)) {
- g_error ("Unable to get targets");
- } else {
- int j;
- for (i = 0; i < target_list->_length; i++) {
- GNOME_Development_Target *target;
-
- target = GNOME_Development_Project_getTarget (project, target_list->_buffer[i], &ev);
- if (!BONOBO_EX (&ev))
- g_print ("%s [%s]\n", target->name, target_list->_buffer [i]);
-
- for (j = 0; j < target->sources._length; j++) {
- GNOME_Development_TargetSource *source;
- const CORBA_char *id;
-
- id = target->sources._buffer[j];
-
- source = GNOME_Development_Project_getSource (project, id, &ev);
- if (!BONOBO_EX (&ev)) {
- g_print (" %s\n", source->source);
-
- if (remove_id == NULL && !strcmp (target->type, "program")) {
- /* we need a source from a program, since other target
- writers are still not implemented */
- target_id = CORBA_string_dup (source->target_id);
- uri = CORBA_string_dup (source->source);
- remove_id = CORBA_string_dup (id);
- }
- }
-
- CORBA_free (source);
- }
- CORBA_free (target);
- }
- CORBA_free (target_list);
- }
-
- g_print ("\n\n*** Groups\n\n");
- print_group (project, 0, "/");
-
- GNOME_Development_Project_removeSource (project, remove_id, &ev);
- if (BONOBO_EX (&ev))
- g_error ("Unable to remove source");
- else
- g_print ("Removed source\n");
- CORBA_free (remove_id);
-
- GNOME_Development_Project_addSource (project, target_id, uri, &ev);
- if (BONOBO_EX (&ev))
- g_error ("Unable to add source");
- else
- g_print ("Added source\n");
- CORBA_free (target_id);
-
- /* Clean up */
- bonobo_object_release_unref (project, &ev);
- if (BONOBO_EX (&ev))
- g_error ("Unable to unref object");
-
- CORBA_exception_free (&ev);
+ g_print ("unreffing project\n");
+ g_object_unref (project);
- return 0;
+ return 0;
}
Index: src/controls/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/Makefile.am,v
retrieving revision 1.22
diff -u -r1.22 Makefile.am
--- src/controls/Makefile.am 12 Jul 2002 04:38:50 -0000 1.22
+++ src/controls/Makefile.am 17 Aug 2002 11:28:55 -0000
@@ -14,17 +14,12 @@
lib_LTLIBRARIES = libgbf-widgets-1.la
libgbf_widgets_1_la_SOURCES = \
- control-factories.c \
- commands.c \
- commands.h \
default-icon.c \
default-icon.h \
gbf-project-tree.c \
gbf-target-tree.c \
gbf-tree-data.c \
gbf-build-info.c \
- menus.c \
- menus.h \
utils.c \
utils.h
@@ -47,6 +42,7 @@
test_controls_LDADD = \
$(top_builddir)/src/lib/libgbf-1.la \
+ libgbf-widgets-1.la \
$(GBF_CONTROL_LIBS)
uidir = $(datadir)/gnome-2.0/ui
Index: src/controls/gbf-build-info.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-build-info.c,v
retrieving revision 1.14
diff -u -r1.14 gbf-build-info.c
--- src/controls/gbf-build-info.c 12 Jul 2002 04:38:50 -0000 1.14
+++ src/controls/gbf-build-info.c 17 Aug 2002 11:28:55 -0000
@@ -21,10 +21,17 @@
* Author: JP Rosevear
*/
-#include <bonobo/bonobo-exception.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-macros.h>
#include <libgtkhtml/gtkhtml.h>
#include "utils.h"
#include "gbf-build-info.h"
+#include "gbf-project.h"
+
+enum {
+ ERROR_SELECTED,
+ LAST_SIGNAL
+};
enum {
PROP_0,
@@ -32,60 +39,60 @@
};
struct _GbfBuildInfoPrivate {
- GNOME_Development_Project prj;
+ GbfProject *prj;
GtkWidget *html;
HtmlDocument *html_doc;
-
- BonoboListener *listener;
-
- BonoboEventSource *event_source;
};
-static GtkVBoxClass *parent_class = NULL;
+static guint info_signals [LAST_SIGNAL] = { 0 };
-static void class_init (GbfBuildInfoClass *klass);
-static void init (GbfBuildInfo *info);
static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void destroy (GtkObject *object);
+static void dispose (GObject *object);
-static void event_cb (BonoboListener *listener,
- const char *event,
- CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data);
-
static void link_clicked_cb (HtmlDocument *document,
const gchar *url,
gpointer user_data);
+GNOME_CLASS_BOILERPLATE (GbfBuildInfo, gbf_build_info, GtkVBox, GTK_TYPE_VBOX);
+
static void
-class_init (GbfBuildInfoClass *klass)
+gbf_build_info_class_init (GbfBuildInfoClass *klass)
{
GObjectClass *g_object_class;
- GtkObjectClass *object_class;
g_object_class = G_OBJECT_CLASS (klass);
- object_class = (GtkObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
+ g_object_class->dispose = dispose;
g_object_class->get_property = get_property;
g_object_class->set_property = set_property;
- object_class->destroy = destroy;
-
g_object_class_install_property
(g_object_class, PROP_PROJECT,
g_param_spec_pointer ("project",
_("Project"),
_("Corba Project Object"),
G_PARAM_READWRITE));
+
+ info_signals [ERROR_SELECTED] =
+ g_signal_new ("error_selected",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GbfBuildInfoClass, error_selected),
+ NULL, /* accumulator */
+ NULL, /* accu_data */
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, /* return type */
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_INT);
}
static void
-init (GbfBuildInfo *info)
+gbf_build_info_instance_init (GbfBuildInfo *info)
{
GbfBuildInfoPrivate *priv;
GtkWidget *scrolled_window;
@@ -119,8 +126,6 @@
gtk_container_add (GTK_CONTAINER (scrolled_window), priv->html);
gtk_container_add (GTK_CONTAINER (info), scrolled_window);
-
- priv->event_source = bonobo_event_source_new ();
}
static void
@@ -133,7 +138,7 @@
switch (prop_id) {
case PROP_PROJECT:
- g_value_set_pointer (value, gbf_build_info_get_project (info));
+ g_value_set_pointer (value, info->priv->prj);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -151,7 +156,7 @@
switch (prop_id) {
case PROP_PROJECT:
- gbf_build_info_set_project (info, g_value_get_pointer (value));
+ info->priv->prj = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -160,30 +165,23 @@
}
static void
-destroy (GtkObject *object)
+dispose (GObject *object)
{
GbfBuildInfo *info;
GbfBuildInfoPrivate *priv;
- CORBA_Environment ev;
-
+
info = GBF_BUILD_INFO (object);
priv = info->priv;
-
- if (priv) {
- CORBA_exception_init (&ev);
- priv->prj = bonobo_object_release_unref (priv->prj, &ev);
-
- CORBA_exception_free (&ev);
+ if (priv) {
+ if (priv->prj)
+ g_object_unref (priv->prj);
/* FIXME: destroy the html objects */
g_free (priv);
info->priv = NULL;
}
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
@@ -203,6 +201,7 @@
g_free (html);
}
+#if 0
static void
file_msg (GbfBuildInfo *info, CORBA_any *any)
{
@@ -214,7 +213,7 @@
source = any->_value;
- basename = uri_basename (source);
+ basename = uri_basename (source);
html = g_strdup_printf ("<p>Compiling <a href=\"%s\">%s</a></p>",
source, basename);
html_document_write_stream (priv->html_doc, html, strlen(html));
@@ -247,6 +246,7 @@
g_free (html);
g_free (basename);
}
+#endif
static void
end_msg (GbfBuildInfo *info)
@@ -263,6 +263,7 @@
html_document_close_stream (priv->html_doc);
}
+#if 0
static void
event_cb (BonoboListener *listener,
const char *event,
@@ -284,12 +285,14 @@
else if (!strcmp (event, "build-error"))
error_msg (info, any);
}
+#endif
static void
link_clicked_cb (HtmlDocument *document,
const gchar *url,
gpointer user_data)
{
+#if 0
GbfBuildInfo *info = GBF_BUILD_INFO (user_data);
GbfBuildInfoPrivate *priv;
GNOME_Development_Source source;
@@ -322,6 +325,7 @@
bonobo_event_source_notify_listeners (priv->event_source, type, arg, NULL);
bonobo_arg_release (arg);
+#endif
}
/* ----------------------------------------------------------------------
@@ -334,40 +338,7 @@
return GTK_WIDGET (g_object_new (GBF_TYPE_BUILD_INFO, NULL));
}
-GType
-gbf_build_info_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GbfBuildInfoClass),
- NULL, /* base_init. */
- NULL, /* base_finalize. */
- (GClassInitFunc) class_init,
- NULL, /* class_finalize. */
- NULL, /* class_data. */
- sizeof (GbfBuildInfo),
- 0, /* n_preallocs. */
- (GInstanceInitFunc) init,
- NULL, /* value_table. */
- };
-
- type = g_type_register_static (GTK_TYPE_VBOX, "GbfBuildInfo", &info, 0);
- }
-
- return type;
-}
-
-GNOME_Development_Project
-gbf_build_info_get_project (GbfBuildInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
- g_return_val_if_fail (GBF_IS_BUILD_INFO (info), NULL);
-
- return info->priv->prj;
-}
-
+#if 0
void
gbf_build_info_set_project (GbfBuildInfo *info, GNOME_Development_Project prj)
{
@@ -408,9 +379,4 @@
CORBA_exception_free (&ev);
}
-
-BonoboEventSource *
-gbf_build_info_get_event_source (GbfBuildInfo *info)
-{
- return info->priv->event_source;
-}
+#endif
Index: src/controls/gbf-build-info.h
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-build-info.h,v
retrieving revision 1.3
diff -u -r1.3 gbf-build-info.h
--- src/controls/gbf-build-info.h 22 Feb 2002 01:41:32 -0000 1.3
+++ src/controls/gbf-build-info.h 17 Aug 2002 11:28:55 -0000
@@ -24,14 +24,9 @@
#ifndef _GBF_BUILD_INFO_H_
#define _GBF_BUILD_INFO_H_
-#include <gnome.h>
-#include <bonobo/bonobo-event-source.h>
-#include "gnome-build.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
#define GBF_TYPE_BUILD_INFO (gbf_build_info_get_type ())
#define GBF_BUILD_INFO(obj) (GTK_CHECK_CAST ((obj), GBF_TYPE_BUILD_INFO, GbfBuildInfo))
@@ -51,17 +46,13 @@
struct _GbfBuildInfoClass {
GtkVBoxClass parent_class;
+
+ void (* error_selected) (GbfBuildInfo *info, const char *filename, int line);
};
-GType gbf_build_info_get_type (void);
-GtkWidget *gbf_build_info_new (void);
-GNOME_Development_Project gbf_build_info_get_project (GbfBuildInfo *info);
-void gbf_build_info_set_project (GbfBuildInfo *info,
- GNOME_Development_Project project);
-BonoboEventSource *gbf_build_info_get_event_source (GbfBuildInfo *info);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+GType gbf_build_info_get_type (void);
+GtkWidget *gbf_build_info_new (void);
+
+G_END_DECLS
#endif /* _GBF_BUILD_INFO_H_ */
Index: src/controls/gbf-project-tree.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-project-tree.c,v
retrieving revision 1.31
diff -u -r1.31 gbf-project-tree.c
--- src/controls/gbf-project-tree.c 12 Jul 2002 04:38:50 -0000 1.31
+++ src/controls/gbf-project-tree.c 17 Aug 2002 11:28:56 -0000
@@ -21,18 +21,23 @@
* Author: JP Rosevear
*/
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
+#include <string.h>
+#include <gtk/gtktreeview.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-macros.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <gtk/gtktreeview.h>
-#include <libgnome/gnome-i18n.h>
-#include <string.h>
#include <gdl/gdl-icons.h>
#include "utils.h"
#include "gbf-tree-data.h"
#include "gbf-project-tree.h"
+#include "gbf-project.h"
+
+enum {
+ FILE_SELECTED,
+ LAST_SIGNAL
+};
enum Properties {
PROP_0,
@@ -40,7 +45,7 @@
};
struct _GbfProjectTreePrivate {
- GNOME_Development_Project prj;
+ GbfProject *prj;
GtkWidget *tree_sw;
GtkWidget *tree;
@@ -50,20 +55,14 @@
GnomeVFSURI *root;
GHashTable *dirs;
- BonoboListener *listener;
-
- BonoboEventSource *event_source;
-
GbfTreeData *empty_node;
};
-static GtkVBoxClass *parent_class = NULL;
+static guint tree_signals [LAST_SIGNAL] = { 0 };
-static void class_init (GbfProjectTreeClass *klass);
-static void init (GbfProjectTree *tree);
static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void destroy (GtkObject *object);
+static void dispose (GObject *object);
static void set_pixbuf (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
GtkTreeModel *model, GtkTreeIter *iter,
@@ -71,12 +70,8 @@
static void set_text (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
GtkTreeModel *model, GtkTreeIter *iter,
gpointer data);
-
-static void event_cb (BonoboListener *listener,
- const char *event,
- CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data);
+
+static void load_data (GbfProjectTree *tree);
static void row_activated_cb (GtkTreeView *tree_view,
GtkTreePath *path,
@@ -84,33 +79,43 @@
gpointer user_data);
static void insert_no_project_node (GbfProjectTree *tree);
+GNOME_CLASS_BOILERPLATE (GbfProjectTree, gbf_project_tree, GtkVBox, GTK_TYPE_VBOX);
+
static void
-class_init (GbfProjectTreeClass *klass)
+gbf_project_tree_class_init (GbfProjectTreeClass *klass)
{
GObjectClass *g_object_class;
- GtkObjectClass *object_class;
g_object_class = G_OBJECT_CLASS (klass);
- object_class = (GtkObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
+ g_object_class->dispose = dispose;
g_object_class->get_property = get_property;
g_object_class->set_property = set_property;
- object_class->destroy = destroy;
-
g_object_class_install_property
(g_object_class, PROP_PROJECT,
g_param_spec_pointer ("project",
_("Project"),
- _("Corba Project Object"),
+ _("Project Object"),
G_PARAM_READWRITE));
+ tree_signals [FILE_SELECTED] =
+ g_signal_new ("file_selected",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GbfProjectTreeClass, file_selected),
+ NULL, /* accumulator */
+ NULL, /* accu_data */
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, /* return type */
+ 1,
+ G_TYPE_STRING);
}
static void
-init (GbfProjectTree *tree)
+gbf_project_tree_instance_init (GbfProjectTree *tree)
{
GbfProjectTreePrivate *priv;
GtkCellRenderer *renderer;
@@ -119,6 +124,7 @@
priv = g_new0 (GbfProjectTreePrivate, 1);
tree->priv = priv;
+ priv->prj = NULL;
/* create tree model. */
priv->tree_model =
@@ -163,8 +169,6 @@
priv->dirs = g_hash_table_new (g_str_hash, g_str_equal);
- priv->event_source = bonobo_event_source_new ();
-
priv->empty_node = gbf_tree_data_new (GBF_TREE_NODE_STRING,
_("No project loaded."));
insert_no_project_node (tree);
@@ -178,7 +182,7 @@
switch (prop_id) {
case PROP_PROJECT:
- g_value_set_pointer (value, gbf_project_tree_get_project (tree));
+ g_value_set_pointer (value, tree->priv->prj);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -191,10 +195,20 @@
const GValue *value, GParamSpec *pspec)
{
GbfProjectTree *tree = GBF_PROJECT_TREE (object);
+ char *dir;
switch (prop_id) {
case PROP_PROJECT:
- gbf_project_tree_set_project (tree, g_value_get_pointer (value));
+ if (tree->priv->root)
+ gnome_vfs_uri_unref (tree->priv->root);
+
+ tree->priv->prj = g_value_get_pointer (value);
+ if (tree->priv->prj) {
+ g_object_get (G_OBJECT (tree->priv->prj), "project-dir", &dir, NULL);
+ tree->priv->root = gnome_vfs_uri_new (dir);
+ }
+
+ load_data (tree);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -203,7 +217,7 @@
}
static void
-destroy (GtkObject *object)
+dispose (GObject *object)
{
GbfProjectTree *tree;
GbfProjectTreePrivate *priv;
@@ -212,8 +226,8 @@
priv = tree->priv;
if (priv) {
- if (priv->prj != CORBA_OBJECT_NIL)
- gbf_project_tree_set_project (tree, CORBA_OBJECT_NIL);
+ if (priv->prj != NULL)
+ g_object_unref (tree->priv->prj);
if (priv->empty_node) {
gbf_tree_data_free (priv->empty_node);
@@ -223,9 +237,6 @@
g_free (priv);
tree->priv = NULL;
}
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
@@ -236,7 +247,7 @@
gpointer data)
{
GbfTreeData *tdata;
- GNOME_Development_TargetSource *source;
+ GbfProjectTargetSource *source;
GdkPixbuf *pixbuf;
gtk_tree_model_get (model, iter, 0, &tdata, -1);
@@ -244,7 +255,7 @@
switch (tdata->type) {
case GBF_TREE_NODE_FILE:
source = tdata->data;
- pixbuf = gdl_icon_for_uri (source->source);
+ pixbuf = gdl_icon_for_uri (source->source_uri);
break;
case GBF_TREE_NODE_FOLDER:
pixbuf = gdl_icon_for_folder ();
@@ -269,14 +280,14 @@
{
GbfTreeData *tdata;
char *str;
- GNOME_Development_TargetSource *source;
+ GbfProjectTargetSource *source;
gtk_tree_model_get (model, iter, 0, &tdata, -1);
switch (tdata->type) {
case GBF_TREE_NODE_FILE:
source = tdata->data;
- str = uri_basename (source->source);
+ str = uri_basename (source->source_uri);
g_object_set (GTK_CELL_RENDERER (cell), "text",
str, NULL);
g_free (str);
@@ -364,20 +375,18 @@
load_data (GbfProjectTree *tree)
{
GbfProjectTreePrivate *priv;
- GNOME_Development_SourceList *source_list;
+ GList *sources, *l;
GtkTreeIter iter;
GtkTreePath *path;
GbfTreeData *node;
char *uri;
- int i;
- CORBA_Environment ev;
-
+
priv = tree->priv;
gtk_tree_store_clear (GTK_TREE_STORE (priv->tree_model));
g_hash_table_foreach_remove (priv->dirs, destroy_tree_node, NULL);
- if (priv->prj == CORBA_OBJECT_NIL) {
+ if (priv->prj == NULL) {
insert_no_project_node (tree);
return;
}
@@ -390,34 +399,26 @@
gtk_tree_store_append (GTK_TREE_STORE (priv->tree_model), &iter, NULL);
gtk_tree_store_set (GTK_TREE_STORE (priv->tree_model), &iter, 0, node, -1);
gbf_tree_data_free (node);
-
- path = gtk_tree_path_new_root ();
+
+ path = gtk_tree_path_new_root ();
g_hash_table_insert (priv->dirs, g_strdup (uri), path);
g_free (uri);
-
+
/* Add all the sources */
- CORBA_exception_init (&ev);
+ sources = GBF_PROJECT_GET_CLASS (priv->prj)->get_all_sources (priv->prj, NULL);
- source_list = GNOME_Development_Project_getAllSources (priv->prj, &ev);
- if (BONOBO_EX (&ev))
- return;
-
- for (i = 0; i < source_list->_length; i++) {
- GNOME_Development_TargetSource *source;
- const CORBA_char *id;
+ for (l = sources; l; l = l->next) {
+ GbfProjectTargetSource *source;
+ const char *id;
GtkTreeIter *parent;
- CORBA_exception_init (&ev);
+ id = l->data;
+ source = GBF_PROJECT_GET_CLASS (priv->prj)->get_source (priv->prj, id, NULL);
- id = source_list->_buffer[i];
- source = GNOME_Development_Project_getSource (priv->prj, id, &ev);
- if (BONOBO_EX (&ev))
- continue;
-
- parent = find_parent (tree, source->source);
+ parent = find_parent (tree, source->source_uri);
node = gbf_tree_data_new (GBF_TREE_NODE_FILE, source);
-
+
gtk_tree_store_append (GTK_TREE_STORE (priv->tree_model),
&iter, parent);
gtk_tree_store_set (GTK_TREE_STORE (priv->tree_model),
@@ -425,39 +426,14 @@
gtk_tree_iter_free (parent);
gbf_tree_data_free (node);
}
- CORBA_free (source_list);
- CORBA_exception_free (&ev);
-
+ g_list_free (sources);
+
gtk_tree_view_expand_row (GTK_TREE_VIEW (priv->tree), path, FALSE);
}
/* ----------------------------------------------------------------------
* Public interface
* ---------------------------------------------------------------------- */
-GType
-gbf_project_tree_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GbfProjectTreeClass),
- NULL, /* base_init. */
- NULL, /* base_finalize. */
- (GClassInitFunc) class_init,
- NULL, /* class_finalize. */
- NULL, /* class_data. */
- sizeof (GbfProjectTree),
- 0, /* n_preallocs. */
- (GInstanceInitFunc) init,
- NULL, /* value_table. */
- };
-
- type = g_type_register_static (GTK_TYPE_VBOX, "GbfProjectTree", &info, 0);
- }
-
- return type;
-}
GtkWidget *
gbf_project_tree_new (void)
@@ -465,15 +441,7 @@
return GTK_WIDGET (g_object_new (GBF_TYPE_PROJECT_TREE, NULL));
}
-GNOME_Development_Project
-gbf_project_tree_get_project (GbfProjectTree *tree)
-{
- g_return_val_if_fail (tree != NULL, NULL);
- g_return_val_if_fail (GBF_IS_PROJECT_TREE (tree), NULL);
-
- return tree->priv->prj;
-}
-
+#if 0
void
gbf_project_tree_set_project (GbfProjectTree *tree,
GNOME_Development_Project prj)
@@ -535,16 +503,6 @@
load_data (tree);
}
-BonoboEventSource *
-gbf_project_tree_get_event_source (GbfProjectTree *tree)
-{
- g_return_val_if_fail (tree != NULL, NULL);
- g_return_val_if_fail (GBF_IS_PROJECT_TREE (tree), NULL);
-
- return tree->priv->event_source;
-}
-
-
static void
event_cb (BonoboListener *listener,
const char *event,
@@ -557,6 +515,7 @@
if (!strcmp (event, "project-changed"))
load_data (tree);
}
+#endif
static void
row_activated_cb (GtkTreeView *tree_view,
@@ -568,27 +527,17 @@
GbfTreeData *tdata;
GtkTreeIter iter;
GtkTreeModel *model;
- CORBA_Environment ev;
-
+
model = gtk_tree_view_get_model (tree_view);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, 0, &tdata, -1);
if (tdata->type == GBF_TREE_NODE_FILE) {
- BonoboArg *arg;
- GNOME_Development_TargetSource *source =
- (GNOME_Development_TargetSource *) tdata->data;
-
- CORBA_exception_init (&ev);
-
- arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (arg, CORBA_string_dup (source->source));
- bonobo_event_source_notify_listeners (tree->priv->event_source,
- "file-selected",
- arg, NULL);
- bonobo_arg_release (arg);
+ GbfProjectTargetSource *source = tdata->data;
- CORBA_exception_free (&ev);
+ g_signal_emit (G_OBJECT (tree),
+ tree_signals[FILE_SELECTED], 0,
+ source->source_uri);
}
}
@@ -603,4 +552,3 @@
gtk_tree_store_set (GTK_TREE_STORE (tree->priv->tree_model), &iter,
0, tree->priv->empty_node, -1);
}
-
Index: src/controls/gbf-project-tree.h
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-project-tree.h,v
retrieving revision 1.6
diff -u -r1.6 gbf-project-tree.h
--- src/controls/gbf-project-tree.h 22 Feb 2002 01:41:34 -0000 1.6
+++ src/controls/gbf-project-tree.h 17 Aug 2002 11:28:56 -0000
@@ -25,16 +25,14 @@
#define _GBF_PROJECT_TREE_H_
#include <gtk/gtk.h>
-#include <bonobo/bonobo-event-source.h>
-#include "gnome-build.h"
G_BEGIN_DECLS
#define GBF_TYPE_PROJECT_TREE (gbf_project_tree_get_type ())
#define GBF_PROJECT_TREE(obj) (GTK_CHECK_CAST ((obj), GBF_TYPE_PROJECT_TREE, GbfProjectTree))
#define GBF_PROJECT_TREE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GBF_TYPE_PROJECT_TREE, GbfProjectTreeClass))
-#define GBF_IS_PROJECT_TREE(obj) (GTK_CHECK_TYPE ((obj), GBF_TYPE_PROJECT_TREE))
-#define GBF_IS_PROJECT_TREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GBF_TYPE_PROJECT_TREE))
+#define GBF_IS_PROJECT_TREE(obj) (GTK_CHECK_TYPE ((obj), GBF_TYPE_PROJECT_TREE))
+#define GBF_IS_PROJECT_TREE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GBF_TYPE_PROJECT_TREE))
typedef struct _GbfProjectTree GbfProjectTree;
typedef struct _GbfProjectTreePrivate GbfProjectTreePrivate;
@@ -48,15 +46,12 @@
struct _GbfProjectTreeClass {
GtkVBoxClass parent_class;
-};
-GType gbf_project_tree_get_type (void);
-GtkWidget *gbf_project_tree_new (void);
-GNOME_Development_Project gbf_project_tree_get_project (GbfProjectTree *tree);
-void gbf_project_tree_set_project (GbfProjectTree *tree,
- GNOME_Development_Project prj);
-BonoboEventSource *gbf_project_tree_get_event_source (GbfProjectTree *tree);
+ void (* file_selected) (GbfProjectTree *tree, const char *filename);
+};
+GType gbf_project_tree_get_type (void);
+GtkWidget *gbf_project_tree_new (void);
G_END_DECLS
Index: src/controls/gbf-target-tree.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-target-tree.c,v
retrieving revision 1.30
diff -u -r1.30 gbf-target-tree.c
--- src/controls/gbf-target-tree.c 12 Jul 2002 04:38:51 -0000 1.30
+++ src/controls/gbf-target-tree.c 17 Aug 2002 11:28:56 -0000
@@ -21,16 +21,22 @@
* Author: JP Rosevear
*/
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <gtk/gtktreeview.h>
#include <libgnome/gnome-i18n.h>
+#include <libgnome/gnome-macros.h>
#include <gdl/gdl-icons.h>
#include "utils.h"
#include "gbf-tree-data.h"
#include "gbf-target-tree.h"
+#include "gbf-project.h"
+
+enum {
+ FILE_SELECTED,
+ TARGET_SELECTED,
+ LAST_SIGNAL
+};
enum {
PROP_0,
@@ -38,32 +44,26 @@
};
struct _GbfTargetTreePrivate {
- GNOME_Development_Project prj;
-
+ GbfProject *prj;
+
GtkWidget *tree_sw;
GtkWidget *tree;
-
+
GtkTreeModel *tree_model;
GnomeVFSURI *root;
GHashTable *icons;
-
- GNOME_Development_Target *current_target;
- BonoboListener *listener;
-
- BonoboEventSource *event_source;
+ GbfProjectTarget *current_target;
GbfTreeData *empty_node;
};
-static GtkVBoxClass *parent_class = NULL;
+static guint tree_signals [LAST_SIGNAL] = { 0 };
-static void class_init (GbfTargetTreeClass *klass);
-static void init (GbfTargetTree *tree);
static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void destroy (GtkObject *object);
+static void dispose (GObject *object);
static void set_pixbuf (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
GtkTreeModel *model, GtkTreeIter *iter,
@@ -72,44 +72,51 @@
GtkTreeModel *model, GtkTreeIter *iter,
gpointer data);
-static void event_cb (BonoboListener *listener,
- const char *event,
- CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data);
-
+static void load_data (GbfTargetTree *tree);
+
static void row_activated_cb (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data);
static void insert_no_project_node (GbfTargetTree *tree);
+GNOME_CLASS_BOILERPLATE (GbfTargetTree, gbf_target_tree, GtkVBox, GTK_TYPE_VBOX);
+
static void
-class_init (GbfTargetTreeClass *klass)
+gbf_target_tree_class_init (GbfTargetTreeClass *klass)
{
GObjectClass *g_object_class;
- GtkObjectClass *object_class;
g_object_class = G_OBJECT_CLASS (klass);
- object_class = (GtkObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
+ g_object_class->dispose = dispose;
g_object_class->get_property = get_property;
g_object_class->set_property = set_property;
- object_class->destroy = destroy;
-
g_object_class_install_property
(g_object_class, PROP_PROJECT,
g_param_spec_pointer ("project",
_("Project"),
_("Corba Project Object"),
G_PARAM_READWRITE));
+
+ tree_signals [FILE_SELECTED] =
+ g_signal_new ("file_selected",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GbfTargetTreeClass, file_selected),
+ NULL, /* accumulator */
+ NULL, /* accu_data */
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, /* return type */
+ 1,
+ G_TYPE_STRING);
}
static void
-init (GbfTargetTree *tree)
+gbf_target_tree_instance_init (GbfTargetTree *tree)
{
GbfTargetTreePrivate *priv;
GtkCellRenderer *renderer;
@@ -165,8 +172,6 @@
(GDestroyNotify)g_free,
(GDestroyNotify)gdk_pixbuf_unref);
- priv->event_source = bonobo_event_source_new ();
-
priv->empty_node = gbf_tree_data_new (GBF_TREE_NODE_STRING,
_("No project loaded."));
insert_no_project_node (tree);
@@ -180,7 +185,7 @@
switch (prop_id) {
case PROP_PROJECT:
- g_value_set_pointer (value, gbf_target_tree_get_project (tree));
+ g_value_set_pointer (value, tree->priv->prj);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -193,10 +198,20 @@
const GValue *value, GParamSpec *pspec)
{
GbfTargetTree *tree = GBF_TARGET_TREE (object);
+ char *dir;
switch (prop_id) {
case PROP_PROJECT:
- gbf_target_tree_set_project (tree, g_value_get_pointer (value));
+ if (tree->priv->root)
+ gnome_vfs_uri_unref (tree->priv->root);
+
+ tree->priv->prj = g_value_get_pointer (value);
+ if (tree->priv->prj) {
+ g_object_get (G_OBJECT (tree->priv->prj), "project-dir", &dir, NULL);
+ tree->priv->root = gnome_vfs_uri_new (dir);
+ }
+
+ load_data (tree);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -205,7 +220,7 @@
}
static void
-destroy (GtkObject *object)
+dispose (GObject *object)
{
GbfTargetTree *tree;
GbfTargetTreePrivate *priv;
@@ -214,8 +229,8 @@
priv = tree->priv;
if (priv) {
- if (priv->prj != CORBA_OBJECT_NIL)
- gbf_target_tree_set_project (tree, CORBA_OBJECT_NIL);
+ if (priv->prj != NULL)
+ g_object_unref (priv->prj);
g_hash_table_destroy (priv->icons);
@@ -227,9 +242,6 @@
g_free (priv);
tree->priv = NULL;
}
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
@@ -241,8 +253,8 @@
{
GbfTargetTree *tree;
GbfTreeData *tdata;
- GNOME_Development_Target *target;
- GNOME_Development_TargetSource *source;
+ GbfProjectTarget *target;
+ GbfProjectTargetSource *source;
GdkPixbuf *pixbuf;
tree = GBF_TARGET_TREE (data);
@@ -251,7 +263,7 @@
switch (tdata->type) {
case GBF_TREE_NODE_FILE:
source = tdata->data;
- pixbuf = gdl_icon_for_uri (source->source);
+ pixbuf = gdl_icon_for_uri (source->source_uri);
break;
case GBF_TREE_NODE_FOLDER:
pixbuf = gdl_icon_for_folder ();
@@ -280,15 +292,15 @@
{
GbfTreeData *tdata;
char *str;
- GNOME_Development_Target *target;
- GNOME_Development_TargetSource *source;
+ GbfProjectTarget *target;
+ GbfProjectTargetSource *source;
gtk_tree_model_get (model, iter, 0, &tdata, -1);
switch (tdata->type) {
case GBF_TREE_NODE_FILE:
source = tdata->data;
- str = uri_basename (source->source);
+ str = uri_basename (source->source_uri);
g_object_set (GTK_CELL_RENDERER (cell), "text", str, NULL);
g_free (str);
break;
@@ -317,24 +329,22 @@
load_data (GbfTargetTree *tree)
{
GbfTargetTreePrivate *priv;
- GNOME_Development_TargetList *target_list;
+ GList *targets, *l, *j;
GtkTreeIter iter, child_iter, root_iter;
GtkTreePath *path;
GbfTreeData *node;
char *uri;
- CORBA_Environment ev;
- int i, j;
priv = tree->priv;
gtk_tree_store_clear (GTK_TREE_STORE (priv->tree_model));
- if (priv->prj == CORBA_OBJECT_NIL) {
+ if (priv->prj == NULL) {
insert_no_project_node (tree);
return;
}
- /* Add the highest directory in the tree */
+ /* Add the highest directory in the tree */
uri = gnome_vfs_uri_to_string (priv->root, GNOME_VFS_URI_HIDE_NONE);
node = gbf_tree_data_new (GBF_TREE_NODE_FOLDER, uri);
@@ -345,44 +355,34 @@
gbf_tree_data_free (node);
/* Add all the targets and their sources */
- CORBA_exception_init (&ev);
+ targets = GBF_PROJECT_GET_CLASS (priv->prj)->get_all_targets (priv->prj, NULL);
- target_list = GNOME_Development_Project_getAllTargets (priv->prj, &ev);
- if (BONOBO_EX (&ev))
- return;
-
- for (i = 0; i < target_list->_length; i++) {
- GNOME_Development_Target *target;
- const CORBA_char *id;
-
- CORBA_exception_init (&ev);
-
- id = target_list->_buffer[i];
- target = GNOME_Development_Project_getTarget (priv->prj, id, &ev);
- if (BONOBO_EX (&ev))
- continue;
+ for (l = targets; l; l = l->next) {
+ GbfProjectTarget *target;
+ const char *id;
+
+ id = l->data;
+ target = GBF_PROJECT_GET_CLASS (priv->prj)->get_target (priv->prj, id, NULL);
node = gbf_tree_data_new (GBF_TREE_NODE_TARGET, target);
-
- /* Add target to the tree */
+
+ /* Add target to the tree */
gtk_tree_store_append (GTK_TREE_STORE (priv->tree_model),
&iter, &root_iter);
gtk_tree_store_set (GTK_TREE_STORE (priv->tree_model), &iter,
0, node, -1);
gbf_tree_data_free (node);
-
+
/* Add sources to the tree */
- for (j = 0; j < target->sources._length; j++) {
- GNOME_Development_TargetSource *source;
- const CORBA_char *id;
-
- id = target->sources._buffer[j];
- source = GNOME_Development_Project_getSource (priv->prj, id, &ev);
- if (BONOBO_EX (&ev))
- continue;
+ for (j = target->sources; j; j = j->next) {
+ GbfProjectTargetSource *source;
+ const char *id;
+
+ id = l->data;
+ source = GBF_PROJECT_GET_CLASS (priv->prj)->get_source (priv->prj, id, NULL);
node = gbf_tree_data_new (GBF_TREE_NODE_FILE, source);
-
+
gtk_tree_store_append (GTK_TREE_STORE (priv->tree_model),
&child_iter, &iter);
gtk_tree_store_set (GTK_TREE_STORE (priv->tree_model), &child_iter,
@@ -390,7 +390,7 @@
gbf_tree_data_free (node);
}
}
- CORBA_free (target_list);
+ g_list_free (targets);
/* Expand first levels. */
path = gtk_tree_path_new_root ();
@@ -408,111 +408,7 @@
return GTK_WIDGET (g_object_new (GBF_TYPE_TARGET_TREE, NULL));
}
-GType
-gbf_target_tree_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GbfTargetTreeClass),
- NULL, /* base_init. */
- NULL, /* base_finalize. */
- (GClassInitFunc) class_init,
- NULL, /* class_finalize. */
- NULL, /* class_data. */
- sizeof (GbfTargetTree),
- 0, /* n_preallocs. */
- (GInstanceInitFunc) init,
- NULL, /* value_table. */
- };
-
- type = g_type_register_static (GTK_TYPE_VBOX, "GbfTargetTree", &info, 0);
- }
-
- return type;
-}
-
-GNOME_Development_Project
-gbf_target_tree_get_project (GbfTargetTree *tree)
-{
- g_return_val_if_fail (tree != NULL, NULL);
- g_return_val_if_fail (GBF_IS_TARGET_TREE (tree), NULL);
-
- return tree->priv->prj;
-}
-
-void
-gbf_target_tree_set_project (GbfTargetTree *tree,
- GNOME_Development_Project prj)
-{
- GbfTargetTreePrivate *priv;
- Bonobo_EventSource source;
- CORBA_Environment ev;
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GBF_IS_TARGET_TREE (tree));
-
- priv = tree->priv;
-
- CORBA_exception_init (&ev);
-
- if (priv->prj) {
- source = Bonobo_Unknown_queryInterface (priv->prj, "IDL:Bonobo/EventSource:1.0", &ev);
- Bonobo_EventSource_removeListener (source, BONOBO_OBJREF (priv->listener), &ev);
- bonobo_object_release_unref (source, &ev);
- bonobo_object_release_unref (priv->prj, &ev);
- CORBA_exception_free (&ev);
- }
-
- priv->prj = bonobo_object_dup_ref (prj, &ev);
-
- if (prj != CORBA_OBJECT_NIL) {
- Bonobo_PropertyBag pb;
- char *dir;
-
- /* Find the project dir */
- if (priv->root)
- gnome_vfs_uri_unref (priv->root);
- priv->root = NULL;
-
- pb = Bonobo_Unknown_queryInterface (prj, "IDL:Bonobo/PropertyBag:1.0", &ev);
- dir = bonobo_pbclient_get_string (pb, "project-dir", NULL);
- bonobo_object_release_unref (pb, &ev);
- CORBA_exception_free (&ev);
-
- priv->root = gnome_vfs_uri_new (dir);
-
- /* Listen for signals */
- priv->listener = bonobo_listener_new (NULL, NULL);
- g_signal_connect (priv->listener, "event_notify",
- G_CALLBACK (event_cb), tree);
-
- source = Bonobo_Unknown_queryInterface (prj, "IDL:Bonobo/EventSource:1.0", &ev);
-
- if (BONOBO_EX (&ev))
- g_error ("couldn't get event source for project");
- else
- Bonobo_EventSource_addListener (source, BONOBO_OBJREF (priv->listener), &ev);
-
- bonobo_object_unref (priv->listener);
- bonobo_object_release_unref (source, &ev);
- }
-
- CORBA_exception_free (&ev);
-
- load_data (tree);
-}
-
-GNOME_Development_Target *
-gbf_target_tree_get_current_target (GbfTargetTree *tree)
-{
- g_return_val_if_fail (tree != NULL, NULL);
- g_return_val_if_fail (GBF_IS_TARGET_TREE (tree), NULL);
-
- return tree->priv->current_target;
-}
-
+#if 0
void
gbf_target_tree_set_current_target (GbfTargetTree *tree,
GNOME_Development_Target *target)
@@ -540,13 +436,9 @@
}
#endif
}
+#endif
-BonoboEventSource *
-gbf_target_tree_get_event_source (GbfTargetTree *tree)
-{
- return tree->priv->event_source;
-}
-
+#if 0
static void
event_cb (BonoboListener *listener,
const char *event,
@@ -562,6 +454,7 @@
if (!strcmp (event, "project-changed"))
load_data (tree);
}
+#endif
static void
row_activated_cb (GtkTreeView *tree_view,
@@ -569,6 +462,7 @@
GtkTreeViewColumn *column,
gpointer data)
{
+#if 0
GbfTargetTree *tree;
GbfTargetTreePrivate *priv;
GbfTreeData *tdata;
@@ -576,26 +470,21 @@
GtkTreeModel *model;
GNOME_Development_TargetSource *source;
BonoboArg *arg;
- CORBA_Environment ev;
-
+
tree = GBF_TARGET_TREE (data);
priv = tree->priv;
-
+
model = gtk_tree_view_get_model (tree_view);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, 0, &tdata, -1);
- CORBA_exception_init (&ev);
-
switch (tdata->type) {
case GBF_TREE_NODE_FILE:
source = tdata->data;
- arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (arg, CORBA_string_dup (source->source));
- bonobo_event_source_notify_listeners (tree->priv->event_source,
- "file-selected",
- arg, NULL);
- bonobo_arg_release (arg);
+
+ g_signal_emit (G_OBJECT (tree),
+ tree_signals[FILE_SELECTED], 0,
+ source->source);
break;
case GBF_TREE_NODE_TARGET:
arg = bonobo_arg_new_from (TC_GNOME_Development_Target, tdata->data);
@@ -607,8 +496,7 @@
break;
default:
}
-
- CORBA_exception_free (&ev);
+#endif
}
static void
Index: src/controls/gbf-target-tree.h
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/gbf-target-tree.h,v
retrieving revision 1.8
diff -u -r1.8 gbf-target-tree.h
--- src/controls/gbf-target-tree.h 23 Feb 2002 05:30:38 -0000 1.8
+++ src/controls/gbf-target-tree.h 17 Aug 2002 11:28:56 -0000
@@ -24,9 +24,7 @@
#ifndef _GBF_TARGET_TREE_H_
#define _GBF_TARGET_TREE_H_
-#include <gnome.h>
-#include <bonobo/bonobo-event-source.h>
-#include "gnome-build.h"
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -48,17 +46,13 @@
struct _GbfTargetTreeClass {
GtkVBoxClass parent_class;
+
+ void (* file_selected) (GbfTargetTree *tree, const char *filename);
+ /*void (* target_selected) (GbfTargetTree *tree, const char **/
};
-GType gbf_target_tree_get_type (void);
-GtkWidget *gbf_target_tree_new (void);
-GNOME_Development_Project gbf_target_tree_get_project (GbfTargetTree *tree);
-void gbf_target_tree_set_project (GbfTargetTree *tree,
- GNOME_Development_Project project);
-GNOME_Development_Target *gbf_target_tree_get_current_target (GbfTargetTree *tree);
-void gbf_target_tree_set_current_target (GbfTargetTree *tree,
- GNOME_Development_Target *target);
-BonoboEventSource *gbf_target_tree_get_event_source (GbfTargetTree *tree);
+GType gbf_target_tree_get_type (void);
+GtkWidget *gbf_target_tree_new (void);
G_END_DECLS
Index: src/controls/test-controls.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/controls/test-controls.c,v
retrieving revision 1.4
diff -u -r1.4 test-controls.c
--- src/controls/test-controls.c 12 Jul 2002 04:38:51 -0000 1.4
+++ src/controls/test-controls.c 17 Aug 2002 11:28:57 -0000
@@ -1,16 +1,20 @@
#include <config.h>
#include <gnome.h>
-#include <bonobo.h>
+#include <string.h>
+#include <libbonoboui.h>
#include <libgnomevfs/gnome-vfs-uri.h>
-#include "gnome-build.h"
+#include "gbf-backend.h"
+#include "gbf-project-tree.h"
+#include "gbf-target-tree.h"
+#include "gbf-build-info.h"
#define TEST_CONTROLS_UI_XML "test-controls.xml"
static GtkWidget *app;
-static GNOME_Development_Project proj = CORBA_OBJECT_NIL;
-static Bonobo_Control project_ctrl;
-static Bonobo_Control target_ctrl;
-static Bonobo_Control info_ctrl;
+static GbfProject *proj = NULL;
+static GtkWidget *project_tree;
+static GtkWidget *target_tree;
+static GtkWidget *build_info;
static void open_cb (GtkWidget *widget,
gpointer user_data,
@@ -22,65 +26,46 @@
char *cname);
static BonoboUIVerb verbs[] = {
- BONOBO_UI_UNSAFE_VERB ("FileOpen", open_cb),
- BONOBO_UI_UNSAFE_VERB ("FileExit", exit_cb),
- BONOBO_UI_VERB_END
+ BONOBO_UI_UNSAFE_VERB ("FileOpen", open_cb),
+ BONOBO_UI_UNSAFE_VERB ("FileExit", exit_cb),
+ BONOBO_UI_VERB_END
};
-static GNOME_Development_Project
-activate_id (const char *id)
-{
- CORBA_Object object = CORBA_OBJECT_NIL;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- object = bonobo_activation_activate_from_id (id, Bonobo_ACTIVATION_FLAG_PRIVATE, NULL, &ev);
-
- if (BONOBO_EX (&ev))
- g_error ("Unable to activate object");
-
- CORBA_exception_free (&ev);
-
- return (GNOME_Development_Project) object;
-}
-
static void
open_cb (GtkWidget *widget,
gpointer user_data,
char *cname)
{
- GtkWidget *file_sel;
-
- file_sel = gtk_file_selection_new (_("Open Project"));
- g_signal_connect (GTK_FILE_SELECTION (file_sel)->ok_button, "clicked",
- G_CALLBACK (open_project), file_sel);
+ GtkWidget *file_sel;
-
- g_signal_connect_swapped (GTK_FILE_SELECTION (file_sel)->ok_button,
- "clicked", G_CALLBACK (gtk_widget_destroy),
- file_sel);
- g_signal_connect_swapped (GTK_FILE_SELECTION (file_sel)->cancel_button,
- "clicked", G_CALLBACK (gtk_widget_destroy),
- file_sel);
-
- gtk_widget_show (file_sel);
+ file_sel = gtk_file_selection_new (_("Open Project"));
+
+ g_signal_connect (GTK_FILE_SELECTION (file_sel)->ok_button,
+ "clicked",
+ G_CALLBACK (open_project),
+ file_sel);
+
+ g_signal_connect_swapped (GTK_FILE_SELECTION (file_sel)->ok_button,
+ "clicked", G_CALLBACK (gtk_widget_destroy),
+ file_sel);
+ g_signal_connect_swapped (GTK_FILE_SELECTION (file_sel)->cancel_button,
+ "clicked", G_CALLBACK (gtk_widget_destroy),
+ file_sel);
+
+ gtk_widget_show (file_sel);
}
static void
open_project (GtkWidget *widget,
- gpointer user_data)
+ gpointer user_data)
{
- Bonobo_ServerInfoList *result;
GtkFileSelection *file_sel;
const gchar *filename;
GnomeVFSURI *vfs_uri;
gchar *dirname;
- Bonobo_PropertyBag pb;
- BonoboArg *arg;
-
- CORBA_Environment ev;
-
+ GSList *l;
+ GbfBackend *backend = NULL;
+
file_sel = GTK_FILE_SELECTION (user_data);
filename = gtk_file_selection_get_filename (file_sel);
@@ -91,49 +76,37 @@
dirname = gnome_vfs_uri_extract_dirname (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
- if (proj != CORBA_OBJECT_NIL)
- bonobo_object_release_unref (proj, &ev);
+ if (proj != NULL)
+ g_object_unref (proj);
- CORBA_exception_init (&ev);
+ g_print ("initializing gbf backend...\n");
+ gbf_backend_init ();
- /* Get a project */
- result = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Development/Build:1.0')", NULL, &ev);
- g_assert (!BONOBO_EX (&ev));
+ for (l = gbf_backend_get_backends (); l; l = l->next) {
+ backend = l->data;
+ if (!strcmp (backend->id, "gbf-am:GbfAmProject"))
+ break;
+ backend = NULL;
+ }
- proj = activate_id (result->_buffer[0].iid);
- g_assert (proj != CORBA_OBJECT_NIL);
+ if (!backend) {
+ g_print ("no automake/autoconf backend available\n");
+ return;
+ }
- CORBA_free (result);
-
- GNOME_Development_Project_load (proj, dirname, &ev);
- if (BONOBO_EX (&ev))
- g_error ("Unable to load project");
+ g_print ("creating new gbf-am project\n");
+ proj = gbf_backend_new_project (backend->id);
+ if (!proj) {
+ g_print ("project creation failed\n");
+ return;
+ }
- arg = bonobo_arg_new (TC_GNOME_Development_Project);
- BONOBO_ARG_SET_GENERAL (arg, proj, TC_GNOME_Development_Project, GNOME_Development_Project, NULL);
-
- /* Tell GbfProjectTree to display the project. */
- pb = Bonobo_Control_getProperties (project_ctrl, &ev);
- g_assert (!BONOBO_EX (&ev));
-
- bonobo_pbclient_set_value (pb, "project", arg, &ev);
- g_assert (!BONOBO_EX (&ev));
- bonobo_object_release_unref (pb, &ev);
- g_assert (!BONOBO_EX (&ev));
-
- /* Tell GbfTargetTree to display the project. */
- pb = Bonobo_Control_getProperties (target_ctrl, &ev);
- g_assert (!BONOBO_EX (&ev));
-
- bonobo_pbclient_set_value (pb, "project", arg, &ev);
- g_assert (!BONOBO_EX (&ev));
- bonobo_object_release_unref (pb, &ev);
- g_assert (!BONOBO_EX (&ev));
+ g_print ("loading project %s\n\n", dirname);
+ GBF_PROJECT_GET_CLASS (proj)->load (proj, dirname, NULL);
- BONOBO_ARG_SET_GENERAL (arg, CORBA_OBJECT_NIL, TC_GNOME_Development_Project, GNOME_Development_Project, NULL);
- bonobo_arg_release (arg);
-
- CORBA_exception_free (&ev);
+ g_object_set (G_OBJECT (project_tree), "project", proj, NULL);
+ /*g_object_set (G_OBJECT (target_tree), "project", proj, NULL);
+ g_object_set (G_OBJECT (build_info), "project", proj, NULL);*/
}
static void
@@ -146,6 +119,7 @@
bonobo_main_quit ();
}
+#if 0
static void
event_cb (BonoboListener *listener,
const char *event,
@@ -223,6 +197,7 @@
CORBA_exception_free (&ev);
}
+#endif
static void
window_destroyed (GtkWidget *window,
@@ -244,7 +219,7 @@
BonoboWindow *win;
BonoboUIContainer *ui_container;
BonoboUIComponent *ui_component;
- GtkWidget *project_tree, *target_tree, *build_info, *notebook, *paned;
+ GtkWidget *notebook, *paned;
win = BONOBO_WINDOW (bonobo_window_new (GETTEXT_PACKAGE, _("Test Controls")));
@@ -280,22 +255,13 @@
paned = gtk_vpaned_new ();
/* Create GbfProjectTree control. */
- project_tree = bonobo_widget_new_control ("OAFIID:GNOME_Development_ProjectTree",
- BONOBO_OBJREF (ui_container));
- project_ctrl = bonobo_widget_get_objref (BONOBO_WIDGET (project_tree));
- add_event_listener (project_ctrl);
-
+ project_tree = gbf_project_tree_new ();
+
/* Create GbfTargetTree control. */
- target_tree = bonobo_widget_new_control ("OAFIID:GNOME_Development_TargetTree",
- BONOBO_OBJREF (ui_container));
- target_ctrl = bonobo_widget_get_objref (BONOBO_WIDGET (target_tree));
- add_event_listener (target_ctrl);
+ target_tree = gbf_target_tree_new ();
/* Create GbfBuildInfo control. */
- build_info = bonobo_widget_new_control ("OAFIID:GNOME_Development_BuildInfo",
- BONOBO_OBJREF (ui_container));
- info_ctrl = bonobo_widget_get_objref (BONOBO_WIDGET (build_info));
- add_event_listener (info_ctrl);
+ build_info = gbf_build_info_new ();
/* Add everything to the notebook and display it. */
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
@@ -334,9 +300,9 @@
bonobo_main ();
if (proj)
- bonobo_object_release_unref (proj, NULL);
-
+ g_object_unref (proj);
+
bonobo_ui_debug_shutdown ();
-
+
return 0;
}
/* gbf-backend.c
*
* Copyright (C) 2002 Jeroen Zwartepoorte
*
* 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 of the License, 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 Library 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.
*/
#include <config.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <libxml/tree.h>
#include "glue-factory.h"
#include "gbf-backend.h"
#define BACKEND_DIR PREFIX "/lib/gnome-build/backends"
static GList *plugin_dirs = NULL;
static GSList *available_backends = NULL;
static GHashTable *backends_by_name = NULL;
static GlueFactory *glue_factory = NULL;
static void
destroy_backend (GbfBackend *backend)
{
if (backend->id)
g_free (backend->id);
if (backend->name)
g_free (backend->name);
g_free (backend);
}
static gboolean
str_has_suffix (const char *haystack,
const char *needle)
{
const char *h, *n;
if (needle == NULL)
return TRUE;
if (haystack == NULL)
return needle[0] == '\0';
/* Eat one character at a time. */
h = haystack + strlen(haystack);
n = needle + strlen(needle);
do {
if (n == needle) {
return TRUE;
}
if (h == haystack) {
return FALSE;
}
} while (*--h == *--n);
return FALSE;
}
static char *
get_attr (GHashTable *attrs,
const char *name,
GList *lang_list)
{
#if 0
GList *l;
char *ret;
for (l = lang_list; l != NULL; l = l->next) {
char *lang_attr = g_strdup_printf ("%s-%s",
name,
(char*)l->data);
ret = g_hash_table_lookup (attrs, lang_attr);
g_free (lang_attr);
if (ret)
return ret;
}
#endif
return g_hash_table_lookup (attrs, name);
}
static GHashTable *
read_backend_attributes (xmlNodePtr backend)
{
xmlNodePtr attr;
GHashTable *attributes;
attributes = g_hash_table_new (g_str_hash, g_str_equal);
for (attr = backend->children; attr != NULL; attr = attr->next) {
char *type = xmlGetProp (attr, "type");
if (type) {
char *name;
char *value;
if (strcmp (type, "string")) {
g_warning ("gnome-build only supports string-type oaf attributes");
return NULL;
}
name = xmlGetProp (attr, "name");
value = xmlGetProp (attr, "value");
if (name && value) {
g_hash_table_insert (attributes, name, value);
} else {
g_warning ("Missing name or value in attribute");
}
}
}
return attributes;
}
static GbfBackend *
backend_from_attributes (xmlNodePtr plugin,
GHashTable *attrs)
{
static GList *langs = NULL;
GbfBackend *backend = g_new0 (GbfBackend, 1);
gboolean success = TRUE;
char *str;
#if 0
if (!langs)
langs = anjuta_get_lang_list ();
#endif
str = xmlGetProp (plugin, "location");
if (str) {
backend->id = g_strdup (str);
} else {
g_warning ("Couldn't find 'location'");
success = FALSE;
}
str = get_attr (attrs, "name", langs);
if (str) {
backend->name = g_strdup (str);
} else {
g_warning ("couldn't find 'name' attribute.");
success = FALSE;
}
str = get_attr (attrs, "description", langs);
if (str) {
backend->description = g_strdup (str);
} else {
g_warning ("Couldn't find 'description' attribute.");
success = FALSE;
}
if (!success) {
destroy_backend (backend);
backend = NULL;
}
return backend;
}
static void
load_backend (xmlNodePtr node)
{
GHashTable *attrs;
GbfBackend *backend;
attrs = read_backend_attributes (node);
backend = backend_from_attributes (node, attrs);
if (backend) {
if (g_hash_table_lookup (backends_by_name, backend->id)) {
destroy_backend (backend);
} else {
available_backends = g_slist_prepend (available_backends,
backend);
g_hash_table_insert (backends_by_name, backend->id, backend);
}
}
g_hash_table_destroy (attrs);
}
static void
load_backend_file (const char *path)
{
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr backend;
doc = xmlParseFile (path);
if ((root = xmlDocGetRootElement (doc)) == NULL) {
g_warning ("%s is not a valid backend description file", path);
xmlFreeDoc (doc);
return;
}
for (backend = root->children; backend != NULL; backend = backend->next) {
if (xmlGetProp (backend, "location")) {
load_backend (backend);
}
}
}
static void
load_backends_from_directory (const char *dirname)
{
DIR *dir;
struct dirent *entry;
dir = opendir (dirname);
if (!dir)
return;
for (entry = readdir (dir); entry != NULL; entry = readdir (dir)) {
if (str_has_suffix (entry->d_name, ".server")) {
char *pathname;
pathname = g_strdup_printf ("%s/%s",
dirname,
entry->d_name);
load_backend_file (pathname);
g_free (pathname);
}
}
}
static void
load_available_backends (void)
{
GList *l;
backends_by_name = g_hash_table_new (g_str_hash, g_str_equal);
for (l = plugin_dirs; l != NULL; l = l->next) {
load_backends_from_directory ((char*)l->data);
}
}
void
gbf_backend_init (void)
{
static gboolean initialized = FALSE;
const char *gnome2_path;
char **pathv;
char **p;
if (initialized)
return;
initialized = TRUE;
glue_factory = glue_factory_new ();
gnome2_path = g_getenv ("GNOME2_PATH");
if (gnome2_path) {
pathv = g_strsplit (gnome2_path, ":", 1);
for (p = pathv; *p != NULL; p++) {
char *path = g_strdup (*p);
plugin_dirs = g_list_prepend (plugin_dirs, path);
glue_factory_add_path (glue_factory, path);
}
g_strfreev (pathv);
}
plugin_dirs = g_list_prepend (NULL, BACKEND_DIR);
glue_factory_add_path (glue_factory, BACKEND_DIR);
plugin_dirs = g_list_reverse (plugin_dirs);
load_available_backends ();
}
GSList *
gbf_backend_get_backends (void)
{
return available_backends;
}
GbfProject *
gbf_backend_new_project (const char *id)
{
static GHashTable *types = NULL;
GType type;
GbfProject *project;
if (!types) {
types = g_hash_table_new (g_str_hash, g_str_equal);
}
type = GPOINTER_TO_UINT (g_hash_table_lookup (types, id));
if (!type) {
char **pieces;
pieces = g_strsplit (id, ":", -1);
type = glue_factory_get_object_type (glue_factory,
pieces[0],
pieces[1]);
g_hash_table_insert (types,
g_strdup (id),
GUINT_TO_POINTER (type));
g_strfreev (pieces);
}
if (type == G_TYPE_INVALID) {
g_warning ("Invalid type\n");
project = NULL;
} else {
project = GBF_PROJECT (g_object_new (type, NULL));
}
return project;
}
/* gbf-backend.h
*
* Copyright (C) 2002 Jeroen Zwartepoorte
*
* 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 of the License, 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 Library 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.
*/
#ifndef _GBF_BACKEND_H_
#define _GBF_BACKEND_H_
#include "gbf-project.h"
G_BEGIN_DECLS
typedef struct _GbfBackend GbfBackend;
struct _GbfBackend {
char *id;
char *name;
char *description;
};
void gbf_backend_init (void);
GSList *gbf_backend_get_backends (void);
GbfProject *gbf_backend_new_project (const char *id);
G_END_DECLS
#endif /* _GBF_BACKEND_H_ */
/* gbf-project.c
*
* Copyright (C) 2002 Jeroen Zwartepoorte
*
* 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 of the License, 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 Library 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.
*/
#include <config.h>
#include <libgnome/gnome-macros.h>
#include "gbf-project.h"
GNOME_CLASS_BOILERPLATE (GbfProject, gbf_project, GObject, G_TYPE_OBJECT);
static void
gbf_project_class_init (GbfProjectClass *klass)
{
parent_class = g_type_class_peek_parent (klass);
g_signal_new ("build_started",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GbfProjectClass, build_started),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_signal_new ("build_msg",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GbfProjectClass, build_msg),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_INT);
g_signal_new ("build_finished",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GbfProjectClass, build_finished),
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
}
static void
gbf_project_instance_init (GbfProject *project)
{
}
GQuark
gbf_project_error_quark (void)
{
static GQuark quark = 0;
if (quark == 0)
quark = g_quark_from_static_string ("gbf-project-quark");
return quark;
}
/* gbf-project.h
*
* Copyright (C) 2002 Jeroen Zwartepoorte
*
* 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 of the License, 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 Library 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.
*/
#ifndef _GBF_PROJECT_H_
#define _GBF_PROJECT_H_
#include <glib-object.h>
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GBF_TYPE_PROJECT (gbf_project_get_type ())
#define GBF_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GBF_TYPE_PROJECT, GbfProject))
#define GBF_PROJECT_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((klass), GBF_TYPE_PROJECT, GbfProjectClass))
#define GBF_IS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GBF_TYPE_PROJECT))
#define GBF_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GBF_TYPE_PROJECT))
#define GBF_PROJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GBF_TYPE_PROJECT, GbfProjectClass))
#define GBF_PROJECT_ERROR (gbf_project_error_quark ())
typedef struct _GbfProject GbfProject;
typedef struct _GbfProjectClass GbfProjectClass;
typedef struct _GbfProjectGroup GbfProjectGroup;
typedef struct _GbfProjectTarget GbfProjectTarget;
typedef struct _GbfProjectTargetSource GbfProjectTargetSource;
typedef enum _GbfProjectError GbfProjectError;
typedef enum _GbfBuildType GbfBuildType;
typedef enum _GbfBuildMessage GbfBuildMessage;
struct _GbfProject {
GObject parent;
};
struct _GbfProjectClass {
GObjectClass parent_class;
/* Signals */
void (*build_started) (GbfProject *project);
void (*build_msg) (GbfProject *project, GbfBuildMessage type);
void (*build_finished) (GbfProject *project, gboolean success);
/* Virtual Table */
/* Project. */
void (*load) (GbfProject *project,
const char *path,
GError **error);
void (*build) (GbfProject *project,
GbfBuildType type,
GError **error);
/* Groups. */
const char * (*add_group) (GbfProject *project,
const char *parent_id,
const char *name,
GError **error);
void (*remove_group) (GbfProject *project,
const char *id,
GError **error);
GbfProjectGroup * (*get_group) (GbfProject *project,
const char *id,
GError **error);
GtkWidget * (*configure_group) (GbfProject *project,
const char *id,
GError **error);
GtkWidget * (*configure_new_group) (GbfProject *project,
GError **error);
/* Targets. */
const char * (*add_target) (GbfProject *project,
const char *group_id,
const char *name,
const char *type,
GError **error);
void (*remove_target) (GbfProject *project,
const char *id,
GError **error);
GbfProjectTarget * (*get_target) (GbfProject *project,
const char *id,
GError **error);
GList * (*get_all_targets) (GbfProject *project,
GError **error);
GtkWidget * (*configure_target) (GbfProject *project,
const char *id,
GError **error);
GtkWidget * (*configure_new_target) (GbfProject *project,
GError **error);
/* Sources. */
const char * (*add_source) (GbfProject *project,
const char *target_id,
const char *uri,
GError **error);
void (*remove_source) (GbfProject *project,
const char *id,
GError **error);
GbfProjectTargetSource * (*get_source) (GbfProject *project,
const char *id,
GError **error);
GList * (*get_all_sources) (GbfProject *project,
GError **error);
GtkWidget * (*configure_source) (GbfProject *project,
const char *id,
GError **error);
GtkWidget * (*configure_new_source) (GbfProject *project,
GError **error);
/* Types. */
const char * (*name_for_type) (GbfProject *project,
const char *type);
GdkPixbuf * (*icon_for_type) (GbfProject *project,
const char *type);
};
struct _GbfProjectGroup {
char *id;
char *parent_id;
char *name;
GList *groups;
GList *targets;
};
struct _GbfProjectTarget {
char *id;
char *group_id;
char *name;
char *type;
GList *sources;
};
struct _GbfProjectTargetSource {
char *id;
char *target_id;
char *source_uri;
};
enum _GbfProjectError {
GBF_PROJECT_ERROR_DOESNT_EXIST,
GBF_PROJECT_ERROR_PROJECT_MALFORMED
};
enum _GbfBuildType {
GBF_BUILD_PREPARE,
GBF_BUILD_CONFIGURE,
GBF_BUILD_CLEAN,
GBF_BUILD_ALL,
GBF_BUILD_CURRENT,
GBF_BUILD_INSTALL
};
enum _GbfBuildMessage {
GBF_BUILD_DATA,
GBF_BUILD_ERROR,
GBF_BUILD_WARNING
};
GQuark gbf_project_error_quark (void);
GType gbf_project_get_type (void);
#define GBF_BACKEND_BOILERPLATE(class_name, prefix) \
GType \
prefix##_get_type (GluePlugin *plugin) \
{ \
static GType type = 0; \
if (!type) { \
static const GTypeInfo type_info = { \
sizeof (class_name##Class), \
NULL, \
NULL, \
(GClassInitFunc)prefix##_class_init, \
NULL, \
NULL, \
sizeof (class_name), \
0, \
(GInstanceInitFunc)prefix##_instance_init \
}; \
type = g_type_module_register_type (G_TYPE_MODULE (plugin), \
GBF_TYPE_PROJECT, \
#class_name, \
&type_info, 0); \
} \
return type; \
}
#define GBF_SIMPLE_BACKEND(class_name, prefix) \
G_MODULE_EXPORT void glue_register_components (GluePlugin *plugin); \
G_MODULE_EXPORT GType glue_get_component_type (GluePlugin *plugin, const char *name); \
G_MODULE_EXPORT void \
glue_register_components (GluePlugin *plugin) \
{ \
prefix##_get_type (plugin); \
} \
G_MODULE_EXPORT GType \
glue_get_component_type (GluePlugin *plugin, const char *name) \
{ \
if (!strcmp (name, #class_name)) { \
return prefix##_get_type (plugin); \
} else { \
return G_TYPE_INVALID; \
} \
}
G_END_DECLS
#endif /* _GBF_PROJECT_H_ */
#include <config.h>
#include <gnome.h>
#include "gbf-backend.h"
int main (int argc, char **argv)
{
GSList *l;
gnome_program_init ("libgbf-test", VERSION, LIBGNOME_MODULE,
argc, argv, NULL);
g_print ("initializing gbf backend...\n");
gbf_backend_init ();
g_print ("backends found:\n");
for (l = gbf_backend_get_backends (); l; l = l->next) {
GbfBackend *backend = l->data;
g_print ("id : %s\n", backend->id);
g_print ("name : %s\n", backend->name);
g_print ("description: %s\n\n", backend->description);
}
g_print ("done\n");
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]