diff --git a/configure.ac b/configure.ac index cfeb481b..81c849de 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ Makefile bin/Makefile data/Makefile lib/Makefile -lib/xdgmime/Makefile +lib/ui/Makefile services/Makefile services/clipboard/Makefile shell/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index 445307e7..55298bf5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,51 +1,21 @@ -SUBDIRS = xdgmime +SUBDIRS = ui + +INCLUDES = -DXDG_PREFIX=sugar_mime -libsugar_la_CPPFLAGS = \ - $(LIB_CFLAGS) - noinst_LTLIBRARIES = libsugar.la -libsugar_la_LIBADD = \ - $(LIB_LIBS) \ - $(top_builddir)/lib/xdgmime/libxdgmime.la - -libsugar_la_SOURCES = \ - $(BUILT_SOURCES) \ - eggaccelerators.c \ - eggaccelerators.h \ - sugar-address-entry.c \ - sugar-address-entry.h \ - sugar-key-grabber.c \ - sugar-key-grabber.h \ - sugar-menu.h \ - sugar-menu.c \ - sugar-x11-util.c \ - sugar-x11-util.h - -BUILT_SOURCES = \ - sugar-marshal.c \ - sugar-marshal.h - -stamp_files = \ - stamp-sugar-marshal.c \ - stamp-sugar-marshal.h - -sugar-marshal.c: stamp-sugar-marshal.c - @true -stamp-sugar-marshal.c: sugar-marshal.list - $(GLIB_GENMARSHAL) --prefix=sugar_marshal \ - $(srcdir)/sugar-marshal.list --header --body > \ - sugar-marshal.c && echo timestamp > $(@F) - -sugar-marshal.h: stamp-sugar-marshal.h - @true -stamp-sugar-marshal.h: sugar-marshal.list - $(GLIB_GENMARSHAL) --prefix=sugar_marshal \ - $(srcdir)/sugar-marshal.list --header > \ - sugar-marshal.h && echo timestamp > $(@F) - -CLEANFILES = $(stamp_files) $(BUILT_SOURCES) -DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES) -MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES) - -EXTRA_DIST = sugar-marshal.list +libsugar_la_SOURCES = \ + xdgmime.c \ + xdgmime.h \ + xdgmimealias.c \ + xdgmimealias.h \ + xdgmimecache.c \ + xdgmimecache.h \ + xdgmimeglob.c \ + xdgmimeglob.h \ + xdgmimeint.c \ + xdgmimeint.h \ + xdgmimemagic.c \ + xdgmimemagic.h \ + xdgmimeparent.c \ + xdgmimeparent.h diff --git a/lib/ui/Makefile.am b/lib/ui/Makefile.am new file mode 100644 index 00000000..3640a08a --- /dev/null +++ b/lib/ui/Makefile.am @@ -0,0 +1,48 @@ +libsugarui_la_CPPFLAGS = \ + $(LIB_CFLAGS) + +noinst_LTLIBRARIES = libsugarui.la + +libsugarui_la_LIBADD = \ + $(LIB_LIBS) + +libsugarui_la_SOURCES = \ + $(BUILT_SOURCES) \ + eggaccelerators.c \ + eggaccelerators.h \ + sugar-address-entry.c \ + sugar-address-entry.h \ + sugar-key-grabber.c \ + sugar-key-grabber.h \ + sugar-menu.h \ + sugar-menu.c \ + sugar-x11-util.c \ + sugar-x11-util.h + +BUILT_SOURCES = \ + sugar-marshal.c \ + sugar-marshal.h + +stamp_files = \ + stamp-sugar-marshal.c \ + stamp-sugar-marshal.h + +sugar-marshal.c: stamp-sugar-marshal.c + @true +stamp-sugar-marshal.c: sugar-marshal.list + $(GLIB_GENMARSHAL) --prefix=sugar_marshal \ + $(srcdir)/sugar-marshal.list --header --body > \ + sugar-marshal.c && echo timestamp > $(@F) + +sugar-marshal.h: stamp-sugar-marshal.h + @true +stamp-sugar-marshal.h: sugar-marshal.list + $(GLIB_GENMARSHAL) --prefix=sugar_marshal \ + $(srcdir)/sugar-marshal.list --header > \ + sugar-marshal.h && echo timestamp > $(@F) + +CLEANFILES = $(stamp_files) $(BUILT_SOURCES) +DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES) +MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES) + +EXTRA_DIST = sugar-marshal.list diff --git a/lib/eggaccelerators.c b/lib/ui/eggaccelerators.c similarity index 100% rename from lib/eggaccelerators.c rename to lib/ui/eggaccelerators.c diff --git a/lib/eggaccelerators.h b/lib/ui/eggaccelerators.h similarity index 100% rename from lib/eggaccelerators.h rename to lib/ui/eggaccelerators.h diff --git a/lib/sugar-address-entry.c b/lib/ui/sugar-address-entry.c similarity index 100% rename from lib/sugar-address-entry.c rename to lib/ui/sugar-address-entry.c diff --git a/lib/sugar-address-entry.h b/lib/ui/sugar-address-entry.h similarity index 100% rename from lib/sugar-address-entry.h rename to lib/ui/sugar-address-entry.h diff --git a/lib/sugar-key-grabber.c b/lib/ui/sugar-key-grabber.c similarity index 100% rename from lib/sugar-key-grabber.c rename to lib/ui/sugar-key-grabber.c diff --git a/lib/sugar-key-grabber.h b/lib/ui/sugar-key-grabber.h similarity index 100% rename from lib/sugar-key-grabber.h rename to lib/ui/sugar-key-grabber.h diff --git a/lib/sugar-marshal.list b/lib/ui/sugar-marshal.list similarity index 100% rename from lib/sugar-marshal.list rename to lib/ui/sugar-marshal.list diff --git a/lib/sugar-menu.c b/lib/ui/sugar-menu.c similarity index 100% rename from lib/sugar-menu.c rename to lib/ui/sugar-menu.c diff --git a/lib/sugar-menu.h b/lib/ui/sugar-menu.h similarity index 100% rename from lib/sugar-menu.h rename to lib/ui/sugar-menu.h diff --git a/lib/sugar-x11-util.c b/lib/ui/sugar-x11-util.c similarity index 100% rename from lib/sugar-x11-util.c rename to lib/ui/sugar-x11-util.c diff --git a/lib/sugar-x11-util.h b/lib/ui/sugar-x11-util.h similarity index 100% rename from lib/sugar-x11-util.h rename to lib/ui/sugar-x11-util.h diff --git a/lib/xdgmime/xdgmime.c b/lib/xdgmime.c similarity index 100% rename from lib/xdgmime/xdgmime.c rename to lib/xdgmime.c diff --git a/lib/xdgmime/xdgmime.h b/lib/xdgmime.h similarity index 100% rename from lib/xdgmime/xdgmime.h rename to lib/xdgmime.h diff --git a/lib/xdgmime/ChangeLog b/lib/xdgmime/ChangeLog deleted file mode 100644 index d04c59a6..00000000 --- a/lib/xdgmime/ChangeLog +++ /dev/null @@ -1,378 +0,0 @@ -2007-01-22 Matthias Clasen - - * === 2.10.9 === - -2007-01-17 Matthias Clasen - - * === Released 2.10.8 === - -2007-01-07 Matthias Clasen - - * xdgmimecache.c (cache_glob_node_lookup_suffix): Don't return "" - as match. (fd.o #9544, Yevgen Muntyan) - -2007-01-07 Matthias Clasen - - * xdgmimecache.c (_xdg_mime_cache_list_mime_parents): Fix - several problems with this function. (fd.o #9560, Yevgen Muntyan) - -2007-01-05 Matthias Clasen - - * === Released 2.10.7 === - -2006-10-03 Matthias Clasen - - * === Released 2.10.6 === - -2006-10-02 Matthias Clasen - - * === Released 2.10.5 === - -2006-09-22 Matthias Clasen - - * === Released 2.10.4 === - -2006-09-04 Matthias Clasen - - * === Released 2.10.3 === - -2006-08-17 Matthias Clasen - - * === Released 2.10.2 === - -2006-07-23 Matthias Clasen - - * === Released 2.10.1 === - -2006-07-20 Matthias Clasen - - Fix a thinko that leads to constantly reloading - the mime data if a mime.cache is present. Patch - by Yevgen Muntyan, bugs.freedesktop.org #7495 - - * xdgmime.c (xdg_check_dir): Look for mime.cache first. - (xdg_check_file): Report existance of the file separately. - -2006-07-20 Matthias Clasen - - * xdgmime.c (xdg_mime_shutdown): Unref the caches. - Patch by Yevgen Muntyan, bugs.freedesktop.org #7496 - - * xdgmimemagic.c: - * xdgmime.c: - * xdgmime.h: Add xdg_init-free versions of some - functions and use them internally, so that we don't - reload caches and clobber data structures in the - middle of an operation. Patch by Joe Shaw, - bugs.freedesktop.org #6824 - -2006-07-19 Matthias Clasen - - * xdgmimeglob.c (_xdg_glob_hash_node_lookup_file_name): - Don't return NULL as a mimetype, ever, patch - by Yevgen Muntyan, bugs.freedesktop.org #5241 - -2006-07-02 Matthias Clasen - - * === Released 2.10.0 === - -2006-06-21 Matthias Clasen - - * === Released 2.9.4 === - -2006-06-12 Matthias Clasen - - * === Released 2.9.3 === - -2006-06-05 Matthias Clasen - - * === Released 2.9.2 === - -2006-05-16 Matthias Clasen - - * === Released 2.9.1 ==== - -2006-05-04 Matthias Clasen - - * === Released 2.9.0 === - -2006-04-03 Matthias Clasen - - * xdgmime.[hc]: Move xdg_mime_type_unknown to .rodata. - -2006-03-06 Matthias Clasen - - * xdgmimemagic.c: Remove superfluous extern errno - declaration. (#333605, Tommi Komulainen) - -2006-02-27 Matthias Clasen - - * xdgmime.h (xdg_mime_dump): Don't export xdg_mime_dump. - -2005-12-01 Matthias Clasen - - * Merge upstream changes to handle duplicate glob - patterns. - -2005-11-04 Matthias Clasen - - * xdgmime.c (xdg_mime_list_mime_parents): Prevent - a segfault. - -2005-10-18 Matthias Clasen - - * xdgmimecache.c: Make magic comparisons work correctly - in the cache. - -2005-10-17 Matthias Clasen - - * xdgmime.c (xdg_mime_get_mime_type_for_file): Remove - a debugging printf. - -2005-09-01 Matthias Clasen - - * xdgmime.h: - * xdgmime.c (xdg_mime_get_mime_type_for_file): Take - a struct statbuf * as argument. - - * test-mime.c (main): Adjust. - -2005-08-24 Matthias Clasen - - * === Released 2.8.2 === - - * === Released 2.8.1 === - -2005-08-13 Matthias Clasen - - * === Released 2.8.0 === - -2005-08-07 Matthias Clasen - - * Rename caches to _caches, so it doesn't - get exported. Also don't export n_caches. - -2005-08-02 Matthias Clasen - - * === Released 2.7.5 === - -2005-07-22 Matthias Clasen - - * === Released 2.7.4 === - -2005-07-15 Matthias Clasen - - * === Released 2.7.3 === - -2005-07-08 Matthias Clasen - - * === Released 2.7.2 === - -2005-07-01 Matthias Clasen - - * === Released 2.7.1 === - -2005-06-20 Matthias Clasen - - * xdgmimecache.c: Handle missing MAP_FAILED. (#308449, Georg - Schwarz) - -2005-06-20 Matthias Clasen - - * === Released 2.7.0 === - -2005-06-10 Federico Mena Quintero - - * xdgmime.c (xdg_mime_init_from_directory): Pass the correct size - to realloc(). Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3506. - -2005-06-09 Matthias Clasen - - * xdgmimemagic.c: Don't declare errno, including errno.h - is enough. (#304164, Joerg Sonnenberger) - -2005-05-20 Matthias Clasen - - * xdgmimecache.c (GET_UINT32): Don't rely on C99 - types. (#304924, John Ehresman) - -2005-04-29 Matthias Clasen - - * Sync to upstream. - -2005-04-08 Matthias Clasen - - * xdgmimecache.c (cache_magic_matchlet_compare_to_data) - (cache_magic_matchlet_compare): Use cache->buffer, not - cache. - -Tue Apr 5 16:00:04 2005 Manish Singh - - * Makefile.am: add xdgmimecache.[ch]. - -2005-03-28 Matthias Clasen - - * xdgmimeglob.c: Sync to latest upstream, - including fixes for matching against multiple - extensions (eg .tar.gz) and for suffix - patterns which don't start with a dot. - -Sat Mar 19 23:52:33 2005 Manish Singh - - * xdgmimeglob.c (_xdg_glob_hash_insert_text): cast away the constness - in the call to free(). - -2005-03-20 Matthias Clasen - - * xdgmimeglob.c (_xdg_glob_hash_insert_text): Don't - leak node->mime_type if we are reusing an existing - node. (#170774, Kjartan Maraas) - -2005-01-08 Matthias Clasen - - * === Released 2.6.1 === - -2004-12-16 Matthias Clasen - - * === Released 2.6.0 === - -2004-12-13 Marco Pesenti Gritti - - * xdgmimeglob.c: (_xdg_glob_hash_lookup_file_name): - - Resync with upstream again - -Fri Dec 10 13:58:38 2004 Manish Singh - - * xdgmime.h: wrap new API in XDG_ENTRY(). - -2004-12-09 Marco Pesenti Gritti - - * xdgmime.c: (xdg_mime_unalias_mime_type), - (xdg_mime_mime_type_equal), (xdg_mime_mime_type_subclass), - (xdg_mime_get_mime_parents): - * xdgmime.h: - * xdgmimealias.c: (_xdg_mime_alias_list_lookup): - * xdgmimeglob.c: (_xdg_glob_hash_node_lookup_file_name): - * xdgmimeint.c: (_xdg_ucs4_to_lower): - * xdgmimeint.h: - * xdgmimemagic.c: (_xdg_mime_magic_read_from_file): - * xdgmimeparent.c: (_xdg_mime_parent_list_lookup): - - Resync with upstream - -2004-12-09 Matthias Clasen - - * xdgmimealias.c (_xdg_mime_alias_read_from_file): - * xdgmimeparent.c (_xdg_mime_parent_read_from_file): Make - repeated calls accumulate the results, don't call qsort() - on empty arrays. (#160838, Mariano Suárez-Alvarez) - -2004-12-02 Matthias Clasen - - * === Released 2.5.6 === - -2004-11-29 Matthias Clasen - - * xdgmimeparent.c (_xdg_mime_parent_list_lookup): - * xdgmimealias.c (_xdg_mime_alias_list_lookup): Protect - against stupid bsearch() implementations. (#159737, - Morten Welinder) - -2004-11-24 Matthias Clasen - - * xdgmimeparent.c (_xdg_mime_parent_read_from_file): - Initialize the parent field of the newly allocate list - entry. (#159330, Alex Larsson) - -Fri Nov 19 15:10:32 2004 Manish Singh - - * xdgmime.c: Don't put /* within a comment. - -2004-11-09 Matthias Clasen - - * xdgmime.h: Prefix all symbols. - -2004-11-08 Matthias Clasen - - * xdgmime.c (xdg_mime_mime_type_subclass): Enable matching - of supertypes as text/*. - - * Sync from upstream - -2004-10-27 Matthias Clasen - - * === Released 2.5.4 === - -2004-09-19 Matthias Clasen - - * === Released 2.5.3 === - -2004-08-25 Matthias Clasen - - * === Released 2.5.2 === - -Wed Aug 11 20:44:35 2004 Matthias Clasen - - * xdgmime.h (xdg_mime_shutdown): Add the XDG_PREFIX to - this function as well. - -2004-08-01 Matthias Clasen - - * === Released 2.5.1 === - -Tue Jul 20 22:24:35 2004 Matthias Clasen - - * xdgmimeglob.h: Remove trailing commas from - enumerations. (#148035) - -Sun Jul 18 20:17:41 2004 Soeren Sandmann - - * === Released 2.5.0 == - -Thu May 27 15:23:17 2004 Jonathan Blandford - - * Sync from upstream - -Fri Apr 30 00:19:11 2004 Matthias Clasen - - * xdgmimemagic.c (_xdg_mime_magic_read_a_number): Make sure - the static string is long enough. (#136323, Morten Welinder) - -2004-03-12 Morten Welinder - - * *.c: Make sure to include (#137001) - -Wed Mar 10 22:48:15 2004 Jonathan Blandford - - * Sync from upstream - -Sun Feb 8 19:05:16 2004 Manish Singh - - * xdgmimeint.h: declare _xdg_utf8_skip as extern to prevent multiple - definitions. - -Wed Jan 21 09:33:13 2004 Jonathan Blandford - - * libgnomevfs/xdgmimeglob.c: - * libgnomevfs/xdgmimemagic.c: Sync from upstream - -Tue Jan 20 13:07:04 2004 Jonathan Blandford - - * xdgmime.c: resync with upstream sources. - -Fri Oct 24 16:54:57 2003 Owen Taylor - - * Makefile.am (libxdgmime_la_SOURCES): Add .h files to - SOURCES. - -Fri Oct 24 16:02:32 2003 Owen Taylor - - * *.[ch]: Relicense to be dual AFL/LGPL (and thus also - GPL) rather than AFL/GPL. Also update AFL version to 1.2. - -Tue Jul 22 15:37:45 2003 Jonathan Blandford - - * xdgmime/xdgmime.c (xdg_mime_init): use XDG_DATA_HOME instead of - XDG_CONFIG_HOME. - diff --git a/lib/xdgmime/Makefile.am b/lib/xdgmime/Makefile.am deleted file mode 100644 index 3cf173d0..00000000 --- a/lib/xdgmime/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDES = -DXDG_PREFIX=sugar_mime - -noinst_LTLIBRARIES = libxdgmime.la - -libxdgmime_la_SOURCES = \ - xdgmime.c \ - xdgmime.h \ - xdgmimealias.c \ - xdgmimealias.h \ - xdgmimecache.c \ - xdgmimecache.h \ - xdgmimeglob.c \ - xdgmimeglob.h \ - xdgmimeint.c \ - xdgmimeint.h \ - xdgmimemagic.c \ - xdgmimemagic.h \ - xdgmimeparent.c \ - xdgmimeparent.h diff --git a/lib/xdgmime/xdgmimealias.c b/lib/xdgmimealias.c similarity index 100% rename from lib/xdgmime/xdgmimealias.c rename to lib/xdgmimealias.c diff --git a/lib/xdgmime/xdgmimealias.h b/lib/xdgmimealias.h similarity index 100% rename from lib/xdgmime/xdgmimealias.h rename to lib/xdgmimealias.h diff --git a/lib/xdgmime/xdgmimecache.c b/lib/xdgmimecache.c similarity index 100% rename from lib/xdgmime/xdgmimecache.c rename to lib/xdgmimecache.c diff --git a/lib/xdgmime/xdgmimecache.h b/lib/xdgmimecache.h similarity index 100% rename from lib/xdgmime/xdgmimecache.h rename to lib/xdgmimecache.h diff --git a/lib/xdgmime/xdgmimeglob.c b/lib/xdgmimeglob.c similarity index 100% rename from lib/xdgmime/xdgmimeglob.c rename to lib/xdgmimeglob.c diff --git a/lib/xdgmime/xdgmimeglob.h b/lib/xdgmimeglob.h similarity index 100% rename from lib/xdgmime/xdgmimeglob.h rename to lib/xdgmimeglob.h diff --git a/lib/xdgmime/xdgmimeint.c b/lib/xdgmimeint.c similarity index 100% rename from lib/xdgmime/xdgmimeint.c rename to lib/xdgmimeint.c diff --git a/lib/xdgmime/xdgmimeint.h b/lib/xdgmimeint.h similarity index 100% rename from lib/xdgmime/xdgmimeint.h rename to lib/xdgmimeint.h diff --git a/lib/xdgmime/xdgmimemagic.c b/lib/xdgmimemagic.c similarity index 100% rename from lib/xdgmime/xdgmimemagic.c rename to lib/xdgmimemagic.c diff --git a/lib/xdgmime/xdgmimemagic.h b/lib/xdgmimemagic.h similarity index 100% rename from lib/xdgmime/xdgmimemagic.h rename to lib/xdgmimemagic.h diff --git a/lib/xdgmime/xdgmimeparent.c b/lib/xdgmimeparent.c similarity index 100% rename from lib/xdgmime/xdgmimeparent.c rename to lib/xdgmimeparent.c diff --git a/lib/xdgmime/xdgmimeparent.h b/lib/xdgmimeparent.h similarity index 100% rename from lib/xdgmime/xdgmimeparent.h rename to lib/xdgmimeparent.h diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py index a20064c6..2247e809 100644 --- a/shell/view/keyhandler.py +++ b/shell/view/keyhandler.py @@ -24,7 +24,7 @@ import gtk from hardware import hardwaremanager from model.shellmodel import ShellModel -from sugar._sugarext import KeyGrabber +from sugar._sugaruiext import KeyGrabber _BRIGHTNESS_STEP = 2 _VOLUME_STEP = 10 diff --git a/sugar/.gitignore b/sugar/.gitignore index 69373fb3..191b96c9 100644 --- a/sugar/.gitignore +++ b/sugar/.gitignore @@ -1,2 +1,2 @@ _sugarext.c - +_sugaruiext.c diff --git a/sugar/Makefile.am b/sugar/Makefile.am index 6a7a2c2d..5fcb3874 100644 --- a/sugar/Makefile.am +++ b/sugar/Makefile.am @@ -17,16 +17,16 @@ INCLUDES = \ $(LIB_BINDINGS_CFLAGS) \ $(PYTHON_INCLUDES) \ -I$(top_srcdir)/lib \ - -I$(top_srcdir)/lib/xdgmime + -I$(top_srcdir)/lib/ui pkgpyexecdir = $(pythondir)/sugar -pkgpyexec_LTLIBRARIES = _sugarext.la +pkgpyexec_LTLIBRARIES = _sugarext.la _sugaruiext.la _sugarext_la_LDFLAGS = -module -avoid-version -_sugarext_la_LIBADD = \ - $(LIB_BINDINGS_LIBS) \ - $(LIB_LIBS) \ +_sugarext_la_LIBADD = \ + $(LIB_BINDINGS_LIBS) \ + $(LIB_LIBS) \ $(top_builddir)/lib/libsugar.la _sugarext_la_SOURCES = \ @@ -36,8 +36,28 @@ nodist__sugarext_la_SOURCES = _sugarext.c _sugarext.c: _sugarext.defs _sugarext.override -CLEANFILES = _sugarext.c -EXTRA_DIST = _sugarext.override _sugarext.defs +_sugaruiext_la_LDFLAGS = -module -avoid-version +_sugaruiext_la_LIBADD = \ + $(LIB_BINDINGS_LIBS) \ + $(LIB_LIBS) \ + $(top_builddir)/lib/ui/libsugarui.la + +_sugaruiext_la_SOURCES = \ + _sugaruiextmodule.c + +nodist__sugaruiext_la_SOURCES = _sugaruiext.c + +_sugaruiext.c: _sugaruiext.defs _sugaruiext.override + +CLEANFILES = \ + _sugarext.c \ + _sugaruiext.c + +EXTRA_DIST = \ + _sugarext.override \ + _sugarext.defs \ + _sugaruiext.defs \ + _sugaruiext.override .defs.c: (cd $(srcdir)\ diff --git a/sugar/_sugarext.defs b/sugar/_sugarext.defs index 7bc3cda4..d97f8b41 100644 --- a/sugar/_sugarext.defs +++ b/sugar/_sugarext.defs @@ -1,81 +1,3 @@ -;; -*- scheme -*- -; object definitions - -(define-object AddressEntry - (in-module "Sugar") - (parent "GtkEntry") - (c-name "SugarAddressEntry") - (gtype-id "SUGAR_TYPE_ADDRESS_ENTRY") -) - -(define-object KeyGrabber - (in-module "Sugar") - (parent "GObject") - (c-name "SugarKeyGrabber") - (gtype-id "SUGAR_TYPE_KEY_GRABBER") -) - -(define-object Menu - (in-module "Sugar") - (parent "GtkMenu") - (c-name "SugarMenu") - (gtype-id "SUGAR_TYPE_MENU") -) - -;; Enumerations and flags ... - -;; From sugar-menu.h - -(define-method set_min_width - (of-object "SugarMenu") - (c-name "sugar_menu_set_min_width") - (return-type "none") - (parameters - '("gint" "width") - ) -) - -(define-method popup - (of-object "SugarMenu") - (c-name "sugar_menu_popup") - (return-type "none") - (parameters - '("gint" "x") - '("gint" "y") - ) -) - -(define-method popdown - (of-object "SugarMenu") - (c-name "sugar_menu_popdown") - (return-type "none") -) - -;; From sugar-key-grabber.h - -(define-function sugar_key_grabber_get_type - (c-name "sugar_key_grabber_get_type") - (return-type "GType") -) - -(define-method grab - (of-object "SugarKeyGrabber") - (c-name "sugar_key_grabber_grab") - (return-type "none") - (parameters - '("const-char*" "key") - ) -) - -(define-method get_key - (of-object "SugarKeyGrabber") - (c-name "sugar_key_grabber_get_key") - (return-type "char*") - (parameters - '("guint" "keycode") - '("guint" "state") - ) -) ; functions (define-function get_mime_type_from_file_name @@ -94,24 +16,6 @@ ) ) -(define-function x11_set_string_property - (c-name "sugar_x11_util_set_string_property") - (parameters - '("GdkWindow*" "window") - '("const-char*" "property") - '("const-char*" "value") - ) -) - -(define-function x11_get_string_property - (c-name "sugar_x11_util_get_string_property") - (return-type "char*") - (parameters - '("GdkWindow*" "window") - '("const-char*" "property") - ) -) - (define-function get_prgname (c-name "g_get_prgname") (return-type "const-char*") diff --git a/sugar/_sugarext.override b/sugar/_sugarext.override index 7f798c2e..9fe98266 100644 --- a/sugar/_sugarext.override +++ b/sugar/_sugarext.override @@ -2,25 +2,11 @@ %% headers #include - -#include "pygobject.h" -#include "sugar-address-entry.h" -#include "sugar-key-grabber.h" -#include "sugar-menu.h" -#include "sugar-x11-util.h" #include "xdgmime.h" - -#include #include - %% modulename _sugarext %% -import gobject.GObject as PyGObject_Type -import gtk.Entry as PyGtkEntry_Type -import gtk.Menu as PyGtkMenu_Type -import gtk.gdk.Window as PyGdkWindow_Type -%% ignore-glob *_get_type _* diff --git a/sugar/_sugarextmodule.c b/sugar/_sugarextmodule.c index b66cde26..41d21bd0 100644 --- a/sugar/_sugarextmodule.c +++ b/sugar/_sugarextmodule.c @@ -24,8 +24,6 @@ /* include this first, before NO_IMPORT_PYGOBJECT is defined */ #include -void py_sugarext_register_classes (PyObject *d); - extern PyMethodDef py_sugarext_functions[]; DL_EXPORT(void) @@ -38,8 +36,6 @@ init_sugarext(void) m = Py_InitModule ("_sugarext", py_sugarext_functions); d = PyModule_GetDict (m); - py_sugarext_register_classes (d); - if (PyErr_Occurred ()) { Py_FatalError ("can't initialise module _sugarext"); } diff --git a/sugar/_sugaruiext.defs b/sugar/_sugaruiext.defs new file mode 100644 index 00000000..1a976377 --- /dev/null +++ b/sugar/_sugaruiext.defs @@ -0,0 +1,97 @@ +;; -*- scheme -*- +; object definitions + +(define-object AddressEntry + (in-module "Sugar") + (parent "GtkEntry") + (c-name "SugarAddressEntry") + (gtype-id "SUGAR_TYPE_ADDRESS_ENTRY") +) + +(define-object KeyGrabber + (in-module "Sugar") + (parent "GObject") + (c-name "SugarKeyGrabber") + (gtype-id "SUGAR_TYPE_KEY_GRABBER") +) + +(define-object Menu + (in-module "Sugar") + (parent "GtkMenu") + (c-name "SugarMenu") + (gtype-id "SUGAR_TYPE_MENU") +) + +;; Enumerations and flags ... + +;; From sugar-menu.h + +(define-method set_min_width + (of-object "SugarMenu") + (c-name "sugar_menu_set_min_width") + (return-type "none") + (parameters + '("gint" "width") + ) +) + +(define-method popup + (of-object "SugarMenu") + (c-name "sugar_menu_popup") + (return-type "none") + (parameters + '("gint" "x") + '("gint" "y") + ) +) + +(define-method popdown + (of-object "SugarMenu") + (c-name "sugar_menu_popdown") + (return-type "none") +) + +;; From sugar-key-grabber.h + +(define-function sugar_key_grabber_get_type + (c-name "sugar_key_grabber_get_type") + (return-type "GType") +) + +(define-method grab + (of-object "SugarKeyGrabber") + (c-name "sugar_key_grabber_grab") + (return-type "none") + (parameters + '("const-char*" "key") + ) +) + +(define-method get_key + (of-object "SugarKeyGrabber") + (c-name "sugar_key_grabber_get_key") + (return-type "char*") + (parameters + '("guint" "keycode") + '("guint" "state") + ) +) +; functions + +(define-function x11_set_string_property + (c-name "sugar_x11_util_set_string_property") + (parameters + '("GdkWindow*" "window") + '("const-char*" "property") + '("const-char*" "value") + ) +) + +(define-function x11_get_string_property + (c-name "sugar_x11_util_get_string_property") + (return-type "char*") + (parameters + '("GdkWindow*" "window") + '("const-char*" "property") + ) +) diff --git a/sugar/_sugaruiext.override b/sugar/_sugaruiext.override new file mode 100644 index 00000000..02e900ea --- /dev/null +++ b/sugar/_sugaruiext.override @@ -0,0 +1,26 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- */ +%% +headers +#include + +#include "pygobject.h" +#include "sugar-address-entry.h" +#include "sugar-key-grabber.h" +#include "sugar-menu.h" +#include "sugar-x11-util.h" + +#include +#include + +%% +modulename _sugarext +%% +import gobject.GObject as PyGObject_Type +import gtk.Entry as PyGtkEntry_Type +import gtk.Menu as PyGtkMenu_Type +import gtk.gdk.Window as PyGdkWindow_Type +%% +ignore-glob + *_get_type + _* +%% diff --git a/sugar/_sugaruiextmodule.c b/sugar/_sugaruiextmodule.c new file mode 100644 index 00000000..8c740103 --- /dev/null +++ b/sugar/_sugaruiextmodule.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2006-2007, Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* include this first, before NO_IMPORT_PYGOBJECT is defined */ +#include + +extern PyMethodDef py_sugaruiext_functions[]; + +void py_sugaruiext_register_classes (PyObject *d); + +DL_EXPORT(void) +init_sugaruiext(void) +{ + PyObject *m, *d; + + init_pygobject (); + + m = Py_InitModule ("_sugaruiext", py_sugaruiext_functions); + d = PyModule_GetDict (m); + + py_sugaruiext_register_classes (d); + + if (PyErr_Occurred ()) { + Py_FatalError ("can't initialise module _sugaruiext"); + } +} diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 31b8d95d..e5312aa6 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -40,7 +40,7 @@ from sugar.graphics.toolcombobox import ToolComboBox from sugar.datastore import datastore from sugar import wm from sugar import profile -from sugar import _sugarext +from sugar import _sugaruiext class ActivityToolbar(gtk.Toolbar): SHARE_PRIVATE = 0 @@ -289,7 +289,7 @@ class Activity(Window, gtk.Container): return self._activity_id def get_service_name(self): - return _sugarext.get_prgname() + return _sugaruiext.get_prgname() def set_canvas(self, canvas): Window.set_canvas(self, canvas) @@ -469,7 +469,7 @@ class Activity(Window, gtk.Container): def get_bundle_name(): """Return the bundle name for the current process' bundle """ - return _sugarext.get_application_name() + return _sugaruiext.get_application_name() def get_bundle_path(): """Return the bundle path for the current process' bundle diff --git a/sugar/graphics/__init__.py b/sugar/graphics/__init__.py index 9f0a73fc..03e4251d 100644 --- a/sugar/graphics/__init__.py +++ b/sugar/graphics/__init__.py @@ -17,4 +17,4 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -from sugar._sugarext import AddressEntry +from sugar._sugaruiext import AddressEntry diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py index b779eec7..37e70b1a 100644 --- a/sugar/graphics/palette.py +++ b/sugar/graphics/palette.py @@ -26,7 +26,7 @@ from sugar.graphics import palettegroup from sugar.graphics import animator from sugar.graphics import units from sugar.graphics import style -from sugar import _sugarext +from sugar import _sugaruiext _BOTTOM_LEFT = 0 _BOTTOM_RIGHT = 1 @@ -87,7 +87,7 @@ class Palette(gobject.GObject): self._popdown_anim = animator.Animator(0.6, 10) self._popdown_anim.add(_PopdownAnimation(self)) - self._menu = _sugarext.Menu() + self._menu = _sugaruiext.Menu() self._menu.set_min_width(units.grid_to_pixels(1)) self._primary = _PrimaryMenuItem(label, accel_path) diff --git a/sugar/wm.py b/sugar/wm.py index 66108891..999e07a0 100644 --- a/sugar/wm.py +++ b/sugar/wm.py @@ -17,22 +17,22 @@ import gtk -import _sugarext +import _sugaruiext def get_activity_id(wnck_window): window = gtk.gdk.window_foreign_new(wnck_window.get_xid()) - return _sugarext.x11_get_string_property( + return _sugaruiext.x11_get_string_property( window, '_SUGAR_ACTIVITY_ID') def get_bundle_id(wnck_window): window = gtk.gdk.window_foreign_new(wnck_window.get_xid()) - return _sugarext.x11_get_string_property( + return _sugaruiext.x11_get_string_property( window, '_SUGAR_BUNDLE_ID') def set_activity_id(window, activity_id): - _sugarext.x11_set_string_property( + _sugaruiext.x11_set_string_property( window, '_SUGAR_ACTIVITY_ID', activity_id) def set_bundle_id(window, bundle_id): - _sugarext.x11_set_string_property( + _sugaruiext.x11_set_string_property( window, '_SUGAR_BUNDLE_ID', bundle_id)