]> Pileus Git - ~andy/gtk/commitdiff
Break compatibility and make gtk_image_new() take no arguments. The
authorOwen Taylor <otaylor@redhat.com>
Sat, 25 Aug 2001 03:15:26 +0000 (03:15 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 25 Aug 2001 03:15:26 +0000 (03:15 +0000)
Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility
and make gtk_image_new() take no arguments. The compiler will
catch it, and it is vastly more useful than having
gtk_image_new() be a deprecated alias for gtk_image_new_from_image().

* gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
to add tearoff-title property (#51319, Lee Mallabone)

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/Changes-2.0.txt
gtk/gtkimage.c
gtk/gtkimage.h
gtk/gtkmenu.c

index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index a9019643a11327ec2332bc63f9b656c9e33c6002..ed0c28d66fdf7ce8a2d0ea173939bf63461edb1a 100644 (file)
@@ -1,3 +1,13 @@
+Fri Aug 24 23:09:05 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkimage.[ch] docs/Changes-2.0.txt: Break compatibility 
+       and make gtk_image_new() take no arguments. The compiler will
+       catch it, and it is vastly more useful than having
+       gtk_image_new() be a deprecated alias for gtk_image_new_from_image().  
+
+       * gtk/gtkmenu.c (gtk_menu_set_property): Apply patch
+       to add tearoff-title property (#51319, Lee Mallabone)
+
 Fri Aug 24 22:12:32 2001  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkmenuitem.[ch]: Remove unused and useless function
index 9b82b2d85a1cc18eef577505a7fe7e642046edea..7d4ce76205b0776518b7133e2c2a234a17efe560 100644 (file)
@@ -442,3 +442,7 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
 
    - For NO_WINDOW widgets, if you create windows in your realize()
      method, you must map then in map() and unmap them in unmap().
+
+* gtk_image_new() now takes no arguments and creates an empty GtkImage
+  widget. To create a GtkImage widget from a GdkImage (the least
+  common usage of GdkImage), use gtk_image_new_from_image.
\ No newline at end of file
index dd01873b7575052c015ba2eeac53899b7333ddaa..509d569c52555cae26f352dd8cf6df348c8ca511 100644 (file)
@@ -776,19 +776,18 @@ gtk_image_get_animation (GtkImage *image)
   return image->data.anim.anim;
 }
 
+/**
+ * gtk_image_new:
+ * @void: a #GtkImage
+ * 
+ * Creates a new empty #GtkImage widget.
+ * 
+ * Return value: a newly created #GtkImage widget. 
+ **/
 GtkWidget*
-gtk_image_new (GdkImage  *val,
-              GdkBitmap *mask)
+gtk_image_new (void)
 {
-  GtkImage *image;
-
-  g_return_val_if_fail (val != NULL, NULL);
-
-  image = gtk_type_new (GTK_TYPE_IMAGE);
-
-  gtk_image_set (image, val, mask);
-
-  return GTK_WIDGET (image);
+  return g_object_new (GTK_TYPE_IMAGE, NULL);
 }
 
 void
index 71c80dfd0a1389b7743e0e7f46aebb9e0f793ec3..b528ef4ac92f183715b27544d707ed39ffce3c15 100644 (file)
@@ -125,6 +125,7 @@ struct _GtkImageClass
 
 GtkType    gtk_image_get_type (void) G_GNUC_CONST;
 
+GtkWidget* gtk_image_new                (void);
 GtkWidget* gtk_image_new_from_pixmap    (GdkPixmap       *pixmap,
                                          GdkBitmap       *mask);
 GtkWidget* gtk_image_new_from_image     (GdkImage        *image,
@@ -177,8 +178,6 @@ GdkPixbufAnimation* gtk_image_get_animation (GtkImage *image);
 #ifndef GTK_DISABLE_DEPRECATED
 /* These three are deprecated */
 
-GtkWidget* gtk_image_new      (GdkImage   *val,
-                              GdkBitmap  *mask);
 void       gtk_image_set      (GtkImage   *image,
                               GdkImage   *val,
                               GdkBitmap  *mask);
index 5cdb8213717e17d2dc88a437b43abb6116301c67..fb9dbaac3d6f19a3561e89847d58c81700b6b708 100644 (file)
@@ -37,6 +37,7 @@
 #include "gtkhbox.h"
 #include "gtkvscrollbar.h"
 #include "gtksettings.h"
+#include "gtkintl.h"
 
 
 #define MENU_ITEM_CLASS(w)   GTK_MENU_ITEM_GET_CLASS (w)
@@ -59,9 +60,21 @@ struct _GtkMenuAttachData
   GtkMenuDetachFunc detacher;
 };
 
+enum {
+  PROP_0,
+  PROP_TEAROFF_TITLE
+};
 
 static void     gtk_menu_class_init        (GtkMenuClass     *klass);
 static void     gtk_menu_init              (GtkMenu          *menu);
+static void     gtk_menu_set_property      (GObject      *object,
+                                           guint         prop_id,
+                                           const GValue *value,
+                                           GParamSpec   *pspec);
+static void     gtk_menu_get_property      (GObject     *object,
+                                           guint        prop_id,
+                                           GValue      *value,
+                                           GParamSpec  *pspec);
 static void     gtk_menu_destroy           (GtkObject        *object);
 static void     gtk_menu_realize           (GtkWidget        *widget);
 static void     gtk_menu_unrealize         (GtkWidget        *widget);
@@ -146,6 +159,7 @@ gtk_menu_get_type (void)
 static void
 gtk_menu_class_init (GtkMenuClass *class)
 {
+  GObjectClass *gobject_class;
   GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;
   GtkContainerClass *container_class;
@@ -153,12 +167,23 @@ gtk_menu_class_init (GtkMenuClass *class)
 
   GtkBindingSet *binding_set;
   
+  gobject_class = (GObjectClass*) class;
   object_class = (GtkObjectClass*) class;
   widget_class = (GtkWidgetClass*) class;
   container_class = (GtkContainerClass*) class;
   menu_shell_class = (GtkMenuShellClass*) class;
   parent_class = gtk_type_class (gtk_menu_shell_get_type ());
   
+  gobject_class->set_property = gtk_menu_set_property;
+  gobject_class->get_property = gtk_menu_get_property;
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_TEAROFF_TITLE,
+                                   g_param_spec_string ("tearoff-title",
+                                                        _("Tearoff Title"),
+                                                        _("A title that may be displayed by the window manager when this menu is torn-off."),
+                                                        "",
+                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
   object_class->destroy = gtk_menu_destroy;
   
   widget_class->realize = gtk_menu_realize;
@@ -223,6 +248,50 @@ gtk_menu_class_init (GtkMenuClass *class)
                                GTK_MENU_DIR_CHILD);
 }
 
+
+static void 
+gtk_menu_set_property (GObject      *object,
+                      guint         prop_id,
+                      const GValue *value,
+                      GParamSpec   *pspec)
+{
+  GtkMenu *menu;
+  
+  menu = GTK_MENU (object);
+  
+  switch (prop_id)
+    {
+    case PROP_TEAROFF_TITLE:
+      gtk_menu_set_title (menu, g_value_get_string (value));
+      break;     
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void 
+gtk_menu_get_property (GObject     *object,
+                      guint        prop_id,
+                      GValue      *value,
+                      GParamSpec  *pspec)
+{
+  GtkMenu *menu;
+  
+  menu = GTK_MENU (object);
+  
+  switch (prop_id)
+    {
+    case PROP_TEAROFF_TITLE:
+      g_value_set_string (value, gtk_object_get_data (GTK_OBJECT (menu), 
+                                                     "gtk-menu-title"));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
 static gboolean
 gtk_menu_window_event (GtkWidget *window,
                       GdkEvent  *event,
@@ -945,6 +1014,7 @@ gtk_menu_set_title (GtkMenu     *menu,
 
   gtk_object_set_data_full (GTK_OBJECT (menu), "gtk-menu-title",
                            g_strdup (title), (GtkDestroyNotify) g_free);
+  g_object_notify (G_OBJECT (menu), "tearoff_title");
 }
 
 /**