diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-09-25 06:53:30 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-09-25 06:53:30 +0800 |
commit | 9515b98403f2f7ef77dc6c51f82505fccef08c2b (patch) | |
tree | 2557338a0ad82878b8b2d84ecc9df7e169d75bc8 /calendar/gui/e-calendar-table.c | |
parent | 73c370019c4de89d4c901ee8c25cc0cbb55992fb (diff) | |
download | gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.gz gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.bz2 gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.lz gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.xz gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.zst gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.zip |
Saving progress. Experimenting with directory layout.
Saving progress.
Experimenting with directory layout.
svn path=/branches/kill-bonobo/; revision=36446
Diffstat (limited to 'calendar/gui/e-calendar-table.c')
-rw-r--r-- | calendar/gui/e-calendar-table.c | 713 |
1 files changed, 411 insertions, 302 deletions
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 9e74ea2c26..ed254d0680 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -65,6 +65,16 @@ #include "e-tasks.h" #include "misc.h" +#define E_CALENDAR_TABLE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CALENDAR_TABLE, ECalendarTablePrivate)) + +struct _ECalendarTablePrivate { + gpointer shell_view; /* weak pointer */ + + EActivity *activity; +}; + enum TargetType{ TARGET_TYPE_VCALENDAR }; @@ -76,12 +86,6 @@ static GtkTargetEntry target_types[] = { static guint n_target_types = G_N_ELEMENTS (target_types); -extern ECompEditorRegistry *comp_editor_registry; - -static void e_calendar_table_class_init (ECalendarTableClass *class); -static void e_calendar_table_init (ECalendarTable *cal_table); -static void e_calendar_table_destroy (GtkObject *object); - static void e_calendar_table_on_double_click (ETable *table, gint row, gint col, @@ -118,7 +122,8 @@ enum { LAST_SIGNAL }; -static guint signals[LAST_SIGNAL] = { 0 }; +static gpointer parent_class; +static guint signals[LAST_SIGNAL]; /* The icons to represent the task. */ #define E_CALENDAR_MODEL_NUM_ICONS 4 @@ -129,17 +134,92 @@ static GdkPixbuf* icon_pixbufs[E_CALENDAR_MODEL_NUM_ICONS] = { NULL }; static GdkAtom clipboard_atom = GDK_NONE; -G_DEFINE_TYPE (ECalendarTable, e_calendar_table, GTK_TYPE_TABLE) +static void +calendar_table_emit_user_created (ECalendarTable *cal_table) +{ + g_signal_emit (cal_table, signals[USER_CREATED], 0); +} + +static void +calendar_table_set_shell_view (ECalendarTable *cal_table, + EShellView *shell_view) +{ + g_return_if_fail (cal_table->priv->shell_view == NULL); + + cal_table->priv->shell_view = shell_view; + + g_object_add_weak_pointer ( + G_OBJECT (shell_view), + &cal_table->priv->shell_view); +} + +static void +calendar_table_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + calendar_table_set_shell_view ( + E_CALENDAR_TABLE (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +calendar_table_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + g_value_set_object ( + value, e_calendar_table_get_shell_view ( + E_CALENDAR_TABLE (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +calendar_table_dispose (GObject *object) +{ + ECalendarTable *cal_table; + + cal_table = E_CALENDAR_TABLE (object); + + if (cal_table->model != NULL) { + g_object_unref (cal_table->model); + cal_table->model = NULL; + } + + if (cal_table->priv->activity != NULL) { + /* XXX Activity is not cancellable. */ + e_activity_complete (cal_table->priv->activity); + g_object_unref (cal_table->priv->activity); + cal_table->priv->activity = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} static void -e_calendar_table_class_init (ECalendarTableClass *class) +calendar_table_class_init (ECalendarTableClass *class) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (ECalendarTablePrivate)); - /* Method override */ - object_class->destroy = e_calendar_table_destroy; + object_class = G_OBJECT_CLASS (class); + object_class->dispose = calendar_table_dispose; signals[USER_CREATED] = g_signal_new ("user_created", @@ -150,9 +230,299 @@ e_calendar_table_class_init (ECalendarTableClass *class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - /* clipboard atom */ - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); + clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); +} + +static void +calendar_table_init (ECalendarTable *cal_table) +{ + GtkWidget *table; + ETable *e_table; + ECell *cell, *popup_cell; + ETableExtras *extras; + gint i; + GdkPixbuf *pixbuf; + GList *strings; + AtkObject *a11y; + char *etspecfile; + + cal_table->priv = E_CALENDAR_TABLE_GET_PRIVATE (cal_table); + + /* Create the model */ + + cal_table->model = (ECalModel *) e_cal_model_tasks_new (); + g_signal_connect_swapped ( + cal_table->model, "row_appended", + G_CALLBACK (calendar_table_emit_user_created), cal_table); + + /* Create the header columns */ + + extras = e_table_extras_new (); + + /* + * Normal string fields. + */ + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + NULL); + + e_table_extras_add_cell (extras, "calstring", cell); + + + /* + * Date fields. + */ + cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + NULL); + + popup_cell = e_cell_date_edit_new (); + e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); + g_object_unref (cell); + e_table_extras_add_cell (extras, "dateedit", popup_cell); + cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell); + + e_cell_date_edit_set_get_time_callback (E_CELL_DATE_EDIT (popup_cell), + e_calendar_table_get_current_time, + cal_table, NULL); + + + /* + * Combo fields. + */ + + /* Classification field. */ + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + "editable", FALSE, + NULL); + + popup_cell = e_cell_combo_new (); + e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); + g_object_unref (cell); + + strings = NULL; + strings = g_list_append (strings, (char*) _("Public")); + strings = g_list_append (strings, (char*) _("Private")); + strings = g_list_append (strings, (char*) _("Confidential")); + e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), + strings); + + e_table_extras_add_cell (extras, "classification", popup_cell); + + /* Priority field. */ + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + "editable", FALSE, + NULL); + + popup_cell = e_cell_combo_new (); + e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); + g_object_unref (cell); + + strings = NULL; + strings = g_list_append (strings, (char*) _("High")); + strings = g_list_append (strings, (char*) _("Normal")); + strings = g_list_append (strings, (char*) _("Low")); + strings = g_list_append (strings, (char*) _("Undefined")); + e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), + strings); + + e_table_extras_add_cell (extras, "priority", popup_cell); + + /* Percent field. */ + cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + NULL); + + popup_cell = e_cell_combo_new (); + e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); + g_object_unref (cell); + + strings = NULL; + strings = g_list_append (strings, (char*) _("0%")); + strings = g_list_append (strings, (char*) _("10%")); + strings = g_list_append (strings, (char*) _("20%")); + strings = g_list_append (strings, (char*) _("30%")); + strings = g_list_append (strings, (char*) _("40%")); + strings = g_list_append (strings, (char*) _("50%")); + strings = g_list_append (strings, (char*) _("60%")); + strings = g_list_append (strings, (char*) _("70%")); + strings = g_list_append (strings, (char*) _("80%")); + strings = g_list_append (strings, (char*) _("90%")); + strings = g_list_append (strings, (char*) _("100%")); + e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), + strings); + + e_table_extras_add_cell (extras, "percent", popup_cell); + + /* Transparency field. */ + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + "editable", FALSE, + NULL); + + popup_cell = e_cell_combo_new (); + e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); + g_object_unref (cell); + + strings = NULL; + strings = g_list_append (strings, (char*) _("Free")); + strings = g_list_append (strings, (char*) _("Busy")); + e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), + strings); + + e_table_extras_add_cell (extras, "transparency", popup_cell); + + /* Status field. */ + cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + g_object_set (G_OBJECT (cell), + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, + "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, + "bg_color_column", E_CAL_MODEL_FIELD_COLOR, + "editable", FALSE, + NULL); + + popup_cell = e_cell_combo_new (); + e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); + g_object_unref (cell); + + strings = NULL; + strings = g_list_append (strings, (char*) _("Not Started")); + strings = g_list_append (strings, (char*) _("In Progress")); + strings = g_list_append (strings, (char*) _("Completed")); + strings = g_list_append (strings, (char*) _("Canceled")); + e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), + strings); + + e_table_extras_add_cell (extras, "calstatus", popup_cell); + + e_table_extras_add_compare (extras, "date-compare", + date_compare_cb); + e_table_extras_add_compare (extras, "percent-compare", + percent_compare_cb); + e_table_extras_add_compare (extras, "priority-compare", + priority_compare_cb); + e_table_extras_add_compare (extras, "status-compare", + status_compare_cb); + + /* Create pixmaps */ + + if (!icon_pixbufs[0]) + for (i = 0; i < E_CALENDAR_MODEL_NUM_ICONS; i++) { + icon_pixbufs[i] = e_icon_factory_get_icon (icon_names[i], E_ICON_SIZE_LIST); + } + + cell = e_cell_toggle_new (0, E_CALENDAR_MODEL_NUM_ICONS, icon_pixbufs); + e_table_extras_add_cell(extras, "icon", cell); + e_table_extras_add_pixbuf(extras, "icon", icon_pixbufs[0]); + + pixbuf = e_icon_factory_get_icon ("stock_check-filled", E_ICON_SIZE_LIST); + e_table_extras_add_pixbuf(extras, "complete", pixbuf); + g_object_unref(pixbuf); + + /* Create the table */ + + etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, + "e-calendar-table.etspec", + NULL); + table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (cal_table->model), + extras, + etspecfile, + NULL); + g_free (etspecfile); + + /* FIXME: this causes a message from GLib about 'extras' having only a floating + reference */ + /* g_object_unref (extras); */ + + cal_table->etable = table; + gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1, + GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_show (table); + + + e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (table)); + g_signal_connect (e_table, "double_click", G_CALLBACK (e_calendar_table_on_double_click), cal_table); + g_signal_connect (e_table, "right_click", G_CALLBACK (e_calendar_table_on_right_click), cal_table); + g_signal_connect (e_table, "key_press", G_CALLBACK (e_calendar_table_on_key_press), cal_table); + g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_calendar_table_on_popup_menu), cal_table); + g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), cal_table); + gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE); + + a11y = gtk_widget_get_accessible ((GtkWidget *)e_table); + if (a11y) + atk_object_set_name (a11y, _("Tasks")); +} + +GType +e_calendar_table_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { + sizeof (ECalendarTableClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) calendar_table_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (ECalendarTable), + 0, /* n_preallocs */ + (GInstanceInitFunc) calendar_table_init, + NULL /* value_table */ + }; + + type = g_type_register_static ( + GTK_TYPE_TABLE, "ECalendarTable", &type_info, 0); + } + + return type; +} + +/** + * e_calendar_table_new: + * @shell_view: an #EShellView + * + * Returns a new #ECalendarTable. + * + * Returns: a new #ECalendarTable + **/ +GtkWidget * +e_calendar_table_new (EShellView *shell_view) +{ + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); + + return g_object_new ( + E_TYPE_CALENDAR_TABLE, + "shell-view", shell_view, NULL); +} + +EShellView * +e_calendar_table_get_shell_view (ECalendarTable *cal_table) +{ + g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL); + + return cal_table->priv->shell_view; } static gint @@ -257,12 +627,6 @@ status_compare_cb (gconstpointer a, gconstpointer b) } static void -row_appended_cb (ECalModel *model, ECalendarTable *cal_table) -{ - g_signal_emit (cal_table, signals[USER_CREATED], 0); -} - -static void get_time_as_text (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone, char *buff, int buff_len) { struct tm tmp_tm; @@ -465,261 +829,6 @@ query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk return TRUE; } -static void -e_calendar_table_init (ECalendarTable *cal_table) -{ - GtkWidget *table; - ETable *e_table; - ECell *cell, *popup_cell; - ETableExtras *extras; - gint i; - GdkPixbuf *pixbuf; - GList *strings; - AtkObject *a11y; - char *etspecfile; - - /* Create the model */ - - cal_table->model = (ECalModel *) e_cal_model_tasks_new (); - g_signal_connect (cal_table->model, "row_appended", G_CALLBACK (row_appended_cb), cal_table); - - cal_table->user_created_cal = NULL; - - /* Create the header columns */ - - extras = e_table_extras_new(); - - /* - * Normal string fields. - */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - NULL); - - e_table_extras_add_cell (extras, "calstring", cell); - - - /* - * Date fields. - */ - cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - NULL); - - popup_cell = e_cell_date_edit_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - g_object_unref (cell); - e_table_extras_add_cell (extras, "dateedit", popup_cell); - cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell); - - e_cell_date_edit_set_get_time_callback (E_CELL_DATE_EDIT (popup_cell), - e_calendar_table_get_current_time, - cal_table, NULL); - - - /* - * Combo fields. - */ - - /* Classification field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - g_object_unref (cell); - - strings = NULL; - strings = g_list_append (strings, (char*) _("Public")); - strings = g_list_append (strings, (char*) _("Private")); - strings = g_list_append (strings, (char*) _("Confidential")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "classification", popup_cell); - - /* Priority field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - g_object_unref (cell); - - strings = NULL; - strings = g_list_append (strings, (char*) _("High")); - strings = g_list_append (strings, (char*) _("Normal")); - strings = g_list_append (strings, (char*) _("Low")); - strings = g_list_append (strings, (char*) _("Undefined")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "priority", popup_cell); - - /* Percent field. */ - cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - g_object_unref (cell); - - strings = NULL; - strings = g_list_append (strings, (char*) _("0%")); - strings = g_list_append (strings, (char*) _("10%")); - strings = g_list_append (strings, (char*) _("20%")); - strings = g_list_append (strings, (char*) _("30%")); - strings = g_list_append (strings, (char*) _("40%")); - strings = g_list_append (strings, (char*) _("50%")); - strings = g_list_append (strings, (char*) _("60%")); - strings = g_list_append (strings, (char*) _("70%")); - strings = g_list_append (strings, (char*) _("80%")); - strings = g_list_append (strings, (char*) _("90%")); - strings = g_list_append (strings, (char*) _("100%")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "percent", popup_cell); - - /* Transparency field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - g_object_unref (cell); - - strings = NULL; - strings = g_list_append (strings, (char*) _("Free")); - strings = g_list_append (strings, (char*) _("Busy")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "transparency", popup_cell); - - /* Status field. */ - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, - "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, - "bg_color_column", E_CAL_MODEL_FIELD_COLOR, - "editable", FALSE, - NULL); - - popup_cell = e_cell_combo_new (); - e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell); - g_object_unref (cell); - - strings = NULL; - strings = g_list_append (strings, (char*) _("Not Started")); - strings = g_list_append (strings, (char*) _("In Progress")); - strings = g_list_append (strings, (char*) _("Completed")); - strings = g_list_append (strings, (char*) _("Canceled")); - e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), - strings); - - e_table_extras_add_cell (extras, "calstatus", popup_cell); - - e_table_extras_add_compare (extras, "date-compare", - date_compare_cb); - e_table_extras_add_compare (extras, "percent-compare", - percent_compare_cb); - e_table_extras_add_compare (extras, "priority-compare", - priority_compare_cb); - e_table_extras_add_compare (extras, "status-compare", - status_compare_cb); - - /* Create pixmaps */ - - if (!icon_pixbufs[0]) - for (i = 0; i < E_CALENDAR_MODEL_NUM_ICONS; i++) { - icon_pixbufs[i] = e_icon_factory_get_icon (icon_names[i], E_ICON_SIZE_LIST); - } - - cell = e_cell_toggle_new (0, E_CALENDAR_MODEL_NUM_ICONS, icon_pixbufs); - e_table_extras_add_cell(extras, "icon", cell); - e_table_extras_add_pixbuf(extras, "icon", icon_pixbufs[0]); - - pixbuf = e_icon_factory_get_icon ("stock_check-filled", E_ICON_SIZE_LIST); - e_table_extras_add_pixbuf(extras, "complete", pixbuf); - g_object_unref(pixbuf); - - /* Create the table */ - - etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, - "e-calendar-table.etspec", - NULL); - table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (cal_table->model), - extras, - etspecfile, - NULL); - g_free (etspecfile); - - /* FIXME: this causes a message from GLib about 'extras' having only a floating - reference */ - /* g_object_unref (extras); */ - - cal_table->etable = table; - gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_show (table); - - - e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (table)); - g_signal_connect (e_table, "double_click", G_CALLBACK (e_calendar_table_on_double_click), cal_table); - g_signal_connect (e_table, "right_click", G_CALLBACK (e_calendar_table_on_right_click), cal_table); - g_signal_connect (e_table, "key_press", G_CALLBACK (e_calendar_table_on_key_press), cal_table); - g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_calendar_table_on_popup_menu), cal_table); - g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), cal_table); - gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE); - - a11y = gtk_widget_get_accessible ((GtkWidget *)e_table); - if (a11y) - atk_object_set_name (a11y, _("Tasks")); -} - - -/** - * e_calendar_table_new: - * @Returns: a new #ECalendarTable. - * - * Creates a new #ECalendarTable. - **/ -GtkWidget * -e_calendar_table_new (void) -{ - GtkWidget *cal_table; - - cal_table = GTK_WIDGET (g_object_new (e_calendar_table_get_type (), NULL)); - - return cal_table; -} - /** * e_calendar_table_get_model: @@ -739,21 +848,6 @@ e_calendar_table_get_model (ECalendarTable *cal_table) } -static void -e_calendar_table_destroy (GtkObject *object) -{ - ECalendarTable *cal_table; - - cal_table = E_CALENDAR_TABLE (object); - - if (cal_table->model) { - g_object_unref (cal_table->model); - cal_table->model = NULL; - } - - GTK_OBJECT_CLASS (e_calendar_table_parent_class)->destroy (object); -} - /** * e_calendar_table_get_table: * @cal_table: A calendar table. @@ -1836,20 +1930,35 @@ static char *test[] = { #endif void -e_calendar_table_set_activity_handler (ECalendarTable *cal_table, EActivityHandler *activity_handler) +e_calendar_table_set_status_message (ECalendarTable *cal_table, + const gchar *message, + gdouble percent) { - g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); - - cal_table->activity_handler = activity_handler; -} + EActivity *activity; + EShellView *shell_view; -void -e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *message, int percent) -{ g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); - if (!cal_table->activity_handler) - return; + activity = cal_table->priv->activity; + shell_view = e_calendar_table_get_shell_view (cal_table); + + if (message == NULL || *message == '\0') { + if (activity != NULL) { + e_activity_complete (activity); + g_object_unref (activity); + cal_table->priv->activity = NULL; + } + + } else if (activity == NULL) { + activity = e_activity_new (message); + cal_able->priv->activity = activity; + e_activity_set_percent (activity, percent); + e_shell_view_add_activity (shell_view, activity); + + } else { + e_activity_set_percent (activity, percent); + e_activity_set_primary_text (activity, message); + } if (!message || !*message) { if (cal_table->activity_id != 0) { |