Commit 931ebfd4 authored by Naba Kumar's avatar Naba Kumar

New project type named LibGlade.

	* src/appwiz_page1.c
	  src/compiler_options.c
	  src/project_dbase.c
	  src/project_dbase.h
	  src/project_type.c
	  src/source.c
	  src/source.h:

	  New project type named LibGlade.

	  Patch submitted by:
	  Dick Knol <dknol@gmx.net>

	* src/gnome_prj.c:
	  Commented out unused pixmap creation. May be it
	  will fix the crash in project creation.
parent 2c932177
2002-01-21 Naba Kumar <kh_naba@users.sourceforge.net>
* src/appwiz_page1.c
src/compiler_options.c
src/project_dbase.c
src/project_dbase.h
src/project_type.c
src/source.c
src/source.h:
New project type named LibGlade.
Patch submitted by:
Dick Knol <dknol@gmx.net>
* src/gnome_prj.c:
Commented out unused pixmap creation. May be it
will fix the crash in project creation.
2002-01-21 Naba Kumar <kh_naba@users.sourceforge.net>
* src/registers.c
......
......@@ -48,14 +48,17 @@ on_wizard_app_icon_select (GnomeIconList * gil, gint num,
aw->prj_type = PROJECT_TYPE_GNOME;
break;
case 3:
aw->prj_type = PROJECT_TYPE_GTKMM;
break;
aw->prj_type = PROJECT_TYPE_GTKMM;
break;
case 4:
aw->prj_type = PROJECT_TYPE_GNOMEMM;
break;
aw->prj_type = PROJECT_TYPE_GNOMEMM;
break;
case 5:
aw->prj_type = PROJECT_TYPE_BONOBO;
break;
case 6:
aw->prj_type = PROJECT_TYPE_LIBGLADE;
break;
default: /* Invalid project type */
aw->prj_type = PROJECT_TYPE_END_MARK;
break;
......@@ -74,7 +77,7 @@ create_app_wizard_page1 (AppWizard * aw)
GtkWidget *label2;
GtkWidget *druid_vbox1;
gchar *icon1_file, *icon2_file, *icon3_file, *icon4_file, *icon5_file, *icon6_file;
gchar *icon1_file, *icon2_file, *icon3_file, *icon4_file, *icon5_file, *icon6_file, *icon7_file;
frame = gtk_frame_new (NULL);
gtk_widget_show (frame);
......@@ -124,6 +127,7 @@ create_app_wizard_page1 (AppWizard * aw)
icon4_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_APP_GTKMM);
icon5_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_APP_GNOMEMM);
icon6_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_APP_COMPONENT);
icon7_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_APP_GNOME);
if (icon1_file)
gnome_icon_list_append (GNOME_ICON_LIST (iconlist1),
......@@ -149,12 +153,17 @@ create_app_wizard_page1 (AppWizard * aw)
gnome_icon_list_append (GNOME_ICON_LIST (iconlist1),
icon6_file, _("Bonobo component"));
string_free (icon1_file);
if (icon7_file)
gnome_icon_list_append (GNOME_ICON_LIST (iconlist1),
icon7_file, _("LibGlade project"));
string_free (icon1_file);
string_free (icon2_file);
string_free (icon3_file);
string_free (icon4_file);
string_free (icon5_file);
string_free (icon6_file);
string_free (icon7_file);
gtk_signal_connect (GTK_OBJECT (iconlist1), "select_icon",
GTK_SIGNAL_FUNC (on_wizard_app_icon_select), aw);
......
......@@ -85,7 +85,7 @@ create_app_wizard_page3 (AppWizard * aw)
GtkWidget *hbox1;
gchar *pixmap1_filename;
GtkWidget *pixmap1;
GtkWidget *vseparator1;
/* GtkWidget *vseparator1; */
GtkWidget *vbox1;
GSList *vbox1_group = NULL;
GtkWidget *radiobutton1;
......@@ -141,12 +141,13 @@ create_app_wizard_page3 (AppWizard * aw)
gtk_container_add (GTK_CONTAINER (frame2), hbox1);
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);
/*
pixmap1 = gtk_type_new (gnome_pixmap_get_type ());
pixmap1_filename = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_APPWIZ_GEAR);
if (pixmap1_filename)
gnome_pixmap_load_file_at_size (GNOME_PIXMAP (pixmap1), pixmap1_filename, 100, 100);
gnome_pixmap_load_file_at_size (GNOME_PIXMAP (pixmap1), pixmap1_filename, 100, 100);
else
g_warning (_("Couldn't find pixmap file: %s"), pixmap1_filename);
g_warning (_("Couldn't find pixmap file: %s"), pixmap1_filename);
g_free (pixmap1_filename);
gtk_widget_show (pixmap1);
gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, FALSE, FALSE, 0);
......@@ -154,7 +155,7 @@ create_app_wizard_page3 (AppWizard * aw)
vseparator1 = gtk_vseparator_new ();
gtk_widget_show (vseparator1);
gtk_box_pack_start (GTK_BOX (hbox1), vseparator1, TRUE, TRUE, 0);
*/
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox1);
gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 0);
......
......@@ -111,6 +111,18 @@ gchar *anjuta_supports[][ANJUTA_SUPPORT_END_MARK] = {
"",
"gnome-config --version"}
,
{
"LIBGLADE",
"C program using libglade",
"",
"",
"$(LIBGLADE_CFLAGS)",
"$(LIBGLADE_LIBS)",
"`libglade-config --cflags gnome`",
"`libglade-config --libs gnome`",
"",
"libglade-config --version"}
,
ANJUTA_SUPPORTS_END
};
......
......@@ -100,6 +100,7 @@ gchar *project_type_map[]=
"BONOBO",
"GTK--",
"GNOME--",
"LIBGLADE",
NULL
};
......@@ -1510,7 +1511,7 @@ project_dbase_generate_source_code (ProjectDBase *p)
{
gchar *filename, *target;
gboolean ret;
if (p->project_is_open == FALSE)
return FALSE;
......@@ -1520,7 +1521,7 @@ project_dbase_generate_source_code (ProjectDBase *p)
{
return source_write_generic_main_c (p);
}
filename = g_strdup_printf ("%s/%s.glade",
p->top_proj_dir,
target);
......@@ -1534,6 +1535,10 @@ project_dbase_generate_source_code (ProjectDBase *p)
}
else
{
if (project_dbase_get_project_type (p)->id == PROJECT_TYPE_LIBGLADE)
{
ret = source_write_libglade_main_c (p);
} else
if ((ret=glade_iface_generate_source_code (filename)) == FALSE)
ret = source_write_generic_main_c (p);
}
......
......@@ -59,6 +59,7 @@ enum
PROJECT_TYPE_BONOBO,
PROJECT_TYPE_GTKMM,
PROJECT_TYPE_GNOMEMM,
PROJECT_TYPE_LIBGLADE,
PROJECT_TYPE_END_MARK
};
......
......@@ -55,6 +55,28 @@ gchar* project_type_gtk[] =
"1",
};
gchar* project_type_libglade[] =
{
"LIBGLADE",
" \\\n\t$(GNOME_INCLUDEDIR) $(LIBGLADE_CFLAGS)",
" \\\n\t$(LIBGLADE_LIBS)",
"\n"
"dnl Pick up the GNOME macros.\n"
"AM_ACLOCAL_INCLUDE(macros)\n"
"\n"
"dnl GNOME macros.\n"
"GNOME_INIT\n"
"GNOME_COMPILE_WARNINGS\nGNOME_X_CHECKS\n"
"AM_PATH_LIBGLADE(,,\"gnome\")",
"/autogen.sh.gnome",
"1",
"1",
};
gchar* project_type_gnome[] =
{
"GNOME",
......@@ -182,6 +204,11 @@ Project_Type* load_project_type(gint id)
type = load_type_from_data(project_type_bonobo, id);
break;
}
case PROJECT_TYPE_LIBGLADE:
{
type = load_type_from_data(project_type_libglade, id);
break;
}
default:
{
anjuta_error("Unknown project type!");
......
......@@ -1352,6 +1352,100 @@ source_write_generic_main_c (ProjectDBase *data)
return TRUE;
}
gboolean
source_write_libglade_main_c (ProjectDBase *data)
{
FILE *fp;
gchar *filename, *src_dir, *gladefile, *target;
gint lang;
target = prop_get (data->props, "project.source.target");
g_strdelimit (target, "-", '_');
gladefile = g_strconcat (data->top_proj_dir, "/", target, ".glade", NULL);
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (data->project_is_open, FALSE);
src_dir = project_dbase_get_module_dir (data, MODULE_SOURCE);
if (!src_dir)
return FALSE;
force_create_dir (src_dir);
lang = project_dbase_get_language (data);
if (lang == PROJECT_PROGRAMMING_LANGUAGE_C)
{
filename = g_strconcat (src_dir, "/main.c", NULL);
}
else
{
filename = g_strconcat (src_dir, "/main.cc", NULL);
}
g_free (src_dir);
/* FIXME: If main.c exists, just leave it, for now. */
if (file_is_regular (filename))
{
g_free (filename);
return TRUE;
}
fp = fopen (filename, "w");
if (fp == NULL)
{
anjuta_system_error (errno, _("Couldn't create file: %s."), filename);
g_free (filename);
return FALSE;
}
fprintf(fp,
"/* Created by Anjuta version %s */\n", VERSION);
fprintf(fp,
"/*\tThis file will not be overwritten */\n\n");
if (lang == PROJECT_PROGRAMMING_LANGUAGE_C)
{
fprintf(fp,
"#ifdef HAVE_CONFIG_H\n"
"# include <config.h>\n"
"#endif\n\n"
"#include <gnome.h>\n"
"#include <glade/glade.h>\n\n"
"int main (int argc, char *argv[])\n"
"{\n"
" GtkWidget *window1;\n"
" GladeXML *xml;\n\n"
" #ifdef ENABLE_NLS\n"
" bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);\n"
" textdomain (PACKAGE);\n"
" #endif\n\n"
" gnome_init (PACKAGE, VERSION, argc, argv);\n"
" glade_gnome_init ();\n"
" /*\n"
" * The .glade filename should be on the next line.\n"
" */\n"
" xml = glade_xml_new(\"%s\", NULL);\n\n"
" /* This is important */\n"
" glade_xml_signal_autoconnect(xml);\n"
" window1 = glade_xml_get_widget(xml, \"window1\");\n"
" gtk_widget_show (window1);\n\n"
" gtk_main ();\n"
" return 0;\n"
"}\n", gladefile);
}
else
{
fprintf(fp,
"#include <iostream.h>\n"
"int main()\n\n"
"{\n"
"\tcout << \"Hello world\\n\";\n"
"\treturn (0);\n"
"}\n\n");
}
fclose (fp);
return TRUE;
}
gboolean
source_write_build_files (ProjectDBase * data)
{
......@@ -1378,6 +1472,7 @@ source_write_build_files (ProjectDBase * data)
break;
case PROJECT_TYPE_GNOME:
case PROJECT_TYPE_BONOBO:
case PROJECT_TYPE_LIBGLADE:
case PROJECT_TYPE_GNOMEMM:
ret = source_write_desktop_entry (data);
if (!ret) return FALSE;
......
......@@ -25,6 +25,9 @@
gboolean
source_write_generic_main_c (ProjectDBase *data);
gboolean
source_write_libglade_main_c (ProjectDBase *data);
gboolean
source_write_build_files (ProjectDBase * data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment