Hi,
First, excuse me for my (very) bad English
![Sad :(](https://forums.codeblocks.org/Smileys/default/sad.gif)
I developed a GTK+ template for C::B, it work with RC1 but with last Nightly builds (07 November) it does not appear in New Projects dialog box
![Sad :(](https://forums.codeblocks.org/Smileys/default/sad.gif)
Here files based on the Qt template :
share/CodeBlocks/templates/gtk.cbp
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="GTK+ application"/>
<Option makefile="Makefile"/>
<Build>
<Target title="default">
<Option type="0"/>
<Option parameters=""/>
<Option includeInTargetAll="1"/>
<Option projectCompilerOptionsRelation="3"/>
<Option projectLinkerOptionsRelation="3"/>
<Option projectIncludeDirsRelation="3"/>
<Option projectLibDirsRelation="3"/>
<Compiler>
<Add option="-mno-cygwin"/>
<Add option="-mms-bitfields"/>
<Add directory="C:\Program Files\CodeBlocks\include\gtk-2.0"/>
<Add directory="C:\Program Files\CodeBlocks\lib\gtk-2.0\include"/>
<Add directory="C:\Program Files\CodeBlocks\include\atk-1.0"/>
<Add directory="C:\Program Files\CodeBlocks\include\pango-1.0"/>
<Add directory="C:\Program Files\CodeBlocks\include\glib-2.0"/>
<Add directory="C:\Program Files\CodeBlocks\include\glib-2.0\glib"/>
<Add directory="C:\Program Files\CodeBlocks\lib\glib-2.0"/>
<Add directory="C:\Program Files\CodeBlocks\lib\glib-2.0\include"/>
<Add directory="C:\Program Files\CodeBlocks\include\cairo"/>
</Compiler>
<Linker>
<Add option="-limm32"/>
<Add option="-lshell32"/>
<Add option="-lole32"/>
<Add option="-luuid"/>
<Add library="C:\Program Files\CodeBlocks\lib\glib-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\pangocairo-1.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\pangowin32-1.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\libatk-1.0.dll.a"/>
<Add library="C:\Program Files\CodeBlocks\lib\gdk_pixbuf-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\gdk-win32-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\pango-1.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\gmodule-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\gobject-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\gthread-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\gtk-win32-2.0.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\cairo.lib"/>
<Add library="C:\Program Files\CodeBlocks\lib\pangoft2-1.0.lib"/>
</Linker>
</Target>
</Build>
</Project>
</CodeBlocks_project_file>
share/CodeBlocks/templates/gtk.template
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_template_file>
<CodeBlocks_template_file>
<Template name="GTKapp" title="GTK Application" category="GUI" bitmap="gtklogo.png">
<FileSet name="s" title="Default">
<File source="gtk-main.c" destination="main.c"/>
</FileSet>
<Option name="GTK Application">
<Project file="gtk.cbp"/>
</Option>
</Template>
</CodeBlocks_template_file>
share/CodeBlocks/templates/gtk.template
#include <stdlib.h>
#include <gtk/gtk.h>
static void helloWorld (GtkWidget *wid, GtkWidget *win)
{
GtkWidget *dialog = NULL;
dialog = gtk_message_dialog_new (GTK_WINDOW (win), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Hello World!");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
int main (int argc, char *argv[])
{
GtkWidget *button = NULL;
GtkWidget *win = NULL;
GtkWidget *vbox = NULL;
/* Initialize GTK+ */
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
gtk_init (&argc, &argv);
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
/* Create the main window */
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (win), 8);
gtk_window_set_title (GTK_WINDOW (win), "Hello World");
gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
gtk_widget_realize (win);
g_signal_connect (win, "destroy", gtk_main_quit, NULL);
/* Create a vertical box with buttons */
vbox = gtk_vbox_new (TRUE, 6);
gtk_container_add (GTK_CONTAINER (win), vbox);
button = gtk_button_new_from_stock (GTK_STOCK_DIALOG_INFO);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (helloWorld), (gpointer) win);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
g_signal_connect (button, "clicked", gtk_main_quit, NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
/* Enter the main loop */
gtk_widget_show_all (win);
gtk_main ();
return 0;
}
Where is mistake ?
Thanks
![Wink ;)](https://forums.codeblocks.org/Smileys/default/wink.gif)
[attachment deleted by admin]