[anjuta] bgo#513156 – Get rid of libgnome(ui)



commit 6b663ab536d1b7355963ddbf414c8ae86c8515d2
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Wed Jun 24 22:16:14 2009 +0200

    bgo#513156 â?? Get rid of libgnome(ui)

 configure.in                               |    6 +-
 libanjuta/Makefile.am                      |    6 +-
 libanjuta/anjuta-utils.c                   |  122 ++++++++++++++++++++++++++--
 libanjuta/anjuta-utils.h                   |    4 +-
 libanjuta/gbf-project.c                    |    7 +-
 libanjuta/libanjuta-1.0.pc.in              |    2 +-
 plugins/document-manager/Makefile.am       |    2 -
 plugins/gbf-am/gbf-am-project.c            |    5 +-
 plugins/gbf-am/test.c                      |    5 +-
 plugins/gbf-mkfile/gbf-mkfile-project.c    |    5 +-
 plugins/project-import/Makefile.am         |    1 -
 plugins/project-manager/Makefile.am        |    1 -
 plugins/project-manager/gbf-project-view.c |   21 ++---
 plugins/project-wizard/Makefile.am         |    1 -
 plugins/project-wizard/property.c          |   84 ++++++++++++++++++-
 plugins/run-program/Makefile.am            |    1 -
 plugins/search/Makefile.am                 |    3 -
 plugins/sourceview/Makefile.am             |    2 -
 plugins/tools/Makefile.am                  |    1 -
 plugins/tools/execute.c                    |    3 +-
 src/Makefile.am                            |    1 -
 21 files changed, 220 insertions(+), 63 deletions(-)
---
diff --git a/configure.in b/configure.in
index 4eab349..c15d81b 100644
--- a/configure.in
+++ b/configure.in
@@ -27,7 +27,6 @@ GLIB_REQUIRED=2.16.0
 GDK_PIXBUF_REQUIRED=2.0.0
 GTK_REQUIRED=2.14.0
 ORBIT_REQUIRED=2.6.0
-GNOME_REQUIRED=2.12.0
 GCONF_REQUIRED=2.12.0
 VTE_REQUIRED=0.9.0
 VTE_NEW_REQUIRED=0.13.1
@@ -49,7 +48,6 @@ AC_SUBST(GLIB_REQUIRED)
 AC_SUBST(GDK_PIXBUF_REQUIRED)
 AC_SUBST(GTK_REQUIRED)
 AC_SUBST(ORBIT_REQUIRED)
-AC_SUBST(GNOME_REQUIRED)
 AC_SUBST(VTE_REQUIRED)
 AC_SUBST(LIBXML_REQUIRED)
 AC_SUBST(PANGO_REQUIRED)
@@ -137,8 +135,6 @@ PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED)
 
 PKG_CHECK_MODULES(ORBIT, ORBit-2.0 >= $ORBIT_REQUIRED)
 
-PKG_CHECK_MODULES(GNOME, libgnome-2.0 >= $GNOME_REQUIRED libgnomeui-2.0 >= $GNOME_REQUIRED)
-
 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= $GCONF_REQUIRED)
 
 PKG_CHECK_MODULES(VTE, vte >= $VTE_REQUIRED)
@@ -263,7 +259,7 @@ PKG_CHECK_MODULES(PLUGIN_SYMBOL_DB,
 
 dnl Setup Anjuta Library flags
 dnl --------------------------
-LIBANJUTA_CFLAGS='$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GDL_CFLAGS) $(GNOME_CFLAGS) $(DEPRECATED_FLAGS) -I$(top_srcdir) -I$(top_builddir)/libanjuta -DPACKAGE_PIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)"\" -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" -DPACKAGE_DATA_DIR=\""$(datadir)/$(PACKAGE)"\"'
+LIBANJUTA_CFLAGS='$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GCONF_CFLAGS) $(GDL_CFLAGS) $(DEPRECATED_FLAGS) -I$(top_srcdir) -I$(top_builddir)/libanjuta -DPACKAGE_PIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)"\" -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" -DPACKAGE_DATA_DIR=\""$(datadir)/$(PACKAGE)"\"'
 LIBANJUTA_LIBS='$(top_builddir)/libanjuta/libanjuta.la'
 AC_SUBST(LIBANJUTA_CFLAGS)
 AC_SUBST(LIBANJUTA_LIBS)
diff --git a/libanjuta/Makefile.am b/libanjuta/Makefile.am
index 0e1d9ae..3b66f47 100644
--- a/libanjuta/Makefile.am
+++ b/libanjuta/Makefile.am
@@ -4,7 +4,8 @@ SUBDIRS = interfaces
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(GNOME_CFLAGS) \
+	$(GTK_CFLAGS) \
+	$(GCONF_CFLAGS) \
 	$(GLADE_DEPRECATED_CFLAGS) \
 	$(LIBXML_CFLAGS) \
 	-I$(top_srcdir) \
@@ -19,7 +20,8 @@ lib_LTLIBRARIES = libanjuta.la
 libanjuta_la_LDFLAGS = $(ANJUTA_LDFLAGS) 
 libanjuta_la_LIBADD = \
 	interfaces/libanjuta-interfaces.la \
-	$(GNOME_LIBS) \
+	$(GTK_LIBS) \
+	$(GCONF_LIBS) \
 	$(GLADE_DEPRECATED_LIBS) \
 	$(GLIB_LIBS)
 
diff --git a/libanjuta/anjuta-utils.c b/libanjuta/anjuta-utils.c
index 71808e2..771d9c4 100644
--- a/libanjuta/anjuta-utils.c
+++ b/libanjuta/anjuta-utils.c
@@ -52,6 +52,8 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#include <gconf/gconf-client.h>
+
 #include <libanjuta/anjuta-utils.h>
 #include <libanjuta/anjuta-debug.h>
 
@@ -859,14 +861,14 @@ anjuta_util_create_dir (const gchar* path)
  * Returns: A newly allocated string that is the path to the shell.
  */
 /* copied from deprecated gnome_util_user_shell in libgnome */
-char *
+gchar *
 anjuta_util_user_shell (void)
 {
 #ifndef G_OS_WIN32
 	struct passwd *pw;
-	int i;
-	const char *shell;
-	const char shells [][14] = {
+	gint i;
+	const gchar *shell;
+	const gchar shells [][14] = {
 		/* Note that on some systems shells can also
 		 * be installed in /usr/bin */
 		"/bin/bash", "/usr/bin/bash",
@@ -874,7 +876,7 @@ anjuta_util_user_shell (void)
 		"/bin/tcsh", "/usr/bin/tcsh",
 		"/bin/ksh", "/usr/bin/ksh",
 		"/bin/csh", "/bin/sh"
-											};
+	};
 
 	if (geteuid () == getuid () &&
 	    getegid () == getgid ()) {
@@ -908,7 +910,7 @@ anjuta_util_user_shell (void)
  	 * and System32 directories, so it should always find either cmd.exe
  	 * or command.com.
  	 */
-	char *retval = g_find_program_in_path ("cmd.exe");
+	gchar *retval = g_find_program_in_path ("cmd.exe");
 
 	if (retval == NULL)
 		retval = g_find_program_in_path ("command.com");
@@ -919,6 +921,80 @@ anjuta_util_user_shell (void)
 #endif
 }
 
+/**
+ * anjuta_util_user_terminal:
+ *
+ * Retrieves the user's preferred terminal.
+ *
+ * Returns: A newly allocated strings list. The first argument is the terminal 
+ * program name. The following are the arguments needed to execute
+ * a command. The list has to be freed with g_strfreev
+ */
+/* copied from deprecated gnome_execute_terminal in libgnome */
+gchar **
+anjuta_util_user_terminal (void)
+{
+#ifndef G_OS_WIN32
+	GConfClient *client;
+	gchar *terminal = NULL;
+	gchar **argv = NULL;
+	static const gchar *terms[] = {
+		"xdg-terminal",
+		"gnome-terminal",
+		"nxterm",
+		"color-xterm",
+		"rxvt",
+		"xterm",
+		"dtterm",
+		NULL
+	};
+	const gchar **term;
+
+	client = gconf_client_get_default ();
+	terminal = gconf_client_get_string (client, "/desktop/gnome/applications/terminal/exec", NULL);
+	g_object_unref (client);
+	
+	if (terminal)
+	{
+		gchar *command_line;
+		gchar *exec_flag;
+
+		exec_flag = gconf_client_get_string (client, "/desktop/gnome/applications/terminal/exec_arg", NULL);
+		command_line = g_strconcat (terminal, " ", exec_flag, NULL);
+
+		g_shell_parse_argv (command_line, NULL, &argv, NULL);
+		g_free (terminal);
+		g_free (exec_flag);
+
+		return argv;
+	}
+
+
+	/* Search for common ones */
+	for (term = terms; *term != NULL; term++)
+	{
+		terminal = g_find_program_in_path (*term);
+		if (terminal != NULL) break;
+	}
+
+	/* Try xterm */
+	g_warning (_("Cannot find a terminal, using "
+			"xterm, even if it may not work"));
+	terminal = g_strdup ("xterm");
+
+	argv = g_new0 (char *, 3);
+	argv[0] = terminal;
+	/* Note that gnome-terminal takes -x and
+	 * as -e in gnome-terminal is broken we use that. */
+	argv[1] = g_strdup (term == &terms[2] ? "-x" : "-e");
+
+	return argv;
+#else
+	g_warning ("anjuta_util_user_terminal: Not implemented");
+	return NULL;
+#endif
+}
+
 pid_t
 anjuta_util_execute_shell (const gchar *dir, const gchar *command)
 {
@@ -944,6 +1020,40 @@ anjuta_util_execute_shell (const gchar *dir, const gchar *command)
 	if (pid < 0)
 		g_warning (_("Cannot execute command: %s (using shell %s)\n"), command, shell);
 	g_free (shell);
+
+	// Anjuta will take care of child exit automatically.
+	return pid;
+}
+
+pid_t
+anjuta_util_execute_terminal_shell (const gchar *dir, const gchar *command)
+{
+	pid_t pid;
+	gchar *shell;
+	gchar **term_argv;
+	gint err;
+	
+	g_return_val_if_fail (command != NULL, -1);
+	
+	shell = anjuta_util_user_shell ();
+	term_argv = anjuta_util_user_terminal ();
+	pid = fork();
+	if (pid == 0)
+	{
+		if(dir)
+		{
+			anjuta_util_create_dir (dir);
+			err = chdir (dir);
+		}
+		execlp (term_argv[0], term_argv[0], term_argv[1], shell, "-c", command, NULL);
+		g_warning (_("Cannot execute command: %s (using shell %s)\n"), command, shell);
+		_exit(1);
+	}
+	if (pid < 0)
+		g_warning (_("Cannot execute command: %s (using shell %s)\n"), command, shell);
+	g_free (shell);
+	g_strfreev (term_argv);
+
 	// Anjuta will take care of child exit automatically.
 	return pid;
 }
diff --git a/libanjuta/anjuta-utils.h b/libanjuta/anjuta-utils.h
index a378ddb..5fc0f8f 100644
--- a/libanjuta/anjuta-utils.h
+++ b/libanjuta/anjuta-utils.h
@@ -105,8 +105,10 @@ GList * anjuta_util_update_string_list (GList *p_list, const gchar *p_str,
 										gint length);
 
 gboolean anjuta_util_create_dir (const gchar * d);
-char * anjuta_util_user_shell (void);
+gchar * anjuta_util_user_shell (void);
+gchar ** anjuta_util_user_terminal (void);
 pid_t anjuta_util_execute_shell (const gchar *dir, const gchar *command);
+pid_t anjuta_util_execute_terminal_shell (const gchar *dir, const gchar *command);
 
 gchar* anjuta_util_escape_quotes(const gchar* str);
 
diff --git a/libanjuta/gbf-project.c b/libanjuta/gbf-project.c
index 84bb5ba..b6f7492 100755
--- a/libanjuta/gbf-project.c
+++ b/libanjuta/gbf-project.c
@@ -21,10 +21,9 @@
 #include <config.h>
 #endif
 
-#include <libgnome/gnome-macros.h>
 #include "gbf-project.h"
 
-GNOME_CLASS_BOILERPLATE (GbfProject, gbf_project, GObject, G_TYPE_OBJECT);
+G_DEFINE_TYPE (GbfProject, gbf_project, G_TYPE_OBJECT);
 
 void 
 gbf_project_load (GbfProject  *project,
@@ -403,8 +402,6 @@ gbf_project_get_types (GbfProject *project)
 static void
 gbf_project_class_init (GbfProjectClass *klass) 
 {
-	parent_class = g_type_class_peek_parent (klass);
-
 	g_signal_new ("project-updated",
 		      G_TYPE_FROM_CLASS (klass),
 		      G_SIGNAL_RUN_LAST,
@@ -415,7 +412,7 @@ gbf_project_class_init (GbfProjectClass *klass)
 }
 
 static void
-gbf_project_instance_init (GbfProject *project)
+gbf_project_init (GbfProject *project)
 {
 }
 
diff --git a/libanjuta/libanjuta-1.0.pc.in b/libanjuta/libanjuta-1.0.pc.in
index 77aea70..ece3576 100644
--- a/libanjuta/libanjuta-1.0.pc.in
+++ b/libanjuta/libanjuta-1.0.pc.in
@@ -9,6 +9,6 @@ idldir= datadir@/idl/libanjuta-1.0
 Name: libanjuta
 Description: Libraries for developing Anjuta plugins.
 Version: @VERSION@
-Requires: libgnomeui-2.0
+Requires: gconf-2.0 gtk+-2.0
 Libs: -L${libdir} -lanjuta
 Cflags: -I${includedir}
diff --git a/plugins/document-manager/Makefile.am b/plugins/document-manager/Makefile.am
index f161ef4..4837552 100644
--- a/plugins/document-manager/Makefile.am
+++ b/plugins/document-manager/Makefile.am
@@ -22,7 +22,6 @@ AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
 	$(GDL_CFLAGS) \
-	$(GNOME_PRINT_UI_CFLAGS) \
 	$(GIO_CFLAGS) \
 	$(LIBANJUTA_CFLAGS) \
 	-DG_LOG_DOMAIN=\"libanjuta-document-manager\"
@@ -31,7 +30,6 @@ libanjuta_document_manager_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_document_manager_la_LIBADD = \
 	$(GDL_LIBS) \
-	$(GNOME_PRINT_UI_LIBS) \
 	$(GIO_LIBS) \
 	$(LIBANJUTA_LIBS)
 
diff --git a/plugins/gbf-am/gbf-am-project.c b/plugins/gbf-am/gbf-am-project.c
index 31996a5..1a26eb8 100644
--- a/plugins/gbf-am/gbf-am-project.c
+++ b/plugins/gbf-am/gbf-am-project.c
@@ -34,7 +34,6 @@
 #include <sys/types.h>
 #include <signal.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-macros.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libanjuta/anjuta-debug.h>
@@ -3751,8 +3750,8 @@ gbf_am_project_dispose (GObject *object)
 	g_free (project->configure_command);
 	g_free (project->autogen_command);
 	g_free (project->install_prefix);
-	
-	GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+
+	G_OBJECT_CLASS (parent_class)->dispose (object);	
 }
 
 static void
diff --git a/plugins/gbf-am/test.c b/plugins/gbf-am/test.c
index 75b1661..f2a559e 100644
--- a/plugins/gbf-am/test.c
+++ b/plugins/gbf-am/test.c
@@ -5,7 +5,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <gtk/gtk.h>
-#include <libgnome/gnome-init.h>
 #include "gbf-am-project.h"
 
 static void
@@ -103,9 +102,7 @@ main (int argc, char *argv[])
 	GError *error = NULL;
 	
 	/* Bootstrap */
-	gnome_program_init ("libgbf-am-test", VERSION, LIBGNOME_MODULE, 
-			    argc, argv, NULL,
-			    NULL);  /* Avoid GCC sentinel warning */
+	g_type_init ();
 
 	if (argc < 2) {
 		g_print ("! You need to specify a project path\n");
diff --git a/plugins/gbf-mkfile/gbf-mkfile-project.c b/plugins/gbf-mkfile/gbf-mkfile-project.c
index badfa2e..1abc49d 100644
--- a/plugins/gbf-mkfile/gbf-mkfile-project.c
+++ b/plugins/gbf-mkfile/gbf-mkfile-project.c
@@ -38,7 +38,6 @@
 #include <signal.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#include <libgnome/gnome-macros.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libanjuta/gbf-project.h>
@@ -3493,8 +3492,8 @@ gbf_mkfile_project_dispose (GObject *object)
 	g_free (project->configure_command);
 	g_free (project->autogen_command);
 	g_free (project->install_prefix);
-	
-	GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+
+	G_OBJECT_CLASS (parent_class)->dispose (object);	
 }
 
 static void
diff --git a/plugins/project-import/Makefile.am b/plugins/project-import/Makefile.am
index efd4cc9..2afcae5 100644
--- a/plugins/project-import/Makefile.am
+++ b/plugins/project-import/Makefile.am
@@ -28,7 +28,6 @@ libanjuta_project_import_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_project_import_la_LIBADD = \
 	$(PLUGIN_GNOMEBUILD_LIBS) \
-	$(GNOME_UI_LIBS) \
 	$(GIO_LIBS) \
 	$(LIBANJUTA_LIBS)
 
diff --git a/plugins/project-manager/Makefile.am b/plugins/project-manager/Makefile.am
index 3c9b3d3..e0da507 100644
--- a/plugins/project-manager/Makefile.am
+++ b/plugins/project-manager/Makefile.am
@@ -51,7 +51,6 @@ libanjuta_project_manager_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 # Plugin dependencies
 libanjuta_project_manager_la_LIBADD = \
-	$(GNOME_UI_LIBS) \
 	$(LIBANJUTA_LIBS)
 
 EXTRA_DIST = \
diff --git a/plugins/project-manager/gbf-project-view.c b/plugins/project-manager/gbf-project-view.c
index c92259e..2db6a70 100644
--- a/plugins/project-manager/gbf-project-view.c
+++ b/plugins/project-manager/gbf-project-view.c
@@ -29,7 +29,6 @@
 #include <glib/gi18n.h>
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
-#include <libgnome/gnome-macros.h>
 #include <gio/gio.h>
 #include <string.h>
 
@@ -49,7 +48,7 @@ enum {
 static guint signals [LAST_SIGNAL] = { 0 };
 
 static void gbf_project_view_class_init    (GbfProjectViewClass *klass);
-static void gbf_project_view_instance_init (GbfProjectView      *tree);
+static void gbf_project_view_init          (GbfProjectView      *tree);
 static void destroy                        (GtkObject           *object);
 
 static void set_pixbuf                     (GtkTreeViewColumn   *tree_column,
@@ -64,9 +63,7 @@ static void set_text                       (GtkTreeViewColumn   *tree_column,
 					    gpointer             data);
 
 
-GNOME_CLASS_BOILERPLATE(GbfProjectView, gbf_project_view,
-			GtkTreeView, GTK_TYPE_TREE_VIEW);
-
+G_DEFINE_TYPE(GbfProjectView, gbf_project_view, GTK_TYPE_TREE_VIEW);
 
 static void
 row_activated (GtkTreeView       *tree_view,
@@ -120,8 +117,8 @@ destroy (GtkObject *object)
 		tree->priv = NULL;
 	}
 	
-	if (GTK_OBJECT_CLASS (parent_class)->destroy)
-		(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+	if (GTK_OBJECT_CLASS (gbf_project_view_parent_class)->destroy)
+		(* GTK_OBJECT_CLASS (gbf_project_view_parent_class)->destroy) (object);
 }
 
 static GdkPixbuf*
@@ -245,9 +242,9 @@ expose_event (GtkWidget *widget, GdkEventExpose *ev)
 	GtkTreeModel *model;
 	GtkTreeView *tree_view;
 	gint event_handled = FALSE;
-	
-	event_handled = GNOME_CALL_PARENT_WITH_DEFAULT (
-		GTK_WIDGET_CLASS, expose_event, (widget, ev), event_handled);
+
+	if (GTK_WIDGET_CLASS (gbf_project_view_parent_class)->expose_event != NULL)
+		GTK_WIDGET_CLASS (gbf_project_view_parent_class)->expose_event (widget, ev);
 
 	tree_view = GTK_TREE_VIEW (widget);
 	model = gtk_tree_view_get_model (tree_view);
@@ -291,8 +288,6 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
 	widget_class = GTK_WIDGET_CLASS (klass);
 	tree_view_class = GTK_TREE_VIEW_CLASS (klass);
 
-	parent_class = g_type_class_peek_parent (klass);
-
 	object_class->destroy = destroy;
 	widget_class->expose_event = expose_event;
 	tree_view_class->row_activated = row_activated;
@@ -328,7 +323,7 @@ gbf_project_view_class_init (GbfProjectViewClass *klass)
 }
 
 static void 
-gbf_project_view_instance_init (GbfProjectView *tree)
+gbf_project_view_init (GbfProjectView *tree)
 {
 	GtkCellRenderer *renderer;
 	GtkTreeViewColumn *column;
diff --git a/plugins/project-wizard/Makefile.am b/plugins/project-wizard/Makefile.am
index eefca11..1f7c1bf 100644
--- a/plugins/project-wizard/Makefile.am
+++ b/plugins/project-wizard/Makefile.am
@@ -36,7 +36,6 @@ AM_CPPFLAGS = \
 libanjuta_project_wizard_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_project_wizard_la_LIBADD = \
-	$(GNOME_UI_LIBS) \
 	$(LIBANJUTA_LIBS)
 
 libanjuta_project_wizard_la_SOURCES= \
diff --git a/plugins/project-wizard/property.c b/plugins/project-wizard/property.c
index 70e7ff3..5a1c41e 100644
--- a/plugins/project-wizard/property.c
+++ b/plugins/project-wizard/property.c
@@ -33,7 +33,6 @@
 #include <gdk/gdk.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#include <gnome.h>
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -318,7 +317,7 @@ cb_browse_button_clicked (GtkButton *button, NPWProperty* prop)
 
 	if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
   	{
-    	char *filename;
+    	gchar *filename;
 
     	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 		gtk_entry_set_text (GTK_ENTRY (prop->widget), filename);
@@ -327,6 +326,67 @@ cb_browse_button_clicked (GtkButton *button, NPWProperty* prop)
 	gtk_widget_destroy (dialog);
 }
 
+static void
+cb_preview_update (GtkFileChooser *fc,
+		   GtkImage *preview)
+{
+	char *filename;
+	GdkPixbuf *pixbuf;
+
+	filename = gtk_file_chooser_get_preview_filename (fc);
+	if (filename) {
+		pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+
+		gtk_file_chooser_set_preview_widget_active (fc, pixbuf != NULL);
+		
+		if (pixbuf) {
+			gtk_image_set_from_pixbuf (preview, pixbuf);
+			g_object_unref (pixbuf);
+		}
+		
+		g_free (filename);
+	}
+}
+
+static void
+cb_icon_button_clicked (GtkButton *button, NPWProperty* prop)
+{
+	GtkWidget *dialog;
+	GtkFileFilter *filter;
+	GtkWidget *preview;
+	int res;
+
+	dialog = gtk_file_chooser_dialog_new (_("Select an Image File"),
+											GTK_WINDOW (gtk_widget_get_ancestor (prop->widget, GTK_TYPE_WINDOW)),
+					      					GTK_FILE_CHOOSER_ACTION_OPEN, 
+					      					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					      					GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+					      					NULL);
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
+	    									PACKAGE_PIXMAPS_DIR);
+	filter = gtk_file_filter_new ();
+	gtk_file_filter_add_pixbuf_formats (filter);
+	gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
+
+	preview = gtk_image_new ();
+	gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog),
+	    								    preview);
+	g_signal_connect (dialog, "update-preview",
+			  								G_CALLBACK (cb_preview_update), preview);
+
+	res = gtk_dialog_run (GTK_DIALOG (dialog));
+
+	if (res == GTK_RESPONSE_ACCEPT) {
+    	gchar *filename;
+
+    	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+		gtk_image_set_from_file (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON (prop->widget))), filename);
+		gtk_button_set_label (GTK_BUTTON (prop->widget), filename == NULL ? _("Choose Icon") : NULL);
+	}
+
+	gtk_widget_destroy (dialog);
+}
+
 GtkWidget*
 npw_property_create_widget (NPWProperty* prop)
 {
@@ -400,8 +460,22 @@ npw_property_create_widget (NPWProperty* prop)
 		}
 		break;
 	case NPW_ICON_PROPERTY:
-		entry = gnome_icon_entry_new("icon_choice", _("Icon choice"));
-		if (value) gnome_icon_entry_set_filename (GNOME_ICON_ENTRY (entry), value);
+		{
+			GtkWidget *image;
+
+			image = gtk_image_new ();
+			entry = gtk_button_new ();
+			if (value)
+			{
+				gtk_image_set_from_file (GTK_IMAGE (image), value);
+			}
+			else
+			{
+				gtk_button_set_label (GTK_BUTTON(entry), _("Choose Icon"));
+			}
+			gtk_button_set_image (GTK_BUTTON (entry), image);
+			g_signal_connect (entry, "clicked", G_CALLBACK (cb_icon_button_clicked), prop);
+		}
 		break;
 	case NPW_LIST_PROPERTY:
 	{
@@ -519,7 +593,7 @@ npw_property_set_value_from_widget (NPWProperty* prop, NPWValueTag tag)
 		}
 		break;
 	case NPW_ICON_PROPERTY:
-		alloc_value = gnome_icon_entry_get_filename (GNOME_ICON_ENTRY (prop->widget));
+		g_object_get (G_OBJECT (gtk_button_get_image (GTK_BUTTON (prop->widget))), "file", &alloc_value, NULL);	
 		value = alloc_value;
 		break;
 	case NPW_LIST_PROPERTY:
diff --git a/plugins/run-program/Makefile.am b/plugins/run-program/Makefile.am
index f8ff5c2..66a416a 100644
--- a/plugins/run-program/Makefile.am
+++ b/plugins/run-program/Makefile.am
@@ -29,7 +29,6 @@ AM_CPPFLAGS= \
 libanjuta_run_program_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_run_program_la_LIBADD = \
-	$(GNOME_UI_LIBS) \
 	$(LIBANJUTA_LIBS)
 
 libanjuta_run_program_la_SOURCES = \
diff --git a/plugins/search/Makefile.am b/plugins/search/Makefile.am
index 83adbf9..d6b0e3c 100644
--- a/plugins/search/Makefile.am
+++ b/plugins/search/Makefile.am
@@ -24,7 +24,6 @@ search_ui_DATA = anjuta-search.xml
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(GNOME_PRINT_UI_CFLAGS) \
 	$(LIBANJUTA_CFLAGS) \
 	-I$(top_srcdir)/tagmanager/include \
 	-DG_LOG_DOMAIN=\"libanjuta-search\"
@@ -32,8 +31,6 @@ AM_CPPFLAGS = \
 libanjuta_search_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_search_la_LIBADD = \
-	$(GNOME_PRINT_UI_LIBS) \
-	$(GNOME_UI_LIBS) \
 	$(LIBANJUTA_LIBS)
 
 libanjuta_search_la_SOURCES= \
diff --git a/plugins/sourceview/Makefile.am b/plugins/sourceview/Makefile.am
index 5f87052..d9b524a 100644
--- a/plugins/sourceview/Makefile.am
+++ b/plugins/sourceview/Makefile.am
@@ -24,7 +24,6 @@ sourceview_plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(GNOME_PRINT_UI_CFLAGS) \
 	$(GIO_CFLAGS) \
 	$(PLUGIN_SOURCEVIEW_CFLAGS) \
 	$(LIBANJUTA_CFLAGS)
@@ -74,7 +73,6 @@ libanjuta_sourceview_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 # Plugin dependencies
 libanjuta_sourceview_la_LIBADD = \
-	$(GNOME_PRINT_UI_LIBS) \
 	$(GIO_LIBS) \
 	$(PLUGIN_SOURCEVIEW_LIBS) \
 	$(LIBANJUTA_LIBS)
diff --git a/plugins/tools/Makefile.am b/plugins/tools/Makefile.am
index f7fc32c..b321a2b 100644
--- a/plugins/tools/Makefile.am
+++ b/plugins/tools/Makefile.am
@@ -31,7 +31,6 @@ AM_CPPFLAGS = \
 libanjuta_tools_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_tools_la_LIBADD = \
-	$(GNOME_UI_LIBS) \
 	$(LIBANJUTA_LIBS)
 
 libanjuta_tools_la_SOURCES= \
diff --git a/plugins/tools/execute.c b/plugins/tools/execute.c
index 8b1fa31..4f98b11 100644
--- a/plugins/tools/execute.c
+++ b/plugins/tools/execute.c
@@ -35,7 +35,6 @@
 #include <libanjuta/interfaces/ianjuta-editor-selection.h>
 #include <libanjuta/interfaces/ianjuta-file-savable.h>
 #include <libanjuta/interfaces/ianjuta-file-loader.h>
-#include <libgnome/libgnome.h>
 
 #include <glib.h>
 #include <stdlib.h>
@@ -979,7 +978,7 @@ atp_user_tool_execute (GtkMenuItem *item, ATPUserTool* this)
 		/* Run in a terminal */
 		/* don't need a execution context, launch and forget */
 
-		gnome_execute_terminal_shell (dir, cmd);
+		anjuta_util_execute_terminal_shell (dir, cmd);
 	}
 	else
 	{
diff --git a/src/Makefile.am b/src/Makefile.am
index ffdddaa..4d47c64 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,7 +41,6 @@ anjuta_SOURCES = \
 	main.c
 
 anjuta_LDADD =  \
-	$(GNOME_LIBS) \
 	$(GCONF_LIBS) \
 	$(GDL_LIBS) \
 	$(GLADE_LIBS)\



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]