[Goodies-commits] r2240 - in xfce4-datetime-plugin/trunk: . panel-plugin po
Nick Schermer
nick at xfce.org
Sun Dec 17 13:55:39 CET 2006
Author: nick
Date: 2006-12-17 12:55:39 +0000 (Sun, 17 Dec 2006)
New Revision: 2240
Added:
xfce4-datetime-plugin/trunk/autogen.sh
xfce4-datetime-plugin/trunk/configure.in.in
xfce4-datetime-plugin/trunk/po/LINGUAS
Removed:
xfce4-datetime-plugin/trunk/configure.ac
Modified:
xfce4-datetime-plugin/trunk/ChangeLog
xfce4-datetime-plugin/trunk/Makefile.am
xfce4-datetime-plugin/trunk/panel-plugin/Makefile.am
xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c
xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.h
xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
xfce4-datetime-plugin/trunk/panel-plugin/datetime.desktop.in.in
xfce4-datetime-plugin/trunk/panel-plugin/datetime.h
Log:
* Fix compiler warnings.
* Add LINGUAS support.
* Cygwin Fix.
* Fix compiler warnings and header includes.
* Use new module detection for the panel.
* Fix multiple memory leaks.
* Fix crash when the plugin was removed from the panel.
* Use panel slice macros for creating structures.
Modified: xfce4-datetime-plugin/trunk/ChangeLog
===================================================================
--- xfce4-datetime-plugin/trunk/ChangeLog 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/ChangeLog 2006-12-17 12:55:39 UTC (rev 2240)
@@ -1,3 +1,14 @@
+2006-12-17 Nick Schermer <nick at xfce.org>
+ * Move the file into trunk.
+ * Fix compiler warnings.
+ * Add LINGUAS support.
+ * Cygwin Fix.
+ * Fix compiler warnings and header includes.
+ * Use new module detection for the panel.
+ * Fix multiple memory leaks.
+ * Fix crash when the plugin was removed from the panel.
+ * Use panel slice macros for creating structures.
+
2006-10-06 Remco den Breeje <remco at sx.mine.nu>
* release 0.4.0
compatible with xfce 4.4
Modified: xfce4-datetime-plugin/trunk/Makefile.am
===================================================================
--- xfce4-datetime-plugin/trunk/Makefile.am 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/Makefile.am 2006-12-17 12:55:39 UTC (rev 2240)
@@ -1,4 +1,4 @@
-SUBDIRS = panel-plugin \
+SUBDIRS = panel-plugin \
po
AUTOMAKE_OPTIONS = \
Added: xfce4-datetime-plugin/trunk/autogen.sh
===================================================================
--- xfce4-datetime-plugin/trunk/autogen.sh (rev 0)
+++ xfce4-datetime-plugin/trunk/autogen.sh 2006-12-17 12:55:39 UTC (rev 2240)
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $Id: autogen.sh 1972 2006-09-06 08:21:54Z nick $
+#
+# Copyright (c) 2002-2006
+# The Thunar development team. All rights reserved.
+#
+# Written for Thunar by Benedikt Meurer <benny at xfce.org>.
+#
+
+(type xdt-autogen) >/dev/null 2>&1 || {
+ cat >&2 <<EOF
+autogen.sh: You don't seem to have the Xfce development tools installed on
+ your system, which are required to build this software.
+ Please install the xfce4-dev-tools package first, it is available
+ from http://www.xfce.org/.
+EOF
+ exit 1
+}
+
+# verify that po/LINGUAS is present
+(test -f po/LINGUAS) >/dev/null 2>&1 || {
+ cat >&2 <<EOF
+autogen.sh: The file po/LINGUAS could not be found. Please check your snapshot
+ or try to checkout again.
+EOF
+ exit 1
+}
+
+# substitute revision and linguas
+linguas=`sed -e '/^#/d' po/LINGUAS`
+revision=`LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}'`
+sed -e "s/@LINGUAS@/${linguas}/g" \
+ -e "s/@REVISION@/${revision}/g" \
+ < "configure.in.in" > "configure.in"
+
+exec xdt-autogen $@
Property changes on: xfce4-datetime-plugin/trunk/autogen.sh
___________________________________________________________________
Name: svn:executable
+ *
Deleted: xfce4-datetime-plugin/trunk/configure.ac
Copied: xfce4-datetime-plugin/trunk/configure.in.in (from rev 2238, xfce4-datetime-plugin/trunk/configure.ac)
===================================================================
--- xfce4-datetime-plugin/trunk/configure.in.in (rev 0)
+++ xfce4-datetime-plugin/trunk/configure.in.in 2006-12-17 12:55:39 UTC (rev 2240)
@@ -0,0 +1,48 @@
+dnl Version information
+m4_define([datetime_version_major], [0])
+m4_define([datetime_version_minor], [4])
+m4_define([datetime_version_micro], [0])
+m4_define([datetime_version], [datetime_version_major().datetime_version_minor().datetime_version_micro()])
+
+dnl Initialize autoconf
+AC_COPYRIGHT([Copyright (c) 2006
+ Remco den Breeje <remco at sx.mine.nu>])
+AC_INIT([datetime], [datetime_version()], [remco at sx.mine.nu])
+
+dnl Initialize automake
+AM_INIT_AUTOMAKE([AC_PACKAGE_TARNAME()], [AC_PACKAGE_VERSION()])
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE()
+
+dnl Check for UNIX variants
+AC_AIX()
+AC_ISC_POSIX()
+AC_MINIX()
+AM_CONDITIONAL([HAVE_CYGWIN], [test "`uname | grep \"CYGWIN\"`" != ""])
+
+dnl check for basic programs
+AC_PROG_CC()
+AC_PROG_INSTALL()
+AC_PROG_INTLTOOL()
+AC_PROG_LIBTOOL()
+
+dnl Check for i18n support
+XDT_I18N([@LINGUAS@])
+
+dnl Check for required packages
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
+XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.3.99.2])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.99.2])
+XDT_CHECK_PACKAGE([LIBXFCE4PANEL],[libxfce4panel-1.0],[4.3.99.2])
+
+dnl Check for optional packages
+XDT_CHECK_OPTIONAL_PACKAGE([DBUS], [dbus-1], [0.22], [dbus], [D-BUS support])
+
+dnl Check for debugging support
+BM_DEBUG_SUPPORT()
+
+AC_OUTPUT([
+Makefile
+po/Makefile.in
+panel-plugin/Makefile
+])
Modified: xfce4-datetime-plugin/trunk/panel-plugin/Makefile.am
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/Makefile.am 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/panel-plugin/Makefile.am 2006-12-17 12:55:39 UTC (rev 2240)
@@ -3,11 +3,6 @@
plugin_LTLIBRARIES = \
libdatetime.la
-libdatetime_la_LDFLAGS = \
- -avoid-version \
- -module
-#-export-dynamic
-
libdatetime_la_SOURCES = \
datetime.h \
datetime.c \
@@ -17,22 +12,31 @@
libdatetime_la_CFLAGS = \
-I$(top_srcdir) \
-DLOCALEDIR=\"$(localedir)\" \
- @LIBXFCE4PANEL_CFLAGS@
+ $(GTK_CFLAGS) \
+ $(LIBXFCE4PANEL_CFLAGS) \
+ $(LIBXFCEGUI4_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS)
-libdatetime_la_LIBADD = \
- @LIBXFCE4PANEL_LIBS@
-# ../../libxfce4panel/libxfce4panel.la
+libdatetime_la_LDFLAGS = \
+ -avoid-version \
+ -module
-#libdatetime_la_DEPENDENCIES = \
-# ../../libxfce4panel/libxfce4panel.la
+if HAVE_CYGWIN
+libdatetime_la_LDFLAGS += \
+ -no-undefined
+endif
-%.desktop.in: %.desktop.in.in
- sed -e "s^@INTERNAL_PLUGIN_PATH@^$(libdir)/xfce4/panel-plugins^" < $< > $@
+libdatetime_la_LIBADD = \
+ $(GTK_LIBS) \
+ $(LIBXFCE4PANEL_LIBS) \
+ $(LIBXFCEGUI4_LIBS) \
+ $(LIBXFCE4UTIL_LIBS)
+desktopdir = $(datadir)/xfce4/panel-plugins
desktop_in_in_files = datetime.desktop.in.in
desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
-
-desktopdir = $(datadir)/xfce4/panel-plugins
+%.desktop.in: %.desktop.in.in
+ sed -e "s,\@libdir\@,$(libdir),g" < $< > $@
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
@@ -41,5 +45,6 @@
$(desktop_in_in_files)
DISTCLEANFILES = \
- $(desktop_DATA) $(desktop_in_files)
+ $(desktop_DATA) \
+ $(desktop_in_files)
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.c 2006-12-17 12:55:39 UTC (rev 2240)
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Remco den Breeje <remco at sx.mine.nu>
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as published
+ * it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@@ -31,43 +31,50 @@
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/xfce-panel-plugin.h>
+#include "datetime.h"
#include "datetime-dialog.h"
/*
- * show and read fonts and inform datetime about it
+ * show and read fonts and inform datetime about it
*/
static void datetime_font_selection_cb(GtkWidget *widget, t_datetime *dt)
{
GtkWidget *dialog;
- gchar *fontname, *previewtext;
+ gchar *fontname;
+ const gchar *previewtext;
gint target, result;
+ gchar *font_name;
if(widget == dt->date_font_selector)
{
target = DATE;
fontname = dt->date_font;
- previewtext = (gchar *)gtk_label_get_text(GTK_LABEL(dt->date_label));
+ previewtext = gtk_label_get_text(GTK_LABEL(dt->date_label));
}
- else if(widget == dt->time_font_selector)
+ else /*time_font_selector */
{
target = TIME;
fontname = dt->time_font;
- previewtext = (gchar *)gtk_label_get_text(GTK_LABEL(dt->time_label));
+ previewtext = gtk_label_get_text(GTK_LABEL(dt->time_label));
}
dialog = gtk_font_selection_dialog_new(_("Select font"));
gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog),
fontname);
- gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(dialog),
- previewtext);
-
+
+ if (G_LIKELY (previewtext != NULL))
+ {
+ gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(dialog),
+ previewtext);
+ }
+
result = gtk_dialog_run(GTK_DIALOG(dialog));
- if (result == GTK_RESPONSE_OK || result == GTK_RESPONSE_ACCEPT)
+ if (result == GTK_RESPONSE_OK || result == GTK_RESPONSE_ACCEPT)
{
- gchar *font_name;
- font_name = gtk_font_selection_dialog_get_font_name(
- GTK_FONT_SELECTION_DIALOG(dialog));
- if (font_name != NULL)
+ font_name =
+ gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog));
+
+ if (font_name != NULL)
{
gtk_button_set_label(GTK_BUTTON(widget), font_name);
@@ -75,13 +82,15 @@
datetime_apply_font(dt, font_name, NULL);
else
datetime_apply_font(dt, NULL, font_name);
+
+ g_free (font_name);
}
}
gtk_widget_destroy(dialog);
}
/*
- * read values from date and time entry and inform datetime about it
+ * read values from date and time entry and inform datetime about it
*/
static gboolean datetime_entry_change_cb(GtkWidget *widget, GdkEventFocus *ev,
t_datetime *dt)
@@ -120,9 +129,9 @@
void datetime_properties_dialog(XfcePanelPlugin *plugin,
t_datetime * datetime)
{
- GtkWidget *dlg,
- *frame,
- *vbox,
+ GtkWidget *dlg,
+ *frame,
+ *vbox,
*hbox,
*label,
*image,
@@ -147,7 +156,7 @@
gtk_container_set_border_width(GTK_CONTAINER(dlg), 2);
- /*
+ /*
* time frame
*/
frame = xfce_create_framebox(_("Time"), &bin);
@@ -194,8 +203,8 @@
gtk_widget_show_all(frame);
- /*
- * Date frame
+ /*
+ * Date frame
*/
frame = xfce_create_framebox(_("Date"), &bin);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), frame,
@@ -241,7 +250,7 @@
gtk_widget_show_all(frame);
- /*
+ /*
* Calendar options frame
*/
frame = xfce_create_framebox(_("Calendar"), &bin);
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.h
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.h 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime-dialog.h 2006-12-17 12:55:39 UTC (rev 2240)
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Remco den Breeje <remco at sx.mine.nu>
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as published
+ * it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@@ -21,13 +21,8 @@
#ifndef _DATETIME_DIALOG_H
#define _DATETIME_DIALOG_H 1
-#include "datetime.h"
+void
+datetime_properties_dialog(XfcePanelPlugin *plugin, t_datetime * datetime);
-static void datetime_font_selection_cb(GtkWidget *widget, t_datetime *dt);
-static gboolean datetime_entry_change_cb(GtkWidget *widget, GdkEventFocus *ev,
- t_datetime *dt);
-static void datetime_dialog_response(GtkWidget *dlg, int foo, t_datetime *dt);
-void datetime_properties_dialog(XfcePanelPlugin *plugin, t_datetime * datetime);
-
#endif /* datetime-dialog.h */
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime.c 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime.c 2006-12-17 12:55:39 UTC (rev 2240)
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Remco den Breeje <remco at sx.mine.nu>
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as published
+ * it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@@ -55,38 +55,38 @@
g_get_current_time(&timeval);
current = localtime((time_t *)&timeval.tv_sec);
- if (datetime->date_format != NULL && GTK_IS_LABEL(datetime->date_label))
+ if (datetime->date_format != NULL && GTK_IS_LABEL(datetime->date_label))
{
len = strftime(buf, sizeof(buf) - 1, datetime->date_format, current);
- if (len != 0)
+ if (len != 0)
{
buf[len] = '\0'; /* make sure nul terminated string */
utf8str = g_locale_to_utf8(buf, len, NULL, NULL, NULL);
- if (utf8str != NULL)
+ if (utf8str != NULL)
{
gtk_label_set_text(GTK_LABEL(datetime->date_label), utf8str);
g_free(utf8str);
}
- }
- else
+ }
+ else
{
gtk_label_set_text(GTK_LABEL(datetime->date_label), _("Error"));
}
}
- if (datetime->time_format != NULL && GTK_IS_LABEL(datetime->time_label))
+ if (datetime->time_format != NULL && GTK_IS_LABEL(datetime->time_label))
{
len = strftime(buf, sizeof(buf) - 1, datetime->time_format, current);
- if (len != 0)
+ if (len != 0)
{
buf[len] = '\0'; /* make sure nul terminated string */
utf8str = g_locale_to_utf8(buf, len, NULL, NULL, NULL);
- if (utf8str != NULL)
+ if (utf8str != NULL)
{
gtk_label_set_text(GTK_LABEL(datetime->time_label), utf8str);
g_free(utf8str);
}
- }
+ }
else
{
gtk_label_set_text(GTK_LABEL(datetime->time_label), _("Error"));
@@ -148,7 +148,7 @@
DBG("root: %dx%d", root_w, root_h);
DBG("calendar: %dx%d", width, height);
- if (orientation == GTK_ORIENTATION_VERTICAL)
+ if (orientation == GTK_ORIENTATION_VERTICAL)
{
if (parent_x < root_w / 2) {
if (parent_y < root_h / 2) {
@@ -171,33 +171,33 @@
y = parent_y + parent_h - height;
}
}
- }
- else
+ }
+ else
{
- if (parent_x < root_w / 2)
+ if (parent_x < root_w / 2)
{
- if (parent_y < root_h / 2)
+ if (parent_y < root_h / 2)
{
/* upper left */
x = parent_x;
y = parent_y + parent_h;
- }
- else
+ }
+ else
{
/* lower left */
x = parent_x;
y = parent_y - height;
}
- }
- else
+ }
+ else
{
- if (parent_y < root_h / 2)
+ if (parent_y < root_h / 2)
{
/* upper right */
x = parent_x + parent_w - width;
y = parent_y + parent_h;
- }
- else
+ }
+ else
{
/* lower right */
x = parent_x + parent_w - width;
@@ -279,44 +279,54 @@
GdkEventButton *event,
t_datetime *datetime)
{
+ gint orientation;
+
if (event->button != 1)
return FALSE;
if (datetime == NULL)
return FALSE;
- if (datetime->cal != NULL)
+ if (datetime->cal != NULL)
{
gtk_widget_destroy(datetime->cal);
datetime->cal = NULL;
- }
- else
+ }
+ else
{
/* get orientation before drawing the calendar */
- int orientation = xfce_panel_plugin_get_orientation(datetime->plugin);
+ orientation = xfce_panel_plugin_get_orientation(datetime->plugin);
/* draw calendar */
datetime->cal = pop_calendar_window(datetime->eventbox,
- orientation,
- gtk_label_get_text(
- GTK_LABEL(datetime->date_label))
- );
+ orientation,
+ gtk_label_get_text(GTK_LABEL(datetime->date_label)));
}
return TRUE;
-}
+}
static void datetime_update_date_font(t_datetime *datetime)
-{
+{
PangoFontDescription *font;
font = pango_font_description_from_string(datetime->date_font);
- gtk_widget_modify_font(datetime->date_label, font);
+
+ if (G_LIKELY (font))
+ {
+ gtk_widget_modify_font(datetime->date_label, font);
+ pango_font_description_free (font);
+ }
}
static void datetime_update_time_font(t_datetime *datetime)
{
PangoFontDescription *font;
font = pango_font_description_from_string(datetime->time_font);
- gtk_widget_modify_font(datetime->time_label, font);
+
+ if (G_LIKELY (font))
+ {
+ gtk_widget_modify_font(datetime->time_label, font);
+ pango_font_description_free (font);
+ }
}
/*
@@ -326,14 +336,14 @@
const gchar *date_font_name,
const gchar *time_font_name)
{
- if (date_font_name != NULL)
+ if (date_font_name != NULL)
{
g_free(datetime->date_font);
datetime->date_font = g_strdup(date_font_name);
datetime_update_date_font(datetime);
}
- if (time_font_name != NULL)
+ if (time_font_name != NULL)
{
g_free(datetime->time_font);
datetime->time_font = g_strdup(time_font_name);
@@ -345,13 +355,13 @@
* set the date and time format
*/
void datetime_apply_format(t_datetime *datetime,
- const char *date_format,
- const char *time_format)
+ const gchar *date_format,
+ const gchar *time_format)
{
if (datetime == NULL)
return;
- if (date_format != NULL)
+ if (date_format != NULL)
{
g_free(datetime->date_format);
datetime->date_format = g_strdup(date_format);
@@ -361,7 +371,7 @@
gtk_widget_show(GTK_WIDGET(datetime->date_label));
}
- if (time_format != NULL)
+ if (time_format != NULL)
{
g_free(datetime->time_format);
datetime->time_format = g_strdup(time_format);
@@ -391,14 +401,14 @@
{
datetime->timeout_id = g_timeout_add(10000, datetime_update, datetime);
}
-}
+}
/*
* Set a border - Function only called by the signal handler.
* A border is only set, if there is enough space for it (size > 26)
*/
static int datetime_set_size(XfcePanelPlugin *plugin,
- int size,
+ gint size,
t_datetime *datetime)
{
DBG("set_size called! with new size of %d", size);
@@ -417,16 +427,16 @@
*/
static void datetime_read_rc_file(XfcePanelPlugin *plugin, t_datetime *dt)
{
- char *file;
+ gchar *file;
XfceRc *rc;
- gchar *date_font, *time_font, *date_format, *time_format;
+ const gchar *date_font, *time_font, *date_format, *time_format;
/* load defaults */
date_font = "Bitstream Vera Sans 8";
time_font = "Bitstream Vera Sans 10";
date_format = _("%Y-%m-%d");
time_format = _("%H:%M");
-
+
/* open file */
if((file = xfce_panel_plugin_lookup_rc_file(plugin)) != NULL)
{
@@ -435,13 +445,14 @@
if(rc != NULL)
{
- date_font = (gchar *)xfce_rc_read_entry(rc, "date_font", date_font);
- time_font = (gchar *)xfce_rc_read_entry(rc, "time_font", time_font);
- date_format = (gchar *)xfce_rc_read_entry(rc, "date_format", date_format);
- time_format = (gchar *)xfce_rc_read_entry(rc, "time_format", time_format);
+ date_font = xfce_rc_read_entry(rc, "date_font", date_font);
+ time_font = xfce_rc_read_entry(rc, "time_font", time_font);
+ date_format = xfce_rc_read_entry(rc, "date_format", date_format);
+ time_format = xfce_rc_read_entry(rc, "time_format", time_format);
+
xfce_rc_close(rc);
}
- }
+ }
/* set values in dt struct */
datetime_apply_font(dt, date_font, time_font);
@@ -458,7 +469,7 @@
if(!(file = xfce_panel_plugin_save_location(plugin, TRUE)))
return;
-
+
rc = xfce_rc_simple_open(file, FALSE);
g_free(file);
@@ -475,9 +486,6 @@
*/
static void datetime_create_widget(t_datetime * datetime)
{
- GtkWidget *box;
- GtkWidget *align;
-
/* create event box */
datetime->eventbox = gtk_event_box_new();
@@ -497,9 +505,9 @@
gtk_label_set_justify(GTK_LABEL(datetime->date_label), GTK_JUSTIFY_CENTER);
/* add time and date lines to the vbox */
- gtk_box_pack_start(GTK_BOX(datetime->vbox),
+ gtk_box_pack_start(GTK_BOX(datetime->vbox),
datetime->time_label, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(datetime->vbox),
+ gtk_box_pack_start(GTK_BOX(datetime->vbox),
datetime->date_label, FALSE, FALSE, 0);
gtk_box_reorder_child(GTK_BOX(datetime->vbox), datetime->time_label, 0);
gtk_box_reorder_child(GTK_BOX(datetime->vbox), datetime->date_label, 1);
@@ -516,13 +524,10 @@
{
t_datetime * datetime;
- DBG("");
- DBG("");
- DBG("******************************************");
DBG("Starting datetime panel plugin");
- /* allocate 1 (arg2) element(s) of type t_datetime (arg1) */
- datetime = g_new(t_datetime, 1);
+ /* alloc mem */
+ datetime = panel_slice_new0 (t_datetime);
/* set variables */
datetime->plugin = plugin;
@@ -539,7 +544,7 @@
/* load settings (default values if non-av) */
datetime_read_rc_file(plugin, datetime);
-
+
/* set date and time labels */
datetime_update(datetime);
@@ -552,12 +557,21 @@
/*
* frees the datetime struct
*/
-static void datetime_free(XfcePanelPlugin *plugin, gpointer data)
+static void datetime_free(XfcePanelPlugin *plugin, t_datetime *datetime)
{
- t_datetime *datetime;
- g_return_if_fail(data != NULL);
- datetime = (t_datetime *) data;
- g_free(datetime);
+ /* stop timeout */
+ g_source_remove(datetime->timeout_id);
+
+ /* destroy widget */
+ gtk_widget_destroy(datetime->eventbox);
+
+ /* cleanup */
+ g_free(datetime->date_font);
+ g_free(datetime->time_font);
+ g_free(datetime->date_format);
+ g_free(datetime->time_format);
+
+ panel_slice_free(t_datetime, datetime);
}
/*
@@ -573,11 +587,11 @@
xfce_panel_plugin_add_action_widget(plugin, datetime->eventbox);
/* connect plugin signals to functions */
- g_signal_connect(plugin, "save",
+ g_signal_connect(plugin, "save",
G_CALLBACK(datetime_write_rc_file), datetime);
- g_signal_connect(plugin, "free-data",
+ g_signal_connect(plugin, "free-data",
G_CALLBACK(datetime_free), datetime);
- g_signal_connect(plugin, "size-changed",
+ g_signal_connect(plugin, "size-changed",
G_CALLBACK (datetime_set_size), datetime);
g_signal_connect(plugin, "configure-plugin",
G_CALLBACK (datetime_properties_dialog), datetime);
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime.desktop.in.in
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime.desktop.in.in 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime.desktop.in.in 2006-12-17 12:55:39 UTC (rev 2240)
@@ -4,4 +4,5 @@
_Name=DateTime
_Comment=Date and Time plugin with a simple calendar
Icon=xfce-schedule
-X-XFCE-Module=@INTERNAL_PLUGIN_PATH@/libdatetime.so
+X-XFCE-Module=datetime
+X-XFCE-Module-Path=@libdir@/xfce4/panel-plugins
Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime.h
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime.h 2006-12-17 11:56:34 UTC (rev 2239)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime.h 2006-12-17 12:55:39 UTC (rev 2240)
@@ -4,7 +4,7 @@
* Copyright (c) 2006 Remco den Breeje <remco at sx.mine.nu>
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as published
+ * it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@@ -52,5 +52,22 @@
GtkWidget *cal;
} t_datetime;
+gboolean
+datetime_update(gpointer data);
+
+void
+datetime_apply_font(t_datetime *datetime,
+ const gchar *date_font_name,
+ const gchar *time_font_name);
+
+void
+datetime_apply_format(t_datetime *datetime,
+ const gchar *date_format,
+ const gchar *time_format);
+
+void
+datetime_write_rc_file(XfcePanelPlugin *plugin,
+ t_datetime *dt);
+
#endif /* datetime.h */
Added: xfce4-datetime-plugin/trunk/po/LINGUAS
===================================================================
--- xfce4-datetime-plugin/trunk/po/LINGUAS (rev 0)
+++ xfce4-datetime-plugin/trunk/po/LINGUAS 2006-12-17 12:55:39 UTC (rev 2240)
@@ -0,0 +1,2 @@
+# set of available languages (in alphabetic order)
+nl
More information about the Goodies-commits
mailing list