Skip to content

Commit

Permalink
Widgets: set evrything not static as LOCAL_FN
Browse files Browse the repository at this point in the history
  • Loading branch information
nbourdau committed Dec 7, 2010
1 parent 7c6e4f6 commit 7e811ff
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 94 deletions.
52 changes: 28 additions & 24 deletions src/bargraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <gtk/gtk.h>
#include <memory.h>
#include "bargraph.h"
Expand Down Expand Up @@ -52,8 +53,8 @@ bargraph_get_property (GObject *object, guint property_id,
}
*/

static void
bargraph_set_property (GObject *object, guint property_id,
static
void bargraph_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
Bargraph* self = BARGRAPH(object);
Expand All @@ -78,8 +79,8 @@ bargraph_set_property (GObject *object, guint property_id,
}
}

static void
bargraph_finalize (GObject *object)
static
void bargraph_finalize (GObject *object)
{
Bargraph* self = BARGRAPH(object);

Expand All @@ -92,8 +93,8 @@ bargraph_finalize (GObject *object)
}


static void
bargraph_class_init (BargraphClass *klass)
static
void bargraph_class_init (BargraphClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

Expand Down Expand Up @@ -161,16 +162,18 @@ bargraph_init (Bargraph *self)
G_CALLBACK(bargraph_expose_event_callback), NULL);
}

Bargraph*
bargraph_new (void)

LOCAL_FN
Bargraph* bargraph_new (void)
{
return g_object_new(TYPE_BARGRAPH, NULL);
}

static gboolean
bargraph_configure_event_callback (Bargraph *self,
GdkEventConfigure *event,
gpointer data)

static
gboolean bargraph_configure_event_callback(Bargraph *self,
GdkEventConfigure *event,
gpointer data)
{
(void)data;
(void)event;
Expand All @@ -179,10 +182,10 @@ bargraph_configure_event_callback (Bargraph *self,
}


static gboolean
bargraph_expose_event_callback (Bargraph *self,
GdkEventExpose *event,
gpointer data)
static
gboolean bargraph_expose_event_callback(Bargraph *self,
GdkEventExpose *event,
gpointer data)
{
(void)data;
(void)event;
Expand All @@ -193,9 +196,8 @@ bargraph_expose_event_callback (Bargraph *self,
}



static void
bargraph_draw_samples(const Bargraph* self)
static
void bargraph_draw_samples(const Bargraph* self)
{
guint i, iChannel, iColor, width, height, nColors, num_ticks;
gint ivalue, jvalue, halfwidth, Yorg, rectH;
Expand Down Expand Up @@ -258,8 +260,8 @@ bargraph_draw_samples(const Bargraph* self)
}


static void
bargraph_calculate_drawparameters(Bargraph* self)
static
void bargraph_calculate_drawparameters(Bargraph* self)
{
guint height, width, i;
gint *xticks, *yticks;
Expand Down Expand Up @@ -301,8 +303,8 @@ bargraph_calculate_drawparameters(Bargraph* self)
}


void
bargraph_update_data(Bargraph* self, guint pointer)
LOCAL_FN
void bargraph_update_data(Bargraph* self, guint pointer)
{
GdkRectangle rect;
//GdkWindow* window;
Expand Down Expand Up @@ -336,6 +338,8 @@ bargraph_update_data(Bargraph* self, guint pointer)
}
}


LOCAL_FN
void bargraph_set_data(Bargraph* self, data_t* data, guint num_ch)
{
self->data = data;
Expand All @@ -351,7 +355,7 @@ void bargraph_set_data(Bargraph* self, data_t* data, guint num_ch)
}



LOCAL_FN
void bargraph_set_ticks(Bargraph* self, guint num_ticks, data_t* tick_values)
{
if (num_ticks != self->num_ticks) {
Expand Down
52 changes: 30 additions & 22 deletions src/binary-scope.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <gtk/gtk.h>
#include "binary-scope.h"
#include <memory.h>
Expand Down Expand Up @@ -54,8 +55,8 @@ binary_scope_set_property (GObject *object, guint property_id,
}
*/

static void
binary_scope_finalize (GObject *object)
static
void binary_scope_finalize (GObject *object)
{
BinaryScope* self = BINARY_SCOPE(object);

Expand All @@ -70,8 +71,8 @@ binary_scope_finalize (GObject *object)
}


static void
binary_scope_class_init (BinaryScopeClass *klass)
static
void binary_scope_class_init (BinaryScopeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

Expand All @@ -80,8 +81,9 @@ binary_scope_class_init (BinaryScopeClass *klass)
object_class->finalize = binary_scope_finalize;
}

static void
binary_scope_init (BinaryScope *self)

static
void binary_scope_init (BinaryScope *self)
{
// Initialize members
self->num_channels = 0;
Expand All @@ -101,16 +103,18 @@ binary_scope_init (BinaryScope *self)
G_CALLBACK(binary_scope_expose_event_callback), NULL);
}

BinaryScope*
binary_scope_new (void)

LOCAL_FN
BinaryScope* binary_scope_new (void)
{
return g_object_new(TYPE_BINARY_SCOPE, NULL);
}

static gboolean
binary_scope_configure_event_callback (BinaryScope *self,
GdkEventConfigure *event,
gpointer data)

static
gboolean binary_scope_configure_event_callback(BinaryScope *self,
GdkEventConfigure *event,
gpointer data)
{
(void)event;
(void)data;
Expand All @@ -120,10 +124,10 @@ binary_scope_configure_event_callback (BinaryScope *self,
}


static gboolean
binary_scope_expose_event_callback (BinaryScope *self,
GdkEventExpose *event,
gpointer data)
static
gboolean binary_scope_expose_event_callback(BinaryScope *self,
GdkEventExpose *event,
gpointer data)
{
unsigned int first, last, num_points;
int xmin, xmax;
Expand Down Expand Up @@ -154,8 +158,9 @@ binary_scope_expose_event_callback (BinaryScope *self,



static void
binary_scope_draw_samples(const BinaryScope* self, unsigned int first, unsigned int last)
static
void binary_scope_draw_samples(const BinaryScope* self, unsigned int first,
unsigned int last)
{
unsigned int i, iChannel, iSample, iColor;
gint xmin, xmax;
Expand Down Expand Up @@ -226,8 +231,8 @@ binary_scope_draw_samples(const BinaryScope* self, unsigned int first, unsigned
}


static void
binary_scope_calculate_drawparameters(const BinaryScope* self)
static
void binary_scope_calculate_drawparameters(const BinaryScope* self)
{
guint height, width;
unsigned int i, num_ch, num_points;
Expand All @@ -253,8 +258,8 @@ binary_scope_calculate_drawparameters(const BinaryScope* self)
}


void
binary_scope_update_data(BinaryScope* self, guint pointer)
LOCAL_FN
void binary_scope_update_data(BinaryScope* self, guint pointer)
{
int first, last;
GdkRectangle rect;
Expand Down Expand Up @@ -298,6 +303,8 @@ binary_scope_update_data(BinaryScope* self, guint pointer)
}
}


LOCAL_FN
void binary_scope_set_data(BinaryScope* self, guint32* data, guint num_points, guint num_ch)
{
int has_changed = 0;
Expand Down Expand Up @@ -331,6 +338,7 @@ void binary_scope_set_data(BinaryScope* self, guint32* data, guint num_points, g
}


LOCAL_FN
void binary_scope_set_ticks(BinaryScope* self, guint num_ticks, guint* ticks)
{
if (num_ticks != self->num_ticks) {
Expand Down
46 changes: 32 additions & 14 deletions src/gtk-led.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <gtk/gtk.h>
#include "gtk-led.h"

#include <gdk-pixbuf/gdk-pixdata.h>
#include "led-images.h"

const GdkPixdata const* led_image_data[NUM_COLORS_LED] = {&pix_led_gray, &pix_led_red, &pix_led_green, &pix_led_blue};
static const GdkPixdata const* led_image_data[NUM_COLORS_LED] = {
[GRAY_LED] = &pix_led_gray,
[RED_LED] = &pix_led_red,
[GREEN_LED] = &pix_led_green,
[BLUE_LED] = &pix_led_blue
};

enum {
DUMMY_PROP,
Expand All @@ -33,8 +39,10 @@ enum {
COLOR_OFF_PROP
};

void gtk_led_expose_event_callback(GtkLed* self, GdkEventExpose* event, gpointer data);
static void gtk_led_expose_event_callback(GtkLed* self, GdkEventExpose* event, gpointer data);


LOCAL_FN
GType led_color_get_type(void)
{
static GType type = 0;
Expand All @@ -58,8 +66,8 @@ GType led_color_get_type(void)

G_DEFINE_TYPE (GtkLed, gtk_led, GTK_TYPE_WIDGET)

static void
gtk_led_set_property (GObject *object, guint property_id,
static
void gtk_led_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
GtkLed* self = GTK_LED(object);
Expand All @@ -86,9 +94,10 @@ gtk_led_set_property (GObject *object, guint property_id,
gtk_widget_queue_draw(GTK_WIDGET(self));
}

static void
gtk_led_size_request (GtkWidget * widget,
GtkRequisition * requisition)

static
void gtk_led_size_request (GtkWidget * widget,
GtkRequisition * requisition)
{
//GtkLedClass* klass = gtk_type_class(GTK_TYPE_LED);
g_return_if_fail (widget != NULL);
Expand All @@ -101,9 +110,9 @@ gtk_led_size_request (GtkWidget * widget,
}


static void
gtk_led_size_allocate (GtkWidget * widget,
GtkAllocation * allocation)
static
void gtk_led_size_allocate(GtkWidget * widget,
GtkAllocation * allocation)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_LED (widget));
Expand All @@ -121,8 +130,8 @@ gtk_led_size_allocate (GtkWidget * widget,
}


static void
gtk_led_realize (GtkWidget * widget)
static
void gtk_led_realize(GtkWidget * widget)
{
GdkWindowAttr attributes;
guint attributes_mask;
Expand Down Expand Up @@ -154,7 +163,8 @@ gtk_led_realize (GtkWidget * widget)
}


static void gtk_led_class_init (GtkLedClass *klass)
static
void gtk_led_class_init(GtkLedClass *klass)
{
int i;
GdkPixbuf* pixbuf;
Expand Down Expand Up @@ -215,7 +225,9 @@ static void gtk_led_class_init (GtkLedClass *klass)
g_object_unref(G_OBJECT(klass->off_pixbuf));
}*/

static void gtk_led_init(GtkLed *self)

static
void gtk_led_init(GtkLed *self)
{
self->state = FALSE;
self->color_off = GRAY_LED;
Expand All @@ -226,11 +238,15 @@ static void gtk_led_init(GtkLed *self)
G_CALLBACK(gtk_led_expose_event_callback), NULL);
}


LOCAL_FN
GtkLed* gtk_led_new (void)
{
return g_object_new (GTK_TYPE_LED, NULL);
}


LOCAL_FN
void gtk_led_set_state(GtkLed* self, gboolean state)
{
if (self->state != state) {
Expand All @@ -239,6 +255,8 @@ void gtk_led_set_state(GtkLed* self, gboolean state)
}
}


static
void gtk_led_expose_event_callback(GtkLed* self, GdkEventExpose* event, gpointer data)
{
GdkPixbuf* pixbuf;
Expand Down
Loading

0 comments on commit 7e811ff

Please sign in to comment.