aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorJesse Pavel <jpavel@src.gnome.org>2000-10-17 06:30:36 +0800
committerJesse Pavel <jpavel@src.gnome.org>2000-10-17 06:30:36 +0800
commit558571a562252639558836b9aa816020981e5d2f (patch)
tree362d4d706e8ea5d597350aa30885ba1bc48e2855 /calendar/gui
parent7d8cdf100f142e84395764fcf43887b9b2e57633 (diff)
downloadgsoc2013-evolution-558571a562252639558836b9aa816020981e5d2f.tar.gz
gsoc2013-evolution-558571a562252639558836b9aa816020981e5d2f.tar.zst
gsoc2013-evolution-558571a562252639558836b9aa816020981e5d2f.zip
*** empty log message ***
svn path=/trunk/; revision=5950
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-itip-control.c89
-rw-r--r--calendar/gui/e-itip-control.glade104
2 files changed, 186 insertions, 7 deletions
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 463941e6c2..28071be091 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -18,11 +18,13 @@
#include "e-itip-control.h"
#include <cal-util/cal-component.h>
+#include <cal-client/cal-client.h>
#define DEFAULT_WIDTH 500
#define DEFAULT_HEIGHT 400
+extern gchar *evolution_dir;
typedef struct _EItipControlPrivate EItipControlPrivate;
@@ -32,6 +34,9 @@ struct _EItipControlPrivate {
GtkWidget *text_box;
GtkWidget *organizer_entry, *dtstart_label, *dtend_label;
GtkWidget *summary_entry, *description_box;
+ GtkWidget *add_button;
+ GtkWidget *loading_window;
+ GtkWidget *loading_progress;
icalcomponent *main_comp, *comp;
CalComponent *cal_comp;
@@ -63,6 +68,9 @@ itip_control_destroy_cb (GtkObject *object,
icalcomponent_free (priv->main_comp);
}
+ if (priv->cal_comp != NULL) {
+ gtk_object_unref (GTK_OBJECT (priv->cal_comp));
+ }
g_free (priv);
}
@@ -73,6 +81,69 @@ itip_control_size_request_cb (GtkWidget *widget, GtkRequisition *requisition)
requisition->height = DEFAULT_HEIGHT;
}
+static void
+cal_loaded_cb (GtkObject *object, CalClientGetStatus status, gpointer data)
+{
+ CalClient *client = CAL_CLIENT (object);
+ EItipControlPrivate *priv = data;
+
+ gtk_widget_hide (priv->loading_progress);
+
+ if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (cal_client_update_object (client, priv->cal_comp) == FALSE) {
+ GtkWidget *dialog;
+
+ dialog = gnome_warning_dialog("I couldn't update your calendar file!\n");
+ gnome_dialog_run (GNOME_DIALOG(dialog));
+ }
+ else {
+ /* We have success. */
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_dialog("Component successfully added.");
+ gnome_dialog_run (GNOME_DIALOG(dialog));
+ }
+ }
+ else {
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_dialog("There was an error loading the calendar file.");
+ gnome_dialog_run (GNOME_DIALOG(dialog));
+ }
+
+ gtk_object_unref (GTK_OBJECT (client));
+ return;
+}
+
+static void
+add_button_clicked_cb (GtkWidget *widget, gpointer data)
+{
+ EItipControlPrivate *priv = data;
+ gchar cal_uri[255];
+ CalClient *client;
+
+ sprintf (cal_uri, "%s/local/Calendar/calendar.ics", evolution_dir);
+
+ client = cal_client_new ();
+ if (cal_client_load_calendar (client, cal_uri) == FALSE) {
+ GtkWidget *dialog;
+
+ dialog = gnome_warning_dialog("I couldn't open your calendar file!\n");
+ gnome_dialog_run (GNOME_DIALOG(dialog));
+ gtk_object_unref (GTK_OBJECT (client));
+
+ return;
+ }
+
+ gtk_signal_connect (GTK_OBJECT (client), "cal_loaded",
+ GTK_SIGNAL_FUNC (cal_loaded_cb), priv);
+
+ gtk_progress_bar_update (GTK_PROGRESS_BAR (priv->loading_progress), 0.5);
+ gtk_widget_show (priv->loading_progress);
+
+ return;
+}
+
/*
* Bonobo::PersistStream
@@ -178,15 +249,13 @@ pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
return;
}
-#if 0
priv->cal_comp = cal_component_new ();
- if (cal_component_set_icalcomponent (priv->cal_comp, priv->comp) == FALSE)) {
- gtk_object_destroy (GTK_OBJECT (priv->cal_comp));
- icalcomponent_free (main_comp);
+ if (cal_component_set_icalcomponent (priv->cal_comp, priv->comp) == FALSE) {
+ g_printerr ("e-itip-control.c: I couldn't create a CalComponent from the iTip data.\n");
+ gtk_object_unref (GTK_OBJECT (priv->cal_comp));
}
-#endif
- /* Okay, good then; now I will pick apart the CalComponent to get
+ /* Okay, good then; now I will pick apart the component to get
all the things I'll show in my control. */
{
icalproperty *prop;
@@ -328,12 +397,18 @@ e_itip_control_factory (BonoboGenericFactory *Factory, void *closure)
priv->dtend_label = glade_xml_get_widget (priv->xml, "dtend_label");
priv->summary_entry = glade_xml_get_widget (priv->xml, "summary_entry");
priv->description_box = glade_xml_get_widget (priv->xml, "description_box");
- gtk_text_set_editable (GTK_TEXT (priv->text_box), FALSE);
+ priv->add_button = glade_xml_get_widget (priv->xml, "add_button");
+ priv->loading_progress = glade_xml_get_widget (priv->xml, "loading_progress");
+ priv->loading_window = glade_xml_get_widget (priv->xml, "loading_window");
+ gtk_text_set_editable (GTK_TEXT (priv->text_box), FALSE);
+
gtk_signal_connect (GTK_OBJECT (priv->main_frame), "destroy",
GTK_SIGNAL_FUNC (itip_control_destroy_cb), priv);
gtk_signal_connect (GTK_OBJECT (priv->main_frame), "size_request",
GTK_SIGNAL_FUNC (itip_control_size_request_cb), priv);
+ gtk_signal_connect (GTK_OBJECT (priv->add_button), "clicked",
+ GTK_SIGNAL_FUNC (add_button_clicked_cb), priv);
gtk_widget_show (priv->text_box);
gtk_widget_show (priv->main_frame);
diff --git a/calendar/gui/e-itip-control.glade b/calendar/gui/e-itip-control.glade
index da2e1dcdae..8a683f72aa 100644
--- a/calendar/gui/e-itip-control.glade
+++ b/calendar/gui/e-itip-control.glade
@@ -331,6 +331,30 @@
</widget>
<widget>
+ <class>GtkHButtonBox</class>
+ <name>hbuttonbox1</name>
+ <layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
+ <spacing>30</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>add_button</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>Add to Calendar</label>
+ </widget>
+ </widget>
+
+ <widget>
<class>GtkText</class>
<name>text_box</name>
<can_focus>True</can_focus>
@@ -348,4 +372,84 @@
</widget>
</widget>
+<widget>
+ <class>GtkWindow</class>
+ <name>loading_window</name>
+ <visible>False</visible>
+ <title>Loading Calendar</title>
+ <type>GTK_WINDOW_DIALOG</type>
+ <position>GTK_WIN_POS_CENTER</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame1</name>
+ <border_width>4</border_width>
+ <label></label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_OUT</shadow_type>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox2</name>
+ <border_width>7</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>1</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox2</name>
+ <border_width>6</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>9</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label10</name>
+ <label>Loading calendar...</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkProgressBar</class>
+ <name>progressbar1</name>
+ <value>0</value>
+ <lower>0</lower>
+ <upper>100</upper>
+ <bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
+ <orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
+ <activity_mode>False</activity_mode>
+ <show_text>False</show_text>
+ <format>%P %%</format>
+ <text_xalign>0.5</text_xalign>
+ <text_yalign>0.5</text_yalign>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
</GTK-Interface>