set an application name, pass the default module path to

2005-04-20  Sven Neumann  <sven@gimp.org>

	* tools/shooter.c: set an application name, pass the default
	module path to gimp_module_db_load().
This commit is contained in:
Sven Neumann
2005-04-20 12:08:46 +00:00
committed by Sven Neumann
parent a25777d322
commit 880fa8e586

View File

@ -12,11 +12,11 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimp/gimp.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h" #include "libgimpwidgets/gimpwidgets.h"
#include "libgimpwidgets/gimpwidgets-private.h" #include "libgimpwidgets/gimpwidgets-private.h"
#include "libgimp/gimp.h"
#include "libgimpmodule/gimpmoduletypes.h"
#include "libgimpmodule/gimpmoduledb.h"
#include "widgets.h" #include "widgets.h"
#include "shadow.h" #include "shadow.h"
@ -56,7 +56,8 @@ add_border_to_shot (GdkPixbuf *pixbuf)
gdk_pixbuf_get_height (pixbuf) + 2); gdk_pixbuf_get_height (pixbuf) + 2);
/* Fill with solid black */ /* Fill with solid black */
gdk_pixbuf_fill (retval, 0xFF); gdk_pixbuf_fill (retval, 0xFFFFFFFF);
gdk_pixbuf_copy_area (pixbuf, gdk_pixbuf_copy_area (pixbuf,
0, 0, 0, 0,
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_width (pixbuf),
@ -174,6 +175,7 @@ take_window_shot (Window child,
tmp2 = add_border_to_shot (tmp); tmp2 = add_border_to_shot (tmp);
retval = create_shadowed_pixbuf (tmp2); retval = create_shadowed_pixbuf (tmp2);
g_object_unref (tmp); g_object_unref (tmp);
g_object_unref (tmp2); g_object_unref (tmp2);
@ -210,9 +212,12 @@ shooter_ensure_modules (void)
if (! module_db) if (! module_db)
{ {
gchar *path = gimp_config_build_plug_in_path ("modules");
module_db = gimp_module_db_new (FALSE); module_db = gimp_module_db_new (FALSE);
gimp_module_db_set_load_inhibit (module_db, NULL);
gimp_module_db_load (module_db, ""); gimp_module_db_load (module_db, path);
g_free (path);
} }
} }
@ -223,13 +228,14 @@ main (int argc, char **argv)
GList *toplevels; GList *toplevels;
GList *node; GList *node;
/* If there's no DISPLAY, we silently error out. We don't want to break g_set_application_name ("GIMP documention shooter");
* headless builds. */
/* If there's no DISPLAY, we silently error out.
* We don't want to break headless builds.
*/
if (! gtk_init_check (&argc, &argv)) if (! gtk_init_check (&argc, &argv))
return EXIT_SUCCESS; return EXIT_SUCCESS;
gimp_stock_init ();
gimp_widgets_init (shooter_standard_help, gimp_widgets_init (shooter_standard_help,
shooter_get_foreground, shooter_get_foreground,
shooter_get_background, shooter_get_background,
@ -242,8 +248,8 @@ main (int argc, char **argv)
{ {
GdkWindow *window; GdkWindow *window;
WidgetInfo *info; WidgetInfo *info;
XID id; XID xid;
char *filename; gchar *filename;
info = node->data; info = node->data;
@ -265,11 +271,13 @@ main (int argc, char **argv)
gtk_main_iteration (); gtk_main_iteration ();
} }
id = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window)); xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
screenshot = take_window_shot (id, info->include_decorations); screenshot = take_window_shot (xid, info->include_decorations);
filename = g_strdup_printf ("./%s.png", info->name);
filename = g_strdup_printf ("%s.png", info->name);
gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL); gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);
g_free(filename); g_free(filename);
gtk_widget_hide (info->window); gtk_widget_hide (info->window);
} }