자바스크립트를 이용하여 GNOME에서 창을 띄어보기


출처: YES! Gnome JS Bindings Documentation is now available! 

#!/usr/bin/gjs

//The previous line is a hash bang which tells how to run the script.
// Note that the script has to be executable (run in terminal in the right folder: chmod +x scriptname)
// Initialize GTK+
var Gtk = imports.gi.Gtk;
Gtk.init(null, 0);
// Create your window, name it, and connect the “click x to quit” function.
// The word “window” is a JavaScript keyword, so we have to
// call it something different.
var mywindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL});
mywindow.title = "Hello World!";
mywindow.connect("destroy", function(){Gtk.main_quit()});
// Add some text to your window
var label = new Gtk.Label({label: "Hello World"});
mywindow.add(label);
// Make the label and the window itself visible to the user
label.show();
mywindow.show();
// Let the user run the app
Gtk.main();


chmod +x helloworld.js

./helloworld.js


Hello World!



Buy me a coffeeBuy me a coffee

어제부터 GTK+ 3.0 Reference Manual을 주말마다 짬을 내어 올해안까지 번역해보자는 목표를 세워보았다.

이렇게 목표를 잡고 나서 간한단 GTK+ 프로그램을 C로 작성해보았다.
아래는 C소스코드입니다.

#include <gtk/gtk.h>

GtkWidget* build_label() {
    GtkWidget *label = gtk_label_new("Hello, World!");
    gtk_label_set_selectable(GTK_LABEL(label), FALSE);
    return label;
}

int main (int argc, char **argv)
{
    GtkWidget *win;

    gtk_init (&argc, &argv);

    win = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    gtk_container_add(GTK_CONTAINER(win), build_label());
    gtk_window_resize(GTK_WINDOW(win), 300, 200);

    g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);

    gtk_widget_show_all (win);

    gtk_main ();
   
    return 0;
}

소스코드를 컴파일 하는 방법은, GTK+3.0 라이브러리가 설치되어야 하며, 아래와 같은 명령어를 작성하여 누르면 컴파일이 됩니다. 실행파일을 열면 아래와 같은 화면이 나옵니다.

gcc `pkg-config --cflags gtk+-3.0`  -o gtkmain gtkmain.c  `pkg-config --libs gtk+-3.0`



조만간 재미있는 GTK+용 프로그램이 나오겠지?ㅎㅎ



Buy me a coffeeBuy me a coffee




GTK+ 3.2가 2011년 9월 25일(일)에 출시되었습니다.



GTK+ 3.2.0에서는 2가지 중요한 실험적인 기능이 포함되었습니다.

  1. HTML5을 사용하는 웹 브라우저 안에서 GTK+어플리케이션을 실행할수 있는 기능 (First, the ability to run Gtk+ applications inside a browser using HTML5.)
  2. Wayland display server를 지원(Second, initial support for the Wayland display server.)


GTK+ 3.2는 사용자가 바로 혜택을 누릴수 있는 수많은 소소한 기능을 소개합니다.

  • CSS Themeing 기능의 향상(CSS themeing support has been improved)
  • GtkFileChooser는 사용 할수 있도록 돌리었음. (GtkFileChooser has been overhauled)
  • GtkFontSelection 은 GtkFontChooser 위젯의 새로운 세트로 대체 되었음(GtkFontSelection has been replaced by a new set of GtkFontChooser widgets)
  • 여러 새로운 위젯들이 소개되었음(several new widgets have been introduced as well.)

GTK+3.2에서 HTML5의 지원은 여전히 실험적입니다. 이 것은 HTML5에 적합한 브라우저 안에서 계산기나 노트패드 어플리케이션류의 GTK+ 어플리케이션을 작동할수 있도록 허락을 해준다. 

아래는 Firefox 4.0안에서 GIMP를 실행하는 데모비디오입니다.


아래 동영상은 HTML5을 지원하는 Firefox4안에서 계산기와 Evince를 실행하는 동영상입니다.

Gtk+ broadway demo from Alexander Larsson on Vimeo.



또 다른 큰 새로운 것도 실험적인 것입니다. 알다시피 Wayland 자체는 매우 실험적인데, GTK+ 3.2 에서는 Wayland display server를 지원한다. 현재 많이 알려져 있는 X.org를 대신하여 미래에 많이 사용할 Wayland에 대해 GTK+가 미래를 위해 준비를 확실히 하고 있다.

QT또는 Wayland를 지원을 하는 중이기 때문에 두가지 오픈 소스 툴킷(GTK+, QT은 미래를 위한 준비를 하고 있다고 볼수 있습니다.



※ GTK+란? (What is GTK+)

GTK+는 그래픽 유저 인터페이스(GUI)를 만들기 위한 멀티 플랫폼 툴킷입니다. (아래서 부턴 알아서 번역을 바랍니다.)

GTK+ is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK+ is suitable for projects ranging from small one-off tools to complete application suites.

GTK+ has been designed from the ground up to support a range of languages, not only C/C++. Using GTK+ from languages such as Perl and Python (especially in combination with the Glade GUI builder) provides an effective method of rapid application development.

GTK+ is free software and part of the GNU Project. However, the licensing terms for GTK+, the GNU LGPL, allow it to be used by all developers, including those developing proprietary software, without any license fees or royalties. GTK+ is the only 100% free-of-cost open source industrial-strength GUI toolkit available today.

Since its origins as the toolkit for the GNU Image Manipulation Program (GIMP), GTK+ has been used in a wide range of software. Notably, GTK+ is the foundation of the GNOME desktop.


Buy me a coffeeBuy me a coffee

저의 지인이며 비밀 스터디의 주도권을 가지고 계신 ganadist님께서 안드로이드 빌드 툴을 GTK와 Python기반으로 개발하셨다고 합니다.

아래는 저의 컴퓨터에서 실행한 화면으로 아직 Android Source kit을 받지 않았기 때문에 설정화면이 이상하게 되었군요.


(제대로 동작하는 화면의 경우는 그분의 동의를 받지 못해서 올리지 못하고, 주말 쯤 제가직접 프로그램 돌리는 스크린샷을 올리겠습니다.)


소스는 https://github.com/ganadist/abuild 에서 받을 수 있습니다.

안드로이드(Android)를 처음 접하는 초보자들도 쉽게 빌드 할수 있도록 GTK기반으로 UI를 구성한 후, 작성하였다고 합니다.


이 프로그램의 요구사항은 GNOME 3.0 개발환경에 맞게 만들어졌기 때문에 GTK+-3.0 이상이 설치되어야 한다고 나와 있군요. (GTK+-2.0과 GTK+-3.0간 호환성이 없다보니..)


* Requirements
	- python 2.6 or higher
	- pygobject 2.90 or higher
	- gtk 3.0 or higher with gobject-introspection
	- vte 2.90 or higher with gobject-introspection


실행방법

git으로 소스트리(참고 - https://github.com/ganadist/abuild  )를 받은 후 ./abuild를 실행하면 됩니다. 단 안드로이드 커널 소스를 미리 받으셔야 합니다.


* How to run?
	- change directory to source
	- run ./abuild
	 . need to fix for deployment
	- click "Source Top" button and select android source directory
	- if source directory has valid contents, "Build", "Product",
	  "Variant" button will be enabled
	  . TIP: If you set TOP shell environment and that is android
	    source directory, it will be set as "Source Top" directory
	- select check buttons and press "Build" button


ps. 제대로 빌드하는 모습을 다음 일요일에 제대로 된 실행화면을 블로그로 업로드할 예정입니다.

Buy me a coffeeBuy me a coffee

Overview of GObjectIntrospection architecture

http://live.gnome.org/GObjectIntrospection/Architecture


GNOME3와 GTK3.0에서 도입된 GObjectIntrospection 구조.






Buy me a coffeeBuy me a coffee

+ Recent posts