r1438@localhost: muntyan | 2005-12-21 01:03:50 -0600
Made it easier to build standalone python moo modulemaster
parent
160c9eb5d8
commit
7812e6958d
43
configure.ac
43
configure.ac
|
@ -68,31 +68,8 @@ MOO_AC_PYGTK
|
|||
# pcre
|
||||
MOO_AC_PCRE
|
||||
|
||||
|
||||
################################################################################
|
||||
# Python module
|
||||
#
|
||||
AC_ARG_ENABLE([moo-module],
|
||||
AC_HELP_STRING([--enable-moo-module], [create standalone python module 'moo' (default = YES)]),
|
||||
[
|
||||
if test x$enable_moo_module = "xno"; then
|
||||
build_pymoo="no"
|
||||
else
|
||||
build_pymoo="yes"
|
||||
fi
|
||||
], [
|
||||
build_pymoo="yes"
|
||||
])
|
||||
|
||||
if test x$MOO_USE_PYGTK = "xyes"; then
|
||||
if test x$build_pymoo != "xno"; then
|
||||
build_pymoo="yes"
|
||||
fi
|
||||
else
|
||||
build_pymoo="no"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_PYMOO, test x$build_pymoo = "xyes")
|
||||
MOO_AC_MODULE
|
||||
|
||||
|
||||
################################################################################
|
||||
|
@ -141,21 +118,34 @@ AM_CONDITIONAL(MOO_BUILD_UTILS, test "x$build_mooutils" != "xno")
|
|||
AM_CONDITIONAL(MOO_BUILD_EDIT, test "x$build_mooedit" != "xno")
|
||||
AM_CONDITIONAL(MOO_BUILD_TERM, test "x$build_mooterm" != "xno")
|
||||
AM_CONDITIONAL(MOO_BUILD_APP, test "x$build_mooapp" != "xno")
|
||||
AM_CONDITIONAL(MOO_BUILD_PLUGINS, true)
|
||||
|
||||
MOO_BUILD_UTILS=0
|
||||
MOO_BUILD_EDIT=0
|
||||
MOO_BUILD_TERM=0
|
||||
MOO_BUILD_APP=0
|
||||
|
||||
if test "x$build_mooutils" != "xno"; then
|
||||
AC_DEFINE(MOO_BUILD_UTILS,, [build mooutils])
|
||||
MOO_BUILD_UTILS=1
|
||||
fi
|
||||
if test "x$build_mooedit" != "xno"; then
|
||||
AC_DEFINE(MOO_BUILD_EDIT,, [build mooedit])
|
||||
MOO_BUILD_EDIT=1
|
||||
fi
|
||||
if test "x$build_mooterm" != "xno"; then
|
||||
AC_DEFINE(MOO_BUILD_TERM,, [build mooterm])
|
||||
MOO_BUILD_TERM=1
|
||||
fi
|
||||
if test "x$build_mooapp" != "xno"; then
|
||||
AC_DEFINE(MOO_BUILD_APP,, [build mooapp])
|
||||
MOO_BUILD_APP=1
|
||||
fi
|
||||
|
||||
AC_SUBST(MOO_BUILD_UTILS)
|
||||
AC_SUBST(MOO_BUILD_EDIT)
|
||||
AC_SUBST(MOO_BUILD_TERM)
|
||||
AC_SUBST(MOO_BUILD_APP)
|
||||
|
||||
moo_top_src_dir=`cd $srcdir && pwd`
|
||||
moo_top_build_dir=`cd ./$ac_top_builddir && pwd`
|
||||
MOO_CFLAGS="-I$moo_top_src_dir/moo $GTK_CFLAGS -DXDG_PREFIX=_moo_edit_xdg -DG_LOG_DOMAIN=\\\"Moo\\\" -D__MOO__ -DMOO_MARSHALS_H=\\\"mooutils/moomarshals.h\\\""
|
||||
|
@ -228,9 +218,10 @@ Makefile
|
|||
moo/moo-config.h
|
||||
moo/mooterm/termhelper_res.rc
|
||||
moo/mooutils/pcre/pcre.h
|
||||
moo/moopython/moo-mod.py
|
||||
moo/moo.pc
|
||||
tests/pyapp.py
|
||||
m4/Makefile
|
||||
moo.pc
|
||||
])
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
##############################################################################
|
||||
# MOO_AC_MODULE()
|
||||
#
|
||||
AC_DEFUN([MOO_AC_MODULE],[
|
||||
AC_REQUIRE([MOO_AC_PYGTK])
|
||||
|
||||
AC_ARG_ENABLE([moo-module],
|
||||
AC_HELP_STRING([--enable-moo-module], [create standalone python module 'moo' (default = YES)]),
|
||||
[
|
||||
if test x$enable_moo_module = "xno"; then
|
||||
build_pymoo="no"
|
||||
else
|
||||
build_pymoo="yes"
|
||||
fi
|
||||
], [
|
||||
build_pymoo="yes"
|
||||
])
|
||||
|
||||
if test x$MOO_USE_PYGTK = "xyes"; then
|
||||
if test x$build_pymoo != "xno"; then
|
||||
build_pymoo="yes"
|
||||
fi
|
||||
else
|
||||
build_pymoo="no"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_PYMOO, test x$build_pymoo = "xyes")
|
||||
])
|
|
@ -268,16 +268,16 @@
|
|||
</kdevdoctreeview>
|
||||
<kdevfilecreate>
|
||||
<filetypes>
|
||||
<type icon="source" ext="g" name="GAP source" create="template" >
|
||||
<type icon="source" ext="g" create="template" name="GAP source" >
|
||||
<descr>A new empty GAP source file</descr>
|
||||
</type>
|
||||
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
|
||||
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
|
||||
<descr>A new empty C++ file.</descr>
|
||||
</type>
|
||||
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
|
||||
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
|
||||
<descr>A new empty header file for C/C++.</descr>
|
||||
</type>
|
||||
<type icon="source_c" ext="c" name="C Source" create="template" >
|
||||
<type icon="source_c" ext="c" create="template" name="C Source" >
|
||||
<descr>A new empty C file.</descr>
|
||||
</type>
|
||||
</filetypes>
|
||||
|
|
|
@ -42,7 +42,11 @@ $(mooapp)/mooappabout-glade.h: $(mooapp_srcdir)/glade/mooappabout.glade $(XML2H)
|
|||
mkdir -p $(mooapp)
|
||||
sh $(XML2H) MOO_APP_ABOUT_GLADE_UI $(mooapp_srcdir)/glade/mooappabout.glade > $(mooapp)/mooappabout-glade.h
|
||||
|
||||
|
||||
if MOO_BUILD_APP
|
||||
moo_sources += $(mooapp_sources)
|
||||
moo_built_sources += $(mooapp_built_sources)
|
||||
else
|
||||
moo_extra_dist += $(mooapp_sources)
|
||||
endif
|
||||
|
||||
moo_extra_dist += $(mooapp_extra_dist)
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "mooutils/moocompat.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/mooglade.h"
|
||||
#include "mooutils/moocellrenderercolor.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ moopython_built_sources = \
|
|||
$(moopython)/moo-mod.h
|
||||
|
||||
nodist_moopython_sources =
|
||||
moopython_cleanfiles =
|
||||
moopython_cleanfiles = $(moopython)/moo-mod.h
|
||||
|
||||
mooedit_defs_files = \
|
||||
$(moopython)/mooeditor.defs \
|
||||
|
@ -150,7 +150,7 @@ $(moopython)/mooapp-pygtk.c: $(moopython)/mooapp-pygtk.defs $(moopython)/mooapp-
|
|||
|
||||
$(moopython)/moo-mod.h: $(moopython)/moo-mod.py $(PY2H)
|
||||
mkdir -p $(moopython)
|
||||
sh $(PY2H) MOO_PY $(moopython_srcdir)/moo-mod.py > $(moopython)/moo-mod.h
|
||||
sh $(PY2H) MOO_PY $(moopython)/moo-mod.py > $(moopython)/moo-mod.h
|
||||
$(moopython)/mooedit-mod.h: $(moopython)/mooedit-mod.py $(PY2H)
|
||||
mkdir -p $(moopython)
|
||||
sh $(PY2H) MOO_EDIT_PY $(moopython_srcdir)/mooedit-mod.py > $(moopython)/mooedit-mod.h
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
"""moo module"""
|
||||
|
||||
import moo_utils as utils
|
||||
import moo_term as term
|
||||
import moo_edit as edit
|
||||
import moo_app as app
|
|
@ -0,0 +1,10 @@
|
|||
"""moo module"""
|
||||
|
||||
if @MOO_BUILD_UTILS@:
|
||||
import moo_utils as utils
|
||||
if @MOO_BUILD_TERM@:
|
||||
import moo_term as term
|
||||
if @MOO_BUILD_EDIT@:
|
||||
import moo_edit as edit
|
||||
if @MOO_BUILD_APP@:
|
||||
import moo_app as app
|
|
@ -76,11 +76,22 @@ initmoo (void)
|
|||
PyModule_AddObject (_moo_module, (char*)"version", moo_version());
|
||||
PyModule_AddObject (_moo_module, (char*)"detailed_version", moo_detailed_version());
|
||||
|
||||
if (!_moo_utils_mod_init () || !_moo_term_mod_init () ||
|
||||
!_moo_edit_mod_init () || !_moo_app_mod_init ())
|
||||
{
|
||||
#ifdef MOO_BUILD_UTILS
|
||||
if (!_moo_utils_mod_init ())
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOO_BUILD_TERM
|
||||
if (!_moo_term_mod_init ())
|
||||
return FALSE;
|
||||
#endif
|
||||
#ifdef MOO_BUILD_EDIT
|
||||
if (!_moo_edit_mod_init ())
|
||||
return FALSE;
|
||||
#endif
|
||||
#ifdef MOO_BUILD_APP
|
||||
if (!_moo_app_mod_init ())
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
code = Py_CompileString (MOO_PY, "moo/__init__.py", Py_file_input);
|
||||
|
||||
|
|
|
@ -90,4 +90,5 @@ moo_extra_dist += $(mooterm_extra_dist)
|
|||
if MOO_OS_CYGWIN
|
||||
noinst_PROGRAMS += termhelper
|
||||
termhelper_SOURCES = $(termhelper_sources)
|
||||
termhelper_CFLAGS =
|
||||
endif
|
||||
|
|
|
@ -13,7 +13,6 @@ mooutils_include_headers = \
|
|||
$(mooutils)/mooaction.h \
|
||||
$(mooutils)/mooactiongroup.h \
|
||||
$(mooutils)/moobigpaned.h \
|
||||
$(mooutils)/moocellrenderercolor.h \
|
||||
$(mooutils)/mooclosure.h \
|
||||
$(mooutils)/moocmd.h \
|
||||
$(mooutils)/moocombo.h \
|
||||
|
@ -50,7 +49,6 @@ mooutils_sources = \
|
|||
$(mooutils)/mooaction.c \
|
||||
$(mooutils)/mooactiongroup.c \
|
||||
$(mooutils)/moobigpaned.c \
|
||||
$(mooutils)/moocellrenderercolor.c \
|
||||
$(mooutils)/mooclosure.c \
|
||||
$(mooutils)/moocombo.c \
|
||||
$(mooutils)/moocompat.c \
|
||||
|
|
|
@ -1,333 +0,0 @@
|
|||
/*
|
||||
* moocellrenderercolor.c
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#include "mooutils/moocellrenderercolor.h"
|
||||
#include "mooutils/moomarshals.h"
|
||||
#include "mooutils/moodialogs.h"
|
||||
#include <gtk/gtkcolorseldialog.h>
|
||||
|
||||
#define CELL_MIN_WIDTH 20
|
||||
#define CELL_MIN_HEIGHT 12
|
||||
#define CELL_BORDER_WIDTH 1
|
||||
|
||||
|
||||
static void moo_cell_renderer_color_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void moo_cell_renderer_color_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void moo_cell_renderer_color_get_size (GtkCellRenderer *cell,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *rectangle,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
gint *width,
|
||||
gint *height);
|
||||
static void moo_cell_renderer_color_render (GtkCellRenderer *cell,
|
||||
GdkDrawable *window,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *background_area,
|
||||
GdkRectangle *cell_area,
|
||||
GdkRectangle *expose_area,
|
||||
GtkCellRendererState flags);
|
||||
static gboolean moo_cell_renderer_color_activate (GtkCellRenderer *cell,
|
||||
GdkEvent *event,
|
||||
GtkWidget *widget,
|
||||
const gchar *path,
|
||||
GdkRectangle *background_area,
|
||||
GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags);
|
||||
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_COLOR,
|
||||
PROP_COLOR_SET,
|
||||
PROP_ACTIVATABLE
|
||||
};
|
||||
|
||||
enum {
|
||||
COLOR_SET,
|
||||
NUM_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals[NUM_SIGNALS];
|
||||
|
||||
G_DEFINE_TYPE (MooCellRendererColor, moo_cell_renderer_color, GTK_TYPE_CELL_RENDERER)
|
||||
|
||||
|
||||
static void
|
||||
moo_cell_renderer_color_class_init (MooCellRendererColorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
|
||||
|
||||
object_class->get_property = moo_cell_renderer_color_get_property;
|
||||
object_class->set_property = moo_cell_renderer_color_set_property;
|
||||
|
||||
cell_class->get_size = moo_cell_renderer_color_get_size;
|
||||
cell_class->render = moo_cell_renderer_color_render;
|
||||
cell_class->activate = moo_cell_renderer_color_activate;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_COLOR,
|
||||
g_param_spec_boxed ("color",
|
||||
"color",
|
||||
"color",
|
||||
GDK_TYPE_COLOR,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_ACTIVATABLE,
|
||||
g_param_spec_boolean ("activatable",
|
||||
"activatable",
|
||||
"activatable",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_COLOR_SET,
|
||||
g_param_spec_boolean ("color-set",
|
||||
"color-set",
|
||||
"color-set",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
signals[COLOR_SET] =
|
||||
g_signal_new ("color-set",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (MooCellRendererColorClass, color_set),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_COLOR);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_cell_renderer_color_init (MooCellRendererColor *cell)
|
||||
{
|
||||
cell->color_set = FALSE;
|
||||
cell->activatable = FALSE;
|
||||
GTK_CELL_RENDERER(cell)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
|
||||
GTK_CELL_RENDERER(cell)->xpad = 2;
|
||||
GTK_CELL_RENDERER(cell)->ypad = 2;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_cell_renderer_color_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooCellRendererColor *cell = MOO_CELL_RENDERER_COLOR (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
g_value_set_boxed (value, &cell->color);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_SET:
|
||||
g_value_set_boolean (value, cell->color_set ? TRUE : FALSE);
|
||||
break;
|
||||
|
||||
case PROP_ACTIVATABLE:
|
||||
g_value_set_boolean (value, cell->activatable ? TRUE : FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_cell_renderer_color_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkColor *color;
|
||||
MooCellRendererColor *cell = MOO_CELL_RENDERER_COLOR (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
color = g_value_get_boxed (value);
|
||||
if (color)
|
||||
{
|
||||
cell->color = *color;
|
||||
cell->color_set = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell->color_set = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_COLOR_SET:
|
||||
cell->color_set = g_value_get_boolean (value) ? TRUE : FALSE;
|
||||
break;
|
||||
|
||||
case PROP_ACTIVATABLE:
|
||||
cell->activatable = g_value_get_boolean (value) ? TRUE : FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GtkCellRenderer *
|
||||
moo_cell_renderer_color_new (void)
|
||||
{
|
||||
return g_object_new (MOO_TYPE_CELL_RENDERER_COLOR, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_cell_renderer_color_get_size (GtkCellRenderer *gtkcell,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
int border_x = CELL_BORDER_WIDTH;
|
||||
int border_y = CELL_BORDER_WIDTH;
|
||||
|
||||
if (widget->style)
|
||||
{
|
||||
border_x = widget->style->xthickness;
|
||||
border_y = widget->style->ythickness;
|
||||
}
|
||||
|
||||
if (x_offset)
|
||||
*x_offset = 0;
|
||||
if (y_offset)
|
||||
*y_offset = 0;
|
||||
if (width)
|
||||
*width = 2 * gtkcell->xpad + 2 * border_x + CELL_MIN_WIDTH;
|
||||
if (height)
|
||||
*height = 2 * gtkcell->ypad + 2 * border_y + CELL_MIN_HEIGHT;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_cell_renderer_color_render (GtkCellRenderer *gtkcell,
|
||||
GdkWindow *window,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *background_area,
|
||||
GdkRectangle *cell_area,
|
||||
GdkRectangle *expose_area,
|
||||
GtkCellRendererState flags)
|
||||
|
||||
{
|
||||
MooCellRendererColor *cell = MOO_CELL_RENDERER_COLOR (gtkcell);
|
||||
GdkRectangle rect;
|
||||
GdkGC *gc;
|
||||
|
||||
rect = *cell_area;
|
||||
rect.x += gtkcell->xpad;
|
||||
rect.y += gtkcell->ypad;
|
||||
rect.width -= gtkcell->xpad * 2;
|
||||
rect.height -= gtkcell->ypad * 2;
|
||||
|
||||
if (cell->color_set)
|
||||
{
|
||||
static GdkGCValues values;
|
||||
GdkColormap *colormap;
|
||||
|
||||
colormap = gtk_widget_get_colormap (widget);
|
||||
g_return_if_fail (colormap != NULL);
|
||||
gdk_colormap_alloc_color (colormap, &cell->color, TRUE, TRUE);
|
||||
|
||||
values.foreground = cell->color;
|
||||
|
||||
gc = gdk_gc_new_with_values (window, &values, GDK_GC_FOREGROUND);
|
||||
gdk_draw_rectangle (window, gc, TRUE, rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
g_object_unref (gc);
|
||||
}
|
||||
|
||||
if (flags & GTK_CELL_RENDERER_SELECTED)
|
||||
gc = widget->style->text_gc[GTK_STATE_SELECTED];
|
||||
else if (flags & GTK_CELL_RENDERER_INSENSITIVE)
|
||||
gc = widget->style->text_gc[GTK_STATE_INSENSITIVE];
|
||||
else
|
||||
gc = widget->style->text_gc[GTK_STATE_NORMAL];
|
||||
|
||||
gdk_draw_rectangle (window, gc, FALSE, rect.x, rect.y,
|
||||
rect.width - 1, rect.height - 1);
|
||||
|
||||
if (!cell->color_set)
|
||||
gdk_draw_line (window, gc,
|
||||
rect.x,
|
||||
rect.y + rect.height - 1,
|
||||
rect.x + rect.width - 1,
|
||||
rect.y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
moo_cell_renderer_color_activate (GtkCellRenderer *gtkcell,
|
||||
GdkEvent *event,
|
||||
GtkWidget *widget,
|
||||
const gchar *path,
|
||||
GdkRectangle *background_area,
|
||||
GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
MooCellRendererColor *cell = MOO_CELL_RENDERER_COLOR (gtkcell);
|
||||
|
||||
if (cell->activatable)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkColorSelectionDialog *color_dialog;
|
||||
GtkColorSelection *colorsel;
|
||||
GdkColor color;
|
||||
int response;
|
||||
|
||||
dialog = gtk_color_selection_dialog_new (NULL);
|
||||
color_dialog = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
colorsel = GTK_COLOR_SELECTION (color_dialog->colorsel);
|
||||
|
||||
gtk_color_selection_set_current_color (colorsel, &cell->color);
|
||||
|
||||
moo_position_window (dialog, widget, TRUE, FALSE, 0, 0);
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
gtk_color_selection_get_current_color (colorsel, &color);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
g_signal_emit (cell, signals[COLOR_SET], 0, &color);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* moocellrenderercolor.h
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef __MOO_CELL_RENDERER_COLOR_H__
|
||||
#define __MOO_CELL_RENDERER_COLOR_H__
|
||||
|
||||
#include <gtk/gtkcellrenderer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_CELL_RENDERER_COLOR (moo_cell_renderer_color_get_type ())
|
||||
#define MOO_CELL_RENDERER_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_CELL_RENDERER_COLOR, MooCellRendererColor))
|
||||
#define MOO_CELL_RENDERER_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_CELL_RENDERER_COLOR, MooCellRendererColorClass))
|
||||
#define MOO_IS_CELL_RENDERER_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_CELL_RENDERER_COLOR))
|
||||
#define MOO_IS_CELL_RENDERER_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_CELL_RENDERER_COLOR))
|
||||
#define MOO_CELL_RENDERER_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_CELL_RENDERER_COLOR, MooCellRendererColorClass))
|
||||
|
||||
typedef struct _MooCellRendererColor MooCellRendererColor;
|
||||
typedef struct _MooCellRendererColorClass MooCellRendererColorClass;
|
||||
|
||||
struct _MooCellRendererColor
|
||||
{
|
||||
GtkCellRenderer parent;
|
||||
|
||||
GdkColor color;
|
||||
guint color_set : 1;
|
||||
guint activatable : 1;
|
||||
};
|
||||
|
||||
struct _MooCellRendererColorClass
|
||||
{
|
||||
GtkCellRendererClass parent_class;
|
||||
|
||||
void (*color_set) (MooCellRendererColor *cell,
|
||||
GdkColor *color);
|
||||
};
|
||||
|
||||
GType moo_cell_renderer_color_get_type (void) G_GNUC_CONST;
|
||||
GtkCellRenderer *moo_cell_renderer_color_new (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MOO_CELL_RENDERER_COLOR_H__ */
|
Loading…
Reference in New Issue