Remove this and use gnome-i18n.h instead.
2003-06-27 Richard Hult <richard@imendio.com> * typing-break/drw-intl.h: Remove this and use gnome-i18n.h instead. * typing-break/Makefile.am: Remove drw-intl.h * typing-break/drwright.c: * typing-break/drwright.h: * typing-break/drw-break-window.c: Merge in changes from drwright.
This commit is contained in:
parent
168f178cea
commit
f39c8ca372
10 changed files with 119 additions and 131 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2003-06-27 Richard Hult <richard@imendio.com>
|
||||
|
||||
* typing-break/drw-intl.h: Remove this and use gnome-i18n.h
|
||||
instead.
|
||||
|
||||
* typing-break/Makefile.am: Remove drw-intl.h
|
||||
|
||||
* typing-break/drwright.c:
|
||||
* typing-break/drwright.h:
|
||||
* typing-break/drw-break-window.c: Merge in changes from drwright.
|
||||
|
||||
Thu Jun 26 16:37:50 2003 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* Makefile.am (SUBDIRS): add typing-break to subdirs.
|
||||
|
|
|
@ -13,7 +13,6 @@ gnome_typing_monitor_SOURCES = \
|
|||
drw-break-window.h \
|
||||
drw-monitor.c \
|
||||
drw-monitor.h \
|
||||
drw-intl.h \
|
||||
eggtrayicon.c \
|
||||
eggtrayicon.h \
|
||||
drw-selection.c \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 CodeFactory AB
|
||||
* Copyright (C) 2002 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
@ -25,16 +25,18 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include "drwright.h"
|
||||
#include "drw-break-window.h"
|
||||
#include "drw-intl.h"
|
||||
|
||||
|
||||
struct _DrwBreakWindowPriv {
|
||||
GtkWidget *clock_label;
|
||||
GtkWidget *break_label;
|
||||
GtkWidget *image;
|
||||
|
||||
GtkWidget *unlock_entry;
|
||||
GtkWidget *unlock_button;
|
||||
GtkWidget *postpone_entry;
|
||||
GtkWidget *postpone_button;
|
||||
|
||||
GTimer *timer;
|
||||
|
||||
|
@ -42,10 +44,10 @@ struct _DrwBreakWindowPriv {
|
|||
|
||||
gchar *break_text;
|
||||
guint clock_timeout_id;
|
||||
guint unlock_timeout_id;
|
||||
guint postpone_timeout_id;
|
||||
};
|
||||
|
||||
#define UNLOCK_CANCEL 30*1000
|
||||
#define POSTPONE_CANCEL 30*1000
|
||||
|
||||
/* Signals */
|
||||
enum {
|
||||
|
@ -63,7 +65,7 @@ static GdkPixbuf * create_tile_pixbuf (GdkPixbuf *dest_pi
|
|||
guint alpha,
|
||||
GdkColor *bg_color);
|
||||
static gboolean clock_timeout_cb (DrwBreakWindow *window);
|
||||
static void unlock_clicked_cb (GtkWidget *button,
|
||||
static void postpone_clicked_cb (GtkWidget *button,
|
||||
GtkWidget *window);
|
||||
static gboolean label_expose_event_cb (GtkLabel *label,
|
||||
GdkEventExpose *event,
|
||||
|
@ -146,17 +148,17 @@ drw_break_window_init (DrwBreakWindow *window)
|
|||
GdkColor color;
|
||||
GtkWidget *outer_vbox;
|
||||
GtkWidget *button_box;
|
||||
gboolean allow_unlock;
|
||||
gboolean allow_postpone;
|
||||
|
||||
priv = g_new0 (DrwBreakWindowPriv, 1);
|
||||
window->priv = priv;
|
||||
|
||||
priv->break_time = 60 * gconf_client_get_int (gconf_client_get_default (),
|
||||
"/desktop/gnome/typing_break/break_time",
|
||||
GCONF_PATH "/break_time",
|
||||
NULL);
|
||||
|
||||
allow_unlock = gconf_client_get_bool (gconf_client_get_default (),
|
||||
"/desktop/gnome/typing_break/allow_unlock",
|
||||
allow_postpone = gconf_client_get_bool (gconf_client_get_default (),
|
||||
GCONF_PATH "/allow_postpone",
|
||||
NULL);
|
||||
|
||||
GTK_WINDOW (window)->type = GTK_WINDOW_POPUP;
|
||||
|
@ -249,26 +251,26 @@ drw_break_window_init (DrwBreakWindow *window)
|
|||
|
||||
gtk_box_pack_start (GTK_BOX (outer_vbox), align, TRUE, TRUE, 0);
|
||||
|
||||
if (allow_unlock) {
|
||||
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->unlock_button = gtk_button_new_with_label (_("Postpone break"));
|
||||
gtk_widget_show (priv->unlock_button);
|
||||
priv->postpone_button = gtk_button_new_with_label (_("Postpone break"));
|
||||
gtk_widget_show (priv->postpone_button);
|
||||
|
||||
g_signal_connect (priv->unlock_button,
|
||||
g_signal_connect (priv->postpone_button,
|
||||
"clicked",
|
||||
G_CALLBACK (unlock_clicked_cb),
|
||||
G_CALLBACK (postpone_clicked_cb),
|
||||
window);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (button_box), priv->unlock_button, FALSE, TRUE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (button_box), priv->postpone_button, FALSE, TRUE, 0);
|
||||
|
||||
priv->unlock_entry = gtk_entry_new ();
|
||||
gtk_entry_set_has_frame (GTK_ENTRY (priv->unlock_entry), FALSE);
|
||||
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->unlock_entry, FALSE, TRUE, 4);
|
||||
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);
|
||||
}
|
||||
|
@ -347,8 +349,8 @@ drw_break_window_finalize (GObject *object)
|
|||
g_source_remove (priv->clock_timeout_id);
|
||||
}
|
||||
|
||||
if (priv->unlock_timeout_id != 0) {
|
||||
g_source_remove (priv->unlock_timeout_id);
|
||||
if (priv->postpone_timeout_id != 0) {
|
||||
g_source_remove (priv->postpone_timeout_id);
|
||||
}
|
||||
|
||||
g_free (priv);
|
||||
|
@ -473,7 +475,7 @@ clock_timeout_cb (DrwBreakWindow *window)
|
|||
}
|
||||
|
||||
static void
|
||||
unlock_entry_activate_cb (GtkWidget *entry,
|
||||
postpone_entry_activate_cb (GtkWidget *entry,
|
||||
DrwBreakWindow *window)
|
||||
{
|
||||
const gchar *str;
|
||||
|
@ -482,12 +484,11 @@ unlock_entry_activate_cb (GtkWidget *entry,
|
|||
str = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
|
||||
phrase = gconf_client_get_string (gconf_client_get_default (),
|
||||
"/desktop/gnome/typing_break/unlock_phrase",
|
||||
GCONF_PATH "/unlock_phrase",
|
||||
NULL);
|
||||
|
||||
if (!strcmp (str, phrase)) {
|
||||
g_signal_emit (window, signals[POSTPONE], 0, NULL);
|
||||
//gtk_widget_destroy (GTK_WIDGET (window));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -516,22 +517,22 @@ grab_on_window (GdkWindow *window,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
unlock_cancel_cb (DrwBreakWindow *window)
|
||||
postpone_cancel_cb (DrwBreakWindow *window)
|
||||
{
|
||||
DrwBreakWindowPriv *priv;
|
||||
|
||||
priv = window->priv;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->unlock_entry), "");
|
||||
gtk_widget_hide (priv->unlock_entry);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->postpone_entry), "");
|
||||
gtk_widget_hide (priv->postpone_entry);
|
||||
|
||||
priv->unlock_timeout_id = 0;
|
||||
priv->postpone_timeout_id = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
unlock_entry_key_press_event_cb (GtkEntry *entry,
|
||||
postpone_entry_key_press_event_cb (GtkEntry *entry,
|
||||
GdkEventKey *event,
|
||||
DrwBreakWindow *window)
|
||||
{
|
||||
|
@ -540,62 +541,61 @@ unlock_entry_key_press_event_cb (GtkEntry *entry,
|
|||
priv = window->priv;
|
||||
|
||||
if (event->keyval == GDK_Escape) {
|
||||
if (priv->unlock_timeout_id) {
|
||||
g_source_remove (priv->unlock_timeout_id);
|
||||
if (priv->postpone_timeout_id) {
|
||||
g_source_remove (priv->postpone_timeout_id);
|
||||
}
|
||||
|
||||
unlock_cancel_cb (window);
|
||||
postpone_cancel_cb (window);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_source_remove (priv->unlock_timeout_id);
|
||||
g_source_remove (priv->postpone_timeout_id);
|
||||
|
||||
priv->unlock_timeout_id = g_timeout_add (UNLOCK_CANCEL, (GSourceFunc) unlock_cancel_cb, window);
|
||||
priv->postpone_timeout_id = g_timeout_add (POSTPONE_CANCEL, (GSourceFunc) postpone_cancel_cb, window);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
unlock_clicked_cb (GtkWidget *button,
|
||||
postpone_clicked_cb (GtkWidget *button,
|
||||
GtkWidget *window)
|
||||
{
|
||||
DrwBreakWindow *bw = DRW_BREAK_WINDOW (window);
|
||||
DrwBreakWindowPriv *priv = bw->priv;
|
||||
gchar *phrase;
|
||||
|
||||
phrase = gconf_client_get_string (gconf_client_get_default (),
|
||||
"/desktop/gnome/typing_break/unlock_phrase",
|
||||
NULL);
|
||||
/* 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);
|
||||
|
||||
//gtk_widget_destroy (window);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (priv->unlock_entry)) {
|
||||
gtk_widget_activate (priv->unlock_entry);
|
||||
if (GTK_WIDGET_VISIBLE (priv->postpone_entry)) {
|
||||
gtk_widget_activate (priv->postpone_entry);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_show (priv->unlock_entry);
|
||||
gtk_widget_show (priv->postpone_entry);
|
||||
|
||||
priv->unlock_timeout_id = g_timeout_add (UNLOCK_CANCEL, (GSourceFunc) unlock_cancel_cb, bw);
|
||||
priv->postpone_timeout_id = g_timeout_add (POSTPONE_CANCEL, (GSourceFunc) postpone_cancel_cb, bw);
|
||||
|
||||
grab_on_window (priv->unlock_entry->window, gtk_get_current_event_time ());
|
||||
grab_on_window (priv->postpone_entry->window, gtk_get_current_event_time ());
|
||||
|
||||
gtk_widget_grab_focus (priv->unlock_entry);
|
||||
gtk_widget_grab_focus (priv->postpone_entry);
|
||||
|
||||
g_signal_connect (priv->unlock_entry,
|
||||
g_signal_connect (priv->postpone_entry,
|
||||
"activate",
|
||||
G_CALLBACK (unlock_entry_activate_cb),
|
||||
G_CALLBACK (postpone_entry_activate_cb),
|
||||
bw);
|
||||
|
||||
g_signal_connect (priv->unlock_entry,
|
||||
g_signal_connect (priv->postpone_entry,
|
||||
"key_press_event",
|
||||
G_CALLBACK (unlock_entry_key_press_event_cb),
|
||||
G_CALLBACK (postpone_entry_key_press_event_cb),
|
||||
bw);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 CodeFactory AB
|
||||
* Copyright (C) 2002 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
|
|
@ -1,43 +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 <rhult@codefactory.se>
|
||||
*
|
||||
* 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 __DRWRIGHT_INTL_H__
|
||||
#define __DRWRIGHT_INTL_H__
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include<libintl.h>
|
||||
#define _(String) dgettext(GETTEXT_PACKAGE,String)
|
||||
#ifdef gettext_noop
|
||||
#define N_(String) gettext_noop(String)
|
||||
#else
|
||||
#define N_(String) (String)
|
||||
#endif
|
||||
#else /* NLS is disabled */
|
||||
#define _(String) (String)
|
||||
#define N_(String) (String)
|
||||
#define textdomain(String) (String)
|
||||
#define gettext(String) (String)
|
||||
#define dgettext(Domain,String) (String)
|
||||
#define dcgettext(Domain,String,Type) (String)
|
||||
#define bindtextdomain(Domain,Directory) (Domain)
|
||||
#endif
|
||||
|
||||
#endif /* __DRWRIGHT_INTL_H__ */
|
|
@ -1,7 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 CodeFactory AB
|
||||
* Copyright (C) 2002 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 CodeFactory AB
|
||||
* Copyright (C) 2002 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 CodeFactory AB
|
||||
* Copyright (C) 2002-2003 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
@ -28,9 +28,9 @@
|
|||
#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-intl.h"
|
||||
#include "drw-break-window.h"
|
||||
#include "drw-monitor.h"
|
||||
#include "eggtrayicon.h"
|
||||
|
@ -107,18 +107,22 @@ static void break_window_done_cb (GtkWidget *window,
|
|||
DrWright *dr);
|
||||
static void break_window_postpone_cb (GtkWidget *window,
|
||||
DrWright *dr);
|
||||
#if 0
|
||||
static void popup_enabled_cb (gpointer callback_data,
|
||||
guint action,
|
||||
GtkWidget *widget);
|
||||
#endif
|
||||
static void popup_break_cb (gpointer callback_data,
|
||||
guint action,
|
||||
GtkWidget *widget);
|
||||
static void popup_preferences_cb (gpointer callback_data,
|
||||
guint action,
|
||||
GtkWidget *widget);
|
||||
#if 0
|
||||
static void popup_quit_cb (gpointer callback_data,
|
||||
guint action,
|
||||
GtkWidget *widget);
|
||||
#endif
|
||||
static void popup_about_cb (gpointer callback_data,
|
||||
guint action,
|
||||
GtkWidget *widget);
|
||||
|
@ -130,17 +134,17 @@ static void init_tray_icon (DrWright *dr);
|
|||
#define GIF_CB(x) ((GtkItemFactoryCallback)(x))
|
||||
|
||||
static GtkItemFactoryEntry popup_items[] = {
|
||||
{ N_("/_Enabled"), NULL, GIF_CB (popup_enabled_cb), POPUP_ITEM_ENABLED, "<ToggleItem>", NULL },
|
||||
{ N_("/_Take a Break"), NULL, GIF_CB (popup_break_cb), POPUP_ITEM_BREAK, "<Item>", NULL },
|
||||
{ "/sep1", NULL, 0, 0, "<Separator>", NULL },
|
||||
/* { 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 },
|
||||
{ "/sep2", NULL, 0, 0, "<Separator>", NULL },
|
||||
{ N_("/_Remove Icon"), "", GIF_CB (popup_quit_cb), 0, "<StockItem>", GTK_STOCK_REMOVE },
|
||||
{ "/sep1", NULL, 0, 0, "<Separator>", NULL },
|
||||
{ N_("/_Take a Break"), NULL, GIF_CB (popup_break_cb), POPUP_ITEM_BREAK, "<Item>", NULL }
|
||||
/* { "/sep2", NULL, 0, 0, "<Separator>", NULL },
|
||||
{ N_("/_Remove Icon"), "", GIF_CB (popup_quit_cb), 0, "<StockItem>", GTK_STOCK_REMOVE }*/
|
||||
};
|
||||
|
||||
GConfClient *client = NULL;
|
||||
gboolean debug;
|
||||
extern gboolean debug;
|
||||
|
||||
static void
|
||||
setup_debug_values (DrWright *dr)
|
||||
|
@ -448,11 +452,11 @@ update_tooltip (DrWright *dr)
|
|||
switch (dr->state) {
|
||||
case STATE_WARN_TYPE:
|
||||
case STATE_WARN_IDLE:
|
||||
min = ceil ((dr->warn_time - elapsed_time) / 60.0);
|
||||
min = floor (0.5 + (dr->warn_time - elapsed_time) / 60.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
min = ceil ((dr->type_time - elapsed_time) / 60.0);
|
||||
min = floor (0.5 + (dr->type_time - elapsed_time) / 60.0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -491,7 +495,7 @@ gconf_notify_cb (GConfClient *client,
|
|||
DrWright *dr = user_data;
|
||||
GtkWidget *item;
|
||||
|
||||
if (!strcmp (entry->key, "/desktop/gnome/typing_break/type_time")) {
|
||||
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);
|
||||
|
@ -499,20 +503,20 @@ gconf_notify_cb (GConfClient *client,
|
|||
dr->state = STATE_START;
|
||||
}
|
||||
}
|
||||
/* else if (!strcmp (entry->key, "/desktop/gnome/typing_break/warn_time")) {
|
||||
/* 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, "/desktop/gnome/typing_break/break_time")) {
|
||||
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, "/desktop/gnome/typing_break/enabled")) {
|
||||
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;
|
||||
|
@ -528,6 +532,7 @@ gconf_notify_cb (GConfClient *client,
|
|||
maybe_change_state (dr);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
popup_enabled_cb (gpointer callback_data,
|
||||
guint action,
|
||||
|
@ -542,10 +547,11 @@ popup_enabled_cb (gpointer callback_data,
|
|||
|
||||
enabled = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (item));
|
||||
|
||||
gconf_client_set_bool (client, "/desktop/gnome/typing_break/enabled",
|
||||
gconf_client_set_bool (client, GCONF_PATH "/enabled",
|
||||
enabled,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
popup_break_cb (gpointer callback_data,
|
||||
|
@ -568,6 +574,7 @@ popup_preferences_cb (gpointer callback_data,
|
|||
/* Bring up gnome-keyboard-properties on the right page */
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
popup_quit_cb (gpointer callback_data,
|
||||
guint action,
|
||||
|
@ -585,11 +592,19 @@ popup_quit_cb (gpointer callback_data,
|
|||
dialog = gtk_message_dialog_new (NULL,
|
||||
0,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_YES_NO,
|
||||
GTK_BUTTONS_NONE,
|
||||
str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
_("Don't Quit"),
|
||||
GTK_RESPONSE_NO);
|
||||
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
_("Quit"),
|
||||
GTK_RESPONSE_YES);
|
||||
|
||||
g_object_set (GTK_MESSAGE_DIALOG (dialog)->label,
|
||||
"use-markup", TRUE,
|
||||
"wrap", TRUE,
|
||||
|
@ -607,6 +622,7 @@ popup_quit_cb (gpointer callback_data,
|
|||
gtk_main_quit ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
popup_about_cb (gpointer callback_data,
|
||||
|
@ -626,7 +642,10 @@ popup_about_cb (gpointer callback_data,
|
|||
|
||||
about_window = gtk_dialog_new ();
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (about_window), (gpointer *) &about_window);
|
||||
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);
|
||||
|
@ -658,7 +677,7 @@ popup_about_cb (gpointer callback_data,
|
|||
"<span size=\"small\">%s</span>\n"
|
||||
"<span size=\"small\">%s</span>\n",
|
||||
_("A computer break reminder."),
|
||||
_("Written by Richard Hult <rhult@codefactory.se>"),
|
||||
_("Written by Richard Hult <richard@imendio.com>"),
|
||||
_("Eye candy added by Anders Carlsson"));
|
||||
gtk_label_set_markup (GTK_LABEL (label), markup);
|
||||
g_free (markup);
|
||||
|
@ -865,30 +884,30 @@ drwright_new (void)
|
|||
client = gconf_client_get_default ();
|
||||
|
||||
gconf_client_add_dir (client,
|
||||
"/apps/drwright",
|
||||
GCONF_PATH,
|
||||
GCONF_CLIENT_PRELOAD_NONE,
|
||||
NULL);
|
||||
|
||||
gconf_client_notify_add (client, "/apps/drwright",
|
||||
gconf_client_notify_add (client, GCONF_PATH,
|
||||
gconf_notify_cb,
|
||||
dr,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
dr->type_time = 60 * gconf_client_get_int (
|
||||
client, "/desktop/gnome/typing_break/type_time", NULL);
|
||||
client, GCONF_PATH "/type_time", NULL);
|
||||
|
||||
/* dr->warn_time = 60 * gconf_client_get_int (
|
||||
client, "/desktop/gnome/typing_break/warn_time", NULL);
|
||||
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, "/desktop/gnome/typing_break/break_time", NULL);
|
||||
client, GCONF_PATH "/break_time", NULL);
|
||||
|
||||
dr->enabled = gconf_client_get_bool (
|
||||
client,
|
||||
"/desktop/gnome/typing_break/enabled",
|
||||
GCONF_PATH "/enabled",
|
||||
NULL);
|
||||
|
||||
if (debug) {
|
||||
|
@ -908,8 +927,8 @@ drwright_new (void)
|
|||
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_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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
@ -21,8 +21,10 @@
|
|||
#ifndef __DR_WRIGHT_H__
|
||||
#define __DR_WRIGHT_H__
|
||||
|
||||
#define GCONF_PATH "/desktop/gnome/typing_break"
|
||||
|
||||
typedef struct _DrWright DrWright;
|
||||
|
||||
DrWright * drwright_new (void);
|
||||
DrWright *drwright_new (void);
|
||||
|
||||
#endif /* __DR_WRIGHT_H__ */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 CodeFactory AB
|
||||
* Copyright (C) 2002-2003 Richard Hult <rhult@codefactory.se>
|
||||
* 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
|
||||
|
@ -24,7 +24,7 @@
|
|||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libgnomeui/libgnomeui.h>
|
||||
#include "drw-intl.h"
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include "drw-selection.h"
|
||||
#include "drwright.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue