Exemple #1
0
WIDGET *
object_create_props_dialog(DiaObject *obj, gboolean is_default)
{
  GList *list = NULL;
  list = g_list_append(list, obj);
  return object_list_create_props_dialog(list, is_default);
}
Exemple #2
0
void
object_list_properties_show(Diagram *dia, GList *objects)
{
  GtkWidget *properties;
  DiaObject *one_obj;
  GtkWidget *parent = ddisplay_active() ? ddisplay_active()->shell : NULL;
  if (!dialog)
      create_dialog(parent);
  clear_dialog_globals();

  if (!objects) {
    /* Hide dialog when no object is selected */
    properties_dialog_hide();
    return;
  }

  /* Prefer object-specific UI when only one object is selected. */
  one_obj = (g_list_length(objects) == 1) ? objects->data : NULL;
  if (one_obj)
    properties = one_obj->ops->get_properties(one_obj, FALSE);
  else
    properties = object_list_create_props_dialog(objects, FALSE);
  if (properties == NULL) {
    properties = no_properties_dialog;
  }

  if (one_obj) {
    DiaObjectType *otype = one_obj->type;
    gchar *buf;

    buf = g_strconcat(_("Properties: "), _(otype->name), NULL);
    gtk_window_set_title(GTK_WINDOW(dialog), buf);
    g_free(buf);
  } else {
    gtk_window_set_title(GTK_WINDOW(dialog), _("Object properties:"));
  }

  g_signal_connect (G_OBJECT (properties), "destroy",
		  G_CALLBACK(properties_part_destroyed), NULL);
  gtk_box_pack_start(GTK_BOX(dialog_vbox), properties, TRUE, TRUE, 0);

  gtk_widget_show (properties);

  properties_give_focus(properties, NULL);

  /* resize to minimum */
  /* if (obj != current_obj) */
  gtk_window_resize (GTK_WINDOW(dialog), 1, 1);
  if (parent)
    gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW (parent));
  gtk_window_present (GTK_WINDOW (dialog));
  object_part = properties;
  current_objects = g_list_copy(objects);
  current_dia = dia;
}