aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-import.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-03 04:24:53 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-03 04:24:53 +0800
commit71219970c53e84d98edc9ac59ef22c8b07fdffa8 (patch)
treeba834d7cb70b834e38a8de16c0a05c3a0b008b0f /src/bookmarks/ephy-bookmarks-import.c
parent2dd166055fa8702ad52df80d2927f8560b4f73f6 (diff)
downloadgsoc2013-epiphany-71219970c53e84d98edc9ac59ef22c8b07fdffa8.tar.gz
gsoc2013-epiphany-71219970c53e84d98edc9ac59ef22c8b07fdffa8.tar.zst
gsoc2013-epiphany-71219970c53e84d98edc9ac59ef22c8b07fdffa8.zip
Use gtk icons for dnd. Basic implementation of bookmarks importing. Still
2003-01-02 Marco Pesenti Gritti <marco@it.gnome.org> * lib/ephy-string.c: (ephy_str_replace_substring): * lib/ephy-string.h: * lib/widgets/eggtreemultidnd.c: (egg_tree_multi_drag_motion_event): * src/bookmarks/Makefile.am: Use gtk icons for dnd. Basic implementation of bookmarks importing. Still not used but functional.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-import.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
new file mode 100644
index 000000000..19eaecc0b
--- /dev/null
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <libxml/HTMLtree.h>
+#include <string.h>
+
+#include "ephy-bookmarks-import.h"
+#include "ephy-string.h"
+
+static char *
+build_keyword (const char *folder)
+{
+ return ephy_str_replace_substring (folder, " ", "_");
+}
+
+static void
+mozilla_parse_bookmarks (EphyBookmarks *bookmarks,
+ htmlNodePtr node,
+ char **keyword)
+{
+ htmlNodePtr child = node;
+
+ while (child != NULL)
+ {
+ if (xmlStrEqual (child->name, "h3"))
+ {
+ xmlChar *tmp;
+
+ tmp = xmlNodeGetContent (child);
+ g_free (*keyword);
+ *keyword = build_keyword (tmp);
+ xmlFree (tmp);
+ }
+ else if (xmlStrEqual (child->name, "a"))
+ {
+ xmlChar *title, *url;
+
+ title = xmlNodeGetContent (child);
+ url = xmlGetProp (child, "href");
+ ephy_bookmarks_add (bookmarks,
+ title,
+ url,
+ NULL,
+ *keyword);
+ xmlFree (title);
+ xmlFree (url);
+ }
+
+ mozilla_parse_bookmarks (bookmarks,
+ child->children,
+ keyword);
+ child = child->next;
+ }
+}
+
+gboolean
+ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
+ const char *filename)
+{
+ htmlDocPtr doc;
+ htmlNodePtr child;
+ char *keyword = NULL;
+
+ if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
+ return FALSE;
+
+ doc = htmlParseFile (filename, "UTF-8");
+ g_assert (doc != NULL);
+
+ child = doc->children;
+ mozilla_parse_bookmarks (bookmarks, child, &keyword);
+
+ g_free (keyword);
+ xmlFreeDoc (doc);
+
+ return TRUE;
+}
rts-graphics/commit/net-mgmt/nagios-devel/Makefile?id=29a8d3ee174b93e5b4078916290b95c83bd05ee2'>29a8d3ee174
29a8d3ee174








7e7a92ab579











29a8d3ee174









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132







                                                                               
                     
                 
                        
                                                                         
                      








                                                                                            

                           
                   
                                       

                         
                              
 



                                                                                 


























                                                             
                                                         



                                                     

                                                                  






                                           

                           















                                                          
                                              



                                  
                      

                                                








                                          











                                                                                









                                                                                                           
# New ports collection makefile for:    nagios-devel
# Date created:             14 July 2007
# Whom:                 Jarrod Sayers <jarrod@netleader.com.au>
#
# $FreeBSD$
#

PORTNAME=   nagios
PORTVERSION=    3.1.2
PORTREVISION=   2
CATEGORIES= net-mgmt
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}-3.x/${PORTNAME}-${PORTVERSION}
PKGNAMESUFFIX=  -devel

MAINTAINER= jarrod@netleader.com.au
COMMENT=    Extremely powerful network monitoring system

LIB_DEPENDS=    gd.4:${PORTSDIR}/graphics/gd
RUN_DEPENDS=    ${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net-mgmt/nagios-plugins

LATEST_LINK=    nagios-devel

USE_ICONV=  yes
USE_PERL5_BUILD=    yes
USE_PHP=    yes
USE_AUTOTOOLS=  autoconf:262 libltdl:22
USE_RC_SUBR=    nagios.sh

CONFLICTS=  nagios-[123].*

OPTIONS=    EMBEDDED_PERL "Enable embedded Perl [requires Perl 5.8.0+]" off \
        NANOSLEEP "Use nanosleep in event timing" off \
        EVENT_BROKER "Enable event broker functionality" off \
        UNHANDLED_HACK "Display passive checks in unhandled queries" off

GNU_CONFIGURE=  yes

NAGIOSUSER?=    nagios
NAGIOSGROUP?=   nagios
NAGIOSDIR?= /var/spool/nagios

NAGIOSUID=  181
NAGIOSGID=  ${NAGIOSUID}

NAGIOSWWWDIR?=  www/nagios
NAGIOSHTMURL?=  /nagios
NAGIOSCGIURL?=  ${NAGIOSHTMURL}/cgi-bin

.include <bsd.port.pre.mk>

CPPFLAGS=   -I${LOCALBASE}/include -fPIC
CFLAGS+=    ${CPPFLAGS}

CONFIGURE_ARGS= --with-command-user=${NAGIOSUSER} \
        --with-command-group=${WWWGRP} \
        --with-nagios-user=${NAGIOSUSER} \
        --with-nagios-group=${NAGIOSGROUP} \
        --with-htmurl=${NAGIOSHTMURL} \
        --with-cgiurl=${NAGIOSCGIURL} \
        --sbindir=${PREFIX}/${NAGIOSWWWDIR}/cgi-bin \
        --libexecdir=${PREFIX}/libexec/nagios \
        --datarootdir=${PREFIX}/${NAGIOSWWWDIR} \
        --datadir=${PREFIX}/${NAGIOSWWWDIR} \
        --sysconfdir=${PREFIX}/etc/nagios \
        --localstatedir=${NAGIOSDIR} \
        --with-httpd-conf=${PREFIX}/etc \
        --with-checkresult-dir=${NAGIOSDIR}/checkresults \
        --disable-statuswrl

CONFIGURE_ENV=  CPPFLAGS="${CPPFLAGS}" \
        CFLAGS="${CFLAGS}" \
        LDFLAGS="${LDFLAGS}" \
        LIBS="-L${LOCALBASE}/lib" \
        PERL=${PERL}

MAKE_JOBS_UNSAFE=   yes

INSTALL_TARGET= install install-commandmode install-config

PLIST_SUB=  NAGIOSDIR=${NAGIOSDIR} \
        NAGIOSWWWDIR=${NAGIOSWWWDIR} \
        NAGIOSUSER=${NAGIOSUSER} \
        NAGIOSGROUP=${NAGIOSGROUP} \
        NAGIOSUID=${NAGIOSUID} \
        NAGIOSGID=${NAGIOSGID} \
        NAGIOSHTMURL=${NAGIOSHTMURL} \
        NAGIOSCGIURL=${NAGIOSCGIURL} \
        WWWGRP=${WWWGRP}

SUB_FILES=  pkg-install \
        pkg-deinstall \
        pkg-message

# XXX: Don't remove PREFIX from SUB_LIST here.
SUB_LIST=   PREFIX=${PREFIX} \
        ${PLIST_SUB}

.if defined(WITH_EMBEDDED_PERL)
USE_PERL5=  5.8.0+
CONFIGURE_ARGS+=    --enable-embedded-perl \
        --with-perlcache
PLIST_SUB+= EMBEDDED_PERL=""
.else
PLIST_SUB+= EMBEDDED_PERL="@comment "
.endif

.if defined(WITH_NANOSLEEP)
CONFIGURE_ARGS+=    --enable-nanosleep
.endif

.if defined(WITH_EVENT_BROKER)
CONFIGURE_ARGS+=    --enable-event-broker
.else
CONFIGURE_ARGS+=    --disable-event-broker
.endif

post-patch:
.if defined(WITH_UNHANDLED_HACK)
    @${REINPLACE_CMD} -e 's#;serviceprops=42\&#;serviceprops=10\&#g' \
        -e 's#;hostprops=42\"#;hostprops=10\"#g' ${WRKSRC}/html/side.php
.endif

pre-install:
    @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL

post-install:
    @${CHMOD} 775 ${NAGIOSDIR} ${NAGIOSDIR}/archives ${NAGIOSDIR}/checkresults ${NAGIOSDIR}/rw
    @${CHOWN} ${NAGIOSUSER}:${NAGIOSGROUP} ${NAGIOSDIR} ${NAGIOSDIR}/archives ${NAGIOSDIR}/checkresults
    @${CHOWN} ${NAGIOSUSER}:${WWWGRP} ${NAGIOSDIR}/rw
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>