summaryrefslogtreecommitdiff
path: root/typing-break
diff options
context:
space:
mode:
Diffstat (limited to 'typing-break')
-rw-r--r--typing-break/.cvsignore3
-rw-r--r--typing-break/ChangeLog28
-rw-r--r--typing-break/Makefile.am31
-rw-r--r--typing-break/bar-disabled.pngbin473 -> 0 bytes
-rw-r--r--typing-break/bar-green.pngbin253 -> 0 bytes
-rw-r--r--typing-break/bar-red.pngbin258 -> 0 bytes
-rw-r--r--typing-break/bar.pngbin331 -> 0 bytes
-rw-r--r--typing-break/drw-break-window.c574
-rw-r--r--typing-break/drw-break-window.h52
-rw-r--r--typing-break/drw-monitor.c181
-rw-r--r--typing-break/drw-monitor.h51
-rw-r--r--typing-break/drw-selection.c190
-rw-r--r--typing-break/drw-selection.h33
-rw-r--r--typing-break/drw-utils.c173
-rw-r--r--typing-break/drw-utils.h27
-rw-r--r--typing-break/drwright.c970
-rw-r--r--typing-break/drwright.h30
-rw-r--r--typing-break/egg-spawn.c355
-rw-r--r--typing-break/egg-spawn.h81
-rw-r--r--typing-break/eggtrayicon.c341
-rw-r--r--typing-break/eggtrayicon.h76
-rw-r--r--typing-break/main.c122
-rw-r--r--typing-break/ocean-stripes.pngbin274 -> 0 bytes
-rw-r--r--typing-break/stock_stop.pngbin1451 -> 0 bytes
-rw-r--r--typing-break/stop.pngbin2248 -> 0 bytes
25 files changed, 0 insertions, 3318 deletions
diff --git a/typing-break/.cvsignore b/typing-break/.cvsignore
deleted file mode 100644
index b798e21da..000000000
--- a/typing-break/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-gnome-typing-monitor
diff --git a/typing-break/ChangeLog b/typing-break/ChangeLog
deleted file mode 100644
index 0edeb098c..000000000
--- a/typing-break/ChangeLog
+++ /dev/null
@@ -1,28 +0,0 @@
-2003-10-28 Jody Goldberg <jody@gnome.org>
-
- * Release 2.5.0
-
-2003-09-30 Danilo Ĺ egan <dsegan@gmx.net>
-
- * drwright.c (update_tooltip): Use ngettext for plural-forms,
- fixes bug #117997.
-
-2003-08-24 Richard Hult <richard@imendio.com>
-
- * Makefile.am:
- * drw-break-window.c:
- * drwright.c: Multihead support, fixes bug #119827.
-
-Thu Jul 31 17:41:45 2003 Jonathan Blandford <jrb@redhat.com>
-
- * drwright.c (popup_preferences_cb): add properties dialog,
- #118323
-
-Thu Jul 31 14:56:41 2003 Jonathan Blandford <jrb@redhat.com>
-
- * drwright.c (popup_quit_cb): remove bogus popup_quit code.
-
-Thu Jul 31 14:56:13 2003 Jonathan Blandford <jrb@redhat.com>
-
- * ChangeLog: Started a new ChangeLog for the typing break.
-
diff --git a/typing-break/Makefile.am b/typing-break/Makefile.am
deleted file mode 100644
index 28e72f31e..000000000
--- a/typing-break/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-INCLUDES = \
- @GNOME_CFLAGS@ \
- -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
- -DIMAGEDIR=\"$(GNOMECC_PIXMAPS_DIR)\"
-
-bin_PROGRAMS = gnome-typing-monitor
-
-gnome_typing_monitor_SOURCES = \
- main.c \
- drwright.c \
- drwright.h \
- drw-break-window.c \
- drw-break-window.h \
- drw-monitor.c \
- drw-monitor.h \
- drw-utils.c \
- drw-utils.h \
- drw-selection.c \
- drw-selection.h \
- eggtrayicon.c \
- eggtrayicon.h \
- egg-spawn.c \
- egg-spawn.h
-
-gnome_typing_monitor_LDADD = @GNOME_LIBS@ -L/usr/X11R6/lib -lXss
-gnome_typing_monitor_LDFLAGS = -export-dynamic
-
-imagedir = $(GNOMECC_PIXMAPS_DIR)
-image_DATA = stop.png bar.png bar-red.png bar-green.png bar-disabled.png ocean-stripes.png
-
-EXTRA_DIST = $(image_DATA)
diff --git a/typing-break/bar-disabled.png b/typing-break/bar-disabled.png
deleted file mode 100644
index 36bef4b4e..000000000
--- a/typing-break/bar-disabled.png
+++ /dev/null
Binary files differ
diff --git a/typing-break/bar-green.png b/typing-break/bar-green.png
deleted file mode 100644
index f1755b303..000000000
--- a/typing-break/bar-green.png
+++ /dev/null
Binary files differ
diff --git a/typing-break/bar-red.png b/typing-break/bar-red.png
deleted file mode 100644
index 06118d14b..000000000
--- a/typing-break/bar-red.png
+++ /dev/null
Binary files differ
diff --git a/typing-break/bar.png b/typing-break/bar.png
deleted file mode 100644
index 5587fe65b..000000000
--- a/typing-break/bar.png
+++ /dev/null
Binary files differ
diff --git a/typing-break/drw-break-window.c b/typing-break/drw-break-window.c
deleted file mode 100644
index 1f7b5db38..000000000
--- a/typing-break/drw-break-window.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 CodeFactory AB
- * Copyright (C) 2002-2003 Richard Hult <richard@imendio.com>
-
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <math.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gconf/gconf-client.h>
-#include <libgnome/gnome-i18n.h>
-#include "drwright.h"
-#include "drw-utils.h"
-#include "drw-break-window.h"
-
-struct _DrwBreakWindowPriv {
- GtkWidget *clock_label;
- GtkWidget *break_label;
- GtkWidget *image;
-
- GtkWidget *postpone_entry;
- GtkWidget *postpone_button;
-
- GTimer *timer;
-
- gint break_time;
-
- gchar *break_text;
- guint clock_timeout_id;
- guint postpone_timeout_id;
-};
-
-#define POSTPONE_CANCEL 30*1000
-
-/* Signals */
-enum {
- DONE,
- POSTPONE,
- LAST_SIGNAL
-};
-
-static void drw_break_window_class_init (DrwBreakWindowClass *klass);
-static void drw_break_window_init (DrwBreakWindow *window);
-static void drw_break_window_finalize (GObject *object);
-static void drw_break_window_dispose (GObject *object);
-static gboolean clock_timeout_cb (DrwBreakWindow *window);
-static void postpone_clicked_cb (GtkWidget *button,
- GtkWidget *window);
-static gboolean label_expose_event_cb (GtkLabel *label,
- GdkEventExpose *event,
- gpointer user_data);
-static void label_size_request_cb (GtkLabel *label,
- GtkRequisition *requisition,
- gpointer user_data);
-
-
-static GObjectClass *parent_class;
-static guint signals[LAST_SIGNAL];
-
-GType
-drw_break_window_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- static const GTypeInfo object_info = {
- sizeof (DrwBreakWindowClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) drw_break_window_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (DrwBreakWindow),
- 0, /* n_preallocs */
- (GInstanceInitFunc) drw_break_window_init,
- };
-
- object_type = g_type_register_static (GTK_TYPE_WINDOW,
- "DrwBreakWindow",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-static void
-drw_break_window_class_init (DrwBreakWindowClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
- object_class->finalize = drw_break_window_finalize;
- object_class->dispose = drw_break_window_dispose;
-
- signals[POSTPONE] =
- g_signal_new ("postpone",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[DONE] =
- g_signal_new ("done",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-drw_break_window_init (DrwBreakWindow *window)
-{
- DrwBreakWindowPriv *priv;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *frame;
- GtkWidget *align;
- gchar *str;
- GtkWidget *outer_vbox;
- GtkWidget *button_box;
- gboolean allow_postpone;
-
- priv = g_new0 (DrwBreakWindowPriv, 1);
- window->priv = priv;
-
- priv->break_time = 60 * gconf_client_get_int (gconf_client_get_default (),
- GCONF_PATH "/break_time",
- NULL);
-
- allow_postpone = gconf_client_get_bool (gconf_client_get_default (),
- GCONF_PATH "/allow_postpone",
- NULL);
-
- GTK_WINDOW (window)->type = GTK_WINDOW_POPUP;
-
- gtk_window_set_default_size (GTK_WINDOW (window),
- gdk_screen_width (),
- gdk_screen_height ());
-
- gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
- gtk_widget_realize (GTK_WIDGET (window));
-
- drw_setup_background (GTK_WIDGET (window));
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- gtk_widget_show (frame);
-
- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- gtk_widget_show (align);
-
- outer_vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (outer_vbox);
-
- gtk_container_add (GTK_CONTAINER (window), outer_vbox);
-
- gtk_box_pack_start (GTK_BOX (outer_vbox), align, TRUE, TRUE, 0);
-
- if (allow_postpone) {
- button_box = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (button_box);
-
- gtk_container_set_border_width (GTK_CONTAINER (button_box), 12);
-
- priv->postpone_button = gtk_button_new_with_label (_("Postpone break"));
- gtk_widget_show (priv->postpone_button);
-
- g_signal_connect (priv->postpone_button,
- "clicked",
- G_CALLBACK (postpone_clicked_cb),
- window);
-
- gtk_box_pack_end (GTK_BOX (button_box), priv->postpone_button, FALSE, TRUE, 0);
-
- priv->postpone_entry = gtk_entry_new ();
- gtk_entry_set_has_frame (GTK_ENTRY (priv->postpone_entry), FALSE);
-
- gtk_box_pack_end (GTK_BOX (button_box), priv->postpone_entry, FALSE, TRUE, 4);
-
- gtk_box_pack_end (GTK_BOX (outer_vbox), button_box, FALSE, TRUE, 0);
- }
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (vbox);
-
- gtk_container_add (GTK_CONTAINER (align), frame);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- priv->break_label = gtk_label_new (NULL);
- gtk_widget_show (priv->break_label);
-
- g_signal_connect (priv->break_label,
- "expose_event",
- G_CALLBACK (label_expose_event_cb),
- NULL);
-
- g_signal_connect_after (priv->break_label,
- "size_request",
- G_CALLBACK (label_size_request_cb),
- NULL);
-
- str = g_strdup_printf ("<span size=\"xx-large\" foreground=\"white\"><b>%s</b></span>",
- _("Take a break!"));
- gtk_label_set_markup (GTK_LABEL (priv->break_label), str);
- g_free (str);
-
- gtk_box_pack_start (GTK_BOX (vbox), priv->break_label, FALSE, FALSE, 12);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (hbox);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
-
- priv->image = gtk_image_new_from_file (IMAGEDIR "/stop.png");
- gtk_misc_set_alignment (GTK_MISC (priv->image), 1, 0.5);
- gtk_widget_show (priv->image);
- gtk_box_pack_start (GTK_BOX (hbox), priv->image, TRUE, TRUE, 8);
-
- priv->clock_label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (priv->clock_label), 0, 0.5);
- gtk_widget_show (priv->clock_label);
- gtk_box_pack_start (GTK_BOX (hbox), priv->clock_label, TRUE, TRUE, 8);
-
- g_signal_connect (priv->clock_label,
- "expose_event",
- G_CALLBACK (label_expose_event_cb),
- NULL);
-
- g_signal_connect_after (priv->clock_label,
- "size_request",
- G_CALLBACK (label_size_request_cb),
- NULL);
-
- gtk_window_stick (GTK_WINDOW (window));
-
- priv->timer = g_timer_new ();
-
- /* Make sure we have a valid time label from the start. */
- clock_timeout_cb (window);
-
- priv->clock_timeout_id = g_timeout_add (1000,
- (GSourceFunc) clock_timeout_cb,
- window);
-}
-
-static void
-drw_break_window_finalize (GObject *object)
-{
- DrwBreakWindow *window = DRW_BREAK_WINDOW (object);
- DrwBreakWindowPriv *priv;
-
- priv = window->priv;
-
- if (priv->clock_timeout_id != 0) {
- g_source_remove (priv->clock_timeout_id);
- }
-
- if (priv->postpone_timeout_id != 0) {
- g_source_remove (priv->postpone_timeout_id);
- }
-
- g_free (priv);
- window->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize) {
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
- }
-}
-
-static void
-drw_break_window_dispose (GObject *object)
-{
- DrwBreakWindow *window = DRW_BREAK_WINDOW (object);
- DrwBreakWindowPriv *priv;
-
- priv = window->priv;
-
- if (priv->clock_timeout_id != 0) {
- g_source_remove (priv->clock_timeout_id);
- priv->clock_timeout_id = 0;
- }
-
- if (priv->postpone_timeout_id != 0) {
- g_source_remove (priv->postpone_timeout_id);
- priv->postpone_timeout_id = 0;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose) {
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
- }
-}
-
-GtkWidget *
-drw_break_window_new (void)
-{
- return g_object_new (DRW_TYPE_BREAK_WINDOW, NULL);
-}
-
-static gboolean
-clock_timeout_cb (DrwBreakWindow *window)
-{
- DrwBreakWindowPriv *priv;
- gchar *txt;
- gint minutes;
- gint seconds;
-
- g_return_val_if_fail (DRW_IS_BREAK_WINDOW (window), FALSE);
-
- priv = window->priv;
-
- seconds = 1 + priv->break_time - g_timer_elapsed (priv->timer, NULL);
- seconds = MAX (0, seconds);
-
- if (seconds == 0) {
- /* Zero this out so the finalizer doesn't try to remove the
- * source, which would be done in the timeout callback ==
- * no-no.
- */
- priv->clock_timeout_id = 0;
-
- g_signal_emit (window, signals[DONE], 0, NULL);
- //gtk_widget_destroy (GTK_WIDGET (window));
-
- return FALSE;
- }
-
- minutes = seconds / 60;
- seconds -= minutes * 60;
-
- txt = g_strdup_printf ("<span size=\"25000\" foreground=\"white\"><b>%d:%02d</b></span>",
- minutes,
- seconds);
- gtk_label_set_markup (GTK_LABEL (priv->clock_label), txt);
- g_free (txt);
-
- return TRUE;
-}
-
-static void
-postpone_entry_activate_cb (GtkWidget *entry,
- DrwBreakWindow *window)
-{
- const gchar *str;
- const gchar *phrase;
-
- str = gtk_entry_get_text (GTK_ENTRY (entry));
-
- phrase = gconf_client_get_string (gconf_client_get_default (),
- GCONF_PATH "/unlock_phrase",
- NULL);
-
- if (!strcmp (str, phrase)) {
- g_signal_emit (window, signals[POSTPONE], 0, NULL);
- return;
- }
-
- gtk_entry_set_text (GTK_ENTRY (entry), "");
-}
-
-static gboolean
-grab_on_window (GdkWindow *window,
- guint32 activate_time)
-{
- if ((gdk_pointer_grab (window, TRUE,
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK,
- NULL, NULL, activate_time) == 0)) {
- if (gdk_keyboard_grab (window, TRUE,
- activate_time) == 0)
- return TRUE;
- else {
- gdk_pointer_ungrab (activate_time);
- return FALSE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-postpone_cancel_cb (DrwBreakWindow *window)
-{
- DrwBreakWindowPriv *priv;
-
- priv = window->priv;
-
- gtk_entry_set_text (GTK_ENTRY (priv->postpone_entry), "");
- gtk_widget_hide (priv->postpone_entry);
-
- priv->postpone_timeout_id = 0;
-
- return FALSE;
-}
-
-static gboolean
-postpone_entry_key_press_event_cb (GtkEntry *entry,
- GdkEventKey *event,
- DrwBreakWindow *window)
-{
- DrwBreakWindowPriv *priv;
-
- priv = window->priv;
-
- if (event->keyval == GDK_Escape) {
- if (priv->postpone_timeout_id) {
- g_source_remove (priv->postpone_timeout_id);
- }
-
- postpone_cancel_cb (window);
-
- return TRUE;
- }
-
- g_source_remove (priv->postpone_timeout_id);
-
- priv->postpone_timeout_id = g_timeout_add (POSTPONE_CANCEL, (GSourceFunc) postpone_cancel_cb, window);
-
- return FALSE;
-}
-
-static void
-postpone_clicked_cb (GtkWidget *button,
- GtkWidget *window)
-{
- DrwBreakWindow *bw = DRW_BREAK_WINDOW (window);
- DrwBreakWindowPriv *priv = bw->priv;
- gchar *phrase;
-
- /* Disable the phrase for now. */
- phrase = NULL; /*gconf_client_get_string (gconf_client_get_default (),
- GCONF_PATH "/unlock_phrase",
- NULL);*/
-
- if (!phrase || !phrase[0]) {
- g_signal_emit (window, signals[POSTPONE], 0, NULL);
- return;
- }
-
- if (GTK_WIDGET_VISIBLE (priv->postpone_entry)) {
- gtk_widget_activate (priv->postpone_entry);
- return;
- }
-
- gtk_widget_show (priv->postpone_entry);
-
- priv->postpone_timeout_id = g_timeout_add (POSTPONE_CANCEL, (GSourceFunc) postpone_cancel_cb, bw);
-
- grab_on_window (priv->postpone_entry->window, gtk_get_current_event_time ());
-
- gtk_widget_grab_focus (priv->postpone_entry);
-
- g_signal_connect (priv->postpone_entry,
- "activate",
- G_CALLBACK (postpone_entry_activate_cb),
- bw);
-
- g_signal_connect (priv->postpone_entry,
- "key_press_event",
- G_CALLBACK (postpone_entry_key_press_event_cb),
- bw);
-}
-
-static void
-get_layout_location (GtkLabel *label,
- gint *xp,
- gint *yp)
-{
- GtkMisc *misc;
- GtkWidget *widget;
- gfloat xalign;
- gint x, y;
-
- misc = GTK_MISC (label);
- widget = GTK_WIDGET (label);
-
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) {
- xalign = misc->xalign;
- } else {
- xalign = 1.0 - misc->xalign;
- }
-
- x = floor (widget->allocation.x + (int)misc->xpad
- + ((widget->allocation.width - widget->requisition.width - 1) * xalign)
- + 0.5);
-
- y = floor (widget->allocation.y + (int)misc->ypad
- + ((widget->allocation.height - widget->requisition.height - 1) * misc->yalign)
- + 0.5);
-
- if (xp) {
- *xp = x;
- }
-
- if (yp) {
- *yp = y;
- }
-}
-
-static gboolean
-label_expose_event_cb (GtkLabel *label,
- GdkEventExpose *event,
- gpointer user_data)
-{
- gint x, y;
- GdkColor color;
- GtkWidget *widget;
- GdkGC *gc;
-
- color.red = 0;
- color.green = 0;
- color.blue = 0;
- color.pixel = 0;
-
- get_layout_location (label, &x, &y);
-
- widget = GTK_WIDGET (label);
- gc = gdk_gc_new (widget->window);
- gdk_gc_set_rgb_fg_color (gc, &color);
- gdk_gc_set_clip_rectangle (gc, &event->area);
-
- gdk_draw_layout_with_colors (widget->window,
- gc,
- x + 1,
- y + 1,
- label->layout,
- &color,
- NULL);
- g_object_unref (gc);
-
- gtk_paint_layout (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
- FALSE,
- &event->area,
- widget,
- "label",
- x, y,
- label->layout);
-
- return TRUE;
-}
-
-static void
-label_size_request_cb (GtkLabel *label,
- GtkRequisition *requisition,
- gpointer user_data)
-{
- requisition->width += 1;
- requisition->height += 1;
-}
diff --git a/typing-break/drw-break-window.h b/typing-break/drw-break-window.h
deleted file mode 100644
index d3c19718d..000000000
--- a/typing-break/drw-break-window.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 CodeFactory AB
- * Copyright (C) 2002 Richard Hult <richard@imendio.com>
- *
- * 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 __DRW_BREAK_WINDOW_H__
-#define __DRW_BREAK_WINDOW_H__
-
-#include <gtk/gtkwindow.h>
-
-#define DRW_TYPE_BREAK_WINDOW (drw_break_window_get_type ())
-#define DRW_BREAK_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DRW_TYPE_BREAK_WINDOW, DrwBreakWindow))
-#define DRW_BREAK_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DRW_TYPE_BREAK_WINDOW, DrwBreakWindowClass))
-#define DRW_IS_BREAK_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DRW_TYPE_BREAK_WINDOW))
-#define DRW_IS_BREAK_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DRW_TYPE_BREAK_WINDOW))
-#define DRW_BREAK_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DRW_TYPE_BREAK_WINDOW, DrwBreakWindowClass))
-
-typedef struct _DrwBreakWindow DrwBreakWindow;
-typedef struct _DrwBreakWindowClass DrwBreakWindowClass;
-typedef struct _DrwBreakWindowPriv DrwBreakWindowPriv;
-
-struct _DrwBreakWindow {
- GtkWindow parent;
-
- DrwBreakWindowPriv *priv;
-};
-
-struct _DrwBreakWindowClass {
- GtkWindowClass parent_class;
-};
-
-GType drw_break_window_get_type (void) G_GNUC_CONST;
-GtkWidget * drw_break_window_new (void);
-
-
-#endif /* __DRW_BREAK_WINDOW_H__ */
diff --git a/typing-break/drw-monitor.c b/typing-break/drw-monitor.c
deleted file mode 100644
index 7985b5ad3..000000000
--- a/typing-break/drw-monitor.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 CodeFactory AB
- * Copyright (C) 2002 Richard Hult <richard@imendio.com>
- *
- * 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.
- */
-
-#include <config.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtkinvisible.h>
-#include <math.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/scrnsaver.h>
-#include "drw-monitor.h"
-
-struct _DrwMonitorPriv {
- XScreenSaverInfo *ss_info;
- guint timeout_id;
- unsigned long last_idle;
-};
-
-/* Signals */
-enum {
- ACTIVITY,
- LAST_SIGNAL
-};
-
-
-static void drw_monitor_class_init (DrwMonitorClass *klass);
-static void drw_monitor_init (DrwMonitor *monitor);
-static void drw_monitor_finalize (GObject *object);
-static gboolean drw_monitor_setup (DrwMonitor *monitor);
-
-static GObjectClass *parent_class;
-static guint signals[LAST_SIGNAL];
-
-
-GType
-drw_monitor_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- static const GTypeInfo object_info = {
- sizeof (DrwMonitorClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) drw_monitor_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (DrwMonitor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) drw_monitor_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "DrwMonitor",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-drw_monitor_class_init (DrwMonitorClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
- object_class->finalize = drw_monitor_finalize;
-
- signals[ACTIVITY] =
- g_signal_new ("activity",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-drw_monitor_init (DrwMonitor *monitor)
-{
- DrwMonitorPriv *priv;
-
- priv = g_new0 (DrwMonitorPriv, 1);
- monitor->priv = priv;
-
- drw_monitor_setup (monitor);
-}
-
-static void
-drw_monitor_finalize (GObject *object)
-{
- DrwMonitor *monitor = DRW_MONITOR (object);
- DrwMonitorPriv *priv;
-
- priv = monitor->priv;
-
- g_source_remove (priv->timeout_id);
- priv->timeout_id = 0;
-
- if (priv->ss_info) {
- XFree (priv->ss_info);
- }
-
- g_free (priv);
- monitor->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize) {
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
- }
-}
-
-static gboolean
-drw_monitor_timeout (DrwMonitor *monitor)
-{
- DrwMonitorPriv *priv;
-
- priv = monitor->priv;
-
- if (XScreenSaverQueryInfo (GDK_DISPLAY (), DefaultRootWindow (GDK_DISPLAY ()), priv->ss_info) != 0) {
- if (priv->ss_info->idle < priv->last_idle) {
- g_signal_emit (monitor, signals[ACTIVITY], 0, NULL);
- }
-
- priv->last_idle = priv->ss_info->idle;
- }
-
- return TRUE;
-}
-
-static gboolean
-drw_monitor_setup (DrwMonitor *monitor)
-{
- DrwMonitorPriv *priv;
- int event_base;
- int error_base;
-
- priv = monitor->priv;
-
- if (!XScreenSaverQueryExtension (GDK_DISPLAY (), &event_base, &error_base)) {
- return FALSE;
- }
-
- priv->ss_info = XScreenSaverAllocInfo ();
-
- priv->timeout_id = g_timeout_add (3000, (GSourceFunc) drw_monitor_timeout, monitor);
-
- return TRUE;
-}
-
-DrwMonitor *
-drw_monitor_new (void)
-{
- return g_object_new (DRW_TYPE_MONITOR, NULL);
-}
-
diff --git a/typing-break/drw-monitor.h b/typing-break/drw-monitor.h
deleted file mode 100644
index 3b5ef6774..000000000
--- a/typing-break/drw-monitor.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 CodeFactory AB
- * Copyright (C) 2002 Richard Hult <richard@imendi.com>
- *
- * 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 __DRW_MONITOR_H__
-#define __DRW_MONITOR_H__
-
-#include <glib-object.h>
-
-#define DRW_TYPE_MONITOR (drw_monitor_get_type ())
-#define DRW_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DRW_TYPE_MONITOR, DrwMonitor))
-#define DRW_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DRW_TYPE_MONITOR, DrwMonitorClass))
-#define DRW_IS_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DRW_TYPE_MONITOR))
-#define DRW_IS_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DRW_TYPE_MONITOR))
-#define DRW_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DRW_TYPE_MONITOR, DrwMonitorClass))
-
-typedef struct _DrwMonitor DrwMonitor;
-typedef struct _DrwMonitorClass DrwMonitorClass;
-typedef struct _DrwMonitorPriv DrwMonitorPriv;
-
-struct _DrwMonitor {
- GObject parent;
-
- DrwMonitorPriv *priv;
-};
-
-struct _DrwMonitorClass {
- GObjectClass parent_class;
-};
-
-GType drw_monitor_get_type (void) G_GNUC_CONST;
-DrwMonitor *drw_monitor_new (void);
-
-#endif /* __DRW_MONITOR_H__ */
diff --git a/typing-break/drw-selection.c b/typing-break/drw-selection.c
deleted file mode 100644
index a0aa23599..000000000
--- a/typing-break/drw-selection.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Copyright © 2002 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Red Hat makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Owen Taylor, Red Hat, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
-#include "drw-selection.h"
-
-struct _DrwSelection
-{
- GdkWindow *owner_window;
- GtkWidget *invisible;
-};
-
-#define SELECTION_NAME "_CODEFACTORY_DRWRIGHT"
-
-static GdkFilterReturn drw_selection_filter (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer data);
-static void drw_selection_negotiate (DrwSelection *drw_selection);
-
-static void
-drw_selection_reset (DrwSelection *drw_selection)
-{
- if (drw_selection->owner_window) {
- gdk_window_remove_filter (drw_selection->owner_window,
- drw_selection_filter, drw_selection);
- gdk_window_unref (drw_selection->owner_window);
- drw_selection->owner_window = NULL;
- }
-
- if (drw_selection->invisible) {
- gtk_widget_destroy (drw_selection->invisible);
- drw_selection->invisible = NULL;
- }
-}
-
-static void
-drw_selection_clear (GtkWidget *widget,
- GdkEventSelection *event,
- gpointer user_data)
-{
- DrwSelection *drw_selection = user_data;
-
- drw_selection_reset (drw_selection);
- drw_selection_negotiate (drw_selection);
-}
-
-static gboolean
-drw_selection_find_existing (DrwSelection *drw_selection)
-{
- Display *xdisplay = GDK_DISPLAY ();
- Window old;
-
- gdk_error_trap_push ();
- old = XGetSelectionOwner (xdisplay,
- gdk_x11_get_xatom_by_name (SELECTION_NAME));
- if (old) {
- XSelectInput (xdisplay, old, StructureNotifyMask);
- drw_selection->owner_window = gdk_window_foreign_new (old);
- }
- XSync (xdisplay, False);
-
- if (gdk_error_trap_pop () == 0 && drw_selection->owner_window) {
- gdk_window_add_filter (drw_selection->owner_window,
- drw_selection_filter, drw_selection);
-
- XUngrabServer (xdisplay);
-
- return TRUE;
- } else {
- if (drw_selection->owner_window) {
- gdk_window_unref (drw_selection->owner_window);
- drw_selection->owner_window = NULL;
- }
-
- return FALSE;
- }
-}
-
-static gboolean
-drw_selection_claim (DrwSelection *drw_selection)
-{
- drw_selection->invisible = gtk_invisible_new ();
- g_signal_connect (drw_selection->invisible, "selection-clear-event",
- G_CALLBACK (drw_selection_clear), drw_selection);
-
-
- if (gtk_selection_owner_set (drw_selection->invisible,
- gdk_atom_intern (SELECTION_NAME, FALSE),
- GDK_CURRENT_TIME)) {
- return TRUE;
- } else {
- drw_selection_reset (drw_selection);
- return FALSE;
- }
-}
-
-static void
-drw_selection_negotiate (DrwSelection *drw_selection)
-{
- Display *xdisplay = GDK_DISPLAY ();
- gboolean found = FALSE;
-
- /* We don't need both the XGrabServer() and the loop here;
- * the XGrabServer() should make sure that we only go through
- * the loop once. It also works if you remove the XGrabServer()
- * and just have the loop, but then the selection ownership
- * can get transfered a bunch of times before things
- * settle down.
- */
- while (!found)
- {
- XGrabServer (xdisplay);
-
- if (drw_selection_find_existing (drw_selection))
- found = TRUE;
- else if (drw_selection_claim (drw_selection))
- found = TRUE;
-
- XUngrabServer (xdisplay);
- }
-}
-
-static GdkFilterReturn
-drw_selection_filter (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer data)
-{
- DrwSelection *drw_selection = data;
- XEvent *xev = (XEvent *)xevent;
-
- if (xev->xany.type == DestroyNotify &&
- xev->xdestroywindow.window == xev->xdestroywindow.event)
- {
- drw_selection_reset (drw_selection);
- drw_selection_negotiate (drw_selection);
-
- return GDK_FILTER_REMOVE;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-DrwSelection *
-drw_selection_start ()
-{
- DrwSelection *drw_selection = g_new (DrwSelection, 1);
-
- drw_selection->owner_window = NULL;
- drw_selection->invisible = NULL;
-
- drw_selection_negotiate (drw_selection);
-
- return drw_selection;
-}
-
-void
-drw_selection_stop (DrwSelection *drw_selection)
-{
- drw_selection_reset (drw_selection);
- g_free (drw_selection);
-}
-
-gboolean
-drw_selection_is_master (DrwSelection *drw_selection)
-{
- return drw_selection->invisible != NULL;
-}
diff --git a/typing-break/drw-selection.h b/typing-break/drw-selection.h
deleted file mode 100644
index 54fd779a3..000000000
--- a/typing-break/drw-selection.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Copyright © 2002 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Red Hat makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Owen Taylor, Red Hat, Inc.
- */
-
-#ifndef __DRW_SELECTION_H__
-#define __DRW_SELECTION_H__
-
-typedef struct _DrwSelection DrwSelection;
-
-DrwSelection * drw_selection_start ();
-void drw_selection_stop (DrwSelection *drw_selection);
-gboolean drw_selection_is_master (DrwSelection *drw_selection);
-
-#endif /* __DRW_SELECTION_H__ */
diff --git a/typing-break/drw-utils.c b/typing-break/drw-utils.c
deleted file mode 100644
index 10db6aee7..000000000
--- a/typing-break/drw-utils.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003 Richard Hult <richard@imendio.com>
- *
- * 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.
- */
-
-#include <config.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-#include "drw-utils.h"
-
-static GdkPixbuf *
-create_tile_pixbuf (GdkPixbuf *dest_pixbuf,
- GdkPixbuf *src_pixbuf,
- GdkRectangle *field_geom,
- guint alpha,
- GdkColor *bg_color)
-{
- gboolean need_composite;
- gboolean use_simple;
- gdouble cx, cy;
- gdouble colorv;
- gint pwidth, pheight;
-
- need_composite = (alpha < 255 || gdk_pixbuf_get_has_alpha (src_pixbuf));
- use_simple = (dest_pixbuf == NULL);
-
- if (dest_pixbuf == NULL)
- dest_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE, 8,
- field_geom->width, field_geom->height);
-
- if (need_composite && use_simple)
- colorv = ((bg_color->red & 0xff00) << 8) |
- (bg_color->green & 0xff00) |
- ((bg_color->blue & 0xff00) >> 8);
- else
- colorv = 0;
-
- pwidth = gdk_pixbuf_get_width (src_pixbuf);
- pheight = gdk_pixbuf_get_height (src_pixbuf);
-
- for (cy = 0; cy < field_geom->height; cy += pheight) {
- for (cx = 0; cx < field_geom->width; cx += pwidth) {
- if (need_composite && !use_simple)
- gdk_pixbuf_composite (src_pixbuf, dest_pixbuf,
- cx, cy,
- MIN (pwidth, field_geom->width - cx),
- MIN (pheight, field_geom->height - cy),
- cx, cy,
- 1.0, 1.0,
- GDK_INTERP_BILINEAR,
- alpha);
- else if (need_composite && use_simple)
- gdk_pixbuf_composite_color (src_pixbuf, dest_pixbuf,
- cx, cy,
- MIN (pwidth, field_geom->width - cx),
- MIN (pheight, field_geom->height - cy),
- cx, cy,
- 1.0, 1.0,
- GDK_INTERP_BILINEAR,
- alpha,
- 65536, 65536, 65536,
- colorv, colorv);
- else
- gdk_pixbuf_copy_area (src_pixbuf,
- 0, 0,
- MIN (pwidth, field_geom->width - cx),
- MIN (pheight, field_geom->height - cy),
- dest_pixbuf,
- cx, cy);
- }
- }
-
- return dest_pixbuf;
-}
-
-void
-drw_setup_background (GtkWidget *window)
-{
- GdkScreen *screen;
- GdkPixbuf *tmp_pixbuf, *pixbuf, *tile_pixbuf;
- GdkPixmap *pixmap;
- GdkRectangle rect;
- GdkColor color;
- gint width, height;
-
- screen = gtk_widget_get_screen (window);
-
- width = gdk_screen_get_width (screen);
- height = gdk_screen_get_height (screen);
-
- tmp_pixbuf = gdk_pixbuf_get_from_drawable (NULL,
- gdk_screen_get_root_window (screen),
- gdk_screen_get_system_colormap (screen),
- 0,
- 0,
- 0,
- 0,
- width, height);
-
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/ocean-stripes.png", NULL);
-
- rect.x = 0;
- rect.y = 0;
- rect.width = width;
- rect.height = height;
-
- color.red = 0;
- color.blue = 0;
- color.green = 0;
-
- tile_pixbuf = create_tile_pixbuf (NULL,
- pixbuf,
- &rect,
- 155,
- &color);
-
- g_object_unref (pixbuf);
-
- gdk_pixbuf_composite (tile_pixbuf,
- tmp_pixbuf,
- 0,
- 0,
- width,
- height,
- 0,
- 0,
- 1,
- 1,
- GDK_INTERP_NEAREST,
- 225);
-
- g_object_unref (tile_pixbuf);
-
- pixmap = gdk_pixmap_new (GTK_WIDGET (window)->window,
- width,
- height,
- -1);
-
- gdk_pixbuf_render_to_drawable_alpha (tmp_pixbuf,
- pixmap,
- 0,
- 0,
- 0,
- 0,
- width,
- height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 0,
- GDK_RGB_DITHER_NONE,
- 0,
- 0);
- g_object_unref (tmp_pixbuf);
-
- gdk_window_set_back_pixmap (window->window, pixmap, FALSE);
- g_object_unref (pixmap);
-}
-
diff --git a/typing-break/drw-utils.h b/typing-break/drw-utils.h
deleted file mode 100644
index 968f531fd..000000000
--- a/typing-break/drw-utils.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003 Richard Hult <richard@imendio.com>
- *
- * 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 __DRW_UTILS_H__
-#define __DRW_UTILS_H__
-
-void drw_setup_background (GtkWidget *window);
-
-
-#endif /* __DRW_UTILS_H__ */
diff --git a/typing-break/drwright.c b/typing-break/drwright.c
deleted file mode 100644
index 2c58f6f7d..000000000
--- a/typing-break/drwright.c
+++ /dev/null
@@ -1,970 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 CodeFactory AB
- * Copyright (C) 2002-2003 Richard Hult <richard@imendio.com>
- *
- * 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.
- */
-
-#include <config.h>
-#include <time.h>
-#include <string.h>
-#include <math.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <libgnomeui/gnome-client.h>
-#include <libgnome/gnome-i18n.h>
-#include <gconf/gconf-client.h>
-#include "drwright.h"
-#include "drw-break-window.h"
-#include "drw-monitor.h"
-#include "drw-utils.h"
-#include "eggtrayicon.h"
-#include "egg-spawn.h"
-
-#define BLINK_TIMEOUT 200
-#define BLINK_TIMEOUT_MIN 120
-#define BLINK_TIMEOUT_FACTOR 100
-
-#define POPUP_ITEM_ENABLED 1
-#define POPUP_ITEM_BREAK 2
-
-typedef enum {
- STATE_START,
- STATE_IDLE,
- STATE_TYPE,
- STATE_WARN_TYPE,
- STATE_WARN_IDLE,
- STATE_BREAK_SETUP,
- STATE_BREAK,
- STATE_BREAK_DONE_SETUP,
- STATE_BREAK_DONE
-} DrwState;
-
-struct _DrWright {
- /* Widgets. */
- GtkWidget *break_window;
- GList *secondary_break_windows;
-
- DrwMonitor *monitor;
-
- GtkItemFactory *popup_factory;
-
- DrwState state;
- GTimer *timer;
- GTimer *idle_timer;
-
- gint last_elapsed_time;
-
- gboolean is_active;
-
- /* Time settings. */
- gint type_time;
- gint break_time;
- gint warn_time;
-
- gboolean enabled;
-
- guint clock_timeout_id;
- guint blink_timeout_id;
-
- gboolean blink_on;
-
- EggTrayIcon *icon;
- GtkWidget *icon_image;
- GtkWidget *icon_event_box;
- GtkTooltips *tooltips;
-
- GdkPixbuf *neutral_bar;
- GdkPixbuf *red_bar;
- GdkPixbuf *green_bar;
- GdkPixbuf *disabled_bar;
- GdkPixbuf *composite_bar;
-
- GtkWidget *warn_dialog;
-};
-
-static void activity_detected_cb (DrwMonitor *monitor,
- DrWright *drwright);
-static gboolean maybe_change_state (DrWright *drwright);
-static gboolean update_tooltip (DrWright *drwright);
-static gboolean icon_button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- DrWright *drwright);
-static void break_window_done_cb (GtkWidget *window,
- DrWright *dr);
-static void break_window_postpone_cb (GtkWidget *window,
- DrWright *dr);
-static void break_window_destroy_cb (GtkWidget *window,
- DrWright *dr);
-static void popup_break_cb (gpointer callback_data,
- guint action,
- GtkWidget *widget);
-static void popup_preferences_cb (gpointer callback_data,
- guint action,
- GtkWidget *widget);
-static void popup_about_cb (gpointer callback_data,
- guint action,
- GtkWidget *widget);
-static gchar * item_factory_trans_cb (const gchar *path,
- gpointer data);
-static void init_tray_icon (DrWright *dr);
-static GList * create_secondary_break_windows (void);
-
-
-
-#define GIF_CB(x) ((GtkItemFactoryCallback)(x))
-
-static GtkItemFactoryEntry popup_items[] = {
-/* { N_("/_Enabled"), NULL, GIF_CB (popup_enabled_cb), POPUP_ITEM_ENABLED, "<ToggleItem>", NULL },*/
- { N_("/_Preferences"), NULL, GIF_CB (popup_preferences_cb), 0, "<StockItem>", GTK_STOCK_PREFERENCES },
- { N_("/_About"), NULL, GIF_CB (popup_about_cb), 0, "<StockItem>", GNOME_STOCK_ABOUT },
- { "/sep1", NULL, 0, 0, "<Separator>", NULL },
- { N_("/_Take a Break"), NULL, GIF_CB (popup_break_cb), POPUP_ITEM_BREAK, "<Item>", NULL }
-};
-
-GConfClient *client = NULL;
-extern gboolean debug;
-
-static void
-setup_debug_values (DrWright *dr)
-{
- dr->type_time = 5;
- dr->warn_time = 4;
- dr->break_time = 10;
-}
-
-static void
-update_icon (DrWright *dr)
-{
- GdkPixbuf *pixbuf;
- GdkPixbuf *tmp_pixbuf;
- gint width, height;
- gfloat r;
- gint offset;
- gboolean set_pixbuf;
-
- if (!dr->enabled) {
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->disabled_bar);
- return;
- }
-
- tmp_pixbuf = gdk_pixbuf_copy (dr->neutral_bar);
-
- width = gdk_pixbuf_get_width (tmp_pixbuf);
- height = gdk_pixbuf_get_height (tmp_pixbuf);
-
- set_pixbuf = TRUE;
-
- switch (dr->state) {
- case STATE_BREAK:
- case STATE_BREAK_SETUP:
- r = 1;
- break;
-
- case STATE_BREAK_DONE:
- case STATE_BREAK_DONE_SETUP:
- case STATE_START:
- r = 0;
- break;
-
- case STATE_WARN_IDLE:
- case STATE_WARN_TYPE:
- r = ((float)(dr->type_time - dr->warn_time) / dr->type_time) +
- (float) g_timer_elapsed (dr->timer, NULL) / (float) dr->warn_time;
- break;
-
- default:
- r = (float) g_timer_elapsed (dr->timer, NULL) / (float) dr->type_time;
- break;
- }
-
- offset = CLAMP ((height - 0) * (1.0 - r), 1, height - 0);
-
- switch (dr->state) {
- case STATE_WARN_TYPE:
- case STATE_WARN_IDLE:
- pixbuf = dr->red_bar;
- set_pixbuf = FALSE;
- break;
-
- case STATE_BREAK_SETUP:
- case STATE_BREAK:
- pixbuf = dr->red_bar;
- break;
-
- default:
- pixbuf = dr->green_bar;
- }
-
- gdk_pixbuf_composite (pixbuf,
- tmp_pixbuf,
- 0,
- offset,
- width,
- height - offset,
- 0,
- 0,
- 1.0,
- 1.0,
- GDK_INTERP_BILINEAR,
- 255);
-
- if (set_pixbuf) {
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), tmp_pixbuf);
- }
-
- if (dr->composite_bar) {
- g_object_unref (dr->composite_bar);
- }
-
- dr->composite_bar = tmp_pixbuf;
-}
-
-static gboolean
-blink_timeout_cb (DrWright *dr)
-{
- gfloat r;
- gint timeout;
-
- r = (dr->warn_time - g_timer_elapsed (dr->timer, NULL)) / dr->warn_time;
- timeout = BLINK_TIMEOUT + BLINK_TIMEOUT_FACTOR * r;
-
- if (timeout < BLINK_TIMEOUT_MIN) {
- timeout = BLINK_TIMEOUT_MIN;
- }
-
- if (dr->blink_on || timeout == 0) {
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->composite_bar);
- } else {
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->neutral_bar);
- }
-
- dr->blink_on = !dr->blink_on;
-
- if (timeout) {
- dr->blink_timeout_id = g_timeout_add (timeout,
- (GSourceFunc) blink_timeout_cb,
- dr);
- } else {
- dr->blink_timeout_id = 0;
- }
-
- return FALSE;
-}
-
-static void
-start_blinking (DrWright *dr)
-{
- if (!dr->blink_timeout_id) {
- dr->blink_on = TRUE;
- blink_timeout_cb (dr);
- }
-
- /*gtk_widget_show (GTK_WIDGET (dr->icon));*/
-}
-
-static void
-stop_blinking (DrWright *dr)
-{
- if (dr->blink_timeout_id) {
- g_source_remove (dr->blink_timeout_id);
- dr->blink_timeout_id = 0;
- }
-
- /*gtk_widget_hide (GTK_WIDGET (dr->icon));*/
-}
-
-static gboolean
-maybe_change_state (DrWright *dr)
-{
- gint elapsed_time;
- gint elapsed_idle_time;
-
- if (debug) {
- g_timer_reset (dr->idle_timer);
- }
-
- elapsed_time = g_timer_elapsed (dr->timer, NULL);
- elapsed_idle_time = g_timer_elapsed (dr->idle_timer, NULL);
-
- if (elapsed_time > dr->last_elapsed_time + dr->warn_time) {
- /* If the timeout is delayed by the amount of warning time, then
- * we must have been suspended or stopped, so we just start
- * over.
- */
- dr->state = STATE_START;
- }
-
- switch (dr->state) {
- case STATE_START:
- if (dr->break_window) {
- gtk_widget_destroy (dr->break_window);
- dr->break_window = NULL;
- }
-
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->neutral_bar);
-
- g_timer_start (dr->timer);
- g_timer_start (dr->idle_timer);
-
- if (dr->enabled) {
- dr->state = STATE_IDLE;
- }
-
- update_tooltip (dr);
- stop_blinking (dr);
- break;
-
- case STATE_IDLE:
- if (elapsed_idle_time >= dr->break_time) {
- g_timer_start (dr->timer);
- g_timer_start (dr->idle_timer);
- } else if (dr->is_active) {
- dr->state = STATE_TYPE;
- }
- break;
-
- case STATE_TYPE:
- if (elapsed_time >= dr->type_time - dr->warn_time) {
- dr->state = STATE_WARN_TYPE;
- g_timer_start (dr->timer);
-
- start_blinking (dr);
- } else if (elapsed_time >= dr->type_time) {
- dr->state = STATE_BREAK_SETUP;
- }
- else if (!dr->is_active) {
- dr->state = STATE_IDLE;
- g_timer_start (dr->idle_timer);
- }
- break;
-
- case STATE_WARN_TYPE:
- if (elapsed_time >= dr->warn_time) {
- dr->state = STATE_BREAK_SETUP;
- }
- else if (!dr->is_active) {
- dr->state = STATE_WARN_IDLE;
- }
- break;
-
- case STATE_WARN_IDLE:
- if (elapsed_idle_time >= dr->break_time) {
- dr->state = STATE_BREAK_DONE_SETUP;
- }
- else if (dr->is_active) {
- dr->state = STATE_WARN_TYPE;
- }
-
- break;
-
- case STATE_BREAK_SETUP:
- stop_blinking (dr);
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->red_bar);
-
- g_timer_start (dr->timer);
-
- dr->break_window = drw_break_window_new ();
-
- g_signal_connect (dr->break_window,
- "done",
- G_CALLBACK (break_window_done_cb),
- dr);
-
- g_signal_connect (dr->break_window,
- "postpone",
- G_CALLBACK (break_window_postpone_cb),
- dr);
-
- g_signal_connect (dr->break_window,
- "destroy",
- G_CALLBACK (break_window_destroy_cb),
- dr);
-
- dr->secondary_break_windows = create_secondary_break_windows ();
-
- gtk_widget_show (dr->break_window);
-
- dr->state = STATE_BREAK;
- break;
-
- case STATE_BREAK:
- if (elapsed_time >= dr->break_time) {
- dr->state = STATE_BREAK_DONE_SETUP;
- }
- break;
-
- case STATE_BREAK_DONE_SETUP:
- stop_blinking (dr);
- gtk_image_set_from_pixbuf (GTK_IMAGE (dr->icon_image), dr->green_bar);
-
- dr->state = STATE_BREAK_DONE;
- break;
-
- case STATE_BREAK_DONE:
- if (dr->is_active) {
- dr->state = STATE_START;
- if (dr->break_window) {
- gtk_widget_destroy (dr->break_window);
- dr->break_window = NULL;
- }
- }
- break;
- }
-
- dr->is_active = FALSE;
- dr->last_elapsed_time = elapsed_time;
-
- update_icon (dr);
-
- return TRUE;
-}
-
-static gboolean
-update_tooltip (DrWright *dr)
-{
- gint elapsed_time, min;
- gchar *str;
-
- if (!dr->enabled) {
- gtk_tooltips_set_tip (GTK_TOOLTIPS (dr->tooltips),
- dr->icon_event_box,
- _("Disabled"), _("Disabled"));
- return TRUE;
- }
-
- elapsed_time = g_timer_elapsed (dr->timer, NULL);
-
- switch (dr->state) {
- case STATE_WARN_TYPE:
- case STATE_WARN_IDLE:
- min = floor (0.5 + (dr->warn_time - elapsed_time) / 60.0);
- break;
-
- default:
- min = floor (0.5 + (dr->type_time - elapsed_time) / 60.0);
- break;
- }
-
- if (min >= 1) {
- str = g_strdup_printf (ngettext("%d minute until the next break",
- "%d minutes until the next break",
- min), min);
- } else {
- str = g_strdup_printf (_("Less than one minute until the next break"));
- }
-
- gtk_tooltips_set_tip (GTK_TOOLTIPS (dr->tooltips),
- dr->icon_event_box,
- str, str);
-
- g_free (str);
-
- return TRUE;
-}
-
-static void
-activity_detected_cb (DrwMonitor *monitor,
- DrWright *dr)
-{
- dr->is_active = TRUE;
- g_timer_start (dr->idle_timer);
-}
-
-static void
-gconf_notify_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- DrWright *dr = user_data;
- GtkWidget *item;
-
- if (!strcmp (entry->key, GCONF_PATH "/type_time")) {
- if (entry->value->type == GCONF_VALUE_INT) {
- dr->type_time = 60 * gconf_value_get_int (entry->value);
- dr->warn_time = MIN (dr->type_time / 10, 5*60);
-
- dr->state = STATE_START;
- }
- }
-/* else if (!strcmp (entry->key, GCONF_PATH "/warn_time")) {
- if (entry->value->type == GCONF_VALUE_INT) {
- dr->warn_time = 60 * gconf_value_get_int (entry->value);
- dr->state = STATE_START;
- }
- }
-*/
- else if (!strcmp (entry->key, GCONF_PATH "/break_time")) {
- if (entry->value->type == GCONF_VALUE_INT) {
- dr->break_time = 60 * gconf_value_get_int (entry->value);
- dr->state = STATE_START;
- }
- }
- else if (!strcmp (entry->key, GCONF_PATH "/enabled")) {
- if (entry->value->type == GCONF_VALUE_BOOL) {
- dr->enabled = gconf_value_get_bool (entry->value);
- dr->state = STATE_START;
-
- item = gtk_item_factory_get_widget_by_action (dr->popup_factory,
- POPUP_ITEM_BREAK);
- gtk_widget_set_sensitive (item, dr->enabled);
-
- update_tooltip (dr);
- }
- }
-
- maybe_change_state (dr);
-}
-
-static void
-popup_break_cb (gpointer callback_data,
- guint action,
- GtkWidget *widget)
-{
- DrWright *dr = callback_data;
-
- if (dr->enabled) {
- dr->state = STATE_BREAK_SETUP;
- maybe_change_state (dr);
- }
-}
-
-static void
-popup_preferences_cb (gpointer callback_data,
- guint action,
- GtkWidget *widget)
-{
- GdkScreen *screen;
- GError *error = NULL;
-
- screen = gtk_widget_get_screen (widget);
-
- if (!egg_spawn_command_line_async_on_screen ("gnome-keyboard-properties --typing-break", screen, &error)) {
- GtkWidget *error_dialog;
-
- error_dialog = gtk_message_dialog_new (NULL, 0,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Unable to bring up the typing break properties dialog with the following error: %s"),
- error->message);
- g_signal_connect (error_dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_window_set_resizable (GTK_WINDOW (error_dialog), FALSE);
- gtk_widget_show (error_dialog);
-
- g_error_free (error);
- }
-}
-
-static void
-popup_about_cb (gpointer callback_data,
- guint action,
- GtkWidget *widget)
-{
- static GtkWidget *about_window;
- GtkWidget *vbox;
- GtkWidget *label;
- GdkPixbuf *icon;
- gchar *markup;
-
- if (about_window) {
- gtk_window_present (GTK_WINDOW (about_window));
- return;
- }
-
- about_window = gtk_dialog_new ();
-
- g_signal_connect (about_window,
- "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &about_window);
-
- gtk_dialog_add_button (GTK_DIALOG (about_window),
- GTK_STOCK_OK, GTK_RESPONSE_OK);
- gtk_dialog_set_default_response (GTK_DIALOG (about_window),
- GTK_RESPONSE_OK);
-
- gtk_window_set_title (GTK_WINDOW (about_window), _("About GNOME Typing Monitor"));
- icon = NULL; /*gdk_pixbuf_new_from_file (IMAGEDIR "/bar.png", NULL);*/
- if (icon != NULL) {
- gtk_window_set_icon (GTK_WINDOW (about_window), icon);
- g_object_unref (icon);
- }
-
- gtk_window_set_resizable (GTK_WINDOW (about_window), FALSE);
- gtk_window_set_position (GTK_WINDOW (about_window),
- GTK_WIN_POS_CENTER_ON_PARENT);
- gtk_window_set_type_hint (GTK_WINDOW (about_window),
- GDK_WINDOW_TYPE_HINT_DIALOG);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_window)->vbox), vbox, FALSE, FALSE, 0);
-
- label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
- markup = g_strdup_printf ("<span size=\"xx-large\" weight=\"bold\">Typing Monitor " VERSION "</span>\n\n"
- "%s\n\n"
- "<span size=\"small\">%s</span>\n"
- "<span size=\"small\">%s</span>\n",
- _("A computer break reminder."),
- _("Written by Richard Hult &lt;richard@imendio.com&gt;"),
- _("Eye candy added by Anders Carlsson"));
- gtk_label_set_markup (GTK_LABEL (label), markup);
- g_free (markup);
- gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
-
- gtk_widget_show_all (about_window);
- gtk_dialog_run (GTK_DIALOG (about_window));
- gtk_widget_destroy (about_window);
-}
-
-static void
-popup_menu_position_cb (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer data)
-{
- GtkWidget *w = data;
- GtkRequisition requisition;
- gint wx, wy;
-
- g_return_if_fail (w != NULL);
-
- gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
-
- gdk_window_get_origin (w->window, &wx, &wy);
-
- if (*x < wx)
- *x = wx;
- else if (*x > wx + w->allocation.width)
- *x = wx + w->allocation.width;
-
- if (*x + requisition.width > gdk_screen_width())
- *x = gdk_screen_width() - requisition.width;
-
- if (*y < wy)
- *y = wy;
- else if (*y > wy + w->allocation.height)
- *y = wy + w->allocation.height;
-
- if (*y + requisition.height > gdk_screen_height())
- *y = gdk_screen_height() - requisition.height;
-
- *push_in = TRUE;
-}
-
-static gboolean
-icon_button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- DrWright *dr)
-{
- GtkWidget *menu;
-
- if (event->button == 3) {
- menu = gtk_item_factory_get_widget (dr->popup_factory, "");
-
- gtk_menu_popup (GTK_MENU (menu),
- NULL,
- NULL,
- popup_menu_position_cb,
- dr->icon,
- event->button,
- event->time);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-popup_menu_cb (GtkWidget *widget,
- DrWright *dr)
-{
- GtkWidget *menu;
-
- menu = gtk_item_factory_get_widget (dr->popup_factory, "");
-
- gtk_menu_popup (GTK_MENU (menu),
- NULL,
- NULL,
- popup_menu_position_cb,
- dr->icon,
- 0,
- gtk_get_current_event_time());
-}
-
-static void
-break_window_done_cb (GtkWidget *window,
- DrWright *dr)
-{
- gtk_widget_destroy (dr->break_window);
-
- dr->state = STATE_BREAK_DONE_SETUP;
- dr->break_window = NULL;
-
- maybe_change_state (dr);
-}
-
-static void
-break_window_postpone_cb (GtkWidget *window,
- DrWright *dr)
-{
- gtk_widget_destroy (dr->break_window);
-
- dr->state = STATE_WARN_TYPE;
- dr->break_window = NULL;
-
- g_timer_start (dr->timer);
- start_blinking (dr);
- update_icon (dr);
- update_tooltip (dr);
-}
-
-static void
-break_window_destroy_cb (GtkWidget *window,
- DrWright *dr)
-{
- GList *l;
-
- for (l = dr->secondary_break_windows; l; l = l->next) {
- gtk_widget_destroy (l->data);
- }
-
- g_list_free (dr->secondary_break_windows);
- dr->secondary_break_windows = NULL;
-}
-
-static char *
-item_factory_trans_cb (const gchar *path,
- gpointer data)
-{
- return _((gchar*) path);
-}
-
-static void
-icon_event_box_destroy_cb (GtkWidget *widget,
- DrWright *dr)
-{
- gtk_widget_destroy (GTK_WIDGET (dr->icon));
- init_tray_icon (dr);
-}
-
-static gboolean
-icon_event_box_expose_event_cb (GtkWidget *widget,
- GdkEventExpose *event,
- DrWright *dr)
-{
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
- gint focus_width, focus_pad;
- gint x, y, width, height;
-
- gtk_widget_style_get (widget,
- "focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
- NULL);
- x = widget->allocation.x + focus_pad;
- y = widget->allocation.y + focus_pad;
- width = widget->allocation.width - 2 * focus_pad;
- height = widget->allocation.height - 2 * focus_pad;
-
- gtk_paint_focus (widget->style, widget->window,
- GTK_WIDGET_STATE (widget),
- &event->area, widget, "button",
- x, y, width, height);
- }
-
- return FALSE;
-}
-
-static void
-init_tray_icon (DrWright *dr)
-{
- dr->icon = egg_tray_icon_new (_("Break reminder"));
-
- dr->icon_event_box = gtk_event_box_new ();
- dr->icon_image = gtk_image_new_from_pixbuf (dr->neutral_bar);
- gtk_container_add (GTK_CONTAINER (dr->icon_event_box), dr->icon_image);
-
- gtk_widget_add_events (GTK_WIDGET (dr->icon), GDK_BUTTON_PRESS_MASK | GDK_FOCUS_CHANGE_MASK);
- gtk_container_add (GTK_CONTAINER (dr->icon), dr->icon_event_box);
- gtk_widget_show_all (GTK_WIDGET (dr->icon));
-
- GTK_WIDGET_SET_FLAGS (dr->icon_event_box, GTK_CAN_FOCUS);
-
- update_tooltip (dr);
- update_icon (dr);
-
- g_signal_connect (dr->icon,
- "button_press_event",
- G_CALLBACK (icon_button_press_cb),
- dr);
-
- g_signal_connect (dr->icon,
- "destroy",
- G_CALLBACK (icon_event_box_destroy_cb),
- dr);
-
- g_signal_connect (dr->icon,
- "popup_menu",
- G_CALLBACK (popup_menu_cb),
- dr);
-
- g_signal_connect_after (dr->icon_event_box,
- "expose_event",
- G_CALLBACK (icon_event_box_expose_event_cb),
- dr);
-}
-
-static GList *
-create_secondary_break_windows (void)
-{
- GdkDisplay *display;
- GdkScreen *screen;
- GtkWidget *window;
- gint i;
- GList *windows = NULL;
-
- display = gdk_display_get_default ();
-
- for (i = 0; i < gdk_display_get_n_screens (display); i++) {
- screen = gdk_display_get_screen (display, i);
-
- if (screen == gdk_screen_get_default ()) {
- /* Handled by DrwBreakWindow. */
- continue;
- }
-
- window = gtk_window_new (GTK_WINDOW_POPUP);
-
- windows = g_list_prepend (windows, window);
-
- gtk_window_set_screen (GTK_WINDOW (window), screen);
-
- gtk_window_set_default_size (GTK_WINDOW (window),
- gdk_screen_get_width (screen),
- gdk_screen_get_height (screen));
-
- gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
- gtk_widget_realize (GTK_WIDGET (window));
-
- drw_setup_background (GTK_WIDGET (window));
- gtk_window_stick (GTK_WINDOW (window));
- gtk_widget_show (window);
- }
-
- return windows;
-}
-
-DrWright *
-drwright_new (void)
-{
- DrWright *dr;
- GtkWidget *item;
-
- dr = g_new0 (DrWright, 1);
-
- client = gconf_client_get_default ();
-
- gconf_client_add_dir (client,
- GCONF_PATH,
- GCONF_CLIENT_PRELOAD_NONE,
- NULL);
-
- gconf_client_notify_add (client, GCONF_PATH,
- gconf_notify_cb,
- dr,
- NULL,
- NULL);
-
- dr->type_time = 60 * gconf_client_get_int (
- client, GCONF_PATH "/type_time", NULL);
-
-/* dr->warn_time = 60 * gconf_client_get_int (
- client, GCONF_PATH /warn_time", NULL);
-*/
- dr->warn_time = MIN (dr->type_time / 10, 60*5);
-
- dr->break_time = 60 * gconf_client_get_int (
- client, GCONF_PATH "/break_time", NULL);
-
- dr->enabled = gconf_client_get_bool (
- client,
- GCONF_PATH "/enabled",
- NULL);
-
- if (debug) {
- setup_debug_values (dr);
- }
-
- dr->popup_factory = gtk_item_factory_new (GTK_TYPE_MENU,
- "<main>",
- NULL);
- gtk_item_factory_set_translate_func (dr->popup_factory,
- item_factory_trans_cb,
- NULL,
- NULL);
-
- gtk_item_factory_create_items (dr->popup_factory,
- G_N_ELEMENTS (popup_items),
- popup_items,
- dr);
-
- /*item = gtk_item_factory_get_widget_by_action (dr->popup_factory, POPUP_ITEM_ENABLED);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), dr->enabled);*/
-
- item = gtk_item_factory_get_widget_by_action (dr->popup_factory, POPUP_ITEM_BREAK);
- gtk_widget_set_sensitive (item, dr->enabled);
-
- dr->timer = g_timer_new ();
- dr->idle_timer = g_timer_new ();
-
- dr->state = STATE_START;
-
- dr->monitor = drw_monitor_new ();
-
- g_signal_connect (dr->monitor,
- "activity",
- G_CALLBACK (activity_detected_cb),
- dr);
-
- dr->neutral_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar.png", NULL);
- dr->red_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-red.png", NULL);
- dr->green_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-green.png", NULL);
- dr->disabled_bar = gdk_pixbuf_new_from_file (IMAGEDIR "/bar-disabled.png", NULL);
-
- dr->tooltips = gtk_tooltips_new ();
-
- init_tray_icon (dr);
-
- g_timeout_add (15*1000,
- (GSourceFunc) update_tooltip,
- dr);
- g_timeout_add (500,
- (GSourceFunc) maybe_change_state,
- dr);
-
- return dr;
-}
-
diff --git a/typing-break/drwright.h b/typing-break/drwright.h
deleted file mode 100644
index df2cf9919..000000000
--- a/typing-break/drwright.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 Richard Hult <richard@imendio.com>
- *
- * 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 __DR_WRIGHT_H__
-#define __DR_WRIGHT_H__
-
-#define GCONF_PATH "/desktop/gnome/typing_break"
-
-typedef struct _DrWright DrWright;
-
-DrWright *drwright_new (void);
-
-#endif /* __DR_WRIGHT_H__ */
diff --git a/typing-break/egg-spawn.c b/typing-break/egg-spawn.c
deleted file mode 100644
index a1e0389b5..000000000
--- a/typing-break/egg-spawn.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* egg-spawn.c:
- *
- * Copyright (C) 2002 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify 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.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mark McLoughlin <mark@skynet.ie>
- */
-
-#include <config.h>
-#include <string.h>
-
-#include "egg-spawn.h"
-
-#include <glib.h>
-#include <gdk/gdk.h>
-
-extern char **environ;
-
-/**
- * egg_make_spawn_environment_for_screen:
- * @screen: A #GdkScreen
- * @envp: program environment to copy, or NULL to use current environment.
- *
- * Returns a modified copy of the program environment @envp (or the current
- * environment if @envp is NULL) with $DISPLAY set such that a launched
- * application (which calls gdk_display_open()) inheriting this environment
- * would have @screen as its default screen..
- *
- * Returns: a newly-allocated %NULL-terminated array of strings or
- * %NULL on error. Use g_strfreev() to free it.
- **/
-gchar **
-egg_make_spawn_environment_for_screen (GdkScreen *screen,
- gchar **envp)
-{
- gchar **retval = NULL;
- gchar *display_name;
- gint display_index = -1;
- gint i, env_len;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- if (envp == NULL)
- envp = environ;
-
- for (env_len = 0; envp [env_len]; env_len++)
- if (!strncmp (envp [env_len], "DISPLAY", strlen ("DISPLAY")))
- display_index = env_len;
-
- if (display_index == -1)
- display_index = env_len++;
-
- retval = g_new (char *, env_len + 1);
- retval [env_len] = NULL;
-
- display_name = gdk_screen_make_display_name (screen);
-
- for (i = 0; i < env_len; i++)
- if (i == display_index)
- retval [i] = g_strconcat ("DISPLAY=", display_name, NULL);
- else
- retval [i] = g_strdup (envp [i]);
-
- g_assert (i == env_len);
-
- g_free (display_name);
-
- return retval;
-}
-
-/**
- * egg_spawn_async_on_screen:
- * @working_directory: child's current working directory, or %NULL to inherit parent's
- * @argv: child's argument vector
- * @envp: child's environment, or %NULL to inherit parent's
- * @flags: flags from #GSpawnFlags
- * @child_setup: function to run in the child just before <function>exec()</function>
- * @user_data: user data for @child_setup
- * @screen: a #GdkScreen
- * @child_pid: return location for child process ID, or %NULL
- * @error: return location for error
- *
- * Like g_spawn_async(), except the child process is spawned in such
- * an environment that on calling gdk_display_open() it would be
- * returned a #GdkDisplay with @screen as the default screen.
- *
- * This is useful for applications which wish to launch an application
- * on a specific screen.
- *
- * Return value: %TRUE on success, %FALSE if error is set
- **/
-gboolean
-egg_spawn_async_on_screen (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GdkScreen *screen,
- gint *child_pid,
- GError **error)
-{
- GdkScreen *default_screen;
- gchar **new_envp = NULL;
- gboolean retval;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- default_screen = gdk_display_get_default_screen (
- gdk_screen_get_display (screen));
- if (screen != default_screen)
- new_envp = egg_make_spawn_environment_for_screen (screen, envp);
-
- retval = g_spawn_async (working_directory, argv,
- new_envp ? new_envp : envp,
- flags, child_setup, user_data,
- child_pid, error);
-
- g_strfreev (new_envp);
-
- return retval;
-}
-
-/**
- * egg_spawn_async_with_pipes_on_screen:
- * @working_directory: child's current working directory, or %NULL to inherit parent's
- * @argv: child's argument vector
- * @envp: child's environment, or %NULL to inherit parent's
- * @flags: flags from #GSpawnFlags
- * @child_setup: function to run in the child just before <function>exec()</function>
- * @user_data: user data for @child_setup
- * @screen: a #GdkScreen
- * @child_pid: return location for child process ID, or %NULL
- * @standard_input: return location for file descriptor to write to child's stdin, or %NULL
- * @standard_output: return location for file descriptor to read child's stdout, or %NULL
- * @standard_error: return location for file descriptor to read child's stderr, or %NULL
- * @error: return location for error
- *
- * Like g_spawn_async_with_pipes(), except the child process is
- * spawned in such an environment that on calling gdk_display_open()
- * it would be returned a #GdkDisplay with @screen as the default
- * screen.
- *
- * This is useful for applications which wish to launch an application
- * on a specific screen.
- *
- * Return value: %TRUE on success, %FALSE if an error was set
- **/
-gboolean
-egg_spawn_async_with_pipes_on_screen (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GdkScreen *screen,
- gint *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error)
-{
- GdkScreen *default_screen;
- gchar **new_envp = NULL;
- gboolean retval;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- default_screen = gdk_display_get_default_screen (
- gdk_screen_get_display (screen));
- if (screen != default_screen)
- new_envp = egg_make_spawn_environment_for_screen (screen, envp);
-
- retval = g_spawn_async_with_pipes (working_directory, argv,
- new_envp ? new_envp : envp,
- flags, child_setup, user_data,
- child_pid, standard_input,
- standard_output, standard_error,
- error);
-
- g_strfreev (new_envp);
-
- return retval;
-}
-
-/**
- * egg_spawn_sync_on_screen:
- * @working_directory: child's current working directory, or %NULL to inherit parent's
- * @argv: child's argument vector
- * @envp: child's environment, or %NULL to inherit parent's
- * @flags: flags from #GSpawnFlags
- * @child_setup: function to run in the child just before <function>exec()</function>
- * @user_data: user data for @child_setup
- * @screen: a #GdkScreen
- * @standard_output: return location for child output
- * @standard_error: return location for child error messages
- * @exit_status: child exit status, as returned by <function>waitpid()</function>
- * @error: return location for error
- *
- * Like g_spawn_sync(), except the child process is spawned in such
- * an environment that on calling gdk_display_open() it would be
- * returned a #GdkDisplay with @screen as the default screen.
- *
- * This is useful for applications which wish to launch an application
- * on a specific screen.
- *
- * Return value: %TRUE on success, %FALSE if an error was set.
- **/
-gboolean
-egg_spawn_sync_on_screen (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GdkScreen *screen,
- gchar **standard_output,
- gchar **standard_error,
- gint *exit_status,
- GError **error)
-{
- GdkScreen *default_screen;
- gchar **new_envp = NULL;
- gboolean retval;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- default_screen = gdk_display_get_default_screen (
- gdk_screen_get_display (screen));
- if (screen != default_screen)
- new_envp = egg_make_spawn_environment_for_screen (screen, envp);
-
- retval = g_spawn_sync (working_directory, argv,
- new_envp ? new_envp : envp,
- flags, child_setup, user_data,
- standard_output, standard_error,
- exit_status, error);
-
- g_strfreev (new_envp);
-
- return retval;
-}
-
-/**
- * egg_spawn_command_line_sync_on_screen:
- * @command_line: a command line
- * @screen: a #GdkScreen
- * @standard_output: return location for child output
- * @standard_error: return location for child errors
- * @exit_status: return location for child exit status
- * @error: return location for errors
- *
- * Like g_spawn_command_line_sync(), except the child process is
- * spawned in such an environment that on calling gdk_display_open()
- * it would be returned a #GdkDisplay with @screen as the default
- * screen.
- *
- * This is useful for applications which wish to launch an application
- * on a specific screen.
- *
- * Return value: %TRUE on success, %FALSE if an error was set
- **/
-gboolean
-egg_spawn_command_line_sync_on_screen (const gchar *command_line,
- GdkScreen *screen,
- gchar **standard_output,
- gchar **standard_error,
- gint *exit_status,
- GError **error)
-{
- gchar **argv = NULL;
- gboolean retval;
-
- g_return_val_if_fail (command_line != NULL, FALSE);
-
- if (!g_shell_parse_argv (command_line,
- NULL, &argv,
- error))
- return FALSE;
-
- retval = egg_spawn_sync_on_screen (NULL,
- argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- screen,
- standard_output,
- standard_error,
- exit_status,
- error);
-
- g_strfreev (argv);
-
- return retval;
-}
-
-/**
- * egg_spawn_command_line_async_on_screen:
- * @command_line: a command line
- * @screen: a #GdkScreen
- * @error: return location for errors
- *
- * Like g_spawn_command_line_async(), except the child process is
- * spawned in such an environment that on calling gdk_display_open()
- * it would be returned a #GdkDisplay with @screen as the default
- * screen.
- *
- * This is useful for applications which wish to launch an application
- * on a specific screen.
- *
- * Return value: %TRUE on success, %FALSE if error is set.
- **/
-gboolean
-egg_spawn_command_line_async_on_screen (const gchar *command_line,
- GdkScreen *screen,
- GError **error)
-{
- gchar **argv = NULL;
- gboolean retval;
-
- g_return_val_if_fail (command_line != NULL, FALSE);
-
- if (!g_shell_parse_argv (command_line,
- NULL, &argv,
- error))
- return FALSE;
-
- retval = egg_spawn_async_on_screen (NULL,
- argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- screen,
- NULL,
- error);
- g_strfreev (argv);
-
- return retval;
-}
diff --git a/typing-break/egg-spawn.h b/typing-break/egg-spawn.h
deleted file mode 100644
index 478fa2a70..000000000
--- a/typing-break/egg-spawn.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* egg-spawn.h:
- *
- * Copyright (C) 2002 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify 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.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mark McLoughlin <mark@skynet.ie>
- */
-
-#ifndef __EGG_SPAWN_H__
-#define __EGG_SPAWN_H__
-
-#include <gdk/gdk.h>
-#include <glib/gspawn.h>
-
-G_BEGIN_DECLS
-
-gchar **egg_make_spawn_environment_for_screen (GdkScreen *screen,
- gchar **envp);
-
-gboolean egg_spawn_async_on_screen (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GdkScreen *screen,
- gint *child_pid,
- GError **error);
-
-gboolean egg_spawn_async_with_pipes_on_screen (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GdkScreen *screen,
- gint *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error);
-
-gboolean egg_spawn_sync_on_screen (const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GdkScreen *screen,
- gchar **standard_output,
- gchar **standard_error,
- gint *exit_status,
- GError **error);
-
-gboolean egg_spawn_command_line_sync_on_screen (const gchar *command_line,
- GdkScreen *screen,
- gchar **standard_output,
- gchar **standard_error,
- gint *exit_status,
- GError **error);
-gboolean egg_spawn_command_line_async_on_screen (const gchar *command_line,
- GdkScreen *screen,
- GError **error);
-
-G_END_DECLS
-
-#endif /* __EGG_SPAWN_H__ */
diff --git a/typing-break/eggtrayicon.c b/typing-break/eggtrayicon.c
deleted file mode 100644
index 065d84976..000000000
--- a/typing-break/eggtrayicon.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.c
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-#include <gdk/gdkx.h>
-#include "eggtrayicon.h"
-
-#define SYSTEM_TRAY_REQUEST_DOCK 0
-#define SYSTEM_TRAY_BEGIN_MESSAGE 1
-#define SYSTEM_TRAY_CANCEL_MESSAGE 2
-
-static GtkPlugClass *parent_class = NULL;
-
-static void egg_tray_icon_init (EggTrayIcon *icon);
-static void egg_tray_icon_class_init (EggTrayIconClass *klass);
-
-static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
-
-GType
-egg_tray_icon_get_type (void)
-{
- static GType our_type = 0;
-
- if (our_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (EggTrayIconClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_tray_icon_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EggTrayIcon),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_tray_icon_init
- };
-
- our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
- }
-
- return our_type;
-}
-
-static void
-egg_tray_icon_init (EggTrayIcon *icon)
-{
- icon->stamp = 1;
-
- gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
-}
-
-static void
-egg_tray_icon_class_init (EggTrayIconClass *klass)
-{
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static GdkFilterReturn
-egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
-{
- EggTrayIcon *icon = user_data;
- XEvent *xev = (XEvent *)xevent;
-
- if (xev->xany.type == ClientMessage &&
- xev->xclient.message_type == icon->manager_atom &&
- xev->xclient.data.l[1] == icon->selection_atom)
- {
- egg_tray_icon_update_manager_window (icon);
- }
- else if (xev->xany.window == icon->manager_window)
- {
- if (xev->xany.type == DestroyNotify)
- {
- egg_tray_icon_update_manager_window (icon);
- }
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-egg_tray_icon_send_manager_message (EggTrayIcon *icon,
- long message,
- Window window,
- long data1,
- long data2,
- long data3)
-{
- XClientMessageEvent ev;
- Display *display;
-
- ev.type = ClientMessage;
- ev.window = window;
- ev.message_type = icon->system_tray_opcode_atom;
- ev.format = 32;
- ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window);
- ev.data.l[1] = message;
- ev.data.l[2] = data1;
- ev.data.l[3] = data2;
- ev.data.l[4] = data3;
-
-#if HAVE_GTK_MULTIHEAD
- display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
- display = gdk_display;
-#endif
-
- gdk_error_trap_push ();
- XSendEvent (display,
- icon->manager_window, False, NoEventMask, (XEvent *)&ev);
- XSync (display, False);
- gdk_error_trap_pop ();
-}
-
-static void
-egg_tray_icon_send_dock_request (EggTrayIcon *icon)
-{
- egg_tray_icon_send_manager_message (icon,
- SYSTEM_TRAY_REQUEST_DOCK,
- icon->manager_window,
- gtk_plug_get_id (GTK_PLUG (icon)),
- 0, 0);
-}
-
-static void
-egg_tray_icon_update_manager_window (EggTrayIcon *icon)
-{
- Display *xdisplay;
-
-#if HAVE_GTK_MULTIHEAD
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
- xdisplay = gdk_display;
-#endif
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
-#if HAVE_GTK_MULTIHEAD
- gdkwin = gdk_window_lookup_for_display (display,
- icon->manager_window);
-#else
- gdkwin = gdk_window_lookup (icon->manager_window);
-#endif
-
- gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
- }
-
- XGrabServer (xdisplay);
-
- icon->manager_window = XGetSelectionOwner (xdisplay,
- icon->selection_atom);
-
- if (icon->manager_window != None)
- XSelectInput (xdisplay,
- icon->manager_window, StructureNotifyMask);
-
- XUngrabServer (xdisplay);
- XFlush (xdisplay);
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
-#if HAVE_GTK_MULTIHEAD
- gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
- icon->manager_window);
-#else
- gdkwin = gdk_window_lookup (icon->manager_window);
-#endif
-
- gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
-
- /* Send a request that we'd like to dock */
- egg_tray_icon_send_dock_request (icon);
- }
-}
-
-EggTrayIcon *
-egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
-{
- EggTrayIcon *icon;
- char buffer[256];
- GdkWindow *root_window;
-
- g_return_val_if_fail (xscreen != NULL, NULL);
-
- icon = g_object_new (EGG_TYPE_TRAY_ICON, NULL);
- gtk_window_set_title (GTK_WINDOW (icon), name);
-
-#if HAVE_GTK_MULTIHEAD
- gtk_plug_construct_for_display (GTK_PLUG (icon),
- gdk_screen_get_display (screen), 0);
-#else
- gtk_plug_construct (GTK_PLUG (icon), 0);
-#endif
-
- gtk_widget_realize (GTK_WIDGET (icon));
-
- /* Now see if there's a manager window around */
- g_snprintf (buffer, sizeof (buffer),
- "_NET_SYSTEM_TRAY_S%d",
- XScreenNumberOfScreen (xscreen));
-
- icon->selection_atom = XInternAtom (DisplayOfScreen (xscreen),
- buffer, False);
-
- icon->manager_atom = XInternAtom (DisplayOfScreen (xscreen),
- "MANAGER", False);
-
- icon->system_tray_opcode_atom = XInternAtom (DisplayOfScreen (xscreen),
- "_NET_SYSTEM_TRAY_OPCODE", False);
-
- egg_tray_icon_update_manager_window (icon);
-
-#if HAVE_GTK_MULTIHEAD
- root_window = gdk_screen_get_root_window (screen);
-#else
- root_window = gdk_window_lookup (gdk_x11_get_default_root_xwindow ());
-#endif
-
- /* Add a root window filter so that we get changes on MANAGER */
- gdk_window_add_filter (root_window,
- egg_tray_icon_manager_filter, icon);
-
- return icon;
-}
-
-#if HAVE_GTK_MULTIHEAD
-EggTrayIcon *
-egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
-{
- EggTrayIcon *icon;
- char buffer[256];
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- return egg_tray_icon_new_for_xscreen (GDK_SCREEN_XSCREEN (screen), name);
-}
-#endif
-
-EggTrayIcon*
-egg_tray_icon_new (const gchar *name)
-{
- return egg_tray_icon_new_for_xscreen (DefaultScreenOfDisplay (gdk_display), name);
-}
-
-guint
-egg_tray_icon_send_message (EggTrayIcon *icon,
- gint timeout,
- const gchar *message,
- gint len)
-{
- guint stamp;
-
- g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
- g_return_val_if_fail (timeout >= 0, 0);
- g_return_val_if_fail (message != NULL, 0);
-
- if (icon->manager_window == None)
- return 0;
-
- if (len < 0)
- len = strlen (message);
-
- stamp = icon->stamp++;
-
- /* Get ready to send the message */
- egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
- (Window)gtk_plug_get_id (GTK_PLUG (icon)),
- timeout, len, stamp);
-
- /* Now to send the actual message */
- gdk_error_trap_push ();
- while (len > 0)
- {
- XClientMessageEvent ev;
- Display *xdisplay;
-
-#if HAVE_GTK_MULTIHEAD
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
- xdisplay = gdk_display;
-#endif
-
- ev.type = ClientMessage;
- ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
- ev.format = 8;
- ev.message_type = XInternAtom (xdisplay,
- "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
- if (len > 20)
- {
- memcpy (&ev.data, message, 20);
- len -= 20;
- message += 20;
- }
- else
- {
- memcpy (&ev.data, message, len);
- len = 0;
- }
-
- XSendEvent (xdisplay,
- icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
- XSync (xdisplay, False);
- }
- gdk_error_trap_pop ();
-
- return stamp;
-}
-
-void
-egg_tray_icon_cancel_message (EggTrayIcon *icon,
- guint id)
-{
- g_return_if_fail (EGG_IS_TRAY_ICON (icon));
- g_return_if_fail (id > 0);
-
- egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
- (Window)gtk_plug_get_id (GTK_PLUG (icon)),
- id, 0, 0);
-}
diff --git a/typing-break/eggtrayicon.h b/typing-break/eggtrayicon.h
deleted file mode 100644
index 724bc3da8..000000000
--- a/typing-break/eggtrayicon.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.h
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EGG_TRAY_ICON_H__
-#define __EGG_TRAY_ICON_H__
-
-#include <gtk/gtkplug.h>
-#include <gdk/gdkx.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ())
-#define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon))
-#define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-#define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON))
-#define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON))
-#define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-
-typedef struct _EggTrayIcon EggTrayIcon;
-typedef struct _EggTrayIconClass EggTrayIconClass;
-
-struct _EggTrayIcon
-{
- GtkPlug parent_instance;
-
- guint stamp;
-
- Atom selection_atom;
- Atom manager_atom;
- Atom system_tray_opcode_atom;
- Window manager_window;
-};
-
-struct _EggTrayIconClass
-{
- GtkPlugClass parent_class;
-};
-
-GType egg_tray_icon_get_type (void);
-
-#if EGG_TRAY_ENABLE_MULTIHEAD
-EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen,
- const gchar *name);
-#endif
-
-EggTrayIcon *egg_tray_icon_new (const gchar *name);
-
-guint egg_tray_icon_send_message (EggTrayIcon *icon,
- gint timeout,
- const char *message,
- gint len);
-void egg_tray_icon_cancel_message (EggTrayIcon *icon,
- guint id);
-
-
-
-G_END_DECLS
-
-#endif /* __EGG_TRAY_ICON_H__ */
diff --git a/typing-break/main.c b/typing-break/main.c
deleted file mode 100644
index 88e10ddc4..000000000
--- a/typing-break/main.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2002 CodeFactory AB
- * Copyright (C) 2002-2003 Richard Hult <richard@imendio.com>
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <libgnomeui/libgnomeui.h>
-#include <libgnome/gnome-i18n.h>
-#include "drw-selection.h"
-#include "drwright.h"
-
-gboolean debug = FALSE;
-
-static gboolean
-have_tray (void)
-{
- Screen *xscreen = DefaultScreenOfDisplay (gdk_display);
- Atom selection_atom;
- char *selection_atom_name;
-
- selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d",
- XScreenNumberOfScreen (xscreen));
- selection_atom = XInternAtom (DisplayOfScreen (xscreen), selection_atom_name, False);
- g_free (selection_atom_name);
-
- if (XGetSelectionOwner (DisplayOfScreen (xscreen), selection_atom)) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- gint i;
- DrWright *drwright;
- DrwSelection *selection;
- GnomeClient *client;
- gboolean no_check = FALSE;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
- i = 1;
- while (i < argc) {
- const gchar *arg = argv[i];
-
- if (strcmp (arg, "--debug") == 0 ||
- strcmp (arg, "-d") == 0) {
- debug = TRUE;
- }
- else if (strcmp (arg, "-n") == 0) {
- no_check = TRUE;
- }
- else if (strcmp (arg, "-?") == 0) {
- g_printerr ("Usage: %s [--debug]\n", argv[0]);
- return 0;
- }
-
- ++i;
- }
-
- gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
- argc, argv, NULL);
-
- selection = drw_selection_start ();
- if (!drw_selection_is_master (selection)) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, 0,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_CLOSE,
- _("The typing monitor is already running."));
-
- gtk_dialog_run (GTK_DIALOG (dialog));
-
- return 0;
- }
-
- if (!no_check && !have_tray ()) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, 0,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_CLOSE,
- _("The typing monitor uses the notification area to display "
- "information. You don't seem to have a notification area "
- "on your panel. You can add it by right-clicking on your "
- "panel and choose 'Add to panel -> Utilities -> Notification area'."));
-
- gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
- }
-
- drwright = drwright_new ();
-
- gtk_main ();
-
- return 0;
-}
diff --git a/typing-break/ocean-stripes.png b/typing-break/ocean-stripes.png
deleted file mode 100644
index d0570962e..000000000
--- a/typing-break/ocean-stripes.png
+++ /dev/null
Binary files differ
diff --git a/typing-break/stock_stop.png b/typing-break/stock_stop.png
deleted file mode 100644
index 4beba47d9..000000000
--- a/typing-break/stock_stop.png
+++ /dev/null
Binary files differ
diff --git a/typing-break/stop.png b/typing-break/stop.png
deleted file mode 100644
index b786dd724..000000000
--- a/typing-break/stop.png
+++ /dev/null
Binary files differ