[Glade-devel] [PATCH] Cut/Paste and Undo/Redo crash fix.
- From: bighead users sourceforge net (Archit Baweja)
- Subject: [Glade-devel] [PATCH] Cut/Paste and Undo/Redo crash fix.
- Date: Fri, 25 Apr 2003 17:26:19 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
The following patch primarily fixes the cut/paste thru the undo/redo patch I
sent earlier. The in-your-face crashes are taken care of.
This patch also fixes the undo/redo with create/delete. When you undo a new
widget addition and "redo" it, the contents of the widget are not redrawn. Just
a simple gtk_widget_show_all(), thats all.
===File ~/Projects/gnome2/glade3/glade-3-cut-paste-replace-undo-redo-crash-fix.patch===
? .cvsignore
? autom4te-2.53.cache
? glade-3-cut-paste-replace-undo-redo-crash-fix.patch
? glade-3.desktop
? glade3-clipboard-and-undo.patch
? stamp-h1
? src/blah.glade3
? src/glade-3
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glade3/ChangeLog,v
retrieving revision 1.112
diff -u -r1.112 ChangeLog
- --- ChangeLog 23 Apr 2003 02:42:11 -0000 1.112
+++ ChangeLog 25 Apr 2003 21:20:06 -0000
@@ -1,3 +1,17 @@
+2003-04-25 Archit Baweja <bighead users sourceforge net>
+
+ * src/glade-clipboard-view.c (glade_clipboard_view_remove): remove
+ widget based on the pointer, not selection.
+
+ * src/glade-clipboard.c (glade_clipboard_add): set clipboard->curr
+ to the widget added.
+ (glade_clipboard_cut): return placeholder.
+ (glade_clipboard_paste): set active_placeholder = NULL. Stops crashes
+ when undo/redo-ing cut/paste.
+
+ * src/glade-command.c (glade_command_create_execute): show all widgets.
+ Previously forgot to show the contents.
+
2003-04-22 Joaquin Cuenca Abela <e98cuenc yahoo com>
* src/main.c: remove the command line that you usually get on a
Index: src/glade-clipboard-view.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-clipboard-view.c,v
retrieving revision 1.4
diff -u -r1.4 glade-clipboard-view.c
- --- src/glade-clipboard-view.c 12 Apr 2002 09:01:35 -0000 1.4
+++ src/glade-clipboard-view.c 25 Apr 2003 21:20:07 -0000
@@ -238,12 +238,19 @@
GtkTreeSelection *sel;
GtkTreeIter iter;
GtkTreeModel *model;
+ GladeWidget *clip_widget;
g_return_if_fail (GLADE_IS_CLIPBOARD_VIEW (view));
g_return_if_fail (GLADE_IS_WIDGET (widget));
model = GTK_TREE_MODEL (view->model);
- - sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->widget));
- - if (gtk_tree_selection_get_selected (sel, &model, &iter))
- - gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ do {
+ gtk_tree_model_get (model, &iter, 0, &clip_widget, -1);
+ if (widget == clip_widget)
+ break;
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+
+ gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
}
Index: src/glade-clipboard.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-clipboard.c,v
retrieving revision 1.8
diff -u -r1.8 glade-clipboard.c
- --- src/glade-clipboard.c 23 Apr 2003 02:42:12 -0000 1.8
+++ src/glade-clipboard.c 25 Apr 2003 21:20:07 -0000
@@ -112,6 +112,7 @@
* latest addition, to currently selected widget in the clipboard.
*/
clipboard->widgets = g_list_prepend (clipboard->widgets, widget);
+ clipboard->curr = widget;
/*
* If there is view present, update it.
@@ -147,9 +148,11 @@
*
* Cut a GladeWidget onto the Clipboard.
**/
- -void
+GladePlaceholder *
glade_clipboard_cut (GladeClipboard * clipboard, GladeWidget * widget)
{
+ GladePlaceholder *placeholder = NULL;
+
g_return_if_fail (GLADE_IS_CLIPBOARD (clipboard));
g_return_if_fail (GLADE_IS_WIDGET (widget));
@@ -160,11 +163,13 @@
*/
gtk_widget_ref (GTK_WIDGET (widget->widget));
if (widget->parent)
- - glade_widget_replace_with_placeholder (widget);
+ placeholder = glade_widget_replace_with_placeholder (widget);
else
gtk_widget_hide (widget->widget);
glade_clipboard_add (clipboard, widget);
+
+ return placeholder;
}
/**
@@ -246,6 +251,8 @@
*/
if (GTK_IS_WIDGET (widget->widget))
gtk_widget_show_all (GTK_WIDGET (widget->widget));
+
+ gpw->active_placeholder = NULL;
/*
* Finally remove widget from clipboard.
Index: src/glade-clipboard.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-clipboard.h,v
retrieving revision 1.3
diff -u -r1.3 glade-clipboard.h
- --- src/glade-clipboard.h 13 Mar 2003 23:12:03 -0000 1.3
+++ src/glade-clipboard.h 25 Apr 2003 21:20:07 -0000
@@ -25,12 +25,12 @@
GType glade_clipboard_get_type ();
GladeClipboard *glade_clipboard_new ();
- -void glade_clipboard_cut (GladeClipboard * clipboard,
- - GladeWidget * widget);
- -void glade_clipboard_copy (GladeClipboard * clipboard,
- - GladeWidget * widget);
- -void glade_clipboard_paste (GladeClipboard * clipboard,
- - GladePlaceholder * placeholder);
+GladePlaceholder * glade_clipboard_cut (GladeClipboard * clipboard,
+ GladeWidget * widget);
+void glade_clipboard_copy (GladeClipboard * clipboard,
+ GladeWidget * widget);
+void glade_clipboard_paste (GladeClipboard * clipboard,
+ GladePlaceholder * placeholder);
G_END_DECLS
#endif /* __GLADE_CLIPBOARD_H__ */
Index: src/glade-command.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-command.c,v
retrieving revision 1.6
diff -u -r1.6 glade-command.c
- --- src/glade-command.c 23 Apr 2003 02:42:12 -0000 1.6
+++ src/glade-command.c 25 Apr 2003 21:20:07 -0000
@@ -505,9 +505,11 @@
glade_project_selection_clear (widget->project, FALSE);
glade_project_add_widget (widget->project, widget);
- - if (GTK_IS_WIDGET (widget->widget))
+ if (GTK_IS_WIDGET (widget->widget)) {
glade_project_selection_add (widget, TRUE);
- -
+ gtk_widget_show_all (GTK_WIDGET (widget->widget));
+ }
+
return FALSE;
}
@@ -644,13 +646,15 @@
{
glade_clipboard_paste (me->clipboard, me->placeholder);
+ me->placeholder = NULL;
+
return TRUE;
}
static gboolean
glade_command_cut_execute (GladeCommandCutPaste *me)
{
- - glade_clipboard_cut (me->clipboard, me->widget);
+ me->placeholder = glade_clipboard_cut (me->clipboard, me->widget);
return TRUE;
}
============================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 and Gnu Privacy Guard <http://www.gnupg.org/>
iD8DBQE+qaf72rWNPKmGjMcRAnCKAJ0ZH+ISFNJh2wbfL39X/XSpwT0LBgCfV3OF
enzsSmZlIWXUFRuDbpedYCU=
=X9T4
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]