~ubuntu-branches/debian/sid/genius/sid

« back to all changes in this revision

Viewing changes to src/plugread.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-08-21 12:57:45 UTC
  • Revision ID: james.westby@ubuntu.com-20060821125745-sl9ks8v7fq324bdf
Tags: upstream-0.7.6.1
ImportĀ upstreamĀ versionĀ 0.7.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GENIUS Calculator
 
2
 * Copyright (C) 1997-2002 George Lebl
 
3
 *
 
4
 * Author: George Lebl
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the  Free Software
 
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
19
 * USA.
 
20
 */
 
21
 
 
22
#include "config.h"
 
23
 
 
24
#include <glib.h>
 
25
#include <string.h>
 
26
#include <vicious.h>
 
27
#include "calc.h"
 
28
#include "plugin.h"
 
29
#include "plugread.h"
 
30
#include "genius-i18n.h"
 
31
 
 
32
GelPlugin *
 
33
gel_readplugin (const char *dir_name, const char *file_name)
 
34
{
 
35
        char *p;
 
36
        char *name;
 
37
        char *file;
 
38
        char *copyright;
 
39
        char *author;
 
40
        char *description;
 
41
        gboolean gui;
 
42
        gboolean hide;
 
43
        GelPlugin *plg;
 
44
        VeConfig *cfg;
 
45
 
 
46
        p = g_strconcat (ve_sure_string (dir_name), "/", ve_sure_string (file_name), NULL);
 
47
        cfg = ve_config_new (p);
 
48
        g_free (p);
 
49
 
 
50
        name = ve_config_get_translated_string (cfg, "/Genius Plugin/Name");
 
51
        file = ve_config_get_string (cfg, "/Genius Plugin/File");
 
52
        copyright = ve_config_get_translated_string (cfg, "/Genius Plugin/Copyright");
 
53
        author = ve_config_get_string (cfg, "/Genius Plugin/Author");
 
54
        description = ve_config_get_translated_string (cfg, "/Genius Plugin/Description");
 
55
        gui = ve_config_get_bool (cfg, "/Genius Plugin/GUI=false");
 
56
        hide = ve_config_get_bool (cfg, "/Genius Plugin/Hide=false");
 
57
        ve_config_destroy (cfg);
 
58
 
 
59
        if (ve_string_empty (name) ||
 
60
            ve_string_empty (file)) {
 
61
                g_free (name);
 
62
                g_free (file);
 
63
                g_free (copyright);
 
64
                g_free (author);
 
65
                g_free (description);
 
66
                return NULL;
 
67
        }
 
68
        plg = g_new0 (GelPlugin, 1);
 
69
        plg->name = name;
 
70
        plg->base = g_strdup (file_name);
 
71
        p = strstr (plg->base,".plugin");
 
72
        if (p != NULL) *p='\0';
 
73
        plg->file = file;
 
74
        plg->copyright = copyright;
 
75
        plg->author = author;
 
76
        plg->description = description;
 
77
        plg->gui = gui;
 
78
        plg->hide = hide;
 
79
        return plg;
 
80
}