Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/edb
Dir : e17/libs/edb/tools/edb_gtk_ed
Modified Files:
callbacks.c
Log Message:
fix for bug 0000018 where edb_gtk_ed would segv on removal of last list item
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edb/tools/edb_gtk_ed/callbacks.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- callbacks.c 24 Dec 2002 03:02:01 -0000 1.4
+++ callbacks.c 19 Aug 2004 00:46:13 -0000 1.5
@@ -83,11 +83,16 @@
gchar *text = NULL;
gchar t[256];
float val;
-
+
if (ignore_changes) return;
top = gtk_widget_get_toplevel(GTK_WIDGET(button));
w = gtk_object_get_data(GTK_OBJECT(top), "list");
gtk_clist_get_text(GTK_CLIST(w), row_selected, 1, &text);
+
+ /* make sure there is something to delete */
+ if (text == NULL)
+ return;
+
E_DB_DEL(db_file, text);
gtk_clist_remove(GTK_CLIST(w), row_selected);
e_db_flush();
@@ -119,10 +124,37 @@
{
gchar *key = NULL, *type = NULL;
GtkWidget *w, *top;
-
+
+ top = gtk_widget_get_toplevel(GTK_WIDGET(clist));
+
+ /* make sure we are within the bounds of the list */
+ if (row >= clist->rows)
+ {
+ row = clist->rows - 1;
+
+ /* there are no rows left so make sure all the boxes
+ and things are reset to blank or default */
+ if (row < 0)
+ {
+ w = gtk_object_get_data(GTK_OBJECT(top), "key");
+ gtk_entry_set_text(GTK_ENTRY(w), "");
+
+ w = gtk_object_get_data(GTK_OBJECT(top), "notebook1");
+ gtk_notebook_set_page(GTK_NOTEBOOK(w), 0);
+
+ w = gtk_object_get_data(GTK_OBJECT(top), "type");
+ gtk_option_menu_set_history(GTK_OPTION_MENU(w), 0);
+
+ w = gtk_object_get_data(GTK_OBJECT(top), "integer");
+ gtk_entry_set_text(GTK_ENTRY(w), "");
+ return;
+ }
+
+ gtk_clist_select_row(clist, row, 0);
+ }
+
ignore_changes ++;
row_selected = row;
- top = gtk_widget_get_toplevel(GTK_WIDGET(clist));
gtk_clist_get_text(clist, row, 1, &key);
gtk_clist_get_text(clist, row, 0, &type);
w = gtk_object_get_data(GTK_OBJECT(top), "key");
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs