Browse Source

* Fix a whole bunch of compiler warnings.

(Old svn revision: 29078)
upstream/xfce4-panel-4.10.1
Nick Schermer 14 years ago
parent
commit
9a6012da4b
  1. 3
      libxfce4panel/Makefile.am
  2. 8
      libxfce4panel/xfce-itembar.c
  3. 99
      libxfce4panel/xfce-panel-plugin.h
  4. 2
      panel/frap-icon-entry.c
  5. 2
      panel/main.c
  6. 13
      panel/panel-app.c
  7. 10
      panel/panel-dialogs.c
  8. 8
      panel/panel-dnd.c
  9. 4
      panel/panel-properties.c
  10. 3
      panel/panel-properties.h
  11. 31
      panel/panel.c
  12. 24
      plugins/clock/clock-analog.c
  13. 44
      plugins/clock/clock-binary.c
  14. 196
      plugins/clock/clock-dialog.c
  15. 32
      plugins/clock/clock-digital.c
  16. 60
      plugins/clock/clock-lcd.c
  17. 280
      plugins/clock/clock.c
  18. 6
      plugins/iconbox/iconbox.c
  19. 8
      plugins/launcher/launcher-dialog.c
  20. 4
      plugins/launcher/launcher-exec.c
  21. 6
      plugins/launcher/launcher.c
  22. 8
      plugins/launcher/launcher.h
  23. 2
      plugins/pager/xfce-pager.h
  24. 3
      plugins/systray/Makefile.am
  25. 2
      plugins/windowlist/xfce4-popup-windowlist.c

3
libxfce4panel/Makefile.am

@ -163,7 +163,8 @@ stamp-libxfce4panel-marshal.h: $(srcdir)/libxfce4panel-marshal.list Makefile
&& echo timestamp > $(@F)
libxfce4panel-marshal.c: libxfce4panel-marshal.h Makefile
( cd $(srcdir) && glib-genmarshal \
echo "#include <libxfce4panel/libxfce4panel-marshal.h>" > xgen-mc \
&& ( cd $(srcdir) && glib-genmarshal \
--prefix="_libxfce4panel_marshal" \
--body libxfce4panel-marshal.list ) >> xgen-mc \
&& cp xgen-mc libxfce4panel-marshal.c \

8
libxfce4panel/xfce-itembar.c

@ -893,7 +893,7 @@ _find_drop_index (XfceItembar *itembar,
{
GSList *l;
GtkTextDirection direction;
gint distance, cursor, pos, i, index;
gint distance, cursor, pos, i, idx;
XfceItembarChild *child;
XfceItembarPrivate *priv = itembar->priv;
gint best_distance = G_MAXINT;
@ -903,7 +903,7 @@ _find_drop_index (XfceItembar *itembar,
direction = gtk_widget_get_direction (GTK_WIDGET (itembar));
index = 0;
idx = 0;
child = priv->children->data;
@ -956,11 +956,11 @@ _find_drop_index (XfceItembar *itembar,
if (distance <= best_distance)
{
best_distance = distance;
index = i;
idx = i;
}
}
return index;
return idx;
}

99
libxfce4panel/xfce-panel-plugin.h

@ -39,8 +39,8 @@ G_BEGIN_DECLS
*
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
**/
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(construct) \
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,NULL,NULL)
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(construct) \
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,NULL,NULL)
/**
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK
@ -56,16 +56,16 @@ G_BEGIN_DECLS
*
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
**/
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK(construct,check) \
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,NULL,check)
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK(construct,check) \
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,NULL,check)
/**
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL
* @construct : name of a function that can be cast to #XfcePanelPluginFunc
* @init : name of a function that can be case to #XfcePanelPluginPreInit
* or NULL
* or NULL
* @check : name of a function that can be cast to #XfcePanelPluginCheck
* or NULL
* or NULL
*
* Registers and initializes the plugin. This is the only thing that is
* required to create a panel plugin.
@ -83,41 +83,41 @@ G_BEGIN_DECLS
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
* Since: 4.5
**/
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,init,check) \
gint \
main (gint argc, gchar **argv) \
{ \
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,init,check) \
gint \
main (gint argc, gchar **argv) \
{ \
GtkWidget *plugin; \
XfcePanelPluginFunc create = (XfcePanelPluginFunc)construct; \
XfcePanelPluginPreInit preinit = (XfcePanelPluginPreInit)init; \
XfcePanelPluginCheck test = (XfcePanelPluginCheck)check; \
\
if ( preinit ) \
{ \
if (G_UNLIKELY (preinit(argc,argv) == FALSE)) \
return 3; \
} \
\
gtk_init (&argc, &argv); \
\
if ( test ) \
{ \
if (G_UNLIKELY (test(gdk_screen_get_default()) == FALSE)) \
return 2; \
} \
\
plugin = xfce_external_panel_plugin_new (argc, argv, create); \
\
if (G_UNLIKELY (plugin == NULL)) \
return 1; \
\
g_signal_connect_after (G_OBJECT (plugin), "destroy", \
G_CALLBACK (gtk_main_quit), NULL); \
\
gtk_widget_show (plugin); \
gtk_main (); \
\
return 0; \
XfcePanelPluginFunc create = (XfcePanelPluginFunc) construct; \
XfcePanelPluginPreInit preinit = (XfcePanelPluginPreInit) init; \
XfcePanelPluginCheck test = (XfcePanelPluginCheck) check; \
\
if ( preinit ) \
{ \
if (G_UNLIKELY (preinit(argc,argv) == FALSE)) \
return 3; \
} \
\
gtk_init (&argc, &argv); \
\
if ( test ) \
{ \
if (G_UNLIKELY (test(gdk_screen_get_default()) == FALSE)) \
return 2; \
} \
\
plugin = xfce_external_panel_plugin_new (argc, argv, create); \
\
if (G_UNLIKELY (plugin == NULL)) \
return 1; \
\
g_signal_connect_after (G_OBJECT (plugin), "destroy", \
G_CALLBACK (gtk_main_quit), NULL); \
\
gtk_widget_show (plugin); \
gtk_main (); \
\
return 0; \
}
/**
@ -133,11 +133,13 @@ G_BEGIN_DECLS
*
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
**/
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL(construct) \
XfcePanelPluginFunc \
xfce_panel_plugin_get_construct (void) \
{ \
return (XfcePanelPluginFunc)construct; \
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL(construct) \
XfcePanelPluginFunc xfce_panel_plugin_get_construct (void); \
\
XfcePanelPluginFunc \
xfce_panel_plugin_get_construct (void) \
{ \
return (XfcePanelPluginFunc) construct; \
}
/**
@ -158,15 +160,18 @@ G_BEGIN_DECLS
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
**/
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK(construct,check) \
XfcePanelPluginFunc xfce_panel_plugin_get_construct (void); \
XfcePanelPluginCheck xfce_panel_plugin_get_check (void); \
\
XfcePanelPluginFunc \
xfce_panel_plugin_get_construct (void) \
{ \
return (XfcePanelPluginFunc)construct; \
return (XfcePanelPluginFunc) construct; \
} \
XfcePanelPluginCheck \
xfce_panel_plugin_get_check (void) \
{ \
return (XfcePanelPluginCheck)check; \
return (XfcePanelPluginCheck) check; \
}
G_END_DECLS

2
panel/frap-icon-entry.c

@ -47,8 +47,6 @@ enum
static void frap_icon_entry_class_init (FrapIconEntryClass *klass);
static void frap_icon_entry_init (FrapIconEntry *icon_entry);
static void frap_icon_entry_finalize (GObject *object);
static void frap_icon_entry_get_property (GObject *object,
guint prop_id,

2
panel/main.c

@ -85,7 +85,7 @@ main (gint argc, gchar **argv)
MARK ("start gtk_init_with_args ()");
/* initialize gtk */
if (!gtk_init_with_args (&argc, &argv, "", option_entries, GETTEXT_PACKAGE, &error))
if (!gtk_init_with_args (&argc, &argv, (gchar *) "", option_entries, (gchar *) GETTEXT_PACKAGE, &error))
{
g_print ("%s: %s\n", PACKAGE_NAME, error ? error->message : _("Failed to open display"));

13
panel/panel-app.c

@ -73,6 +73,7 @@
#define SELECTION_NAME "XFCE4_PANEL"
#define PANEL_LAUNCHER "launcher"
#define SAVE_TIMEOUT 30000
#define TEST_MULTIPLE_MONITORS FALSE
#if defined(TIMER) && defined(G_HAVE_ISO_VARARGS)
void
@ -297,15 +298,15 @@ signal_pipe_io (GIOChannel *source,
GIOCondition cond,
gpointer data)
{
gint signal;
gint signal_;
gsize bytes_read;
if (G_IO_STATUS_NORMAL == g_io_channel_read_chars (source, (gchar *)&signal,
sizeof (signal),
if (G_IO_STATUS_NORMAL == g_io_channel_read_chars (source, (gchar *)&signal_,
sizeof (signal_),
&bytes_read, NULL)
&& sizeof(signal) == bytes_read)
&& sizeof(signal_) == bytes_read)
{
switch (signal)
switch (signal_)
{
case SIGUSR1:
DBG ("USR1 signal caught");
@ -717,7 +718,7 @@ panel_app_run (gchar *client_id)
SESSION_RESTART_IMMEDIATELY,
40,
client_id,
PACKAGE_NAME,
(gchar *) PACKAGE_NAME,
NULL,
restart_command,
g_strdupv (restart_command),

10
panel/panel-dialogs.c

@ -290,7 +290,7 @@ render_text (GtkTreeViewColumn *col,
static void
treeview_data_received (GtkWidget *widget, GdkDragContext *context,
gint x, gint y, GtkSelectionData *data,
guint info, guint time, PanelItemsDialog *pid)
guint info, guint time_, PanelItemsDialog *pid)
{
gboolean succeeded = FALSE;
GtkWidget *item;
@ -307,12 +307,12 @@ treeview_data_received (GtkWidget *widget, GdkDragContext *context,
}
/* finish the drag */
gtk_drag_finish (context, succeeded, FALSE, time);
gtk_drag_finish (context, succeeded, FALSE, time_);
}
static gboolean
treeview_drag_drop (GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time, PanelItemsDialog *pid)
gint x, gint y, guint time_, PanelItemsDialog *pid)
{
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
@ -321,7 +321,7 @@ treeview_drag_drop (GtkWidget *widget, GdkDragContext *context,
return FALSE;
/* request the drag data */
gtk_drag_get_data (widget, context, target, time);
gtk_drag_get_data (widget, context, target, time_);
/* we call gtk_drag_finish later */
return TRUE;
@ -344,7 +344,7 @@ treeview_drag_begin (GtkWidget *treeview, GdkDragContext *context,
static void
treeview_data_get (GtkWidget *widget, GdkDragContext *drag_context,
GtkSelectionData *data, guint info,
guint time, PanelItemsDialog *pid)
guint time_, PanelItemsDialog *pid)
{
XfcePanelItemInfo *item_info;
const gchar *item_name;

8
panel/panel-dnd.c

@ -33,18 +33,18 @@
static const GtkTargetEntry dest_target_list[] =
{
{ "application/x-xfce-panel-plugin-name", 0, TARGET_PLUGIN_NAME },
{ "application/x-xfce-panel-plugin-widget", GTK_TARGET_SAME_APP, TARGET_PLUGIN_WIDGET }
{ (gchar *) "application/x-xfce-panel-plugin-name", 0, TARGET_PLUGIN_NAME },
{ (gchar *) "application/x-xfce-panel-plugin-widget", GTK_TARGET_SAME_APP, TARGET_PLUGIN_WIDGET }
};
static const GtkTargetEntry name_target_list[] =
{
{ "application/x-xfce-panel-plugin-name", 0, TARGET_PLUGIN_NAME }
{ (gchar *) "application/x-xfce-panel-plugin-name", 0, TARGET_PLUGIN_NAME }
};
static const GtkTargetEntry widget_target_list[] =
{
{ "application/x-xfce-panel-plugin-widget", GTK_TARGET_SAME_APP, TARGET_PLUGIN_WIDGET }
{ (gchar *) "application/x-xfce-panel-plugin-widget", GTK_TARGET_SAME_APP, TARGET_PLUGIN_WIDGET }
};
/* public API */

4
panel/panel-properties.c

@ -766,7 +766,7 @@ drag_motion (Panel *panel,
GdkDragContext *context,
int x,
int y,
guint time,
guint time_,
gpointer user_data)
{
PanelPrivate *priv;
@ -796,7 +796,7 @@ drag_motion (Panel *panel,
static void
drag_leave (Panel *panel,
GdkDragContext *drag_context,
guint time,
guint time_,
gpointer user_data)
{
int x, y, w, h, px, py;

3
panel/panel-properties.h

@ -67,6 +67,9 @@ void panel_screen_size_changed (GdkScreen *screen,
void panel_set_autohide (Panel *panel,
gboolean autohide);
void panel_set_hidden (Panel *panel,
gboolean hide);
void panel_block_autohide (Panel *panel);

31
panel/panel.c

@ -95,14 +95,14 @@ static void _panel_drag_data_received (GtkWidget *widget,
gint y,
GtkSelectionData *data,
guint info,
guint time,
guint time_,
Panel *panel);
static gboolean _panel_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
guint time_,
Panel *panel);
/* DND source */
@ -415,14 +415,14 @@ _panel_drag_data_received (GtkWidget *widget,
gint y,
GtkSelectionData *data,
guint info,
guint time,
guint time_,
Panel *panel)
{
XfceItembar *itembar = XFCE_ITEMBAR (widget);
PanelPrivate *priv = panel->priv;
XfcePanelItem *item;
GtkWidget *plugin;
gint index;
gint index_;
gint oldindex;
gboolean expand;
gboolean succeed = FALSE;
@ -430,7 +430,7 @@ _panel_drag_data_received (GtkWidget *widget,
DBG (" + drag data received: %d", info);
/* get the drop index */
index = xfce_itembar_get_drop_index (itembar, x, y);
index_ = xfce_itembar_get_drop_index (itembar, x, y);
switch (info)
{
@ -438,7 +438,7 @@ _panel_drag_data_received (GtkWidget *widget,
if (data->length > 0)
{
/* insert the new plugin */
panel_insert_item (panel, (const gchar *) data->data, index);
panel_insert_item (panel, (const gchar *) data->data, index_);
/* succeeded */
succeed = TRUE;
@ -470,7 +470,7 @@ _panel_drag_data_received (GtkWidget *widget,
xfce_panel_item_set_screen_position (item, priv->screen_position);
/* update the itembar */
xfce_itembar_reorder_child (itembar, plugin, index);
xfce_itembar_reorder_child (itembar, plugin, index_);
xfce_itembar_set_child_expand (itembar, plugin, expand);
/* thaw update notifications */
@ -481,11 +481,11 @@ _panel_drag_data_received (GtkWidget *widget,
/* get the old index */
oldindex = xfce_itembar_get_item_index (itembar, plugin);
if (index > oldindex)
index--;
if (index_ > oldindex)
index_--;
if (index != oldindex)
xfce_itembar_reorder_child (itembar, plugin, index);
if (index_ != oldindex)
xfce_itembar_reorder_child (itembar, plugin, index_);
}
/* properly handled */
@ -498,7 +498,7 @@ _panel_drag_data_received (GtkWidget *widget,
}
/* finish the drag */
gtk_drag_finish (context, succeed, FALSE, time);
gtk_drag_finish (context, succeed, FALSE, time_);
}
static gboolean
@ -506,7 +506,7 @@ _panel_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
guint time_,
Panel *panel)
{
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
@ -516,7 +516,7 @@ _panel_drag_drop (GtkWidget *widget,
return FALSE;
/* request the drag data */
gtk_drag_get_data (widget, context, target, time);
gtk_drag_get_data (widget, context, target, time_);
/* we call gtk_drag_finish later */
return TRUE;
@ -824,8 +824,7 @@ _item_start_move (GtkWidget *item,
g_signal_connect (G_OBJECT (item), "drag-end", G_CALLBACK (_item_start_move_end), panel);
}
extern void panel_set_hidden (Panel *panel,
gboolean hide);
static void
_item_set_panel_hidden (GtkWidget *item,

24
plugins/clock/clock-analog.c

@ -45,8 +45,6 @@
/* prototypes */
static void xfce_clock_analog_class_init (XfceClockAnalogClass *klass);
static void xfce_clock_analog_init (XfceClockAnalog *clock);
static void xfce_clock_analog_finalize (GObject *object);
static void xfce_clock_analog_set_property (GObject *object,
guint prop_id,
@ -57,7 +55,7 @@ static void xfce_clock_analog_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_analog_size_request (GtkWidget *widget,
GtkRequisition *requisition);
GtkRequisition *requisition);
static gboolean xfce_clock_analog_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void xfce_clock_analog_draw_ticks (cairo_t *cr,
@ -126,10 +124,10 @@ xfce_clock_analog_class_init (XfceClockAnalogClass *klass)
static void
xfce_clock_analog_init (XfceClockAnalog *clock)
xfce_clock_analog_init (XfceClockAnalog *analog)
{
/* init */
clock->show_seconds = FALSE;
analog->show_seconds = FALSE;
}
@ -148,12 +146,12 @@ xfce_clock_analog_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
XfceClockAnalog *clock = XFCE_CLOCK_ANALOG (object);
XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
clock->show_seconds = g_value_get_boolean (value);
analog->show_seconds = g_value_get_boolean (value);
break;
default:
@ -170,12 +168,12 @@ xfce_clock_analog_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
XfceClockAnalog *clock = XFCE_CLOCK_ANALOG (object);
XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
g_value_set_boolean (value, clock->show_seconds);
g_value_set_boolean (value, analog->show_seconds);
break;
default:
@ -188,7 +186,7 @@ xfce_clock_analog_get_property (GObject *object,
static void
xfce_clock_analog_size_request (GtkWidget *widget,
GtkRequisition *requisition)
GtkRequisition *requisition)
{
gint width, height;
@ -205,13 +203,13 @@ static gboolean
xfce_clock_analog_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
XfceClockAnalog *clock = XFCE_CLOCK_ANALOG (widget);
XfceClockAnalog *analog = XFCE_CLOCK_ANALOG (widget);
gdouble xc, yc;
gdouble angle, radius;
cairo_t *cr;
struct tm tm;
g_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (clock), FALSE);
g_return_val_if_fail (XFCE_CLOCK_IS_ANALOG (analog), FALSE);
/* get center of the widget and the radius */
xc = (widget->allocation.width / 2.0);
@ -241,7 +239,7 @@ xfce_clock_analog_expose_event (GtkWidget *widget,
/* draw the ticks */
xfce_clock_analog_draw_ticks (cr, xc, yc, radius);
if (clock->show_seconds)
if (analog->show_seconds)
{
/* second pointer */
angle = TICKS_TO_RADIANS (tm.tm_sec);

44
plugins/clock/clock-binary.c

@ -41,8 +41,6 @@
/* class functions */
static void xfce_clock_binary_class_init (XfceClockBinaryClass *klass);
static void xfce_clock_binary_init (XfceClockBinary *clock);
static void xfce_clock_binary_finalize (GObject *object);
static void xfce_clock_binary_set_property (GObject *object,
guint prop_id,
@ -53,7 +51,7 @@ static void xfce_clock_binary_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_binary_size_request (GtkWidget *widget,
GtkRequisition *requisition);
GtkRequisition *requisition);
static gboolean xfce_clock_binary_expose_event (GtkWidget *widget,
GdkEventExpose *event);
@ -122,11 +120,11 @@ xfce_clock_binary_class_init (XfceClockBinaryClass *klass)
static void
xfce_clock_binary_init (XfceClockBinary *clock)
xfce_clock_binary_init (XfceClockBinary *binary)
{
/* init */
clock->show_seconds = FALSE;
clock->true_binary = FALSE;
binary->show_seconds = FALSE;
binary->true_binary = FALSE;
}
@ -145,16 +143,16 @@ xfce_clock_binary_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
XfceClockBinary *clock = XFCE_CLOCK_BINARY (object);
XfceClockBinary *binary = XFCE_CLOCK_BINARY (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
clock->show_seconds = g_value_get_boolean (value);
binary->show_seconds = g_value_get_boolean (value);
break;
case PROP_TRUE_BINARY:
clock->true_binary = g_value_get_boolean (value);
binary->true_binary = g_value_get_boolean (value);
break;
default:
@ -171,16 +169,16 @@ xfce_clock_binary_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
XfceClockBinary *clock = XFCE_CLOCK_BINARY (object);
XfceClockBinary *binary = XFCE_CLOCK_BINARY (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
g_value_set_boolean (value, clock->show_seconds);
g_value_set_boolean (value, binary->show_seconds);
break;
case PROP_TRUE_BINARY:
g_value_set_boolean (value, clock->true_binary);
g_value_set_boolean (value, binary->true_binary);
break;
default:
@ -193,23 +191,23 @@ xfce_clock_binary_get_property (GObject *object,
static void
xfce_clock_binary_size_request (GtkWidget *widget,
GtkRequisition *requisition)
GtkRequisition *requisition)
{
gint width, height;
gdouble ratio;
XfceClockBinary *clock = XFCE_CLOCK_BINARY (widget);
XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget);
/* get the current widget size */
gtk_widget_get_size_request (widget, &width, &height);
/* ratio of the clock */
if (clock->true_binary)
if (binary->true_binary)
{
ratio = clock->show_seconds ? 2.0 : 3.0;
ratio = binary->show_seconds ? 2.0 : 3.0;
}
else
{
ratio = clock->show_seconds ? 1.5 : 1.0;
ratio = binary->show_seconds ? 1.5 : 1.0;
}
/* set requisition based on the plugin orientation */
@ -231,7 +229,7 @@ static gboolean
xfce_clock_binary_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
XfceClockBinary *clock = XFCE_CLOCK_BINARY (widget);
XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget);
gdouble cw, ch, columns;
gint ticks, cells, decimal;
gdouble radius;
@ -243,14 +241,14 @@ xfce_clock_binary_expose_event (GtkWidget *widget,
GdkColor active, inactive;
struct tm tm;
g_return_val_if_fail (XFCE_CLOCK_IS_BINARY (clock), FALSE);
g_return_val_if_fail (XFCE_CLOCK_IS_BINARY (binary), FALSE);
/* number of columns and cells */
columns = clock->show_seconds ? 3.0 : 2.0;
cells = clock->true_binary ? 6 : 8;
columns = binary->show_seconds ? 3.0 : 2.0;
cells = binary->true_binary ? 6 : 8;
/* cell width and height */
if (clock->true_binary)
if (binary->true_binary)
{
cw = widget->allocation.width / 6.0;
ch = widget->allocation.height / columns;
@ -294,7 +292,7 @@ xfce_clock_binary_expose_event (GtkWidget *widget,
/* walk the binary columns */
for (j = 0; j < cells; j++)
{
if (clock->true_binary)
if (binary->true_binary)
{
/* skip the columns we don't draw */
if (i == 0 && j == 0)

196
plugins/clock/clock-dialog.c

@ -54,26 +54,26 @@ static const gchar *digital_formats[] = {
/** prototypes **/
void xfce_clock_dialog_options (ClockPlugin *clock);
void xfce_clock_dialog_options (ClockPlugin *plugin);
static void
xfce_clock_dialog_reload_settings (ClockPlugin *clock)
xfce_clock_dialog_reload_settings (ClockPlugin *plugin)
{
if (G_LIKELY (clock->widget))
if (G_LIKELY (plugin->widget))
{
/* save the settings */
xfce_clock_widget_update_settings (clock);
xfce_clock_widget_update_settings (plugin);
/* make sure the plugin sets it's size again */
gtk_widget_queue_resize (clock->widget);
gtk_widget_queue_resize (plugin->widget);
/* run a direct update */
(clock->update) (clock->widget);
(plugin->update) (plugin->widget);
/* reschedule the timeout */
xfce_clock_widget_sync (clock);
xfce_clock_widget_sync (plugin);
}
}
@ -81,82 +81,82 @@ xfce_clock_dialog_reload_settings (ClockPlugin *clock)
static void
xfce_clock_dialog_mode_changed (GtkComboBox *combo,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* set the new mode */
clock->mode = gtk_combo_box_get_active (combo);
plugin->mode = gtk_combo_box_get_active (combo);
/* update the plugin widget */
if (G_LIKELY (clock->widget))
if (G_LIKELY (plugin->widget))
{
/* set the new clock mode */
xfce_clock_widget_set_mode (clock);
xfce_clock_widget_set_mode (plugin);
/* update the settings */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
/* update the plugin size */
xfce_clock_plugin_set_size (clock, xfce_panel_plugin_get_size (clock->plugin));
xfce_clock_plugin_set_size (plugin, xfce_panel_plugin_get_size (plugin->plugin));
}
/* update the dialog */
xfce_clock_dialog_options (clock);
xfce_clock_dialog_options (plugin);
}
static void
xfce_clock_dialog_show_frame_toggled (GtkToggleButton *button,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* set frame mode */
clock->show_frame = gtk_toggle_button_get_active (button);
plugin->show_frame = gtk_toggle_button_get_active (button);
/* change frame shadow */
gtk_frame_set_shadow_type (GTK_FRAME (clock->frame), clock->show_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), plugin->show_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
}
static void
xfce_clock_dialog_tooltip_format_changed (GtkComboBox *combo,
ClockPlugin *clock)
ClockPlugin *plugin)
{
gint index;
gint idx;
GtkWidget *entry;
/* stop running timeout */
if (clock->tooltip_timeout_id)
if (plugin->tooltip_timeout_id)
{
g_source_remove (clock->tooltip_timeout_id);
clock->tooltip_timeout_id = 0;
g_source_remove (plugin->tooltip_timeout_id);
plugin->tooltip_timeout_id = 0;
}
/* get index of selected item */
index = gtk_combo_box_get_active (combo);
idx = gtk_combo_box_get_active (combo);
/* get the custom entry */
entry = g_object_get_data (G_OBJECT (combo), I_("entry"));
/* set one of the default formats */
if (index < (gint) G_N_ELEMENTS (tooltip_formats))
if (idx < (gint) G_N_ELEMENTS (tooltip_formats))
{
/* hide the entry */
gtk_widget_hide (entry);
/* cleanup old format */
g_free (clock->tooltip_format);
g_free (plugin->tooltip_format);
/* set new format */
clock->tooltip_format = g_strdup (tooltip_formats[index]);
plugin->tooltip_format = g_strdup (tooltip_formats[idx]);
/* restart the tooltip timeout */
xfce_clock_tooltip_sync (clock);
xfce_clock_tooltip_sync (plugin);
}
else
{
/* set string */
gtk_entry_set_text (GTK_ENTRY (entry), clock->tooltip_format);
gtk_entry_set_text (GTK_ENTRY (entry), plugin->tooltip_format);
/* show */
gtk_widget_show (entry);
@ -167,117 +167,117 @@ xfce_clock_dialog_tooltip_format_changed (GtkComboBox *combo,
static void
xfce_clock_dialog_tooltip_entry_changed (GtkEntry *entry,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* cleanup old format */
g_free (clock->tooltip_format);
g_free (plugin->tooltip_format);
/* set new format */
clock->tooltip_format = g_strdup (gtk_entry_get_text (entry));
plugin->tooltip_format = g_strdup (gtk_entry_get_text (entry));
/* restart the tooltip timeout */
xfce_clock_tooltip_sync (clock);
xfce_clock_tooltip_sync (plugin);
}
static void
xfce_clock_dialog_show_seconds_toggled (GtkToggleButton *button,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* whether we show seconds */
clock->show_seconds = gtk_toggle_button_get_active (button);
plugin->show_seconds = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
static void
xfce_clock_dialog_show_military_toggled (GtkToggleButton *button,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* whether we show a 24h clock */
clock->show_military = gtk_toggle_button_get_active (button);
plugin->show_military = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
static void
xfce_clock_dialog_show_meridiem_toggled (GtkToggleButton *button,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* whether we show am/pm */
clock->show_meridiem = gtk_toggle_button_get_active (button);
plugin->show_meridiem = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
static void
xfce_clock_dialog_flash_separators_toggled (GtkToggleButton *button,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* whether flash the separators */
clock->flash_separators = gtk_toggle_button_get_active (button);
plugin->flash_separators = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
static void
xfce_clock_dialog_true_binary_toggled (GtkToggleButton *button,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* whether we this is a true binary clock */
clock->true_binary = gtk_toggle_button_get_active (button);
plugin->true_binary = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
static void
xfce_clock_dialog_digital_format_changed (GtkComboBox *combo,
ClockPlugin *clock)
ClockPlugin *plugin)
{
gint index;
gint idx;
GtkWidget *entry;
/* get index of selected item */
index = gtk_combo_box_get_active (combo);
idx = gtk_combo_box_get_active (combo);
/* get the custom entry */
entry = g_object_get_data (G_OBJECT (combo), I_("entry"));
/* set one of the default formats */
if (index < (gint) G_N_ELEMENTS (digital_formats))
if (idx < (gint) G_N_ELEMENTS (digital_formats))
{
/* hide the entry */
gtk_widget_hide (entry);
/* cleanup old format */
g_free (clock->digital_format);
g_free (plugin->digital_format);
/* set new format */
clock->digital_format = g_strdup (digital_formats[index]);
plugin->digital_format = g_strdup (digital_formats[idx]);
/* reload settings */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
else
{
/* set string */
gtk_entry_set_text (GTK_ENTRY (entry), clock->digital_format);
gtk_entry_set_text (GTK_ENTRY (entry), plugin->digital_format);
/* show */
gtk_widget_show (entry);
@ -288,16 +288,16 @@ xfce_clock_dialog_digital_format_changed (GtkComboBox *combo,
static void
xfce_clock_dialog_digital_entry_changed (GtkEntry *entry,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* cleanup old format */
g_free (clock->digital_format);
g_free (plugin->digital_format);
/* set new format */
clock->digital_format = g_strdup (gtk_entry_get_text (entry));
plugin->digital_format = g_strdup (gtk_entry_get_text (entry));
/* reload settings */
xfce_clock_dialog_reload_settings (clock);
xfce_clock_dialog_reload_settings (plugin);
}
@ -376,29 +376,29 @@ xfce_clock_dialog_append_combobox_formats (GtkComboBox *combo,
static void
xfce_clock_dialog_response (GtkWidget *dialog,
gint response,
ClockPlugin *clock)
ClockPlugin *plugin)
{
/* destroy the dialog */
gtk_widget_destroy (dialog);
/* remove links */
g_object_set_data (G_OBJECT (clock->plugin), I_("configure-dialog"), NULL);
g_object_set_data (G_OBJECT (clock->plugin), I_("configure-dialog-bin"), NULL);
g_object_set_data (G_OBJECT (plugin->plugin), I_("configure-dialog"), NULL);
g_object_set_data (G_OBJECT (plugin->plugin), I_("configure-dialog-bin"), NULL);
/* unblock the plugin menu */
xfce_panel_plugin_unblock_menu (clock->plugin);
xfce_panel_plugin_unblock_menu (plugin->plugin);
}
void
xfce_clock_dialog_options (ClockPlugin *clock)
xfce_clock_dialog_options (ClockPlugin *plugin)
{
GtkWidget *button, *bin, *vbox, *combo, *entry;
gboolean has_active;
/* get the frame bin */
bin = g_object_get_data (G_OBJECT (clock->plugin), I_("configure-dialog-bin"));
bin = g_object_get_data (G_OBJECT (plugin->plugin), I_("configure-dialog-bin"));
gtk_container_foreach (GTK_CONTAINER (bin), (GtkCallback) gtk_widget_destroy, NULL);
/* main vbox */
@ -406,52 +406,52 @@ xfce_clock_dialog_options (ClockPlugin *clock)
gtk_container_add (GTK_CONTAINER (bin), vbox);
gtk_widget_show (vbox);
if (clock->mode == XFCE_CLOCK_ANALOG || clock->mode == XFCE_CLOCK_BINARY || clock->mode == XFCE_CLOCK_LCD)
if (plugin->mode == XFCE_CLOCK_ANALOG || plugin->mode == XFCE_CLOCK_BINARY || plugin->mode == XFCE_CLOCK_LCD)
{
button = gtk_check_button_new_with_mnemonic (_("Display _seconds"));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clock->show_seconds);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_seconds_toggled), clock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), plugin->show_seconds);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_seconds_toggled), plugin);
gtk_widget_show (button);
}
if (clock->mode == XFCE_CLOCK_LCD)
if (plugin->mode == XFCE_CLOCK_LCD)
{
button = gtk_check_button_new_with_mnemonic (_("Use 24-_hour clock"));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clock->show_military);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_military_toggled), clock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), plugin->show_military);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_military_toggled), plugin);
gtk_widget_show (button);
button = gtk_check_button_new_with_mnemonic (_("Fl_ash time separators"));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clock->flash_separators);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_flash_separators_toggled), clock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), plugin->flash_separators);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_flash_separators_toggled), plugin);
gtk_widget_show (button);
button = gtk_check_button_new_with_mnemonic (_("Sho_w AM/PM"));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clock->show_meridiem);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_meridiem_toggled), clock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), plugin->show_meridiem);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_meridiem_toggled), plugin);
gtk_widget_show (button);
}
if (clock->mode == XFCE_CLOCK_BINARY)
if (plugin->mode == XFCE_CLOCK_BINARY)
{
button = gtk_check_button_new_with_mnemonic (_("True _binary clock"));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clock->true_binary);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_true_binary_toggled), clock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), plugin->true_binary);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_true_binary_toggled), plugin);
gtk_widget_show (button);
}
if (clock->mode == XFCE_CLOCK_DIGITAL)
if (plugin->mode == XFCE_CLOCK_DIGITAL)
{
combo = gtk_combo_box_new_text ();
gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo), xfce_clock_dialog_row_separator_func, NULL, NULL);
has_active = xfce_clock_dialog_append_combobox_formats (GTK_COMBO_BOX (combo), digital_formats, clock->digital_format);
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_digital_format_changed), clock);
has_active = xfce_clock_dialog_append_combobox_formats (GTK_COMBO_BOX (combo), digital_formats, plugin->digital_format);
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_digital_format_changed), plugin);
gtk_widget_show (combo);
entry = gtk_entry_new ();
@ -461,16 +461,16 @@ xfce_clock_dialog_options (ClockPlugin *clock)
if (!has_active)
{
gtk_widget_show (entry);
gtk_entry_set_text (GTK_ENTRY (entry), clock->digital_format);
gtk_entry_set_text (GTK_ENTRY (entry), plugin->digital_format);
}
g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (xfce_clock_dialog_digital_entry_changed), clock);
g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (xfce_clock_dialog_digital_entry_changed), plugin);
}
}
void
xfce_clock_dialog_show (ClockPlugin *clock)
xfce_clock_dialog_show (ClockPlugin *plugin)
{
GtkWidget *dialog, *dialog_vbox;
GtkWidget *frame, *bin, *vbox, *combo;
@ -478,19 +478,19 @@ xfce_clock_dialog_show (ClockPlugin *clock)
gboolean has_active;
/* block the right-click menu */
xfce_panel_plugin_block_menu (clock->plugin);
xfce_panel_plugin_block_menu (plugin->plugin);
/* create dialog */
dialog = xfce_titled_dialog_new_with_buttons (_("Clock"), NULL,
GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (clock->plugin)));
gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (plugin->plugin)));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_window_set_icon_name (GTK_WINDOW (dialog), "xfce4-settings");
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
g_object_set_data (G_OBJECT (clock->plugin), I_("configure-dialog"), dialog);
g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (xfce_clock_dialog_response), clock);
g_object_set_data (G_OBJECT (plugin->plugin), I_("configure-dialog"), dialog);
g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (xfce_clock_dialog_response), plugin);
/* main vbox */
dialog_vbox = gtk_vbox_new (FALSE, 8);
@ -513,14 +513,14 @@ xfce_clock_dialog_show (ClockPlugin *clock)
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Binary"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Digital"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("LCD"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), clock->mode);
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_mode_changed), clock);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), plugin->mode);
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_mode_changed), plugin);
gtk_widget_show (combo);
button = gtk_check_button_new_with_mnemonic (_("Show _frame"));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), clock->show_frame);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_frame_toggled), clock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), plugin->show_frame);
g_signal_connect (button, "toggled", G_CALLBACK (xfce_clock_dialog_show_frame_toggled), plugin);
gtk_widget_show (button);
/* tooltip settings */
@ -535,8 +535,8 @@ xfce_clock_dialog_show (ClockPlugin *clock)
combo = gtk_combo_box_new_text ();
gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo), xfce_clock_dialog_row_separator_func, NULL, NULL);
has_active = xfce_clock_dialog_append_combobox_formats (GTK_COMBO_BOX (combo), tooltip_formats, clock->tooltip_format);
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_tooltip_format_changed), clock);
has_active = xfce_clock_dialog_append_combobox_formats (GTK_COMBO_BOX (combo), tooltip_formats, plugin->tooltip_format);
g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (xfce_clock_dialog_tooltip_format_changed), plugin);
gtk_widget_show (combo);
entry = gtk_entry_new ();
@ -546,18 +546,18 @@ xfce_clock_dialog_show (ClockPlugin *clock)
if (!has_active)
{
gtk_widget_show (entry);
gtk_entry_set_text (GTK_ENTRY (entry), clock->tooltip_format);
gtk_entry_set_text (GTK_ENTRY (entry), plugin->tooltip_format);
}
g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (xfce_clock_dialog_tooltip_entry_changed), clock);
g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (xfce_clock_dialog_tooltip_entry_changed), plugin);
/* clock settings */
frame = xfce_create_framebox (_("Clock Options"), &bin);
gtk_box_pack_start (GTK_BOX (dialog_vbox), frame, FALSE, TRUE, 0);
g_object_set_data (G_OBJECT (clock->plugin), I_("configure-dialog-bin"), bin);
g_object_set_data (G_OBJECT (plugin->plugin), I_("configure-dialog-bin"), bin);
gtk_widget_show (frame);
/* add the potions */
xfce_clock_dialog_options (clock);
xfce_clock_dialog_options (plugin);
/* show the dialog */
gtk_widget_show (dialog);

32
plugins/clock/clock-digital.c

@ -33,8 +33,6 @@
/* class functions */
static void xfce_clock_digital_class_init (XfceClockDigitalClass *klass);
static void xfce_clock_digital_init (XfceClockDigital *clock);
static void xfce_clock_digital_finalize (GObject *object);
static void xfce_clock_digital_set_property (GObject *object,
guint prop_id,
@ -94,13 +92,13 @@ xfce_clock_digital_class_init (XfceClockDigitalClass *klass)
static void
xfce_clock_digital_init (XfceClockDigital *clock)
xfce_clock_digital_init (XfceClockDigital *digital)
{
/* init */
clock->format = NULL;
digital->format = NULL;
/* center text */
gtk_label_set_justify (GTK_LABEL (clock), GTK_JUSTIFY_CENTER);
gtk_label_set_justify (GTK_LABEL (digital), GTK_JUSTIFY_CENTER);
}
@ -108,10 +106,10 @@ xfce_clock_digital_init (XfceClockDigital *clock)
static void
xfce_clock_digital_finalize (GObject *object)
{
XfceClockDigital *clock = XFCE_CLOCK_DIGITAL (object);
XfceClockDigital *digital = XFCE_CLOCK_DIGITAL (object);
/* cleanup */
g_free (clock->format);
g_free (digital->format);
(*G_OBJECT_CLASS (xfce_clock_digital_parent_class)->finalize) (object);
}
@ -124,19 +122,19 @@ xfce_clock_digital_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
XfceClockDigital *clock = XFCE_CLOCK_DIGITAL (object);
XfceClockDigital *digital = XFCE_CLOCK_DIGITAL (object);
switch (prop_id)
{
case PROP_DIGITAL_FORMAT:
/* cleanup */
g_free (clock->format);
g_free (digital->format);
/* set new format */
clock->format = g_value_dup_string (value);
digital->format = g_value_dup_string (value);
/* update the widget */
xfce_clock_digital_update (clock);
xfce_clock_digital_update (digital);
break;
default:
@ -153,12 +151,12 @@ xfce_clock_digital_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
XfceClockDigital *clock = XFCE_CLOCK_DIGITAL (object);
XfceClockDigital *digital = XFCE_CLOCK_DIGITAL (object);
switch (prop_id)
{
case PROP_DIGITAL_FORMAT:
g_value_set_string (value,clock->format);
g_value_set_string (value, digital->format);
break;
default:
@ -180,20 +178,20 @@ xfce_clock_digital_new (void)
gboolean
xfce_clock_digital_update (gpointer user_data)
{
XfceClockDigital *clock = XFCE_CLOCK_DIGITAL (user_data);
XfceClockDigital *digital = XFCE_CLOCK_DIGITAL (user_data);
gchar *string;
struct tm tm;
g_return_val_if_fail (XFCE_CLOCK_IS_DIGITAL (clock), FALSE);
g_return_val_if_fail (XFCE_CLOCK_IS_DIGITAL (digital), FALSE);
/* get the local time */
xfce_clock_util_get_localtime (&tm);
/* get the string */
string = xfce_clock_util_strdup_strftime (clock->format ? clock->format : DEFAULT_DIGITAL_FORMAT, &tm);
string = xfce_clock_util_strdup_strftime (digital->format ? digital->format : DEFAULT_DIGITAL_FORMAT, &tm);
/* set the new label */
gtk_label_set_markup (GTK_LABEL (clock), string);
gtk_label_set_markup (GTK_LABEL (digital), string);
/* cleanup */
g_free (string);

60
plugins/clock/clock-lcd.c

@ -38,8 +38,6 @@
/* prototypes */
static void xfce_clock_lcd_class_init (XfceClockLcdClass *klass);
static void xfce_clock_lcd_init (XfceClockLcd *clock);
static void xfce_clock_lcd_finalize (GObject *object);
static void xfce_clock_lcd_set_property (GObject *object,
guint prop_id,
@ -53,7 +51,7 @@ static void xfce_clock_lcd_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static gboolean xfce_clock_lcd_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static gdouble xfce_clock_lcd_get_ratio (XfceClockLcd *clock);
static gdouble xfce_clock_lcd_get_ratio (XfceClockLcd *lcd);
static gdouble xfce_clock_lcd_draw_dots (cairo_t *cr,
gdouble size,
gdouble offset_x,
@ -158,13 +156,13 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass)
static void
xfce_clock_lcd_init (XfceClockLcd *clock)
xfce_clock_lcd_init (XfceClockLcd *lcd)
{
/* init */
clock->show_seconds = FALSE;
clock->show_meridiem = FALSE;
clock->show_military = TRUE;
clock->flash_separators = FALSE;
lcd->show_seconds = FALSE;
lcd->show_meridiem = FALSE;
lcd->show_military = TRUE;
lcd->flash_separators = FALSE;
}