aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-06-20 10:45:03 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-06-20 10:45:03 +0800
commitc9e9b9a7bd01883daf4ac57e83233aae40bf1439 (patch)
tree0b643f97f41de9355181a2382766597affba8069
parent9a4a29271b96abd78516fde1c5dda1eea8552251 (diff)
downloadgsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.tar
gsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.tar.gz
gsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.tar.bz2
gsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.tar.lz
gsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.tar.xz
gsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.tar.zst
gsoc2013-evolution-c9e9b9a7bd01883daf4ac57e83233aae40bf1439.zip
added a 'Time zone' setting. Also rearranged a little, adding a new
2001-06-19 Damon Chaplin <damon@ximian.com> * gui/dialogs/cal-prefs-dialog.c: added a 'Time zone' setting. Also rearranged a little, adding a new 'General' page, since we had too many settings on the 'Calendar' page. * gui/e-timezone-entry.[hc]: * gui/dialogs/e-timezone-dialog.[hc]: * gui/dialogs/comp-editor.c: * gui/dialogs/comp-editor-page.[hc]: * gui/dialogs/event-page.c: * gui/dialogs/task-details-page.c: * gui/dialogs/task-page.c: removed CalClient stuff. The timezone dialog now uses the timezone data directly from the client's libical library. svn path=/trunk/; revision=10321
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c19
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade334
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h6
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c18
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h5
-rw-r--r--calendar/gui/dialogs/comp-editor.c5
-rw-r--r--calendar/gui/dialogs/e-timezone-dialog.c193
-rw-r--r--calendar/gui/dialogs/e-timezone-dialog.h5
-rw-r--r--calendar/gui/dialogs/event-page.c15
-rw-r--r--calendar/gui/dialogs/task-details-page.c14
-rw-r--r--calendar/gui/dialogs/task-page.c15
-rw-r--r--calendar/gui/e-timezone-entry.c41
-rw-r--r--calendar/gui/e-timezone-entry.h3
13 files changed, 327 insertions, 346 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 9839318e8e..df030eddd6 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -33,18 +33,20 @@
#include <gal/util/e-util.h>
#include <e-util/e-dialog-widgets.h>
#include <widgets/misc/e-dateedit.h>
+#include "../e-timezone-entry.h"
#include "cal-prefs-dialog.h"
#include "../calendar-config.h"
#include "../calendar-commands.h"
#include "../e-tasks.h"
-typedef struct {
+struct _CalPrefsDialogPrivate {
/* Glade XML data */
GladeXML *xml;
GtkWidget *dialog;
+ GtkWidget *timezone;
GtkWidget *working_days[7];
GtkWidget *week_start_day;
GtkWidget *start_of_day;
@@ -55,7 +57,7 @@ typedef struct {
GtkWidget *show_end_times;
GtkWidget *compress_weekend;
GtkWidget *dnav_show_week_no;
-} CalPrefsDialogPrivate;
+};
static const int week_start_day_map[] = {
1, 2, 3, 4, 5, 6, 0, -1
@@ -196,6 +198,7 @@ get_widgets (CalPrefsDialog *prefs)
priv->working_days[5] = GW ("fri_button");
priv->working_days[6] = GW ("sat_button");
+ priv->timezone = GW ("timezone");
priv->week_start_day = GW ("first_day_of_week");
priv->start_of_day = GW ("start_of_day");
priv->end_of_day = GW ("end_of_day");
@@ -209,6 +212,7 @@ get_widgets (CalPrefsDialog *prefs)
#undef GW
return (priv->dialog
+ && priv->timezone
&& priv->working_days[0]
&& priv->working_days[1]
&& priv->working_days[2]
@@ -347,9 +351,15 @@ cal_prefs_dialog_show_config (CalPrefsDialog *prefs)
CalPrefsDialogPrivate *priv;
CalWeekdays working_days;
gint mask, day, week_start_day, time_divisions;
+ char *zone;
priv = prefs->priv;
+ /* Timezone. */
+ zone = calendar_config_get_timezone ();
+ e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->timezone),
+ zone ? zone : "");
+
/* Working Days. */
working_days = calendar_config_get_working_days ();
mask = 1 << 0;
@@ -403,9 +413,14 @@ cal_prefs_dialog_update_config (CalPrefsDialog *prefs)
CalPrefsDialogPrivate *priv;
CalWeekdays working_days;
gint mask, day, week_start_day, time_divisions, hour, minute;
+ char *zone;
priv = prefs->priv;
+ /* Timezone. */
+ zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->timezone));
+ calendar_config_set_timezone (zone);
+
/* Working Days. */
working_days = 0;
mask = 1 << 0;
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade
index f6eccb163d..bf45b072ce 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -98,13 +98,163 @@
<widget>
<class>GtkVBox</class>
- <name>vbox8</name>
+ <name>vbox10</name>
<border_width>4</border_width>
<homogeneous>False</homogeneous>
<spacing>6</spacing>
<widget>
<class>GtkFrame</class>
+ <name>frame12</name>
+ <label>Time</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table5</name>
+ <border_width>4</border_width>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>4</row_spacing>
+ <column_spacing>4</column_spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label22</name>
+ <label>Time zone:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>Custom</class>
+ <name>timezone</name>
+ <creation_function>make_timezone_entry</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Wed, 20 Jun 2001 02:22:46 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label20</name>
+ <label>Time format:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox10</name>
+ <homogeneous>True</homogeneous>
+ <spacing>4</spacing>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>use_12_hour</name>
+ <can_focus>True</can_focus>
+ <label>12 hour (am/pm)</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>time_format_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>use_24_hour</name>
+ <can_focus>True</can_focus>
+ <label>24 hour</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>time_format_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
<name>frame9</name>
<label>Work week</label>
<label_xalign>0</label_xalign>
@@ -358,6 +508,31 @@ Sunday
</widget>
<widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label21</name>
+ <label>General</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox8</name>
+ <border_width>4</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>6</spacing>
+
+ <widget>
<class>GtkFrame</class>
<name>frame10</name>
<label>Display options</label>
@@ -373,8 +548,8 @@ Sunday
<class>GtkTable</class>
<name>table4</name>
<border_width>4</border_width>
- <rows>4</rows>
- <columns>3</columns>
+ <rows>3</rows>
+ <columns>7</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>4</column_spacing>
@@ -392,8 +567,8 @@ Sunday
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -406,46 +581,56 @@ Sunday
</widget>
<widget>
- <class>GtkLabel</class>
- <name>label20</name>
- <label>Time format:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
+ <class>GtkAlignment</class>
+ <name>alignment4</name>
+ <xalign>7.45058e-09</xalign>
<yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <xscale>0</xscale>
+ <yscale>1</yscale>
<child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>time_divisions</name>
+ <can_focus>True</can_focus>
+ <items>60 minutes
+30 minutes
+15 minutes
+10 minutes
+05 minutes
+</items>
+ <initial_choice>0</initial_choice>
+ </widget>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>show_end_times</name>
<can_focus>True</can_focus>
- <label>Show appointment end times</label>
+ <label>Show appointment end times in week and month views</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>0</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
+ <right_attach>7</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
@@ -458,35 +643,14 @@ Sunday
<class>GtkCheckButton</class>
<name>compress_weekend</name>
<can_focus>True</can_focus>
- <label>Compress weekends</label>
+ <label>Compress weekends in month view</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>0</left_attach>
- <right_attach>3</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox10</name>
- <homogeneous>True</homogeneous>
- <spacing>4</spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
+ <right_attach>7</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -496,72 +660,6 @@ Sunday
<xfill>True</xfill>
<yfill>True</yfill>
</child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>use_12_hour</name>
- <can_focus>True</can_focus>
- <label>12 hour (am/pm)</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>time_format_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>use_24_hour</name>
- <can_focus>True</can_focus>
- <label>24 hour</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>time_format_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment4</name>
- <xalign>7.45058e-09</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>1</yscale>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>time_divisions</name>
- <can_focus>True</can_focus>
- <items>60 minutes
-30 minutes
-15 minutes
-10 minutes
-05 minutes
-</items>
- <initial_choice>0</initial_choice>
- </widget>
</widget>
</widget>
</widget>
@@ -963,18 +1061,18 @@ Sunday
<widget>
<class>GtkVBox</class>
<name>vbox6</name>
+ <border_width>4</border_width>
<homogeneous>False</homogeneous>
- <spacing>0</spacing>
+ <spacing>6</spacing>
<widget>
<class>GtkFrame</class>
<name>frame6</name>
- <border_width>4</border_width>
<label>Defaults</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
- <padding>4</padding>
+ <padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
@@ -1046,12 +1144,11 @@ Sunday
<widget>
<class>GtkFrame</class>
<name>frame7</name>
- <border_width>4</border_width>
<label>Visual Alarms</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
- <padding>4</padding>
+ <padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
@@ -1070,12 +1167,11 @@ Sunday
<widget>
<class>GtkFrame</class>
<name>frame8</name>
- <border_width>4</border_width>
<label>Audio Alarms</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
- <padding>4</padding>
+ <padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 9d744f806d..58d7880e2d 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -45,12 +45,14 @@ BEGIN_GNOME_DECLS
typedef struct _CalPrefsDialog CalPrefsDialog;
typedef struct _CalPrefsDialogClass CalPrefsDialogClass;
+typedef struct _CalPrefsDialogPrivate CalPrefsDialogPrivate;
+
struct _CalPrefsDialog
{
GtkObject object;
- /* Private data */
- gpointer priv;
+ /*< private >*/
+ CalPrefsDialogPrivate *priv;
};
struct _CalPrefsDialogClass
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c
index 005314d0c0..afa09177f5 100644
--- a/calendar/gui/dialogs/comp-editor-page.c
+++ b/calendar/gui/dialogs/comp-editor-page.c
@@ -136,7 +136,6 @@ comp_editor_page_class_init (CompEditorPageClass *class)
class->fill_component = NULL;
class->set_summary = NULL;
class->set_dates = NULL;
- class->set_cal_client = NULL;
}
@@ -199,23 +198,6 @@ comp_editor_page_fill_component (CompEditorPage *page, CalComponent *comp)
}
/**
- * comp_editor_page_set_cal_client:
- * @page: An editor page
- * @client: A #CalClient object
- *
- * Sets the #CalClient for the dialog page to use.
- **/
-void
-comp_editor_page_set_cal_client (CompEditorPage *page, CalClient *client)
-{
- g_return_if_fail (page != NULL);
- g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
-
- if (CLASS (page)->set_cal_client != NULL)
- (* CLASS (page)->set_cal_client) (page, client);
-}
-
-/**
* comp_editor_page_set_summary:
* @page: An editor page
* @summary: The text of the new summary value
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index c4c31852cf..b544200a76 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -26,7 +26,6 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkwidget.h>
#include <cal-util/cal-component.h>
-#include "cal-client.h"
BEGIN_GNOME_DECLS
@@ -69,8 +68,6 @@ typedef struct {
void (* set_summary) (CompEditorPage *page, const char *summary);
void (* set_dates) (CompEditorPage *page, CompEditorPageDates *dates);
-
- void (* set_cal_client) (CompEditorPage *page, CalClient *client);
} CompEditorPageClass;
@@ -80,8 +77,6 @@ void comp_editor_page_fill_widgets (CompEditorPage *page,
CalComponent *comp);
void comp_editor_page_fill_component (CompEditorPage *page,
CalComponent *comp);
-void comp_editor_page_set_cal_client (CompEditorPage *page,
- CalClient *client);
void comp_editor_page_set_summary (CompEditorPage *page,
const char *summary);
void comp_editor_page_set_dates (CompEditorPage *page,
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index bdcaefd269..bdf5c39737 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -359,7 +359,6 @@ void
comp_editor_set_cal_client (CompEditor *editor, CalClient *client)
{
CompEditorPrivate *priv;
- GList *elem;
g_return_if_fail (editor != NULL);
g_return_if_fail (IS_COMP_EDITOR (editor));
@@ -383,10 +382,6 @@ comp_editor_set_cal_client (CompEditor *editor, CalClient *client)
}
priv->client = client;
-
- /* Pass the client to any pages that need it. */
- for (elem = priv->pages; elem; elem = elem->next)
- comp_editor_page_set_cal_client (elem->data, client);
}
/**
diff --git a/calendar/gui/dialogs/e-timezone-dialog.c b/calendar/gui/dialogs/e-timezone-dialog.c
index d515ede197..199abbeb3f 100644
--- a/calendar/gui/dialogs/e-timezone-dialog.c
+++ b/calendar/gui/dialogs/e-timezone-dialog.c
@@ -26,6 +26,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtklabel.h>
#include <gnome.h>
+#include <ical.h>
#include <glade/glade.h>
#include <widgets/misc/e-map.h>
#include "e-timezone-dialog.h"
@@ -39,11 +40,6 @@ struct _ETimezoneDialogPrivate {
/* Glade XML data */
GladeXML *xml;
- /* Client to use */
- CalClient *client;
-
- GArray *zones;
-
EMapPoint *point_selected;
EMapPoint *point_hover;
@@ -158,12 +154,6 @@ e_timezone_dialog_destroy (GtkObject *object)
priv->timeout_id = 0;
}
- if (priv->client) {
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), etd);
- gtk_object_unref (GTK_OBJECT (priv->client));
- priv->client = NULL;
- }
-
if (priv->xml) {
gtk_object_unref (GTK_OBJECT (priv->xml));
priv->xml = NULL;
@@ -177,6 +167,57 @@ e_timezone_dialog_destroy (GtkObject *object)
}
+static void
+e_timezone_dialog_add_timezones (ETimezoneDialog *etd)
+{
+ ETimezoneDialogPrivate *priv;
+ icalarray *zones;
+ GtkWidget *listitem;
+ GtkCombo *combo;
+ int i;
+
+ priv = etd->priv;
+
+ combo = GTK_COMBO (priv->timezone_combo);
+
+ /* Clear any existing items in the combo. */
+ gtk_list_clear_items (GTK_LIST (combo->list), 0, -1);
+
+ /* Put the "None" and "UTC" entries at the top of the combo's list.
+ When "None" is selected we want the field to be cleared. */
+ listitem = gtk_list_item_new_with_label (_("None"));
+ gtk_widget_show (listitem);
+ gtk_container_add (GTK_CONTAINER (combo->list), listitem);
+ gtk_combo_set_item_string (combo, GTK_ITEM (listitem), "");
+
+ /* Note: We don't translate timezone names at the moment. */
+ listitem = gtk_list_item_new_with_label ("UTC");
+ gtk_widget_show (listitem);
+ gtk_container_add (GTK_CONTAINER (combo->list), listitem);
+
+ /* Get the array of builtin timezones. */
+ zones = icaltimezone_get_builtin_timezones ();
+
+ for (i = 0; i < zones->num_elements; i++) {
+ icaltimezone *zone;
+ char *location;
+
+ zone = icalarray_element_at (zones, i);
+
+ location = icaltimezone_get_location (zone);
+
+ e_map_add_point (priv->map, location,
+ icaltimezone_get_longitude (zone),
+ icaltimezone_get_latitude (zone),
+ E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
+
+ listitem = gtk_list_item_new_with_label (location);
+ gtk_widget_show (listitem);
+ gtk_container_add (GTK_CONTAINER (combo->list), listitem);
+ }
+}
+
+
ETimezoneDialog *
e_timezone_dialog_construct (ETimezoneDialog *etd)
{
@@ -210,6 +251,8 @@ e_timezone_dialog_construct (ETimezoneDialog *etd)
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (priv->timezone_combo)->entry), FALSE);
+ e_timezone_dialog_add_timezones (etd);
+
gtk_container_add (GTK_CONTAINER (priv->map_window), map);
gtk_widget_show (map);
@@ -428,26 +471,34 @@ get_zone_from_point (ETimezoneDialog *etd,
EMapPoint *point)
{
ETimezoneDialogPrivate *priv;
- CalTimezoneInfo *zone;
+ icalarray *zones;
double longitude, latitude;
int i;
priv = etd->priv;
- if (point == NULL || priv->zones == NULL)
+ if (point == NULL)
return "";
e_map_point_get_location (point, &longitude, &latitude);
- for (i = 0; i < priv->zones->len; i++) {
- zone = &g_array_index (priv->zones, CalTimezoneInfo, i);
+ /* Get the array of builtin timezones. */
+ zones = icaltimezone_get_builtin_timezones ();
+
+ for (i = 0; i < zones->num_elements; i++) {
+ icaltimezone *zone;
+ double zone_longitude, zone_latitude;
+
+ zone = icalarray_element_at (zones, i);
+ zone_longitude = icaltimezone_get_longitude (zone);
+ zone_latitude = icaltimezone_get_latitude (zone);
- if (zone->longitude - 0.005 <= longitude &&
- zone->longitude + 0.005 >= longitude &&
- zone->latitude - 0.005 <= latitude &&
- zone->latitude + 0.005 >= latitude)
+ if (zone_longitude - 0.005 <= longitude &&
+ zone_longitude + 0.005 >= longitude &&
+ zone_latitude - 0.005 <= latitude &&
+ zone_latitude + 0.005 >= latitude)
{
- return zone->location;
+ return icaltimezone_get_location (zone);
}
}
@@ -457,78 +508,6 @@ get_zone_from_point (ETimezoneDialog *etd,
}
-CalClient*
-e_timezone_dialog_get_cal_client (ETimezoneDialog *etd)
-{
-
- return etd->priv->client;
-}
-
-
-void
-e_timezone_dialog_set_cal_client (ETimezoneDialog *etd,
- CalClient *client)
-{
- ETimezoneDialogPrivate *priv;
- CalTimezoneInfo *zone;
- GtkWidget *listitem;
- GtkCombo *combo;
- char *current_zone;
- int i;
-
- g_return_if_fail (etd != NULL);
- g_return_if_fail (E_IS_TIMEZONE_DIALOG (etd));
- g_return_if_fail (IS_CAL_CLIENT (client));
-
- priv = etd->priv;
-
- combo = GTK_COMBO (priv->timezone_combo);
-
- /* Clear any existing items */
- gtk_list_clear_items (GTK_LIST (combo->list), 0, -1);
-
- priv->zones = cal_client_get_builtin_timezone_info (client);
-
- if (!priv->zones) {
- g_warning ("No timezone info found");
- return;
- }
-
- /* Put the "None" and "UTC" entries at the top of the combo's list.
- When "None" is selected we want the field to be cleared. */
- listitem = gtk_list_item_new_with_label (_("None"));
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (combo->list), listitem);
- gtk_combo_set_item_string (combo, GTK_ITEM (listitem), "");
-
- /* Note: We don't translate timezone names at the moment. */
- listitem = gtk_list_item_new_with_label ("UTC");
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (combo->list), listitem);
-
- current_zone = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->timezone_combo)->entry));
-
- for (i = 0; i < priv->zones->len; i++) {
- zone = &g_array_index (priv->zones, CalTimezoneInfo, i);
- if (!strcmp (current_zone, zone->location)) {
- priv->point_selected = e_map_add_point (priv->map,
- zone->location,
- zone->longitude,
- zone->latitude,
- E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
- } else {
- e_map_add_point (priv->map, zone->location,
- zone->longitude, zone->latitude,
- E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
- }
-
- listitem = gtk_list_item_new_with_label (zone->location);
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (combo->list), listitem);
- }
-}
-
-
char*
e_timezone_dialog_get_timezone (ETimezoneDialog *etd)
{
@@ -581,26 +560,36 @@ static void
find_selected_point (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
- CalTimezoneInfo *zone;
+ icalarray *zones;
char *current_zone;
EMapPoint *point = NULL;
int i;
priv = etd->priv;
- if (priv->zones == NULL)
- return;
-
current_zone = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->timezone_combo)->entry));
- for (i = 0; i < priv->zones->len; i++) {
- zone = &g_array_index (priv->zones, CalTimezoneInfo, i);
- if (!strcmp (current_zone, zone->location)) {
+ /* Get the array of builtin timezones. */
+ zones = icaltimezone_get_builtin_timezones ();
+
+ for (i = 0; i < zones->num_elements; i++) {
+ icaltimezone *zone;
+ char *location;
+
+ zone = icalarray_element_at (zones, i);
+
+ location = icaltimezone_get_location (zone);
+
+ if (!strcmp (current_zone, location)) {
+ double zone_longitude, zone_latitude;
+
+ zone_longitude = icaltimezone_get_longitude (zone);
+ zone_latitude = icaltimezone_get_latitude (zone);
+
point = e_map_get_closest_point (priv->map,
- zone->longitude,
- zone->latitude,
+ zone_longitude,
+ zone_latitude,
FALSE);
-
break;
}
}
diff --git a/calendar/gui/dialogs/e-timezone-dialog.h b/calendar/gui/dialogs/e-timezone-dialog.h
index bb253934f7..860ced85f8 100644
--- a/calendar/gui/dialogs/e-timezone-dialog.h
+++ b/calendar/gui/dialogs/e-timezone-dialog.h
@@ -24,7 +24,6 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkobject.h>
-#include <cal-client/cal-client.h>
@@ -57,10 +56,6 @@ ETimezoneDialog* e_timezone_dialog_construct (ETimezoneDialog *etd);
ETimezoneDialog* e_timezone_dialog_new (void);
-CalClient* e_timezone_dialog_get_cal_client (ETimezoneDialog *etd);
-void e_timezone_dialog_set_cal_client (ETimezoneDialog *etd,
- CalClient *client);
-
char* e_timezone_dialog_get_timezone (ETimezoneDialog *etd);
void e_timezone_dialog_set_timezone (ETimezoneDialog *etd,
char *timezone);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 8087294012..f653e469ef 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -84,7 +84,6 @@ static void event_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
static void event_page_fill_component (CompEditorPage *page, CalComponent *comp);
static void event_page_set_summary (CompEditorPage *page, const char *summary);
static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
-static void event_page_set_cal_client (CompEditorPage *page, CalClient *client);
static CompEditorPageClass *parent_class = NULL;
@@ -139,7 +138,6 @@ event_page_class_init (EventPageClass *class)
editor_page_class->fill_component = event_page_fill_component;
editor_page_class->set_summary = event_page_set_summary;
editor_page_class->set_dates = event_page_set_dates;
- editor_page_class->set_cal_client = event_page_set_cal_client;
object_class->destroy = event_page_destroy;
}
@@ -512,19 +510,6 @@ event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
/* nothing */
}
-static void
-event_page_set_cal_client (CompEditorPage *page, CalClient *client)
-{
- EventPage *epage;
- EventPagePrivate *priv;
-
- epage = EVENT_PAGE (page);
- priv = epage->priv;
-
- e_timezone_entry_set_cal_client (E_TIMEZONE_ENTRY (priv->start_timezone), client);
- e_timezone_entry_set_cal_client (E_TIMEZONE_ENTRY (priv->end_timezone),client);
-}
-
/* Gets the widgets from the XML file and returns if they are all available. */
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index bde17af2fe..76a3cadcd4 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -68,7 +68,6 @@ static void task_details_page_fill_widgets (CompEditorPage *page, CalComponent *
static void task_details_page_fill_component (CompEditorPage *page, CalComponent *comp);
static void task_details_page_set_summary (CompEditorPage *page, const char *summary);
static void task_details_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
-static void task_details_page_set_cal_client (CompEditorPage *page, CalClient *client);
static CompEditorPageClass *parent_class = NULL;
@@ -124,7 +123,6 @@ task_details_page_class_init (TaskDetailsPageClass *class)
editor_page_class->fill_component = task_details_page_fill_component;
editor_page_class->set_summary = task_details_page_set_summary;
editor_page_class->set_dates = task_details_page_set_dates;
- editor_page_class->set_cal_client = task_details_page_set_cal_client;
object_class->destroy = task_details_page_destroy;
}
@@ -309,18 +307,6 @@ task_details_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
dates->complete);
}
-static void
-task_details_page_set_cal_client (CompEditorPage *page, CalClient *client)
-{
- TaskDetailsPage *tdpage;
- TaskDetailsPagePrivate *priv;
-
- tdpage = TASK_DETAILS_PAGE (page);
- priv = tdpage->priv;
-
- e_timezone_entry_set_cal_client (E_TIMEZONE_ENTRY (priv->completed_timezone), client);
-}
-
/* Gets the widgets from the XML file and returns if they are all available. */
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 340281dd59..02a1e1bfd3 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -119,7 +119,6 @@ static void task_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
static void task_page_fill_component (CompEditorPage *page, CalComponent *comp);
static void task_page_set_summary (CompEditorPage *page, const char *summary);
static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates);
-static void task_page_set_cal_client (CompEditorPage *page, CalClient *client);
static CompEditorPageClass *parent_class = NULL;
@@ -174,7 +173,6 @@ task_page_class_init (TaskPageClass *class)
editor_page_class->fill_component = task_page_fill_component;
editor_page_class->set_summary = task_page_set_summary;
editor_page_class->set_dates = task_page_set_dates;
- editor_page_class->set_cal_client = task_page_set_cal_client;
object_class->destroy = task_page_destroy;
}
@@ -607,19 +605,6 @@ task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
priv->updating = FALSE;
}
-static void
-task_page_set_cal_client (CompEditorPage *page, CalClient *client)
-{
- TaskPage *tpage;
- TaskPagePrivate *priv;
-
- tpage = TASK_PAGE (page);
- priv = tpage->priv;
-
- e_timezone_entry_set_cal_client (E_TIMEZONE_ENTRY (priv->due_timezone), client);
- e_timezone_entry_set_cal_client (E_TIMEZONE_ENTRY (priv->start_timezone),client);
-}
-
/* Gets the widgets from the XML file and returns if they are all available. */
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index 6bf7625c32..ff54a92da4 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -42,8 +42,6 @@
struct _ETimezoneEntryPrivate {
GtkWidget *entry;
GtkWidget *button;
-
- CalClient *client;
};
@@ -175,11 +173,6 @@ e_timezone_entry_destroy (GtkObject *object)
tentry = E_TIMEZONE_ENTRY (object);
priv = tentry->priv;
- if (priv->client) {
- gtk_object_unref (GTK_OBJECT (priv->client));
- priv->client = NULL;
- }
-
g_free (tentry->priv);
tentry->priv = NULL;
@@ -202,7 +195,6 @@ on_button_clicked (GtkWidget *widget,
priv = tentry->priv;
timezone_dialog = e_timezone_dialog_new ();
- e_timezone_dialog_set_cal_client (timezone_dialog, priv->client);
zone = e_timezone_entry_get_timezone (tentry);
e_timezone_dialog_set_timezone (timezone_dialog, zone);
@@ -217,39 +209,6 @@ on_button_clicked (GtkWidget *widget,
}
-/**
- * e_timezone_entry_set_cal_client:
- * @tentry: An #ETimezoneEntry.
- * @client: Calendar client.
- *
- * Sets the calendar client that the timezone entry uses to get the timezone
- * information.
- **/
-void
-e_timezone_entry_set_cal_client (ETimezoneEntry *tentry, CalClient *client)
-{
- ETimezoneEntryPrivate *priv;
-
- g_return_if_fail (tentry != NULL);
- g_return_if_fail (E_IS_TIMEZONE_ENTRY (tentry));
-
- priv = tentry->priv;
-
- if (client == priv->client)
- return;
-
- if (client) {
- g_return_if_fail (IS_CAL_CLIENT (client));
- gtk_object_ref (GTK_OBJECT (client));
- }
-
- if (priv->client)
- gtk_object_unref (GTK_OBJECT (priv->client));
-
- priv->client = client;
-}
-
-
static void
on_entry_changed (GtkEntry *entry,
ETimezoneEntry *tentry)
diff --git a/calendar/gui/e-timezone-entry.h b/calendar/gui/e-timezone-entry.h
index f5a32915a2..0eadf1bef0 100644
--- a/calendar/gui/e-timezone-entry.h
+++ b/calendar/gui/e-timezone-entry.h
@@ -67,9 +67,6 @@ struct _ETimezoneEntryClass {
guint e_timezone_entry_get_type (void);
GtkWidget* e_timezone_entry_new (void);
-void e_timezone_entry_set_cal_client (ETimezoneEntry *tentry,
- CalClient *client);
-
char* e_timezone_entry_get_timezone (ETimezoneEntry *tentry);
void e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
char *timezone);