api change review: de-privatization of GnomeDialog patch



since the general consensus of anyone who cared enough to respond was
that de-privatizing GnomeDialog was better than adding new apis, here's
a patch for that.

outside of libgnomeui it only impacts glade.

since the holidays are drawing near, i'll wait a bit longer before
giving up on a response, and in the meantime include a definition of
GnomeDialogPrivate in glade (however if you have approve powers a
response would be greatly appreciated).

thanks,
jacob
-- 
"In fact, can you imagine anything more terrifying than a zombie clown?"
	-- moby
? libgnomeui/ChangeLog.flc
? libgnomeui/Makefile.am2
? libgnomeui/gnome_segv
? libgnomeui/old-gnome-window-icon.c
Index: libgnomeui/gnome-dialog.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dialog.c,v
retrieving revision 1.82
diff -u -r1.82 gnome-dialog.c
--- libgnomeui/gnome-dialog.c	2001/12/10 22:52:10	1.82
+++ libgnomeui/gnome-dialog.c	2001/12/21 20:10:31
@@ -36,8 +36,6 @@
 #include "gnome-dialog-util.h"
 #include "gnome-marshal.h"
 
-#include <libgnomeuiP.h>
-
 enum {
   CLICKED,
   CLOSE,
@@ -134,11 +132,9 @@
 
   g_return_if_fail(dialog != NULL);
   g_return_if_fail(GNOME_IS_DIALOG(dialog));
-
-  dialog->_priv = g_new0(GnomeDialogPrivate, 1);
 
-  dialog->_priv->just_hide = FALSE;
-  dialog->_priv->click_closes = FALSE;
+  dialog->just_hide = FALSE;
+  dialog->click_closes = FALSE;
   dialog->buttons = NULL;
 
   /* FIXME:!!!!!!!!!!!!!! */
@@ -151,9 +147,9 @@
 		      gnome_preferences_get_dialog_position());
 		      */
   
-  dialog->_priv->accelerators = gtk_accel_group_new();
+  dialog->accelerators = gtk_accel_group_new();
   gtk_window_add_accel_group (GTK_WINDOW(dialog), 
-			      dialog->_priv->accelerators);
+			      dialog->accelerators);
 
   bf = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (bf), GTK_SHADOW_OUT);
@@ -181,21 +177,21 @@
 {
   GtkWidget * separator;
 
-  if (dialog->_priv->action_area)
+  if (dialog->action_area)
     return;
 
-  dialog->_priv->action_area = gtk_hbutton_box_new ();
+  dialog->action_area = gtk_hbutton_box_new ();
   /* FIXME!!!!!!! */
-  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->_priv->action_area), 0);
-  /* gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->_priv->action_area),
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area), 0);
+  /* gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog->action_area),
 			     gnome_preferences_get_button_layout()); */
 
-  gtk_button_box_set_spacing (GTK_BOX (dialog->_priv->action_area), 
+  gtk_button_box_set_spacing (GTK_BOX (dialog->action_area), 
 			      GNOME_PAD);
 
-  gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->_priv->action_area, 
+  gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area, 
 		    FALSE, TRUE, 0);
-  gtk_widget_show (dialog->_priv->action_area);
+  gtk_widget_show (dialog->action_area);
 
   separator = gtk_hseparator_new ();
   gtk_box_pack_end (GTK_BOX (dialog->vbox), separator, 
@@ -443,7 +439,7 @@
 
     button = gtk_button_new_from_stock (button_name);
     GTK_WIDGET_SET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT);
-    gtk_box_pack_start (GTK_BOX (dialog->_priv->action_area), button, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (dialog->action_area), button, TRUE, TRUE, 0);
 
     gtk_widget_grab_default (button);
     gtk_widget_show (button);
@@ -531,7 +527,7 @@
     gnome_dialog_init_action_area (dialog);    
 
     GTK_WIDGET_SET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT);
-    gtk_box_pack_start (GTK_BOX (dialog->_priv->action_area), button, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (dialog->action_area), button, TRUE, TRUE, 0);
 
     gtk_widget_grab_default (button);
     gtk_widget_show (button);
@@ -838,7 +834,7 @@
   g_return_if_fail(dialog != NULL);
   g_return_if_fail(GNOME_IS_DIALOG(dialog));
 
-  dialog->_priv->click_closes = click_closes;
+  dialog->click_closes = click_closes;
 }
 
 /**
@@ -859,10 +855,9 @@
   g_return_if_fail(dialog != NULL);
   g_return_if_fail(GNOME_IS_DIALOG(dialog));
 
-  dialog->_priv->just_hide = just_hide;
+  dialog->just_hide = just_hide;
 }
 
-
 /**
  * gnome_dialog_set_sensitive: Set the sensitivity of a button.
  * @dialog: #GnomeDialog to affect.
@@ -985,7 +980,7 @@
     /*FIXME*/
     gtk_widget_add_accelerator(GTK_WIDGET(list->data),
 			       "clicked",
-			       dialog->_priv->accelerators,
+			       dialog->accelerators,
 			       accelerator_key,
 			       accelerator_mods,
 			       GTK_ACCEL_VISIBLE);
@@ -1040,7 +1035,7 @@
     if (list->data == button) {
 	      gboolean click_closes;
   
-	      click_closes = GNOME_DIALOG(dialog)->_priv->click_closes;
+	      click_closes = GNOME_DIALOG(dialog)->click_closes;
 
 	      gtk_signal_emit (GTK_OBJECT (dialog), dialog_signals[CLICKED], 
 			       which);
@@ -1115,9 +1110,6 @@
 
   dialog = GNOME_DIALOG(object);
 
-  g_free(dialog->_priv);
-  dialog->_priv = NULL;
-
   if (G_OBJECT_CLASS(parent_class)->finalize)
     (* (G_OBJECT_CLASS(parent_class)->finalize))(object);
 }
@@ -1129,7 +1121,7 @@
 
   gtk_widget_hide(GTK_WIDGET(dialog));
 
-  if ( ! dialog->_priv->just_hide ) {
+  if ( ! dialog->just_hide ) {
     gtk_widget_destroy (GTK_WIDGET (dialog));
   }
 }
Index: libgnomeui/gnome-dialog.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-dialog.h,v
retrieving revision 1.46
diff -u -r1.46 gnome-dialog.h
--- libgnomeui/gnome-dialog.h	2001/09/08 13:53:06	1.46
+++ libgnomeui/gnome-dialog.h	2001/12/21 20:10:31
@@ -53,9 +53,14 @@
   GtkWindow window;
   /*< public >*/
   GtkWidget * vbox;
-  GList *buttons;
   /*< private >*/
-  GnomeDialogPrivate *_priv;
+  GList *buttons;
+  GtkWidget      *action_area; /* A button box, not an hbox */
+
+  GtkAccelGroup  *accelerators;
+
+  unsigned int    click_closes : 1;
+  unsigned int    just_hide : 1;
 };
 
 struct _GnomeDialogClass
Index: libgnomeui/libgnomeuiP.h
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/libgnomeuiP.h,v
retrieving revision 1.14
diff -u -r1.14 libgnomeuiP.h
--- libgnomeui/libgnomeuiP.h	2001/12/07 18:28:23	1.14
+++ libgnomeui/libgnomeuiP.h	2001/12/21 20:10:31
@@ -39,15 +39,6 @@
 
 void gnome_type_init(void);
 
-struct _GnomeDialogPrivate {
-  GtkWidget      *action_area; /* A button box, not an hbox */
-
-  GtkAccelGroup  *accelerators;
-
-  unsigned int    click_closes : 1;
-  unsigned int    just_hide : 1;
-};
-
 G_END_DECLS
 
 #endif /* LIBGNOMEUIP_H */
Index: glade/glade-gnome.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/glade/glade-gnome.c,v
retrieving revision 1.56
diff -u -r1.56 glade-gnome.c
--- glade/glade-gnome.c	2001/12/12 15:22:36	1.56
+++ glade/glade-gnome.c	2001/12/21 20:10:31
@@ -307,7 +307,7 @@
 
     glade_standard_build_children (self, w, info);
 
-    aa = dialog->_priv->action_area;
+    aa = dialog->action_area;
     if (!aa)
 	return;
 
@@ -591,7 +591,7 @@
     if (!strcmp(childname, "vbox"))
 	return GNOME_DIALOG(parent)->vbox;
     else if (!strcmp (childname, "action_area"))
-	return GNOME_DIALOG (parent)->_priv->action_area;
+	return GNOME_DIALOG (parent)->action_area;
 
     return NULL;
 }
@@ -623,7 +623,7 @@
     if (!strcmp(childname, "vbox"))
 	return GNOME_DIALOG(parent)->vbox;
     else if (!strcmp(childname, "action_area"))
-	return GNOME_DIALOG(parent)->_priv->action_area;
+	return GNOME_DIALOG(parent)->action_area;
     else if (!strcmp(childname, "notebook"))
 	return GNOME_PROPERTY_BOX(parent)->notebook;
     else if (!strcmp(childname, "ok_button"))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]