add "static" to a private function (gtk_image_menu_item_class_init):
2001-02-14 Havoc Pennington <hp@pobox.com> * gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add "static" to a private function (gtk_image_menu_item_class_init): remove destroy handler, add "image" object property
This commit is contained in:
parent
73c5da419c
commit
f1177b43fa
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2001-02-14 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gtk/gtkimagemenuitem.c (gtk_image_menu_item_remove): add
|
||||||
|
"static" to a private function
|
||||||
|
(gtk_image_menu_item_class_init): remove destroy handler,
|
||||||
|
add "image" object property
|
||||||
|
|
||||||
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
2001-02-13 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_clip_region):
|
||||||
|
@ -27,11 +27,10 @@
|
|||||||
#include "gtkimagemenuitem.h"
|
#include "gtkimagemenuitem.h"
|
||||||
#include "gtkaccellabel.h"
|
#include "gtkaccellabel.h"
|
||||||
#include "gtksignal.h"
|
#include "gtksignal.h"
|
||||||
|
#include "gtkintl.h"
|
||||||
|
|
||||||
static void gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass);
|
static void gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass);
|
||||||
static void gtk_image_menu_item_init (GtkImageMenuItem *image_menu_item);
|
static void gtk_image_menu_item_init (GtkImageMenuItem *image_menu_item);
|
||||||
|
|
||||||
static void gtk_image_menu_item_destroy (GtkObject *object);
|
|
||||||
static void gtk_image_menu_item_size_request (GtkWidget *widget,
|
static void gtk_image_menu_item_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
GtkRequisition *requisition);
|
||||||
static void gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
static void gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||||
@ -50,6 +49,23 @@ static void gtk_image_menu_item_forall (GtkContainer *container,
|
|||||||
GtkCallback callback,
|
GtkCallback callback,
|
||||||
gpointer callback_data);
|
gpointer callback_data);
|
||||||
|
|
||||||
|
static void gtk_image_menu_item_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
const gchar *trailer);
|
||||||
|
static void gtk_image_menu_item_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
const gchar *trailer);
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_ZERO,
|
||||||
|
PROP_IMAGE
|
||||||
|
};
|
||||||
|
|
||||||
static GtkMenuItemClass *parent_class = NULL;
|
static GtkMenuItemClass *parent_class = NULL;
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
@ -80,11 +96,13 @@ gtk_image_menu_item_get_type (void)
|
|||||||
static void
|
static void
|
||||||
gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *gobject_class;
|
||||||
GtkObjectClass *object_class;
|
GtkObjectClass *object_class;
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class;
|
||||||
GtkMenuItemClass *menu_item_class;
|
GtkMenuItemClass *menu_item_class;
|
||||||
GtkContainerClass *container_class;
|
GtkContainerClass *container_class;
|
||||||
|
|
||||||
|
gobject_class = (GObjectClass*) klass;
|
||||||
object_class = (GtkObjectClass*) klass;
|
object_class = (GtkObjectClass*) klass;
|
||||||
widget_class = (GtkWidgetClass*) klass;
|
widget_class = (GtkWidgetClass*) klass;
|
||||||
menu_item_class = (GtkMenuItemClass*) klass;
|
menu_item_class = (GtkMenuItemClass*) klass;
|
||||||
@ -92,8 +110,6 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
|||||||
|
|
||||||
parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM);
|
parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM);
|
||||||
|
|
||||||
object_class->destroy = gtk_image_menu_item_destroy;
|
|
||||||
|
|
||||||
widget_class->expose_event = gtk_image_menu_item_expose;
|
widget_class->expose_event = gtk_image_menu_item_expose;
|
||||||
widget_class->size_request = gtk_image_menu_item_size_request;
|
widget_class->size_request = gtk_image_menu_item_size_request;
|
||||||
widget_class->size_allocate = gtk_image_menu_item_size_allocate;
|
widget_class->size_allocate = gtk_image_menu_item_size_allocate;
|
||||||
@ -104,6 +120,17 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
|||||||
container_class->remove = gtk_image_menu_item_remove;
|
container_class->remove = gtk_image_menu_item_remove;
|
||||||
|
|
||||||
menu_item_class->toggle_size_request = gtk_image_menu_item_toggle_size_request;
|
menu_item_class->toggle_size_request = gtk_image_menu_item_toggle_size_request;
|
||||||
|
|
||||||
|
gobject_class->set_property = gtk_image_menu_item_set_property;
|
||||||
|
gobject_class->get_property = gtk_image_menu_item_get_property;
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_IMAGE,
|
||||||
|
g_param_spec_object ("image",
|
||||||
|
_("Image widget"),
|
||||||
|
_("Child widget to appear next to the menu text"),
|
||||||
|
GTK_TYPE_WIDGET,
|
||||||
|
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -113,19 +140,62 @@ gtk_image_menu_item_init (GtkImageMenuItem *image_menu_item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_image_menu_item_destroy (GtkObject *object)
|
gtk_image_menu_item_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
const gchar *trailer)
|
||||||
{
|
{
|
||||||
GtkImageMenuItem *image_menu_item;
|
GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (object);
|
||||||
|
|
||||||
image_menu_item = GTK_IMAGE_MENU_ITEM (object);
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_IMAGE:
|
||||||
|
{
|
||||||
|
GtkWidget *child;
|
||||||
|
|
||||||
/* If you change forall to treat the image widget as
|
child = (GtkWidget*) g_value_get_object (value);
|
||||||
* an internal, then you have to destroy the image widget
|
|
||||||
* here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
if (child != image_menu_item->image)
|
||||||
|
{
|
||||||
|
if (image_menu_item->image)
|
||||||
|
gtk_container_remove (GTK_CONTAINER (image_menu_item),
|
||||||
|
image_menu_item->image);
|
||||||
|
|
||||||
|
if (child)
|
||||||
|
{
|
||||||
|
gtk_image_menu_item_add_image (image_menu_item,
|
||||||
|
child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
static void
|
||||||
|
gtk_image_menu_item_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
const gchar *trailer)
|
||||||
|
{
|
||||||
|
GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (object);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_IMAGE:
|
||||||
|
g_value_set_object (value,
|
||||||
|
(GObject*) image_menu_item->image);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
||||||
@ -331,6 +401,8 @@ gtk_image_menu_item_add_image (GtkImageMenuItem *image_menu_item,
|
|||||||
gtk_widget_set_parent (child, GTK_WIDGET (image_menu_item));
|
gtk_widget_set_parent (child, GTK_WIDGET (image_menu_item));
|
||||||
image_menu_item->image = child;
|
image_menu_item->image = child;
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (image_menu_item), "image");
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (child->parent))
|
if (GTK_WIDGET_REALIZED (child->parent))
|
||||||
gtk_widget_realize (child);
|
gtk_widget_realize (child);
|
||||||
|
|
||||||
@ -351,7 +423,7 @@ gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item)
|
|||||||
return image_menu_item->image;
|
return image_menu_item->image;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
gtk_image_menu_item_remove (GtkContainer *container,
|
gtk_image_menu_item_remove (GtkContainer *container,
|
||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
@ -368,11 +440,10 @@ gtk_image_menu_item_remove (GtkContainer *container,
|
|||||||
gtk_widget_unparent (child);
|
gtk_widget_unparent (child);
|
||||||
image_menu_item->image = NULL;
|
image_menu_item->image = NULL;
|
||||||
|
|
||||||
/* queue resize regardless of GTK_WIDGET_VISIBLE (container),
|
if (GTK_WIDGET_VISIBLE (container) && widget_was_visible)
|
||||||
* since that's what is needed by toplevels, which derive from GtkBin.
|
|
||||||
*/
|
|
||||||
if (widget_was_visible)
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (container));
|
gtk_widget_queue_resize (GTK_WIDGET (container));
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (image_menu_item), "image");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user