Commit 9897f388 authored by Maurits Rijk's avatar Maurits Rijk

Code clean-up, removing use of deprecated GtkCList widget

parent 0f2f38e2
2003-01-01 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_about.c
* plug-ins/imagemap/imap_file.c
* plug-ins/imagemap/imap_grid.c
* plug-ins/imagemap/imap_main.c
* plug-ins/imagemap/imap_menu.[ch]
* plug-ins/imagemap/imap_polygon.[ch]
* plug-ins/imagemap/imap_preview.c
* plug-ins/imagemap/imap_stock.[ch]
* plug-ins/imagemap/imap_edit_area_info.[ch]
* plug-ins/imagemap/imap_statusbar.[ch]
* plug-ins/imagemap/imap_cmd_copy.[ch]: removed use of deprecated GTK
widgets and routines plus some code clean-up.
2003-01-01 Tor Lillqvist <tml@iki.fi>
* modules/Makefile.am: On Win32, use -no-undefined, and add
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -41,7 +41,7 @@ do_about_dialog(void)
default_dialog_hide_help_button(dialog);
default_dialog_set_label(dialog, _("Imagemap plug-in 2.0"));
default_dialog_set_label(
dialog, _("Copyright(c) 1999-2002 by Maurits Rijk"));
dialog, _("Copyright(c) 1999-2003 by Maurits Rijk"));
default_dialog_set_label(dialog, _("lpeek.mrijk@consunet.nl"));
default_dialog_set_label(
dialog, _(" Released under the GNU General Public License "));
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -23,11 +23,6 @@
#include "config.h"
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_cmd_copy.h"
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -26,10 +26,6 @@
#include <stdio.h>
#include <string.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
......@@ -42,7 +38,7 @@
#include "libgimp/stdplugins-intl.h"
static gint callback_lock;
static gboolean callback_lock;
static gchar*
......@@ -105,8 +101,9 @@ set_url(GtkWidget *widget, AreaInfoDialog_t *param, const gchar *prefix)
p = url;
}
}
gtk_entry_set_text(GTK_ENTRY(param->url), prefix);
gtk_entry_append_text(GTK_ENTRY(param->url), p);
p = g_strconcat(prefix, p, NULL);
gtk_entry_set_text(GTK_ENTRY(param->url), p);
g_free(p);
g_free(url);
}
}
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -29,6 +29,7 @@
#include "imap_default_dialog.h"
#include "imap_file.h"
#include "imap_main.h"
#include "imap_misc.h"
#include "libgimp/stdplugins-intl.h"
......@@ -119,55 +120,6 @@ do_file_save_as_dialog(void)
gtk_widget_show(dialog);
}
typedef struct {
DefaultDialog_t *dialog;
GtkWidget *label;
} Alert_t;
Alert_t*
create_alert(const gchar *stock_id)
{
Alert_t *alert = g_new(Alert_t, 1);
DefaultDialog_t *dialog;
GtkWidget *hbox;
GtkWidget *image;
alert->dialog = dialog = make_default_dialog("");
default_dialog_hide_apply_button(dialog);
default_dialog_hide_cancel_button(dialog);
hbox = gtk_hbox_new(FALSE, 12);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox), hbox,
TRUE, TRUE, 10);
gtk_widget_show(hbox);
image = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_DIALOG);
gtk_container_add(GTK_CONTAINER(hbox), image);
gtk_widget_show(image);
alert->label = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(alert->label), 0.0, 0.0);
gtk_container_add(GTK_CONTAINER(hbox), alert->label);
gtk_widget_show(alert->label);
return alert;
}
void
alert_set_text(Alert_t *alert, const char *primary_text,
const char *secondary_text)
{
gchar *text;
text =
g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
primary_text, secondary_text);
gtk_label_set_markup(GTK_LABEL(alert->label), text);
g_free(text);
}
void
do_file_error_dialog(const char *error, const char *filename)
{
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -364,6 +364,7 @@ draw_grid(GtkWidget *preview)
if (!grid_gc) {
grid_gc = gdk_gc_new(preview->window);
gdk_gc_set_line_attributes(grid_gc, 1, GDK_LINE_ON_OFF_DASH,
GDK_CAP_BUTT, GDK_JOIN_BEVEL);
}
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -64,6 +64,7 @@
#include "imap_grid.h"
#include "imap_main.h"
#include "imap_menu.h"
#include "imap_misc.h"
#include "imap_object.h"
#include "imap_polygon.h"
#include "imap_popup.h"
......@@ -469,7 +470,7 @@ fuzzy_select_on_button_press(GtkWidget *widget, GdkEventButton *event,
add_shape(object);
x0 = gimp_path_get_point_at_dist(image_ID, 0.0, &y0, &grad0);
polygon->points = g_list_append(NULL, new_point(x0, y0));
polygon_append_point(polygon, x0, y0);
for (distance = 1.0;; distance += 1.0) {
gint x1, y1 = -1;
......@@ -490,8 +491,7 @@ fuzzy_select_on_button_press(GtkWidget *widget, GdkEventButton *event,
diff = grad1;
if (fabs(diff) > 0.1) {
polygon->points = g_list_append(polygon->points,
new_point(x1, y1));
polygon_append_point(polygon, x1, y1);
grad0 = grad1;
}
x0 = x1;
......@@ -748,18 +748,15 @@ clear_map_info(void)
static void
do_data_changed_dialog(void (*continue_cb)(gpointer), gpointer param)
{
static DefaultDialog_t *dialog;
static Alert_t *alert;
if (!dialog) {
dialog = make_default_dialog(_("Data changed"));
default_dialog_hide_apply_button(dialog);
default_dialog_set_label(
dialog,
_("Some data has been changed.\n"
"Do you really want to discard your changes?"));
if (!alert) {
alert = create_confirm_alert(GTK_STOCK_DIALOG_WARNING);
alert_set_text(alert, _("Some data has been changed!"),
_("Do you really want to discard your changes?"));
}
default_dialog_set_ok_cb(dialog, continue_cb, param);
default_dialog_show(dialog);
default_dialog_set_ok_cb(alert->dialog, continue_cb, param);
default_dialog_show(alert->dialog);
}
static void
......@@ -990,21 +987,16 @@ resize_image_cancel_cb(gpointer data)
static void
do_image_size_changed_dialog(void)
{
static DefaultDialog_t *dialog;
static Alert_t *alert;
if (!dialog) {
dialog = make_default_dialog( _("Image size changed"));
default_dialog_hide_apply_button(dialog);
default_dialog_set_label(
dialog,
_("Image size has changed.\n"
"Resize Area's?"));
default_dialog_set_ok_cb(dialog, resize_image_ok_cb, NULL);
default_dialog_set_cancel_cb(dialog, resize_image_cancel_cb, NULL);
if (!alert) {
alert = create_confirm_alert(GTK_STOCK_DIALOG_WARNING);
alert_set_text(alert, _("Image size has changed."),
_("Resize area's?"));
}
default_dialog_show(dialog);
default_dialog_set_ok_cb(alert->dialog, resize_image_ok_cb, NULL);
default_dialog_set_cancel_cb(alert->dialog, resize_image_cancel_cb, NULL);
default_dialog_show(alert->dialog);
}
static void
......@@ -1056,10 +1048,11 @@ toggle_area_list(void)
selection_toggle_visibility(_selection);
}
static void
static gboolean
close_callback(GtkWidget *widget, gpointer data)
{
gtk_main_quit();
do_quit();
return TRUE;
}
static gboolean
......@@ -1442,7 +1435,7 @@ dialog(GimpDrawable *drawable)
gimp_help_connect (dlg, gimp_standard_help_func, "filters/imagemap.html");
gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
g_signal_connect(G_OBJECT(dlg), "destroy",
g_signal_connect(G_OBJECT(dlg), "delete_event",
G_CALLBACK(close_callback), NULL);
g_signal_connect(G_OBJECT(dlg), "key_press_event",
G_CALLBACK(key_press_cb), NULL);
......
......@@ -183,6 +183,7 @@ make_file_menu(GtkWidget *menu_bar)
_menu.file_menu = file_menu;
make_item_with_image(file_menu, GTK_STOCK_OPEN, menu_command,
&_menu.cmd_open);
_menu.open_recent = make_sub_menu(file_menu, _("Open Recent"));
make_item_with_image(file_menu, GTK_STOCK_SAVE, menu_command,
&_menu.cmd_save);
item = make_item_with_image(file_menu, GTK_STOCK_SAVE_AS, menu_command,
......@@ -424,11 +425,13 @@ void
menu_build_mru_items(MRU_t *mru)
{
GList *p;
gint position = 7; /* Position of 'Close' entry */
gint position = 0;
int i;
if (_menu.nr_off_mru_items) {
GList *children = gtk_container_get_children(GTK_CONTAINER(_menu.file_menu));
GList *children;
children = gtk_container_get_children(GTK_CONTAINER(_menu.open_recent));
p = g_list_nth(children, position);
for (i = 0; i < _menu.nr_off_mru_items; i++, p = p->next) {
......@@ -439,7 +442,7 @@ menu_build_mru_items(MRU_t *mru)
i = 0;
for (p = mru->list; p; p = p->next, i++) {
GtkWidget *item = insert_item_with_label(_menu.file_menu, position++,
GtkWidget *item = insert_item_with_label(_menu.open_recent, position++,
(gchar*) p->data,
menu_mru, p->data);
if (i < 9) {
......@@ -447,7 +450,6 @@ menu_build_mru_items(MRU_t *mru)
add_accelerator(item, accelerator_key, GDK_CONTROL_MASK);
}
}
insert_separator(_menu.file_menu, position);
_menu.nr_off_mru_items = i + 1;
}
......
......@@ -28,60 +28,61 @@
#include "imap_mru.h"
typedef struct {
GtkWidget *file_menu;
GtkWidget *edit_menu;
GtkWidget *undo;
GtkWidget *redo;
GtkWidget *cut;
GtkWidget *copy;
GtkWidget *clear;
GtkWidget *edit;
GtkWidget *deselect_all;
GtkWidget *arrow;
GtkWidget *fuzzy_select;
GtkWidget *rectangle;
GtkWidget *circle;
GtkWidget *polygon;
GtkWidget *grid;
GtkWidget *gray;
GtkWidget *color;
GtkWidget *zoom[8];
GtkWidget *zoom_in;
GtkWidget *zoom_out;
GtkWidget *file_menu;
GtkWidget *edit_menu;
GtkWidget *open_recent;
GtkWidget *undo;
GtkWidget *redo;
GtkWidget *cut;
GtkWidget *copy;
GtkWidget *clear;
GtkWidget *edit;
GtkWidget *deselect_all;
GtkWidget *arrow;
GtkWidget *fuzzy_select;
GtkWidget *rectangle;
GtkWidget *circle;
GtkWidget *polygon;
GtkWidget *grid;
GtkWidget *gray;
GtkWidget *color;
GtkWidget *zoom[8];
GtkWidget *zoom_in;
GtkWidget *zoom_out;
gint nr_off_mru_items;
gint nr_off_mru_items;
CommandFactory_t cmd_open;
CommandFactory_t cmd_save;
CommandFactory_t cmd_save_as;
CommandFactory_t cmd_preferences;
CommandFactory_t cmd_close;
CommandFactory_t cmd_quit;
CommandFactory_t cmd_undo;
CommandFactory_t cmd_redo;
CommandFactory_t cmd_cut;
CommandFactory_t cmd_copy;
CommandFactory_t cmd_paste;
CommandFactory_t cmd_select_all;
CommandFactory_t cmd_deselect_all;
CommandFactory_t cmd_clear;
CommandFactory_t cmd_edit_area_info;
CommandFactory_t cmd_area_list;
CommandFactory_t cmd_source;
CommandFactory_t cmd_color;
CommandFactory_t cmd_gray;
CommandFactory_t cmd_zoom_in;
CommandFactory_t cmd_zoom_out;
CommandFactory_t cmd_edit_map_info;
CommandFactory_t cmd_grid_settings;
CommandFactory_t cmd_create_guides;
CommandFactory_t cmd_use_gimp_guides;
CommandFactory_t cmd_about;
CommandFactory_t cmd_open;
CommandFactory_t cmd_save;
CommandFactory_t cmd_save_as;
CommandFactory_t cmd_preferences;
CommandFactory_t cmd_close;
CommandFactory_t cmd_quit;
CommandFactory_t cmd_undo;
CommandFactory_t cmd_redo;
CommandFactory_t cmd_cut;
CommandFactory_t cmd_copy;
CommandFactory_t cmd_paste;
CommandFactory_t cmd_select_all;
CommandFactory_t cmd_deselect_all;
CommandFactory_t cmd_clear;
CommandFactory_t cmd_edit_area_info;
CommandFactory_t cmd_area_list;
CommandFactory_t cmd_source;
CommandFactory_t cmd_color;
CommandFactory_t cmd_gray;
CommandFactory_t cmd_zoom_in;
CommandFactory_t cmd_zoom_out;
CommandFactory_t cmd_edit_map_info;
CommandFactory_t cmd_grid_settings;
CommandFactory_t cmd_create_guides;
CommandFactory_t cmd_use_gimp_guides;
CommandFactory_t cmd_about;
} Menu_t;
#define menu_set_open_command(menu, command) \
......
......@@ -70,6 +70,64 @@ make_toolbar_toggle_icon(GtkWidget *toolbar, const gchar *stock_id,
GTK_SIGNAL_FUNC(callback), udata);
}
static Alert_t*
create_base_alert(const gchar *stock_id)
{
Alert_t *alert = g_new(Alert_t, 1);
DefaultDialog_t *dialog;
GtkWidget *hbox;
GtkWidget *image;
alert->dialog = dialog = make_default_dialog("");
default_dialog_hide_apply_button(dialog);
hbox = gtk_hbox_new(FALSE, 12);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox), hbox,
TRUE, TRUE, 10);
gtk_widget_show(hbox);
image = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_DIALOG);
gtk_container_add(GTK_CONTAINER(hbox), image);
gtk_widget_show(image);
alert->label = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(alert->label), 0.0, 0.0);
gtk_container_add(GTK_CONTAINER(hbox), alert->label);
gtk_widget_show(alert->label);
return alert;
}
Alert_t*
create_alert(const gchar *stock_id)
{
Alert_t *alert = create_base_alert(stock_id);
default_dialog_hide_cancel_button(alert->dialog);
return alert;
}
Alert_t*
create_confirm_alert(const gchar *stock_id)
{
return create_base_alert(stock_id);
}
void
alert_set_text(Alert_t *alert, const char *primary_text,
const char *secondary_text)
{
gchar *text;
text =
g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
primary_text, secondary_text);
gtk_label_set_markup(GTK_LABEL(alert->label), text);
g_free(text);
}
#define SASH_SIZE 8
static gint _sash_size = SASH_SIZE;
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -44,5 +44,15 @@ void set_sash_size(gboolean double_size);
void draw_sash(GdkWindow *window, GdkGC *gc, gint x, gint y);
gboolean near_sash(gint sash_x, gint sash_y, gint x, gint y);
typedef struct {
DefaultDialog_t *dialog;
GtkWidget *label;
} Alert_t;
Alert_t *create_alert(const gchar *stock_id);
Alert_t *create_confirm_alert(const gchar *stock_id);
void alert_set_text(Alert_t *alert, const char *primary_text,
const char *secondary_text);
#endif /* _IMAP_MISC_H */
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -26,11 +26,6 @@
#include <stdlib.h>
#include <stdio.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_cmd_delete_point.h"
......@@ -142,8 +137,7 @@ polygon_clone(Object_t *obj)
clone->points = NULL;
for (p = polygon->points; p; p = p->next) {
GdkPoint *point = (GdkPoint*) p->data;
clone->points = g_list_append(clone->points,
new_point(point->x, point->y));
polygon_append_point(clone, point->x, point->y);
}
return &clone->obj;
}
......@@ -158,8 +152,7 @@ polygon_assign(Object_t *obj, Object_t *des)
polygon_free_list(des_polygon);
for (p = src_polygon->points; p; p = p->next) {
GdkPoint *point = (GdkPoint*) p->data;
des_polygon->points = g_list_append(des_polygon->points,
new_point(point->x, point->y));
polygon_append_point(des_polygon, point->x, point->y);
}
}
......@@ -298,7 +291,8 @@ polygon_move(Object_t *obj, gint dx, gint dy)
typedef struct {
Object_t *obj;
GtkWidget *list;
GtkListStore *store;
GtkTreeSelection *selection;
GtkWidget *x;
GtkWidget *y;
GtkWidget *update;
......@@ -310,64 +304,98 @@ typedef struct {
} PolygonProperties_t;
static void
select_row_cb(GtkWidget *widget, gint row, gint column, GdkEventButton *event,
PolygonProperties_t *data)
select_row_cb(GtkTreeSelection *selection, PolygonProperties_t *data)
{
gchar *text;
data->selected_row = row;
GtkTreeIter iter;
GtkTreeModel *model;
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
GdkPoint *point;
_sash_point = g_list_nth(ObjectToPolygon(data->obj)->points, row)->data;
gtk_tree_model_get (model, &iter, 0, &point, -1);
gtk_clist_get_text(GTK_CLIST(data->list), row, 0, &text);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->x), atoi(text));
_sash_point = point;
gtk_clist_get_text(GTK_CLIST(data->list), row, 1, &text);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->y), atoi(text));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->x), point->x);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(data->y), point->y);
}
}
static void
update_button_clicked(GtkWidget *widget, PolygonProperties_t *data)
{
gtk_clist_set_text(GTK_CLIST(data->list), data->selected_row, 0,
gtk_entry_get_text(GTK_ENTRY(data->x)));
gtk_clist_set_text(GTK_CLIST(data->list), data->selected_row, 1,
gtk_entry_get_text(GTK_ENTRY(data->y)));
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(data->store);
if (gtk_tree_selection_get_selected (data->selection, &model, &iter)) {
GdkPoint *point;
gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->x));
gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->y));
gtk_tree_model_get (model, &iter, 0, &point, -1);
point->x = x;
point->y = y;
gtk_list_store_set (data->store, &iter, 0, point, -1);
}
}
static void
set_buttons_sensitivity(PolygonProperties_t *data)
{
gint rows = GTK_CLIST(data->list)->rows;
gint sensitive = (rows != MAX_POLYGON_POINTS) && (rows > 2);
gtk_widget_set_sensitive(data->insert, sensitive);
gtk_widget_set_sensitive(data->append, sensitive);
gint rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL(data->store),
NULL);
gtk_widget_set_sensitive(data->insert, rows != MAX_POLYGON_POINTS);
gtk_widget_set_sensitive(data->append, rows != MAX_POLYGON_POINTS);
gtk_widget_set_sensitive(data->remove, rows > 2);
}
static void
insert_button_clicked(GtkWidget *widget, PolygonProperties_t *data)
{
const gchar *text[2];
text[0] = gtk_entry_get_text(GTK_ENTRY(data->x));
text[1] = gtk_entry_get_text(GTK_ENTRY(data->y));
gtk_clist_insert(GTK_CLIST(data->list), data->selected_row, (gchar **) text);
set_buttons_sensitivity(data);
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(data->store);
if (gtk_tree_selection_get_selected (data->selection, &model, &iter)) {
Polygon_t *polygon = ObjectToPolygon(data->obj);
GdkPoint *point;
GList *here;
gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->x));
gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->y));
gtk_tree_model_get (model, &iter, 0, &point, -1);
here = g_list_find(polygon->points, point);
polygon->points = g_list_insert_before(polygon->points, here,
new_point(x, y));
polygon_fill_info_tab(data->obj, data);
}
}
static void
append_button_clicked(GtkWidget *widget, PolygonProperties_t *data)
{
const gchar *text[2];
text[0] = gtk_entry_get_text(GTK_ENTRY(data->x));
text[1] = gtk_entry_get_text(GTK_ENTRY(data->y));
gtk_clist_append(GTK_CLIST(data->list), (gchar **) text);
set_buttons_sensitivity(data);
gint x = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->x));
gint y = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->y));
polygon_append_point(ObjectToPolygon(data->obj), x, y);
polygon_fill_info_tab(data->obj, data);
}
static void
remove_button_clicked(GtkWidget *widget, PolygonProperties_t *data)
{
gtk_clist_remove(GTK_CLIST(data->list), data->selected_row);
set_buttons_sensitivity(data);
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(data->store);
if (gtk_tree_selection_get_selected (data->selection, &model, &iter)) {
Polygon_t *polygon = ObjectToPolygon(data->obj);