glade-catalog.c 19.7 KB
Newer Older
Jose Maria Celorio's avatar
Jose Maria Celorio committed
1 2
/*
 * Copyright (C) 2001 Ximian, Inc.
3
 * Copyright (C) 2004 Imendio AB
Jose Maria Celorio's avatar
Jose Maria Celorio committed
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * 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 of the
 * License, 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
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jose Maria Celorio's avatar
Jose Maria Celorio committed
18 19 20 21 22
 *
 * Authors:
 *   Chema Celorio <chema@celorio.com>
 */

23
#include <config.h>
Jose Maria Celorio's avatar
Jose Maria Celorio committed
24 25 26

#include "glade.h"
#include "glade-catalog.h"
27
#include "glade-widget-adaptor.h"
Jose Maria Celorio's avatar
Jose Maria Celorio committed
28

29 30 31 32 33 34
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <glib.h>
#include <glib/gi18n-lib.h>

35
struct _GladeCatalog
Joaquín Cuenca Abela's avatar
Joaquín Cuenca Abela committed
36
{
37 38
  guint16 major_version;        /* The catalog version               */
  guint16 minor_version;
39

40
  GList *targetable_versions;   /* list of suitable version targets */
41

42
  gchar *library;               /* Library name for backend support  */
Jose Maria Celorio's avatar
Jose Maria Celorio committed
43

44
  gchar *name;                  /* Symbolic catalog name             */
45

46 47
  gchar *dep_catalog;           /* Symbolic name of the catalog that
                                 * this catalog depends on           */
48

49 50 51 52
  gchar *domain;                /* The domain to be used to translate
                                 * strings from this catalog (otherwise this 
                                 * defaults to the library name)
                                 */
53

54 55
  gchar *book;                  /* Devhelp search domain
                                 */
Vincent Geddes's avatar
Vincent Geddes committed
56

57
  gchar *icon_prefix;           /* the prefix for icons */
58

59 60 61 62 63 64 65 66 67 68
  GList *widget_groups;         /* List of widget groups (palette)   */
  GList *adaptors;              /* List of widget class adaptors (all)  */

  GladeXmlContext *context;     /* Xml context is stored after open
                                 * before classes are loaded         */

  GModule *module;

  gchar *init_function_name;    /* Catalog's init function name */
  GladeCatalogInitFunc init_function;
69 70
};

71 72
struct _GladeWidgetGroup
{
73 74
  gchar *name;                  /* Group name */
  gchar *title;                 /* Group name in the palette */
75

76
  gboolean expanded;            /* Whether group is expanded in the palette */
77

78
  GList *adaptors;              /* List of class adaptors in the palette    */
79 80
};

81
static void catalog_load (GladeCatalog * catalog);
82

83
static GladeCatalog *catalog_open (const gchar * filename);
84

85
static GList *catalog_sort (GList * catalogs);
86

87 88
static gboolean catalog_load_classes (GladeCatalog * catalog,
                                      GladeXmlNode * widgets_node);
89

90 91
static gboolean catalog_load_group (GladeCatalog * catalog,
                                    GladeXmlNode * group_node);
92

93
static void widget_group_destroy (GladeWidgetGroup * group);
94

95
static void catalog_destroy (GladeCatalog * catalog);
96

97
static void module_close (GModule * module);
98

Jose Maria Celorio's avatar
Jose Maria Celorio committed
99

100
/* List of catalogs successfully loaded.
101 102
 */
static GList *loaded_catalogs = NULL;
103

104
static gboolean
105 106
catalog_get_function (GladeCatalog * catalog,
                      const gchar * symbol_name, gpointer * symbol_ptr)
107
{
108 109
  if (catalog->module == NULL)
    catalog->module = glade_util_load_library (catalog->library);
110

111 112 113 114
  if (catalog->module)
    return g_module_symbol (catalog->module, symbol_name, symbol_ptr);

  return FALSE;
115 116
}

117 118 119
static GladeCatalog *
catalog_allocate (void)
{
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
  GladeCatalog *catalog;

  catalog = g_slice_new0 (GladeCatalog);

  catalog->library = NULL;
  catalog->name = NULL;
  catalog->dep_catalog = NULL;
  catalog->domain = NULL;
  catalog->book = NULL;
  catalog->icon_prefix = NULL;
  catalog->init_function_name = NULL;
  catalog->module = NULL;

  catalog->context = NULL;
  catalog->adaptors = NULL;
  catalog->widget_groups = NULL;

  return catalog;
138 139
}

140
static GladeCatalog *
141
catalog_open (const gchar * filename)
Jose Maria Celorio's avatar
Jose Maria Celorio committed
142
{
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
  GladeTargetableVersion *version;
  GladeCatalog *catalog;
  GladeXmlContext *context;
  GladeXmlDoc *doc;
  GladeXmlNode *root;

  /* get the context & root node of the catalog file */
  context = glade_xml_context_new_from_path (filename,
                                             NULL, GLADE_TAG_GLADE_CATALOG);
  if (!context)
    {
      g_warning ("Couldn't open catalog [%s].", filename);
      return NULL;
    }

  doc = glade_xml_context_get_doc (context);
  root = glade_xml_doc_get_root (doc);

  if (!glade_xml_node_verify (root, GLADE_TAG_GLADE_CATALOG))
    {
      g_warning ("Catalog root node is not '%s', skipping %s",
                 GLADE_TAG_GLADE_CATALOG, filename);
      glade_xml_context_free (context);
      return NULL;
    }

  catalog = catalog_allocate ();
  catalog->context = context;
  catalog->name = glade_xml_get_property_string (root, GLADE_TAG_NAME);

  if (!catalog->name)
    {
      g_warning ("Couldn't find required property 'name' in catalog root node");
      catalog_destroy (catalog);
      return NULL;
    }


  glade_xml_get_property_version (root, GLADE_TAG_VERSION,
                                  &catalog->major_version,
                                  &catalog->minor_version);

  /* Make one default suitable target */
  version = g_new (GladeTargetableVersion, 1);
  version->major = catalog->major_version;
  version->minor = catalog->minor_version;

  catalog->targetable_versions =
      glade_xml_get_property_targetable_versions (root, GLADE_TAG_TARGETABLE);

  catalog->targetable_versions =
      g_list_prepend (catalog->targetable_versions, version);

  catalog->library = glade_xml_get_property_string (root, GLADE_TAG_LIBRARY);
  catalog->dep_catalog =
      glade_xml_get_property_string (root, GLADE_TAG_DEPENDS);
  catalog->domain = glade_xml_get_property_string (root, GLADE_TAG_DOMAIN);
  catalog->book = glade_xml_get_property_string (root, GLADE_TAG_BOOK);
  catalog->icon_prefix =
      glade_xml_get_property_string (root, GLADE_TAG_ICON_PREFIX);
  catalog->init_function_name =
      glade_xml_get_value_string (root, GLADE_TAG_INIT_FUNCTION);

  if (!catalog->domain)
    catalog->domain = g_strdup (catalog->library);

  /* catalog->icon_prefix defaults to catalog->name */
  if (!catalog->icon_prefix)
    catalog->icon_prefix = g_strdup (catalog->name);

  if (catalog->init_function_name)
    catalog_get_function (catalog, catalog->init_function_name,
                          (gpointer) & catalog->init_function);

  return catalog;
218
}
Jose Maria Celorio's avatar
Jose Maria Celorio committed
219

220 221

static void
222
catalog_load (GladeCatalog * catalog)
223
{
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
  GladeXmlDoc *doc;
  GladeXmlNode *root;
  GladeXmlNode *node;

  g_return_if_fail (catalog->context != NULL);

  doc = glade_xml_context_get_doc (catalog->context);
  root = glade_xml_doc_get_root (doc);
  node = glade_xml_node_get_children (root);

  for (; node; node = glade_xml_node_next (node))
    {
      const gchar *node_name;

      node_name = glade_xml_node_get_name (node);
      if (strcmp (node_name, GLADE_TAG_GLADE_WIDGET_CLASSES) == 0)
        {
          catalog_load_classes (catalog, node);
        }
      else if (strcmp (node_name, GLADE_TAG_GLADE_WIDGET_GROUP) == 0)
        {
          catalog_load_group (catalog, node);
        }
      else
        continue;
    }

  catalog->widget_groups = g_list_reverse (catalog->widget_groups);
  catalog->context = (glade_xml_context_free (catalog->context), NULL);

  return;
255
}
256

257
static gint
258
catalog_find_by_name (GladeCatalog * catalog, const gchar * name)
259
{
260
  return strcmp (catalog->name, name);
261
}
262

263
static GList *
264
catalog_sort (GList * catalogs)
265
{
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
  GList *l, *node, *sorted = NULL, *sort;
  GladeCatalog *catalog, *cat;

  /* Add all dependant catalogs to the sorted list first */
  for (l = catalogs; l; l = l->next)
    {
      catalog = l->data;
      sort = NULL;

      /* itterate ascending through dependancy hierarchy */
      while (catalog->dep_catalog)
        {
          node = g_list_find_custom
              (catalogs, catalog->dep_catalog,
               (GCompareFunc) catalog_find_by_name);

          if (!node || (cat = node->data) == NULL)
            {
              g_critical ("Catalog %s depends on catalog %s, not found",
                          catalog->name, catalog->dep_catalog);
              break;
            }

          /* Prepend to sort list */
          if (g_list_find (sort, cat) == NULL &&
              g_list_find (sorted, cat) == NULL)
            sort = g_list_prepend (sort, cat);

          catalog = cat;
        }
      sorted = g_list_concat (sorted, sort);
    }

  /* Append all independant catalogs after */
  for (l = catalogs; l; l = l->next)
    if (g_list_find (sorted, l->data) == NULL)
      sorted = g_list_append (sorted, l->data);

  g_list_free (catalogs);
  return sorted;
306 307
}

308 309 310
static GHashTable *modules = NULL;

static GModule *
311
catalog_load_library (GladeCatalog * catalog)
312
{
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
  GModule *module;

  if (modules == NULL)
    modules = g_hash_table_new_full (g_str_hash,
                                     g_str_equal,
                                     (GDestroyNotify) g_free,
                                     (GDestroyNotify) module_close);

  if (catalog->library == NULL)
    return NULL;

  if ((module = g_hash_table_lookup (modules, catalog->library)))
    return module;

  if ((module = glade_util_load_library (catalog->library)))
    g_hash_table_insert (modules, g_strdup (catalog->library), module);
  else
    g_warning ("Failed to load external library '%s'", catalog->library);

  return module;
333
}
334

335
static gboolean
336
catalog_load_classes (GladeCatalog * catalog, GladeXmlNode * widgets_node)
337
{
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
  GladeXmlNode *node;
  GModule *module = catalog_load_library (catalog);

  node = glade_xml_node_get_children (widgets_node);
  for (; node; node = glade_xml_node_next (node))
    {
      const gchar *node_name, *domain;
      GladeWidgetAdaptor *adaptor;

      node_name = glade_xml_node_get_name (node);
      if (strcmp (node_name, GLADE_TAG_GLADE_WIDGET_CLASS) != 0)
        continue;

      domain = catalog->domain ? catalog->domain : catalog->library;

      adaptor = glade_widget_adaptor_from_catalog (catalog, node, module);

      catalog->adaptors = g_list_prepend (catalog->adaptors, adaptor);
    }

  return TRUE;
359 360 361
}

static gboolean
362
catalog_load_group (GladeCatalog * catalog, GladeXmlNode * group_node)
363
{
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
  GladeWidgetGroup *group;
  GladeXmlNode *node;
  char *title, *translated_title;

  group = g_slice_new0 (GladeWidgetGroup);

  group->name = glade_xml_get_property_string (group_node, GLADE_TAG_NAME);

  if (!group->name)
    {
      g_warning ("Required property 'name' not found in group node");
      widget_group_destroy (group);
      return FALSE;
    }

  title = glade_xml_get_property_string (group_node, GLADE_TAG_TITLE);
  if (!title)
    {
      g_warning ("Required property 'title' not found in group node");
      widget_group_destroy (group);
      return FALSE;
    }

  /* by default, group is expanded in palette  */
  group->expanded = TRUE;

  /* Translate it */
  translated_title = dgettext (catalog->domain, title);
  if (translated_title != title)
    {
      group->title = g_strdup (translated_title);
      g_free (title);
    }
  else
    {
      group->title = title;
    }

  group->adaptors = NULL;

  node = glade_xml_node_get_children (group_node);
  for (; node; node = glade_xml_node_next (node))
    {
      const gchar *node_name;
      GladeWidgetAdaptor *adaptor;
      gchar *name;

      node_name = glade_xml_node_get_name (node);

      if (strcmp (node_name, GLADE_TAG_GLADE_WIDGET_CLASS_REF) == 0)
414
        {
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
          if ((name =
               glade_xml_get_property_string (node, GLADE_TAG_NAME)) == NULL)
            {
              g_warning ("Couldn't find required property on %s",
                         GLADE_TAG_GLADE_WIDGET_CLASS);
              continue;
            }

          if ((adaptor = glade_widget_adaptor_get_by_name (name)) == NULL)
            {
              g_warning ("Tried to include undefined widget "
                         "class '%s' in a widget group", name);
              g_free (name);
              continue;
            }
          g_free (name);

          group->adaptors = g_list_prepend (group->adaptors, adaptor);

434
        }
435
      else if (strcmp (node_name, GLADE_TAG_DEFAULT_PALETTE_STATE) == 0)
436
        {
437 438 439
          group->expanded =
              glade_xml_get_property_boolean
              (node, GLADE_TAG_EXPANDED, group->expanded);
440
        }
441
    }
442

443 444 445 446 447
  group->adaptors = g_list_reverse (group->adaptors);

  catalog->widget_groups = g_list_prepend (catalog->widget_groups, group);

  return TRUE;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
448
}
449

450
static GList *
451
catalogs_from_path (GList * catalogs, const gchar * path)
452
{
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
  GladeCatalog *catalog;
  GDir *dir;
  GError *error = NULL;
  const gchar *filename;

  if ((dir = g_dir_open (path, 0, &error)) != NULL)
    {
      while ((filename = g_dir_read_name (dir)))
        {
          gchar *catalog_filename;

          if (!g_str_has_suffix (filename, ".xml"))
            continue;

          catalog_filename = g_build_filename (path, filename, NULL);
          catalog = catalog_open (catalog_filename);
          g_free (catalog_filename);

          if (catalog)
            {
              /* Verify that we are not loading the same catalog twice !
               */
              if (!g_list_find_custom (catalogs, catalog->name,
                                       (GCompareFunc) catalog_find_by_name))
                catalogs = g_list_prepend (catalogs, catalog);
              else
                catalog_destroy (catalog);
            }
          else
            g_warning ("Unable to open the catalog file %s.\n", filename);
        }
    }
  else
    g_warning ("Failed to open catalog directory '%s': %s", path,
               error->message);


  return catalogs;
491 492 493 494 495
}

const GList *
glade_catalog_load_all (void)
{
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
  GList *catalogs = NULL, *l, *adaptors;
  GladeCatalog *catalog;
  const gchar *search_path;
  gchar **split;
  GString *icon_warning = NULL;
  gint i;


  /* Make sure we don't init the catalogs twice */
  if (loaded_catalogs)
    return loaded_catalogs;

  /* First load catalogs from user specified directories ... */
  if ((search_path = g_getenv (GLADE_ENV_CATALOG_PATH)) != NULL)
    {
      if ((split = g_strsplit (search_path, ":", 0)) != NULL)
        {
          for (i = 0; split[i] != NULL; i++)
            catalogs = catalogs_from_path (catalogs, split[i]);

          g_strfreev (split);
        }
    }

  /* ... Then load catalogs from standard install directory */
  catalogs = catalogs_from_path (catalogs, glade_app_get_catalogs_dir ());

  /* Catalogs need dependancies, most catalogs depend on
   * the gtk+ catalog, but some custom toolkits may depend
   * on the gnome catalog for instance.
   */
  catalogs = catalog_sort (catalogs);

  /* After sorting, execute init function and then load */
  for (l = catalogs; l; l = l->next)
    {
      catalog = l->data;
      if (catalog->init_function)
        catalog->init_function (catalog->name);
    }

  for (l = catalogs; l; l = l->next)
    {
      catalog = l->data;
      catalog_load (catalog);
    }

  /* Print a summery of widget adaptors missing icons.
   */
  adaptors = glade_widget_adaptor_list_adaptors ();
  for (l = adaptors; l; l = l->next)
    {
      GladeWidgetAdaptor *adaptor = l->data;

550
      if (glade_widget_adaptor_get_missing_icon (adaptor))
551 552 553 554 555 556 557 558
        {
          if (!icon_warning)
            icon_warning = g_string_new ("Glade needs artwork; "
                                         "a default icon will be used for "
                                         "the following classes:");

          g_string_append_printf (icon_warning,
                                  "\n\t%s\tneeds an icon named '%s'",
559 560
                                  glade_widget_adaptor_get_name (adaptor), 
				  glade_widget_adaptor_get_missing_icon (adaptor));
561 562 563 564 565 566 567 568 569 570 571 572 573 574
        }

    }
  g_list_free (adaptors);

  if (icon_warning)
    {
      g_message ("%s", icon_warning->str);
      g_string_free (icon_warning, TRUE);
    }

  loaded_catalogs = catalogs;

  return loaded_catalogs;
575
}
576

577
G_CONST_RETURN gchar *
578
glade_catalog_get_name (GladeCatalog * catalog)
579
{
580
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
581

582
  return catalog->name;
583 584
}

585
G_CONST_RETURN gchar *
586
glade_catalog_get_book (GladeCatalog * catalog)
587
{
588
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
589

590
  return catalog->book;
591 592 593
}

G_CONST_RETURN gchar *
594
glade_catalog_get_domain (GladeCatalog * catalog)
595
{
596
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
597

598
  return catalog->domain;
599 600 601
}

G_CONST_RETURN gchar *
602
glade_catalog_get_icon_prefix (GladeCatalog * catalog)
603
{
604
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
605

606
  return catalog->icon_prefix;
607 608
}

609
guint16
610
glade_catalog_get_major_version (GladeCatalog * catalog)
611
{
612
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), 0);
613

614
  return catalog->major_version;
615 616
}

617
guint16
618
glade_catalog_get_minor_version (GladeCatalog * catalog)
619
{
620
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), 0);
621

622
  return catalog->minor_version;
623 624 625 626
}


GList *
627
glade_catalog_get_targets (GladeCatalog * catalog)
628
{
629
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
630

631
  return catalog->targetable_versions;
632 633
}

634
GList *
635
glade_catalog_get_widget_groups (GladeCatalog * catalog)
636
{
637
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
638

639
  return catalog->widget_groups;
640 641
}

642
GList *
643
glade_catalog_get_adaptors (GladeCatalog * catalog)
644
{
645
  g_return_val_if_fail (GLADE_IS_CATALOG (catalog), NULL);
646

647
  return catalog->adaptors;
648
}
649

650
gboolean
651
glade_catalog_is_loaded (const gchar * name)
652
{
653 654 655 656 657 658 659 660 661 662 663 664 665
  GList *l;

  g_return_val_if_fail (name != NULL, FALSE);
  g_assert (loaded_catalogs != NULL);

  for (l = loaded_catalogs; l; l = l->next)
    {
      GladeCatalog *catalog = GLADE_CATALOG (l->data);
      if (strcmp (catalog->name, name) == 0)
        return TRUE;
    }

  return FALSE;
666
}
667

668
static void
669
catalog_destroy (GladeCatalog * catalog)
670
{
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696
  g_return_if_fail (GLADE_IS_CATALOG (catalog));

  g_free (catalog->name);
  g_free (catalog->library);
  g_free (catalog->dep_catalog);
  g_free (catalog->domain);
  g_free (catalog->book);
  g_free (catalog->icon_prefix);
  g_free (catalog->init_function_name);

  if (catalog->adaptors)
    {
      g_list_free (catalog->adaptors);
    }

  if (catalog->widget_groups)
    {
      g_list_foreach (catalog->widget_groups, (GFunc) widget_group_destroy,
                      NULL);
      g_list_free (catalog->widget_groups);
    }

  if (catalog->context)
    glade_xml_context_free (catalog->context);

  g_slice_free (GladeCatalog, catalog);
697
}
698

699 700
static void
module_close (GModule * module)
701
{
702
  g_module_close (module);
703 704 705 706
}

void
glade_catalog_destroy_all (void)
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
{
  /* close catalogs */
  if (loaded_catalogs)
    {
      GList *l;
      for (l = loaded_catalogs; l; l = l->next)
        catalog_destroy (GLADE_CATALOG (l->data));
      g_list_free (loaded_catalogs);
      loaded_catalogs = NULL;
    }

  /* close plugin modules */
  if (modules)
    {
      g_hash_table_destroy (modules);
      modules = NULL;
    }
724
}
725

726
const gchar *
727
glade_widget_group_get_name (GladeWidgetGroup * group)
728
{
729
  g_return_val_if_fail (group != NULL, NULL);
730

731
  return group->name;
732 733 734
}

const gchar *
735
glade_widget_group_get_title (GladeWidgetGroup * group)
736
{
737
  g_return_val_if_fail (group != NULL, NULL);
738

739
  return group->title;
740 741
}

742
gboolean
743
glade_widget_group_get_expanded (GladeWidgetGroup * group)
744
{
745
  g_return_val_if_fail (group != NULL, FALSE);
746

747
  return group->expanded;
748 749
}

750
const GList *
751
glade_widget_group_get_adaptors (GladeWidgetGroup * group)
752
{
753
  g_return_val_if_fail (group != NULL, NULL);
754

755
  return group->adaptors;
756 757
}

758
static void
759
widget_group_destroy (GladeWidgetGroup * group)
760
{
761 762 763 764 765
  g_return_if_fail (GLADE_IS_WIDGET_GROUP (group));

  g_free (group->name);
  g_free (group->title);
  g_list_free (group->adaptors);
766

767
  g_slice_free (GladeWidgetGroup, group);
768
}