keep a reference to the EvolutionShellClient component

2001-10-19  Rodrigo Moya <rodrigo@ximian.com>

	* gui/component-factory.c (owner_set_cb): keep a reference to the
	EvolutionShellClient component

	* gui/e-week-view.c (e_week_view_set_status_message): new function
	(update_query): call e_week_view_set_status_message
	(query_query_done_cb):
	(query_eval_error_cb): clean up status bar messages

	* gui/e-day-view.c (e_day_view_set_status_message): new function
	(update_query): call e_day_view_set_status_message
	(query_query_done_cb):
	(query_eval_error_cb): clean up status bar messages

	* gui/Makefile.am: added EVOLUTION_IMAGESDIR to CFLAGS

svn path=/trunk/; revision=13793
This commit is contained in:
Rodrigo Moya
2001-10-19 15:26:43 +00:00
committed by Rodrigo Moya
parent 971f97e051
commit 92d0b48b3c
8 changed files with 156 additions and 25 deletions

View File

@ -1,3 +1,20 @@
2001-10-19 Rodrigo Moya <rodrigo@ximian.com>
* gui/component-factory.c (owner_set_cb): keep a reference to the
EvolutionShellClient component
* gui/e-week-view.c (e_week_view_set_status_message): new function
(update_query): call e_week_view_set_status_message
(query_query_done_cb):
(query_eval_error_cb): clean up status bar messages
* gui/e-day-view.c (e_day_view_set_status_message): new function
(update_query): call e_day_view_set_status_message
(query_query_done_cb):
(query_eval_error_cb): clean up status bar messages
* gui/Makefile.am: added EVOLUTION_IMAGESDIR to CFLAGS
2001-10-18 JP Rosevear <jpr@ximian.com>
* gui/e-meeting-time-sel.c

View File

@ -35,29 +35,30 @@ help_base = $(datadir)/gnome/help/cal
bin_PROGRAMS = evolution-calendar
INCLUDES = \
-DG_LOG_DOMAIN=\"calendar-gui\" \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_srcdir) \
-I$(top_srcdir)/calendar \
-I$(top_srcdir)/calendar/cal-client \
-I$(top_builddir)/calendar/cal-client \
-I$(top_srcdir)/libical/src/libical \
-I$(top_builddir)/libical/src/libical \
-I$(top_srcdir)/addressbook/backend/ebook \
-I$(top_builddir)/addressbook/backend/ebook \
-I$(top_srcdir)/widgets \
-I$(includedir) \
$(BONOBO_HTML_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(GAL_CFLAGS) \
$(BONOBO_CONF_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\"
INCLUDES = \
-DG_LOG_DOMAIN=\"calendar-gui\" \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_srcdir) \
-I$(top_srcdir)/calendar \
-I$(top_srcdir)/calendar/cal-client \
-I$(top_builddir)/calendar/cal-client \
-I$(top_srcdir)/libical/src/libical \
-I$(top_builddir)/libical/src/libical \
-I$(top_srcdir)/addressbook/backend/ebook \
-I$(top_builddir)/addressbook/backend/ebook \
-I$(top_srcdir)/widgets \
-I$(includedir) \
$(BONOBO_HTML_GNOME_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(GAL_CFLAGS) \
$(BONOBO_CONF_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\"
iconsdir = $(datadir)/images/evolution

View File

@ -56,6 +56,7 @@
#define CREATE_TASK_ID "task"
char *evolution_dir;
EvolutionShellClient *global_shell_client = NULL;
static const EvolutionShellComponentFolderType folder_types[] = {
{ FOLDER_CALENDAR,
@ -483,6 +484,8 @@ owner_set_cb (EvolutionShellComponent *shell_component,
}
shells = g_list_append (shells, shell_component);
global_shell_client = shell_client;
}
static void

View File

@ -56,6 +56,7 @@
#define CREATE_TASK_ID "task"
char *evolution_dir;
EvolutionShellClient *global_shell_client = NULL;
static const EvolutionShellComponentFolderType folder_types[] = {
{ FOLDER_CALENDAR,
@ -483,6 +484,8 @@ owner_set_cb (EvolutionShellComponent *shell_component,
}
shells = g_list_append (shells, shell_component);
global_shell_client = shell_client;
}
static void

View File

@ -97,6 +97,9 @@
we get from the server. */
#define E_DAY_VIEW_LAYOUT_TIMEOUT 100
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
/* Signal IDs */
enum {
@ -871,6 +874,8 @@ e_day_view_init (EDayView *day_view)
GTK_SIGNAL_FUNC (invisible_destroyed),
(gpointer) day_view);
day_view->clipboard_selection = NULL;
day_view->activity = NULL;
}
@ -956,8 +961,15 @@ e_day_view_destroy (GtkObject *object)
if (day_view->invisible)
gtk_widget_destroy (day_view->invisible);
if (day_view->clipboard_selection)
if (day_view->clipboard_selection) {
g_free (day_view->clipboard_selection);
day_view->clipboard_selection = NULL;
}
if (day_view->activity) {
gtk_object_unref (GTK_OBJECT (day_view->activity));
day_view->activity = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -1575,6 +1587,8 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err
/* FIXME */
e_day_view_set_status_message (day_view, NULL);
if (status != CAL_QUERY_DONE_SUCCESS)
fprintf (stderr, "query done: %s\n", error_str);
}
@ -1589,6 +1603,8 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
/* FIXME */
e_day_view_set_status_message (day_view, NULL);
fprintf (stderr, "eval error: %s\n", error_str);
}
@ -1655,6 +1671,7 @@ update_query (EDayView *day_view)
if (!real_sexp)
return; /* No time range is set, so don't start a query */
e_day_view_set_status_message (day_view, _("Searching"));
day_view->query = cal_client_get_query (day_view->client, real_sexp);
g_free (real_sexp);
@ -7026,3 +7043,33 @@ e_day_view_get_num_events_selected (EDayView *day_view)
return (day_view->editing_event_day != -1) ? 1 : 0;
}
/* Displays messages on the status bar. */
void
e_day_view_set_status_message (EDayView *day_view, const char *message)
{
extern EvolutionShellClient *global_shell_client; /* ugly */
g_return_if_fail (E_IS_DAY_VIEW (day_view));
if (!message || !*message) {
if (day_view->activity) {
gtk_object_unref (GTK_OBJECT (day_view->activity));
day_view->activity = NULL;
}
}
else if (!day_view->activity) {
int display;
char *client_id = g_strdup_printf ("%p", day_view);
if (progress_icon[0] == NULL)
progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE);
day_view->activity = evolution_activity_client_new (
global_shell_client, client_id,
progress_icon, message, TRUE, &display);
g_free (client_id);
}
else
evolution_activity_client_update (day_view->activity, message, -1.0);
}

View File

@ -30,6 +30,7 @@
#include <libgnomeui/gnome-canvas.h>
#include "gnome-cal.h"
#include "evolution-activity-client.h"
#ifdef __cplusplus
extern "C" {
@ -493,6 +494,9 @@ struct _EDayView
/* The default category for new events */
char *default_category;
/* The activity client used to show messages on the status bar. */
EvolutionActivityClient *activity;
};
struct _EDayViewClass
@ -657,6 +661,9 @@ gint e_day_view_get_time_string_width (EDayView *day_view);
gint e_day_view_event_sort_func (const void *arg1,
const void *arg2);
void e_day_view_set_status_message (EDayView *day_view,
const char *message);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -80,6 +80,9 @@
we get from the server. */
#define E_WEEK_VIEW_LAYOUT_TIMEOUT 100
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
static GdkPixbuf *progress_icon[2] = { NULL, NULL };
/* Signal IDs */
enum {
@ -453,6 +456,8 @@ e_week_view_init (EWeekView *week_view)
GTK_SIGNAL_FUNC (invisible_destroyed),
(gpointer) week_view);
week_view->clipboard_selection = NULL;
week_view->activity = NULL;
}
@ -519,8 +524,15 @@ e_week_view_destroy (GtkObject *object)
if (week_view->invisible)
gtk_widget_destroy (week_view->invisible);
if (week_view->clipboard_selection)
if (week_view->clipboard_selection) {
g_free (week_view->clipboard_selection);
week_view->clipboard_selection = NULL;
}
if (week_view->activity) {
gtk_object_unref (GTK_OBJECT (week_view->activity));
week_view->activity = NULL;
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -1079,6 +1091,8 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err
/* FIXME */
e_week_view_set_status_message (week_view, NULL);
if (status != CAL_QUERY_DONE_SUCCESS)
fprintf (stderr, "query done: %s\n", error_str);
@ -1095,6 +1109,8 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
/* FIXME */
e_week_view_set_status_message (week_view, NULL);
fprintf (stderr, "eval error: %s\n", error_str);
gtk_widget_queue_draw (week_view->main_canvas);
@ -1162,6 +1178,7 @@ update_query (EWeekView *week_view)
return; /* No time range is set, so don't start a query */
}
e_week_view_set_status_message (week_view, _("Searching"));
week_view->query = cal_client_get_query (week_view->client, real_sexp);
g_free (real_sexp);
@ -3921,3 +3938,33 @@ e_week_view_get_num_events_selected (EWeekView *week_view)
return (week_view->editing_event_num != -1) ? 1 : 0;
}
/* Displays a message on the activity client. */
void
e_week_view_set_status_message (EWeekView *week_view, const char *message)
{
extern EvolutionShellClient *global_shell_client; /* ugly */
g_return_if_fail (E_IS_WEEK_VIEW (week_view));
if (!message || !*message) {
if (week_view->activity) {
gtk_object_unref (GTK_OBJECT (week_view->activity));
week_view->activity = NULL;
}
}
else if (!week_view->activity) {
int display;
char *client_id = g_strdup_printf ("%p", week_view);
if (progress_icon[0] == NULL)
progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE);
week_view->activity = evolution_activity_client_new (
global_shell_client, client_id,
progress_icon, message, TRUE, &display);
g_free (client_id);
}
else
evolution_activity_client_update (week_view->activity, message, -1.0);
}

View File

@ -29,6 +29,7 @@
#include <libgnomeui/gnome-canvas.h>
#include "gnome-cal.h"
#include "evolution-activity-client.h"
#ifdef __cplusplus
extern "C" {
@ -363,6 +364,9 @@ struct _EWeekView
/* The default category for new events */
char *default_category;
/* The activity client used to show messages on the status bar. */
EvolutionActivityClient *activity;
};
struct _EWeekViewClass
@ -495,6 +499,8 @@ gint e_week_view_get_time_string_width (EWeekView *week_view);
gint e_week_view_event_sort_func (const void *arg1,
const void *arg2);
void e_week_view_set_status_message (EWeekView *week_view,
const char *message);
#ifdef __cplusplus
}