Browse Source

Drop .svn directories.

upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
3b7428949a
  1. 89
      plugins/clock/.svn/all-wcprops
  2. 10
      plugins/clock/.svn/dir-prop-base
  3. 210
      plugins/clock/.svn/entries
  4. 1
      plugins/clock/.svn/format
  5. 5
      plugins/clock/.svn/prop-base/Makefile.am.svn-base
  6. 5
      plugins/clock/.svn/prop-base/clock-analog.c.svn-base
  7. 5
      plugins/clock/.svn/prop-base/clock-analog.h.svn-base
  8. 5
      plugins/clock/.svn/prop-base/clock-binary.c.svn-base
  9. 5
      plugins/clock/.svn/prop-base/clock-binary.h.svn-base
  10. 5
      plugins/clock/.svn/prop-base/clock-dialog.c.svn-base
  11. 5
      plugins/clock/.svn/prop-base/clock-dialog.h.svn-base
  12. 5
      plugins/clock/.svn/prop-base/clock-digital.c.svn-base
  13. 5
      plugins/clock/.svn/prop-base/clock-digital.h.svn-base
  14. 5
      plugins/clock/.svn/prop-base/clock-lcd.c.svn-base
  15. 5
      plugins/clock/.svn/prop-base/clock-lcd.h.svn-base
  16. 9
      plugins/clock/.svn/prop-base/clock.c.svn-base
  17. 5
      plugins/clock/.svn/prop-base/clock.desktop.in.in.svn-base
  18. 5
      plugins/clock/.svn/prop-base/clock.h.svn-base
  19. 81
      plugins/clock/.svn/text-base/Makefile.am.svn-base
  20. 377
      plugins/clock/.svn/text-base/clock-analog.c.svn-base
  21. 43
      plugins/clock/.svn/text-base/clock-analog.h.svn-base
  22. 395
      plugins/clock/.svn/text-base/clock-binary.c.svn-base
  23. 43
      plugins/clock/.svn/text-base/clock-binary.h.svn-base
  24. 563
      plugins/clock/.svn/text-base/clock-dialog.c.svn-base
  25. 31
      plugins/clock/.svn/text-base/clock-dialog.h.svn-base
  26. 226
      plugins/clock/.svn/text-base/clock-digital.c.svn-base
  27. 43
      plugins/clock/.svn/text-base/clock-digital.h.svn-base
  28. 551
      plugins/clock/.svn/text-base/clock-lcd.c.svn-base
  29. 43
      plugins/clock/.svn/text-base/clock-lcd.h.svn-base
  30. 667
      plugins/clock/.svn/text-base/clock.c.svn-base
  31. 8
      plugins/clock/.svn/text-base/clock.desktop.in.in.svn-base
  32. 105
      plugins/clock/.svn/text-base/clock.h.svn-base
  33. 53
      plugins/launcher/.svn/all-wcprops
  34. 10
      plugins/launcher/.svn/dir-prop-base
  35. 131
      plugins/launcher/.svn/entries
  36. 1
      plugins/launcher/.svn/format
  37. 5
      plugins/launcher/.svn/prop-base/Makefile.am.svn-base
  38. 5
      plugins/launcher/.svn/prop-base/launcher-dialog.c.svn-base
  39. 5
      plugins/launcher/.svn/prop-base/launcher-dialog.h.svn-base
  40. 5
      plugins/launcher/.svn/prop-base/launcher-exec.c.svn-base
  41. 5
      plugins/launcher/.svn/prop-base/launcher-exec.h.svn-base
  42. 5
      plugins/launcher/.svn/prop-base/launcher.c.svn-base
  43. 5
      plugins/launcher/.svn/prop-base/launcher.h.svn-base
  44. 80
      plugins/launcher/.svn/text-base/Makefile.am.svn-base
  45. 1597
      plugins/launcher/.svn/text-base/launcher-dialog.c.svn-base
  46. 26
      plugins/launcher/.svn/text-base/launcher-dialog.h.svn-base
  47. 639
      plugins/launcher/.svn/text-base/launcher-exec.c.svn-base
  48. 29
      plugins/launcher/.svn/text-base/launcher-exec.h.svn-base
  49. 1298
      plugins/launcher/.svn/text-base/launcher.c.svn-base
  50. 9
      plugins/launcher/.svn/text-base/launcher.desktop.in.in.svn-base
  51. 124
      plugins/launcher/.svn/text-base/launcher.h.svn-base
  52. 71
      plugins/systray/.svn/all-wcprops
  53. 10
      plugins/systray/.svn/dir-prop-base
  54. 170
      plugins/systray/.svn/entries
  55. 1
      plugins/systray/.svn/format
  56. 5
      plugins/systray/.svn/prop-base/Makefile.am.svn-base
  57. 9
      plugins/systray/.svn/prop-base/xfce-tray-dialogs.c.svn-base
  58. 9
      plugins/systray/.svn/prop-base/xfce-tray-dialogs.h.svn-base
  59. 9
      plugins/systray/.svn/prop-base/xfce-tray-manager.c.svn-base
  60. 9
      plugins/systray/.svn/prop-base/xfce-tray-manager.h.svn-base
  61. 5
      plugins/systray/.svn/prop-base/xfce-tray-marshal.list.svn-base
  62. 9
      plugins/systray/.svn/prop-base/xfce-tray-plugin.c.svn-base
  63. 9
      plugins/systray/.svn/prop-base/xfce-tray-plugin.h.svn-base
  64. 9
      plugins/systray/.svn/prop-base/xfce-tray-widget.c.svn-base
  65. 9
      plugins/systray/.svn/prop-base/xfce-tray-widget.h.svn-base
  66. 117
      plugins/systray/.svn/text-base/Makefile.am.svn-base
  67. 9
      plugins/systray/.svn/text-base/systray.desktop.in.in.svn-base
  68. 492
      plugins/systray/.svn/text-base/xfce-tray-dialogs.c.svn-base
  69. 23
      plugins/systray/.svn/text-base/xfce-tray-dialogs.h.svn-base
  70. 913
      plugins/systray/.svn/text-base/xfce-tray-manager.c.svn-base
  71. 76
      plugins/systray/.svn/text-base/xfce-tray-manager.h.svn-base
  72. 2
      plugins/systray/.svn/text-base/xfce-tray-marshal.list.svn-base
  73. 498
      plugins/systray/.svn/text-base/xfce-tray-plugin.c.svn-base
  74. 42
      plugins/systray/.svn/text-base/xfce-tray-plugin.h.svn-base
  75. 870
      plugins/systray/.svn/text-base/xfce-tray-widget.c.svn-base
  76. 69
      plugins/systray/.svn/text-base/xfce-tray-widget.h.svn-base
  77. 28
      plugins/systray/xfce-tray-manager.c
  78. 41
      plugins/tasklist/.svn/all-wcprops
  79. 10
      plugins/tasklist/.svn/dir-prop-base
  80. 105
      plugins/tasklist/.svn/entries
  81. 1
      plugins/tasklist/.svn/format
  82. 5
      plugins/tasklist/.svn/prop-base/Makefile.am.svn-base
  83. 5
      plugins/tasklist/.svn/prop-base/tasklist-dialogs.c.svn-base
  84. 5
      plugins/tasklist/.svn/prop-base/tasklist-dialogs.h.svn-base
  85. 5
      plugins/tasklist/.svn/prop-base/tasklist.c.svn-base
  86. 5
      plugins/tasklist/.svn/prop-base/tasklist.h.svn-base
  87. 74
      plugins/tasklist/.svn/text-base/Makefile.am.svn-base
  88. 232
      plugins/tasklist/.svn/text-base/tasklist-dialogs.c.svn-base
  89. 25
      plugins/tasklist/.svn/text-base/tasklist-dialogs.h.svn-base
  90. 477
      plugins/tasklist/.svn/text-base/tasklist.c.svn-base
  91. 9
      plugins/tasklist/.svn/text-base/tasklist.desktop.in.in.svn-base
  92. 63
      plugins/tasklist/.svn/text-base/tasklist.h.svn-base

89
plugins/clock/.svn/all-wcprops

@ -1,89 +0,0 @@
K 25
svn:wc:ra_dav:version-url
V 56
/svn/xfce/!svn/ver/26625/xfce4-panel/trunk/plugins/clock
END
clock-analog.h
K 25
svn:wc:ra_dav:version-url
V 71
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/clock-analog.h
END
clock-lcd.h
K 25
svn:wc:ra_dav:version-url
V 68
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/clock-lcd.h
END
clock.h
K 25
svn:wc:ra_dav:version-url
V 64
/svn/xfce/!svn/ver/26385/xfce4-panel/trunk/plugins/clock/clock.h
END
clock-binary.h
K 25
svn:wc:ra_dav:version-url
V 71
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/clock-binary.h
END
clock-digital.c
K 25
svn:wc:ra_dav:version-url
V 72
/svn/xfce/!svn/ver/25899/xfce4-panel/trunk/plugins/clock/clock-digital.c
END
Makefile.am
K 25
svn:wc:ra_dav:version-url
V 68
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/Makefile.am
END
clock-dialog.c
K 25
svn:wc:ra_dav:version-url
V 71
/svn/xfce/!svn/ver/26477/xfce4-panel/trunk/plugins/clock/clock-dialog.c
END
clock-analog.c
K 25
svn:wc:ra_dav:version-url
V 71
/svn/xfce/!svn/ver/25905/xfce4-panel/trunk/plugins/clock/clock-analog.c
END
clock-digital.h
K 25
svn:wc:ra_dav:version-url
V 72
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/clock-digital.h
END
clock-lcd.c
K 25
svn:wc:ra_dav:version-url
V 68
/svn/xfce/!svn/ver/26385/xfce4-panel/trunk/plugins/clock/clock-lcd.c
END
clock.c
K 25
svn:wc:ra_dav:version-url
V 64
/svn/xfce/!svn/ver/26625/xfce4-panel/trunk/plugins/clock/clock.c
END
clock.desktop.in.in
K 25
svn:wc:ra_dav:version-url
V 76
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/clock.desktop.in.in
END
clock-binary.c
K 25
svn:wc:ra_dav:version-url
V 71
/svn/xfce/!svn/ver/25899/xfce4-panel/trunk/plugins/clock/clock-binary.c
END
clock-dialog.h
K 25
svn:wc:ra_dav:version-url
V 71
/svn/xfce/!svn/ver/25890/xfce4-panel/trunk/plugins/clock/clock-dialog.h
END

10
plugins/clock/.svn/dir-prop-base

@ -1,10 +0,0 @@
K 10
svn:ignore
V 42
Makefile
Makefile.in
.deps
.libs
*desktop
END

210
plugins/clock/.svn/entries

@ -1,210 +0,0 @@
8
dir
26625
https://svn.xfce.org/svn/xfce/xfce4-panel/trunk/plugins/clock
https://svn.xfce.org/svn/xfce
2008-02-18T07:59:29.025147Z
26625
nick
has-props
svn:special svn:externals svn:needs-lock
a0aa69c2-05f4-0310-b83c-d5d913b14636
clock-analog.h
file
2007-12-21T07:30:11.000000Z
df81a049a71a1e39054a4bb4d39bc364
2007-07-06T19:57:20.222544Z
25890
nick
has-props
clock-lcd.h
file
2007-12-21T07:30:11.000000Z
7996d55d3b72f40e9d2a6b262b6205b0
2007-07-06T19:57:20.222544Z
25890
nick
has-props
clock.h
file
2007-12-21T07:30:11.000000Z
8f7076898e0b06de115fa080d95e8b88
2007-11-21T10:21:11.159627Z
26385
nick
has-props
clock-binary.h
file
2007-12-21T07:30:11.000000Z
0feec91fbb3c524f065f327763745d13
2007-07-06T19:57:20.222544Z
25890
nick
has-props
clock-digital.c
file
2007-12-21T07:30:11.000000Z
8a8951e77e6d5ae3d8b910c812c1c8cf
2007-07-08T10:03:02.704025Z
25899
nick
has-props
Makefile.am
file
2007-12-21T07:30:11.000000Z
289bcee5642e698e74b778dbd824fc18
2007-07-06T19:57:20.222544Z
25890
nick
has-props
clock-dialog.c
file
2007-12-21T07:30:11.000000Z
a382b283c3e9b1210debcee13b22100b
2007-12-14T10:14:04.569928Z
26477
nick
has-props
clock-analog.c
file
2007-12-21T07:30:11.000000Z
32d14fb0e5779485a25a6e8e5ef1bc6d
2007-07-09T19:51:58.413526Z
25905
nick
has-props
clock-digital.h
file
2007-12-21T07:30:11.000000Z
f45daed913b547fc6b93af3578fb6079
2007-07-06T19:57:20.222544Z
25890
nick
has-props
clock-lcd.c
file
2007-12-21T07:30:11.000000Z
e23f7b0ba4e8a68c3406febb972598d0
2007-11-21T10:21:11.159627Z
26385
nick
has-props
clock.c
file
2008-02-18T07:59:28.000000Z
dc3f7e658cb0687f53af7739394720de
2008-02-18T07:59:29.025147Z
26625
nick
has-props
clock.desktop.in.in
file
2007-12-21T07:30:11.000000Z
3328f6a0e9c3f094f148100e0e345791
2007-07-06T19:57:20.222544Z
25890
nick
has-props
clock-binary.c
file
2007-12-21T07:30:11.000000Z
4382fb6dedb49c83e08e08fe03677922
2007-07-08T10:03:02.704025Z
25899
nick
has-props
clock-dialog.h
file
2007-12-21T07:30:11.000000Z
7cd25d14556394c5ba2a759e7f0f455f
2007-07-06T19:57:20.222544Z
25890
nick
has-props

1
plugins/clock/.svn/format

@ -1 +0,0 @@
8

5
plugins/clock/.svn/prop-base/Makefile.am.svn-base

@ -1,5 +0,0 @@
K 12
svn:keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-analog.c.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-analog.h.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-binary.c.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-binary.h.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-dialog.c.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-dialog.h.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-digital.c.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-digital.h.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-lcd.c.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock-lcd.h.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

9
plugins/clock/.svn/prop-base/clock.c.svn-base

@ -1,9 +0,0 @@
K 8
keywords
V 2
Id
K 12
svn:keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock.desktop.in.in.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

5
plugins/clock/.svn/prop-base/clock.h.svn-base

@ -1,5 +0,0 @@
K 8
keywords
V 2
Id
END

81
plugins/clock/.svn/text-base/Makefile.am.svn-base

@ -1,81 +0,0 @@
# $Id$
INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libclock\" \
-DLOCALEDIR=\"$(localedir)\" \
$(PLATFORM_CPPFLAGS)
plugindir = \
$(libdir)/xfce4/panel-plugins
plugin_LTLIBRARIES = \
libclock.la
libclock_la_SOURCES = \
clock.c \
clock.h \
clock-analog.c \
clock-analog.h \
clock-binary.c \
clock-binary.h \
clock-dialog.c \
clock-dialog.h \
clock-digital.c \
clock-digital.h \
clock-lcd.c \
clock-lcd.h
libclock_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(PLATFORM_CFLAGS)
libclock_la_LDFLAGS = \
-avoid-version \
-module \
$(PLATFORM_LDFLAGS)
if HAVE_CYGWIN
libclock_la_LDFLAGS += \
-no-undefined
endif
libclock_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(CAIRO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS)
libclock_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la
#
# .desktop file
#
desktopdir = \
$(datadir)/xfce4/panel-plugins
desktop_in_in_files = \
clock.desktop.in.in
desktop_in_files = \
$(desktop_in_in_files:.desktop.in.in=.desktop.in)
%.desktop.in: %.desktop.in.in
sed -e "s,\@libdir\@,$(libdir),g" < $< > $@
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
$(desktop_in_in_files)
DISTCLEANFILES = \
$(desktop_DATA) \
$(desktop_in_files)
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

377
plugins/clock/.svn/text-base/clock-analog.c.svn-base

@ -1,377 +0,0 @@
/* $Id$ */
/*
* Copyright (c) 2007 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include <gtk/gtk.h>
#include <cairo/cairo.h>
#include "clock.h"
#include "clock-analog.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define CLOCK_SCALE 0.1
#define TICKS_TO_RADIANS(x) (M_PI - (M_PI / 30.0) * (x))
#define HOURS_TO_RADIANS(x,y) (M_PI - (M_PI / 6.0) * (((x) > 12 ? (x) - 12 : (x)) + (y) / 60.0))
/* 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,
const GValue *value,
GParamSpec *pspec);
static void xfce_clock_analog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_analog_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static gboolean xfce_clock_analog_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void xfce_clock_analog_draw_ticks (cairo_t *cr,
gdouble xc,
gdouble yc,
gdouble radius);
static void xfce_clock_analog_draw_pointer (cairo_t *cr,
gdouble xc,
gdouble yc,
gdouble radius,
gdouble angle,
gdouble scale,
gboolean line);
enum
{
PROP_0,
PROP_SHOW_SECONDS
};
struct _XfceClockAnalogClass
{
GtkImageClass __parent__;
};
struct _XfceClockAnalog
{
GtkImage __parent__;
/* draw seconds */
guint show_seconds : 1;
};
static GObjectClass *xfce_clock_analog_parent_class;
GType
xfce_clock_analog_get_type (void)
{
static GType type = G_TYPE_INVALID;
if (G_UNLIKELY (type == G_TYPE_INVALID))
{
type = g_type_register_static_simple (GTK_TYPE_IMAGE,
I_("XfceClockAnalog"),
sizeof (XfceClockAnalogClass),
(GClassInitFunc) xfce_clock_analog_class_init,
sizeof (XfceClockAnalog),
(GInstanceInitFunc) xfce_clock_analog_init,
0);
}
return type;
}
static void
xfce_clock_analog_class_init (XfceClockAnalogClass *klass)
{
GObjectClass *gobject_class;
GtkWidgetClass *gtkwidget_class;
xfce_clock_analog_parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_clock_analog_finalize;
gobject_class->set_property = xfce_clock_analog_set_property;
gobject_class->get_property = xfce_clock_analog_get_property;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->size_request = xfce_clock_analog_size_request;
gtkwidget_class->expose_event = xfce_clock_analog_expose_event;
/**
* Whether we display seconds
**/
g_object_class_install_property (gobject_class,
PROP_SHOW_SECONDS,
g_param_spec_boolean ("show-seconds", "show-seconds", "show-seconds",
FALSE, PANEL_PARAM_READWRITE));
}
static void
xfce_clock_analog_init (XfceClockAnalog *clock)
{
/* init */
clock->show_seconds = FALSE;
}
static void
xfce_clock_analog_finalize (GObject *object)
{
(*G_OBJECT_CLASS (xfce_clock_analog_parent_class)->finalize) (object);
}
static void
xfce_clock_analog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
XfceClockAnalog *clock = XFCE_CLOCK_ANALOG (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
clock->show_seconds = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xfce_clock_analog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
XfceClockAnalog *clock = XFCE_CLOCK_ANALOG (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
g_value_set_boolean (value, clock->show_seconds);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xfce_clock_analog_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
gint width, height;
/* get the current widget size */
gtk_widget_get_size_request (widget, &width, &height);
/* square the widget */
requisition->width = requisition->height = MAX (width, height);
}
static gboolean
xfce_clock_analog_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
XfceClockAnalog *clock = 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);
/* get center of the widget and the radius */
xc = (widget->allocation.width / 2.0);
yc = (widget->allocation.height / 2.0);
radius = MIN (xc, yc);
/* add the window offset */
xc += widget->allocation.x;
yc += widget->allocation.y;
/* get the cairo context */
cr = gdk_cairo_create (widget->window);
if (G_LIKELY (cr != NULL))
{
/* get the local time */
xfce_clock_util_get_localtime (&tm);
/* set the line properties */
cairo_set_line_width (cr, 1);
gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_STATE_NORMAL]);
/* draw the ticks */
xfce_clock_analog_draw_ticks (cr, xc, yc, radius);
if (clock->show_seconds)
{
/* second pointer */
angle = TICKS_TO_RADIANS (tm.tm_sec);
xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.7, TRUE);
}
/* minute pointer */
angle = TICKS_TO_RADIANS (tm.tm_min);
xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.8, FALSE);
/* hour pointer */
angle = HOURS_TO_RADIANS (tm.tm_hour, tm.tm_min);
xfce_clock_analog_draw_pointer (cr, xc, yc, radius, angle, 0.5, FALSE);
/* cleanup */
cairo_destroy (cr);
}
return FALSE;
}
static void
xfce_clock_analog_draw_ticks (cairo_t *cr,
gdouble xc,
gdouble yc,
gdouble radius)
{
gint i;
gdouble x, y, angle;
for (i = 0; i < 12; i++)
{
/* calculate */
angle = HOURS_TO_RADIANS (i, 0);
x = xc + sin (angle) * (radius * (1.0 - CLOCK_SCALE));
y = yc + cos (angle) * (radius * (1.0 - CLOCK_SCALE));
/* draw arc */
cairo_move_to (cr, x, y);
cairo_arc (cr, x, y, radius * CLOCK_SCALE, 0, 2 * M_PI);
cairo_close_path (cr);
}
/* fill the arcs */
cairo_fill (cr);
}
static void
xfce_clock_analog_draw_pointer (cairo_t *cr,
gdouble xc,
gdouble yc,
gdouble radius,
gdouble angle,
gdouble scale,
gboolean line)
{
gdouble xs, ys;
gdouble xt, yt;
/* calculate tip position */
xt = xc + sin (angle) * radius * scale;
yt = yc + cos (angle) * radius * scale;
if (line)
{
/* draw the line */
cairo_move_to (cr, xc, yc);
cairo_line_to (cr, xt, yt);
/* draw the line */
cairo_stroke (cr);
}
else
{
/* calculate start position */
xs = xc + sin (angle - 0.5 * M_PI) * radius * CLOCK_SCALE;
ys = yc + cos (angle - 0.5 * M_PI) * radius * CLOCK_SCALE;
/* draw the pointer */
cairo_move_to (cr, xs, ys);
cairo_arc (cr, xc, yc, radius * CLOCK_SCALE, -angle + M_PI, -angle);
cairo_line_to (cr, xt, yt);
cairo_close_path (cr);
/* fill the pointer */
cairo_fill (cr);
}
}
GtkWidget *
xfce_clock_analog_new (void)
{
return g_object_new (XFCE_CLOCK_TYPE_ANALOG, NULL);
}
gboolean
xfce_clock_analog_update (gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET (user_data);
/* update if the widget if visible */
if (G_LIKELY (GTK_WIDGET_VISIBLE (widget)))
gtk_widget_queue_draw (widget);
return TRUE;
}

43
plugins/clock/.svn/text-base/clock-analog.h.svn-base

@ -1,43 +0,0 @@
/* $Id$ */
/*
* Copyright (c) 2007 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CLOCK_ANALOG_H__
#define __CLOCK_ANALOG_H__
G_BEGIN_DECLS
typedef struct _XfceClockAnalogClass XfceClockAnalogClass;
typedef struct _XfceClockAnalog XfceClockAnalog;
#define XFCE_CLOCK_TYPE_ANALOG (xfce_clock_analog_get_type ())
#define XFCE_CLOCK_ANALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_CLOCK_TYPE_ANALOG, XfceClockAnalog))
#define XFCE_CLOCK_ANALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_CLOCK_TYPE_ANALOG, XfceClockAnalogClass))
#define XFCE_CLOCK_IS_ANALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_CLOCK_TYPE_ANALOG))
#define XFCE_CLOCK_IS_ANALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_CLOCK_TYPE_ANALOG))
#define XFCE_CLOCK_ANALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_CLOCK_TYPE_ANALOG, XfceClockAnalogClass))
GType xfce_clock_analog_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
GtkWidget *xfce_clock_analog_new (void) G_GNUC_MALLOC G_GNUC_INTERNAL;
gboolean xfce_clock_analog_update (gpointer user_data) G_GNUC_INTERNAL;
G_END_DECLS
#endif /* !__CLOCK_ANALOG_H__ */

395
plugins/clock/.svn/text-base/clock-binary.c.svn-base

@ -1,395 +0,0 @@
/* $Id$ */
/*
* Copyright (c) 2007 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifndef M_PI
#define M_PI 3.141592654
#endif
#include <gtk/gtk.h>
#include <cairo/cairo.h>
#include "clock.h"
#include "clock-binary.h"
/* 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,
const GValue *value,
GParamSpec *pspec);
static void xfce_clock_binary_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_binary_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static gboolean xfce_clock_binary_expose_event (GtkWidget *widget,
GdkEventExpose *event);
enum
{
PROP_0,
PROP_SHOW_SECONDS,
PROP_TRUE_BINARY
};
struct _XfceClockBinaryClass
{
GtkImageClass __parent__;
};
struct _XfceClockBinary
{
GtkImage __parent__;
/* whether we draw seconds */
guint show_seconds : 1;
/* if this is a true binary clock */
guint true_binary : 1;
};
static GObjectClass *xfce_clock_binary_parent_class;
GType
xfce_clock_binary_get_type (void)
{
static GType type = G_TYPE_INVALID;
if (G_UNLIKELY (type == G_TYPE_INVALID))
{
type = g_type_register_static_simple (GTK_TYPE_IMAGE,
I_("XfceClockBinary"),
sizeof (XfceClockBinaryClass),
(GClassInitFunc) xfce_clock_binary_class_init,
sizeof (XfceClockBinary),
(GInstanceInitFunc) xfce_clock_binary_init,
0);
}
return type;
}
static void
xfce_clock_binary_class_init (XfceClockBinaryClass *klass)
{
GObjectClass *gobject_class;
GtkWidgetClass *gtkwidget_class;
xfce_clock_binary_parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_clock_binary_finalize;
gobject_class->set_property = xfce_clock_binary_set_property;
gobject_class->get_property = xfce_clock_binary_get_property;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->size_request = xfce_clock_binary_size_request;
gtkwidget_class->expose_event = xfce_clock_binary_expose_event;
/**
* Whether we display seconds
**/
g_object_class_install_property (gobject_class,
PROP_SHOW_SECONDS,
g_param_spec_boolean ("show-seconds", "show-seconds", "show-seconds",
FALSE, PANEL_PARAM_READWRITE));
/**
* Whether this is a true binary clock
**/
g_object_class_install_property (gobject_class,
PROP_TRUE_BINARY,
g_param_spec_boolean ("true-binary", "true-binary", "true-binary",
FALSE, PANEL_PARAM_READWRITE));
}
static void
xfce_clock_binary_init (XfceClockBinary *clock)
{
/* init */
clock->show_seconds = FALSE;
clock->true_binary = FALSE;
}
static void
xfce_clock_binary_finalize (GObject *object)
{
(*G_OBJECT_CLASS (xfce_clock_binary_parent_class)->finalize) (object);
}
static void
xfce_clock_binary_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
XfceClockBinary *clock = XFCE_CLOCK_BINARY (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
clock->show_seconds = g_value_get_boolean (value);
break;
case PROP_TRUE_BINARY:
clock->true_binary = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xfce_clock_binary_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
XfceClockBinary *clock = XFCE_CLOCK_BINARY (object);
switch (prop_id)
{
case PROP_SHOW_SECONDS:
g_value_set_boolean (value, clock->show_seconds);
break;
case PROP_TRUE_BINARY:
g_value_set_boolean (value, clock->true_binary);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
xfce_clock_binary_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
gint width, height;
gdouble ratio;
XfceClockBinary *clock = 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)
{
ratio = clock->show_seconds ? 2.0 : 3.0;
}
else
{
ratio = clock->show_seconds ? 1.5 : 1.0;
}
/* set requisition based on the plugin orientation */
if (width == -1)
{
requisition->height = height;
requisition->width = height * ratio;
}
else
{
requisition->height = width / ratio;
requisition->width = width;
}
}
static gboolean
xfce_clock_binary_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
XfceClockBinary *clock = XFCE_CLOCK_BINARY (widget);
gdouble cw, ch, columns;
gint ticks, cells, decimal;
gdouble radius;
gdouble x, y;
gint i, j;
gint decimal_tb[] = {32, 16, 8, 4, 2, 1};
gint decimal_bcd[] = {80, 40, 20, 10, 8, 4, 2, 1};
cairo_t *cr;
GdkColor active, inactive;
struct tm tm;
g_return_val_if_fail (XFCE_CLOCK_IS_BINARY (clock), FALSE);
/* number of columns and cells */
columns = clock->show_seconds ? 3.0 : 2.0;
cells = clock->true_binary ? 6 : 8;
/* cell width and height */
if (clock->true_binary)
{
cw = widget->allocation.width / 6.0;
ch = widget->allocation.height / columns;
}
else /* bcd clock */
{
cw = widget->allocation.width / columns / 2.0;
ch = widget->allocation.height / 4.0;
}
/* arc radius */
radius = MIN (cw, ch) / 2.0 * 0.7;
/* get colors */
inactive = widget->style->fg[GTK_STATE_NORMAL];
active = widget->style->bg[GTK_STATE_SELECTED];
/* get the cairo context */
cr = gdk_cairo_create (widget->window);
if (G_LIKELY (cr != NULL))
{
/* get the current time */
xfce_clock_util_get_localtime (&tm);
/* walk the three or two time parts */
for (i = 0; i < columns; i++)
{
/* get the time of this column */
if (i == 0)
ticks = tm.tm_hour;
else if (i == 1)
ticks = tm.tm_min;
else
ticks = tm.tm_sec;
/* walk the binary columns */
for (j = 0; j < cells; j++)
{
if (clock->true_binary)
{
/* skip the columns we don't draw */
if (i == 0 && j == 0)
continue;
/* decimal representation of this cell */
decimal = decimal_tb[j];
/* center of the arc */
x = cw * (j + 0.5) + widget->allocation.x;
y = ch * (i + 0.5) + widget->allocation.y;
}
else /* bcd clock */
{
/* skip the columns we don't draw */
if ((j == 0) || (i == 0 && j == 1))
continue;
/* decimal representation of this cell */
decimal = decimal_bcd[j];
/* center of the arc */
x = cw * (i * 2 + (j < 4 ? 0 : 1) + 0.5) + widget->allocation.x;
y = ch * ((j >= 4 ? j - 4 : j) + 0.5) + widget->allocation.y;
}
/* if this binary values 'fits' in the time */
if (ticks >= decimal)
{
/* extract the decimal value from the time */
ticks -= decimal;
/* set the active color */
gdk_cairo_set_source_color (cr, &active);
}
else
{
/* set the inactive color */
gdk_cairo_set_source_color (cr, &inactive);
}
/* draw the arc */
cairo_move_to (cr, x, y);
cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
cairo_close_path (cr);
/* fill the arc */
cairo_fill (cr);
}
}
/* cleanup */
cairo_destroy (cr);
}
return FALSE;
}
GtkWidget *
xfce_clock_binary_new (void)
{
return g_object_new (XFCE_CLOCK_TYPE_BINARY, NULL);
}
gboolean
xfce_clock_binary_update (gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET (user_data);
/* update if the widget if visible */
if (G_LIKELY (GTK_WIDGET_VISIBLE (widget)))
gtk_widget_queue_draw (widget);
return TRUE;
}

43
plugins/clock/.svn/text-base/clock-binary.h.svn-base

@ -1,43 +0,0 @@
/* $Id$ */
/*
* Copyright (c) 2007 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CLOCK_BINARY_H__
#define __CLOCK_BINARY_H__
G_BEGIN_DECLS
typedef struct _XfceClockBinaryClass XfceClockBinaryClass;
typedef struct _XfceClockBinary XfceClockBinary;
#define XFCE_CLOCK_TYPE_BINARY (xfce_clock_binary_get_type ())
#define XFCE_CLOCK_BINARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_CLOCK_TYPE_BINARY, XfceClockBinary))
#define XFCE_CLOCK_BINARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_CLOCK_TYPE_BINARY, XfceClockBinaryClass))
#define XFCE_CLOCK_IS_BINARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_CLOCK_TYPE_BINARY))
#define XFCE_CLOCK_IS_BINARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_CLOCK_TYPE_BINARY))
#define XFCE_CLOCK_BINARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_CLOCK_TYPE_BINARY, XfceClockBinaryClass))
GType xfce_clock_binary_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
GtkWidget *xfce_clock_binary_new (void) G_GNUC_MALLOC G_GNUC_INTERNAL;
gboolean xfce_clock_binary_update (gpointer user_data) G_GNUC_INTERNAL;
G_END_DECLS
#endif /* !__CLOCK_BINARY_H__ */

563
plugins/clock/.svn/text-base/clock-dialog.c.svn-base

@ -1,563 +0,0 @@
/* $Id$ */
/*
* Copyright (c) 2007 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfcegui4/xfce-titled-dialog.h>
#include <libxfcegui4/xfce-widget-helpers.h>
#include "clock.h"
#include "clock-dialog.h"
/** default formats **/
static const gchar *tooltip_formats[] = {
DEFAULT_TOOLTIP_FORMAT,
"%x",
NULL
};
static const gchar *digital_formats[] = {
DEFAULT_DIGITAL_FORMAT,
"%T",
"%r",
"%R %p",
NULL
};
/** prototypes **/
void xfce_clock_dialog_options (ClockPlugin *clock);
static void
xfce_clock_dialog_reload_settings (ClockPlugin *clock)
{
if (G_LIKELY (clock->widget))
{
/* save the settings */
xfce_clock_widget_update_settings (clock);
/* make sure the plugin sets it's size again */
gtk_widget_queue_resize (clock->widget);
/* run a direct update */
(clock->update) (clock->widget);
/* reschedule the timeout */
xfce_clock_widget_sync (clock);
}
}
static void
xfce_clock_dialog_mode_changed (GtkComboBox *combo,
ClockPlugin *clock)
{
/* set the new mode */
clock->mode = gtk_combo_box_get_active (combo);
/* update the plugin widget */
if (G_LIKELY (clock->widget))
{
/* set the new clock mode */
xfce_clock_widget_set_mode (clock);
/* update the settings */
xfce_clock_dialog_reload_settings (clock);
/* update the plugin size */
xfce_clock_plugin_set_size (clock, xfce_panel_plugin_get_size (clock->plugin));
}
/* update the dialog */
xfce_clock_dialog_options (clock);
}
static void
xfce_clock_dialog_show_frame_toggled (GtkToggleButton *button,
ClockPlugin *clock)
{
/* set frame mode */
clock->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);
}
static void
xfce_clock_dialog_tooltip_format_changed (GtkComboBox *combo,
ClockPlugin *clock)
{
gint index;
GtkWidget *entry;
/* stop running timeout */
if (clock->tooltip_timeout_id)
{
g_source_remove (clock->tooltip_timeout_id);
clock->tooltip_timeout_id = 0;
}
/* get index of selected item */
index = 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 < G_N_ELEMENTS (tooltip_formats))
{
/* hide the entry */
gtk_widget_hide (entry);
/* cleanup old format */
g_free (clock->tooltip_format);
/* set new format */
clock->tooltip_format = g_strdup (tooltip_formats[index]);
/* restart the tooltip timeout */
xfce_clock_tooltip_sync (clock);
}
else
{
/* set string */
gtk_entry_set_text (GTK_ENTRY (entry), clock->tooltip_format);
/* show */
gtk_widget_show (entry);
}
}
static void
xfce_clock_dialog_tooltip_entry_changed (GtkEntry *entry,
ClockPlugin *clock)
{
/* cleanup old format */
g_free (clock->tooltip_format);
/* set new format */
clock->tooltip_format = g_strdup (gtk_entry_get_text (entry));
/* restart the tooltip timeout */
xfce_clock_tooltip_sync (clock);
}
static void
xfce_clock_dialog_show_seconds_toggled (GtkToggleButton *button,
ClockPlugin *clock)
{
/* whether we show seconds */
clock->show_seconds = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
}
static void
xfce_clock_dialog_show_military_toggled (GtkToggleButton *button,
ClockPlugin *clock)
{
/* whether we show a 24h clock */
clock->show_military = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
}
static void
xfce_clock_dialog_show_meridiem_toggled (GtkToggleButton *button,
ClockPlugin *clock)
{
/* whether we show am/pm */
clock->show_meridiem = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
}
static void
xfce_clock_dialog_flash_separators_toggled (GtkToggleButton *button,
ClockPlugin *clock)
{
/* whether flash the separators */
clock->flash_separators = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
}
static void
xfce_clock_dialog_true_binary_toggled (GtkToggleButton *button,
ClockPlugin *clock)
{
/* whether we this is a true binary clock */
clock->true_binary = gtk_toggle_button_get_active (button);
/* update the clock */
xfce_clock_dialog_reload_settings (clock);
}
static void
xfce_clock_dialog_digital_format_changed (GtkComboBox *combo,
ClockPlugin *clock)
{
gint index;
GtkWidget *entry;
/* get index of selected item */
index = 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 < G_N_ELEMENTS (digital_formats))
{
/* hide the entry */
gtk_widget_hide (entry);
/* cleanup old format */
g_free (clock->digital_format);
/* set new format */
clock->digital_format = g_strdup (digital_formats[index]);
/* reload settings */
xfce_clock_dialog_reload_settings (clock);
}
else
{
/* set string */
gtk_entry_set_text (GTK_ENTRY (entry), clock->digital_format);
/* show */
gtk_widget_show (entry);
}
}
static void
xfce_clock_dialog_digital_entry_changed (GtkEntry *entry,
ClockPlugin *clock)
{
/* cleanup old format */
g_free (clock->digital_format);
/* set new format */
clock->digital_format = g_strdup (gtk_entry_get_text (entry));
/* reload settings */
xfce_clock_dialog_reload_settings (clock);
}
static gboolean
xfce_clock_dialog_row_separator_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
{
gchar *title;
gboolean result = FALSE;
gtk_tree_model_get (model, iter, 0, &title, -1);
if (G_LIKELY (title != NULL))
{
result = (strcmp (title, "-") == 0);
/* cleanup */
g_free (title);
}
return result;
}
static gboolean
xfce_clock_dialog_append_combobox_formats (GtkComboBox *combo,
const gchar *formats[],
const gchar *current_format)
{
gint i;
struct tm tm;
gchar *string;
gboolean has_active = FALSE;
/* get the local time */
xfce_clock_util_get_localtime (&tm);
for (i = 0; formats[i] != NULL; i++)
{
/* insert user-redable string */
string = xfce_clock_util_strdup_strftime (formats[i], &tm);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), string);
g_free (string);
/* check if this is the active string */
if (!has_active && current_format && strcmp (formats[i], current_format) == 0)
{
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i);
has_active = TRUE;
}
}
/* insert the separator and the custom line */
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "-");
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Custom"));
if (!has_active)
{
if (!current_format)
{
has_active = TRUE;
i = -1;
}
/* select item */
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
}
return has_active;
}
static void
xfce_clock_dialog_response (GtkWidget *dialog,
gint response,
ClockPlugin *clock)
{
/* 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);
/* unblock the plugin menu */
xfce_panel_plugin_unblock_menu (clock->plugin);
}
void
xfce_clock_dialog_options (ClockPlugin *clock)
{
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"));
gtk_container_foreach (GTK_CONTAINER (bin), (GtkCallback) gtk_widget_destroy, NULL);
/* main vbox */
vbox = gtk_vbox_new (FALSE, 8);
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)
{
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_widget_show (button);
}
if (clock->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_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_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_widget_show (button);
}
if (clock->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_widget_show (button);
}
if (clock->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);
gtk_widget_show (combo);
entry = gtk_entry_new_with_max_length (BUFFER_SIZE-1);
gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (combo), I_("entry"), entry);
if (!has_active)
{
gtk_widget_show (entry);
gtk_entry_set_text (GTK_ENTRY (entry), clock->digital_format);
}
g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (xfce_clock_dialog_digital_entry_changed), clock);
}
}
void
xfce_clock_dialog_show (ClockPlugin *clock)
{
GtkWidget *dialog, *dialog_vbox;
GtkWidget *frame, *bin, *vbox, *combo;