anjuta r4423 - in trunk: . data libanjuta plugins/starter src



Author: naba
Date: Sun Dec  7 12:52:21 2008
New Revision: 4423
URL: http://svn.gnome.org/viewvc/anjuta?rev=4423&view=rev

Log:
	* src/action-callbacks.c:
	* libanjuta/anjuta-utils.c:
	* libanjuta/anjuta-utils.h:
	Changed argument from GtkWindow to GtkWidget.
	
	* plugins/starter/plugin.c:
	* plugins/starter/plugin.h:
	* plugins/starter/starter.c:
	* plugins/starter/starter.h:
	* plugins/starter/anjuta-starter.plugin.in:
	* plugins/starter/starter_logo.png:
	* plugins/starter/Makefile.am:
	* src/layout.xml:
	* data/default.profile:
	* configure.in:
	Added starter plugin. (Changes by Naba: dock the starter widget directly
	to the shell instead of putting it as an editor in document-manager.
	Removed on-session-load signal which is not necessary since this widget
	can stay as quick shortcuts while working on projects. Added it in data/
	default.profile and src/layout.xml to load at startup)


Added:
   trunk/plugins/starter/
   trunk/plugins/starter/Makefile.am
   trunk/plugins/starter/anjuta-starter.plugin.in
   trunk/plugins/starter/plugin.c
   trunk/plugins/starter/plugin.h
   trunk/plugins/starter/starter.c
   trunk/plugins/starter/starter.h
   trunk/plugins/starter/starter_logo.png   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/data/default.profile
   trunk/libanjuta/anjuta-utils.c
   trunk/libanjuta/anjuta-utils.h
   trunk/src/action-callbacks.c
   trunk/src/layout.xml

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Dec  7 12:52:21 2008
@@ -1039,6 +1039,7 @@
 plugins/language-support-cpp-java/Makefile
 plugins/run-program/Makefile
 plugins/scratchbox/Makefile
+plugins/starter/Makefile
 anjuta.desktop.in
 manuals/Makefile
 manuals/reference/Makefile

Modified: trunk/data/default.profile
==============================================================================
--- trunk/data/default.profile	(original)
+++ trunk/data/default.profile	Sun Dec  7 12:52:21 2008
@@ -7,6 +7,13 @@
                  attribute="Interfaces"
                  value="IAnjutaFileLoader"/>
     </plugin>
+    <plugin name="Starter View"
+            url="http://anjuta.org/plugins/";
+            mandatory="no">
+                <require group="Anjuta Plugin"
+                 attribute="Location"
+                 value="anjuta-starter:StarterPlugin"/>
+    </plugin>
     <plugin name="Document Manager"
             url="http://anjuta.org/plugins/";
             mandatory="yes">

Modified: trunk/libanjuta/anjuta-utils.c
==============================================================================
--- trunk/libanjuta/anjuta-utils.c	(original)
+++ trunk/libanjuta/anjuta-utils.c	Sun Dec  7 12:52:21 2008
@@ -1486,7 +1486,7 @@
 #endif /* HAVE_LIBUTIL */
 
 void
-anjuta_util_help_display (GtkWindow   *parent,
+anjuta_util_help_display (GtkWidget   *parent,
 						  const gchar *doc_id,
 						  const gchar *file_name)
 {

Modified: trunk/libanjuta/anjuta-utils.h
==============================================================================
--- trunk/libanjuta/anjuta-utils.h	(original)
+++ trunk/libanjuta/anjuta-utils.h	Sun Dec  7 12:52:21 2008
@@ -122,7 +122,7 @@
 gchar* anjuta_util_get_uri_mime_type (const gchar *uri);
 gchar* anjuta_util_get_local_path_from_uri (const gchar *uri);
 
-void anjuta_util_help_display (GtkWindow   *parent,
+void anjuta_util_help_display (GtkWidget   *parent,
 							   const gchar *doc_id,
 							   const gchar *file_name);
 

Added: trunk/plugins/starter/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/plugins/starter/Makefile.am	Sun Dec  7 12:52:21 2008
@@ -0,0 +1,37 @@
+# Plugin file
+plugin_in_files = anjuta-starter.plugin.in
+%.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+starter_plugindir = $(anjuta_plugin_dir)
+starter_plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
+
+plugindir = $(anjuta_plugin_dir)
+plugin_LTLIBRARIES = libanjuta-starter.la
+
+AM_CPPFLAGS = \
+	$(WARN_CFLAGS) \
+	$(DEPRECATED_FLAGS) \
+	$(GDL_CFLAGS) \
+	$(LIBANJUTA_CFLAGS)
+
+libanjuta_starter_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
+
+libanjuta_starter_la_LIBADD = \
+	$(GDL_LIBS) \
+	$(LIBANJUTA_LIBS)
+
+libanjuta_starter_la_SOURCES= \
+	plugin.c \
+	plugin.h \
+	starter.h \
+	starter.c
+
+starter_pixmapsdir = $(anjuta_image_dir)
+starter_pixmaps_DATA = \
+	starter_logo.png
+	
+include $(top_srcdir)/scripts/build-schemas.mk
+
+EXTRA_DIST = \
+	$(plugin_in_files) \
+	$(starter_plugin_DATA) 

Added: trunk/plugins/starter/anjuta-starter.plugin.in
==============================================================================
--- (empty file)
+++ trunk/plugins/starter/anjuta-starter.plugin.in	Sun Dec  7 12:52:21 2008
@@ -0,0 +1,7 @@
+[Anjuta Plugin]
+_Name=Starter
+_Description=Welcome page with most common actions.
+Location=anjuta-starter:StarterPlugin
+Version=0.1
+Icon=anjuta-document-manager-plugin-48.png
+UserActivatable=yes

Added: trunk/plugins/starter/plugin.c
==============================================================================
--- (empty file)
+++ trunk/plugins/starter/plugin.c	Sun Dec  7 12:52:21 2008
@@ -0,0 +1,98 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+    plugin.c
+    Copyright (C) 2008 Ignacio Casal Quinteiro
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include <config.h>
+#include <libanjuta/anjuta-shell.h>
+#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-encodings.h>
+
+#include "plugin.h"
+#include "starter.h"
+
+
+static gpointer parent_class;
+
+static gboolean
+activate_plugin (AnjutaPlugin *plugin)
+{
+	GtkWidget *starter;
+
+	DEBUG_PRINT ("StarterPlugin: Activating document manager plugin...");
+
+	AnjutaShell* shell = ANJUTA_PLUGIN(plugin)->shell;
+
+	/*
+	 * Adding starter
+	 */
+	starter = GTK_WIDGET (starter_new (shell));
+	gtk_widget_show (starter);
+	ANJUTA_PLUGIN_STARTER (plugin)->starter = starter;
+	
+	anjuta_shell_add_widget (shell, starter,
+	                         "AnjutaStarter",
+	                         _("Starter"),
+	                         GTK_STOCK_ABOUT,
+	                         ANJUTA_SHELL_PLACEMENT_CENTER,
+	                         NULL);
+	return TRUE;
+}
+
+static gboolean
+deactivate_plugin (AnjutaPlugin *plugin)
+{
+	
+	DEBUG_PRINT ("StarterPlugin: Deactivating starter plugin...");
+	anjuta_shell_remove_widget (plugin->shell, ANJUTA_PLUGIN_STARTER (plugin)->starter, NULL);
+	return TRUE;
+}
+
+static void
+dispose (GObject *obj)
+{
+	G_OBJECT_CLASS (parent_class)->dispose (obj);
+}
+
+static void
+finalize (GObject *obj)
+{
+	/* Finalization codes here */
+	G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
+starter_plugin_instance_init (GObject *obj)
+{
+}
+
+static void
+starter_plugin_class_init (GObjectClass *klass) 
+{
+	AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	plugin_class->activate = activate_plugin;
+	plugin_class->deactivate = deactivate_plugin;
+	klass->dispose = dispose;
+	klass->finalize = finalize;
+}
+
+ANJUTA_PLUGIN_BOILERPLATE (StarterPlugin, starter_plugin);
+ANJUTA_SIMPLE_PLUGIN (StarterPlugin, starter_plugin);

Added: trunk/plugins/starter/plugin.h
==============================================================================
--- (empty file)
+++ trunk/plugins/starter/plugin.h	Sun Dec  7 12:52:21 2008
@@ -0,0 +1,26 @@
+#ifndef __PLUGIN_H__
+#define __PLUGIN_H__
+
+#include <libanjuta/anjuta-plugin.h>
+
+extern GType starter_plugin_get_type (GTypeModule *module);
+#define ANJUTA_TYPE_PLUGIN_STARTER         (starter_plugin_get_type (NULL))
+#define ANJUTA_PLUGIN_STARTER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_PLUGIN_STARTER, StarterPlugin))
+#define ANJUTA_PLUGIN_STARTER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), ANJUTA_TYPE_PLUGIN_STARTER, StarterPluginClass))
+#define ANJUTA_IS_PLUGIN_STARTER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PLUGIN_STARTER))
+#define ANJUTA_IS_PLUGIN_STARTER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_PLUGIN_STARTER))
+#define ANJUTA_PLUGIN_STARTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ANJUTA_TYPE_PLUGIN_STARTER, StarterPluginClass))
+
+typedef struct _StarterPlugin StarterPlugin;
+typedef struct _StarterPluginClass StarterPluginClass;
+
+struct _StarterPlugin{
+	AnjutaPlugin parent;
+	GtkWidget *starter;
+};
+
+struct _StarterPluginClass{
+	AnjutaPluginClass parent_class;
+};
+
+#endif

Added: trunk/plugins/starter/starter.c
==============================================================================
--- (empty file)
+++ trunk/plugins/starter/starter.c	Sun Dec  7 12:52:21 2008
@@ -0,0 +1,715 @@
+/*
+ *	Copyright  2008	Ignacio Casal Quinteiro <nacho resa gmail com>
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-shell.h>
+#include <libanjuta/anjuta-utils.h>
+#include <libanjuta/resources.h>
+#include <libanjuta/interfaces/ianjuta-document.h>
+#include <libanjuta/interfaces/ianjuta-document-manager.h>
+#include <libanjuta/interfaces/ianjuta-file.h>
+#include <libanjuta/interfaces/ianjuta-file-savable.h>
+#include <libanjuta/interfaces/ianjuta-file-loader.h>
+#include <libanjuta/interfaces/ianjuta-wizard.h>
+
+#include "starter.h"
+#include <gio/gio.h>
+
+#define LOGO_NAME "starter_logo.png"
+
+static GObjectClass *parent_class = NULL;
+
+struct StarterPrivate
+{
+	AnjutaShell *shell;
+
+	GtkWidget *event_box;
+
+	GdkPixbuf *logo;	
+
+	gchar *filename;
+
+	GtkWidget *new_file;
+	GtkWidget *file_box;
+
+	GtkWidget *recent_projects;
+
+	GtkWidget *anjuta_page;
+	GtkWidget *anjuta_manual;
+	GtkWidget *gnome_library;
+};
+
+static GtkWidget *anjuta_starter_button_new (const gchar *label);
+
+static void
+destroy_notify (gpointer data)
+{
+	GFile *file = (GFile *)data;
+	
+	g_object_unref (file);
+}
+
+static void
+recent_project_clicked_cb (GtkButton *button, Starter *wcm)
+{
+	GFile *file;
+	IAnjutaLoader *loader = anjuta_shell_get_interface (wcm->priv->shell, IAnjutaFileLoader,
+														NULL);
+
+	file = g_object_get_data (G_OBJECT (button), "file");
+
+	ianjuta_file_loader_load (IANJUTA_FILE_LOADER (loader),
+							  file, FALSE, NULL);
+}
+
+static void
+build_recent_projects (GtkWidget *box, Starter *wcm)
+{
+	GtkRecentManager *manager;
+	GList *list;
+	gint limit = 1000;
+	gint i = 0;
+	
+	manager = gtk_recent_manager_get_default ();
+
+	list = gtk_recent_manager_get_items (manager);
+
+	while (i < limit && list != NULL)
+	{
+		if (strcmp (gtk_recent_info_get_mime_type (list->data), "application/x-anjuta") == 0)
+		{
+			GtkWidget *button;
+			GFile *file;
+
+			button = anjuta_starter_button_new (gtk_recent_info_get_display_name (list->data));
+			gtk_widget_show (button);
+			gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
+
+			file = g_file_new_for_uri (gtk_recent_info_get_uri (list->data));
+			g_object_set_data_full (G_OBJECT (button), "file", file,
+									(GDestroyNotify)destroy_notify);
+
+			g_signal_connect (button, "clicked",
+							  G_CALLBACK (recent_project_clicked_cb),
+							  wcm);
+		}
+		i++;
+		list = g_list_next (list);
+	}
+
+	g_list_foreach (list, (GFunc)gtk_recent_info_unref, NULL);
+	g_list_free (list);
+}
+
+static void
+new_file_clicked_cb (GtkWidget *button, Starter *wcm)
+{
+	IAnjutaDocumentManager *docman = anjuta_shell_get_interface (wcm->priv->shell, 
+																 IAnjutaDocumentManager,
+																 NULL);
+	if (docman)
+		ianjuta_document_manager_add_buffer (docman, NULL, NULL, NULL);
+}
+
+static void
+on_wizard_clicked (GtkButton *menuitem, Starter *starter)
+{
+	AnjutaPluginManager *plugin_manager;
+	AnjutaPluginDescription *desc;
+	
+	desc = g_object_get_data (G_OBJECT (menuitem), "__plugin_desc");
+	plugin_manager = anjuta_shell_get_plugin_manager (starter->priv->shell,
+													  NULL);
+	if (desc)
+	{
+		gchar *id;
+		GObject *plugin;
+		
+		if (anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
+												  "Location", &id))
+		{
+			plugin =
+				anjuta_plugin_manager_get_plugin_by_id (plugin_manager, id);
+			ianjuta_wizard_activate (IANJUTA_WIZARD (plugin), NULL);
+		}
+	}
+}
+
+static int
+sort_wizards (gconstpointer wizard1, gconstpointer wizard2)
+{
+	gchar* name1, *name2;
+	AnjutaPluginDescription* desc1 = (AnjutaPluginDescription*) wizard1;
+	AnjutaPluginDescription* desc2 = (AnjutaPluginDescription*) wizard2;
+	
+	if ((anjuta_plugin_description_get_locale_string (desc1, "Wizard",
+													  "Title", &name1) ||
+			anjuta_plugin_description_get_locale_string (desc1, "Anjuta Plugin",
+														 "Name", &name1)) &&
+		(anjuta_plugin_description_get_locale_string (desc2, "Wizard",
+													  "Title", &name2) ||
+			anjuta_plugin_description_get_locale_string (desc2, "Anjuta Plugin",
+														 "Name", &name2)))
+	{
+		return strcmp(name1, name2);
+	}
+	else
+		return 0;
+}
+
+static void
+add_wizard_buttons (Starter *starter)
+{
+	AnjutaPluginManager *plugin_manager;
+	GList *node;
+	gint count;
+	GList *plugin_descs = NULL;
+	
+	plugin_manager = anjuta_shell_get_plugin_manager (starter->priv->shell,
+													  NULL);
+	
+	plugin_descs = anjuta_plugin_manager_query (plugin_manager,
+												"Anjuta Plugin",
+												"Interfaces", "IAnjutaWizard",
+												NULL);
+	plugin_descs = g_list_sort (plugin_descs, sort_wizards);
+	node = plugin_descs;
+	count = 0;
+	while (node)
+	{
+		AnjutaPluginDescription *desc;
+		gchar *str, *name;
+		
+		desc = node->data;
+		
+		name = NULL;
+		if (anjuta_plugin_description_get_locale_string (desc, "Wizard",
+														 "Title", &str) ||
+			anjuta_plugin_description_get_locale_string (desc, "Anjuta Plugin",
+														 "Name", &str))
+		{
+			name = g_strdup (N_(str));
+			g_free (str);
+		}
+		if (name)
+		{
+			GtkWidget *button;
+			
+			button = anjuta_starter_button_new (name);
+			g_free(name);
+			gtk_widget_show (button);
+			g_object_set_data (G_OBJECT (button), "__plugin_desc", desc);
+			g_signal_connect (G_OBJECT (button), "clicked",
+							  G_CALLBACK (on_wizard_clicked),
+							  starter);
+							  
+			gtk_box_pack_start (GTK_BOX (starter->priv->file_box), button,
+								FALSE, FALSE, 0);
+		}
+		node = g_list_next (node);
+	}
+	g_list_free (plugin_descs);
+}
+
+static void
+anjuta_manual_clicked_cb (GtkWidget *button, gpointer useless)
+{
+	anjuta_util_help_display (button, "anjuta-manual", "anjuta-manual.xml");
+}
+
+static void
+anjuta_page_clicked_cb (GtkButton *button, gpointer useless)
+{
+	anjuta_res_url_show ("http://anjuta.sourceforge.net";);
+}
+
+static void
+gnome_library_clicked_cb (GtkButton *button, gpointer useless)
+{
+	anjuta_res_url_show ("http://library.gnome.org";);
+}
+
+static gboolean
+on_expose_event_cb (GtkWidget *widget, GdkEventExpose *event,
+					Starter *wcm)
+{
+	cairo_t *cr;
+	cairo_pattern_t *pattern;
+	
+	cr = gdk_cairo_create (widget->window);
+	
+	pattern = cairo_pattern_create_linear (0, 0, 0, widget->allocation.height);
+	
+	if (gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget)) &&
+	    gtk_widget_is_composited (widget))
+		cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); /* transparent */
+	else
+		cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* opaque white */
+	
+	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+	cairo_paint (cr);
+	
+	cairo_pattern_add_color_stop_rgba (pattern, 0.0,
+					  				   0.6, 0.7, 0.9, 1.0); /* solid orange */
+	cairo_pattern_add_color_stop_rgba (pattern, 0.18,
+					   				   1.0, 1.0, 1.0, 1.0); /* transparent orange */
+	
+	cairo_set_source (cr, pattern);
+	cairo_pattern_destroy (pattern);
+	
+	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+	
+	cairo_paint (cr);
+	
+	cairo_destroy (cr);
+
+	cr = gdk_cairo_create (widget->window);
+	
+	gdk_cairo_set_source_pixbuf (cr, wcm->priv->logo, 20, 20);
+	
+	cairo_paint (cr);
+	
+	cairo_destroy (cr);	
+
+	GList *l, *list = NULL;
+	list = gtk_container_get_children (GTK_CONTAINER (widget));
+	
+	for (l = list; l != NULL; l = g_list_next (l))
+		gtk_container_propagate_expose (GTK_CONTAINER (widget), l->data, event);
+	
+	g_list_free (list);
+	
+	return TRUE;
+}
+
+static GtkWidget *
+anjuta_starter_button_new (const gchar *label)
+{
+	GtkWidget *button;
+	gchar *markup;
+	GtkWidget *widget;
+	
+	markup = g_markup_printf_escaped ("<span underline=\"single\" foreground=\"#5a7ac7\">%s</span>", label);
+	
+	button = gtk_button_new_with_label (markup);
+	widget = gtk_bin_get_child (GTK_BIN (button));
+	gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+	
+	g_free (markup);
+	
+	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+	gtk_button_set_alignment (GTK_BUTTON (button), 0.0, 0.5);
+	
+	return button;
+}
+
+static gchar *
+get_header_text (const gchar *text)
+{
+	gchar *markup;
+	
+	markup = g_markup_printf_escaped ("<span size=\"large\"  weight=\"bold\" foreground=\"#2525a6\">%s</span>", text);
+	
+	return markup;
+}
+
+static void 
+starter_instance_init (Starter* wcm)
+{
+	GtkWidget *main_box;
+	GtkWidget *alignment;
+	GtkWidget *vbox1, *vbox2, *vbox;
+	GtkWidget *hbox;
+	GtkWidget *label;
+	GError *error = NULL;
+	gchar *logo;
+	gchar *aux;
+	const guint logo_offset = 20;
+
+	wcm->priv = g_slice_new0 (StarterPrivate);
+
+	wcm->priv->filename = g_strdup (_("Starter"));
+
+	logo = g_build_filename (PACKAGE_PIXMAPS_DIR, LOGO_NAME, NULL);
+	
+	wcm->priv->logo = gdk_pixbuf_new_from_file (logo, &error);
+	
+	if (error != NULL)
+	{
+		g_warning (error->message);
+		g_error_free (error);
+		return;
+	}
+
+	wcm->priv->event_box = gtk_event_box_new ();
+	gtk_widget_show (wcm->priv->event_box);
+	g_signal_connect (wcm->priv->event_box, "expose-event",
+					  G_CALLBACK (on_expose_event_cb), wcm);
+
+	alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (alignment),
+							   logo_offset + gdk_pixbuf_get_height (wcm->priv->logo) + logo_offset,
+							   0, logo_offset, 0);
+
+	gtk_widget_show (alignment);
+	gtk_container_add (GTK_CONTAINER (wcm->priv->event_box), alignment);
+	
+	main_box = gtk_hbox_new (FALSE, 35);
+	gtk_widget_show (main_box);
+	gtk_container_add (GTK_CONTAINER (alignment), main_box);
+
+	/*
+	 * vbox1
+	 */
+	vbox1 = gtk_vbox_new (FALSE, 6);
+	gtk_widget_show (vbox1);
+	gtk_box_pack_start (GTK_BOX (main_box), vbox1, FALSE, FALSE, 0);
+	
+	/*
+	 * FILE/PROJECT
+	 */
+	label = gtk_label_new (NULL);
+	aux = get_header_text (_("Create File/Project"));
+	gtk_label_set_markup (GTK_LABEL (label), aux);
+	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+	g_free (aux);
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
+	
+	hbox = gtk_hbox_new (FALSE, 6);
+	gtk_widget_show (hbox);
+	gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0);
+	
+	label = gtk_label_new ("    ");
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+	
+	wcm->priv->file_box = gtk_vbox_new (FALSE, 6);
+	gtk_widget_show (wcm->priv->file_box);
+	gtk_box_pack_start (GTK_BOX (hbox), wcm->priv->file_box, FALSE, FALSE, 0);
+	
+	wcm->priv->new_file = anjuta_starter_button_new (_("New File"));
+	gtk_widget_show (wcm->priv->new_file);
+	gtk_box_pack_start (GTK_BOX (wcm->priv->file_box), wcm->priv->new_file, TRUE, TRUE, 0);
+	g_signal_connect (wcm->priv->new_file, "clicked",
+					  G_CALLBACK (new_file_clicked_cb), wcm);
+	
+	/* Separator */
+	label = gtk_label_new ("");
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
+	
+	/*
+	 * Recent Projects
+	 */
+	label = gtk_label_new (NULL);
+	aux = get_header_text (_("Recent Projects"));
+	gtk_label_set_markup (GTK_LABEL (label), aux);
+	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+	g_free (aux);
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
+	
+	hbox = gtk_hbox_new (FALSE, 6);
+	gtk_widget_show (hbox);
+	gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0);
+	
+	label = gtk_label_new ("    ");
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+	wcm->priv->recent_projects = gtk_vbox_new (FALSE, 0);
+	gtk_widget_show (wcm->priv->recent_projects);
+	gtk_box_pack_start (GTK_BOX (hbox), wcm->priv->recent_projects, FALSE, FALSE, 0);
+	build_recent_projects (wcm->priv->recent_projects, wcm);
+	
+	/*
+	 * vbox2
+	 */
+	vbox2 = gtk_vbox_new (FALSE, 6);
+	gtk_widget_show (vbox2);
+	gtk_box_pack_start (GTK_BOX (main_box), vbox2, FALSE, FALSE, 0);
+
+	/*
+	 * Links
+	 */
+	label = gtk_label_new (NULL);
+	aux = get_header_text (_("Links"));
+	gtk_label_set_markup (GTK_LABEL (label), aux);
+	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+	g_free (aux);
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
+	
+	hbox = gtk_hbox_new (FALSE, 6);
+	gtk_widget_show (hbox);
+	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
+	
+	label = gtk_label_new ("    ");
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+	vbox = gtk_vbox_new (FALSE, 6);
+	gtk_widget_show (vbox);
+	gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+
+	wcm->priv->anjuta_page = anjuta_starter_button_new (_("Anjuta Home Page"));
+	gtk_widget_show (wcm->priv->anjuta_page);
+	gtk_box_pack_start (GTK_BOX (vbox), wcm->priv->anjuta_page, TRUE, TRUE, 0);
+	g_signal_connect (wcm->priv->anjuta_page, "clicked",
+					  G_CALLBACK (anjuta_page_clicked_cb), NULL);
+
+	wcm->priv->anjuta_manual = anjuta_starter_button_new (_("Anjuta Manual"));
+	gtk_widget_show (wcm->priv->anjuta_manual);
+	gtk_box_pack_start (GTK_BOX (vbox), wcm->priv->anjuta_manual, TRUE, TRUE, 0);
+	g_signal_connect (wcm->priv->anjuta_manual, "clicked",
+					  G_CALLBACK (anjuta_manual_clicked_cb), NULL);
+
+	wcm->priv->gnome_library = anjuta_starter_button_new (_("Gnome Online API Documentation"));
+	gtk_widget_show (wcm->priv->gnome_library);
+	gtk_box_pack_start (GTK_BOX (vbox), wcm->priv->gnome_library, TRUE, TRUE, 0);
+	g_signal_connect (wcm->priv->gnome_library, "clicked",
+					  G_CALLBACK (gnome_library_clicked_cb), NULL);
+
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wcm),
+									GTK_POLICY_AUTOMATIC,
+									GTK_POLICY_AUTOMATIC);
+}
+
+static void
+starter_dispose (GObject *object)
+{
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+starter_finalize (GObject *object)
+{
+	Starter *cobj;
+	cobj = ANJUTA_STARTER (object);
+	
+	g_free (cobj->priv->filename);
+
+	g_object_unref (cobj->priv->logo);
+
+	g_slice_free (StarterPrivate, cobj->priv);
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+	DEBUG_PRINT("=========== finalise =============");
+}
+
+static void
+starter_class_init (StarterClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	
+	parent_class = g_type_class_peek_parent (klass);
+	object_class->dispose = starter_dispose;
+	object_class->finalize = starter_finalize;
+}
+
+/* Return true if editor can redo */
+static gboolean
+idocument_can_redo (IAnjutaDocument *editor, GError **e)
+{
+	return FALSE;
+}
+
+/* Return true if editor can undo */
+static gboolean
+idocument_can_undo (IAnjutaDocument *editor, GError **e)
+{
+	return FALSE;
+}
+
+/* Return true if editor can undo */
+static void
+idocument_begin_undo_action (IAnjutaDocument *editor, GError **e)
+{
+	return;
+}
+
+/* Return true if editor can undo */
+static void
+idocument_end_undo_action (IAnjutaDocument *editor, GError **e)
+{
+	return;
+}
+
+
+static void 
+idocument_undo (IAnjutaDocument* edit, GError** ee)
+{
+	return;
+}
+
+static void 
+idocument_redo (IAnjutaDocument* edit, GError** ee)
+{
+	return;
+}
+
+/* Grab focus */
+static void
+idocument_grab_focus (IAnjutaDocument *editor, GError **e)
+{
+	return;
+}
+
+/* Return the opened filename */
+static const gchar* 
+idocument_get_filename (IAnjutaDocument *editor, GError **e)
+{
+	Starter *wcm = ANJUTA_STARTER (editor);
+
+	return wcm->priv->filename;
+}
+
+static void 
+idocument_cut (IAnjutaDocument* edit, GError** ee)
+{
+	return;
+}
+
+static void 
+idocument_copy (IAnjutaDocument* edit, GError** ee)
+{
+	return;
+}
+
+static void 
+idocument_paste (IAnjutaDocument* edit, GError** ee)
+{
+	return;
+}
+
+static void 
+idocument_clear (IAnjutaDocument* edit, GError** ee)
+{
+	return;
+}
+
+static void
+idocument_iface_init (IAnjutaDocumentIface *iface)
+{
+	iface->grab_focus = idocument_grab_focus;
+	iface->get_filename = idocument_get_filename;
+	iface->can_undo = idocument_can_undo;
+	iface->can_redo = idocument_can_redo;
+	iface->begin_undo_action = idocument_begin_undo_action;
+	iface->end_undo_action = idocument_end_undo_action;
+	iface->undo = idocument_undo;
+	iface->redo = idocument_redo;
+	iface->cut = idocument_cut;
+	iface->copy = idocument_copy;
+	iface->paste = idocument_paste;
+	iface->clear = idocument_clear;
+}
+
+/* IAnjutaFile interface */
+
+/* Open uri in Editor */
+static void
+ifile_open (IAnjutaFile* file, GFile *uri, GError** e)
+{
+	return;
+}
+
+/* Return the currently loaded uri */
+
+static GFile *
+ifile_get_file (IAnjutaFile* file, GError** e)
+{
+	GFile *f;
+	
+	f = g_file_new_for_path (_("Starter"));
+	
+	return f;
+}
+
+/* IAnjutaFileSavable interface */
+
+/* Save file */
+static void 
+ifile_savable_save (IAnjutaFileSavable* file, GError** e)
+{
+	return;
+}
+
+/* Save file as */
+static void 
+ifile_savable_save_as (IAnjutaFileSavable* file, GFile *uri, GError** e)
+{
+	return;
+}
+
+static void 
+ifile_savable_set_dirty (IAnjutaFileSavable* file, gboolean dirty, GError** e)
+{
+	return;
+}
+
+static gboolean 
+ifile_savable_is_dirty (IAnjutaFileSavable* file, GError** e)
+{
+	return FALSE;
+}
+
+static void
+isavable_iface_init (IAnjutaFileSavableIface *iface)
+{
+	iface->save = ifile_savable_save;
+	iface->save_as = ifile_savable_save_as;
+	iface->set_dirty = ifile_savable_set_dirty;
+	iface->is_dirty = ifile_savable_is_dirty;
+}
+
+static void
+ifile_iface_init (IAnjutaFileIface *iface)
+{
+	iface->open = ifile_open;
+	iface->get_file = ifile_get_file;
+}
+
+/* Plublic funcs */
+Starter *
+starter_new (AnjutaShell *shell)
+{
+	Starter *starter = ANJUTA_STARTER(g_object_new(ANJUTA_TYPE_STARTER, NULL));
+
+	starter->priv->shell = shell;
+	
+	/*
+	 * Add buttons after setting the shell
+	 */
+	add_wizard_buttons (starter);
+	
+	/*
+	 * Add the event box after the scroll is realized
+	 */
+	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (starter),
+									       starter->priv->event_box);
+
+	return starter;
+}
+
+ANJUTA_TYPE_BEGIN(Starter, starter, GTK_TYPE_SCROLLED_WINDOW);
+ANJUTA_TYPE_ADD_INTERFACE(idocument, IANJUTA_TYPE_DOCUMENT);
+ANJUTA_TYPE_ADD_INTERFACE(ifile, IANJUTA_TYPE_FILE);
+ANJUTA_TYPE_ADD_INTERFACE(isavable, IANJUTA_TYPE_FILE_SAVABLE);
+ANJUTA_TYPE_END;

Added: trunk/plugins/starter/starter.h
==============================================================================
--- (empty file)
+++ trunk/plugins/starter/starter.h	Sun Dec  7 12:52:21 2008
@@ -0,0 +1,51 @@
+/*
+ *	Copyright  2008	Ignacio Casal Quinteiro <nacho resa gmail com>
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef STARTER_H
+#define STARTER_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <libanjuta/anjuta-plugin.h>
+#include <libanjuta/anjuta-shell.h>
+
+#define ANJUTA_TYPE_STARTER         (starter_get_type ())
+#define ANJUTA_STARTER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_STARTER, Starter))
+#define ANJUTA_STARTER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_STARTER, StarterClass))
+#define ANJUTA_IS_STARTER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_STARTER))
+#define ANJUTA_IS_STARTER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_STARTER))
+#define ANJUTA_STARTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ANJUTA_TYPE_STARTER, StarterClass))
+
+typedef struct StarterPrivate StarterPrivate;
+
+typedef struct {
+	GtkScrolledWindow parent;
+	StarterPrivate *priv;
+} Starter;
+
+typedef struct {
+	GtkScrolledWindowClass parent_class;
+	void (*update_ui);
+	
+} StarterClass;
+
+GType starter_get_type (void);
+Starter *starter_new (AnjutaShell *shell);
+
+#endif /* STARTER_H */

Added: trunk/plugins/starter/starter_logo.png
==============================================================================
Binary file. No diff available.

Modified: trunk/src/action-callbacks.c
==============================================================================
--- trunk/src/action-callbacks.c	(original)
+++ trunk/src/action-callbacks.c	Sun Dec  7 12:52:21 2008
@@ -102,7 +102,7 @@
 }
 
 static void
-help_activate (GtkWindow *parent, const gchar *doc_id, const gchar *item)
+help_activate (GtkWidget *parent, const gchar *doc_id, const gchar *item)
 {
 	anjuta_util_help_display (parent, doc_id, item);
 }

Modified: trunk/src/layout.xml
==============================================================================
--- trunk/src/layout.xml	(original)
+++ trunk/src/layout.xml	Sun Dec  7 12:52:21 2008
@@ -20,6 +20,7 @@
 								<placeholder name="ph_top" next-placement="center"/>
 							</notebook>
 							<notebook orientation="vertical" locked="no" page="0">
+								<item name="AnjutaStarter" orientation="horizontal" locked="no"/>
 								<item name="AnjutaDocumentManager" orientation="horizontal" locked="no"/>
 								<item name="AnjutaDevhelpDisplay" orientation="horizontal" locked="no"/>
 								<item name="AnjutaTodoPlugin" orientation="horizontal" locked="no"/>



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