









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Topics covered in this lecture handout are: Programming, Gnome, GTK, KDE, Features, Data types, Dealing.
Typology: Study notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!










#include <gnome.h>
int main(int argc, char argv[]) { / declare a window object */ GtkWidget *app;
/* initialize and load functions
/* create a top level window, which has
/* make this window visible */ gtk_widget_show(app);
/* controls in gtk_main() can is loaded,
Use the following command to compile:
gcc win1.c ‘gnome-config --cflags --libs gnomeui‘ -o win
#include <gnome.h>
/* define the event of button click,
GTK_SIGNAL_FUNC(button_clicked), "button is clicked\n"); /* put the button onto the object of app */ gnome_app_set_contents(GNOME_APP(app), button); gtk_widget_show_all(app); gtk_main (); return(0); }
#include <gnome.h>
static void enter_pressed(GtkWidget *button, gpointer data) { GtkWidget *text_entry = data; char *string = gtk_entry_get_text(GTK_ENTRY(text_entry)); g_print(string); }
int main(int argc, char *argv[]) { GtkWidget *app; GtkWidget *text_entry; GtkWidget *label; GtkWidget *hbox;
gnome_init("example","0.1", argc, argv);
/create a top level window with an title/ app=gnome_app_new("example","Entry widget");
/* give the window a boarder / gtk_container_border_width(GTK_CONTAINER(app), 5); / create a container, not each object occupy
/* create a label with text on*/ label= gtk_label_new("Password:");
/* event of inputing some text / gtk_signal_connect(GTK_OBJECT(text_entry), "activate", GTK_SIGNAL_FUNC(enter_pressed), text_entry); / place the container to the app object */ gnome_app_set_contents(GNOME_APP(app), hbox);
/* show all the widgets on the app */ gtk_widget_show_all(app); gtk_main(); return 0; }
#include <gnome.h>
int main( int argc, char *argv[] ) {
GtkWidget *app; GtkWidget *button1, *button2; GtkWidget *radio1, *radio2; GtkWidget *radio3, *radio4; GtkWidget *vbox1, *vbox2; GtkWidget hbox; /empty list */ GSList *group = NULL;
gnome_init("example","0.1", argc, argv);
app=gnome_app_new("example","Music choices");
/* give the window a boarder */ gtk_container_border_width(GTK_CONTAINER(app), 20);
/* create containers */ vbox1 = gtk_vbox_new(FALSE, 0); vbox2 = gtk_vbox_new(FALSE, 0); hbox = gtk_hbox_new(FALSE, 0);
/create button1 as check button with label/
/* place the radio buttons onto the vbox2 */ gtk_box_pack_start(GTK_BOX(vbox2), radio1, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), radio2, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), radio3, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), radio4, FALSE, FALSE, 0);
/* place the vbox1 and vbox2 onto the hbox */ gtk_container_add(GTK_CONTAINER(hbox),vbox1); gtk_container_add(GTK_CONTAINER(hbox),vbox2);
/event of quiting the window/ gtk_signal_connect(GTK_OBJECT(app), "delete_event", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); /* place the hbox onto the top level window */ gnome_app_set_contents(GNOME_APP(app), hbox);
/* show all the widgets in the window*/
gtk_widget_show_all(app); gtk_main (); return(0); }
#include <gnome.h>
static void callback(GtkWidget button, gpointer data) { g_print("Item selected"); } / create the file item list */ GnomeUIInfo file_tree[]= { GNOMEUIINFO_MENU_NEW_ITEM("New", "create a new file", callback, NULL), GNOMEUIINFO_MENU_EXIT_ITEM(gtk_main_quit, NULL), GNOMEUIINFO_END
GtkWidget *app;
gnome_init("example", "0.1", argc, argv);
/create the top level window with title/ app=gnome_app_new("example", "Simple Menu and Tool bar");
/*create the menu on the top window / gnome_app_create_menus(GNOME_APP(app), menubar); /create the toolbar on the top window / gnome_app_create_toolbar(GNOME_APP(app), toolbar); /show all the widget on the top window */ gtk_widget_show_all(app); gtk_main(); return 0; }