Commit 5882f3c1 authored by Vincent Untz's avatar Vincent Untz Committed by Vincent Untz
Browse files

Changes needed for the support for timezones in the clock applet. Bug

2007-07-05  Vincent Untz  <vuntz@gnome.org>

	Changes needed for the support for timezones in the clock applet.
	Bug #88754.

	* configure.in: check for glade for the clock applet, check for
	solaris build and add new Makefile
	* icons/world_map-960.png: new
	* icons/Makefile.am: add new file

2007-07-05  Vincent Untz  <vuntz@gnome.org>

	Add support for timezones. This needs some more work and testing on
	various OS. I'm not sure the tz.c part work well outside of Linux, eg.
	Fix bug #88754.

	* Makefile.am: add new files, and other updates needed for this commit
	* calendar-window.c: make gconf keys #define
	(calendar_window_destroy): unref the gconf client
	* calendar-window.h: small update
	* clock-utils.[ch]: new file, containing some common code:
	clock_locale_format() and clock_utils_display_help()
	* clock.h: small update
	* clock.c: make gconf keys #define
	(set_tooltip): kill
	(update_clock): update the tz popup too with the new time
	(update_tooltip): use gtk_widget_set_tooltip_text()
	(destroy_clock): updated
	(close_on_escape): make a bit more generic
	(delete_event): ditto
	(clock_locale_format): moved to clock-utils.c
	(create_calendar): updated
	(create_tz): new
	(position_calendar_popup): updated to be a bit more simple
	(position_tz_popup): new
	(present_calendar_popup): killed
	(update_calendar_popup): renamed from update_popup, close the tz popup
	if it's open
	(update_tz_popup): new, based on update_calendar_popup()
	(toggle_calendar): updated
	(toggle_timezone): new
	(toggle_timezone_shown): new
	(toggle_timezone_hidden): new
	(create_clock_widget): updated, and added the obox and the tz toggle
	(applet_change_orient): change obox orientation and the direction of
	the arrow in the tz toggle
	(format_changed): updated
	(gmt_time_changed): updated
	(show_week_changed): updated
	(show_tz_changed): new
	(setup_gconf): add new listener
	(fill_clock_applet): updated
	(set_show_zones_cb): new
	(properties_response_cb): use clock_utils_display_help()
	(display_properties_dialog): updated for the new checkbox
	(display_help_dialog): use clock_utils_display_help()
	* clock.schemas.in: add new show_timezones and timezones/tz_id_list
	keys
	* e-map/*: e-map code, taken from evolution/gnome-system-tools
	* obox.[ch]: new, stolen from the notification area
	* tz-list.[ch]: new, handles configuration related to the timezones.
	* tz-sel-dialog.[ch]: new, a dialog to handle timezone configuration
	* timezone.glade: new, glade file for the timezone configuration
	dialog
	* tz-window.[ch]: new, a popup similar to the calendar popup showing
	selected timezones
	* tz.[ch]: new, read timezone information from the OS. It's based on
	code taken from anaconda/evolution/gnome-system-tools. The data is
	shared among all instances in the process.

svn path=/trunk/; revision=10532
parent ebd18933
2007-07-05 Vincent Untz <vuntz@gnome.org>
Changes needed for the support for timezones in the clock applet.
Bug #88754.
* configure.in: check for glade for the clock applet, check for
solaris build and add new Makefile
* icons/world_map-960.png: new
* icons/Makefile.am: add new file
2007-07-03 Bastien Nocera <hadess@hadess.net>
* doc/gnome-panel-action-protocol.txt: Update the documentation
......
2007-07-05 Vincent Untz <vuntz@gnome.org>
Add support for timezones. This needs some more work and testing on
various OS. I'm not sure the tz.c part work well outside of Linux, eg.
Fix bug #88754.
* Makefile.am: add new files, and other updates needed for this commit
* calendar-window.c: make gconf keys #define
(calendar_window_destroy): unref the gconf client
* calendar-window.h: small update
* clock-utils.[ch]: new file, containing some common code:
clock_locale_format() and clock_utils_display_help()
* clock.h: small update
* clock.c: make gconf keys #define
(set_tooltip): kill
(update_clock): update the tz popup too with the new time
(update_tooltip): use gtk_widget_set_tooltip_text()
(destroy_clock): updated
(close_on_escape): make a bit more generic
(delete_event): ditto
(clock_locale_format): moved to clock-utils.c
(create_calendar): updated
(create_tz): new
(position_calendar_popup): updated to be a bit more simple
(position_tz_popup): new
(present_calendar_popup): killed
(update_calendar_popup): renamed from update_popup, close the tz popup
if it's open
(update_tz_popup): new, based on update_calendar_popup()
(toggle_calendar): updated
(toggle_timezone): new
(toggle_timezone_shown): new
(toggle_timezone_hidden): new
(create_clock_widget): updated, and added the obox and the tz toggle
(applet_change_orient): change obox orientation and the direction of
the arrow in the tz toggle
(format_changed): updated
(gmt_time_changed): updated
(show_week_changed): updated
(show_tz_changed): new
(setup_gconf): add new listener
(fill_clock_applet): updated
(set_show_zones_cb): new
(properties_response_cb): use clock_utils_display_help()
(display_properties_dialog): updated for the new checkbox
(display_help_dialog): use clock_utils_display_help()
* clock.schemas.in: add new show_timezones and timezones/tz_id_list
keys
* e-map/*: e-map code, taken from evolution/gnome-system-tools
* obox.[ch]: new, stolen from the notification area
* tz-list.[ch]: new, handles configuration related to the timezones.
* tz-sel-dialog.[ch]: new, a dialog to handle timezone configuration
* timezone.glade: new, glade file for the timezone configuration
dialog
* tz-window.[ch]: new, a popup similar to the calendar popup showing
selected timezones
* tz.[ch]: new, read timezone information from the OS. It's based on
code taken from anaconda/evolution/gnome-system-tools. The data is
shared among all instances in the process.
2007-06-27 Ross Burton <ross@openedhand.com>
* calendar-window.c:
......
SUBDIRS = e-map
INCLUDES = \
-I$(srcdir)/../../libpanel-applet \
-I$(top_builddir)/libpanel-applet \
......@@ -7,6 +9,7 @@ INCLUDES = \
$(CLOCK_CFLAGS) \
$(LIBPANEL_APPLET_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DGLADEDIR=\""$(datadir)/gnome-panel/glade"\" \
-DLIBDIR=\""$(libdir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
......@@ -26,13 +29,26 @@ endif
CLOCK_SOURCES = \
calendar-window.c \
calendar-window.h \
tz-window.c \
tz-window.h \
tz-sel-dialog.c \
tz-sel-dialog.h \
tz-list.c \
tz-list.h \
tz.c \
tz.h \
obox.c \
obox.h \
clock.c \
clock.h \
clock-utils.c \
clock-utils.h \
$(BUILT_SOURCES) \
$(CALENDAR_SOURCES)
CLOCK_LDADD = \
../../libpanel-applet/libpanel-applet-2.la \
e-map/libemap.a \
$(CLOCK_LIBS)
BUILT_SOURCES = \
......@@ -40,7 +56,7 @@ BUILT_SOURCES = \
clock-typebuiltins.h
clock_enum_headers = \
$(top_srcdir)/applets/clock/clock.h
$(top_srcdir)/applets/clock/clock-utils.h
clock-typebuiltins.c: @REBUILD@ $(clock_enum_headers)
glib-mkenums --fhead "#include <glib-object.h>\n" \
......@@ -90,6 +106,9 @@ clock_applet_CFLAGS =
$(clock_applet_OBJECTS): $(BUILT_SOURCES)
endif
gladedir = $(datadir)/gnome-panel/glade
glade_DATA = timezone.glade
uidir = $(datadir)/gnome-2.0/ui
ui_DATA = GNOME_ClockApplet.xml
......
......@@ -45,6 +45,7 @@
#include "calendar-window.h"
#include "clock.h"
#include "clock-utils.h"
#include "clock-typebuiltins.h"
#ifdef HAVE_LIBECAL
#include "calendar-client.h"
......@@ -55,10 +56,10 @@
#ifdef HAVE_LIBECAL
#define N_CALENDAR_WINDOW_GCONF_PREFS 4
static const char* KEY_APPOINTMENTS_EXPANDED = "expand_appointments";
static const char* KEY_BIRTHDAYS_EXPANDED = "expand_birthdays";
static const char* KEY_TASKS_EXPANDED = "expand_tasks";
static const char* KEY_WEATHER_EXPANDED = "expand_weather";
#define KEY_APPOINTMENTS_EXPANDED "expand_appointments"
#define KEY_BIRTHDAYS_EXPANDED "expand_birthdays"
#define KEY_TASKS_EXPANDED "expand_tasks"
#define KEY_WEATHER_EXPANDED "expand_weather"
#endif
struct _CalendarWindowPrivate {
......@@ -1591,6 +1592,10 @@ calendar_window_destroy (GtkObject *object)
calwin->priv->listeners [i]);
calwin->priv->listeners [i] = 0;
}
if (calwin->priv->gconfclient)
g_object_unref (calwin->priv->gconfclient);
calwin->priv->gconfclient = NULL;
#endif /* HAVE_LIBECAL */
GTK_OBJECT_CLASS (calendar_window_parent_class)->destroy (object);
......
......@@ -29,7 +29,7 @@
#define CALENDAR_WINDOW_H
#include <gtk/gtk.h>
#include "clock.h"
#include "clock-utils.h"
G_BEGIN_DECLS
......
/*
* clock-utils.c
*
* Copyright (C) 2007 Vincent Untz <vuntz@gnome.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Authors:
* Vincent Untz <vuntz@gnome.org>
*
* Most of the original code comes from clock.c
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libgnomeui/gnome-help.h>
#include "clock-utils.h"
ClockFormat
clock_locale_format (void)
{
#ifdef HAVE_NL_LANGINFO
const char *am;
am = nl_langinfo (AM_STR);
return (am[0] == '\0') ? CLOCK_FORMAT_24 : CLOCK_FORMAT_12;
#else
return CLOCK_FORMAT_24;
#endif
}
void
clock_utils_display_help (GtkWidget *widget,
const char *doc_id,
const char *filename,
const char *link_id)
{
GError *error = NULL;
gnome_help_display_desktop_on_screen (NULL, doc_id, filename, link_id,
gtk_widget_get_screen (widget),
&error);
if (error) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
_("There was an error displaying help: %s"),
error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_widget_get_screen (widget));
gtk_widget_show (dialog);
g_error_free (error);
}
}
/*
* clock-utils.h
*
* Copyright (C) 2007 Vincent Untz <vuntz@gnome.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Authors:
* Vincent Untz <vuntz@gnome.org>
*
* Most of the original code comes from clock.c
*/
#ifndef __CLOCK_UTILS_H__
#define __CLOCK_UTILS_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
/* Needs to match the indices in the combo of the prefs dialog */
typedef enum {
CLOCK_FORMAT_INVALID = 0,
CLOCK_FORMAT_12,
CLOCK_FORMAT_24,
CLOCK_FORMAT_UNIX,
CLOCK_FORMAT_INTERNET,
CLOCK_FORMAT_CUSTOM
} ClockFormat;
ClockFormat clock_locale_format (void);
void clock_utils_display_help (GtkWidget *widget,
const char *doc_id,
const char *filename,
const char *link_id);
G_END_DECLS
#endif /* __CLOCK_UTILS_H__ */
This diff is collapsed.
......@@ -30,18 +30,7 @@
G_BEGIN_DECLS
#define CLOCK_ICON "gnome-panel-clock"
/* Needs to match the indices in the combo of the prefs dialog */
typedef enum {
CLOCK_FORMAT_INVALID = 0,
CLOCK_FORMAT_12,
CLOCK_FORMAT_24,
CLOCK_FORMAT_UNIX,
CLOCK_FORMAT_INTERNET,
CLOCK_FORMAT_CUSTOM
} ClockFormat;
ClockFormat clock_locale_format (void);
#define CLOCK_SCHEMA_DIR "/schemas/apps/clock_applet/prefs"
G_END_DECLS
......
<?xml version="1.0"?>
<gconfschemafile>
<schemalist>
......@@ -183,6 +184,65 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/clock_applet/prefs/show_timezones</key>
<owner>clock-applet</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Show the timezone button</short>
<long>
If true, display the timezone button in the clock, in addition to
time.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/clock_applet/prefs/timezones/tz_id_list</key>
<owner>clock-applet</owner>
<type>list</type>
<list_type>string</list_type>
<default>[]</default>
<locale name="C">
<short>Timezone ID list</short>
<long>
A list of timezone IDs. Each ID identifies an individual timezone.
The settings of these timezones are stored in the $(id)_name and
$(id)_zone keys.
</long>
</locale>
</schema>
<!--
<schema>
<key>/schemas/apps/clock_applet/prefs/timezones/timezone_name</key>
<owner>clock-applet</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>User-visible name of the timezone</short>
<long>
This key specifies the user-visible name of the timezone.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/clock_applet/prefs/timezones/timezone_zone</key>
<owner>clock-applet</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Name of the timezone</short>
<long>
This key specifies the name of the timezone as can be used in the
TZ environment variable.
</long>
</locale>
</schema>
-->
<schema>
<key>/schemas/apps/clock_applet/prefs/hour_format</key>
<owner>clock-applet</owner>
......
INCLUDES = \
-DMAP_DIR=\""$(datadir)/gnome-panel/pixmaps"\" \
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
$(DISABLE_DEPRECATED_CFLAGS) \
$(WARN_CFLAGS) \
$(CLOCK_CFLAGS)
EXTRA_DIST= e-map-marshal.list
e-map-marshal.h: e-map-marshal.list
( @GLIB_GENMARSHAL@ $< --header > e-map-marshal.tmp \
&& mv e-map-marshal.tmp e-map-marshal.h ) \
|| ( rm -f e-map-marshal.tmp && exit 1 )
e-map-marshal.c: e-map-marshal.list e-map-marshal.h
( echo "#include \"e-map-marshal.h\"" > e-map-marshal.tmp \
&& @GLIB_GENMARSHAL@ $< --body >> e-map-marshal.tmp \
&& mv e-map-marshal.tmp e-map-marshal.c ) \
|| ( rm -f e-map-marshal.tmp && exit 1 )
$(e_map_la_OBJECTS): e-map-marshal.h
noinst_LIBRARIES = libemap.a
libemap_a_CFLAGS = \
$(GNOME_CFLAGS) \
$(GDK_PIXBUF_CFLAGS)
BUILT_SOURCES= e-map-marshal.c e-map-marshal.h
libemap_a_SOURCES = \
e-map.c e-map.h \
e-map-marshal.c e-map-marshal.h
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Map widget.
*
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Authors: Hans Petter Jansson <hpj@ximian.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 E_MAP_H
#define E_MAP_H
#include <gtk/gtkwidget.h>
#define TYPE_E_MAP (e_map_get_type ())
#define E_MAP(obj) (GTK_CHECK_CAST ((obj), TYPE_E_MAP, EMap))
#define E_MAP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_E_MAP, EMapClass))
#define IS_E_MAP(obj) (GTK_CHECK_TYPE ((obj), TYPE_E_MAP))
#define IS_E_MAP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_E_MAP))
typedef struct _EMap EMap;
typedef struct _EMapClass EMapClass;
typedef struct _EMapPoint EMapPoint;
struct _EMap
{
GtkWidget widget;
/* Private data */
gpointer priv;
};
struct _EMapClass
{
GtkWidgetClass parent_class;
/* Notification signals */
void (*zoom_fit) (EMap * view);
/* GTK+ scrolling interface */
void (*set_scroll_adjustments) (GtkWidget * widget,
GtkAdjustment * hadj,
GtkAdjustment * vadj);
};
/* The definition of Dot */
struct _EMapPoint
{
gchar *name; /* Can be NULL */
double longitude, latitude;
guint32 rgba;
gpointer user_data;
};
/* --- Widget --- */
GtkType e_map_get_type (void);
EMap *e_map_new (void);
/* Stop doing redraws when map data changes (e.g. by modifying points) */
void e_map_freeze (EMap *map);
/* Do an immediate repaint, and start doing realtime repaints again */
void e_map_thaw (EMap *map);
/* --- Coordinate translation --- */
/* Translates window-relative coords to lat/long */
void e_map_window_to_world (EMap *map,
double win_x, double win_y,
double *world_longitude, double *world_latitude);
/* Translates lat/long to window-relative coordinates. Note that the
* returned coordinates can be negative or greater than the current size
* of the allocation area */
void e_map_world_to_window (EMap *map,
double world_longitude, double world_latitude,
double *win_x, double *win_y);
/* --- Zoom --- */
double e_map_get_magnification (EMap *map);
/* Pass TRUE if we want the smooth zoom hack */
void e_map_set_smooth_zoom (EMap *map, gboolean state);
/* TRUE if smooth zoom hack will be employed */
gboolean e_map_get_smooth_zoom (EMap *map);
/* NB: Function definition will change shortly */
void e_map_zoom_to_location (EMap *map, double longitude, double latitude);
/* Zoom to mag factor 1.0 */
void e_map_zoom_out (EMap *map);
/* --- Points --- */
EMapPoint *e_map_add_point (EMap *map, gchar *name,
double longitude, double latitude,
guint32 color_rgba);
void e_map_remove_point (EMap *map, EMapPoint *point);
void e_map_point_get_location (EMapPoint *point,
double *longitude, double *latitude);
gchar *e_map_point_get_name (EMapPoint *point);
guint32 e_map_point_get_color_rgba (EMapPoint *point);
void e_map_point_set_color_rgba (EMap *map, EMapPoint *point, guint32 color_rgba);
void e_map_point_set_data (EMapPoint *point, gpointer data);
gpointer e_map_point_get_data (EMapPoint *point);
gboolean e_map_point_is_in_view (EMap *map, EMapPoint *point);
EMapPoint *e_map_get_closest_point (EMap *map, double longitude, double latitude,
gboolean in_view);
#endif
/* OBox Copyright (C) 2002 Red Hat Inc. based on GtkHBox */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "obox.h"
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
static void clock_obox_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void clock_obox_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
G_DEFINE_TYPE (ClockOBox, clock_obox, GTK_TYPE_BOX)
static void
clock_obox_class_init (ClockOBoxClass *class)
{