[Glade-devel] GtkNotebook decrease pages fix.
- From: bighead users sourceforge net (Archit Baweja)
- Subject: [Glade-devel] GtkNotebook decrease pages fix.
- Date: Fri, 8 Aug 2003 01:51:08 +0530
Hi
I thought I'd sent this patch in to the list for review, but I can't remember.
And neither does it show up in the archives. So I send it again.
Patch for decreasing the number of pages in a GtkNotebook. Bit of luck in
getting this fix (see in patch where I mention old_size-1).
Please review,
Cheers!
Archit Baweja
===File ~/Projects/gnome2/patches/glade3-notebook-decrease-pages-fix.patch===
? autom4te-2.53.cache
? glade-3.desktop
? stamp-h1
? src/bah.glade3
? src/do.glade3
? src/dont.glade3
? src/foo.glade3
? src/foobar.glade3
? src/glade-3
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glade3/ChangeLog,v
retrieving revision 1.180
diff -u -r1.180 ChangeLog
--- ChangeLog 6 Aug 2003 09:41:46 -0000 1.180
+++ ChangeLog 6 Aug 2003 22:56:44 -0000
@@ -1,3 +1,8 @@
+2003-08-07 Archit Baweja <bighead users sourceforge net>
+
+ * src/glade-gtk.c (glade_gtk_notebook_set_n_pages): when number of
+ pages decrease delete widget and remove from project. Works now.
+
2003-08-05 Archit Baweja <bighead users sourceforge net>
* src/glade-property.c (glade_property_set): when using custom
Index: src/glade-gtk.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-gtk.c,v
retrieving revision 1.28
diff -u -r1.28 glade-gtk.c
--- src/glade-gtk.c 14 Jun 2003 15:53:49 -0000 1.28
+++ src/glade-gtk.c 6 Aug 2003 22:56:47 -0000
@@ -282,14 +282,28 @@
}
} else {/* new_size < old_size */
/* The notebook has shrunk. Remove pages */
+ GladeWidget *child_gwidget;
+ GtkWidget *child_widget;
+
+ /*
+ * Thing to remember is that GtkNotebook starts the
+ * page numbers from 0, not 1 (C-style). So we need to do
+ * old_size-1, where we're referring to "nth" widget.
+ */
while (old_size > new_size) {
- /*
- * This is broken, we should also remove the widgets that
- * are in the page from the project!
+ /* Get the last widget. */
+ child_widget = gtk_notebook_get_nth_page (notebook, old_size-1);
+ child_gwidget = glade_widget_get_from_gtk_widget (child_widget);
+
+ /*
+ * If we got it, and its not a placeholder, remove it
+ * from project.
*/
-#if 0
- gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), old_size);
-#endif
+ if (child_gwidget) {
+ glade_project_remove_widget (child_gwidget);
+ }
+
+ gtk_notebook_remove_page (notebook, old_size-1);
old_size--;
}
}
============================================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]