Commit a473b593 authored by Richard Hughes's avatar Richard Hughes
Browse files

Remove links to code that no longer exists to fix make dist

parent 8c5dca4c
......@@ -50,14 +50,10 @@ EXTRA_DIST += \
examples/buttons/info.xpm \
examples/calendar/Makefile \
examples/calendar/calendar.c \
examples/clist/Makefile \
examples/clist/clist.c \
examples/entry/Makefile \
examples/entry/entry.c \
examples/eventbox/Makefile \
examples/eventbox/eventbox.c \
examples/filesel/Makefile \
examples/filesel/filesel.c \
examples/gtkdial/Makefile \
examples/gtkdial/dial_test.c \
examples/gtkdial/gtkdial.c \
......@@ -68,11 +64,8 @@ EXTRA_DIST += \
examples/helloworld2/helloworld2.c \
examples/label/Makefile \
examples/label/label.c \
examples/list/Makefile \
examples/list/list.c \
examples/menu/Makefile \
examples/menu/menu.c \
examples/menu/itemfactory.c \
examples/notebook/Makefile \
examples/notebook/notebook.c \
examples/packbox/Makefile \
......@@ -102,14 +95,10 @@ EXTRA_DIST += \
examples/statusbar/statusbar.c \
examples/table/Makefile \
examples/table/table.c \
examples/text/Makefile \
examples/text/text.c \
examples/tictactoe/Makefile \
examples/tictactoe/tictactoe.c \
examples/tictactoe/tictactoe.h \
examples/tictactoe/ttt_test.c \
examples/tree/Makefile \
examples/tree/tree.c \
examples/wheelbarrow/Makefile \
examples/wheelbarrow/wheelbarrow.c \
examples/fixed/fixed.c \
......
......@@ -5,17 +5,14 @@ SUBDIRS = arrow \
buttonbox \
buttons \
calendar \
clist \
entry \
eventbox \
filesel \
fixed \
frame \
gtkdial \
helloworld \
helloworld2 \
label \
list \
menu \
notebook \
packbox \
......@@ -32,9 +29,7 @@ SUBDIRS = arrow \
spinbutton \
statusbar \
table \
text \
tictactoe \
tree \
wheelbarrow
all:
......
CC = gcc
CFLAGS = -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
clist: clist.c
$(CC) clist.c -o clist `pkg-config gtk+-2.0 --cflags --libs`
clean:
rm -f *.o clist
#include "config.h"
#include <gtk/gtk.h>
/* User clicked the "Add List" button. */
void button_add_clicked( gpointer data )
{
int indx;
/* Something silly to add to the list. 4 rows of 2 columns each */
gchar *drink[4][2] = { { "Milk", "3 Oz" },
{ "Water", "6 l" },
{ "Carrots", "2" },
{ "Snakes", "55" } };
/* Here we do the actual adding of the text. It's done once for
* each row.
*/
for (indx = 0; indx < 4; indx++)
gtk_clist_append ((GtkCList *)data, drink[indx]);
return;
}
/* User clicked the "Clear List" button. */
void button_clear_clicked( gpointer data )
{
/* Clear the list using gtk_clist_clear. This is much faster than
* calling gtk_clist_remove once for each row.
*/
gtk_clist_clear ((GtkCList *)data);
return;
}
/* The user clicked the "Hide/Show titles" button. */
void button_hide_show_clicked( gpointer data )
{
/* Just a flag to remember the status. 0 = currently visible */
static short int flag = 0;
if (flag == 0)
{
/* Hide the titles and set the flag to 1 */
gtk_clist_column_titles_hide ((GtkCList *)data);
flag++;
}
else
{
/* Show the titles and reset flag to 0 */
gtk_clist_column_titles_show ((GtkCList *)data);
flag--;
}
return;
}
/* If we come here, then the user has selected a row in the list. */
void selection_made( GtkWidget *clist,
gint row,
gint column,
GdkEventButton *event,
gpointer data )
{
gchar *text;
/* Get the text that is stored in the selected row and column
* which was clicked in. We will receive it as a pointer in the
* argument text.
*/
gtk_clist_get_text (GTK_CLIST (clist), row, column, &text);
/* Just prints some information about the selected row */
g_print ("You selected row %d. More specifically you clicked in "
"column %d, and the text in this cell is %s\n\n",
row, column, text);
return;
}
int main( int argc,
gchar *argv[] )
{
GtkWidget *window;
GtkWidget *vbox, *hbox;
GtkWidget *scrolled_window, *clist;
GtkWidget *button_add, *button_clear, *button_hide_show;
gchar *titles[2] = { "Ingredients", "Amount" };
gtk_init(&argc, &argv);
window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150);
gtk_window_set_title (GTK_WINDOW (window), "GtkCList Example");
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
vbox=gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
/* Create a scrolled window to pack the CList widget into */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
/* Create the CList. For this example we use 2 columns */
clist = gtk_clist_new_with_titles (2, titles);
/* When a selection is made, we want to know about it. The callback
* used is selection_made, and its code can be found further down */
g_signal_connect (G_OBJECT (clist), "select_row",
G_CALLBACK (selection_made),
NULL);
/* It isn't necessary to shadow the border, but it looks nice :) */
gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_OUT);
/* What however is important, is that we set the column widths as
* they will never be right otherwise. Note that the columns are
* numbered from 0 and up (to 1 in this case).
*/
gtk_clist_set_column_width (GTK_CLIST (clist), 0, 150);
/* Add the CList widget to the vertical box and show it. */
gtk_container_add (GTK_CONTAINER (scrolled_window), clist);
gtk_widget_show (clist);
/* Create the buttons and add them to the window. See the button
* tutorial for more examples and comments on this.
*/
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
gtk_widget_show (hbox);
button_add = gtk_button_new_with_label ("Add List");
button_clear = gtk_button_new_with_label ("Clear List");
button_hide_show = gtk_button_new_with_label ("Hide/Show titles");
gtk_box_pack_start (GTK_BOX (hbox), button_add, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), button_clear, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), button_hide_show, TRUE, TRUE, 0);
/* Connect our callbacks to the three buttons */
g_signal_connect_swapped (G_OBJECT (button_add), "clicked",
G_CALLBACK (button_add_clicked),
clist);
g_signal_connect_swapped (G_OBJECT (button_clear), "clicked",
G_CALLBACK (button_clear_clicked),
clist);
g_signal_connect_swapped (G_OBJECT (button_hide_show), "clicked",
G_CALLBACK (button_hide_show_clicked),
clist);
gtk_widget_show (button_add);
gtk_widget_show (button_clear);
gtk_widget_show (button_hide_show);
/* The interface is completely set up so we show the window and
* enter the gtk_main loop.
*/
gtk_widget_show (window);
gtk_main();
return 0;
}
CC = gcc
CFLAGS = -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
filesel: filesel.c
$(CC) filesel.c -o filesel $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
clean:
rm -f *.o filesel
#include <gtk/gtk.h>
/* Get the selected filename and print it to the console */
static void file_ok_sel( GtkWidget *w,
GtkFileSelection *fs )
{
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
}
int main( int argc,
char *argv[] )
{
GtkWidget *filew;
gtk_init (&argc, &argv);
/* Create a new file selection widget */
filew = gtk_file_selection_new ("File selection");
g_signal_connect (G_OBJECT (filew), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Connect the ok_button to file_ok_sel function */
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
"clicked", G_CALLBACK (file_ok_sel), (gpointer) filew);
/* Connect the cancel_button to destroy the widget */
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
"clicked", G_CALLBACK (gtk_widget_destroy),
G_OBJECT (filew));
/* Lets set the filename, as if this were a save dialog, and we are giving
a default filename */
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew),
"penguin.png");
gtk_widget_show (filew);
gtk_main ();
return 0;
}
CC = gcc
#CFLAGS = -Wall \
# -DG_DISABLE_DEPRECATED \
# -DGDK_DISABLE_DEPRECATED \
# -DGDK_PIXBUF_DISABLE_DEPRECATED \
# -DGTK_DISABLE_DEPRECATED
CFLAGS =
list: list.c
$(CC) list.c -o list $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
clean:
rm -f *.o list
#include "config.h"
#include <gtk/gtk.h>
#include <stdio.h>
/* This is our data identification string to store
* data in list items
*/
const gchar *list_item_data_key="list_item_data";
/* prototypes for signal handler that we are going to connect
* to the List widget
*/
static void sigh_print_selection( GtkWidget *gtklist,
gpointer func_data);
static void sigh_button_event( GtkWidget *gtklist,
GdkEventButton *event,
GtkWidget *frame );
/* Main function to set up the user interface */
gint main( int argc,
gchar *argv[] )
{
GtkWidget *separator;
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *scrolled_window;
GtkWidget *frame;
GtkWidget *gtklist;
GtkWidget *button;
GtkWidget *list_item;
GList *dlist;
guint i;
gchar buffer[64];
/* Initialize GTK (and subsequently GDK) */
gtk_init (&argc, &argv);
/* Create a window to put all the widgets in
* connect gtk_main_quit() to the "destroy" event of
* the window to handle window manager close-window-events
*/
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GtkList Example");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
/* Inside the window we need a box to arrange the widgets
* vertically */
vbox=gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
/* This is the scrolled window to put the List widget inside */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_size_request (scrolled_window, 250, 150);
gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
gtk_widget_show (scrolled_window);
/* Create thekList widget.
* Connect the sigh_print_selection() signal handler
* function to the "selection_changed" signal of the List
* to print out the selected items each time the selection
* has changed */
gtklist=gtk_list_new ();
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
gtklist);
gtk_widget_show (gtklist);
g_signal_connect (gtklist, "selection-changed",
G_CALLBACK (sigh_print_selection),
NULL);
/* We create a "Prison" to put a list item in ;) */
frame=gtk_frame_new ("Prison");
gtk_widget_set_size_request (frame, 200, 50);
gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_widget_show (frame);
/* Connect the sigh_button_event() signal handler to the List
* which will handle the "arresting" of list items
*/
g_signal_connect (gtklist, "button-release-event",
G_CALLBACK (sigh_button_event),
frame);
/* Create a separator */
separator=gtk_hseparator_new ();
gtk_container_add (GTK_CONTAINER (vbox), separator);
gtk_widget_show (separator);
/* Finally create a button and connect its "clicked" signal
* to the destruction of the window */
button=gtk_button_new_with_label ("Close");
gtk_container_add (GTK_CONTAINER (vbox), button);
gtk_widget_show (button);
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
/* Now we create 5 list items, each having its own
* label and add them to the List using gtk_container_add()
* Also we query the text string from the label and
* associate it with the list_item_data_key for each list item
*/
for (i = 0; i < 5; i++) {
GtkWidget *label;
const gchar *string;
sprintf(buffer, "ListItemContainer with Label #%d", i);
label=gtk_label_new (buffer);
list_item=gtk_list_item_new ();
gtk_container_add (GTK_CONTAINER (list_item), label);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (gtklist), list_item);
gtk_widget_show (list_item);
string = gtk_label_get_text (GTK_LABEL (label));
g_object_set_data (G_OBJECT (list_item), list_item_data_key, string);
}
/* Here, we are creating another 5 labels, this time
* we use gtk_list_item_new_with_label() for the creation
* we can't query the text string from the label because
* we don't have the labels pointer and therefore
* we just associate the list_item_data_key of each
* list item with the same text string.
* For adding of the list items we put them all into a doubly
* linked list (GList), and then add them by a single call to
* gtk_list_append_items().
* Because we use g_list_prepend() to put the items into the
* doubly linked list, their order will be descending (instead
* of ascending when using g_list_append())
*/
dlist = NULL;
for (; i < 10; i++) {
sprintf(buffer, "List Item with Label %d", i);
list_item = gtk_list_item_new_with_label (buffer);
dlist = g_list_prepend (dlist, list_item);
gtk_widget_show (list_item);
g_object_set_data (G_OBJECT (list_item),
list_item_data_key,
"ListItem with integrated Label");
}
gtk_list_append_items (GTK_LIST (gtklist), dlist);
/* Finally we want to see the window, don't we? ;) */
gtk_widget_show (window);
/* Fire up the main event loop of gtk */
gtk_main ();
/* We get here after gtk_main_quit() has been called which
* happens if the main window gets destroyed
*/
return 0;
}
/* This is the signal handler that got connected to button
* press/release events of the List
*/
void sigh_button_event( GtkWidget *gtklist,
GdkEventButton *event,
GtkWidget *frame )
{
/* We only do something if the third (rightmost mouse button
* was released
*/
if (event->type == GDK_BUTTON_RELEASE &&
event->button == 3) {
GList *dlist, *free_list;
GtkWidget *new_prisoner;
/* Fetch the currently selected list item which
* will be our next prisoner ;)
*/
dlist = GTK_LIST (gtklist)->selection;
if (dlist)
new_prisoner = GTK_WIDGET (dlist->data);
else
new_prisoner = NULL;
/* Look for already imprisoned list items, we
* will put them back into the list.
* Remember to free the doubly linked list that
* gtk_container_get_children() returns
*/
dlist = gtk_container_get_children (GTK_CONTAINER (frame));
free_list = dlist;
while (dlist) {
GtkWidget *list_item;
list_item = dlist->data;
gtk_widget_reparent (list_item, gtklist);
dlist = dlist->next;
}
g_list_free (free_list);
/* If we have a new prisoner, remove him from the
* List and put him into the frame "Prison".
* We need to unselect the item first.
*/
if (new_prisoner) {
GList static_dlist;
static_dlist.data = new_prisoner;
static_dlist.next = NULL;
static_dlist.prev = NULL;
gtk_list_unselect_child (GTK_LIST (gtklist),
new_prisoner);
gtk_widget_reparent (new_prisoner, frame);
}
}
}
/* This is the signal handler that gets called if List
* emits the "selection_changed" signal
*/
void sigh_print_selection( GtkWidget *gtklist,
gpointer func_data )
{
GList *dlist;
/* Fetch the doubly linked list of selected items
* of the List, remember to treat this as read-only!
*/
dlist = GTK_LIST (gtklist)->selection;
/* If there are no selected items there is nothing more
* to do than just telling the user so
*/
if (!dlist) {
g_print ("Selection cleared\n");
return;
}
/* Ok, we got a selection and so we print it
*/
g_print ("The selection is a ");
/* Get the list item from the doubly linked list
* and then query the data associated with list_item_data_key.
* We then just print it */
while (dlist) {
const gchar *item_data_string;
item_data_string = g_object_get_data (G_OBJECT (dlist->data),
list_item_data_key);
g_print("%s ", item_data_string);
dlist = dlist->next;
}
g_print ("\n");
}
......@@ -71,16 +71,12 @@ gtk/gtkcheckbutton.c
gtk/gtkcheckmenuitem.c
gtk/gtkclipboard-quartz.c
gtk/gtkclipboard.c
gtk/gtkclist.c
gtk/gtkcolorbutton.c
gtk/gtkcolorsel.c
gtk/gtkcolorseldialog.c
gtk/gtkcombo.c
gtk/gtkcombobox.c
gtk/gtkcomboboxentry.c
gtk/gtkcontainer.c
gtk/gtkctree.c
gtk/gtkcurve.c
gtk/gtkcustompaperunixdialog.c
gtk/gtkdialog.c
gtk/gtkdnd-quartz.c
......@@ -102,14 +98,12 @@ gtk/gtkfilechoosersettings.c
gtk/gtkfilechooserutils.c
gtk/gtkfilechooserwidget.c
gtk/gtkfilefilter.c
gtk/gtkfilesel.c
gtk/gtkfilesystem.c
gtk/gtkfilesystemmodel.c
gtk/gtkfixed.c
gtk/gtkfontbutton.c
gtk/gtkfontsel.c
gtk/gtkframe.c
gtk/gtkgamma.c
gtk/gtkgc.c
gtk/gtkhandlebox.c
gtk/gtkhbbox.c
......@@ -130,15 +124,11 @@ gtk/gtkimcontextsimple.c
gtk/gtkimmodule.c
gtk/gtkimmulticontext.c
gtk/gtkinfobar.c
gtk/gtkinputdialog.c
gtk/gtkinvisible.c