Commit 028b24c6 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Make distribution menus api cache the results to avoid continual statting

Sat Sep 02 19:19:08 2000  George Lebl <jirka@5z.com>

	* distribution.[ch], menu*.c:  Make distribution menus api cache the
	  results to avoid continual statting of version files (how often
	  does a user change from one distro to another while keeping the
	  panel running?).  Fix some remaking function to use the correct
	  distribution_info and fix a crash when distribution menus got
	  turned on on an unknown distribution system

	* *.[ch]:  make type macros be more consistent in naming, all the
	  _get_type functions are G_GNUC_CONST functions now also the
	  function to get default menu flags is G_GNUC_CONST
parent 3b0cbcb3
Sat Sep 02 19:19:08 2000 George Lebl <jirka@5z.com>
* distribution.[ch], menu*.c: Make distribution menus api cache the
results to avoid continual statting of version files (how often
does a user change from one distro to another while keeping the
panel running?). Fix some remaking function to use the correct
distribution_info and fix a crash when distribution menus got
turned on on an unknown distribution system
* *.[ch]: make type macros be more consistent in naming, all the
_get_type functions are G_GNUC_CONST functions now also the
function to get default menu flags is G_GNUC_CONST
2000-08-29 Ismael Olea <olea@hispafuentes.com>
* panel.hints: translation into Spanish
......
Sat Sep 02 19:19:08 2000 George Lebl <jirka@5z.com>
* distribution.[ch], menu*.c: Make distribution menus api cache the
results to avoid continual statting of version files (how often
does a user change from one distro to another while keeping the
panel running?). Fix some remaking function to use the correct
distribution_info and fix a crash when distribution menus got
turned on on an unknown distribution system
* *.[ch]: make type macros be more consistent in naming, all the
_get_type functions are G_GNUC_CONST functions now also the
function to get default menu flags is G_GNUC_CONST
2000-08-29 Ismael Olea <olea@hispafuentes.com>
* panel.hints: translation into Spanish
......
......@@ -27,21 +27,23 @@ static void aligned_pos_show_hide_right (BasePWidget *basep);
static BorderPosClass *parent_class;
GtkType
aligned_pos_get_type ()
aligned_pos_get_type (void)
{
static GtkType aligned_pos_type = 0;
if (!aligned_pos_type) {
if (aligned_pos_type == 0) {
GtkTypeInfo aligned_pos_info = {
"AlignedPos",
sizeof (AlignedPos),
sizeof (AlignedPosClass),
(GtkClassInitFunc) aligned_pos_class_init,
(GtkObjectInitFunc) aligned_pos_init,
NULL, NULL
NULL,
NULL,
NULL
};
aligned_pos_type = gtk_type_unique (BORDER_POS_TYPE,
aligned_pos_type = gtk_type_unique (TYPE_BORDER_POS,
&aligned_pos_info);
}
......@@ -60,7 +62,7 @@ aligned_pos_class_init (AlignedPosClass *klass)
{
BasePPosClass *pos_class = BASEP_POS_CLASS(klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
parent_class = gtk_type_class(BORDER_POS_TYPE);
parent_class = gtk_type_class(TYPE_BORDER_POS);
aligned_pos_signals[ALIGN_CHANGE_SIGNAL] =
gtk_signal_new ("align_change",
......@@ -344,8 +346,8 @@ aligned_widget_new (AlignedAlignment align,
gboolean rotate_pixmap_bg,
GdkColor *back_color)
{
AlignedWidget *aligned = gtk_type_new (ALIGNED_WIDGET_TYPE);
AlignedPos *pos = gtk_type_new (ALIGNED_POS_TYPE);
AlignedWidget *aligned = gtk_type_new (TYPE_ALIGNED_WIDGET);
AlignedPos *pos = gtk_type_new (TYPE_ALIGNED_POS);
pos->align = align;
BASEP_WIDGET (aligned)->pos = BASEP_POS (pos);
......
......@@ -12,13 +12,13 @@
BEGIN_GNOME_DECLS
#define ALIGNED_POS_TYPE (aligned_pos_get_type ())
#define ALIGNED_POS(o) (GTK_CHECK_CAST ((o), ALIGNED_POS_TYPE, AlignedPos))
#define ALIGNED_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), ALIGNED_POS_TYPE, AlignedPosClass))
#define IS_ALIGNED_POS(o) (GTK_CHECK_TYPE ((o), ALIGNED_POS_TYPE))
#define IS_ALIGNED_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), ALIGNED_POS_TYPE))
#define TYPE_ALIGNED_POS (aligned_pos_get_type ())
#define ALIGNED_POS(o) (GTK_CHECK_CAST ((o), TYPE_ALIGNED_POS, AlignedPos))
#define ALIGNED_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), TYPE_ALIGNED_POS, AlignedPosClass))
#define IS_ALIGNED_POS(o) (GTK_CHECK_TYPE ((o), TYPE_ALIGNED_POS))
#define IS_ALIGNED_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), TYPE_ALIGNED_POS))
#define ALIGNED_WIDGET_TYPE (BORDER_WIDGET_TYPE)
#define TYPE_ALIGNED_WIDGET (TYPE_BORDER_WIDGET)
#define ALIGNED_WIDGET(o) (BORDER_WIDGET(o))
#define ALIGNED_WIDGET_CLASS(k) (BORDER_WIDGET_CLASS(k))
#define IS_ALIGNED_WIDGET(o) (IS_BORDER_WIDGET(o) && IS_ALIGNED_POS(BASEP_WIDGET(o)->pos))
......@@ -51,7 +51,7 @@ struct _AlignedPosClass {
AlignedAlignment align);
};
GtkType aligned_pos_get_type (void);
GtkType aligned_pos_get_type (void) G_GNUC_CONST;
GtkWidget *aligned_widget_new (AlignedAlignment aligned,
BorderEdge edge,
BasePMode mode,
......
......@@ -41,6 +41,7 @@ typedef GNOME_Panel_BackType PanelBackType;
#define PANEL_BACK_PIXMAP GNOME_Panel_BACK_PIXMAP
#define TYPE_APPLET_WIDGET (applet_widget_get_type ())
#define APPLET_WIDGET(obj) GTK_CHECK_CAST (obj, applet_widget_get_type (), AppletWidget)
#define APPLET_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, applet_widget_get_type (), AppletWidgetClass)
#define IS_APPLET_WIDGET(obj) GTK_CHECK_TYPE (obj, applet_widget_get_type ())
......@@ -121,7 +122,7 @@ typedef GtkWidget *(*AppletFactoryActivator)(const char *goad_id, const char **p
/* Returns TRUE if the factory can activate this applet */
typedef gboolean (*AppletFactoryQuerier)(const char *goad_id);
guint applet_widget_get_type (void);
guint applet_widget_get_type (void) G_GNUC_CONST;
void applet_factory_new(const char *goad_id,
AppletFactoryQuerier qfunc,
......
......@@ -1364,12 +1364,12 @@ basep_widget_convert_to (BasePWidget *basep,
#endif
void
_basep_widget_enable_buttons(BasePWidget *basep, gboolean enabled)
basep_widget_enable_buttons_ (BasePWidget *basep, gboolean enabled)
{
gtk_widget_set_sensitive(basep->hidebutton_n,enabled);
gtk_widget_set_sensitive(basep->hidebutton_e,enabled);
gtk_widget_set_sensitive(basep->hidebutton_w,enabled);
gtk_widget_set_sensitive(basep->hidebutton_s,enabled);
gtk_widget_set_sensitive(basep->hidebutton_n, enabled);
gtk_widget_set_sensitive(basep->hidebutton_e, enabled);
gtk_widget_set_sensitive(basep->hidebutton_w, enabled);
gtk_widget_set_sensitive(basep->hidebutton_s, enabled);
}
void
......
......@@ -4,24 +4,24 @@
* Authors: George Lebl
* Jacob Berkman
*/
#ifndef __BASEP_WIDGET_H__
#define __BASEP_WIDGET_H__
#ifndef BASEP_WIDGET_H
#define BASEP_WIDGET_H
#include "panel-widget.h"
BEGIN_GNOME_DECLS
#define BASEP_WIDGET_TYPE (basep_widget_get_type ())
#define BASEP_WIDGET(o) (GTK_CHECK_CAST((o), BASEP_WIDGET_TYPE, BasePWidget))
#define BASEP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BASEP_WIDGET_TYPE, BasePWidgetClass))
#define IS_BASEP_WIDGET(o) (GTK_CHECK_TYPE((o), BASEP_WIDGET_TYPE))
#define IS_BASEP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), BASEP_WIDGET_TYPE))
#define TYPE_BASEP_WIDGET (basep_widget_get_type ())
#define BASEP_WIDGET(o) (GTK_CHECK_CAST((o), TYPE_BASEP_WIDGET, BasePWidget))
#define BASEP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST((k), TYPE_BASEP_WIDGET, BasePWidgetClass))
#define IS_BASEP_WIDGET(o) (GTK_CHECK_TYPE((o), TYPE_BASEP_WIDGET))
#define IS_BASEP_WIDGET_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), TYPE_BASEP_WIDGET))
#define BASEP_POS_TYPE (basep_pos_get_type ())
#define BASEP_POS(o) (GTK_CHECK_CAST((o), BASEP_POS_TYPE, BasePPos))
#define BASEP_POS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BASEP_POS_TYPE, BasePPosClass))
#define IS_BASEP_POS(o) (GTK_CHECK_TYPE((o), BASEP_POS_TYPE))
#define IS_BASEP_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), BASEP_POS_TYPE))
#define TYPE_BASEP_POS (basep_pos_get_type ())
#define BASEP_POS(o) (GTK_CHECK_CAST((o), TYPE_BASEP_POS, BasePPos))
#define BASEP_POS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), TYPE_BASEP_POS, BasePPosClass))
#define IS_BASEP_POS(o) (GTK_CHECK_TYPE((o), TYPE_BASEP_POS))
#define IS_BASEP_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), TYPE_BASEP_POS))
typedef struct _BasePWidget BasePWidget;
typedef struct _BasePWidgetClass BasePWidgetClass;
......@@ -156,8 +156,8 @@ struct _BasePPosClass {
void (*pre_convert_hook) (BasePWidget *basep);
};
GtkType basep_pos_get_type (void);
GtkType basep_widget_get_type (void);
GtkType basep_pos_get_type (void) G_GNUC_CONST;
GtkType basep_widget_get_type (void) G_GNUC_CONST;
GtkWidget* basep_widget_construct (BasePWidget *basep,
gboolean packed,
gboolean reverse_arrows,
......@@ -192,14 +192,14 @@ void basep_widget_change_params (BasePWidget *basep,
/*gboolean basep_widget_convert_to (BasePWidget *basep,
PanelType type);*/
void _basep_widget_enable_buttons (BasePWidget *basep,
void basep_widget_enable_buttons_ (BasePWidget *basep,
gboolean enabled);
#define basep_widget_enable_buttons(basep) \
(_basep_widget_enable_buttons ((basep),TRUE))
(basep_widget_enable_buttons_ ((basep),TRUE))
#define basep_widget_disable_buttons(basep) \
(_basep_widget_enable_buttons ((basep),FALSE))
(basep_widget_enable_buttons_ ((basep),FALSE))
void basep_widget_set_hidebuttons (BasePWidget *basep);
void basep_widget_update_winhints (BasePWidget *basep);
......
......@@ -48,7 +48,7 @@ border_pos_get_type ()
NULL, NULL
};
border_pos_type = gtk_type_unique (BASEP_POS_TYPE,
border_pos_type = gtk_type_unique (TYPE_BASEP_POS,
&border_pos_info);
}
......@@ -68,7 +68,7 @@ border_pos_class_init (BorderPosClass *klass)
GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
BasePPosClass *pos_class = BASEP_POS_CLASS(klass);
parent_class = gtk_type_class(BASEP_POS_TYPE);
parent_class = gtk_type_class(TYPE_BASEP_POS);
/* set up signals */
border_pos_signals[EDGE_CHANGE_SIGNAL] =
......@@ -78,8 +78,8 @@ border_pos_class_init (BorderPosClass *klass)
GTK_SIGNAL_OFFSET(BorderPosClass,
edge_change),
gtk_marshal_NONE__ENUM,
GTK_TYPE_NONE,
1, GTK_TYPE_ENUM);
GTK_TYPE_NONE, 1,
GTK_TYPE_ENUM);
gtk_object_class_add_signals (object_class,
border_pos_signals,
......
......@@ -5,20 +5,20 @@
* George Lebl
*/
#ifndef __BORDER_WIDGET_H__
#define __BORDER_WIDGET_H__
#ifndef BORDER_WIDGET_H
#define BORDER_WIDGET_H
#include "basep-widget.h"
BEGIN_GNOME_DECLS
#define BORDER_POS_TYPE (border_pos_get_type ())
#define BORDER_POS(o) (GTK_CHECK_CAST ((o), BORDER_POS_TYPE, BorderPos))
#define BORDER_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), BORDER_POS_TYPE, BorderPosClass))
#define IS_BORDER_POS(o) (GTK_CHECK_TYPE ((o), BORDER_POS_TYPE))
#define IS_BORDER_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BORDER_POS_TYPE))
#define TYPE_BORDER_POS (border_pos_get_type ())
#define BORDER_POS(o) (GTK_CHECK_CAST ((o), TYPE_BORDER_POS, BorderPos))
#define BORDER_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), TYPE_BORDER_POS, BorderPosClass))
#define IS_BORDER_POS(o) (GTK_CHECK_TYPE ((o), TYPE_BORDER_POS))
#define IS_BORDER_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), TYPE_BORDER_POS))
#define BORDER_WIDGET_TYPE (BASEP_WIDGET_TYPE)
#define TYPE_BORDER_WIDGET (TYPE_BASEP_WIDGET)
#define BORDER_WIDGET(o) (BASEP_WIDGET(o))
#define BORDER_WIDGET_CLASS(k) (BASEP_WIDGET_CLASS(o))
#define IS_BORDER_WIDGET(o) (IS_BASEP_WIDGET(o) && IS_BORDER_POS( BASEP_WIDGET(o)->pos ))
......@@ -58,7 +58,7 @@ struct _BorderPosClass {
#endif
};
GtkType border_pos_get_type (void);
GtkType border_pos_get_type (void) G_GNUC_CONST;
GtkWidget *border_widget_construct (BorderWidget *border,
BorderEdge edge,
int packed,
......
#ifndef __BUTTON_WIDGET_H__
#define __BUTTON_WIDGET_H__
#ifndef BUTTON_WIDGET_H
#define BUTTON_WIDGET_H
#include <gtk/gtk.h>
#include <gnome.h>
......@@ -9,6 +9,7 @@
extern "C" {
#endif /* __cplusplus */
#define TYPE_BUTTON_WIDGET (button_widget_get_type ())
#define BUTTON_WIDGET(obj) GTK_CHECK_CAST (obj, button_widget_get_type (), ButtonWidget)
#define BUTTON_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, button_widget_get_type (), ButtonWidgetClass)
#define IS_BUTTON_WIDGET(obj) GTK_CHECK_TYPE (obj, button_widget_get_type ())
......@@ -64,7 +65,7 @@ struct _ButtonWidgetClass
void (* unpressed) (ButtonWidget *button);
};
guint button_widget_get_type (void);
guint button_widget_get_type (void) G_GNUC_CONST;
GtkWidget* button_widget_new (char *pixmap,
int size,
......
......@@ -21,7 +21,7 @@
static void rh_menu_init_func (void);
static void rh_menu_show_func (GtkWidget *, GtkMenuItem *);
DistributionInfo distribution_info [] = {
static DistributionInfo distribution_info [] = {
{ DISTRIBUTION_DEBIAN, "/etc/debian_version",
N_("Debian GNU/Linux"), N_("Debian menus"),
"gnome-debian.png", "/var/lib/gnome/Debian/.",
......@@ -40,8 +40,8 @@ DistributionInfo distribution_info [] = {
{ DISTRIBUTION_UNKNOWN, NULL, NULL, NULL, NULL }
};
DistributionType
get_distribution (void)
static DistributionType
internal_get_distribution_type (void)
{
DistributionInfo *ptr;
......@@ -52,8 +52,8 @@ get_distribution (void)
return DISTRIBUTION_UNKNOWN;
}
const DistributionInfo *
get_distribution_info (DistributionType type)
static const DistributionInfo *
internal_get_distribution_info (DistributionType type)
{
DistributionInfo *ptr;
......@@ -64,6 +64,43 @@ get_distribution_info (DistributionType type)
return NULL;
}
/* note that this function is marked G_GNUC_CONST in distribution.h */
DistributionType
get_distribution_type (void)
{
static gboolean cached = FALSE;
static DistributionType cache = DISTRIBUTION_UNKNOWN;
if (cached) {
return cache;
}
cache = internal_get_distribution_type ();
cached = TRUE;
return cache;
}
/* note that this function is marked G_GNUC_CONST in distribution.h */
const DistributionInfo *
get_distribution_info (void)
{
static gboolean cached = FALSE;
static const DistributionInfo *cache = NULL;
DistributionType type;
if (cached) {
return cache;
}
type = get_distribution_type ();
cache = internal_get_distribution_info (type);
cached = TRUE;
return cache;
}
/*
* Distribution specific menu functions.
*/
......
......@@ -25,14 +25,13 @@ typedef struct {
void (*menu_show_func) (GtkWidget *, GtkMenuItem *);
} DistributionInfo;
/* Distribution description array. */
extern DistributionInfo distribution_info [];
/* Get distribution type. */
DistributionType get_distribution (void);
DistributionType get_distribution_type (void) G_GNUC_CONST;
/* Get info about a distribution or NULL. */
const DistributionInfo *get_distribution_info (DistributionType type);
/* Get the distribution info, it only checks the first time, it thus won't handle
* distributions getting changed from under us. Hmmm ... I think doing that
* would be really going overboard */
const DistributionInfo *get_distribution_info (void) G_GNUC_CONST;
END_GNOME_DECLS
......
......@@ -47,21 +47,23 @@ static void drawer_pos_pre_convert_hook (BasePWidget *basep);
static BasePPosClass *parent_class;
GtkType
drawer_pos_get_type ()
drawer_pos_get_type (void)
{
static GtkType drawer_pos_type = 0;
if (!drawer_pos_type) {
if (drawer_pos_type == 0) {
GtkTypeInfo drawer_pos_info = {
"DrawerPos",
sizeof (DrawerPos),
sizeof (DrawerPosClass),
(GtkClassInitFunc) drawer_pos_class_init,
(GtkObjectInitFunc) drawer_pos_init,
NULL, NULL
NULL,
NULL,
NULL
};
drawer_pos_type = gtk_type_unique (BASEP_POS_TYPE,
drawer_pos_type = gtk_type_unique (TYPE_BASEP_POS,
&drawer_pos_info);
}
......@@ -74,7 +76,7 @@ drawer_pos_class_init (DrawerPosClass *klass)
/*GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);*/
BasePPosClass *pos_class = BASEP_POS_CLASS(klass);
parent_class = gtk_type_class(BASEP_POS_TYPE);
parent_class = gtk_type_class(TYPE_BASEP_POS);
/* fill out the virtual funcs */
pos_class->set_hidebuttons = drawer_pos_set_hidebuttons;
......@@ -454,8 +456,8 @@ drawer_widget_new (PanelOrientType orient,
DrawerPos *pos;
PanelOrientation porient;
drawer = gtk_type_new (DRAWER_WIDGET_TYPE);
drawer->pos = gtk_type_new (DRAWER_POS_TYPE);
drawer = gtk_type_new (TYPE_DRAWER_WIDGET);
drawer->pos = gtk_type_new (TYPE_DRAWER_POS);
pos = DRAWER_POS (drawer->pos);
pos->orient = orient;
......
......@@ -5,26 +5,26 @@
* George Lebl
*/
#ifndef __DRAWER_WIDGET_H__
#define __DRAWER_WIDGET_H__
#ifndef DRAWER_WIDGET_H
#define DRAWER_WIDGET_H
#include "basep-widget.h"
#include "drawer.h"
BEGIN_GNOME_DECLS
#define DRAWER_POS_TYPE (drawer_pos_get_type ())
#define DRAWER_POS(o) (GTK_CHECK_CAST ((o), DRAWER_POS_TYPE, DrawerPos))
#define TYPE_DRAWER_POS (drawer_pos_get_type ())
#define DRAWER_POS(o) (GTK_CHECK_CAST ((o), TYPE_DRAWER_POS, DrawerPos))
#define DRAWER_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), DRAWER_POS_TYPE, DrawerPosClass))
#define IS_DRAWER_POS(o) (GTK_CHECK_TYPE ((o), DRAWER_POS_TYPE))
#define IS_DRAWER_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), DRAWER_POS_TYPE))
#define IS_DRAWER_POS(o) (GTK_CHECK_TYPE ((o), TYPE_DRAWER_POS))
#define IS_DRAWER_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), TYPE_DRAWER_POS))
#define DRAWER_WIDGET_TYPE (BASEP_WIDGET_TYPE)
#define TYPE_DRAWER_WIDGET (TYPE_BASEP_WIDGET)
#define DRAWER_WIDGET(o) (BASEP_WIDGET(o))
#define DRAWER_WIDGET_CLASS(k) (BASEP_WIDGET_CLASS(k))
#define IS_DRAWER_WIDGET(o) (IS_BASEP_WIDGET(o) && IS_DRAWER_POS(BASEP_WIDGET(o)->pos))
/* this is not reliable */
#define IS_DRAWER_WIDGET_CLASS(k) (IS_BASEP_WIDGET_CLASS(k))
#define IS_DRAWER_WIDGET_CLASS(k) (IS_BASEP_WIDGET_CLASS(k))
typedef BasePWidget DrawerWidget;
typedef BasePWidgetClass DrawerWidgetClass;
......@@ -49,7 +49,7 @@ struct _DrawerPosClass {
#endif
};
GtkType drawer_pos_get_type (void);
GtkType drawer_pos_get_type (void) G_GNUC_CONST;
GtkWidget *drawer_widget_new (PanelOrientType orient,
BasePMode mode,
BasePState state,
......
......@@ -34,17 +34,19 @@ edge_pos_get_type ()
{
static GtkType edge_pos_type = 0;
if (!edge_pos_type) {
if (edge_pos_type == 0) {
GtkTypeInfo edge_pos_info = {
"EdgePos",
sizeof (EdgePos),
sizeof (EdgePosClass),
(GtkClassInitFunc) edge_pos_class_init,
(GtkObjectInitFunc) edge_pos_init,
NULL, NULL
NULL,
NULL,
NULL
};
edge_pos_type = gtk_type_unique (BORDER_POS_TYPE,
edge_pos_type = gtk_type_unique (TYPE_BORDER_POS,
&edge_pos_info);
}
......@@ -56,7 +58,7 @@ edge_pos_class_init (EdgePosClass *klass)
{
BasePPosClass *pos_class = BASEP_POS_CLASS(klass);
parent_class = gtk_type_class(BORDER_POS_TYPE);
parent_class = gtk_type_class(TYPE_BORDER_POS);
pos_class->set_pos = edge_pos_set_pos;
pos_class->get_pos = edge_pos_get_pos;
......@@ -165,10 +167,10 @@ edge_widget_new (BorderEdge edge,
gboolean rotate_pixmap_bg,
GdkColor *back_color)
{
EdgeWidget *edgew = gtk_type_new (EDGE_WIDGET_TYPE);
EdgeWidget *edgew = gtk_type_new (TYPE_EDGE_WIDGET);
BasePWidget *basep = BASEP_WIDGET (edgew);
basep->pos = gtk_type_new (EDGE_POS_TYPE);
basep->pos = gtk_type_new (TYPE_EDGE_POS);
border_widget_construct (BORDER_WIDGET (basep),
edge,
......
......@@ -5,8 +5,8 @@
* George Lebl
*/
#ifndef __EDGE_WIDGET_H__
#define __EDGE_WIDGET_H__
#ifndef EDGE_WIDGET_H
#define EDGE_WIDGET_H
#include "border-widget.h"
......@@ -17,13 +17,13 @@ BEGIN_GNOME_DECLS
since we do need a seperate GtkType
*/
#define EDGE_POS_TYPE (edge_pos_get_type ())
#define EDGE_POS(o) (GTK_CHECK_CAST ((o), EDGE_POS_TYPE, EdgePos))
#define EDGE_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), EDGE_POS_TYPE, EdgePosClass))
#define IS_EDGE_POS(o) (GTK_CHECK_TYPE ((o), EDGE_POS_TYPE))
#define IS_EDGE_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EDGE_POS_TYPE))
#define TYPE_EDGE_POS (edge_pos_get_type ())
#define EDGE_POS(o) (GTK_CHECK_CAST ((o), TYPE_EDGE_POS, EdgePos))
#define EDGE_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), TYPE_EDGE_POS, EdgePosClass))
#define IS_EDGE_POS(o) (GTK_CHECK_TYPE ((o), TYPE_EDGE_POS))
#define IS_EDGE_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), TYPE_EDGE_POS))
#define EDGE_WIDGET_TYPE (BORDER_WIDGET_TYPE)
#define TYPE_EDGE_WIDGET (TYPE_BORDER_WIDGET)
#define EDGE_WIDGET(o) (BORDER_WIDGET(o))
#define EDGE_WIDGET_CLASS(k) (BORDER_WIDGET_CLASS(k))
#define IS_EDGE_WIDGET(o) (IS_BORDER_WIDGET(o) && IS_EDGE_POS(BASEP_WIDGET(o)->pos))
......@@ -44,7 +44,7 @@ struct _EdgePosClass {
BorderPosClass parent_class;
};
GtkType edge_pos_get_type (void);
GtkType edge_pos_get_type (void) G_GNUC_CONST;
GtkWidget *edge_widget_new (BorderEdge edge,
BasePMode mode,
BasePState state,
......
......@@ -53,22 +53,24 @@ static void floating_pos_show_hide_right (BasePWidget *basep);
static BasePPosClass *parent_class;
GtkType
floating_pos_get_type ()
floating_pos_get_type (void)
{
static GtkType floating_pos_type = 0;
if (!floating_pos_type) {
if (floating_pos_type == 0) {
GtkTypeInfo floating_pos_info = {
"FloatingPos",
sizeof (FloatingPos),
sizeof (FloatingPosClass),
(GtkClassInitFunc) floating_pos_class_init,
(GtkObjectInitFunc) floating_pos_init,
NULL, NULL
NULL,
NULL,
NULL
};
floating_pos_type = gtk_type_unique (BASEP_POS_TYPE,
&floating_pos_info);
floating_pos_type = gtk_type_unique (TYPE_BASEP_POS,
&floating_pos_info);
}
return floating_pos_type;
......@@ -86,7 +88,7 @@ floating_pos_class_init (FloatingPosClass *klass)
GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
BasePPosClass *pos_class = BASEP_POS_CLASS(klass);
parent_class = gtk_type_class(BASEP_POS_TYPE);
parent_class = gtk_type_class(TYPE_BASEP_POS);
floating_pos_signals[COORDS_CHANGE_SIGNAL] =
gtk_signal_new ("floating_coords_change",
......@@ -223,8 +225,8 @@ floating_pos_set_pos (BasePWidget *basep,
newy = pos->y;
if (x < minx || x > maxx) {
int w2=w;
int x2=x;
int w2 = w;
int x2 = x;
if (PANEL_WIDGET (basep->panel)->orient == PANEL_HORIZONTAL) {
switch (basep->state) {
case BASEP_SHOWN:
......@@ -244,8 +246,8 @@ floating_pos_set_pos (BasePWidget *basep,
}
if (y < miny || y > maxy) {
int h2=h;
int y2=y;
int h2 = h;
int y2 = y;
if (PANEL_WIDGET (basep->panel)->orient == PANEL_VERTICAL) {
switch (basep->state) {
case BASEP_SHOWN:
......@@ -477,8 +479,8 @@ floating_widget_new (gint16 x, gint16 y,
FloatingWidget *floating;
FloatingPos *pos;
floating = gtk_type_new (FLOATING_WIDGET_TYPE);
floating->pos = gtk_type_new (FLOATING_POS_TYPE);
floating = gtk_type_new (TYPE_FLOATING_WIDGET);
floating->pos = gtk_type_new (TYPE_FLOATING_POS);
pos = FLOATING_POS (floating->pos);
pos->x = x;
......
......@@ -4,25 +4,25 @@
* Authors: Jacob Berkman
*/
#ifndef __FLOATING_WIDGET_H__
#define __FLOATING_WIDGET_H__
#ifndef FLOATING_WIDGET_H
#define FLOATING_WIDGET_H
#include "basep-widget.h"
BEGIN_GNOME_DECLS
#define FLOATING_POS_TYPE (floating_pos_get_type ())
#define FLOATING_POS(o) (GTK_CHECK_CAST ((o), FLOATING_POS_TYPE, FloatingPos))
#define FLOATING_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), FLOATING_POS_TYPE, FloatingPosClass))
#define IS_FLOATING_POS(o) (GTK_CHECK_TYPE ((o), FLOATING_POS_TYPE))
#define IS_FLOATING_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), FLOATING_POS_TYPE))
#define TYPE_FLOATING_POS (floating_pos_get_type ())
#define FLOATING_POS(o) (GTK_CHECK_CAST ((o), TYPE_FLOATING_POS, FloatingPos))
#define FLOATING_POS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), TYPE_FLOATING_POS, FloatingPosClass))
#define IS_FLOATING_POS(o) (GTK_CHECK_TYPE ((o), TYPE_FLOATING_POS))
#define IS_FLOATING_POS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), TYPE_FLOATING_POS))
#define FLOATING_WIDGET_TYPE (BASEP_WIDGET_TYPE)
#define TYPE_FLOATING_WIDGET (TYPE_BASEP_WIDGET)
#define FLOATING_WIDGET(o) (BASEP_WIDGET(o))
#define FLOATING_WIDGET_CLASS(k) (BASEP_WIDGET_CLASS(k))
#define IS_FLOATING_WIDGET(o) (IS_BASEP_WIDGET(o) && IS_FLOATING_POS(BASEP_WIDGET(o)->pos))
/* this is not reliable */
#define IS_FLOATING_WIDGET_CLASS(k) (IS_BASEP_WIDGET_CLASS(k))
#define IS_FLOATING_WIDGET_CLASS(k) (IS_BASEP_WIDGET_CLASS(k))
typedef BasePWidget FloatingWidget;
typedef BasePWidgetClass FloatingWidgetClass;
......@@ -44,7 +44,7 @@ struct _FloatingPosClass {
gint x, gint y);
};
GtkType floating_pos_get_type (void);
GtkType floating_pos_get_type (void) G_GNUC_CONST;
GtkWidget *floating_widget_new (gint16 x, gint16 y,
PanelOrientType orient,
BasePMode mode,
......
......@@ -647,13 +647,16 @@ GtkWidget *
foobar_widget_new (void)
{
g_return_val_if_fail (das_global_foobar == NULL, NULL);
das_global_foobar = gtk_type_new (FOOBAR_WIDGET_TYPE);
das_global_foobar = gtk_type_new (TYPE_FOOBAR_WIDGET);
gtk_signal_connect_after (GTK_OBJECT (das_global_foobar),
"size-allocate",
GTK_SIGNAL_FUNC (queue_panel_resizes), NULL);
gtk_signal_connect (GTK_OBJECT (das_global_foobar), "destroy",
GTK_SIGNAL_FUNC (foobar_destroyed),
NULL);
return das_global_foobar;
}
......
......@@ -13,10 +13,10 @@
BEGIN_GNOME_DECLS
#define FOOBAR_WIDGET_TYPE (foobar_widget_get_type ())
#define FOOBAR_WIDGET(o) (GTK_CHECK_CAST (o, FOOBAR_WIDGET_TYPE, FoobarWidget))
#define FOOBAR_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST (k, FOOBAR_WIDGET_TYPE, FoobarWidgetType))
#define IS_FOOBAR_WIDGET(o) (GTK_CHECK_TYPE (o, FOOBAR_WIDGET_TYPE))
#define TYPE_FOOBAR_WIDGET (foobar_widget_get_type ())
#define FOOBAR_WIDGET(o) (GTK_CHECK_CAST ((o), TYPE_FOOBAR_WIDGET, FoobarWidget))
#define FOOBAR_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), TYPE_FOOBAR_WIDGET, FoobarWidgetType))
#define IS_FOOBAR_WIDGET(o) (GTK_CHECK_TYPE ((o), TYPE_FOOBAR_WIDGET))
typedef struct _FoobarWidget FoobarWidget;
typedef struct _FoobarWidgetClass FoobarWidgetClass;
......@@ -43,7 +43,7 @@ struct _FoobarWidgetClass
GtkWindowClass panel_class;
};
GtkType foobar_widget_get_type (void);
GtkType foobar_widget_get_type (void) G_GNUC_CONST;
GtkWidget * foobar_widget_new (void);
void foobar_widget_update_winhints (FoobarWidget *foo);
......
......@@ -3,6 +3,7 @@
* bloatware edition by Havoc Pennington. Both versions written in 10
* minutes or less. :-)
* Copyright (C) 1998 Havoc Pennington <hp@pobox.com>
* Copyright (C) 2000 Eazel, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -20,12 +21,12 @@
* USA
*/