📄 gnome.txt
字号:
/* hellwrld.c by detour@metalshell.com
*
* The very basics on how to create a GUI in gnome.
* Basically creates a label with hello world caption
* and attaches a function to the delete_event signal.
*
* To compile this you will need to include all of the
* required libs which is alot. Gnome makes the process
* easier by having gnome-config that lists the needed
* libraries
*
* Example Makefile:
* --------------------------------------------
* CC=gcc
* CFLAGS := -Wall $(shell gnome-config --cflags gnomeui)
* LINK := $(CC) $(shell gnome-config --libs gnomeui)
* all: hellwrld
* hellwrld: hellwrld.o
* $(LINK) -o $@ $<
* hellwrld.o: hellwrld.c
* $(CC) $(CFLAGS) -c -o $@ $<
* --------------------------------------------
*
* http://www.metalshell.com/
*
*/
#include <gnome.h>
#define VERSION "1.0"
void hell_over(void) {
/* End it all */
gtk_main_quit();
}
int main(int argc, char *argv[]) {
GtkWidget *window, *label;
/* Initialize everything, required for every Gnome app */
gnome_init("hell_world", VERSION, argc, argv);
/* Create a new window with the caption 'Hello World' */
window = gnome_app_new("hell_world", "Hello World!");
/* For the signal 'delete_event' call the function hell_over */
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(hell_over), NULL);
/* Create the label */
label = gtk_label_new("Hello World");
/* Put the label in the window */
gnome_app_set_contents(GNOME_APP(window), label);
/* Show everything */
gtk_widget_show_all(window);
/* The main loop */
gtk_main();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -