modules cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The GIMP's modules for OS/2 need some extra handling.
It's copied into the 3-4 modules C files and it's also not
updated.  I want to clean up this code.

I suggest to create a new file called modregister.c and put
all the "register" things there. Modules have to link the new file.

The will be no new features only a cleaner design.
OK ?


Here is the original code (ugly and copied 3 times) :

#ifdef __EMX__
struct main_funcs_struc {
  gchar *name;
  void (*func)();
};
struct main_funcs_struc *gimp_main_funcs = NULL;

static gpointer
get_main_func(gchar *name)
{
  struct main_funcs_struc *x;
  if (gimp_main_funcs == NULL)
    return NULL;
  for (x = gimp_main_funcs; x->name; x++)
  {
    if (!strcmp(x->name, name))
      return (gpointer) x->func;
  }
}
typedef GimpColorSelectorID (*color_reg_func)(const char *,
					      GimpColorSelectorMethods *);
typedef gboolean (*color_unreg_func) (GimpColorSelectorID,
				      void (*)(void *),
				      void *);
#endif


/* globaly exported init function */
G_MODULE_EXPORT GimpModuleStatus
module_init (GimpModuleInfo **inforet)
{
  GimpColorSelectorID id;

#ifndef __EMX__
  id = gimp_color_selector_register ("GTK", "gtk.html", &methods);

  if (id)
#else
  color_reg_func reg_func;
  reg_func = (color_reg_func) get_main_func("gimp_color_selector_register");
  if (reg_func && (id = (*reg_func) ("GTK", &methods)))
#endif
  {
    info.shutdown_data = id;
    *inforet = &info;
    return GIMP_MODULE_OK;
  }
  else
  {
    return GIMP_MODULE_UNLOAD;
  }
}

***********************************************************
* Asbjørn Pettersen           Phone work: +47 77 66 08 91  *
* Kongsberg Spacetec a.s     Phone home: +47 77674022  *
*                              Telefax:    +47 77 65 58 59  *
* Prestvannveien 38          www:http://www.spacetec.no   *
* N-9005 Tromsoe, Norway     email:ape@xxxxxxxxxxx  *
***********************************************************



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux