示例#1
0
ObjectChange *
object_apply_props_from_dialog(DiaObject *obj, WIDGET *dialog_widget)
{
  ObjectChange *change;
  PropDialog *dialog = prop_dialog_from_widget(dialog_widget);
  GPtrArray *props = g_ptr_array_new ();
  guint i;

  prop_get_data_from_widgets(dialog);
  /* only stuff which is actually changed */
  for (i = 0; i < dialog->props->len; ++i) {
    Property *p = g_ptr_array_index (dialog->props, i);
    if (p->descr->flags & PROP_FLAG_WIDGET_ONLY)
      continue;
    if ((p->experience & PXP_NOTSET) == 0)
      g_ptr_array_add(props, p);
  }
  /* with an empty list there is no change at all but simply
   * returning NULL is against the contract ...
   */
  if (!obj->ops->apply_properties_list) {
    g_warning("using a fallback function to apply properties;"
              " undo may not work correctly");
    change = object_apply_props(obj, props);
  } else {
    change = obj->ops->apply_properties_list(obj, props);
  }
  g_ptr_array_free(props, TRUE);
  return change;
}
示例#2
0
文件: compound.c 项目: brunetton/dia
static ObjectChange *
compound_apply_properties_dialog (Compound * comp, GtkWidget * dialog_widget)
{
  CompoundState * state;
  PropDialog *dialog = prop_dialog_from_widget(dialog_widget);

  state = compound_state_new (comp);

  prop_get_data_from_widgets(dialog);
  compound_apply_props (comp, dialog->props, FALSE);
  return (ObjectChange *) compound_change_new (comp, state);
}
示例#3
0
文件: propdialogs.c 项目: UIKit0/dia
static void 
property_signal_handler(GObject *obj,
                        gpointer func_data)
{
  PropEventData *ped = (PropEventData *)func_data;
  if (ped) {
    PropDialog *dialog = ped->dialog;
    Property *prop = ped->self;
    GList *list, *tmp;
    guint j;

    list = dialog->copies;
    g_return_if_fail(list);

    prop->experience &= ~PXP_NOTSET;

    if (!prop->event_handler)
	return;

    /* g_message("Received a signal for object %s from property %s",
       obj->type->name,prop->descr->name); */

    /* obj is a scratch object ; we can do what we want with it. */
    prop_get_data_from_widgets(dialog);

    for (tmp = list; tmp != NULL; tmp = tmp->next) {
      DiaObject *obj = (DiaObject*)tmp->data;
      obj->ops->set_props(obj,dialog->props);
      prop->event_handler(obj,prop);
      obj->ops->get_props(obj,dialog->props);
    }

    for (j = 0; j < dialog->prop_widgets->len; j++) {
      PropWidgetAssoc *pwa = 
        &g_array_index(dialog->prop_widgets,PropWidgetAssoc,j);
      pwa->prop->ops->reset_widget(pwa->prop,pwa->widget);
    }
  } else {
    g_assert_not_reached();
  }
}