todo: create and install libTodo

This commit is contained in:
Pierre Pronchery 2024-10-07 02:09:19 +02:00
parent ddb116a047
commit de95a876d2
12 changed files with 397 additions and 102 deletions

11
data/Todo.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=@PREFIX@
includedir=${prefix}/include
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
Name: Todo
Description: DeforaOS Desktop Todo library
Version: @VERSION@
Requires: libDesktop
Cflags: -I${includedir}
Libs: -L${libdir} @RPATH@ -lTodo

198
data/pkgconfig.sh Executable file
View File

@ -0,0 +1,198 @@
#!/bin/sh
#$Id$
#Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#variables
CONFIGSH="${0%/pkgconfig.sh}/../config.sh"
PREFIX="/usr/local"
DEVNULL="/dev/null"
PROGNAME="pkgconfig.sh"
#executables
DEBUG="_debug"
INSTALL="install"
MKDIR="mkdir -m 0755 -p"
RM="rm -f"
SED="sed"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#pkgconfig
_pkgconfig()
{
#check the variables
if [ -z "$PACKAGE" ]; then
_error "The PACKAGE variable needs to be set"
return $?
fi
if [ -z "$VERSION" ]; then
_error "The VERSION variable needs to be set"
return $?
fi
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
if [ -z "$SYSCONFDIR" ]; then
SYSCONFDIR="$PREFIX/etc"
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
fi
PKGCONFIG="$PREFIX/lib/pkgconfig"
while [ $# -gt 0 ]; do
target="$1"
shift
#clean
[ "$clean" -ne 0 ] && continue
#uninstall
if [ "$uninstall" -eq 1 ]; then
$DEBUG $RM -- "$PKGCONFIG/$target" || return 2
continue
fi
#install
if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$PKGCONFIG" || return 2
mode="-m 0644"
basename="$source"
if [ "${source##*/}" != "$source" ]; then
basename="${source##*/}"
fi
$DEBUG $INSTALL $mode "$target" "$PKGCONFIG/$basename" \
|| return 2
continue
fi
#portability
RPATH=
if [ "$PREFIX" != "/usr" ]; then
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
case $(uname -s) in
"Darwin")
RPATH="-Wl,-rpath,\${libdir}"
;;
"SunOS")
RPATH="-Wl,-R\${libdir}"
;;
esac
fi
#create
source="${target#$OBJDIR}"
source="${source}.in"
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
|| return 2
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
-e "s;@PACKAGE@;$PACKAGE;g" \
-e "s;@VERSION@;$VERSION;g" \
-e "s;@PREFIX@;$PREFIX;g" \
-e "s;@BINDIR@;$BINDIR;g" \
-e "s;@DATADIR@;$DATADIR;g" \
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
-e "s;@LIBDIR@;$LIBDIR;g" \
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
-e "s;@MANDIR@;$MANDIR;g" \
-e "s;@PWD@;$PWD;g" \
-e "s;@RPATH@;$RPATH;g" \
-e "s;@SBINDIR@;$SBINDIR;g" \
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
-- "$source" > "$target"
if [ $? -ne 0 ]; then
$RM -- "$target" 2> "$DEVNULL"
return 2
fi
done
return 0
}
#debug
_debug()
{
echo "$@" 1>&3
"$@"
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
}
#usage
_usage()
{
echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
return 1
}
#main
clean=0
install=0
uninstall=0
while getopts "ciuO:P:" name; do
case $name in
c)
clean=1
;;
i)
uninstall=0
install=1
;;
u)
install=0
uninstall=1
;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
P)
PREFIX="$OPTARG"
;;
?)
_usage
exit $?
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -lt 1 ]; then
_usage
exit $?
fi
exec 3>&1
_pkgconfig "$@"

View File

@ -1,5 +1,13 @@
subdirs=16x16,24x24,48x48
dist=Makefile,org.defora.todo.desktop
targets=Todo.pc
dist=Makefile,Todo.pc.in,org.defora.todo.desktop,pkgconfig.sh
#targets
[Todo.pc]
type=script
script=./pkgconfig.sh
depends=Todo.pc.in,../config.sh
install=
#dist
[org.defora.todo.desktop]

94
include/Todo.h Normal file
View File

@ -0,0 +1,94 @@
/* $Id$ */
/* Copyright (c) 2009-2024 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Todo */
/* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
#ifndef DESKTOP_TODO_H
# define DESKTOP_TODO_H
# include <gtk/gtk.h>
/* Todo */
/* types */
typedef struct _Todo Todo;
typedef enum _TodoColumn
{
TD_COL_TASK,
TD_COL_DONE,
TD_COL_TITLE,
TD_COL_START,
TD_COL_DISPLAY_START,
TD_COL_END,
TD_COL_DISPLAY_END,
TD_COL_PRIORITY,
TD_COL_DISPLAY_PRIORITY,
TD_COL_CATEGORY
} TodoColumn;
#define TD_COL_LAST TD_COL_CATEGORY
#define TD_COL_COUNT (TD_COL_LAST + 1)
typedef enum _TodoFilter
{
TODO_FILTER_ALL_TASKS = 0,
TODO_FILTER_COMPLETED_TASKS,
TODO_FILTER_REMAINING_TASKS
} TodoFilter;
# define TODO_FILTER_LAST TODO_FILTER_REMAINING_TASKS
# define TODO_FILTER_COUNT (TODO_FILTER_LAST + 1)
typedef enum _TodoPriority
{
TODO_PRIORITY_UNKNOWN = 0,
TODO_PRIORITY_LOW,
TODO_PRIORITY_MEDIUM,
TODO_PRIORITY_HIGH,
TODO_PRIORITY_URGENT
} TodoPriority;
/* functions */
Todo * todo_new(GtkWidget * window, GtkAccelGroup * group);
void todo_delete(Todo * todo);
/* accessors */
unsigned int todo_get_filter(Todo * todo);
GtkWidget * todo_get_view(Todo * todo);
GtkTreeViewColumn * todo_get_view_column(Todo * todo, unsigned i);
GtkWidget * todo_get_widget(Todo * todo);
void todo_set_filter(Todo * todo, unsigned int filter);
/* useful */
void todo_about(Todo * todo);
int todo_error(Todo * todo, char const * message, int ret);
void todo_show_preferences(Todo * todo, gboolean show);
#endif /* !DESKTOP_TODO_H */

6
include/project.conf Normal file
View File

@ -0,0 +1,6 @@
includes=Todo.h
dist=Makefile
#includes
[Todo.h]
install=$(INCLUDEDIR)/Desktop

View File

@ -2,7 +2,7 @@ package=Todo
version=0.3.0
config=h,sh
subdirs=data,doc,po,src,tools,tests
subdirs=data,doc,include,po,src,tools,tests
targets=tests
dist=Makefile,COPYING,config.h,config.sh

View File

@ -1,15 +1,25 @@
targets=todo
targets=libTodo,todo
cppflags_force=-I../include
#cppflags=-D EMBEDDED
cflags_force=`pkg-config --cflags libDesktop`
cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libDesktop` -lintl
ldflags=-pie -Wl,-z,relro -Wl,-z,now
dist=Makefile,priority.h,task.h,taskedit.h,todo.h,window.h
#targets
[libTodo]
type=library
sources=priority.c,task.c,taskedit.c,todo.c,window.c
cflags=-fPIC
install=$(LIBDIR)
[todo]
type=binary
sources=priority.c,task.c,taskedit.c,todo.c,window.c,main.c
sources=main.c
depends=libTodo$(SOEXT)
cflags=-fPIE
ldflags=-L. -Wl,-rpath,$(LIBDIR) -lTodo
install=$(BINDIR)
#sources
@ -21,15 +31,12 @@ depends=todo.h,priority.h
[task.c]
depends=task.h
cflags=-fPIC
[taskedit.c]
depends=priority.h
cflags=-fPIC
[todo.c]
depends=priority.h,task.h,todo.h,../config.h
cflags=-fPIC
[window.c]
depends=todo.h,window.h

View File

@ -59,12 +59,6 @@ static char const _license[] = "All rights reserved.\n"
/* Todo */
/* private */
/* types */
typedef enum _TodoColumn { TD_COL_TASK, TD_COL_DONE, TD_COL_TITLE, TD_COL_START,
TD_COL_DISPLAY_START, TD_COL_END, TD_COL_DISPLAY_END, TD_COL_PRIORITY,
TD_COL_DISPLAY_PRIORITY, TD_COL_CATEGORY } TodoColumn;
#define TD_COL_LAST TD_COL_CATEGORY
#define TD_COL_COUNT (TD_COL_LAST + 1)
struct _Todo
{
GtkWidget * window;
@ -74,7 +68,7 @@ struct _Todo
GtkListStore * priorities;
GtkTreeModel * filter;
GtkTreeModel * filter_sort;
TodoView filter_view;
TodoFilter filter_view;
GtkWidget * view;
GtkTreeViewColumn * columns[TD_COL_COUNT];
GtkWidget * about;
@ -99,7 +93,7 @@ static void _todo_on_delete(gpointer data);
#ifdef EMBEDDED
static void _todo_on_preferences(gpointer data);
#endif
static void _todo_on_view_as(gpointer data);
static void _todo_on_filter_as(gpointer data);
/* view */
static void _todo_on_task_activated(gpointer data);
@ -110,9 +104,9 @@ static void _todo_on_task_priority_edited(GtkCellRendererText * renderer,
gchar * path, gchar * priority, gpointer data);
static void _todo_on_task_title_edited(GtkCellRendererText * renderer,
gchar * path, gchar * title, gpointer data);
static void _todo_on_view_all_tasks(gpointer data);
static void _todo_on_view_completed_tasks(gpointer data);
static void _todo_on_view_remaining_tasks(gpointer data);
static void _todo_on_filter_all_tasks(gpointer data);
static void _todo_on_filter_completed_tasks(gpointer data);
static void _todo_on_filter_remaining_tasks(gpointer data);
static gboolean _todo_on_filter_view(GtkTreeModel * model, GtkTreeIter * iter,
gpointer data);
@ -194,19 +188,19 @@ Todo * todo_new(GtkWidget * window, GtkAccelGroup * group)
widget = desktop_toolbar_create(_toolbar, todo, group);
toolitem = gtk_menu_tool_button_new(NULL, _("View..."));
g_signal_connect_swapped(toolitem, "clicked", G_CALLBACK(
_todo_on_view_as), todo);
_todo_on_filter_as), todo);
menu = gtk_menu_new();
menuitem = gtk_menu_item_new_with_label(_("All tasks"));
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
_todo_on_view_all_tasks), todo);
_todo_on_filter_all_tasks), todo);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label(_("Completed tasks"));
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
_todo_on_view_completed_tasks), todo);
_todo_on_filter_completed_tasks), todo);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label(_("Remaining tasks"));
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
_todo_on_view_remaining_tasks), todo);
_todo_on_filter_remaining_tasks), todo);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolitem), menu);
@ -252,7 +246,7 @@ static void _new_view(Todo * todo)
}
todo->filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(todo->store),
NULL);
todo->filter_view = TODO_VIEW_ALL_TASKS;
todo->filter_view = TODO_FILTER_ALL_TASKS;
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(
todo->filter), _todo_on_filter_view, todo,
NULL);
@ -345,13 +339,29 @@ void todo_delete(Todo * todo)
/* accessors */
/* todo_get_view */
TodoView todo_get_view(Todo * todo)
/* todo_get_filter */
TodoFilter todo_get_filter(Todo * todo)
{
return todo->filter_view;
}
/* todo_get_view */
GtkWidget * todo_get_view(Todo * todo)
{
return todo->view;
}
/* todo_get_view_column */
GtkTreeViewColumn * todo_get_view_column(Todo * todo, unsigned int i)
{
if(i >= 0 && i <= TD_COL_LAST)
return todo->columns[i];
return NULL;
}
/* todo_get_widget */
GtkWidget * todo_get_widget(Todo * todo)
{
@ -359,8 +369,8 @@ GtkWidget * todo_get_widget(Todo * todo)
}
/* todo_set_view */
void todo_set_view(Todo * todo, TodoView view)
/* todo_set_filter */
void todo_set_filter(Todo * todo, TodoFilter view)
{
todo->filter_view = view;
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(todo->filter));
@ -1111,30 +1121,30 @@ static void _todo_task_save(Todo * todo, GtkTreeIter * iter)
/* callbacks */
/* todo_on_view_all_tasks */
static void _todo_on_view_all_tasks(gpointer data)
/* todo_on_filter_all_tasks */
static void _todo_on_filter_all_tasks(gpointer data)
{
Todo * todo = data;
todo_set_view(todo, TODO_VIEW_ALL_TASKS);
todo_set_filter(todo, TODO_FILTER_ALL_TASKS);
}
/* todo_on_view_completed_tasks */
static void _todo_on_view_completed_tasks(gpointer data)
/* todo_on_filter_completed_tasks */
static void _todo_on_filter_completed_tasks(gpointer data)
{
Todo * todo = data;
todo_set_view(todo, TODO_VIEW_COMPLETED_TASKS);
todo_set_filter(todo, TODO_FILTER_COMPLETED_TASKS);
}
/* todo_on_view_remaining_tasks */
static void _todo_on_view_remaining_tasks(gpointer data)
/* todo_on_filter_remaining_tasks */
static void _todo_on_filter_remaining_tasks(gpointer data)
{
Todo * todo = data;
todo_set_view(todo, TODO_VIEW_REMAINING_TASKS);
todo_set_filter(todo, TODO_FILTER_REMAINING_TASKS);
}
@ -1177,15 +1187,15 @@ static void _todo_on_preferences(gpointer data)
#endif
/* todo_on_view_as */
static void _todo_on_view_as(gpointer data)
/* todo_on_filter_as */
static void _todo_on_filter_as(gpointer data)
{
Todo * todo = data;
TodoView view;
TodoFilter filter;
view = todo_get_view(todo);
view = (view + 1) % TODO_VIEW_COUNT;
todo_set_view(todo, view);
filter = todo_get_filter(todo);
filter = (filter + 1) % TODO_FILTER_COUNT;
todo_set_filter(todo, filter);
}
@ -1268,14 +1278,14 @@ static gboolean _todo_on_filter_view(GtkTreeModel * model, GtkTreeIter * iter,
switch(todo->filter_view)
{
case TODO_VIEW_COMPLETED_TASKS:
case TODO_FILTER_COMPLETED_TASKS:
gtk_tree_model_get(model, iter, TD_COL_DONE, &done, -1);
return done ? TRUE : FALSE;
case TODO_VIEW_REMAINING_TASKS:
case TODO_FILTER_REMAINING_TASKS:
gtk_tree_model_get(model, iter, TD_COL_DONE, &done, -1);
return done ? FALSE : TRUE;
default:
case TODO_VIEW_ALL_TASKS:
case TODO_FILTER_ALL_TASKS:
return TRUE;
}
}

View File

@ -31,48 +31,12 @@
#ifndef TODO_TODO_H
# define TODO_TODO_H
# include "../include/Todo.h"
# include "task.h"
# include <gtk/gtk.h>
/* Todo */
/* types */
typedef struct _Todo Todo;
typedef enum _TodoPriority
{
TODO_PRIORITY_UNKNOWN,
TODO_PRIORITY_LOW,
TODO_PRIORITY_MEDIUM,
TODO_PRIORITY_HIGH,
TODO_PRIORITY_URGENT
} TodoPriority;
typedef enum _TodoView
{
TODO_VIEW_ALL_TASKS = 0,
TODO_VIEW_COMPLETED_TASKS,
TODO_VIEW_REMAINING_TASKS
} TodoView;
# define TODO_VIEW_LAST TODO_VIEW_REMAINING_TASKS
# define TODO_VIEW_COUNT (TODO_VIEW_LAST + 1)
/* functions */
Todo * todo_new(GtkWidget * window, GtkAccelGroup * group);
void todo_delete(Todo * todo);
/* accessors */
TodoView todo_get_view(Todo * todo);
GtkWidget * todo_get_widget(Todo * todo);
void todo_set_view(Todo * todo, TodoView view);
/* useful */
void todo_about(Todo * todo);
int todo_error(Todo * todo, char const * message, int ret);
void todo_show_preferences(Todo * todo, gboolean show);
/* tasks */
Task * todo_task_add(Todo * todo, Task * task);
void todo_task_delete_selected(Todo * todo);

View File

@ -335,7 +335,7 @@ static void _todowindow_on_view_all_tasks(gpointer data)
{
TodoWindow * todo = data;
todo_set_view(todo->todo, TODO_VIEW_ALL_TASKS);
todo_set_filter(todo->todo, TODO_FILTER_ALL_TASKS);
}
@ -344,7 +344,7 @@ static void _todowindow_on_view_completed_tasks(gpointer data)
{
TodoWindow * todo = data;
todo_set_view(todo->todo, TODO_VIEW_COMPLETED_TASKS);
todo_set_filter(todo->todo, TODO_FILTER_COMPLETED_TASKS);
}
@ -353,7 +353,7 @@ static void _todowindow_on_view_remaining_tasks(gpointer data)
{
TodoWindow * todo = data;
todo_set_view(todo->todo, TODO_VIEW_REMAINING_TASKS);
todo_set_filter(todo->todo, TODO_FILTER_REMAINING_TASKS);
}

View File

@ -1,7 +1,8 @@
targets=todo
cflags_force=`pkg-config --cflags libDesktop Mailer` -fPIC
cppflags=-I../include
cflags_force=`pkg-config --cflags Mailer` -fPIC
cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libDesktop`
ldflags_force=`pkg-config --libs Mailer`
ldflags=-Wl,-z,relro -Wl,-z,now
dist=Makefile,subst.sh
@ -9,8 +10,9 @@ dist=Makefile,subst.sh
[todo]
type=plugin
sources=todo.c
ldflags=-L../src -Wl,-rpath,$(LIBDIR) -lTodo
install=$(LIBDIR)/Mailer/plugins
#sources
[todo.c]
depends=../src/priority.c,../src/task.c,../src/taskedit.c,../src/todo.c
depends=../src/libTodo$(SOEXT)

View File

@ -28,16 +28,9 @@
#ifndef EMBEDDED
# define EMBEDDED
#endif
#include <stdlib.h>
#include <Desktop/Mailer/plugin.h>
#include "../src/priority.c"
#include "../src/task.c"
#include "../src/taskedit.c"
#include "../src/todo.c"
#include "../include/Todo.h"
/* Todo */
@ -88,6 +81,7 @@ static MailerPlugin * _todo_init(MailerPluginHelper * helper)
{
TodoPlugin * todo;
GtkWidget * widget;
GtkTreeViewColumn * column;
size_t i;
if((todo = malloc(sizeof(*todo))) == NULL)
@ -101,12 +95,13 @@ static MailerPlugin * _todo_init(MailerPluginHelper * helper)
todo->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
widget = todo_get_widget(todo->todo);
gtk_box_pack_start(GTK_BOX(todo->widget), widget, TRUE, TRUE, 0);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(todo->todo->view),
FALSE);
widget = todo_get_view(todo->todo);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(widget), FALSE);
for(i = 0; i < TD_COL_COUNT; i++)
if(todo->todo->columns[i] != NULL && i != TD_COL_TITLE)
gtk_tree_view_column_set_visible(todo->todo->columns[i],
FALSE);
if((column = todo_get_view_column(todo->todo, i)) == NULL)
continue;
else if(i != TD_COL_TITLE)
gtk_tree_view_column_set_visible(column, FALSE);
gtk_widget_show_all(todo->widget);
return todo;
}