cropper

changeset 0:ca9155129253

initial commit code base: gthumb_crop.glade and generated code from it with glade
author meillo@marmaro.de
date Tue, 04 Dec 2007 16:48:51 +0100
parents
children 80535e4deaa4
files .hgignore Makefile callbacks.c callbacks.h interface.c interface.h main.c support.c support.h
diffstat 9 files changed, 971 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Tue Dec 04 16:48:51 2007 +0100
     1.3 @@ -0,0 +1,5 @@
     1.4 +syntax: glob
     1.5 +*~
     1.6 +*.swp
     1.7 +*.o
     1.8 +cropper
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Makefile	Tue Dec 04 16:48:51 2007 +0100
     2.3 @@ -0,0 +1,20 @@
     2.4 +# basic GTK+ app makefile
     2.5 +SOURCES = interface.c callbacks.c support.c main.c interface.h callbacks.h support.h
     2.6 +OBJS    = ${SOURCES:.c=.o}
     2.7 +#CFLAGS  = `gtk-config --cflags`
     2.8 +#LDADD   = `gtk-config --libs --cflags`
     2.9 +datadir = /usr/local/share
    2.10 +CFLAGS  = `pkg-config --cflags gtk+-2.0`
    2.11 +LDADD   = `pkg-config --libs --cflags gtk+-2.0`
    2.12 +CC      = gcc
    2.13 +PACKAGE = cropper
    2.14 +
    2.15 +
    2.16 +
    2.17 +all : ${OBJS}
    2.18 +	${CC} -o ${PACKAGE} ${OBJS} ${LDADD}
    2.19 +
    2.20 +.c.o:
    2.21 +	${CC} ${CFLAGS} -c $<
    2.22 +
    2.23 +# end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/callbacks.c	Tue Dec 04 16:48:51 2007 +0100
     3.3 @@ -0,0 +1,127 @@
     3.4 +#ifdef HAVE_CONFIG_H
     3.5 +#  include <config.h>
     3.6 +#endif
     3.7 +
     3.8 +#include <gtk/gtk.h>
     3.9 +
    3.10 +#include "callbacks.h"
    3.11 +#include "interface.h"
    3.12 +#include "support.h"
    3.13 +
    3.14 +
    3.15 +void
    3.16 +on_none1_activate                      (GtkMenuItem     *menuitem,
    3.17 +                                        gpointer         user_data)
    3.18 +{
    3.19 +
    3.20 +}
    3.21 +
    3.22 +
    3.23 +void
    3.24 +on_square1_activate                    (GtkMenuItem     *menuitem,
    3.25 +                                        gpointer         user_data)
    3.26 +{
    3.27 +
    3.28 +}
    3.29 +
    3.30 +
    3.31 +void
    3.32 +on_4x3__book__dvd_1_activate           (GtkMenuItem     *menuitem,
    3.33 +                                        gpointer         user_data)
    3.34 +{
    3.35 +
    3.36 +}
    3.37 +
    3.38 +
    3.39 +void
    3.40 +on_4x6__postcard_1_activate            (GtkMenuItem     *menuitem,
    3.41 +                                        gpointer         user_data)
    3.42 +{
    3.43 +
    3.44 +}
    3.45 +
    3.46 +
    3.47 +void
    3.48 +on_5x1_activate                        (GtkMenuItem     *menuitem,
    3.49 +                                        gpointer         user_data)
    3.50 +{
    3.51 +
    3.52 +}
    3.53 +
    3.54 +
    3.55 +void
    3.56 +on_8x1_activate                        (GtkMenuItem     *menuitem,
    3.57 +                                        gpointer         user_data)
    3.58 +{
    3.59 +
    3.60 +}
    3.61 +
    3.62 +
    3.63 +void
    3.64 +on_custom1_activate                    (GtkMenuItem     *menuitem,
    3.65 +                                        gpointer         user_data)
    3.66 +{
    3.67 +
    3.68 +}
    3.69 +
    3.70 +
    3.71 +void
    3.72 +on_ratio_w_spinbutton_value_changed    (GtkSpinButton   *spinbutton,
    3.73 +                                        gpointer         user_data)
    3.74 +{
    3.75 +
    3.76 +}
    3.77 +
    3.78 +
    3.79 +void
    3.80 +on_ratio_w_spinbutton_change_value     (GtkSpinButton   *spinbutton,
    3.81 +                                        GtkScrollType    scroll,
    3.82 +                                        gpointer         user_data)
    3.83 +{
    3.84 +
    3.85 +}
    3.86 +
    3.87 +
    3.88 +void
    3.89 +on_ratio_swap_button_clicked           (GtkButton       *button,
    3.90 +                                        gpointer         user_data)
    3.91 +{
    3.92 +
    3.93 +}
    3.94 +
    3.95 +
    3.96 +void
    3.97 +on_ratio_h_spinbutton_change_value     (GtkSpinButton   *spinbutton,
    3.98 +                                        GtkScrollType    scroll,
    3.99 +                                        gpointer         user_data)
   3.100 +{
   3.101 +
   3.102 +}
   3.103 +
   3.104 +
   3.105 +void
   3.106 +on_ratio_h_spinbutton_value_changed    (GtkSpinButton   *spinbutton,
   3.107 +                                        gpointer         user_data)
   3.108 +{
   3.109 +
   3.110 +}
   3.111 +
   3.112 +
   3.113 +gboolean
   3.114 +on_cropper_window_delete_event         (GtkWidget       *widget,
   3.115 +                                        GdkEvent        *event,
   3.116 +                                        gpointer         user_data)
   3.117 +{
   3.118 +
   3.119 +	g_print ("delete event occurred\n");
   3.120 +  return FALSE;
   3.121 +}
   3.122 +
   3.123 +
   3.124 +void
   3.125 +on_cropper_window_destroy              (GtkObject       *object,
   3.126 +                                        gpointer         user_data)
   3.127 +{
   3.128 +	gtk_main_quit();
   3.129 +}
   3.130 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/callbacks.h	Tue Dec 04 16:48:51 2007 +0100
     4.3 @@ -0,0 +1,65 @@
     4.4 +#include <gtk/gtk.h>
     4.5 +
     4.6 +
     4.7 +void
     4.8 +on_none1_activate                      (GtkMenuItem     *menuitem,
     4.9 +                                        gpointer         user_data);
    4.10 +
    4.11 +void
    4.12 +on_square1_activate                    (GtkMenuItem     *menuitem,
    4.13 +                                        gpointer         user_data);
    4.14 +
    4.15 +void
    4.16 +on_4x3__book__dvd_1_activate           (GtkMenuItem     *menuitem,
    4.17 +                                        gpointer         user_data);
    4.18 +
    4.19 +void
    4.20 +on_4x6__postcard_1_activate            (GtkMenuItem     *menuitem,
    4.21 +                                        gpointer         user_data);
    4.22 +
    4.23 +void
    4.24 +on_5x1_activate                        (GtkMenuItem     *menuitem,
    4.25 +                                        gpointer         user_data);
    4.26 +
    4.27 +void
    4.28 +on_8x1_activate                        (GtkMenuItem     *menuitem,
    4.29 +                                        gpointer         user_data);
    4.30 +
    4.31 +void
    4.32 +on_custom1_activate                    (GtkMenuItem     *menuitem,
    4.33 +                                        gpointer         user_data);
    4.34 +
    4.35 +void
    4.36 +on_cropper_window_destroy              (GtkObject       *object,
    4.37 +                                        gpointer         user_data);
    4.38 +
    4.39 +void
    4.40 +on_ratio_w_spinbutton_value_changed    (GtkSpinButton   *spinbutton,
    4.41 +                                        gpointer         user_data);
    4.42 +
    4.43 +void
    4.44 +on_ratio_w_spinbutton_change_value     (GtkSpinButton   *spinbutton,
    4.45 +                                        GtkScrollType    scroll,
    4.46 +                                        gpointer         user_data);
    4.47 +
    4.48 +void
    4.49 +on_ratio_swap_button_clicked           (GtkButton       *button,
    4.50 +                                        gpointer         user_data);
    4.51 +
    4.52 +void
    4.53 +on_ratio_h_spinbutton_change_value     (GtkSpinButton   *spinbutton,
    4.54 +                                        GtkScrollType    scroll,
    4.55 +                                        gpointer         user_data);
    4.56 +
    4.57 +void
    4.58 +on_ratio_h_spinbutton_value_changed    (GtkSpinButton   *spinbutton,
    4.59 +                                        gpointer         user_data);
    4.60 +
    4.61 +gboolean
    4.62 +on_cropper_window_delete_event         (GtkWidget       *widget,
    4.63 +                                        GdkEvent        *event,
    4.64 +                                        gpointer         user_data);
    4.65 +
    4.66 +void
    4.67 +on_cropper_window_destroy              (GtkObject       *object,
    4.68 +                                        gpointer         user_data);
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/interface.c	Tue Dec 04 16:48:51 2007 +0100
     5.3 @@ -0,0 +1,524 @@
     5.4 +/*
     5.5 + * DO NOT EDIT THIS FILE - it is generated by Glade.
     5.6 + */
     5.7 +
     5.8 +#ifdef HAVE_CONFIG_H
     5.9 +#  include <config.h>
    5.10 +#endif
    5.11 +
    5.12 +#include <sys/types.h>
    5.13 +#include <sys/stat.h>
    5.14 +#include <unistd.h>
    5.15 +#include <string.h>
    5.16 +#include <stdio.h>
    5.17 +
    5.18 +#include <gdk/gdkkeysyms.h>
    5.19 +#include <gtk/gtk.h>
    5.20 +
    5.21 +#include "callbacks.h"
    5.22 +#include "interface.h"
    5.23 +#include "support.h"
    5.24 +
    5.25 +#define GLADE_HOOKUP_OBJECT(component,widget,name) \
    5.26 +  g_object_set_data_full (G_OBJECT (component), name, \
    5.27 +    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
    5.28 +
    5.29 +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
    5.30 +  g_object_set_data (G_OBJECT (component), name, widget)
    5.31 +
    5.32 +GtkWidget*
    5.33 +create_cropper_window (void)
    5.34 +{
    5.35 +  GtkWidget *cropper_window;
    5.36 +  GtkWidget *dialog_vbox1;
    5.37 +  GtkWidget *hbox1;
    5.38 +  GtkWidget *vbox1;
    5.39 +  GtkWidget *vbox2;
    5.40 +  GtkWidget *label1;
    5.41 +  GtkWidget *hbox2;
    5.42 +  GtkWidget *label2;
    5.43 +  GtkWidget *table2;
    5.44 +  GtkWidget *label3;
    5.45 +  GtkWidget *label5;
    5.46 +  GtkWidget *label4;
    5.47 +  GtkWidget *label6;
    5.48 +  GtkWidget *hbox5;
    5.49 +  GtkObject *crop_x_spinbutton_adj;
    5.50 +  GtkWidget *crop_x_spinbutton;
    5.51 +  GtkWidget *hbox6;
    5.52 +  GtkObject *crop_y_spinbutton_adj;
    5.53 +  GtkWidget *crop_y_spinbutton;
    5.54 +  GtkWidget *hbox7;
    5.55 +  GtkObject *crop_width_spinbutton_adj;
    5.56 +  GtkWidget *crop_width_spinbutton;
    5.57 +  GtkWidget *hbox8;
    5.58 +  GtkObject *crop_height_spinbutton_adj;
    5.59 +  GtkWidget *crop_height_spinbutton;
    5.60 +  GtkWidget *vbox4;
    5.61 +  GtkWidget *label7;
    5.62 +  GtkWidget *hbox3;
    5.63 +  GtkWidget *label8;
    5.64 +  GtkWidget *table3;
    5.65 +  GtkWidget *hbox10;
    5.66 +  GtkWidget *custom_ratio_box;
    5.67 +  GtkObject *ratio_w_spinbutton_adj;
    5.68 +  GtkWidget *ratio_w_spinbutton;
    5.69 +  GtkWidget *ratio_swap_button;
    5.70 +  GtkWidget *eventbox1;
    5.71 +  GtkWidget *ratio_swap_image;
    5.72 +  GtkObject *ratio_h_spinbutton_adj;
    5.73 +  GtkWidget *ratio_h_spinbutton;
    5.74 +  GtkWidget *ratio_optionmenu;
    5.75 +  GtkWidget *menu1;
    5.76 +  GtkWidget *none1;
    5.77 +  GtkWidget *square1;
    5.78 +  GtkWidget *_4x3__book__dvd_1;
    5.79 +  GtkWidget *_4x6__postcard_1;
    5.80 +  GtkWidget *_5x1;
    5.81 +  GtkWidget *_8x1;
    5.82 +  GtkWidget *custom1;
    5.83 +  GtkWidget *vbox5;
    5.84 +  GtkWidget *frame1;
    5.85 +  GtkWidget *vbox7;
    5.86 +  GtkWidget *nav_container;
    5.87 +  GtkWidget *hbox16;
    5.88 +  GtkWidget *hbox17;
    5.89 +  GtkWidget *crop_zoom_in_button;
    5.90 +  GtkWidget *image2;
    5.91 +  GtkWidget *crop_zoom_out_button;
    5.92 +  GtkWidget *image4;
    5.93 +  GtkWidget *crop_zoom_100_button;
    5.94 +  GtkWidget *image3;
    5.95 +  GtkWidget *crop_zoom_fit_button;
    5.96 +  GtkWidget *image1;
    5.97 +
    5.98 +  cropper_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    5.99 +  gtk_widget_set_name (cropper_window, "cropper_window");
   5.100 +  gtk_container_set_border_width (GTK_CONTAINER (cropper_window), 6);
   5.101 +  gtk_window_set_title (GTK_WINDOW (cropper_window), "Cropper");
   5.102 +
   5.103 +  dialog_vbox1 = gtk_vbox_new (FALSE, 6);
   5.104 +  gtk_widget_set_name (dialog_vbox1, "dialog_vbox1");
   5.105 +  gtk_widget_show (dialog_vbox1);
   5.106 +  gtk_container_add (GTK_CONTAINER (cropper_window), dialog_vbox1);
   5.107 +
   5.108 +  hbox1 = gtk_hbox_new (FALSE, 12);
   5.109 +  gtk_widget_set_name (hbox1, "hbox1");
   5.110 +  gtk_widget_show (hbox1);
   5.111 +  gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0);
   5.112 +  gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);
   5.113 +
   5.114 +  vbox1 = gtk_vbox_new (FALSE, 12);
   5.115 +  gtk_widget_set_name (vbox1, "vbox1");
   5.116 +  gtk_widget_show (vbox1);
   5.117 +  gtk_box_pack_start (GTK_BOX (hbox1), vbox1, FALSE, TRUE, 0);
   5.118 +
   5.119 +  vbox2 = gtk_vbox_new (FALSE, 6);
   5.120 +  gtk_widget_set_name (vbox2, "vbox2");
   5.121 +  gtk_widget_show (vbox2);
   5.122 +  gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
   5.123 +
   5.124 +  label1 = gtk_label_new ("<b>Selection</b>");
   5.125 +  gtk_widget_set_name (label1, "label1");
   5.126 +  gtk_widget_show (label1);
   5.127 +  gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0);
   5.128 +  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
   5.129 +  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
   5.130 +
   5.131 +  hbox2 = gtk_hbox_new (FALSE, 0);
   5.132 +  gtk_widget_set_name (hbox2, "hbox2");
   5.133 +  gtk_widget_show (hbox2);
   5.134 +  gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
   5.135 +
   5.136 +  label2 = gtk_label_new ("    ");
   5.137 +  gtk_widget_set_name (label2, "label2");
   5.138 +  gtk_widget_show (label2);
   5.139 +  gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0);
   5.140 +
   5.141 +  table2 = gtk_table_new (4, 2, FALSE);
   5.142 +  gtk_widget_set_name (table2, "table2");
   5.143 +  gtk_widget_show (table2);
   5.144 +  gtk_box_pack_start (GTK_BOX (hbox2), table2, TRUE, TRUE, 0);
   5.145 +  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
   5.146 +  gtk_table_set_col_spacings (GTK_TABLE (table2), 6);
   5.147 +
   5.148 +  label3 = gtk_label_new_with_mnemonic ("_X:");
   5.149 +  gtk_widget_set_name (label3, "label3");
   5.150 +  gtk_widget_show (label3);
   5.151 +  gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 0, 1,
   5.152 +                    (GtkAttachOptions) (GTK_FILL),
   5.153 +                    (GtkAttachOptions) (0), 0, 0);
   5.154 +  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
   5.155 +
   5.156 +  label5 = gtk_label_new_with_mnemonic ("_Y:");
   5.157 +  gtk_widget_set_name (label5, "label5");
   5.158 +  gtk_widget_show (label5);
   5.159 +  gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 1, 2,
   5.160 +                    (GtkAttachOptions) (GTK_FILL),
   5.161 +                    (GtkAttachOptions) (0), 0, 0);
   5.162 +  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
   5.163 +
   5.164 +  label4 = gtk_label_new_with_mnemonic ("_Width:");
   5.165 +  gtk_widget_set_name (label4, "label4");
   5.166 +  gtk_widget_show (label4);
   5.167 +  gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 2, 3,
   5.168 +                    (GtkAttachOptions) (GTK_FILL),
   5.169 +                    (GtkAttachOptions) (0), 0, 0);
   5.170 +  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
   5.171 +
   5.172 +  label6 = gtk_label_new_with_mnemonic ("_Height:");
   5.173 +  gtk_widget_set_name (label6, "label6");
   5.174 +  gtk_widget_show (label6);
   5.175 +  gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 3, 4,
   5.176 +                    (GtkAttachOptions) (GTK_FILL),
   5.177 +                    (GtkAttachOptions) (0), 0, 0);
   5.178 +  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
   5.179 +
   5.180 +  hbox5 = gtk_hbox_new (FALSE, 0);
   5.181 +  gtk_widget_set_name (hbox5, "hbox5");
   5.182 +  gtk_widget_show (hbox5);
   5.183 +  gtk_table_attach (GTK_TABLE (table2), hbox5, 1, 2, 0, 1,
   5.184 +                    (GtkAttachOptions) (GTK_FILL),
   5.185 +                    (GtkAttachOptions) (GTK_FILL), 0, 0);
   5.186 +
   5.187 +  crop_x_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
   5.188 +  crop_x_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_x_spinbutton_adj), 1, 0);
   5.189 +  gtk_widget_set_name (crop_x_spinbutton, "crop_x_spinbutton");
   5.190 +  gtk_widget_show (crop_x_spinbutton);
   5.191 +  gtk_box_pack_start (GTK_BOX (hbox5), crop_x_spinbutton, FALSE, TRUE, 0);
   5.192 +
   5.193 +  hbox6 = gtk_hbox_new (FALSE, 0);
   5.194 +  gtk_widget_set_name (hbox6, "hbox6");
   5.195 +  gtk_widget_show (hbox6);
   5.196 +  gtk_table_attach (GTK_TABLE (table2), hbox6, 1, 2, 1, 2,
   5.197 +                    (GtkAttachOptions) (GTK_FILL),
   5.198 +                    (GtkAttachOptions) (GTK_FILL), 0, 0);
   5.199 +
   5.200 +  crop_y_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
   5.201 +  crop_y_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_y_spinbutton_adj), 1, 0);
   5.202 +  gtk_widget_set_name (crop_y_spinbutton, "crop_y_spinbutton");
   5.203 +  gtk_widget_show (crop_y_spinbutton);
   5.204 +  gtk_box_pack_start (GTK_BOX (hbox6), crop_y_spinbutton, FALSE, TRUE, 0);
   5.205 +
   5.206 +  hbox7 = gtk_hbox_new (FALSE, 0);
   5.207 +  gtk_widget_set_name (hbox7, "hbox7");
   5.208 +  gtk_widget_show (hbox7);
   5.209 +  gtk_table_attach (GTK_TABLE (table2), hbox7, 1, 2, 2, 3,
   5.210 +                    (GtkAttachOptions) (GTK_FILL),
   5.211 +                    (GtkAttachOptions) (GTK_FILL), 0, 0);
   5.212 +
   5.213 +  crop_width_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
   5.214 +  crop_width_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_width_spinbutton_adj), 1, 0);
   5.215 +  gtk_widget_set_name (crop_width_spinbutton, "crop_width_spinbutton");
   5.216 +  gtk_widget_show (crop_width_spinbutton);
   5.217 +  gtk_box_pack_start (GTK_BOX (hbox7), crop_width_spinbutton, FALSE, FALSE, 0);
   5.218 +
   5.219 +  hbox8 = gtk_hbox_new (FALSE, 0);
   5.220 +  gtk_widget_set_name (hbox8, "hbox8");
   5.221 +  gtk_widget_show (hbox8);
   5.222 +  gtk_table_attach (GTK_TABLE (table2), hbox8, 1, 2, 3, 4,
   5.223 +                    (GtkAttachOptions) (GTK_FILL),
   5.224 +                    (GtkAttachOptions) (GTK_FILL), 0, 0);
   5.225 +
   5.226 +  crop_height_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
   5.227 +  crop_height_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_height_spinbutton_adj), 1, 0);
   5.228 +  gtk_widget_set_name (crop_height_spinbutton, "crop_height_spinbutton");
   5.229 +  gtk_widget_show (crop_height_spinbutton);
   5.230 +  gtk_box_pack_start (GTK_BOX (hbox8), crop_height_spinbutton, FALSE, FALSE, 0);
   5.231 +
   5.232 +  vbox4 = gtk_vbox_new (FALSE, 6);
   5.233 +  gtk_widget_set_name (vbox4, "vbox4");
   5.234 +  gtk_widget_show (vbox4);
   5.235 +  gtk_box_pack_start (GTK_BOX (vbox1), vbox4, FALSE, TRUE, 0);
   5.236 +
   5.237 +  label7 = gtk_label_new ("<b>Aspect ratio</b>");
   5.238 +  gtk_widget_set_name (label7, "label7");
   5.239 +  gtk_widget_show (label7);
   5.240 +  gtk_box_pack_start (GTK_BOX (vbox4), label7, FALSE, FALSE, 0);
   5.241 +  gtk_label_set_use_markup (GTK_LABEL (label7), TRUE);
   5.242 +  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
   5.243 +
   5.244 +  hbox3 = gtk_hbox_new (FALSE, 0);
   5.245 +  gtk_widget_set_name (hbox3, "hbox3");
   5.246 +  gtk_widget_show (hbox3);
   5.247 +  gtk_box_pack_start (GTK_BOX (vbox4), hbox3, FALSE, FALSE, 0);
   5.248 +
   5.249 +  label8 = gtk_label_new ("    ");
   5.250 +  gtk_widget_set_name (label8, "label8");
   5.251 +  gtk_widget_show (label8);
   5.252 +  gtk_box_pack_start (GTK_BOX (hbox3), label8, FALSE, FALSE, 0);
   5.253 +
   5.254 +  table3 = gtk_table_new (2, 2, FALSE);
   5.255 +  gtk_widget_set_name (table3, "table3");
   5.256 +  gtk_widget_show (table3);
   5.257 +  gtk_box_pack_start (GTK_BOX (hbox3), table3, TRUE, TRUE, 0);
   5.258 +  gtk_table_set_row_spacings (GTK_TABLE (table3), 6);
   5.259 +  gtk_table_set_col_spacings (GTK_TABLE (table3), 6);
   5.260 +
   5.261 +  hbox10 = gtk_hbox_new (FALSE, 6);
   5.262 +  gtk_widget_set_name (hbox10, "hbox10");
   5.263 +  gtk_widget_show (hbox10);
   5.264 +  gtk_table_attach (GTK_TABLE (table3), hbox10, 0, 2, 1, 2,
   5.265 +                    (GtkAttachOptions) (GTK_FILL),
   5.266 +                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
   5.267 +
   5.268 +  custom_ratio_box = gtk_hbox_new (FALSE, 6);
   5.269 +  gtk_widget_set_name (custom_ratio_box, "custom_ratio_box");
   5.270 +  gtk_widget_show (custom_ratio_box);
   5.271 +  gtk_box_pack_start (GTK_BOX (hbox10), custom_ratio_box, TRUE, TRUE, 0);
   5.272 +
   5.273 +  ratio_w_spinbutton_adj = gtk_adjustment_new (1, 1, 9999, 1, 10, 10);
   5.274 +  ratio_w_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (ratio_w_spinbutton_adj), 1, 0);
   5.275 +  gtk_widget_set_name (ratio_w_spinbutton, "ratio_w_spinbutton");
   5.276 +  gtk_widget_show (ratio_w_spinbutton);
   5.277 +  gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_w_spinbutton, FALSE, TRUE, 0);
   5.278 +
   5.279 +  ratio_swap_button = gtk_button_new ();
   5.280 +  gtk_widget_set_name (ratio_swap_button, "ratio_swap_button");
   5.281 +  gtk_widget_show (ratio_swap_button);
   5.282 +  gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_swap_button, FALSE, FALSE, 0);
   5.283 +  gtk_button_set_relief (GTK_BUTTON (ratio_swap_button), GTK_RELIEF_NONE);
   5.284 +
   5.285 +  eventbox1 = gtk_event_box_new ();
   5.286 +  gtk_widget_set_name (eventbox1, "eventbox1");
   5.287 +  gtk_widget_show (eventbox1);
   5.288 +  gtk_container_add (GTK_CONTAINER (ratio_swap_button), eventbox1);
   5.289 +
   5.290 +  ratio_swap_image = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_BUTTON);
   5.291 +  gtk_widget_set_name (ratio_swap_image, "ratio_swap_image");
   5.292 +  gtk_widget_show (ratio_swap_image);
   5.293 +  gtk_container_add (GTK_CONTAINER (eventbox1), ratio_swap_image);
   5.294 +
   5.295 +  ratio_h_spinbutton_adj = gtk_adjustment_new (1, 1, 9999, 1, 10, 10);
   5.296 +  ratio_h_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (ratio_h_spinbutton_adj), 1, 0);
   5.297 +  gtk_widget_set_name (ratio_h_spinbutton, "ratio_h_spinbutton");
   5.298 +  gtk_widget_show (ratio_h_spinbutton);
   5.299 +  gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_h_spinbutton, FALSE, TRUE, 0);
   5.300 +  gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (ratio_h_spinbutton), GTK_UPDATE_IF_VALID);
   5.301 +
   5.302 +  ratio_optionmenu = gtk_option_menu_new ();
   5.303 +  gtk_widget_set_name (ratio_optionmenu, "ratio_optionmenu");
   5.304 +  gtk_widget_show (ratio_optionmenu);
   5.305 +  gtk_table_attach (GTK_TABLE (table3), ratio_optionmenu, 0, 2, 0, 1,
   5.306 +                    (GtkAttachOptions) (GTK_FILL),
   5.307 +                    (GtkAttachOptions) (0), 0, 0);
   5.308 +
   5.309 +  menu1 = gtk_menu_new ();
   5.310 +  gtk_widget_set_name (menu1, "menu1");
   5.311 +
   5.312 +  none1 = gtk_menu_item_new_with_mnemonic ("None");
   5.313 +  gtk_widget_set_name (none1, "none1");
   5.314 +  gtk_widget_show (none1);
   5.315 +  gtk_container_add (GTK_CONTAINER (menu1), none1);
   5.316 +
   5.317 +  square1 = gtk_menu_item_new_with_mnemonic ("Square");
   5.318 +  gtk_widget_set_name (square1, "square1");
   5.319 +  gtk_widget_show (square1);
   5.320 +  gtk_container_add (GTK_CONTAINER (menu1), square1);
   5.321 +
   5.322 +  _4x3__book__dvd_1 = gtk_menu_item_new_with_mnemonic ("4 x 3 (Book, DVD)");
   5.323 +  gtk_widget_set_name (_4x3__book__dvd_1, "_4x3__book__dvd_1");
   5.324 +  gtk_widget_show (_4x3__book__dvd_1);
   5.325 +  gtk_container_add (GTK_CONTAINER (menu1), _4x3__book__dvd_1);
   5.326 +
   5.327 +  _4x6__postcard_1 = gtk_menu_item_new_with_mnemonic ("4 x 6 (Postcard)");
   5.328 +  gtk_widget_set_name (_4x6__postcard_1, "_4x6__postcard_1");
   5.329 +  gtk_widget_show (_4x6__postcard_1);
   5.330 +  gtk_container_add (GTK_CONTAINER (menu1), _4x6__postcard_1);
   5.331 +
   5.332 +  _5x1 = gtk_menu_item_new_with_mnemonic ("5 x 7");
   5.333 +  gtk_widget_set_name (_5x1, "_5x1");
   5.334 +  gtk_widget_show (_5x1);
   5.335 +  gtk_container_add (GTK_CONTAINER (menu1), _5x1);
   5.336 +
   5.337 +  _8x1 = gtk_menu_item_new_with_mnemonic ("8 x 10");
   5.338 +  gtk_widget_set_name (_8x1, "_8x1");
   5.339 +  gtk_widget_show (_8x1);
   5.340 +  gtk_container_add (GTK_CONTAINER (menu1), _8x1);
   5.341 +
   5.342 +  custom1 = gtk_menu_item_new_with_mnemonic ("Custom");
   5.343 +  gtk_widget_set_name (custom1, "custom1");
   5.344 +  gtk_widget_show (custom1);
   5.345 +  gtk_container_add (GTK_CONTAINER (menu1), custom1);
   5.346 +
   5.347 +  gtk_option_menu_set_menu (GTK_OPTION_MENU (ratio_optionmenu), menu1);
   5.348 +
   5.349 +  vbox5 = gtk_vbox_new (FALSE, 0);
   5.350 +  gtk_widget_set_name (vbox5, "vbox5");
   5.351 +  gtk_widget_show (vbox5);
   5.352 +  gtk_box_pack_start (GTK_BOX (hbox1), vbox5, TRUE, TRUE, 0);
   5.353 +
   5.354 +  frame1 = gtk_frame_new (NULL);
   5.355 +  gtk_widget_set_name (frame1, "frame1");
   5.356 +  gtk_widget_show (frame1);
   5.357 +  gtk_box_pack_start (GTK_BOX (vbox5), frame1, TRUE, TRUE, 0);
   5.358 +  gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);
   5.359 +
   5.360 +  vbox7 = gtk_vbox_new (FALSE, 6);
   5.361 +  gtk_widget_set_name (vbox7, "vbox7");
   5.362 +  gtk_widget_show (vbox7);
   5.363 +  gtk_container_add (GTK_CONTAINER (frame1), vbox7);
   5.364 +
   5.365 +  nav_container = gtk_hbox_new (FALSE, 0);
   5.366 +  gtk_widget_set_name (nav_container, "nav_container");
   5.367 +  gtk_widget_show (nav_container);
   5.368 +  gtk_box_pack_start (GTK_BOX (vbox7), nav_container, TRUE, TRUE, 0);
   5.369 +
   5.370 +  hbox16 = gtk_hbox_new (FALSE, 6);
   5.371 +  gtk_widget_set_name (hbox16, "hbox16");
   5.372 +  gtk_widget_show (hbox16);
   5.373 +  gtk_box_pack_start (GTK_BOX (vbox7), hbox16, FALSE, TRUE, 0);
   5.374 +
   5.375 +  hbox17 = gtk_hbox_new (FALSE, 0);
   5.376 +  gtk_widget_set_name (hbox17, "hbox17");
   5.377 +  gtk_widget_show (hbox17);
   5.378 +  gtk_box_pack_end (GTK_BOX (hbox16), hbox17, FALSE, TRUE, 0);
   5.379 +
   5.380 +  crop_zoom_in_button = gtk_button_new ();
   5.381 +  gtk_widget_set_name (crop_zoom_in_button, "crop_zoom_in_button");
   5.382 +  gtk_widget_show (crop_zoom_in_button);
   5.383 +  gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_in_button, FALSE, FALSE, 0);
   5.384 +  gtk_button_set_relief (GTK_BUTTON (crop_zoom_in_button), GTK_RELIEF_NONE);
   5.385 +
   5.386 +  image2 = gtk_image_new_from_stock ("gtk-zoom-in", GTK_ICON_SIZE_BUTTON);
   5.387 +  gtk_widget_set_name (image2, "image2");
   5.388 +  gtk_widget_show (image2);
   5.389 +  gtk_container_add (GTK_CONTAINER (crop_zoom_in_button), image2);
   5.390 +
   5.391 +  crop_zoom_out_button = gtk_button_new ();
   5.392 +  gtk_widget_set_name (crop_zoom_out_button, "crop_zoom_out_button");
   5.393 +  gtk_widget_show (crop_zoom_out_button);
   5.394 +  gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_out_button, FALSE, FALSE, 0);
   5.395 +  gtk_button_set_relief (GTK_BUTTON (crop_zoom_out_button), GTK_RELIEF_NONE);
   5.396 +
   5.397 +  image4 = gtk_image_new_from_stock ("gtk-zoom-out", GTK_ICON_SIZE_BUTTON);
   5.398 +  gtk_widget_set_name (image4, "image4");
   5.399 +  gtk_widget_show (image4);
   5.400 +  gtk_container_add (GTK_CONTAINER (crop_zoom_out_button), image4);
   5.401 +
   5.402 +  crop_zoom_100_button = gtk_button_new ();
   5.403 +  gtk_widget_set_name (crop_zoom_100_button, "crop_zoom_100_button");
   5.404 +  gtk_widget_show (crop_zoom_100_button);
   5.405 +  gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_100_button, FALSE, FALSE, 0);
   5.406 +  gtk_button_set_relief (GTK_BUTTON (crop_zoom_100_button), GTK_RELIEF_NONE);
   5.407 +
   5.408 +  image3 = gtk_image_new_from_stock ("gtk-zoom-100", GTK_ICON_SIZE_BUTTON);
   5.409 +  gtk_widget_set_name (image3, "image3");
   5.410 +  gtk_widget_show (image3);
   5.411 +  gtk_container_add (GTK_CONTAINER (crop_zoom_100_button), image3);
   5.412 +
   5.413 +  crop_zoom_fit_button = gtk_button_new ();
   5.414 +  gtk_widget_set_name (crop_zoom_fit_button, "crop_zoom_fit_button");
   5.415 +  gtk_widget_show (crop_zoom_fit_button);
   5.416 +  gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_fit_button, FALSE, FALSE, 0);
   5.417 +  gtk_button_set_relief (GTK_BUTTON (crop_zoom_fit_button), GTK_RELIEF_NONE);
   5.418 +
   5.419 +  image1 = gtk_image_new_from_stock ("gtk-zoom-fit", GTK_ICON_SIZE_BUTTON);
   5.420 +  gtk_widget_set_name (image1, "image1");
   5.421 +  gtk_widget_show (image1);
   5.422 +  gtk_container_add (GTK_CONTAINER (crop_zoom_fit_button), image1);
   5.423 +
   5.424 +  g_signal_connect ((gpointer) cropper_window, "delete_event",
   5.425 +                    G_CALLBACK (on_cropper_window_delete_event),
   5.426 +                    NULL);
   5.427 +  g_signal_connect ((gpointer) cropper_window, "destroy",
   5.428 +                    G_CALLBACK (on_cropper_window_destroy),
   5.429 +                    NULL);
   5.430 +  g_signal_connect ((gpointer) ratio_w_spinbutton, "value_changed",
   5.431 +                    G_CALLBACK (on_ratio_w_spinbutton_value_changed),
   5.432 +                    NULL);
   5.433 +  g_signal_connect ((gpointer) ratio_w_spinbutton, "change_value",
   5.434 +                    G_CALLBACK (on_ratio_w_spinbutton_change_value),
   5.435 +                    NULL);
   5.436 +  g_signal_connect ((gpointer) ratio_swap_button, "clicked",
   5.437 +                    G_CALLBACK (on_ratio_swap_button_clicked),
   5.438 +                    NULL);
   5.439 +  g_signal_connect ((gpointer) ratio_h_spinbutton, "change_value",
   5.440 +                    G_CALLBACK (on_ratio_h_spinbutton_change_value),
   5.441 +                    NULL);
   5.442 +  g_signal_connect ((gpointer) ratio_h_spinbutton, "value_changed",
   5.443 +                    G_CALLBACK (on_ratio_h_spinbutton_value_changed),
   5.444 +                    NULL);
   5.445 +  g_signal_connect ((gpointer) none1, "activate",
   5.446 +                    G_CALLBACK (on_none1_activate),
   5.447 +                    NULL);
   5.448 +  g_signal_connect ((gpointer) square1, "activate",
   5.449 +                    G_CALLBACK (on_square1_activate),
   5.450 +                    NULL);
   5.451 +  g_signal_connect ((gpointer) _4x3__book__dvd_1, "activate",
   5.452 +                    G_CALLBACK (on_4x3__book__dvd_1_activate),
   5.453 +                    NULL);
   5.454 +  g_signal_connect ((gpointer) _4x6__postcard_1, "activate",
   5.455 +                    G_CALLBACK (on_4x6__postcard_1_activate),
   5.456 +                    NULL);
   5.457 +  g_signal_connect ((gpointer) _5x1, "activate",
   5.458 +                    G_CALLBACK (on_5x1_activate),
   5.459 +                    NULL);
   5.460 +  g_signal_connect ((gpointer) _8x1, "activate",
   5.461 +                    G_CALLBACK (on_8x1_activate),
   5.462 +                    NULL);
   5.463 +  g_signal_connect ((gpointer) custom1, "activate",
   5.464 +                    G_CALLBACK (on_custom1_activate),
   5.465 +                    NULL);
   5.466 +
   5.467 +  /* Store pointers to all widgets, for use by lookup_widget(). */
   5.468 +  GLADE_HOOKUP_OBJECT_NO_REF (cropper_window, cropper_window, "cropper_window");
   5.469 +  GLADE_HOOKUP_OBJECT (cropper_window, dialog_vbox1, "dialog_vbox1");
   5.470 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox1, "hbox1");
   5.471 +  GLADE_HOOKUP_OBJECT (cropper_window, vbox1, "vbox1");
   5.472 +  GLADE_HOOKUP_OBJECT (cropper_window, vbox2, "vbox2");
   5.473 +  GLADE_HOOKUP_OBJECT (cropper_window, label1, "label1");
   5.474 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox2, "hbox2");
   5.475 +  GLADE_HOOKUP_OBJECT (cropper_window, label2, "label2");
   5.476 +  GLADE_HOOKUP_OBJECT (cropper_window, table2, "table2");
   5.477 +  GLADE_HOOKUP_OBJECT (cropper_window, label3, "label3");
   5.478 +  GLADE_HOOKUP_OBJECT (cropper_window, label5, "label5");
   5.479 +  GLADE_HOOKUP_OBJECT (cropper_window, label4, "label4");
   5.480 +  GLADE_HOOKUP_OBJECT (cropper_window, label6, "label6");
   5.481 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox5, "hbox5");
   5.482 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_x_spinbutton, "crop_x_spinbutton");
   5.483 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox6, "hbox6");
   5.484 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_y_spinbutton, "crop_y_spinbutton");
   5.485 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox7, "hbox7");
   5.486 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_width_spinbutton, "crop_width_spinbutton");
   5.487 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox8, "hbox8");
   5.488 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_height_spinbutton, "crop_height_spinbutton");
   5.489 +  GLADE_HOOKUP_OBJECT (cropper_window, vbox4, "vbox4");
   5.490 +  GLADE_HOOKUP_OBJECT (cropper_window, label7, "label7");
   5.491 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox3, "hbox3");
   5.492 +  GLADE_HOOKUP_OBJECT (cropper_window, label8, "label8");
   5.493 +  GLADE_HOOKUP_OBJECT (cropper_window, table3, "table3");
   5.494 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox10, "hbox10");
   5.495 +  GLADE_HOOKUP_OBJECT (cropper_window, custom_ratio_box, "custom_ratio_box");
   5.496 +  GLADE_HOOKUP_OBJECT (cropper_window, ratio_w_spinbutton, "ratio_w_spinbutton");
   5.497 +  GLADE_HOOKUP_OBJECT (cropper_window, ratio_swap_button, "ratio_swap_button");
   5.498 +  GLADE_HOOKUP_OBJECT (cropper_window, eventbox1, "eventbox1");
   5.499 +  GLADE_HOOKUP_OBJECT (cropper_window, ratio_swap_image, "ratio_swap_image");
   5.500 +  GLADE_HOOKUP_OBJECT (cropper_window, ratio_h_spinbutton, "ratio_h_spinbutton");
   5.501 +  GLADE_HOOKUP_OBJECT (cropper_window, ratio_optionmenu, "ratio_optionmenu");
   5.502 +  GLADE_HOOKUP_OBJECT (cropper_window, menu1, "menu1");
   5.503 +  GLADE_HOOKUP_OBJECT (cropper_window, none1, "none1");
   5.504 +  GLADE_HOOKUP_OBJECT (cropper_window, square1, "square1");
   5.505 +  GLADE_HOOKUP_OBJECT (cropper_window, _4x3__book__dvd_1, "_4x3__book__dvd_1");
   5.506 +  GLADE_HOOKUP_OBJECT (cropper_window, _4x6__postcard_1, "_4x6__postcard_1");
   5.507 +  GLADE_HOOKUP_OBJECT (cropper_window, _5x1, "_5x1");
   5.508 +  GLADE_HOOKUP_OBJECT (cropper_window, _8x1, "_8x1");
   5.509 +  GLADE_HOOKUP_OBJECT (cropper_window, custom1, "custom1");
   5.510 +  GLADE_HOOKUP_OBJECT (cropper_window, vbox5, "vbox5");
   5.511 +  GLADE_HOOKUP_OBJECT (cropper_window, frame1, "frame1");
   5.512 +  GLADE_HOOKUP_OBJECT (cropper_window, vbox7, "vbox7");
   5.513 +  GLADE_HOOKUP_OBJECT (cropper_window, nav_container, "nav_container");
   5.514 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox16, "hbox16");
   5.515 +  GLADE_HOOKUP_OBJECT (cropper_window, hbox17, "hbox17");
   5.516 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_in_button, "crop_zoom_in_button");
   5.517 +  GLADE_HOOKUP_OBJECT (cropper_window, image2, "image2");
   5.518 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_out_button, "crop_zoom_out_button");
   5.519 +  GLADE_HOOKUP_OBJECT (cropper_window, image4, "image4");
   5.520 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_100_button, "crop_zoom_100_button");
   5.521 +  GLADE_HOOKUP_OBJECT (cropper_window, image3, "image3");
   5.522 +  GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_fit_button, "crop_zoom_fit_button");
   5.523 +  GLADE_HOOKUP_OBJECT (cropper_window, image1, "image1");
   5.524 +
   5.525 +  return cropper_window;
   5.526 +}
   5.527 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/interface.h	Tue Dec 04 16:48:51 2007 +0100
     6.3 @@ -0,0 +1,6 @@
     6.4 +/*
     6.5 + * DO NOT EDIT THIS FILE - it is generated by Glade.
     6.6 + */
     6.7 +#include<gtk/gtk.h>
     6.8 +
     6.9 +GtkWidget* create_cropper_window (void);
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/main.c	Tue Dec 04 16:48:51 2007 +0100
     7.3 @@ -0,0 +1,36 @@
     7.4 +/*
     7.5 + * Initial main.c file generated by Glade. Edit as required.
     7.6 + * Glade will not overwrite this file.
     7.7 + */
     7.8 +
     7.9 +#ifdef HAVE_CONFIG_H
    7.10 +#  include <config.h>
    7.11 +#endif
    7.12 +
    7.13 +#include <gtk/gtk.h>
    7.14 +
    7.15 +#include "interface.h"
    7.16 +#include "support.h"
    7.17 +
    7.18 +int
    7.19 +main (int argc, char *argv[])
    7.20 +{
    7.21 +  GtkWidget *cropper_window;
    7.22 +
    7.23 +  gtk_set_locale ();
    7.24 +  gtk_init (&argc, &argv);
    7.25 +
    7.26 +  add_pixmap_directory ("/usr/share/pixmaps");
    7.27 +
    7.28 +  /*
    7.29 +   * The following code was added by Glade to create one of each component
    7.30 +   * (except popup menus), just so that you see something after building
    7.31 +   * the project. Delete any components that you don't want shown initially.
    7.32 +   */
    7.33 +  cropper_window = create_cropper_window ();
    7.34 +  gtk_widget_show (cropper_window);
    7.35 +
    7.36 +  gtk_main ();
    7.37 +  return 0;
    7.38 +}
    7.39 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/support.c	Tue Dec 04 16:48:51 2007 +0100
     8.3 @@ -0,0 +1,144 @@
     8.4 +/*
     8.5 + * DO NOT EDIT THIS FILE - it is generated by Glade.
     8.6 + */
     8.7 +
     8.8 +#ifdef HAVE_CONFIG_H
     8.9 +#  include <config.h>
    8.10 +#endif
    8.11 +
    8.12 +#include <sys/types.h>
    8.13 +#include <sys/stat.h>
    8.14 +#include <unistd.h>
    8.15 +#include <string.h>
    8.16 +#include <stdio.h>
    8.17 +
    8.18 +#include <gtk/gtk.h>
    8.19 +
    8.20 +#include "support.h"
    8.21 +
    8.22 +GtkWidget*
    8.23 +lookup_widget                          (GtkWidget       *widget,
    8.24 +                                        const gchar     *widget_name)
    8.25 +{
    8.26 +  GtkWidget *parent, *found_widget;
    8.27 +
    8.28 +  for (;;)
    8.29 +    {
    8.30 +      if (GTK_IS_MENU (widget))
    8.31 +        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
    8.32 +      else
    8.33 +        parent = widget->parent;
    8.34 +      if (!parent)
    8.35 +        parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
    8.36 +      if (parent == NULL)
    8.37 +        break;
    8.38 +      widget = parent;
    8.39 +    }
    8.40 +
    8.41 +  found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
    8.42 +                                                 widget_name);
    8.43 +  if (!found_widget)
    8.44 +    g_warning ("Widget not found: %s", widget_name);
    8.45 +  return found_widget;
    8.46 +}
    8.47 +
    8.48 +static GList *pixmaps_directories = NULL;
    8.49 +
    8.50 +/* Use this function to set the directory containing installed pixmaps. */
    8.51 +void
    8.52 +add_pixmap_directory                   (const gchar     *directory)
    8.53 +{
    8.54 +  pixmaps_directories = g_list_prepend (pixmaps_directories,
    8.55 +                                        g_strdup (directory));
    8.56 +}
    8.57 +
    8.58 +/* This is an internally used function to find pixmap files. */
    8.59 +static gchar*
    8.60 +find_pixmap_file                       (const gchar     *filename)
    8.61 +{
    8.62 +  GList *elem;
    8.63 +
    8.64 +  /* We step through each of the pixmaps directory to find it. */
    8.65 +  elem = pixmaps_directories;
    8.66 +  while (elem)
    8.67 +    {
    8.68 +      gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
    8.69 +                                         G_DIR_SEPARATOR_S, filename);
    8.70 +      if (g_file_test (pathname, G_FILE_TEST_EXISTS))
    8.71 +        return pathname;
    8.72 +      g_free (pathname);
    8.73 +      elem = elem->next;
    8.74 +    }
    8.75 +  return NULL;
    8.76 +}
    8.77 +
    8.78 +/* This is an internally used function to create pixmaps. */
    8.79 +GtkWidget*
    8.80 +create_pixmap                          (GtkWidget       *widget,
    8.81 +                                        const gchar     *filename)
    8.82 +{
    8.83 +  gchar *pathname = NULL;
    8.84 +  GtkWidget *pixmap;
    8.85 +
    8.86 +  if (!filename || !filename[0])
    8.87 +      return gtk_image_new ();
    8.88 +
    8.89 +  pathname = find_pixmap_file (filename);
    8.90 +
    8.91 +  if (!pathname)
    8.92 +    {
    8.93 +      g_warning ("Couldn't find pixmap file: %s", filename);
    8.94 +      return gtk_image_new ();
    8.95 +    }
    8.96 +
    8.97 +  pixmap = gtk_image_new_from_file (pathname);
    8.98 +  g_free (pathname);
    8.99 +  return pixmap;
   8.100 +}
   8.101 +
   8.102 +/* This is an internally used function to create pixmaps. */
   8.103 +GdkPixbuf*
   8.104 +create_pixbuf                          (const gchar     *filename)
   8.105 +{
   8.106 +  gchar *pathname = NULL;
   8.107 +  GdkPixbuf *pixbuf;
   8.108 +  GError *error = NULL;
   8.109 +
   8.110 +  if (!filename || !filename[0])
   8.111 +      return NULL;
   8.112 +
   8.113 +  pathname = find_pixmap_file (filename);
   8.114 +
   8.115 +  if (!pathname)
   8.116 +    {
   8.117 +      g_warning ("Couldn't find pixmap file: %s", filename);
   8.118 +      return NULL;
   8.119 +    }
   8.120 +
   8.121 +  pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
   8.122 +  if (!pixbuf)
   8.123 +    {
   8.124 +      fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
   8.125 +               pathname, error->message);
   8.126 +      g_error_free (error);
   8.127 +    }
   8.128 +  g_free (pathname);
   8.129 +  return pixbuf;
   8.130 +}
   8.131 +
   8.132 +/* This is used to set ATK action descriptions. */
   8.133 +void
   8.134 +glade_set_atk_action_description       (AtkAction       *action,
   8.135 +                                        const gchar     *action_name,
   8.136 +                                        const gchar     *description)
   8.137 +{
   8.138 +  gint n_actions, i;
   8.139 +
   8.140 +  n_actions = atk_action_get_n_actions (action);
   8.141 +  for (i = 0; i < n_actions; i++)
   8.142 +    {
   8.143 +      if (!strcmp (atk_action_get_name (action, i), action_name))
   8.144 +        atk_action_set_description (action, i, description);
   8.145 +    }
   8.146 +}
   8.147 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/support.h	Tue Dec 04 16:48:51 2007 +0100
     9.3 @@ -0,0 +1,44 @@
     9.4 +/*
     9.5 + * DO NOT EDIT THIS FILE - it is generated by Glade.
     9.6 + */
     9.7 +
     9.8 +#ifdef HAVE_CONFIG_H
     9.9 +#  include <config.h>
    9.10 +#endif
    9.11 +
    9.12 +#include <gtk/gtk.h>
    9.13 +
    9.14 +/*
    9.15 + * Public Functions.
    9.16 + */
    9.17 +
    9.18 +/*
    9.19 + * This function returns a widget in a component created by Glade.
    9.20 + * Call it with the toplevel widget in the component (i.e. a window/dialog),
    9.21 + * or alternatively any widget in the component, and the name of the widget
    9.22 + * you want returned.
    9.23 + */
    9.24 +GtkWidget*  lookup_widget              (GtkWidget       *widget,
    9.25 +                                        const gchar     *widget_name);
    9.26 +
    9.27 +
    9.28 +/* Use this function to set the directory containing installed pixmaps. */
    9.29 +void        add_pixmap_directory       (const gchar     *directory);
    9.30 +
    9.31 +
    9.32 +/*
    9.33 + * Private Functions.
    9.34 + */
    9.35 +
    9.36 +/* This is used to create the pixmaps used in the interface. */
    9.37 +GtkWidget*  create_pixmap              (GtkWidget       *widget,
    9.38 +                                        const gchar     *filename);
    9.39 +
    9.40 +/* This is used to create the pixbufs used in the interface. */
    9.41 +GdkPixbuf*  create_pixbuf              (const gchar     *filename);
    9.42 +
    9.43 +/* This is used to set ATK action descriptions. */
    9.44 +void        glade_set_atk_action_description (AtkAction       *action,
    9.45 +                                              const gchar     *action_name,
    9.46 +                                              const gchar     *description);
    9.47 +