Commit 3917d389 authored by Vincent Untz's avatar Vincent Untz Committed by Vincent Untz
Browse files

detect the datadir of e-d-s, since we need it for icons. This adds a

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

	* configure.in: detect the datadir of e-d-s, since we need it for
	icons. This adds a dependency on e-d-s (for packagers who split e-d-s
	in many small libraries)

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

	* Makefile.am: remove old code handling icons, and directly use the
	e-d-s icons
	* calendar-window.c: (set_renderer_pixbuf_pixmap): new
	(set_renderer_pixbuf_pixmap_for_bday): change path for icons, and use
	set_renderer_pixbuf_pixmap()
	(set_renderer_pixbuf_pixmap_for_weather): ditto
	(calendar_window_tree_selection_changed), (create_task_list),
	(create_list_for_appointment_model), (create_appointment_list),
	(create_birthday_list), (create_weather_list),
	(calendar_window_init): simplify the code to have only one selection

svn path=/trunk/; revision=10419
parent b4967207
2007-05-25 Vincent Untz <vuntz@gnome.org>
* configure.in: detect the datadir of e-d-s, since we need it for
icons. This adds a dependency on e-d-s (for packagers who split e-d-s
in many small libraries)
2007-05-21 Vincent Untz <vuntz@gnome.org>
* configure.in: rework x libraries detection
......
2007-05-25 Vincent Untz <vuntz@gnome.org>
* Makefile.am: remove old code handling icons, and directly use the
e-d-s icons
* calendar-window.c: (set_renderer_pixbuf_pixmap): new
(set_renderer_pixbuf_pixmap_for_bday): change path for icons, and use
set_renderer_pixbuf_pixmap()
(set_renderer_pixbuf_pixmap_for_weather): ditto
(calendar_window_tree_selection_changed), (create_task_list),
(create_list_for_appointment_model), (create_appointment_list),
(create_birthday_list), (create_weather_list),
(calendar_window_init): simplify the code to have only one selection
2007-05-21 Sebastien Bacher <seb128@ubuntu.com>
* calendar-client.c: (calendar_client_foreach_appointment_day):
......
......@@ -6,11 +6,11 @@ INCLUDES = \
$(WARN_CFLAGS) \
$(CLOCK_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DCLOCK_ICONDIR=\""$(clockbitmapsdir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DCLOCK_EDS_ICONDIR="\"$(CLOCK_EDS_ICONDIR)\"" \
-DCLOCK_TIME_UTILITY="\"$(CLOCK_TIME_UTILITY)\""
if HAVE_LIBECAL
......@@ -20,11 +20,6 @@ CALENDAR_SOURCES = \
calendar-sources.c \
calendar-sources.h \
calendar-debug.h
#CLOCK_BITMAPS = \
# icon_anniversary_16.png \
# icon_birthday_16.png \
# icon_weather_16.png \
# icon_unknown_16.png
endif
CLOCK_SOURCES = \
......@@ -128,14 +123,10 @@ install-data-local:
endif
EXTRA_DIST = \
$(CLOCK_BITMAPS) \
GNOME_ClockApplet_Factory.server.in.in \
$(schemas_in_files) \
$(ui_DATA)
clockbitmapsdir = $(datadir)/gnome-panel/pixmaps/clock
clockbitmaps_DATA = $(CLOCK_BITMAPS)
CLEANFILES = \
$(BUILT_SOURCES) \
$(server_in_files) \
......
......@@ -84,10 +84,7 @@ struct _CalendarWindowPrivate {
GtkListStore *appointments_model;
GtkListStore *tasks_model;
GtkTreeSelection *appointments_selection;
GtkTreeSelection *birthdays_selection;
GtkTreeSelection *tasks_selection;
GtkTreeSelection *weather_selection;
GtkTreeSelection *previous_selection;
GtkTreeModelFilter *appointments_filter;
GtkTreeModelFilter *birthdays_filter;
......@@ -521,6 +518,38 @@ set_renderer_pixbuf_color_by_column (GtkCellRenderer *renderer,
g_free (color_string);
}
}
static void
set_renderer_pixbuf_pixmap (GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
const char *iconpath)
{
GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
if (!g_file_test (iconpath, G_FILE_TEST_IS_REGULAR)) {
g_printerr ("File '%s' does not exist.\n", iconpath);
return;
}
pixbuf = gdk_pixbuf_new_from_file (iconpath, &error);
if (error) {
g_printerr ("Cannot load '%s': %s\n",
iconpath, error->message);
g_error_free (error);
return;
}
g_object_set (renderer,
"visible", pixbuf != NULL,
"pixbuf", pixbuf,
NULL);
if (pixbuf)
g_object_unref (pixbuf);
}
static void
set_renderer_pixbuf_pixmap_for_bday (GtkCellRenderer *renderer,
GtkTreeModel *model,
......@@ -529,9 +558,6 @@ set_renderer_pixbuf_pixmap_for_bday (GtkCellRenderer *renderer,
{
const gchar *path = NULL;
gchar *type = NULL;
GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
gtk_tree_model_get (model, iter, data_column, &type, -1);
if (!type)
......@@ -543,28 +569,15 @@ set_renderer_pixbuf_pixmap_for_bday (GtkCellRenderer *renderer,
* ...
*/
if (g_strrstr (type, "birthday") != 0)
path = CLOCK_ICONDIR"/icon_birthday_16.png";
path = CLOCK_EDS_ICONDIR G_DIR_SEPARATOR_S "category_birthday_16.png";
else if (g_strrstr (type, "anniversary") != 0)
path = CLOCK_ICONDIR"/icon_anniversary_16.png";
path = CLOCK_EDS_ICONDIR G_DIR_SEPARATOR_S "category_gifts_16.png";
else
path = CLOCK_ICONDIR"/icon_unknown_16.png";
path = CLOCK_EDS_ICONDIR G_DIR_SEPARATOR_S "category_miscellaneous_16.png";
g_free (type);
pixbuf = gdk_pixbuf_new_from_file (path, &error);
if (error) {
g_warning ("Cannot load '%s': %s", path, error->message);
g_error_free (error);
return;
}
g_object_set (renderer,
"visible", pixbuf != NULL,
"pixbuf", pixbuf,
NULL);
if (pixbuf)
g_object_unref (pixbuf);
set_renderer_pixbuf_pixmap (renderer, model, iter, path);
}
static void
......@@ -572,27 +585,8 @@ set_renderer_pixbuf_pixmap_for_weather (GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter)
{
const gchar *path = NULL;
GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
path = CLOCK_ICONDIR"/icon_weather_16.png";
pixbuf = gdk_pixbuf_new_from_file (path, &error);
if (error) {
g_warning ("Cannot load '%s': %s", path, error->message);
g_error_free (error);
return;
}
g_object_set (renderer,
"visible", pixbuf != NULL,
"pixbuf", pixbuf,
NULL);
if (pixbuf)
g_object_unref (pixbuf);
set_renderer_pixbuf_pixmap (renderer, model, iter,
CLOCK_EDS_ICONDIR G_DIR_SEPARATOR_S "category_holiday_16.png");
}
static void
......@@ -693,42 +687,20 @@ static void
calendar_window_tree_selection_changed (GtkTreeSelection *selection,
CalendarWindow *calwin)
{
if (selection != calwin->priv->appointments_selection) {
g_signal_handlers_block_by_func (calwin->priv->appointments_selection,
calendar_window_tree_selection_changed,
calwin);
gtk_tree_selection_unselect_all (calwin->priv->appointments_selection);
g_signal_handlers_unblock_by_func (calwin->priv->appointments_selection,
calendar_window_tree_selection_changed,
calwin);
}
if (selection != calwin->priv->birthdays_selection) {
g_signal_handlers_block_by_func (calwin->priv->birthdays_selection,
calendar_window_tree_selection_changed,
calwin);
gtk_tree_selection_unselect_all (calwin->priv->birthdays_selection);
g_signal_handlers_unblock_by_func (calwin->priv->birthdays_selection,
calendar_window_tree_selection_changed,
calwin);
}
if (selection != calwin->priv->tasks_selection) {
g_signal_handlers_block_by_func (calwin->priv->tasks_selection,
calendar_window_tree_selection_changed,
calwin);
gtk_tree_selection_unselect_all (calwin->priv->tasks_selection);
g_signal_handlers_unblock_by_func (calwin->priv->tasks_selection,
calendar_window_tree_selection_changed,
calwin);
}
if (selection != calwin->priv->weather_selection) {
g_signal_handlers_block_by_func (calwin->priv->weather_selection,
if (selection == calwin->priv->previous_selection)
return;
if (calwin->priv->previous_selection) {
g_signal_handlers_block_by_func (calwin->priv->previous_selection,
calendar_window_tree_selection_changed,
calwin);
gtk_tree_selection_unselect_all (calwin->priv->weather_selection);
g_signal_handlers_unblock_by_func (calwin->priv->weather_selection,
gtk_tree_selection_unselect_all (calwin->priv->previous_selection);
g_signal_handlers_unblock_by_func (calwin->priv->previous_selection,
calendar_window_tree_selection_changed,
calwin);
}
calwin->priv->previous_selection = selection;
}
static GtkWidget *
......@@ -741,6 +713,7 @@ create_task_list (CalendarWindow *calwin,
GtkWidget *scrolled;
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
list = gtk_expander_new_with_mnemonic (_("_Tasks"));
......@@ -810,8 +783,8 @@ create_task_list (CalendarWindow *calwin,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
calwin->priv->tasks_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
g_signal_connect (calwin->priv->tasks_selection, "changed",
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
g_signal_connect (selection, "changed",
G_CALLBACK (calendar_window_tree_selection_changed),
calwin);
......@@ -897,7 +870,6 @@ static GtkWidget *
create_list_for_appointment_model (CalendarWindow *calwin,
const char *label,
GtkTreeModelFilter **filter,
GtkTreeSelection **selection,
GtkTreeModelFilterVisibleFunc is_for_filter,
GtkTreeCellDataFunc set_pixbuf_cell,
gboolean show_start,
......@@ -909,6 +881,7 @@ create_list_for_appointment_model (CalendarWindow *calwin,
GtkWidget *scrolled;
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
list = gtk_expander_new_with_mnemonic (label);
......@@ -966,8 +939,8 @@ create_list_for_appointment_model (CalendarWindow *calwin,
"text", APPOINTMENT_COLUMN_SUMMARY);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
*selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
g_signal_connect (*selection, "changed",
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
g_signal_connect (selection, "changed",
G_CALLBACK (calendar_window_tree_selection_changed),
calwin);
......@@ -987,7 +960,6 @@ create_appointment_list (CalendarWindow *calwin,
calwin,
_("_Appointments"),
&calwin->priv->appointments_filter,
&calwin->priv->appointments_selection,
is_appointment,
appointment_pixbuf_cell_data_func,
TRUE,
......@@ -1005,7 +977,6 @@ create_birthday_list (CalendarWindow *calwin,
calwin,
_("_Birthdays and Anniversaries"),
&calwin->priv->birthdays_filter,
&calwin->priv->birthdays_selection,
is_birthday,
birthday_pixbuf_cell_data_func,
FALSE,
......@@ -1022,7 +993,6 @@ create_weather_list (CalendarWindow *calwin,
calwin,
_("_Weather Information"),
&calwin->priv->weather_filter,
&calwin->priv->weather_selection,
is_weather,
weather_pixbuf_cell_data_func,
FALSE,
......@@ -1691,6 +1661,7 @@ calendar_window_init (CalendarWindow *calwin)
gtk_window_set_icon_name (window, CLOCK_ICON);
#ifdef HAVE_LIBECAL
calwin->priv->previous_selection = NULL;
calwin->priv->gconfclient = gconf_client_get_default ();
#endif
}
......
......@@ -92,9 +92,10 @@ if test "x$enable_eds" = "xyes"; then
else
if test "x$enable_eds" != "xno"; then
AC_MSG_CHECKING(for evolution-data-server)
if $PKG_CONFIG --exists libecal-1.2 libedataserverui-1.2; then
if $PKG_CONFIG --exists libecal-1.2 libedataserverui-1.2 evolution-data-server-1.2; then
AC_MSG_RESULT(yes)
LIBECAL_REQUIREMENT="libecal-1.2 >= $LIBECAL_REQUIRED libedataserver-1.2 >= $LIBEDATASERVER_REQUIRED libedataserverui-1.2 >= $LIBEDATASERVERUI_REQUIRED"
CLOCK_EDS_ICONDIR=`$PKG_CONFIG --variable=datadir evolution-data-server-1.2`/pixmaps/evolution-data-server
else
AC_MSG_RESULT(no)
fi
......@@ -105,6 +106,7 @@ if test -n "$LIBECAL_REQUIREMENT"; then
[Defined when evolution-data-server libecal-1.2 and libedataserverui-1.2 are detected])
fi
AM_CONDITIONAL(HAVE_LIBECAL, test -n "$LIBECAL_REQUIREMENT")
AC_SUBST(CLOCK_EDS_ICONDIR)
PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED $LIBECAL_REQUIREMENT)
AC_SUBST(CLOCK_CFLAGS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment