GTK-headers 2.22.0 for FreeBasic

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » May 07, 2011 14:25

Nah, I mean it this way (example from Anjuta):

Code: Select all

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * gtk-foobar.c
 * Copyright (C) Arnel A. Borja 2011 <galeon@ymail.com>
 *
 * gtk-foobar 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 3 of the License, or
 * (at your option) any later version.
 *
 * gtk-foobar 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, see <http://www.gnu.org/licenses/>.
 */
#include "gtk-foobar.h"

#include <glib/gi18n.h>



/* For testing propose use the local (not installed) ui file */
/* #define UI_FILE PACKAGE_DATA_DIR"/gtk_foobar/ui/gtk_foobar.ui" */
#define UI_FILE "src/gtk_foobar.ui"


G_DEFINE_TYPE (Gtkfoobar, gtk_foobar, GTK_TYPE_APPLICATION);

/* Create a new window loading a file */
static void
gtk_foobar_new_window (GApplication *app,
                           GFile        *file)
{
   GtkWidget *window;

   GtkBuilder *builder;
   GError* error = NULL;

   /* Load UI from file */
   builder = gtk_builder_new ();
   if (!gtk_builder_add_from_file (builder, UI_FILE, &error))
   {
      g_warning ("Couldn't load builder file: %s", error->message);
      g_error_free (error);
   }

   /* Auto-connect signal handlers */
   gtk_builder_connect_signals (builder, NULL);

   /* Get the window object from the ui file */
   window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
   g_object_unref (builder);
   
   
   gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));
   if (file != NULL)
   {
      /* TODO: Add code here to open the file in the new window */
   }
   gtk_widget_show_all (GTK_WIDGET (window));
}


/* GApplication implementation */
static void
gtk_foobar_activate (GApplication *application)
{
  gtk_foobar_new_window (application, NULL);
}

static void
gtk_foobar_open (GApplication  *application,
                     GFile        **files,
                     gint           n_files,
                     const gchar   *hint)
{
  gint i;

  for (i = 0; i < n_files; i++)
    gtk_foobar_new_window (application, files[i]);
}

static void
gtk_foobar_init (Gtkfoobar *object)
{

}

static void
gtk_foobar_finalize (GObject *object)
{

   G_OBJECT_CLASS (gtk_foobar_parent_class)->finalize (object);
}

static void
gtk_foobar_class_init (GtkfoobarClass *klass)
{
   G_APPLICATION_CLASS (klass)->activate = gtk_foobar_activate;
   G_APPLICATION_CLASS (klass)->open = gtk_foobar_open;

   G_OBJECT_CLASS (klass)->finalize = gtk_foobar_finalize;
}

Gtkfoobar *
gtk_foobar_new (void)
{
   g_type_init ();

   return g_object_new (gtk_foobar_get_type (),
                        "application-id", "org.gnome.gtk_foobar",
                        "flags", G_APPLICATION_HANDLES_OPEN,
                        NULL);
}

Code: Select all

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * gtk-foobar.h
 * Copyright (C) Arnel A. Borja 2011 <galeon@ymail.com>
 *
 * gtk-foobar 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 3 of the License, or
 * (at your option) any later version.
 *
 * gtk-foobar 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef _GTK_FOOBAR_
#define _GTK_FOOBAR_

#include <gtk/gtk.h>

G_BEGIN_DECLS

#define GTK_FOOBAR_TYPE_APPLICATION             (gtk_foobar_get_type ())
#define GTK_FOOBAR_APPLICATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_FOOBAR_TYPE_APPLICATION, Gtkfoobar))
#define GTK_FOOBAR_APPLICATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_FOOBAR_TYPE_APPLICATION, GtkfoobarClass))
#define GTK_FOOBAR_IS_APPLICATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_FOOBAR_TYPE_APPLICATION))
#define GTK_FOOBAR_IS_APPLICATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_FOOBAR_TYPE_APPLICATION))
#define GTK_FOOBAR_APPLICATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_FOOBAR_TYPE_APPLICATION, GtkfoobarClass))

typedef struct _GtkfoobarClass GtkfoobarClass;
typedef struct _Gtkfoobar Gtkfoobar;

struct _GtkfoobarClass
{
   GtkApplicationClass parent_class;
};

struct _Gtkfoobar
{
   GtkApplication parent_instance;
};

GType gtk_foobar_get_type (void) G_GNUC_CONST;
Gtkfoobar *gtk_foobar_new (void);

/* Callbacks */

G_END_DECLS

#endif /* _APPLICATION_H_ */


Creating a GObject is needed this way, because "inheriting" from GtkApplication is needed.

TJF wrote:
Galeon wrote:I could help if you want to. I love creating packages hehe...

I would realy appreciate your (and any other) help. Be prepared that I'll will ask for. Hopefully you won't run out of time again.

Not sure though. I have free time this summer until I enter college on half of June. After that, I only have time on Sunday to Monday (don't have classes in Monday). I don't have enough time last time when I'm still in high school.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » May 19, 2011 15:40

TJF, if you're interested in GTK+ 3.0 binaries for Windows, you can get ATK and GTK+ here:
http://www.galeon.exofire.net/gtk+-3.0/

The other libraries are available from the Gnome website:
http://ftp.gnome.org/pub/gnome/binaries/win32/
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/

The other files needed are:
cairo_1.10.2-1_win32.zip
cairo-dev_1.10.2-1_win32.zip
expat_2.0.1-1_win32.zip
expat-dev_2.0.1-1_win32.zip
fontconfig_2.8.0-2_win32.zip
fontconfig-dev_2.8.0-2_win32.zip
freetype_2.4.4-1_win32.zip
freetype-dev_2.4.4-1_win32.zip
gdk-pixbuf_2.22.1-1_win32.zip
gdk-pixbuf-dev_2.22.1-1_win32.zip
gettext-runtime_0.18.1.1-2_win32.zip
gettext-runtime-dev_0.18.1.1-2_win32.zip
gettext-tools_0.18.1.1-2_win32.zip
gettext-tools-dev_0.18.1.1-2_win32.zip
glib_2.28.1-1_win32.zip
glib-dev_2.28.1-1_win32.zip
libpng_1.4.3-1_win32.zip
libpng-dev_1.4.3-1_win32.zip
pango_1.28.3-1_win32.zip
pango-dev_1.28.3-1_win32.zip
pixman-dev_0.20.0-1_win32.zip
pkg-config_0.25-1_win32.zip
pkg-config-dev_0.25-1_win32.zip
zlib_1.2.5-2_win32.zip
zlib-dev_1.2.5-2_win32.zip


I also compiled Glade 3.10, but it seems that GTK+ 3.0 still have some problems in icons, so Glade is very hard to use. Let me know if you're still interested, so you can add it for the users of your projects to use :).

These builds of GTK+ and ATK are compatible with the old ones compiled by TML, though based on his blog he will no longer provide GTK+ binaries for Windows, that's why the official website still only shows GTK+ 2.22 (though 2.24 is available in the Gnome FTP site, with the link above, including GLib 2.28).

Here are the configuration of the packages, if you're interested (cross-compiled using MinGW of Ubuntu 11.04):

Code: Select all

GTK+:
PKG_CONFIG_PATH=/opt/mingw32/gtk-2/lib/pkgconfig \
lt_cv_deplibs_check_method='pass_all' \
CC='i586-mingw32msvc-gcc -mthreads' \
CPPFLAGS="-I/opt/mingw32/gtk-2/include" \
LDFLAGS="-L/opt/mingw32/gtk-2/lib \
-Wl,--enable-auto-image-base" \
LIBS=-lintl \
CFLAGS=-O2 \
./configure \
--with-included-immodules \
--enable-debug=yes \
--enable-explicit-deps=no \
--disable-gtk-doc \
--disable-static \
--prefix=/opt/mingw32/gtk-2 \
--host=i586-mingw32msvc \
--build=i686-linux

ATK:
PKG_CONFIG_PATH=/opt/mingw32/gtk-2/lib/pkgconfig \
lt_cv_deplibs_check_method='pass_all' \
CC='i586-mingw32msvc-gcc -mtune=pentium3 -mthreads' \
CPPFLAGS="-I/opt/mingw32/gtk-2/include" \
LDFLAGS="-L/opt/mingw32/gtk-2/lib \
-Wl,--enable-auto-image-base" \
CFLAGS=-O2 \
./configure --disable-gtk-doc \
--disable-static \
--prefix=/opt/mingw32/gtk-2 \
--host=i586-mingw32msvc \
--build=i686-linux

Glade:
PKG_CONFIG_PATH=/opt/mingw32/gtk-2/lib/pkgconfig \
lt_cv_deplibs_check_method='pass_all' \
CC='i586-mingw32msvc-gcc -mthreads' \
CPPFLAGS="-I/opt/mingw32/gtk-2/include" \
LDFLAGS="-L/opt/mingw32/gtk-2/lib \
-Wl,--enable-auto-image-base" \
CFLAGS=-O2 \
./autogen.sh \
--enable-debug=yes \
--enable-explicit-deps=no \
--disable-static \
--prefix=/opt/mingw32/gtk-2 \
--host=i586-mingw32msvc \
--build=i686-linux


Glade needs some patches:
https://bugzilla.gnome.org/show_bug.cgi?id=649743
https://bugzilla.gnome.org/show_bug.cgi?id=649745
https://bugzilla.gnome.org/show_bug.cgi?id=649749

Because of lt_cv_deplibs_check_method variable, you may not need this GTK+ patch:
https://bugzilla.gnome.org/show_bug.cgi?id=642214
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » May 19, 2011 18:20

Galeon wrote:TJF, if you're interested in GTK+ 3.0 binaries for Windows

Thanks for your offer!

I found GTK binaries for windows here

https://build.opensuse.org/package/show?package=mingw32-gtk3&project=windows%3Amingw%3Awin32

It's 3.0.6 actually.

I also have problems with icons at windows. It's not usable ATM. I guess that's why no binaries are available yet.

On LINUX it's much better. Under Ubuntu 11.04 the only problems are with libcanberry and appmenu installation (versions are mixed, it runs but sends warnings).
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » May 20, 2011 7:21

TJF wrote:
Galeon wrote:TJF, if you're interested in GTK+ 3.0 binaries for Windows

Thanks for your offer!

I found GTK binaries for windows here

https://build.opensuse.org/package/show?package=mingw32-gtk3&project=windows%3Amingw%3Awin32

It's 3.0.6 actually.


I have 3.0.9. The SVN might be better, there are lots of patches added from the last time, including my patch.

Still waiting for the Windows theme and those icon bug to be fixed though.

TJF wrote:I also have problems with icons at windows. It's not usable ATM. I guess that's why no binaries are available yet.


tml, one of the core maintainers of GTK+, and the one who packages GTK+ for Windows, decided that he will no longer package GTK+ for Windows:
http://tml-blog.blogspot.com/2011/03/gtk-on-windows-i-am-not-really-doing-it.html

The reason why there's no GTK+ for Windows in the official website. I even check that everyday :). Seems like we should depend to ourselves to get the latest in GTK+ development :(.

TJF wrote:On LINUX it's much better. Under Ubuntu 11.04 the only problems are with libcanberry and appmenu installation (versions are mixed, it runs but sends warnings).


We, Linux users, are the most lucky XD.
wallyg
Posts: 88
Joined: May 08, 2009 7:08
Location: Tucson Arizona

First try GTK+ 2.22.0 and GladeToBac3.0.2 loading error

Postby wallyg » Oct 01, 2011 17:42

I have a basic skeleton Glade XML file and generic files produced by GladeToBac files and get the following error.

C:\Program Files (x86)\FreeBASIC\fbc -g -s gui "SSS.bas"
C:\PROGRA~2\FREEBA~1\bin\win32\ld.exe: cannot find -liconv

I am sure I am missing some library but I cannot find any reference to anything with "conv" in it that is causing this error?
TJF
Posts: 3473
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: First try GTK+ 2.22.0 and GladeToBac3.0.2 loading error

Postby TJF » Oct 01, 2011 18:14

wallyg wrote:I am sure I am missing some library but I cannot find any reference to anything with "conv" in it that is causing this error?

Yes, you're rigtht

GTK uses libiconv to convert between different character encodings. See for details and download (windows):

BTW:

I made a small example (a calculator using Glade3 / GladeToBac / GTK / FB). You can find it here

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests