Beispiel #1
0
static void
glide_window_undo_manager_position_changed_cb (GlideUndoManager *manager,
					       gpointer user_data)
{
  GlideWindow *w = (GlideWindow *)user_data;
  glide_window_update_undo_ui (w);
  
  if (!glide_document_get_dirty (w->priv->document))
    {
      glide_document_set_dirty (w->priv->document, TRUE);
      glide_window_update_title (w);
    }
}
Beispiel #2
0
static void
glide_document_set_property (GObject *object,
			     guint prop_id,
			     const GValue *value,
			     GParamSpec *pspec)
{
  GlideDocument *document = GLIDE_DOCUMENT (object);
  
  switch (prop_id)
    {
    case PROP_NAME:
      g_return_if_fail (document->priv->name == NULL);
      document->priv->name = g_value_dup_string (value);
      GLIDE_NOTE (DOCUMENT, "Constructing new GlideDocument (%p): %s",
		  object, document->priv->name);
      break;
    case PROP_WIDTH:
      document->priv->width = g_value_get_int (value);
      break;
    case PROP_HEIGHT:
      document->priv->height = g_value_get_int (value);
      break;
    case PROP_PATH:
      if (document->priv->path)
	g_free (document->priv->path);
      document->priv->path = g_value_dup_string (value);
      break;
    case PROP_DIRTY:
      glide_document_set_dirty (document, g_value_get_boolean (value));
      break;
    case PROP_THEME:
      glide_document_set_theme (document, (GlideTheme *)g_value_get_object (value));
      break;
    default: 
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Beispiel #3
0
static void
glide_window_save_document_real (GlideWindow *w,
				 const gchar *filename)
{
  JsonNode *node;
  JsonGenerator *gen;
  
  node = glide_document_serialize (w->priv->document);
  
  gen = json_generator_new ();
  g_object_set (gen, "pretty", TRUE, NULL);
  
  json_generator_set_root (gen, node);
  
  // TODO: Error
  json_generator_to_file (gen, filename, NULL);

  glide_document_set_dirty (w->priv->document, FALSE);
  glide_document_set_path (w->priv->document, filename);
  
  // Maybe gets called twice?
  glide_window_update_title (w);
}