Support parallel installations. The idea is that for CAD screener, we want
to be able to install this on the same machine as a standard AVOT setup
(most notably for John's laptop). To allow for the possibility of a second
application that might have the same requirements, we add the concept of
vendor-specific distributions. Thus we can have one distribution for CAD
screener and one for The Next Big Thing. It doesn't seem trivial to have
both CAD screener and AVOT under the same vendor tag so we'll have to have
AVOT under "City Occupational" and CAD screener under "City Occupational Ltd"
or some such kludge.
Most of this is done although we are very short of test cases (in particular
we don't test that it's actually possible to install CAD screener in parallel
with AVOT or to update either of them once installed, which is fundamental).
We also have a lot of baggage left over, including an intercept of razor_set.
The problem that this was introduced to debug has been fixed but it looks
like there are a number of memory leaks which it might be useful to help
track down so it has been left in place for now.
There is still a lot of confusion in plover between path-based and URI-based
API. We should review the API, decide what we want and have a general clear up.
There is also confusion as to the purpose of RAZOR_ROOT (and meaning; path or
URI). This is not used at all in librazor (although it is used in razor.exe).
Ideally we shouldn't use it in plover or plover-gtk either although again, we
might want to support it or an equivalent in (some of) the various executables.
Work that would still to nice to do for CAD screener:
- uninstall (ideally as an installed program that hooks into Add/Remove programs
but even re-running the installer would be acceptable).
- xz support (smaller packages).
- repomd.xml and xml:base (would be needed for an Internet installer).
- graphical installer.
2 * Copyright (C) 2010 J. Ali Harlow <ali@juiblex.co.uk>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <plover-gtk/stockicons.h>
28 /* Checks whether a loader for SVG files has been registered
31 static gboolean plover_pixbuf_supports_svg(void)
35 static gint found_svg=-1;
36 gchar **mime_types,**mime_type;
37 if (g_getenv("PLOVER_IGNORE_SVG_SUPPORT"))
41 formats=gdk_pixbuf_get_formats();
43 for (tmp_list=formats;tmp_list && !found_svg;tmp_list=tmp_list->next)
45 mime_types=gdk_pixbuf_format_get_mime_types(tmp_list->data);
46 for (mime_type=mime_types;*mime_type && !found_svg;mime_type++)
47 if (!strcmp(*mime_type,"image/svg"))
49 g_strfreev(mime_types);
51 g_slist_free(formats);
55 static void plover_install_icon_at_size(const char *icon_name,
56 GtkIconSet *icon_set,GtkIconSize size,const char *filename)
60 GtkSettings *settings;
61 GtkIconSource *source;
63 settings=gtk_settings_get_default();
65 g_warning("plover: Can't add icons without a default screen");
66 else if (gtk_icon_size_lookup_for_settings(settings,size,&w,&h))
68 pixbuf=gdk_pixbuf_new_from_file_at_size(filename,w,h,&err);
71 source=gtk_icon_source_new();
72 gtk_icon_source_set_size_wildcarded(source,FALSE);
73 gtk_icon_source_set_size(source,size);
74 gtk_icon_source_set_pixbuf(source,pixbuf);
75 gtk_icon_set_add_source(icon_set,source);
76 gtk_icon_source_free(source);
77 g_object_unref(pixbuf);
81 g_warning("%s: %s",filename,err->message);
88 * plover_icons_add_to_stock:
89 * @type: The icon type, typically "apps" or "mimetype"
90 * @name: The icon name (the basename of files containing the icons)
92 * Find icons in <datadir>/icons/hicolor and add them to the stock images
93 * so that, for example, gtk_image_new_from_stock() will be able find them.
95 * If there is an SVG loader registered with GdkPixbuf, then:
96 * <datadir>/icons/hicolor/scalable/@type/@name.svg will be used. Otherwise,
97 * <datadir>/icons/hicolor/24x24/@type/@name.png and
98 * <datadir>/icons/hicolor/48x48/@type/@name.png will be used.
100 void plover_icons_add_to_stock(const char *type,const char *name)
102 gchar *datadir,*prefix,*s,*filename;
103 GtkIconSource *source;
104 GtkIconSet *icon_set;
105 GtkIconFactory *factory;
106 factory=gtk_icon_factory_new();
107 icon_set=gtk_icon_set_new();
108 datadir=g_strdup(g_getenv("PLOVER_ICONS_DATADIR"));
112 prefix=g_win32_get_package_installation_directory_of_module(NULL);
117 prefix=g_strdup("/usr");
118 datadir=g_strconcat(prefix,"share",NULL);
121 if (plover_pixbuf_supports_svg())
123 source=gtk_icon_source_new();
124 s=g_strconcat(name,".svg",NULL);
125 filename=g_build_filename(datadir,"icons/hicolor/scalable",type,s,NULL);
127 gtk_icon_source_set_filename(source,filename);
129 gtk_icon_set_add_source(icon_set,source);
130 gtk_icon_source_free(source);
134 s=g_strconcat(name,".png",NULL);
135 filename=g_build_filename(datadir,"icons/hicolor/24x24",type,s,NULL);
136 plover_install_icon_at_size(name,icon_set,GTK_ICON_SIZE_MENU,
138 plover_install_icon_at_size(name,icon_set,GTK_ICON_SIZE_BUTTON,
140 plover_install_icon_at_size(name,icon_set,GTK_ICON_SIZE_SMALL_TOOLBAR,
142 plover_install_icon_at_size(name,icon_set,GTK_ICON_SIZE_LARGE_TOOLBAR,
145 filename=g_build_filename(datadir,"icons/hicolor/48x48",type,s,NULL);
146 plover_install_icon_at_size(name,icon_set,GTK_ICON_SIZE_DND,
148 plover_install_icon_at_size(name,icon_set,GTK_ICON_SIZE_DIALOG,
154 gtk_icon_factory_add(factory,name,icon_set);
155 gtk_icon_set_unref(icon_set);
156 //icon_set=gtk_icon_factory_lookup(factory,name);
157 gtk_icon_factory_add_default(factory);
158 g_object_unref(factory);