Commit ba5c0f92 authored by Richard Hult's avatar Richard Hult Committed by Richard Hult

Don't hide the Actions menu when its's empty.

2005-04-18  Richard Hult  <richard@imendio.com>

	* src/planner-window.c (window_populate): Don't hide the Actions
	menu when its's empty.

	* data/ui/*.ui: Clean up some.

2005-04-17  Richard Hult  <richard@imendio.com>

	Work on getting the Python bindings uptodate.

	* libplanner/Makefile.am: Link the modules with libplanner.

	* python/Makefile.am: Split up the module in one for libplanner
	and one for the UI plugins.

	* python/test.py: Make it work.
	* python/python-demo.py: Likewise.

	* src/*.[ch]: Fix type macro for PlannerWindow.

	* src/planner-python-plugin.c: Clean up coding style and import
	the new ui module. Set the application as a global for scripts to
	use.
parent 866ec544
2005-04-18 Richard Hult <richard@imendio.com>
* src/planner-window.c (window_populate): Don't hide the Actions
menu when its's empty.
* data/ui/*.ui: Clean up some.
2005-04-17 Richard Hult <richard@imendio.com>
Work on getting the Python bindings uptodate.
* libplanner/Makefile.am: Link the modules with libplanner.
* python/Makefile.am: Split up the module in one for libplanner
and one for the UI plugins.
* python/test.py: Make it work.
* python/python-demo.py: Likewise.
* src/*.[ch]: Fix type macro for PlannerWindow.
* src/planner-python-plugin.c: Clean up coding style and import
the new ui module. Set the application as a global for scripts to
use.
2005-04-18 Richard Hult <richard@imendio.com>
* libplanner/Makefile.am:
......
......@@ -6,14 +6,14 @@
</menu>
<menu action="View">
<placeholder name="View specific placeholder"/>
<separator/>
<menuitem action="ZoomIn"/>
<menuitem action="ZoomOut"/>
<menuitem action="ZoomToFit"/>
<separator/>
<menuitem action="EditColumns"/>
<menuitem action="HighlightCriticalTasks"/>
<placeholder name="View specific placeholder">
<menuitem action="ZoomIn"/>
<menuitem action="ZoomOut"/>
<menuitem action="ZoomToFit"/>
<separator/>
<menuitem action="EditColumns"/>
<menuitem action="HighlightCriticalTasks"/>
</placeholder>
</menu>
<menu action="Actions">
......
......@@ -7,6 +7,13 @@
<placeholder name="View specific placeholder">
</placeholder>
</menu>
<menu action="View">
<placeholder name="View specific placeholder">
<menuitem action="EditColumns"/>
</placeholder>
</menu>
<menu action="Actions">
<placeholder name="View specific actions placeholder">
<menuitem action="InsertResource"/>
......@@ -14,9 +21,7 @@
<menuitem action="RemoveResource"/>
<separator/>
<menuitem action="EditResource"/>
<separator/>
<menuitem action="EditGroups"/>
<separator/>
<menuitem action="EditCustomProps"/>
</placeholder>
</menu>
......
<ui>
<menubar name="MenuBar">
<menu action="Edit">
<placeholder name="Selection placeholder">
<!--menuitem name="SelectAll" verb="" accel="*Control*a"/-->
......@@ -14,13 +15,11 @@
<menuitem action="ZoomIn"/>
<menuitem action="ZoomOut"/>
<menuitem action="ZoomToFit"/>
<separator/>
<menuitem action="EditColumns"/>
</placeholder>
</menu>
<menu action="Actions">
<placeholder name="View specific actions placeholder">
</placeholder>
</menu>
</menubar>
<toolbar name="ToolBar">
......
......@@ -57,10 +57,10 @@ libplanner_1_la_LIBADD = $(LIBPLANNER_LIBS)
libplannerincludedir = $(includedir)/planner-1.0/libplanner
#
# Storage modules
#
storagemoduledir = $(libdir)/planner/storage-modules
if HAVE_GDA
......@@ -78,6 +78,7 @@ libstorage_mrproject_1_la_SOURCES = \
mrp-parser.h
libstorage_mrproject_1_la_LDFLAGS = -avoid-version -module
libstorage_mrproject_1_la_LIBADD = libplanner-1.la
if HAVE_GDA
libstorage_sql_la_SOURCES = \
......@@ -87,14 +88,13 @@ libstorage_sql_la_SOURCES = \
mrp-sql.h
libstorage_sql_la_LDFLAGS = -avoid-version -module
libstorage_sql_la_LIBADD = $(GDA_LIBS)
libstorage_sql_la_CFLAGS = $(GDA_CFLAGS)
libstorage_sql_la_LIBADD = $(GDA_LIBS) libplanner-1.la
endif
#
# File modules
#
filemoduledir = $(libdir)/planner/file-modules
filemodule_LTLIBRARIES = \
......@@ -108,12 +108,12 @@ libmrp_xml_la_SOURCES = \
libmrp_xml_la_CFLAGS = -DDTDDIR=\""$(datadir)/planner/dtd"\"
libmrp_xml_la_LDFLAGS = -avoid-version -module
libmrp_xml_la_LIBADD = libplanner-1.la
libmrp_xsl_la_SOURCES = mrp-xsl.c
libmrp_xsl_la_CFLAGS = $(XSLT_CFLAGS) -DSTYLESHEETDIR=\""$(datadir)/planner/stylesheets"\"
libmrp_xsl_la_LIBADD = $(XSLT_LIBS)
libmrp_xsl_la_LDFLAGS = -avoid-version -module
libmrp_xsl_la_LIBADD = $(XSLT_LIBS) libplanner-1.la
mrp-marshal.h: Makefile.am mrp-marshal.list
$(GLIB_GENMARSHAL) --prefix=mrp_marshal $(srcdir)/mrp-marshal.list --header > xgen-gmh \
......
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/src/
-I$(top_srcdir)/src \
$(PYTHON_INCLUDES) \
$(PYGTK_CFLAGS) \
$(PLANNER_CFLAGS)
pkgpythondir = $(pythondir)/gtk-2.0
pkgpyexecdir = $(pyexecdir)/gtk-2.0
pkgpythondir = $(pythondir)
pkgpyexecdir = $(pyexecdir)
pkgpyexec_LTLIBRARIES = planner.la plannerui.la
pkgpyexec_LTLIBRARIES = planner.la
planner_la_CFLAGS = -Wno-missing-declarations -Wno-missing-prototypes
planner_la_LDFLAGS = -module -avoid-version -export-symbols-regex initplanner
planner_la_LIBADD = $(LIBPLANNER_LIBS) $(top_builddir)/libplanner/libplanner-1.la
planner_la_SOURCES = plannermodule.c
nodist_planner_la_SOURCES = planner.c
planner.c: planner.defs planner.override
plannerui_la_CFLAGS = -Wno-missing-declarations -Wno-missing-prototypes
plannerui_la_LDFLAGS = -module -avoid-version -export-symbols-regex initplannerui
plannerui_la_LIBADD = $(PLANNER_LIBS) $(top_builddir)/libplanner/libplanner-1.la
plannerui_la_SOURCES = planneruimodule.c
nodist_plannerui_la_SOURCES = plannerui.c
CLEANFILES = planner.c
CLEANFILES = planner.c plannerui.c
EXTRA_DIST = \
planner.override \
planner.defs \
planner-types.defs \
planner-arg-types.py \
$(NULL)
planner-arg-types.py \
\
plannerui.override \
plannerui.defs \
plannerui-types.defs
planner.c: planner.defs planner-types.defs planner.override
$(PYGTK_CODEGEN) \
--override $*.override \
--load-types planner-arg-types.py \
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
--prefix $* $*.defs > gen-$*.c \
&& cp gen-$*.c $*.c \
&& rm -f gen-$*.c
.defs.c:
(cd $(srcdir)\
&& $(PYGTK_CODEGEN) \
plannerui.c: plannerui.defs plannerui-types.defs plannerui.override
$(PYGTK_CODEGEN) \
--override $*.override \
--load-types planner-arg-types.py \
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
--prefix $* $*.defs) > gen-$*.c \
--register planner-types.defs \
--prefix $* $*.defs > gen-$*.c \
&& cp gen-$*.c $*.c \
&& rm -f gen-$*.c
......@@ -70,20 +70,6 @@
(gtype-id "MRP_TYPE_TASK")
)
(define-object Application
(in-module "Planner")
(parent "MrpApplication")
(c-name "PlannerApplication")
(gtype-id "PLANNER_TYPE_APPLICATION")
)
(define-object Window
(in-module "Planner")
(parent "GtkWindow")
(c-name "PlannerWindow")
(gtype-id "PLANNER_TYPE_MAIN_WINDOW")
)
;; Enumerations and flags ...
......
......@@ -1421,125 +1421,3 @@
)
)
;; From ../src/planner-application.h
(define-function planner_application_get_type
(c-name "planner_application_get_type")
(return-type "GType")
)
(define-function planner_application_new
(c-name "planner_application_new")
(is-constructor-of "PlannerApplication")
(return-type "PlannerApplication*")
)
(define-method new_window
(of-object "PlannerApplication")
(c-name "planner_application_new_window")
(return-type "GtkWidget*")
)
(define-method exit
(of-object "PlannerApplication")
(c-name "planner_application_exit")
(return-type "none")
)
(define-method get_recent_model
(of-object "PlannerApplication")
(c-name "planner_application_get_recent_model")
(return-type "EggRecentModel*")
)
(define-function planner_application_get_gconf_client
(c-name "planner_application_get_gconf_client")
(return-type "GConfClient*")
)
;; From ../src/planner-window.h
(define-function planner_window_get_type
(c-name "planner_window_get_type")
(return-type "GType")
)
(define-function planner_window_new
(c-name "planner_window_new")
(is-constructor-of "PlannerWindow")
(return-type "GtkWidget*")
(parameters
'("PlannerApplication*" "app")
)
)
(define-method open
(of-object "PlannerWindow")
(c-name "planner_window_open")
(return-type "gboolean")
(parameters
'("const-gchar*" "uri")
'("gboolean" "internal")
)
)
(define-method get_ui_manager
(of-object "PlannerWindow")
(c-name "planner_window_get_ui_manager")
(return-type "GtkUIManager*")
)
(define-method get_project
(of-object "PlannerWindow")
(c-name "planner_window_get_project")
(return-type "MrpProject*")
)
(define-method get_application
(of-object "PlannerWindow")
(c-name "planner_window_get_application")
(return-type "PlannerApplication*")
)
(define-method check_version
(of-object "PlannerWindow")
(c-name "planner_window_check_version")
(return-type "none")
)
(define-method close
(of-object "PlannerWindow")
(c-name "planner_window_close")
(return-type "none")
)
(define-method show_day_type_dialog
(of-object "PlannerWindow")
(c-name "planner_window_show_day_type_dialog")
(return-type "none")
)
(define-method show_calendar_dialog
(of-object "PlannerWindow")
(c-name "planner_window_show_calendar_dialog")
(return-type "none")
)
(define-method get_cmd_manager
(of-object "PlannerWindow")
(c-name "planner_window_get_cmd_manager")
(return-type "PlannerCmdManager*")
)
(define-method set_status
(of-object "PlannerWindow")
(c-name "planner_window_set_status")
(return-type "none")
(parameters
'("const-gchar*" "message")
)
)
......@@ -7,21 +7,12 @@ headers
#include <libplanner/planner.h>
#include <libplanner/mrp-storage-module.h>
#include <gtk/gtk.h>
#include "planner-application.h"
#include "planner-window.h"
#define PLANNER_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLANNER_TYPE_MAIN_WINDOW, PlannerWindow))
%%
init
%%
modulename planner
%%
import gobject.GObject as PyGObject_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.Window as PyGtkWindow_Type
import gtk.UIManager as PyGtkUIManager_Type
%%
ignore-glob
*_get_type
......
;; -*- scheme -*-
; object definitions ...
(define-object Application
(in-module "Planner")
(parent "MrpApplication")
(c-name "PlannerApplication")
(gtype-id "PLANNER_TYPE_APPLICATION")
)
(define-object Window
(in-module "Planner")
(parent "GtkWindow")
(c-name "PlannerWindow")
(gtype-id "PLANNER_TYPE_WINDOW")
)
;; -*- scheme -*-
(include "plannerui-types.defs")
;; From ../src/planner-application.h
(define-function planner_application_get_type
(c-name "planner_application_get_type")
(return-type "GType")
)
(define-function planner_application_new
(c-name "planner_application_new")
(is-constructor-of "PlannerApplication")
(return-type "PlannerApplication*")
)
(define-method new_window
(of-object "PlannerApplication")
(c-name "planner_application_new_window")
(return-type "GtkWidget*")
)
(define-method exit
(of-object "PlannerApplication")
(c-name "planner_application_exit")
(return-type "none")
)
(define-method get_recent_model
(of-object "PlannerApplication")
(c-name "planner_application_get_recent_model")
(return-type "EggRecentModel*")
)
(define-function planner_application_get_gconf_client
(c-name "planner_application_get_gconf_client")
(return-type "GConfClient*")
)
;; From ../src/planner-window.h
(define-function planner_window_get_type
(c-name "planner_window_get_type")
(return-type "GType")
)
(define-function planner_window_new
(c-name "planner_window_new")
(is-constructor-of "PlannerWindow")
(return-type "GtkWidget*")
(parameters
'("PlannerApplication*" "app")
)
)
(define-method open
(of-object "PlannerWindow")
(c-name "planner_window_open")
(return-type "gboolean")
(parameters
'("const-gchar*" "uri")
'("gboolean" "internal")
)
)
(define-method get_ui_manager
(of-object "PlannerWindow")
(c-name "planner_window_get_ui_manager")
(return-type "GtkUIManager*")
)
(define-method get_project
(of-object "PlannerWindow")
(c-name "planner_window_get_project")
(return-type "MrpProject*")
)
(define-method get_application
(of-object "PlannerWindow")
(c-name "planner_window_get_application")
(return-type "PlannerApplication*")
)
(define-method check_version
(of-object "PlannerWindow")
(c-name "planner_window_check_version")
(return-type "none")
)
(define-method close
(of-object "PlannerWindow")
(c-name "planner_window_close")
(return-type "none")
)
(define-method show_day_type_dialog
(of-object "PlannerWindow")
(c-name "planner_window_show_day_type_dialog")
(return-type "none")
)
(define-method show_calendar_dialog
(of-object "PlannerWindow")
(c-name "planner_window_show_calendar_dialog")
(return-type "none")
)
(define-method get_cmd_manager
(of-object "PlannerWindow")
(c-name "planner_window_get_cmd_manager")
(return-type "PlannerCmdManager*")
)
(define-method set_status
(of-object "PlannerWindow")
(c-name "planner_window_set_status")
(return-type "none")
(parameters
'("const-gchar*" "message")
)
)
/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#include <Python.h>
#include <pygobject.h>
#include <gtk/gtk.h>
#include <libplanner/planner.h>
#include <planner-window.h>
%%
init
%%
modulename plannerui
%%
import gobject.GObject as PyGObject_Type
import gtk.Widget as PyGtkWidget_Type
import gtk.Window as PyGtkWindow_Type
import gtk.UIManager as PyGtkUIManager_Type
import planner.Application as PyMrpApplication_Type
%%
ignore-glob
*_get_type
*_valist
%%
/* -*- Mode: C; c-basic-offset: 4 -*- */
#include <config.h>
/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.h>
void initplannerui(void);
void plannerui_register_classes (PyObject *d);
//void plannerui_add_constants(PyObject *module, const gchar *strip_prefix);
extern PyMethodDef plannerui_functions[];
DL_EXPORT(void)
initplannerui(void)
{
PyObject *m, *d;
init_pygobject ();
m = Py_InitModule ("plannerui", plannerui_functions);
d = PyModule_GetDict (m);
plannerui_register_classes (d);
if (PyErr_Occurred ()) {
PyErr_Print ();
Py_FatalError ("can't initialise module plannerui");
}
}
# This file is a small demo for the planner/python integration. Copy
# it under ~/.gnome2/planner/python/ and restart planner. You'll
# notice a new entry in the file->import menu.
#
# This file is a small demo for the planner/python integration
# Copy it under ~/.gnome2/planner/python/ and restart planner.
# You'll notice a new entry in the file->export menu :)
#
import pygtk
pygtk.require('2.0')
import gtk
import planner
print '***************'
ui_string = """
<ui>
<menubar name="MenuBar">
<menu action="File">
<menu action="Import">
<placeholder name="Import placeholder">
<menuitem action="Python import"/>
<menubar name='MenuBar'>
<menu action='File'>
<menu action='Import'>
<placeholder name='Import placeholder'>
<menuitem action='Python import'/>
</placeholder>
</menu>
</menu>
......@@ -27,7 +19,7 @@ ui_string = """
def import_python(*args):
action = args[0]
print 'Activated the action:',action.get_name()
print 'Activated the action:', action.get_name()
project = window.get_project()
t1 = planner.Task()
t1.set_name('Python demo')
......@@ -39,14 +31,12 @@ python_actions = [
('Python import', None, '_Python', None, 'Python demo', import_python),
]
group = gtk.ActionGroup('PythonImport')
group.add_actions(python_actions)
ui = window.get_ui_manager()
ui.insert_action_group(group,0)
ui.insert_action_group(group, 0)
ui.add_ui_from_string(ui_string)
ui.ensure_update()
print '***************'
import pygtk
pygtk.require('2.0')
import gtk
import planner
#if project.is_empty():
# print 'The project is empty.'
#else:
# print 'The project is not empty.'
app = planner.Application()
#
# Test case nr 1
#
project = planner.Project(app)
t1 = planner.Task()
t1.set_name('T1')
......@@ -24,12 +16,8 @@ r1.set_custom_property('cost',125.0)
r1.assign(t1,100)
if t1.get_cost() == 125*8:
print 'Test1 .... OK'
print 'Test1 .... OK'
else:
print 'Test1 .... FAILED'
#
# Test case nr 2
#
......@@ -155,11 +155,12 @@ usage_source = \
planner-usage-tree.c \
planner-usage-tree.h
planner_LDADD = \
planner_LDADD = \
$(top_builddir)/libplanner/libplanner-1.la \
$(top_builddir)/libegg/recent-files/libeggrecent.la \
$(PLANNER_LIBS)
planner_LDFLAGS = -export-dynamic
#
# Plugins
......
......@@ -213,7 +213,7 @@ application_window_closed_cb (PlannerWindow *window,
{
PlannerApplicationPriv *priv;
g_return_if_fail (PLANNER_IS_MAIN_WINDOW (window));
g_return_if_fail (PLANNER_IS_WINDOW (window));
g_return_if_fail (PLANNER_IS_APPLICATION (application));
priv = application->priv;
......
......@@ -588,7 +588,7 @@ planner_calendar_dialog_new (PlannerWindow *window)
GtkTreeSelection *selection;
gint i;
g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
"calendar_dialog",
......
......@@ -76,7 +76,7 @@ planner_calendar_selector_new (PlannerWindow *window,
GtkWidget *w;
GtkTreeSelection *selection;
g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
"calendar_selector",
......
......@@ -149,7 +149,7 @@ planner_day_type_dialog_new (PlannerWindow *window)
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
"day_type_dialog",
......
......@@ -158,7 +158,7 @@ planner_default_week_dialog_new (PlannerWindow *window,
GtkWidget *w;
gint i;
g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
"default_week_dialog",
......
......@@ -50,81 +50,77 @@ struct _PlannerGanttViewPriv {
guint merged_id;
};
static GtkWidget *gantt_view_create_widget (PlannerGanttView *view);
static void gantt_view_insert_task_cb (GtkAction *action,
gpointer data);
static void gantt_view_insert_tasks_cb (GtkAction *action,
gpointer data);
static void gantt_view_remove_task_cb (GtkAction *action,
gpointer data);
static void gantt_view_edit_task_cb (GtkAction *action,
gpointer data);
static void gantt_view_select_all_cb (GtkAction *action,
gpointer data);