]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkitemfactory.c
Estonian translation update by Ivar Smolin.
[~andy/gtk] / gtk / gtkitemfactory.c
index 877ccab11b6be30eface2b1aedd10e2455465196..55aff410ef64df23abe1743aa9baf54fe342d3fd 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include       "config.h"
+#include       <config.h>
 
+#undef GTK_DISABLE_DEPRECATED
 #include       "gtkitemfactory.h"
-#include       "gtk/gtksignal.h"
-#include       "gtk/gtkoptionmenu.h"
-#include       "gtk/gtkmenubar.h"
-#include       "gtk/gtkmenu.h"
-#include       "gtk/gtkmenuitem.h"
-#include       "gtk/gtkradiomenuitem.h"
-#include       "gtk/gtkcheckmenuitem.h"
-#include       "gtk/gtkimagemenuitem.h"
-#include       "gtk/gtktearoffmenuitem.h"
-#include       "gtk/gtkaccelmap.h"
-#include       "gtk/gtkaccellabel.h"
+#include       "gtkoptionmenu.h"
+#include       "gtkmenubar.h"
+#include       "gtkmenu.h"
+#include       "gtkmenuitem.h"
+#include       "gtkradiomenuitem.h"
+#include       "gtkcheckmenuitem.h"
+#include       "gtkimagemenuitem.h"
+#include       "gtktearoffmenuitem.h"
+#include       "gtkaccelmap.h"
+#include       "gtkaccellabel.h"
 #include        "gdk/gdkkeysyms.h"
-#include       "gtk/gtkimage.h"
-#include       "gtk/gtkstock.h"
-#include       "gtk/gtkiconfactory.h"
+#include       "gtkimage.h"
+#include       "gtkstock.h"
+#include       "gtkiconfactory.h"
+#include       "gtkintl.h"
 #include       <string.h>
 #include       <fcntl.h>
 #ifdef HAVE_UNISTD_H
 #endif
 #include       <stdio.h>
 
-#ifdef G_OS_WIN32
-#include       <io.h>          /* For _open and _close */
-
-#ifndef S_ISREG
-#define S_ISREG(mode) ((mode)&_S_IFREG)
-#endif
-#endif
-
+#include "gtkalias.h"
 
 /* --- defines --- */
 #define                ITEM_FACTORY_STRING     ((gchar*) item_factory_string)
@@ -79,18 +73,12 @@ struct _GtkIFCBData
 
 
 /* --- prototypes --- */
-static void    gtk_item_factory_class_init             (GtkItemFactoryClass  *klass);
-static void    gtk_item_factory_init                   (GtkItemFactory       *ifactory);
 static void    gtk_item_factory_destroy                (GtkObject            *object);
 static void    gtk_item_factory_finalize               (GObject              *object);
 
 
 /* --- static variables --- */
-static GtkItemFactoryClass *gtk_item_factory_class = NULL;
-static gpointer          parent_class = NULL;
-static const gchar     *item_factory_string = "Gtk-<ItemFactory>";
-static GMemChunk       *ifactory_item_chunks = NULL;
-static GMemChunk       *ifactory_cb_data_chunks = NULL;
+static const gchar      item_factory_string[] = "Gtk-<ItemFactory>";
 static GQuark           quark_popup_data = 0;
 static GQuark           quark_if_menu_pos = 0;
 static GQuark           quark_item_factory = 0;
@@ -109,57 +97,20 @@ static GQuark               quark_type_separator_item = 0;
 static GQuark           quark_type_branch = 0;
 static GQuark           quark_type_last_branch = 0;
 
+G_DEFINE_TYPE (GtkItemFactory, gtk_item_factory, GTK_TYPE_OBJECT)
 
 /* --- functions --- */
-GtkType
-gtk_item_factory_get_type (void)
-{
-  static GtkType item_factory_type = 0;
-  
-  if (!item_factory_type)
-    {
-      static const GtkTypeInfo item_factory_info =
-      {
-       "GtkItemFactory",
-       sizeof (GtkItemFactory),
-       sizeof (GtkItemFactoryClass),
-       (GtkClassInitFunc) gtk_item_factory_class_init,
-       (GtkObjectInitFunc) gtk_item_factory_init,
-       /* reserved_1 */ NULL,
-       /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
-      };
-      
-      item_factory_type = gtk_type_unique (GTK_TYPE_OBJECT, &item_factory_info);
-    }
-  
-  return item_factory_type;
-}
-
 static void
 gtk_item_factory_class_init (GtkItemFactoryClass  *class)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (class);
   GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
 
-  gtk_item_factory_class = class;
-  parent_class = g_type_class_peek_parent (class);
-
   gobject_class->finalize = gtk_item_factory_finalize;
 
   object_class->destroy = gtk_item_factory_destroy;
 
   class->item_ht = g_hash_table_new (g_str_hash, g_str_equal);
-  ifactory_item_chunks =
-    g_mem_chunk_new ("GtkItemFactoryItem",
-                    sizeof (GtkItemFactoryItem),
-                    sizeof (GtkItemFactoryItem) * ITEM_BLOCK_SIZE,
-                    G_ALLOC_ONLY);
-  ifactory_cb_data_chunks =
-    g_mem_chunk_new ("GtkIFCBData",
-                    sizeof (GtkIFCBData),
-                    sizeof (GtkIFCBData) * ITEM_BLOCK_SIZE,
-                    G_ALLOC_AND_FREE);
 
   quark_popup_data             = g_quark_from_static_string ("GtkItemFactory-popup-data");
   quark_if_menu_pos            = g_quark_from_static_string ("GtkItemFactory-menu-position");
@@ -183,10 +134,6 @@ gtk_item_factory_class_init (GtkItemFactoryClass  *class)
 static void
 gtk_item_factory_init (GtkItemFactory      *ifactory)
 {
-  GtkObject *object;
-
-  object = GTK_OBJECT (ifactory);
-
   ifactory->path = NULL;
   ifactory->accel_group = NULL;
   ifactory->widget = NULL;
@@ -207,9 +154,13 @@ gtk_item_factory_init (GtkItemFactory          *ifactory)
  * @returns: a new #GtkItemFactory
  * 
  * Creates a new #GtkItemFactory.
+ *
+ * Beware that the returned object does not have a floating reference.
+ *
+ * Deprecated: 2.4:    
  */
 GtkItemFactory*
-gtk_item_factory_new (GtkType       container_type,
+gtk_item_factory_new (GType         container_type,
                      const gchar   *path,
                      GtkAccelGroup *accel_group)
 {
@@ -217,7 +168,7 @@ gtk_item_factory_new (GtkType            container_type,
 
   g_return_val_if_fail (path != NULL, NULL);
 
-  ifactory = gtk_type_new (GTK_TYPE_ITEM_FACTORY);
+  ifactory = g_object_new (GTK_TYPE_ITEM_FACTORY, NULL);
   gtk_item_factory_construct (ifactory, container_type, path, accel_group);
 
   return ifactory;
@@ -248,8 +199,8 @@ gtk_item_factory_item_remove_widget (GtkWidget              *widget,
                                     GtkItemFactoryItem *item)
 {
   item->widgets = g_slist_remove (item->widgets, widget);
-  gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory);
-  gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_path);
+  g_object_set_qdata (G_OBJECT (widget), quark_item_factory, NULL);
+  g_object_set_qdata (G_OBJECT (widget), quark_item_path, NULL);
 }
 
 /**
@@ -257,8 +208,8 @@ gtk_item_factory_item_remove_widget (GtkWidget              *widget,
  * @accel_widget:     widget to install an accelerator on 
  * @full_path:       the full path for the @accel_widget 
  * @accel_group:      the accelerator group to install the accelerator in
- * @accel_key:        key value of the accelerator
- * @accel_mods:       modifier combination of the accelerator
+ * @keyval:           key value of the accelerator
+ * @modifiers:        modifier combination of the accelerator
  *
  * Installs an accelerator for @accel_widget in @accel_group, that causes
  * the ::activate signal to be emitted if the accelerator is activated.
@@ -267,13 +218,18 @@ gtk_item_factory_item_remove_widget (GtkWidget            *widget,
  * saving/restoring functionality provided by gtk_accel_map_save() and
  * gtk_accel_map_load(), even if they haven't been created by an item
  * factory. 
+ *
+ * Deprecated: 2.4: The recommended API for this purpose are the functions 
+ * gtk_menu_item_set_accel_path() and gtk_widget_set_accel_path(); don't 
+ * use gtk_item_factory_add_foreign() in new code, since it is likely to
+ * be removed in the future.
  */
 void
 gtk_item_factory_add_foreign (GtkWidget      *accel_widget,
                              const gchar    *full_path,
                              GtkAccelGroup  *accel_group,
-                             guint           accel_key,
-                             GdkModifierType accel_mods)
+                             guint           keyval,
+                             GdkModifierType modifiers)
 {
   GtkItemFactoryClass *class;
   GtkItemFactoryItem *item;
@@ -283,12 +239,12 @@ gtk_item_factory_add_foreign (GtkWidget      *accel_widget,
 
   class = gtk_type_class (GTK_TYPE_ITEM_FACTORY);
 
-  accel_key = accel_key != GDK_VoidSymbol ? accel_key : 0;
+  keyval = keyval != GDK_VoidSymbol ? keyval : 0;
 
   item = g_hash_table_lookup (class->item_ht, full_path);
   if (!item)
     {
-      item = g_chunk_new (GtkItemFactoryItem, ifactory_item_chunks);
+      item = g_slice_new (GtkItemFactoryItem);
 
       item->path = g_strdup (full_path);
       item->widgets = NULL;
@@ -297,34 +253,34 @@ gtk_item_factory_add_foreign (GtkWidget      *accel_widget,
     }
 
   item->widgets = g_slist_prepend (item->widgets, accel_widget);
-  gtk_signal_connect (GTK_OBJECT (accel_widget),
-                     "destroy",
-                     GTK_SIGNAL_FUNC (gtk_item_factory_item_remove_widget),
-                     item);
+  g_signal_connect (accel_widget,
+                   "destroy",
+                   G_CALLBACK (gtk_item_factory_item_remove_widget),
+                   item);
 
   /* set the item path for the widget
    */
-  gtk_object_set_data_by_id (GTK_OBJECT (accel_widget), quark_item_path, item->path);
+  g_object_set_qdata (G_OBJECT (accel_widget), quark_item_path, item->path);
   gtk_widget_set_name (accel_widget, item->path);
   if (accel_group)
     {
-      gtk_accel_group_ref (accel_group);
-      gtk_object_set_data_by_id_full (GTK_OBJECT (accel_widget),
-                                     quark_accel_group,
-                                     accel_group,
-                                     (GtkDestroyNotify) gtk_accel_group_unref);
+      g_object_ref (accel_group);
+      g_object_set_qdata_full (G_OBJECT (accel_widget),
+                              quark_accel_group,
+                              accel_group,
+                              g_object_unref);
     }
   else
-    gtk_object_set_data_by_id (GTK_OBJECT (accel_widget), quark_accel_group, NULL);
+    g_object_set_qdata (G_OBJECT (accel_widget), quark_accel_group, NULL);
 
   /* install defined accelerators
    */
-  if (gtk_signal_lookup ("activate", GTK_OBJECT_TYPE (accel_widget)))
+  if (g_signal_lookup ("activate", G_TYPE_FROM_INSTANCE (accel_widget)))
     {
       if (accel_group)
        {
-         gtk_accel_map_add_entry (full_path, accel_key, accel_mods);
-         _gtk_widget_set_accel_path (accel_widget, full_path, accel_group);
+         gtk_accel_map_add_entry (full_path, keyval, modifiers);
+         gtk_widget_set_accel_path (accel_widget, full_path, accel_group);
        }
     }
 }
@@ -332,7 +288,7 @@ gtk_item_factory_add_foreign (GtkWidget      *accel_widget,
 static void
 ifactory_cb_data_free (gpointer mem)
 {
-  g_mem_chunk_free (ifactory_cb_data_chunks, mem);
+  g_slice_free (GtkIFCBData, mem);
 }
 
 static void
@@ -349,7 +305,8 @@ gtk_item_factory_add_item (GtkItemFactory           *ifactory,
   GtkItemFactoryClass *class;
   GtkItemFactoryItem *item;
   gchar *fpath;
-  guint keyval, mods;
+  guint keyval;
+  GdkModifierType mods;
   
   g_return_if_fail (widget != NULL);
   g_return_if_fail (item_type != NULL);
@@ -361,32 +318,32 @@ gtk_item_factory_add_item (GtkItemFactory         *ifactory,
   if (GTK_IS_MENU (widget))
     gtk_menu_set_accel_group ((GtkMenu*) widget, ifactory->accel_group);
 
-  /* connect callback if neccessary
+  /* connect callback if necessary
    */
   if (callback)
     {
       GtkIFCBData *data;
 
-      data = g_chunk_new (GtkIFCBData, ifactory_cb_data_chunks);
+      data = g_slice_new (GtkIFCBData);
       data->func = callback;
       data->callback_type = callback_type;
       data->func_data = callback_data;
       data->callback_action = callback_action;
 
-      gtk_object_weakref (GTK_OBJECT (widget),
-                         ifactory_cb_data_free,
-                         data);
-      gtk_signal_connect (GTK_OBJECT (widget),
-                         "activate",
-                         GTK_SIGNAL_FUNC (gtk_item_factory_callback_marshal),
-                         data);
+      g_object_weak_ref (G_OBJECT (widget),
+                        (GWeakNotify) ifactory_cb_data_free,
+                        data);
+      g_signal_connect (widget,
+                       "activate",
+                       G_CALLBACK (gtk_item_factory_callback_marshal),
+                       data);
     }
 
   /* link the widget into its item-entry
    * and keep back pointer on both the item factory and the widget
    */
-  gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_action, GUINT_TO_POINTER (callback_action));
-  gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory, ifactory);
+  g_object_set_qdata (G_OBJECT (widget), quark_action, GUINT_TO_POINTER (callback_action));
+  g_object_set_qdata (G_OBJECT (widget), quark_item_factory, ifactory);
   if (accelerator)
     gtk_accelerator_parse (accelerator, &keyval, &mods);
   else
@@ -416,10 +373,12 @@ gtk_item_factory_add_item (GtkItemFactory         *ifactory,
  *    menu items will be added, or %NULL to create a new one
  * 
  * Initializes an item factory.
+ *
+ * Deprecated: 2.4:
  */  
 void
 gtk_item_factory_construct (GtkItemFactory     *ifactory,
-                           GtkType              container_type,
+                           GType                container_type,
                            const gchar         *path,
                            GtkAccelGroup       *accel_group)
 {
@@ -428,8 +387,8 @@ gtk_item_factory_construct (GtkItemFactory  *ifactory,
   g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
   g_return_if_fail (ifactory->accel_group == NULL);
   g_return_if_fail (path != NULL);
-  if (!gtk_type_is_a (container_type, GTK_TYPE_OPTION_MENU))
-    g_return_if_fail (gtk_type_is_a (container_type, GTK_TYPE_MENU_SHELL));
+  if (!g_type_is_a (container_type, GTK_TYPE_OPTION_MENU))
+    g_return_if_fail (g_type_is_a (container_type, GTK_TYPE_MENU_SHELL));
 
   len = strlen (path);
 
@@ -442,7 +401,7 @@ gtk_item_factory_construct (GtkItemFactory  *ifactory,
   if (accel_group)
     {
       ifactory->accel_group = accel_group;
-      gtk_accel_group_ref (ifactory->accel_group);
+      g_object_ref (ifactory->accel_group);
     }
   else
     ifactory->accel_group = gtk_accel_group_new ();
@@ -451,8 +410,7 @@ gtk_item_factory_construct (GtkItemFactory  *ifactory,
   ifactory->widget = g_object_connect (gtk_widget_new (container_type, NULL),
                                       "signal::destroy", gtk_widget_destroyed, &ifactory->widget,
                                       NULL);
-  gtk_object_ref (GTK_OBJECT (ifactory));
-  gtk_object_sink (GTK_OBJECT (ifactory));
+  g_object_ref_sink (ifactory);
 
   gtk_item_factory_add_item (ifactory,
                             "", NULL,
@@ -470,6 +428,8 @@ gtk_item_factory_construct (GtkItemFactory  *ifactory,
  * Finds an item factory which has been constructed using the 
  * <literal>"&lt;name&gt;"</literal> prefix of @path as the @path argument 
  * for gtk_item_factory_new().
+ *
+ * Deprecated: 2.4:
  */
 GtkItemFactory*
 gtk_item_factory_from_path (const gchar      *path)
@@ -523,10 +483,9 @@ gtk_item_factory_destroy (GtkObject *object)
 
       dobj = GTK_OBJECT (ifactory->widget);
 
-      gtk_object_ref (dobj);
-      gtk_object_sink (dobj);
+      g_object_ref_sink (dobj);
       gtk_object_destroy (dobj);
-      gtk_object_unref (dobj);
+      g_object_unref (dobj);
 
       ifactory->widget = NULL;
     }
@@ -537,13 +496,13 @@ gtk_item_factory_destroy (GtkObject *object)
       GSList *link;
       
       for (link = item->widgets; link; link = link->next)
-       if (gtk_object_get_data_by_id (link->data, quark_item_factory) == ifactory)
-         gtk_object_remove_data_by_id (link->data, quark_item_factory);
+       if (g_object_get_qdata (link->data, quark_item_factory) == ifactory)
+         g_object_set_qdata (link->data, quark_item_factory, NULL);
     }
   g_slist_free (ifactory->items);
   ifactory->items = NULL;
 
-  GTK_OBJECT_CLASS (parent_class)->destroy (object);
+  GTK_OBJECT_CLASS (gtk_item_factory_parent_class)->destroy (object);
 }
 
 static void
@@ -555,14 +514,14 @@ gtk_item_factory_finalize (GObject *object)
 
   ifactory = GTK_ITEM_FACTORY (object);
 
-  gtk_accel_group_unref (ifactory->accel_group);
+  g_object_unref (ifactory->accel_group);
   g_free (ifactory->path);
   g_assert (ifactory->widget == NULL);
 
   if (ifactory->translate_notify)
     ifactory->translate_notify (ifactory->translate_data);
   
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_item_factory_parent_class)->finalize (object);
 }
 
 /**
@@ -571,43 +530,72 @@ gtk_item_factory_finalize (GObject *object)
  * @returns: the item factory from which @widget was created, or %NULL
  *
  * Obtains the item factory from which a widget was created.
+ *
+ * Deprecated: 2.4
  */
 GtkItemFactory*
 gtk_item_factory_from_widget (GtkWidget               *widget)
 {
+  GtkItemFactory *ifactory;
+
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
-  return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_factory);
+  ifactory = g_object_get_qdata (G_OBJECT (widget), quark_item_factory);
+
+  if (ifactory == NULL && GTK_IS_MENU_ITEM (widget) &&
+      GTK_MENU_ITEM (widget)->submenu != NULL) 
+    {
+      GtkWidget *menu = GTK_MENU_ITEM (widget)->submenu;
+      ifactory = g_object_get_qdata (G_OBJECT (menu), quark_item_factory);
+    }
+
+  return ifactory;
 }
 
 /**
  * gtk_item_factory_path_from_widget:
  * @widget: a widget
- * @returns: the full path to @widget if it been created by an item factory, 
- *   %NULL otherwise 
+ * @returns: the full path to @widget if it has been created by an item
+ *   factory, %NULL otherwise. This value is owned by GTK+ and must not be
+ *   modified or freed.
  * 
  * If @widget has been created by an item factory, returns the full path
  * to it. (The full path of a widget is the concatenation of the factory 
  * path specified in gtk_item_factory_new() with the path specified in the 
  * #GtkItemFactoryEntry from which the widget was created.)
+ *
+ * Deprecated: 2.4:
  */
-gchar*
+G_CONST_RETURN gchar*
 gtk_item_factory_path_from_widget (GtkWidget       *widget)
 {
+  gchar* path;
+
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
-  return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_path);
+  path = g_object_get_qdata (G_OBJECT (widget), quark_item_path);
+
+  if (path == NULL && GTK_IS_MENU_ITEM (widget) &&
+      GTK_MENU_ITEM (widget)->submenu != NULL) 
+    {
+      GtkWidget *menu = GTK_MENU_ITEM (widget)->submenu;
+      path = g_object_get_qdata (G_OBJECT (menu), quark_item_path);
+    }
+
+  return path;
 }
 
 /**
  * gtk_item_factory_create_items:
  * @ifactory: a #GtkItemFactory
  * @n_entries: the length of @entries
- * @entries: an array of #GtkItemFactoryEntry<!>s whose @callback members
+ * @entries: an array of #GtkItemFactoryEntry<!-- -->s whose @callback members
  *    must by of type #GtkItemFactoryCallback1
  * @callback_data: data passed to the callback functions of all entries
  *
  * Creates the menu items from the @entries.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_create_items (GtkItemFactory     *ifactory,
@@ -622,12 +610,14 @@ gtk_item_factory_create_items (GtkItemFactory        *ifactory,
  * gtk_item_factory_create_items_ac:
  * @ifactory: a #GtkItemFactory
  * @n_entries: the length of @entries
- * @entries: an array of #GtkItemFactoryEntry<!>s 
+ * @entries: an array of #GtkItemFactoryEntry<!-- -->s 
  * @callback_data: data passed to the callback functions of all entries
- * @callback_data: 1 if the callback functions in @entries are of type
+ * @callback_type: 1 if the callback functions in @entries are of type
  *    #GtkItemFactoryCallback1, 2 if they are of type #GtkItemFactoryCallback2 
  *
  * Creates the menu items from the @entries.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_create_items_ac (GtkItemFactory      *ifactory,
@@ -662,6 +652,8 @@ gtk_item_factory_create_items_ac (GtkItemFactory      *ifactory,
  * If the widget corresponding to @path is a menu item which opens a 
  * submenu, then the submenu is returned. If you are interested in the menu 
  * item, use gtk_item_factory_get_item() instead.
+ *
+ * Deprecated: 2.4:
  */
 GtkWidget*
 gtk_item_factory_get_widget (GtkItemFactory *ifactory,
@@ -708,8 +700,13 @@ gtk_item_factory_get_widget (GtkItemFactory *ifactory,
  * @returns: the widget which corresponds to the given action, or %NULL
  *   if no widget was found
  *
- * Obtains the widget which was constructed from the first #GtkItemFactoryEntry
+ * Obtains the widget which was constructed from the #GtkItemFactoryEntry
  * with the given @action.
+ *
+ * If there are multiple items with the same action, the result is 
+ * undefined.
+ *
+ * Deprecated: 2.4:
  */
 GtkWidget*
 gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory,
@@ -725,8 +722,8 @@ gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory,
       GSList *link;
 
       for (link = item->widgets; link; link = link->next)
-       if (gtk_object_get_data_by_id (link->data, quark_item_factory) == ifactory &&
-           gtk_object_get_data_by_id (link->data, quark_action) == GUINT_TO_POINTER (action))
+       if (g_object_get_qdata (link->data, quark_item_factory) == ifactory &&
+           g_object_get_qdata (link->data, quark_action) == GUINT_TO_POINTER (action))
          return link->data;
     }
 
@@ -745,6 +742,8 @@ gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory,
  * If the widget corresponding to @path is a menu item which opens a 
  * submenu, then the item is returned. If you are interested in the submenu, 
  * use gtk_item_factory_get_widget() instead.
+ *
+ * Deprecated: 2.4:
  */
 GtkWidget*
 gtk_item_factory_get_item (GtkItemFactory *ifactory,
@@ -774,6 +773,8 @@ gtk_item_factory_get_item (GtkItemFactory *ifactory,
  *
  * Obtains the menu item which was constructed from the first 
  * #GtkItemFactoryEntry with the given @action.
+ *
+ * Deprecated: 2.4:
  */
 GtkWidget*
 gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory,
@@ -906,10 +907,12 @@ gtk_item_factory_parse_path (GtkItemFactory *ifactory,
  * @ifactory: a #GtkItemFactory
  * @entry: the #GtkItemFactoryEntry to create an item for
  * @callback_data: data passed to the callback function of @entry
- * @callback_data: 1 if the callback function of @entry is of type
+ * @callback_type: 1 if the callback function of @entry is of type
  *    #GtkItemFactoryCallback1, 2 if it is of type #GtkItemFactoryCallback2 
  *
  * Creates an item for @entry.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_create_item (GtkItemFactory        *ifactory,
@@ -927,7 +930,7 @@ gtk_item_factory_create_item (GtkItemFactory             *ifactory,
   gchar *path;
   gchar *accelerator;
   guint type_id;
-  GtkType type;
+  GType type;
   gchar *item_type_path;
   GtkStockItem stock_item;
       
@@ -946,7 +949,7 @@ gtk_item_factory_create_item (GtkItemFactory             *ifactory,
   else
     {
       item_type_path = entry->item_type;
-      type_id = gtk_object_data_try_key (item_type_path);
+      type_id = g_quark_try_string (item_type_path);
     }
 
   radio_group = NULL;
@@ -980,7 +983,7 @@ gtk_item_factory_create_item (GtkItemFactory             *ifactory,
       if (radio_link && GTK_IS_RADIO_MENU_ITEM (radio_link))
        {
          type = GTK_TYPE_RADIO_MENU_ITEM;
-         radio_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (radio_link));
+         radio_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (radio_link));
        }
       else
        {
@@ -1047,28 +1050,28 @@ gtk_item_factory_create_item (GtkItemFactory         *ifactory,
   if (option_menu && !option_menu->menu_item)
     gtk_option_menu_set_history (option_menu, 0);
 
-  if (type == GTK_TYPE_RADIO_MENU_ITEM)
+  if (GTK_IS_RADIO_MENU_ITEM (widget))
     gtk_radio_menu_item_set_group (GTK_RADIO_MENU_ITEM (widget), radio_group);
-  if (GTK_IS_CHECK_MENU_ITEM (widget))
-    gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), TRUE);
   if (type_id == quark_type_image_item)
     {
       GdkPixbuf *pixbuf = NULL;
-
       image = NULL;
-      pixbuf = gdk_pixbuf_new_from_inline (-1,
-                                          entry->extra_data,
-                                          FALSE,
-                                          NULL);
-      if (pixbuf)
-       image = gtk_image_new_from_pixbuf (pixbuf);
+      if (entry->extra_data)
+       {
+         pixbuf = gdk_pixbuf_new_from_inline (-1,
+                                              entry->extra_data,
+                                              FALSE,
+                                              NULL);
+         if (pixbuf)
+           image = gtk_image_new_from_pixbuf (pixbuf);
+       }
       if (image)
        {
          gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
          gtk_widget_show (image);
        }
       if (pixbuf)
-       g_object_unref (G_OBJECT (pixbuf));
+       g_object_unref (pixbuf);
     }
   if (type_id == quark_type_stock_item)
     {
@@ -1094,7 +1097,7 @@ gtk_item_factory_create_item (GtkItemFactory           *ifactory,
       label = gtk_widget_new (GTK_TYPE_ACCEL_LABEL,
                              "visible", TRUE,
                              "parent", widget,
-                             "accel_widget", widget,
+                             "accel-widget", widget,
                              "xalign", 0.0,
                              NULL);
       gtk_label_set_text_with_mnemonic (GTK_LABEL (label), name);
@@ -1139,9 +1142,11 @@ gtk_item_factory_create_item (GtkItemFactory          *ifactory,
 /**
  * gtk_item_factory_create_menu_entries:
  * @n_entries: the length of @entries
- * @entries: an array of #GtkMenuEntry<!>s 
+ * @entries: an array of #GtkMenuEntry<!-- -->s 
  *
  * Creates the menu items from the @entries.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_create_menu_entries (guint              n_entries,
@@ -1226,6 +1231,8 @@ gtk_item_factory_create_menu_entries (guint              n_entries,
  * @path: a path 
  * 
  * Deletes all widgets constructed from the specified path.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factories_path_delete (const gchar *ifactory_path,
@@ -1263,7 +1270,7 @@ gtk_item_factories_path_delete (const gchar *ifactory_path,
 
          widget = slist->data;
          widget_list = g_slist_prepend (widget_list, widget);
-         gtk_widget_ref (widget);
+         g_object_ref (widget);
        }
 
       for (slist = widget_list; slist; slist = slist->next)
@@ -1272,7 +1279,7 @@ gtk_item_factories_path_delete (const gchar *ifactory_path,
 
          widget = slist->data;
          gtk_widget_destroy (widget);
-         gtk_widget_unref (widget);
+         g_object_unref (widget);
        }
       g_slist_free (widget_list);
     }
@@ -1285,19 +1292,18 @@ gtk_item_factories_path_delete (const gchar *ifactory_path,
  *
  * Deletes the menu item which was created for @path by the given
  * item factory.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_delete_item (GtkItemFactory         *ifactory,
                              const gchar            *path)
 {
-  GtkItemFactoryClass *class;
   GtkWidget *widget;
 
   g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
   g_return_if_fail (path != NULL);
 
-  class = GTK_ITEM_FACTORY_GET_CLASS (ifactory);
-
   widget = gtk_item_factory_get_widget (ifactory, path);
 
   if (widget)
@@ -1316,24 +1322,43 @@ gtk_item_factory_delete_item (GtkItemFactory         *ifactory,
  *
  * Deletes the menu item which was created from @entry by the given
  * item factory.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_delete_entry (GtkItemFactory         *ifactory,
                               GtkItemFactoryEntry    *entry)
 {
+  gchar *path;
+  gchar *parent_path;
+  gchar *name;
+
   g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
   g_return_if_fail (entry != NULL);
+  g_return_if_fail (entry->path != NULL);
+  g_return_if_fail (entry->path[0] == '/');
+
+  if (!gtk_item_factory_parse_path (ifactory, entry->path, 
+                                   &path, &parent_path, &name))
+    return;
+  
+  gtk_item_factory_delete_item (ifactory, path);
 
-  gtk_item_factory_delete_item (ifactory, entry->path);
+  g_free (path);
+  g_free (parent_path);
+  g_free (name);
 }
 
 /**
  * gtk_item_factory_delete_entries:
+ * @ifactory: a #GtkItemFactory
  * @n_entries: the length of @entries
- * @entries: an array of #GtkItemFactoryEntry<!>s 
+ * @entries: an array of #GtkItemFactoryEntry<!-- -->s 
  *
  * Deletes the menu items which were created from the @entries by the given
  * item factory.
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_delete_entries (GtkItemFactory         *ifactory,
@@ -1347,7 +1372,7 @@ gtk_item_factory_delete_entries (GtkItemFactory         *ifactory,
     g_return_if_fail (entries != NULL);
 
   for (i = 0; i < n_entries; i++)
-    gtk_item_factory_delete_item (ifactory, (entries + i)->path);
+    gtk_item_factory_delete_entry (ifactory, entries + i);
 }
 
 typedef struct
@@ -1371,7 +1396,7 @@ gtk_item_factory_menu_pos (GtkMenu  *menu,
 
 /**
  * gtk_item_factory_popup_data_from_widget:
- * @widget a widget
+ * @widget: a widget
  * @returns: @popup_data associated with the item factory from
  *   which @widget was created, or %NULL if @widget wasn't created
  *   by an item factory
@@ -1379,9 +1404,11 @@ gtk_item_factory_menu_pos (GtkMenu  *menu,
  * Obtains the @popup_data which was passed to 
  * gtk_item_factory_popup_with_data(). This data is available until the menu
  * is popped down again.
+ *
+ * Deprecated: 2.4:
  */
 gpointer
-gtk_item_factory_popup_data_from_widget (GtkWidget     *widget)
+gtk_item_factory_popup_data_from_widget (GtkWidget *widget)
 {
   GtkItemFactory *ifactory;
   
@@ -1389,7 +1416,7 @@ gtk_item_factory_popup_data_from_widget (GtkWidget     *widget)
 
   ifactory = gtk_item_factory_from_widget (widget);
   if (ifactory)
-    return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
+    return g_object_get_qdata (G_OBJECT (ifactory), quark_popup_data);
 
   return NULL;
 }
@@ -1402,34 +1429,50 @@ gtk_item_factory_popup_data_from_widget (GtkWidget     *widget)
  * Obtains the @popup_data which was passed to 
  * gtk_item_factory_popup_with_data(). This data is available until the menu
  * is popped down again.
+ *
+ * Deprecated: 2.4:
  */
 gpointer
 gtk_item_factory_popup_data (GtkItemFactory *ifactory)
 {
   g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
 
-  return gtk_object_get_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
+  return g_object_get_qdata (G_OBJECT (ifactory), quark_popup_data);
 }
 
 static void
 ifactory_delete_popup_data (GtkObject     *object,
                            GtkItemFactory *ifactory)
 {
-  gtk_signal_disconnect_by_func (object,
-                                GTK_SIGNAL_FUNC (ifactory_delete_popup_data),
-                                ifactory);
-  gtk_object_remove_data_by_id (GTK_OBJECT (ifactory), quark_popup_data);
+  g_signal_handlers_disconnect_by_func (object,
+                                       ifactory_delete_popup_data,
+                                       ifactory);
+  g_object_set_qdata (G_OBJECT (ifactory), quark_popup_data, NULL);
 }
 
 /**
  * gtk_item_factory_popup:
- * @ifactory: a #GtkItemFactory
+ * @ifactory: a #GtkItemFactory of type #GTK_TYPE_MENU (see gtk_item_factory_new())
  * @x: the x position 
  * @y: the y position
- * @mouse_button: the mouse button which was pressed to initiate this action
- * @time: a timestamp for this action
+ * @mouse_button: the mouse button which was pressed to initiate the popup
+ * @time_: the time at which the activation event occurred
  *
  * Pops up the menu constructed from the item factory at (@x, @y).
+ *
+ * The @mouse_button parameter should be the mouse button pressed to initiate
+ * the menu popup. If the menu popup was initiated by something other than
+ * a mouse button press, such as a mouse button release or a keypress,
+ * @mouse_button should be 0.
+ *
+ * The @time_ parameter should be the time stamp of the event that
+ * initiated the popup. If such an event is not available, use
+ * gtk_get_current_event_time() instead.
+ *
+ * The operation of the @mouse_button and the @time_ parameter is the same
+ * as the @button and @activation_time parameters for gtk_menu_popup().
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_popup (GtkItemFactory         *ifactory,
@@ -1443,18 +1486,32 @@ gtk_item_factory_popup (GtkItemFactory          *ifactory,
 
 /**
  * gtk_item_factory_popup_with_data:
- * @ifactory: a #GtkItemFactory
+ * @ifactory: a #GtkItemFactory of type #GTK_TYPE_MENU (see gtk_item_factory_new())
  * @popup_data: data available for callbacks while the menu is posted
  * @destroy: a #GtkDestroyNotify function to be called on @popup_data when
  *  the menu is unposted
  * @x: the x position 
  * @y: the y position
- * @mouse_button: the mouse button which was pressed to initiate this action
- * @time: a timestamp for this action
+ * @mouse_button: the mouse button which was pressed to initiate the popup
+ * @time_: the time at which the activation event occurred
  *
  * Pops up the menu constructed from the item factory at (@x, @y). Callbacks
  * can access the @popup_data while the menu is posted via 
  * gtk_item_factory_popup_data() and gtk_item_factory_popup_data_from_widget().
+ *
+ * The @mouse_button parameter should be the mouse button pressed to initiate
+ * the menu popup. If the menu popup was initiated by something other than
+ * a mouse button press, such as a mouse button release or a keypress,
+ * @mouse_button should be 0.
+ *
+ * The @time_ parameter should be the time stamp of the event that
+ * initiated the popup. If such an event is not available, use
+ * gtk_get_current_event_time() instead.
+ *
+ * The operation of the @mouse_button and the @time_ parameters is the same
+ * as the @button and @activation_time parameters for gtk_menu_popup().
+ *
+ * Deprecated: 2.4:
  */
 void
 gtk_item_factory_popup_with_data (GtkItemFactory       *ifactory,
@@ -1470,15 +1527,15 @@ gtk_item_factory_popup_with_data (GtkItemFactory        *ifactory,
   g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
   g_return_if_fail (GTK_IS_MENU (ifactory->widget));
   
-  mpos = gtk_object_get_data_by_id (GTK_OBJECT (ifactory->widget), quark_if_menu_pos);
+  mpos = g_object_get_qdata (G_OBJECT (ifactory->widget), quark_if_menu_pos);
   
   if (!mpos)
     {
       mpos = g_new0 (MenuPos, 1);
-      gtk_object_set_data_by_id_full (GTK_OBJECT (ifactory->widget),
-                                     quark_if_menu_pos,
-                                     mpos,
-                                     g_free);
+      g_object_set_qdata_full (G_OBJECT (ifactory->widget),
+                              quark_if_menu_pos,
+                              mpos,
+                              g_free);
     }
   
   mpos->x = x;
@@ -1486,14 +1543,14 @@ gtk_item_factory_popup_with_data (GtkItemFactory        *ifactory,
   
   if (popup_data != NULL)
     {
-      gtk_object_set_data_by_id_full (GTK_OBJECT (ifactory),
-                                     quark_popup_data,
-                                     popup_data,
-                                     destroy);
-      gtk_signal_connect (GTK_OBJECT (ifactory->widget),
-                         "selection-done",
-                         GTK_SIGNAL_FUNC (ifactory_delete_popup_data),
-                         ifactory);
+      g_object_set_qdata_full (G_OBJECT (ifactory),
+                              quark_popup_data,
+                              popup_data,
+                              destroy);
+      g_signal_connect (ifactory->widget,
+                       "selection-done",
+                       G_CALLBACK (ifactory_delete_popup_data),
+                       ifactory);
     }
   
   gtk_menu_popup (GTK_MENU (ifactory->widget),
@@ -1512,6 +1569,8 @@ gtk_item_factory_popup_with_data (GtkItemFactory  *ifactory,
  * 
  * Sets a function to be used for translating the path elements before they
  * are displayed. 
+ *
+ * Deprecated: 2.4:
  */ 
 void
 gtk_item_factory_set_translate_func (GtkItemFactory      *ifactory,
@@ -1528,3 +1587,6 @@ gtk_item_factory_set_translate_func (GtkItemFactory      *ifactory,
   ifactory->translate_data = data;
   ifactory->translate_notify = notify;
 }
+
+#define __GTK_ITEM_FACTORY_C__
+#include "gtkaliasdef.c"