-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 39d0467
Showing
11 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
*~ | ||
*.la | ||
*.lo | ||
*.o | ||
.deps | ||
.libs | ||
Makefile | ||
Makefile.in | ||
/COPYING | ||
/INSTALL | ||
/aclocal.m4 | ||
/autom4te.cache/ | ||
/compile | ||
/config.guess | ||
/config.h | ||
/config.h.in | ||
/config.log | ||
/config.status | ||
/config.sub | ||
/configure | ||
/depcomp | ||
/install-sh | ||
/libtool | ||
/ltmain.sh | ||
/m4/ | ||
/missing | ||
/stamp-h1 | ||
/thumbnailer/hwp-thumbnailer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Changwoo Ryu <cwryu@debian.org> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SUBDIRS = thumbnailer |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
HWP integration for GNOME desktop | ||
|
||
Various softwares for integrating HWP document file types in GNOME | ||
desktop. | ||
|
||
- thumbnailer | ||
|
||
본 제품은 한글과컴퓨터의 한/글 문서 파일(.hwp) 공개 문서를 참고하여 | ||
개발하였습니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
# Run this to generate all the initial makefiles, etc. | ||
|
||
srcdir=`dirname $0` | ||
test -z "$srcdir" && srcdir=. | ||
|
||
PKG_NAME="gnome-hwp-support" | ||
|
||
(test -f $srcdir/configure.ac \ | ||
&& test -f $srcdir/README \ | ||
&& test -d $srcdir/thumbnailer) || { | ||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" | ||
echo " top-level $PKG_NAME directory" | ||
exit 1 | ||
} | ||
|
||
which gnome-autogen.sh || { | ||
echo "You need to install gnome-common from the GNOME CVS" | ||
exit 1 | ||
} | ||
REQUIRED_AUTOMAKE_VERSION=1.9 . gnome-autogen.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
AC_INIT([gnome-hwp-support], [0.1.1], [cwryu@debian.org], [gnome-hwp-support]) | ||
AC_CONFIG_SRCDIR([README]) | ||
AC_CONFIG_HEADERS(config.h) | ||
AM_INIT_AUTOMAKE() | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
|
||
AM_PROG_LIBTOOL | ||
AC_ISC_POSIX | ||
AC_PROG_CC | ||
AM_PROG_CC_STDC | ||
AM_PROG_CC_C_O | ||
AC_STDC_HEADERS | ||
|
||
PKG_CHECK_MODULES([THUMBNAILER],[libgsf-1 gdk-pixbuf-2.0]) | ||
AC_SUBST(THUMBNAILER_CFLAGS) | ||
AC_SUBST(THUMBNAILER_LIBS) | ||
|
||
# PKG_CHECK_MODULES([nautilus],[libnautilus-extension libgsf-1]) | ||
# NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension` | ||
# AC_SUBST([nautilusextensiondir],[$NAUTILUS_EXTENSION_DIR]) | ||
# AC_SUBST(nautilus_CFLAGS) | ||
# AC_SUBST(nautilus_LIBS) | ||
# | ||
|
||
# required to install GConf schemas | ||
AM_GCONF_SOURCE_2 | ||
AC_PATH_PROG([GCONFTOOL], [gconftool-2], [false]) | ||
|
||
AC_CONFIG_FILES([Makefile | ||
thumbnailer/Makefile]) | ||
|
||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
bin_PROGRAMS = hwp-thumbnailer | ||
|
||
hwp_thumbnailer_SOURCES = hwp-thumbnailer.c | ||
hwp_thumbnailer_CFLAGS = $(THUMBNAILER_CFLAGS) | ||
hwp_thumbnailer_LDADD = $(THUMBNAILER_LIBS) | ||
|
||
schemadir = $(GCONF_SCHEMA_FILE_DIR) | ||
schema_DATA = hwp-thumbnailer.schemas | ||
|
||
install-data-local: | ||
if test -z "$(DESTDIR)" ; then \ | ||
for p in $(schema_DATA) ; do \ | ||
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/thumbnailer/$$p >&1 > /dev/null; \ | ||
done \ | ||
fi | ||
|
||
EXTRA_DIST = \ | ||
$(schema_DATA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* gnome-hwp-support | ||
* | ||
* Copyright (C) 2011 Changwoo Ryu | ||
* | ||
* 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, or (at your option) | ||
* any later version. | ||
* | ||
* This program 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301 USA. | ||
*/ | ||
/* | ||
* 본 제품은 한글과컴퓨터의 한/글 문서 파일(.hwp) 공개 문서를 참고하여 | ||
* 개발하였습니다. | ||
*/ | ||
|
||
#include <unistd.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <gdk-pixbuf/gdk-pixbuf.h> | ||
#include <gsf/gsf-utils.h> | ||
#include <gsf/gsf-input-stdio.h> | ||
#include <gsf/gsf-infile.h> | ||
#include <gsf/gsf-infile-msole.h> | ||
|
||
int max_size = 256; | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
int opt; | ||
|
||
while ((opt = getopt(argc, argv, "s:")) != -1) { | ||
switch (opt) { | ||
case 's': | ||
max_size = atoi(optarg); | ||
break; | ||
} | ||
} | ||
|
||
if ((argc - optind) < 2) { | ||
exit(1); | ||
} | ||
|
||
char *infilename = argv[optind]; | ||
char *outfilename = argv[optind + 1]; | ||
|
||
gsf_init(); | ||
|
||
GsfInput *input = gsf_input_stdio_new(infilename, NULL); | ||
GsfInfile *infile = gsf_infile_msole_new(input, NULL); | ||
g_object_unref(input); | ||
GsfInput *child = gsf_infile_child_by_name(infile, "PrvImage"); | ||
g_object_unref(infile); | ||
int size = gsf_input_size(child); | ||
|
||
unsigned char *buf; | ||
buf = g_malloc(size); | ||
|
||
gsf_input_read(child, size, buf); | ||
g_object_unref(child); | ||
|
||
GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); | ||
gdk_pixbuf_loader_write(loader, buf, size, NULL); | ||
g_free(buf); | ||
GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); | ||
gdk_pixbuf_loader_close(loader, NULL); | ||
|
||
int width = gdk_pixbuf_get_width(pixbuf); | ||
int height = gdk_pixbuf_get_height(pixbuf); | ||
|
||
if (width > max_size || height > max_size) { | ||
int dwidth, dheight; | ||
GdkPixbuf *new_pixbuf; | ||
if (width > max_size) { | ||
dwidth = max_size; | ||
dheight = max_size * height / width; | ||
} | ||
if (height > max_size) { | ||
dheight = max_size; | ||
dwidth = max_size * width / height; | ||
} | ||
|
||
new_pixbuf = gdk_pixbuf_scale_simple(pixbuf, dwidth, dheight, GDK_INTERP_BILINEAR); | ||
if (new_pixbuf) { | ||
g_object_unref(pixbuf); | ||
pixbuf = new_pixbuf; | ||
} | ||
} | ||
|
||
gdk_pixbuf_save(pixbuf, outfilename, "png", NULL, 0); | ||
g_object_unref(pixbuf); | ||
|
||
gsf_shutdown(); | ||
|
||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<gconfschemafile> | ||
<schemalist> | ||
<schema> | ||
<key>/schemas/desktop/gnome/thumbnailers/application@x-hwp/enable</key> | ||
<applyto>/desktop/gnome/thumbnailers/application@x-hwp/enable</applyto> | ||
<owner>hwp-thumbnailer</owner> | ||
<type>bool</type> | ||
<default>true</default> | ||
</schema> | ||
<schema> | ||
<key>/schemas/desktop/gnome/thumbnailers/application@x-hwp/command</key> | ||
<applyto>/desktop/gnome/thumbnailers/application@x-hwp/command</applyto> | ||
<owner>hwp-thumbnailer</owner> | ||
<type>string</type> | ||
<default>hwp-thumbnailer -s %s %i %o</default> | ||
</schema> | ||
</schemalist> | ||
</gconfschemafile> |