Esempio n. 1
0
static gboolean
glade_gtk_grid_configure_child (GladeFixed   *fixed,
                                GladeWidget  *child,
                                GdkRectangle *rect,
                                GtkWidget    *grid)
{
  GladeGridChild configure = { child, };

  /* Sometimes we are unable to find a widget in the appropriate column,
   * usually because a placeholder hasnt had its size allocation yet.
   */
  if (glade_gtk_grid_get_attachments (fixed, GTK_GRID (grid), rect, &configure))
    {
      if (memcmp (&configure, &grid_cur_attach, sizeof (GladeGridChild)) != 0)
        {

          glade_property_push_superuser ();
          glade_widget_pack_property_set (child, "left-attach",
                                          configure.left_attach);
          glade_widget_pack_property_set (child, "width",
                                          configure.width);
          glade_widget_pack_property_set (child, "top-attach",
                                          configure.top_attach);
          glade_widget_pack_property_set (child, "height",
                                          configure.height);
          glade_property_pop_superuser ();

          memcpy (&grid_cur_attach, &configure, sizeof (GladeGridChild));
        }
    }
  return TRUE;
}
Esempio n. 2
0
static gboolean
glade_gtk_box_configure_end (GladeFixed * fixed,
                             GladeWidget * child, GtkWidget * box)
{
  GList *list, *l, *children;
  GList *prop_list = NULL;

  children = gtk_container_get_children (GTK_CONTAINER (box));

  for (list = children; list; list = list->next)
    {
      GtkWidget *bchild = list->data;

      for (l = glade_gtk_box_original_positions; l; l = l->next)
        {
          GladeGtkBoxChild *gbchild = l->data;
          GladeWidget *gchild = glade_widget_get_from_gobject (gbchild->widget);


          if (bchild == gbchild->widget)
            {
              GCSetPropData *prop_data = g_new0 (GCSetPropData, 1);
              prop_data->property =
                  glade_widget_get_pack_property (gchild, "position");

              prop_data->old_value = g_new0 (GValue, 1);
              prop_data->new_value = g_new0 (GValue, 1);

              glade_property_get_value (prop_data->property,
                                        prop_data->new_value);

              g_value_init (prop_data->old_value, G_TYPE_INT);
              g_value_set_int (prop_data->old_value, gbchild->position);

              prop_list = g_list_prepend (prop_list, prop_data);
              break;
            }
        }
    }

  g_list_free (children);

  glade_command_push_group (_("Ordering children of %s"),
                            glade_widget_get_name (GLADE_WIDGET (fixed)));
  glade_property_push_superuser ();
  if (prop_list)
    glade_command_set_properties_list (glade_widget_get_project (GLADE_WIDGET (fixed)),
                                       prop_list);
  glade_property_pop_superuser ();
  glade_command_pop_group ();

  for (l = glade_gtk_box_original_positions; l; l = l->next)
    g_free (l->data);

  glade_gtk_box_original_positions =
      (g_list_free (glade_gtk_box_original_positions), NULL);


  return TRUE;
}