From 9a6012da4b2b23e0c5d0b90644d758e1d3f1a6b0 Mon Sep 17 00:00:00 2001 From: Nick Schermer Date: Fri, 2 Jan 2009 13:21:47 +0000 Subject: [PATCH] * Fix a whole bunch of compiler warnings. (Old svn revision: 29078) --- libxfce4panel/Makefile.am | 3 +- libxfce4panel/xfce-itembar.c | 8 +- libxfce4panel/xfce-panel-plugin.h | 99 +++---- panel/frap-icon-entry.c | 2 - panel/main.c | 2 +- panel/panel-app.c | 13 +- panel/panel-dialogs.c | 10 +- panel/panel-dnd.c | 8 +- panel/panel-properties.c | 4 +- panel/panel-properties.h | 3 + panel/panel.c | 31 ++- plugins/clock/clock-analog.c | 24 +- plugins/clock/clock-binary.c | 44 ++- plugins/clock/clock-dialog.c | 196 +++++++------- plugins/clock/clock-digital.c | 32 ++- plugins/clock/clock-lcd.c | 60 ++--- plugins/clock/clock.c | 280 ++++++++++---------- plugins/iconbox/iconbox.c | 6 +- plugins/launcher/launcher-dialog.c | 8 +- plugins/launcher/launcher-exec.c | 4 +- plugins/launcher/launcher.c | 6 +- plugins/launcher/launcher.h | 8 +- plugins/pager/xfce-pager.h | 2 +- plugins/systray/Makefile.am | 3 +- plugins/windowlist/xfce4-popup-windowlist.c | 2 +- 25 files changed, 428 insertions(+), 430 deletions(-) diff --git a/libxfce4panel/Makefile.am b/libxfce4panel/Makefile.am index 6536de44..65f8caec 100644 --- a/libxfce4panel/Makefile.am +++ b/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 " > xgen-mc \ + && ( cd $(srcdir) && glib-genmarshal \ --prefix="_libxfce4panel_marshal" \ --body libxfce4panel-marshal.list ) >> xgen-mc \ && cp xgen-mc libxfce4panel-marshal.c \ diff --git a/libxfce4panel/xfce-itembar.c b/libxfce4panel/xfce-itembar.c index a31a3b57..e48a2ce5 100644 --- a/libxfce4panel/xfce-itembar.c +++ b/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; } diff --git a/libxfce4panel/xfce-panel-plugin.h b/libxfce4panel/xfce-panel-plugin.h index 91ff2a07..659ce98f 100644 --- a/libxfce4panel/xfce-panel-plugin.h +++ b/libxfce4panel/xfce-panel-plugin.h @@ -39,8 +39,8 @@ G_BEGIN_DECLS * * See also: Panel Plugin interface **/ -#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: Panel Plugin interface **/ -#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: Panel Plugin interface * 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: Panel Plugin interface **/ -#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: Panel Plugin interface **/ #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 diff --git a/panel/frap-icon-entry.c b/panel/frap-icon-entry.c index 824c90b6..5128d45f 100644 --- a/panel/frap-icon-entry.c +++ b/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, diff --git a/panel/main.c b/panel/main.c index 9ff96d31..f39e4c28 100644 --- a/panel/main.c +++ b/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")); diff --git a/panel/panel-app.c b/panel/panel-app.c index d46054b1..4b3121c5 100644 --- a/panel/panel-app.c +++ b/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), diff --git a/panel/panel-dialogs.c b/panel/panel-dialogs.c index 84f9258c..e8c3b660 100644 --- a/panel/panel-dialogs.c +++ b/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; diff --git a/panel/panel-dnd.c b/panel/panel-dnd.c index 3eb20b16..afcd98be 100644 --- a/panel/panel-dnd.c +++ b/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 */ diff --git a/panel/panel-properties.c b/panel/panel-properties.c index 711617c8..16bc52da 100644 --- a/panel/panel-properties.c +++ b/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; diff --git a/panel/panel-properties.h b/panel/panel-properties.h index a3598fd8..bee9e78c 100644 --- a/panel/panel-properties.h +++ b/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); diff --git a/panel/panel.c b/panel/panel.c index 803c02b8..bf4858a9 100644 --- a/panel/panel.c +++ b/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, diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c index 89696833..43a54f68 100644 --- a/plugins/clock/clock-analog.c +++ b/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); diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c index b1bbf330..fed0aa30 100644 --- a/plugins/clock/clock-binary.c +++ b/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) diff --git a/plugins/clock/clock-dialog.c b/plugins/clock/clock-dialog.c index d1afc3db..b4f184b3 100644 --- a/plugins/clock/clock-dialog.c +++ b/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); diff --git a/plugins/clock/clock-digital.c b/plugins/clock/clock-digital.c index aef583da..8cf6258d 100644 --- a/plugins/clock/clock-digital.c +++ b/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); diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c index f5d24ebd..0762a6be 100644 --- a/plugins/clock/clock-lcd.c +++ b/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; } @@ -183,24 +181,24 @@ xfce_clock_lcd_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - XfceClockLcd *clock = XFCE_CLOCK_LCD (object); + XfceClockLcd *lcd = XFCE_CLOCK_LCD (object); switch (prop_id) { case PROP_SHOW_SECONDS: - clock->show_seconds = g_value_get_boolean (value); + lcd->show_seconds = g_value_get_boolean (value); break; case PROP_SHOW_MILITARY: - clock->show_military = g_value_get_boolean (value); + lcd->show_military = g_value_get_boolean (value); break; case PROP_SHOW_MERIDIEM: - clock->show_meridiem = g_value_get_boolean (value); + lcd->show_meridiem = g_value_get_boolean (value); break; case PROP_FLASH_SEPARATORS: - clock->flash_separators = g_value_get_boolean (value); + lcd->flash_separators = g_value_get_boolean (value); break; default: @@ -217,24 +215,24 @@ xfce_clock_lcd_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - XfceClockLcd *clock = XFCE_CLOCK_LCD (object); + XfceClockLcd *lcd = XFCE_CLOCK_LCD (object); switch (prop_id) { case PROP_SHOW_SECONDS: - g_value_set_boolean (value, clock->show_seconds); + g_value_set_boolean (value, lcd->show_seconds); break; case PROP_SHOW_MILITARY: - g_value_set_boolean (value, clock->show_military); + g_value_set_boolean (value, lcd->show_military); break; case PROP_SHOW_MERIDIEM: - g_value_set_boolean (value, clock->show_meridiem); + g_value_set_boolean (value, lcd->show_meridiem); break; case PROP_FLASH_SEPARATORS: - g_value_set_boolean (value, clock->flash_separators); + g_value_set_boolean (value, lcd->flash_separators); break; default: @@ -280,7 +278,7 @@ static gboolean xfce_clock_lcd_expose_event (GtkWidget *widget, GdkEventExpose *event) { - XfceClockLcd *clock = XFCE_CLOCK_LCD (widget); + XfceClockLcd *lcd = XFCE_CLOCK_LCD (widget); cairo_t *cr; gdouble offset_x, offset_y; gint ticks, i; @@ -288,10 +286,10 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, gdouble ratio; struct tm tm; - g_return_val_if_fail (XFCE_CLOCK_IS_LCD (clock), FALSE); + g_return_val_if_fail (XFCE_CLOCK_IS_LCD (lcd), FALSE); /* get the width:height ratio */ - ratio = xfce_clock_lcd_get_ratio (XFCE_CLOCK_LCD (widget)); + ratio = xfce_clock_lcd_get_ratio (lcd); /* size of a digit should be a fraction of 10 */ size = widget->allocation.height - widget->allocation.height % 10; @@ -323,7 +321,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, ticks = tm.tm_hour; /* convert 24h clock to 12h clock */ - if (!clock->show_military && ticks > 12) + if (!lcd->show_military && ticks > 12) ticks -= 12; /* queue a resize when the number of hour digits changed */ @@ -350,7 +348,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, else { /* leave when we don't want seconds */ - if (!clock->show_seconds) + if (!lcd->show_seconds) break; /* get the seconds */ @@ -358,7 +356,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, } /* draw the dots */ - if (clock->flash_separators && (tm.tm_sec % 2) == 1) + if (lcd->flash_separators && (tm.tm_sec % 2) == 1) offset_x += size * RELATIVE_SPACE * 2; else offset_x = xfce_clock_lcd_draw_dots (cr, size, offset_x, offset_y); @@ -370,7 +368,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, offset_x = xfce_clock_lcd_draw_digit (cr, ticks % 10, size, offset_x, offset_y); } - if (clock->show_meridiem) + if (lcd->show_meridiem) { /* am or pm? */ ticks = tm.tm_hour >= 12 ? 11 : 10; @@ -389,7 +387,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget, static gdouble -xfce_clock_lcd_get_ratio (XfceClockLcd *clock) +xfce_clock_lcd_get_ratio (XfceClockLcd *lcd) { gdouble ratio; gint ticks; @@ -403,16 +401,16 @@ xfce_clock_lcd_get_ratio (XfceClockLcd *clock) ticks = tm.tm_hour; - if (!clock->show_military && ticks > 12) + if (!lcd->show_military && ticks > 12) ticks -= 12; if (ticks >= 10) ratio += RELATIVE_DIGIT + RELATIVE_SPACE; - if (clock->show_seconds) + if (lcd->show_seconds) ratio += (2 * RELATIVE_DIGIT) + RELATIVE_SPACE + RELATIVE_DOTS; - if (clock->show_meridiem) + if (lcd->show_meridiem) ratio += RELATIVE_DIGIT + RELATIVE_SPACE; return ratio; @@ -463,8 +461,6 @@ xfce_clock_lcd_draw_digit (cairo_t *cr, gdouble x, y; gdouble rel_x, rel_y; - g_return_val_if_fail (number >= 0 || number <= 11, offset_x); - /* ##1## * 6 2 * ##7## @@ -501,6 +497,8 @@ xfce_clock_lcd_draw_digit (cairo_t *cr, { 3, 2, 1, 0, 5, 6, -1 }, { 4, 5, 0, 1, 2, 6, -1 }, { 4, 5, 0, 1, 6, -1 } }; + + g_return_val_if_fail ((gint) number >= 0 || number <= 11, offset_x); for (i = 0; i < 9; i++) { diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c index e9defb7e..e18304ee 100644 --- a/plugins/clock/clock.c +++ b/plugins/clock/clock.c @@ -46,11 +46,11 @@ static guint xfce_clock_util_next_interval (guint timeo static gboolean xfce_clock_tooltip_update (gpointer user_data); static gboolean xfce_clock_tooltip_sync_timeout (gpointer user_data); static gboolean xfce_clock_widget_sync_timeout (gpointer user_data); -static ClockPlugin *xfce_clock_plugin_init (XfcePanelPlugin *plugin); -static void xfce_clock_plugin_read (ClockPlugin *clock); -static void xfce_clock_plugin_write (ClockPlugin *clock); -static void xfce_clock_plugin_free (ClockPlugin *clock); -static void xfce_clock_plugin_construct (XfcePanelPlugin *plugin); +static ClockPlugin *xfce_clock_plugin_init (XfcePanelPlugin *panel_plugin); +static void xfce_clock_plugin_read (ClockPlugin *plugin); +static void xfce_clock_plugin_write (ClockPlugin *plugin); +static void xfce_clock_plugin_free (ClockPlugin *plugin); +static void xfce_clock_plugin_construct (XfcePanelPlugin *panel_plugin); @@ -226,7 +226,7 @@ xfce_clock_util_strdup_strftime (const gchar *format, static gboolean xfce_clock_tooltip_update (gpointer user_data) { - ClockPlugin *clock = (ClockPlugin *) user_data; + ClockPlugin *plugin = (ClockPlugin *) user_data; gchar *string; struct tm tm; #if !GTK_CHECK_VERSION (2,12,0) @@ -237,21 +237,21 @@ xfce_clock_tooltip_update (gpointer user_data) tooltips = gtk_tooltips_new (); #endif - if (G_UNLIKELY (clock->tooltip_format == NULL)) + if (G_UNLIKELY (plugin->tooltip_format == NULL)) return TRUE; /* get the local time */ xfce_clock_util_get_localtime (&tm); /* get the string */ - string = xfce_clock_util_strdup_strftime (clock->tooltip_format, &tm); + string = xfce_clock_util_strdup_strftime (plugin->tooltip_format, &tm); /* set the tooltip */ #if GTK_CHECK_VERSION (2,12,0) - gtk_widget_set_tooltip_text (clock->ebox, string); - gtk_widget_trigger_tooltip_query (GTK_WIDGET (clock->ebox)); + gtk_widget_set_tooltip_text (plugin->ebox, string); + gtk_widget_trigger_tooltip_query (GTK_WIDGET (plugin->ebox)); #else - gtk_tooltips_set_tip (tooltips, clock->ebox, string, NULL); + gtk_tooltips_set_tip (tooltips, plugin->ebox, string, NULL); #endif /* cleanup */ @@ -265,13 +265,13 @@ xfce_clock_tooltip_update (gpointer user_data) static gboolean xfce_clock_tooltip_sync_timeout (gpointer user_data) { - ClockPlugin *clock = (ClockPlugin *) user_data; + ClockPlugin *plugin = (ClockPlugin *) user_data; /* start the tooltip update interval */ - clock->clock_timeout_id = g_timeout_add (clock->tooltip_interval, xfce_clock_tooltip_update, clock); + plugin->clock_timeout_id = g_timeout_add (plugin->tooltip_interval, xfce_clock_tooltip_update, plugin); /* manual update for this timeout */ - xfce_clock_tooltip_update (clock); + xfce_clock_tooltip_update (plugin); /* stop the sync timeout */ return FALSE; @@ -280,28 +280,28 @@ xfce_clock_tooltip_sync_timeout (gpointer user_data) void -xfce_clock_tooltip_sync (ClockPlugin *clock) +xfce_clock_tooltip_sync (ClockPlugin *plugin) { guint interval; - if (clock->tooltip_timeout_id) + if (plugin->tooltip_timeout_id) { /* stop old and reset timeout */ - g_source_remove (clock->tooltip_timeout_id); - clock->tooltip_timeout_id = 0; + g_source_remove (plugin->tooltip_timeout_id); + plugin->tooltip_timeout_id = 0; } /* detect the tooltip interval from the string */ - clock->tooltip_interval = xfce_clock_util_interval_from_format (clock->tooltip_format); + plugin->tooltip_interval = xfce_clock_util_interval_from_format (plugin->tooltip_format); /* get the interval to the next update */ - interval = xfce_clock_util_next_interval (clock->tooltip_interval); + interval = xfce_clock_util_next_interval (plugin->tooltip_interval); /* start the sync timeout */ - clock->tooltip_timeout_id = g_timeout_add (interval, xfce_clock_tooltip_sync_timeout, clock); + plugin->tooltip_timeout_id = g_timeout_add (interval, xfce_clock_tooltip_sync_timeout, plugin); /* update the tooltip */ - xfce_clock_tooltip_update (clock); + xfce_clock_tooltip_update (plugin); } @@ -310,20 +310,20 @@ xfce_clock_tooltip_sync (ClockPlugin *clock) static gboolean xfce_clock_widget_sync_timeout (gpointer user_data) { - ClockPlugin *clock = (ClockPlugin *) user_data; + ClockPlugin *plugin = (ClockPlugin *) user_data; - if (G_LIKELY (clock->widget)) + if (G_LIKELY (plugin->widget)) { /* start the clock update timeout */ - clock->clock_timeout_id = g_timeout_add (clock->interval, clock->update, clock->widget); + plugin->clock_timeout_id = g_timeout_add (plugin->interval, plugin->update, plugin->widget); /* manual update for this interval */ - (clock->update) (clock->widget); + (plugin->update) (plugin->widget); } else { /* remove timer id */ - clock->clock_timeout_id = 0; + plugin->clock_timeout_id = 0; } /* stop the sync timeout */ @@ -333,123 +333,123 @@ xfce_clock_widget_sync_timeout (gpointer user_data) void -xfce_clock_widget_sync (ClockPlugin *clock) +xfce_clock_widget_sync (ClockPlugin *plugin) { guint interval; - if (clock->clock_timeout_id) + if (plugin->clock_timeout_id) { /* stop old and reset timeout */ - g_source_remove (clock->clock_timeout_id); - clock->clock_timeout_id = 0; + g_source_remove (plugin->clock_timeout_id); + plugin->clock_timeout_id = 0; } - if (G_LIKELY (clock->widget)) + if (G_LIKELY (plugin->widget)) { /* get the interval to the next update */ - interval = xfce_clock_util_next_interval (clock->interval); + interval = xfce_clock_util_next_interval (plugin->interval); /* start the sync timeout */ - clock->clock_timeout_id = g_timeout_add (interval, xfce_clock_widget_sync_timeout, clock); + plugin->clock_timeout_id = g_timeout_add (interval, xfce_clock_widget_sync_timeout, plugin); } } void -xfce_clock_widget_update_settings (ClockPlugin *clock) +xfce_clock_widget_update_settings (ClockPlugin *plugin) { - g_return_if_fail (clock->widget != NULL); + g_return_if_fail (plugin->widget != NULL); /* send the settings based on the clock mode */ - switch (clock->mode) + switch (plugin->mode) { case XFCE_CLOCK_ANALOG: /* set settings */ - g_object_set (G_OBJECT (clock->widget), - "show-seconds", clock->show_seconds, NULL); + g_object_set (G_OBJECT (plugin->widget), + "show-seconds", plugin->show_seconds, NULL); break; case XFCE_CLOCK_BINARY: /* set settings */ - g_object_set (G_OBJECT (clock->widget), - "show-seconds", clock->show_seconds, - "true-binary", clock->true_binary, NULL); + g_object_set (G_OBJECT (plugin->widget), + "show-seconds", plugin->show_seconds, + "true-binary", plugin->true_binary, NULL); break; case XFCE_CLOCK_DIGITAL: /* set settings */ - g_object_set (G_OBJECT (clock->widget), - "digital-format", clock->digital_format, NULL); + g_object_set (G_OBJECT (plugin->widget), + "digital-format", plugin->digital_format, NULL); break; case XFCE_CLOCK_LCD: /* set settings */ - g_object_set (G_OBJECT (clock->widget), - "show-seconds", clock->show_seconds, - "show-military", clock->show_military, - "show-meridiem", clock->show_meridiem, - "flash-separators", clock->flash_separators, NULL); + g_object_set (G_OBJECT (plugin->widget), + "show-seconds", plugin->show_seconds, + "show-military", plugin->show_military, + "show-meridiem", plugin->show_meridiem, + "flash-separators", plugin->flash_separators, NULL); break; } /* get update interval */ - if (clock->mode == XFCE_CLOCK_DIGITAL) + if (plugin->mode == XFCE_CLOCK_DIGITAL) { /* get interval from string */ - clock->interval = xfce_clock_util_interval_from_format (clock->digital_format); + plugin->interval = xfce_clock_util_interval_from_format (plugin->digital_format); } else { /* interval from setting */ - if (clock->mode == XFCE_CLOCK_LCD) - clock->interval = (clock->show_seconds || clock->flash_separators) ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE; + if (plugin->mode == XFCE_CLOCK_LCD) + plugin->interval = (plugin->show_seconds || plugin->flash_separators) ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE; else - clock->interval = clock->show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE; + plugin->interval = plugin->show_seconds ? CLOCK_INTERVAL_SECOND : CLOCK_INTERVAL_MINUTE; } } void -xfce_clock_widget_set_mode (ClockPlugin *clock) +xfce_clock_widget_set_mode (ClockPlugin *plugin) { GtkWidget *widget; /* stop runing timeout */ - if (clock->clock_timeout_id) + if (plugin->clock_timeout_id) { - g_source_remove (clock->clock_timeout_id); - clock->clock_timeout_id = 0; + g_source_remove (plugin->clock_timeout_id); + plugin->clock_timeout_id = 0; } /* destroy the old widget */ - if (clock->widget) + if (plugin->widget) { - gtk_widget_destroy (clock->widget); - clock->widget = NULL; + gtk_widget_destroy (plugin->widget); + plugin->widget = NULL; } - switch (clock->mode) + switch (plugin->mode) { case XFCE_CLOCK_ANALOG: widget = xfce_clock_analog_new (); - clock->update = xfce_clock_analog_update; + plugin->update = xfce_clock_analog_update; break; case XFCE_CLOCK_BINARY: widget = xfce_clock_binary_new (); - clock->update = xfce_clock_binary_update; + plugin->update = xfce_clock_binary_update; break; case XFCE_CLOCK_DIGITAL: widget = xfce_clock_digital_new (); - clock->update = xfce_clock_digital_update; + plugin->update = xfce_clock_digital_update; break; case XFCE_CLOCK_LCD: widget = xfce_clock_lcd_new (); - clock->update = xfce_clock_lcd_update; + plugin->update = xfce_clock_lcd_update; break; default: @@ -458,10 +458,10 @@ xfce_clock_widget_set_mode (ClockPlugin *clock) } /* set the clock */ - clock->widget = widget; + plugin->widget = widget; /* add and show the clock */ - gtk_container_add (GTK_CONTAINER (clock->frame), widget); + gtk_container_add (GTK_CONTAINER (plugin->frame), widget); gtk_widget_show (widget); } @@ -469,74 +469,74 @@ xfce_clock_widget_set_mode (ClockPlugin *clock) /** plugin functions **/ static ClockPlugin * -xfce_clock_plugin_init (XfcePanelPlugin *plugin) +xfce_clock_plugin_init (XfcePanelPlugin *panel_plugin) { - ClockPlugin *clock; + ClockPlugin *plugin; /* create structure */ - clock = panel_slice_new0 (ClockPlugin); + plugin = panel_slice_new0 (ClockPlugin); /* set plugin */ - clock->plugin = plugin; + plugin->plugin = panel_plugin; /* initialize */ - clock->clock_timeout_id = 0; - clock->tooltip_timeout_id = 0; - clock->widget = NULL; - clock->tooltip_format = NULL; - clock->digital_format = NULL; + plugin->clock_timeout_id = 0; + plugin->tooltip_timeout_id = 0; + plugin->widget = NULL; + plugin->tooltip_format = NULL; + plugin->digital_format = NULL; /* read the user settings */ - xfce_clock_plugin_read (clock); + xfce_clock_plugin_read (plugin); /* build widgets */ - clock->ebox = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (plugin), clock->ebox); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (clock->ebox), FALSE); - gtk_widget_show (clock->ebox); + plugin->ebox = gtk_event_box_new (); + gtk_container_add (GTK_CONTAINER (panel_plugin), plugin->ebox); + gtk_event_box_set_visible_window (GTK_EVENT_BOX (plugin->ebox), FALSE); + gtk_widget_show (plugin->ebox); - clock->frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (clock->ebox), clock->frame); - gtk_frame_set_shadow_type (GTK_FRAME (clock->frame), clock->show_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE); - gtk_widget_show (clock->frame); + plugin->frame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER (plugin->ebox), plugin->frame); + gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), plugin->show_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE); + gtk_widget_show (plugin->frame); /* set the clock */ - xfce_clock_widget_set_mode (clock); + xfce_clock_widget_set_mode (plugin); /* set the clock settings */ - xfce_clock_widget_update_settings (clock); + xfce_clock_widget_update_settings (plugin); /* start the timeout */ - xfce_clock_widget_sync (clock); + xfce_clock_widget_sync (plugin); /* start the tooltip sync */ - xfce_clock_tooltip_sync (clock); + xfce_clock_tooltip_sync (plugin); - return clock; + return plugin; } gboolean -xfce_clock_plugin_set_size (ClockPlugin *clock, +xfce_clock_plugin_set_size (ClockPlugin *plugin, guint size) { GtkOrientation orientation; /* set the frame border */ - gtk_container_set_border_width (GTK_CONTAINER (clock->frame), size > 26 ? 1 : 0); + gtk_container_set_border_width (GTK_CONTAINER (plugin->frame), size > 26 ? 1 : 0); /* get the clock size */ size -= size > 26 ? 6 : 4; /* get plugin orientation */ - orientation = xfce_panel_plugin_get_orientation (clock->plugin); + orientation = xfce_panel_plugin_get_orientation (plugin->plugin); /* set the clock size */ if (orientation == GTK_ORIENTATION_HORIZONTAL) - gtk_widget_set_size_request (clock->widget, -1, size); + gtk_widget_set_size_request (plugin->widget, -1, size); else - gtk_widget_set_size_request (clock->widget, size, -1); + gtk_widget_set_size_request (plugin->widget, size, -1); return TRUE; } @@ -544,23 +544,23 @@ xfce_clock_plugin_set_size (ClockPlugin *clock, static void -xfce_clock_plugin_set_orientation (ClockPlugin *clock) +xfce_clock_plugin_set_orientation (ClockPlugin *plugin) { /* do a size request */ - 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)); } static void -xfce_clock_plugin_read (ClockPlugin *clock) +xfce_clock_plugin_read (ClockPlugin *plugin) { gchar *filename; const gchar *value; XfceRc *rc; /* config filename */ - filename = xfce_panel_plugin_lookup_rc_file (clock->plugin); + filename = xfce_panel_plugin_lookup_rc_file (plugin->plugin); if (G_LIKELY (filename)) { @@ -573,22 +573,22 @@ xfce_clock_plugin_read (ClockPlugin *clock) /* read strings */ value = xfce_rc_read_entry (rc, "DigitalFormat", DEFAULT_DIGITAL_FORMAT); if (G_LIKELY (value != NULL && *value != '\0')) - clock->digital_format = g_strdup (value); + plugin->digital_format = g_strdup (value); value = xfce_rc_read_entry (rc, "TooltipFormat", DEFAULT_TOOLTIP_FORMAT); if (G_LIKELY (value != NULL && *value != '\0')) - clock->tooltip_format = g_strdup (value); + plugin->tooltip_format = g_strdup (value); /* read clock type */ - clock->mode = xfce_rc_read_int_entry (rc, "ClockType", XFCE_CLOCK_DIGITAL); + plugin->mode = xfce_rc_read_int_entry (rc, "ClockType", XFCE_CLOCK_DIGITAL); /* read boolean settings */ - clock->show_frame = xfce_rc_read_bool_entry (rc, "ShowFrame", TRUE); - clock->show_seconds = xfce_rc_read_bool_entry (rc, "ShowSeconds", FALSE); - clock->show_military = xfce_rc_read_bool_entry (rc, "ShowMilitary", TRUE); - clock->show_meridiem = xfce_rc_read_bool_entry (rc, "ShowMeridiem", FALSE); - clock->true_binary = xfce_rc_read_bool_entry (rc, "TrueBinary", FALSE); - clock->flash_separators = xfce_rc_read_bool_entry (rc, "FlashSeparators", FALSE); + plugin->show_frame = xfce_rc_read_bool_entry (rc, "ShowFrame", TRUE); + plugin->show_seconds = xfce_rc_read_bool_entry (rc, "ShowSeconds", FALSE); + plugin->show_military = xfce_rc_read_bool_entry (rc, "ShowMilitary", TRUE); + plugin->show_meridiem = xfce_rc_read_bool_entry (rc, "ShowMeridiem", FALSE); + plugin->true_binary = xfce_rc_read_bool_entry (rc, "TrueBinary", FALSE); + plugin->flash_separators = xfce_rc_read_bool_entry (rc, "FlashSeparators", FALSE); /* close the rc file */ xfce_rc_close (rc); @@ -599,13 +599,13 @@ xfce_clock_plugin_read (ClockPlugin *clock) static void -xfce_clock_plugin_write (ClockPlugin *clock) +xfce_clock_plugin_write (ClockPlugin *plugin) { gchar *filename; XfceRc *rc; /* config filename */ - filename = xfce_panel_plugin_save_location (clock->plugin, TRUE); + filename = xfce_panel_plugin_save_location (plugin->plugin, TRUE); if (G_LIKELY (filename)) { @@ -616,19 +616,19 @@ xfce_clock_plugin_write (ClockPlugin *clock) if (G_LIKELY (rc)) { /* write settings */ - if (G_LIKELY (clock->digital_format && *clock->digital_format != '\0')) - xfce_rc_write_entry (rc, "DigitalFormat", clock->digital_format); + if (G_LIKELY (plugin->digital_format && *plugin->digital_format != '\0')) + xfce_rc_write_entry (rc, "DigitalFormat", plugin->digital_format); - if (G_LIKELY (clock->tooltip_format && *clock->tooltip_format != '\0')) - xfce_rc_write_entry (rc, "TooltipFormat", clock->tooltip_format); + if (G_LIKELY (plugin->tooltip_format && *plugin->tooltip_format != '\0')) + xfce_rc_write_entry (rc, "TooltipFormat", plugin->tooltip_format); - xfce_rc_write_int_entry (rc, "ClockType", clock->mode); - xfce_rc_write_bool_entry (rc, "ShowFrame", clock->show_frame); - xfce_rc_write_bool_entry (rc, "ShowSeconds", clock->show_seconds); - xfce_rc_write_bool_entry (rc, "ShowMilitary", clock->show_military); - xfce_rc_write_bool_entry (rc, "ShowMeridiem", clock->show_meridiem); - xfce_rc_write_bool_entry (rc, "TrueBinary", clock->true_binary); - xfce_rc_write_bool_entry (rc, "FlashSeparators", clock->flash_separators); + xfce_rc_write_int_entry (rc, "ClockType", plugin->mode); + xfce_rc_write_bool_entry (rc, "ShowFrame", plugin->show_frame); + xfce_rc_write_bool_entry (rc, "ShowSeconds", plugin->show_seconds); + xfce_rc_write_bool_entry (rc, "ShowMilitary", plugin->show_military); + xfce_rc_write_bool_entry (rc, "ShowMeridiem", plugin->show_meridiem); + xfce_rc_write_bool_entry (rc, "TrueBinary", plugin->true_binary); + xfce_rc_write_bool_entry (rc, "FlashSeparators", plugin->flash_separators); /* close the rc file */ xfce_rc_close (rc); @@ -639,46 +639,46 @@ xfce_clock_plugin_write (ClockPlugin *clock) static void -xfce_clock_plugin_free (ClockPlugin *clock) +xfce_clock_plugin_free (ClockPlugin *plugin) { GtkWidget *dialog; /* stop timeouts */ - if (G_LIKELY (clock->clock_timeout_id)) - g_source_remove (clock->clock_timeout_id); + if (G_LIKELY (plugin->clock_timeout_id)) + g_source_remove (plugin->clock_timeout_id); - if (G_LIKELY (clock->tooltip_timeout_id)) - g_source_remove (clock->tooltip_timeout_id); + if (G_LIKELY (plugin->tooltip_timeout_id)) + g_source_remove (plugin->tooltip_timeout_id); /* destroy the configure dialog if it's still open */ - dialog = g_object_get_data (G_OBJECT (clock->plugin), I_("configure-dialog")); + dialog = g_object_get_data (G_OBJECT (plugin->plugin), I_("configure-dialog")); if (G_UNLIKELY (dialog != NULL)) gtk_widget_destroy (dialog); /* cleanup */ - g_free (clock->tooltip_format); - g_free (clock->digital_format); + g_free (plugin->tooltip_format); + g_free (plugin->digital_format); /* free structure */ - panel_slice_free (ClockPlugin, clock); + panel_slice_free (ClockPlugin, plugin); } static void -xfce_clock_plugin_construct (XfcePanelPlugin *plugin) +xfce_clock_plugin_construct (XfcePanelPlugin *panel_plugin) { - ClockPlugin *clock = xfce_clock_plugin_init (plugin); + ClockPlugin *plugin = xfce_clock_plugin_init (panel_plugin); /* plugin settings */ - xfce_panel_plugin_add_action_widget (plugin, clock->ebox); - xfce_panel_plugin_menu_show_configure (plugin); + xfce_panel_plugin_add_action_widget (panel_plugin, plugin->ebox); + xfce_panel_plugin_menu_show_configure (panel_plugin); /* connect signals */ - g_signal_connect_swapped (G_OBJECT (plugin), "size-changed", G_CALLBACK (xfce_clock_plugin_set_size), clock); - g_signal_connect_swapped (G_OBJECT (plugin), "save", G_CALLBACK (xfce_clock_plugin_write), clock); - g_signal_connect_swapped (G_OBJECT (plugin), "free-data", G_CALLBACK (xfce_clock_plugin_free), clock); - g_signal_connect_swapped (G_OBJECT (plugin), "configure-plugin", G_CALLBACK (xfce_clock_dialog_show), clock); - g_signal_connect_swapped (G_OBJECT (plugin), "orientation-changed", G_CALLBACK (xfce_clock_plugin_set_orientation), clock); + g_signal_connect_swapped (G_OBJECT (panel_plugin), "size-changed", G_CALLBACK (xfce_clock_plugin_set_size), plugin); + g_signal_connect_swapped (G_OBJECT (panel_plugin), "save", G_CALLBACK (xfce_clock_plugin_write), plugin); + g_signal_connect_swapped (G_OBJECT (panel_plugin), "free-data", G_CALLBACK (xfce_clock_plugin_free), plugin); + g_signal_connect_swapped (G_OBJECT (panel_plugin), "configure-plugin", G_CALLBACK (xfce_clock_dialog_show), plugin); + g_signal_connect_swapped (G_OBJECT (panel_plugin), "orientation-changed", G_CALLBACK (xfce_clock_plugin_set_orientation), plugin); } diff --git a/plugins/iconbox/iconbox.c b/plugins/iconbox/iconbox.c index aa27fbd2..c581de29 100644 --- a/plugins/iconbox/iconbox.c +++ b/plugins/iconbox/iconbox.c @@ -655,11 +655,7 @@ iconbox_set_size (XfcePanelPlugin *plugin, int size, Iconbox *ib) } for (l = ib->iconlist; l != NULL; l = l->next) - { - Icon *icon = l->data; - - icon_update_image (icon); - } + icon_update_image (l->data); return TRUE; } diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c index 0461d1f8..5b2ae1dc 100644 --- a/plugins/launcher/launcher-dialog.c +++ b/plugins/launcher/launcher-dialog.c @@ -253,7 +253,7 @@ launcher_dialog_tree_drag_data_received (GtkWidget *widget, gint y, GtkSelectionData *selection_data, guint info, - guint time, + guint time_, LauncherDialog *ld) { GtkTreePath *path = NULL; @@ -378,7 +378,7 @@ launcher_dialog_tree_drag_data_received (GtkWidget *widget, gtk_tree_path_free (path); /* finish drag */ - gtk_drag_finish (context, TRUE, FALSE, time); + gtk_drag_finish (context, TRUE, FALSE, time_); } @@ -390,7 +390,7 @@ launcher_dialog_frame_drag_data_received (GtkWidget *widget, gint y, GtkSelectionData *selection_data, guint info, - guint time, + guint time_, LauncherDialog *ld) { GSList *filenames, *li; @@ -433,7 +433,7 @@ launcher_dialog_frame_drag_data_received (GtkWidget *widget, } /* finish drag */ - gtk_drag_finish (context, TRUE, FALSE, time); + gtk_drag_finish (context, TRUE, FALSE, time_); } diff --git a/plugins/launcher/launcher-exec.c b/plugins/launcher/launcher-exec.c index 396b1325..1ff91d4b 100644 --- a/plugins/launcher/launcher-exec.c +++ b/plugins/launcher/launcher-exec.c @@ -34,6 +34,9 @@ #ifdef HAVE_MEMORY_H #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifdef HAVE_STRING_H #include #endif @@ -406,7 +409,6 @@ launcher_exec_on_screen (GdkScreen *screen, gint sn_workspace; #endif gchar *dpyname; - extern gchar **environ; gint n, m; gboolean succeed = FALSE; GError *error = NULL; diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c index 23423f6e..e468e3c5 100644 --- a/plugins/launcher/launcher.c +++ b/plugins/launcher/launcher.c @@ -66,7 +66,7 @@ static void launcher_icon_button_drag_data_received (GtkWidget gint y, GtkSelectionData *selection_data, guint info, - guint time, + guint time_, LauncherPlugin *launcher); static gboolean launcher_arrow_button_pressed (GtkWidget *button, GdkEventButton *event, @@ -474,7 +474,7 @@ launcher_icon_button_drag_data_received (GtkWidget *widget, gint y, GtkSelectionData *selection_data, guint info, - guint time, + guint time_, LauncherPlugin *launcher) { GSList *filenames; @@ -500,7 +500,7 @@ launcher_icon_button_drag_data_received (GtkWidget *widget, } /* finish drag */ - gtk_drag_finish (context, TRUE, FALSE, time); + gtk_drag_finish (context, TRUE, FALSE, time_); } diff --git a/plugins/launcher/launcher.h b/plugins/launcher/launcher.h index e12c0190..a0d1d385 100644 --- a/plugins/launcher/launcher.h +++ b/plugins/launcher/launcher.h @@ -107,10 +107,10 @@ enum /* target types for dropping in the launcher plugin */ static const GtkTargetEntry drop_targets[] = { - { "text/uri-list", 0, 0, }, - { "STRING", 0, 0 }, - { "UTF8_STRING", 0, 0 }, - { "text/plain", 0, 0 }, + { (gchar *) "text/uri-list", 0, 0, }, + { (gchar *) "STRING", 0, 0 }, + { (gchar *) "UTF8_STRING", 0, 0 }, + { (gchar *) "text/plain", 0, 0 }, }; diff --git a/plugins/pager/xfce-pager.h b/plugins/pager/xfce-pager.h index 8fbd761b..1a09b758 100644 --- a/plugins/pager/xfce-pager.h +++ b/plugins/pager/xfce-pager.h @@ -42,7 +42,7 @@ struct _XfcePagerClass WnckPagerClass __parent__; }; -GType xfce_pager_get_type(); +GType xfce_pager_get_type (void) G_GNUC_CONST; GtkWidget *xfce_pager_new (WnckScreen *screen); void xfce_pager_set_workspace_scrolling (XfcePager *pager, diff --git a/plugins/systray/Makefile.am b/plugins/systray/Makefile.am index 78e7c485..d37317e5 100644 --- a/plugins/systray/Makefile.am +++ b/plugins/systray/Makefile.am @@ -107,7 +107,8 @@ stamp-xfce-tray-marshal.h: $(srcdir)/xfce-tray-marshal.list Makefile && echo timestamp > $(@F) xfce-tray-marshal.c: xfce-tray-marshal.h Makefile - ( cd $(srcdir) && glib-genmarshal \ + echo "#include \"xfce-tray-marshal.h\"" > xgen-xtmc \ + && ( cd $(srcdir) && glib-genmarshal \ --prefix=_xfce_tray_marshal \ --body xfce-tray-marshal.list ) >> xgen-xtmc \ && cp xgen-xtmc xfce-tray-marshal.c \ diff --git a/plugins/windowlist/xfce4-popup-windowlist.c b/plugins/windowlist/xfce4-popup-windowlist.c index fa1e53e1..b53e76de 100644 --- a/plugins/windowlist/xfce4-popup-windowlist.c +++ b/plugins/windowlist/xfce4-popup-windowlist.c @@ -41,7 +41,7 @@ #include #endif -gboolean +static gboolean xfce4_check_is_running (GtkWidget *widget, Window *xid) { GdkScreen *gscreen;