Merge branch 'khorben/mailer'
This commit is contained in:
commit
ab83dabe4f
|
@ -1,18 +1 @@
|
||||||
targets=todo
|
|
||||||
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 Mailer`
|
|
||||||
ldflags=-Wl,-z,relro -Wl,-z,now
|
|
||||||
dist=Makefile,subst.sh
|
dist=Makefile,subst.sh
|
||||||
|
|
||||||
#targets
|
|
||||||
[todo]
|
|
||||||
type=plugin
|
|
||||||
sources=todo.c
|
|
||||||
ldflags=-L../src -Wl,-rpath,$(LIBDIR) -lTodo
|
|
||||||
install=$(LIBDIR)/Mailer/plugins
|
|
||||||
|
|
||||||
#sources
|
|
||||||
[todo.c]
|
|
||||||
depends=../src/libTodo$(SOEXT)
|
|
||||||
|
|
123
tools/todo.c
123
tools/todo.c
|
@ -1,123 +0,0 @@
|
||||||
/* $Id$ */
|
|
||||||
/* Copyright (c) 2012-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. */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <Desktop/Mailer/plugin.h>
|
|
||||||
#include "../include/Todo.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Todo */
|
|
||||||
/* private */
|
|
||||||
/* types */
|
|
||||||
typedef struct _MailerPlugin TodoPlugin;
|
|
||||||
|
|
||||||
struct _MailerPlugin
|
|
||||||
{
|
|
||||||
MailerPluginHelper * helper;
|
|
||||||
|
|
||||||
Todo * todo;
|
|
||||||
|
|
||||||
/* widgets */
|
|
||||||
GtkWidget * widget;
|
|
||||||
GtkWidget * view;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* protected */
|
|
||||||
/* prototypes */
|
|
||||||
/* plug-in */
|
|
||||||
static MailerPlugin * _todo_init(MailerPluginHelper * helper);
|
|
||||||
static void _todo_destroy(TodoPlugin * todo);
|
|
||||||
static GtkWidget * _todo_get_widget(TodoPlugin * todo);
|
|
||||||
|
|
||||||
|
|
||||||
/* public */
|
|
||||||
/* variables */
|
|
||||||
/* plug-in */
|
|
||||||
MailerPluginDefinition plugin =
|
|
||||||
{
|
|
||||||
"Todo",
|
|
||||||
"todo",
|
|
||||||
NULL,
|
|
||||||
_todo_init,
|
|
||||||
_todo_destroy,
|
|
||||||
_todo_get_widget,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* protected */
|
|
||||||
/* functions */
|
|
||||||
/* plug-in */
|
|
||||||
/* todo_init */
|
|
||||||
static MailerPlugin * _todo_init(MailerPluginHelper * helper)
|
|
||||||
{
|
|
||||||
TodoPlugin * todo;
|
|
||||||
GtkWidget * widget;
|
|
||||||
GtkTreeViewColumn * column;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if((todo = malloc(sizeof(*todo))) == NULL)
|
|
||||||
return NULL;
|
|
||||||
if((todo->todo = todo_new(NULL, NULL)) == NULL)
|
|
||||||
{
|
|
||||||
_todo_destroy(todo);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
todo->helper = 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);
|
|
||||||
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((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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* todo_destroy */
|
|
||||||
static void _todo_destroy(TodoPlugin * todo)
|
|
||||||
{
|
|
||||||
if(todo->todo != NULL)
|
|
||||||
todo_delete(todo->todo);
|
|
||||||
free(todo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* todo_get_widget */
|
|
||||||
static GtkWidget * _todo_get_widget(TodoPlugin * todo)
|
|
||||||
{
|
|
||||||
return todo->widget;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user