[gnome-builder] environment: add IdeEnvironmentEditor



commit fccf63b6ce58dfcc6709e332f5009ed993bfe4fb
Author: Christian Hergert <chergert redhat com>
Date:   Sun Feb 14 20:37:06 2016 -0800

    environment: add IdeEnvironmentEditor
    
    Add a reusable component to edit IdeEnvironments.

 libide/Makefile.am                  |    4 +
 libide/ide-environment-editor-row.c |  272 ++++++++++++++++++++++++++++++
 libide/ide-environment-editor-row.h |   39 +++++
 libide/ide-environment-editor.c     |  311 +++++++++++++++++++++++++++++++++++
 libide/ide-environment-editor.h     |   39 +++++
 5 files changed, 665 insertions(+), 0 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 2f0461b..7a89836 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -85,6 +85,10 @@ libide_1_0_la_public_sources = \
        ide-enums.h \
        ide-environment.c \
        ide-environment.h \
+       ide-environment-editor.c \
+       ide-environment-editor.h \
+       ide-environment-editor-row.c \
+       ide-environment-editor-row.h \
        ide-environment-variable.c \
        ide-environment-variable.h \
        ide-executable.c \
diff --git a/libide/ide-environment-editor-row.c b/libide/ide-environment-editor-row.c
new file mode 100644
index 0000000..4db6d40
--- /dev/null
+++ b/libide/ide-environment-editor-row.c
@@ -0,0 +1,272 @@
+/* ide-environment-editor-row.c
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ide-environment-editor-row.h"
+
+struct _IdeEnvironmentEditorRow
+{
+  GtkListBoxRow           parent_instance;
+
+  IdeEnvironmentVariable *variable;
+
+  GtkEntry               *key_entry;
+  GtkEntry               *value_entry;
+  GtkButton              *delete_button;
+
+  GBinding               *key_binding;
+  GBinding               *value_binding;
+};
+
+enum {
+  PROP_0,
+  PROP_VARIABLE,
+  LAST_PROP
+};
+
+enum {
+  DELETE,
+  LAST_SIGNAL
+};
+
+G_DEFINE_TYPE (IdeEnvironmentEditorRow, ide_environment_editor_row, GTK_TYPE_LIST_BOX_ROW)
+
+static GParamSpec *properties [LAST_PROP];
+static guint signals [LAST_SIGNAL];
+
+static gboolean
+null_safe_mapping (GBinding     *binding,
+                   const GValue *from_value,
+                   GValue       *to_value,
+                   gpointer      user_data)
+{
+  const gchar *str = g_value_get_string (from_value);
+  g_value_set_string (to_value, str ?: "");
+  return TRUE;
+}
+
+static void
+ide_environment_editor_row_connect (IdeEnvironmentEditorRow *self)
+{
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+  g_assert (IDE_IS_ENVIRONMENT_VARIABLE (self->variable));
+
+  self->key_binding =
+    g_object_bind_property_full (self->variable, "key", self->key_entry, "text",
+                                 G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL,
+                                 null_safe_mapping, NULL, NULL, NULL);
+
+  self->value_binding =
+    g_object_bind_property_full (self->variable, "value", self->value_entry, "text",
+                                 G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL,
+                                 null_safe_mapping, NULL, NULL, NULL);
+}
+
+static void
+ide_environment_editor_row_disconnect (IdeEnvironmentEditorRow *self)
+{
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+  g_assert (IDE_IS_ENVIRONMENT_VARIABLE (self->variable));
+
+  g_clear_pointer (&self->key_binding, g_binding_unbind);
+  g_clear_pointer (&self->value_binding, g_binding_unbind);
+}
+
+static void
+delete_button_clicked (GtkButton               *button,
+                       IdeEnvironmentEditorRow *self)
+{
+  g_assert (GTK_IS_BUTTON (button));
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+
+  g_signal_emit (self, signals [DELETE], 0);
+}
+
+static void
+key_entry_activate (GtkWidget               *entry,
+                    IdeEnvironmentEditorRow *self)
+{
+  g_assert (GTK_IS_ENTRY (entry));
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+
+  gtk_widget_grab_focus (GTK_WIDGET (self->value_entry));
+}
+
+static void
+value_entry_activate (GtkWidget               *entry,
+                      IdeEnvironmentEditorRow *self)
+{
+  GtkWidget *parent;
+
+  g_assert (GTK_IS_ENTRY (entry));
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+
+  gtk_widget_grab_focus (GTK_WIDGET (self));
+  parent = gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_LIST_BOX);
+  g_signal_emit_by_name (parent, "move-cursor", GTK_MOVEMENT_DISPLAY_LINES, 1);
+}
+
+static void
+ide_environment_editor_row_destroy (GtkWidget *widget)
+{
+  IdeEnvironmentEditorRow *self = (IdeEnvironmentEditorRow *)widget;
+
+  if (self->variable != NULL)
+    {
+      ide_environment_editor_row_disconnect (self);
+      g_clear_object (&self->variable);
+    }
+
+  GTK_WIDGET_CLASS (ide_environment_editor_row_parent_class)->destroy (widget);
+}
+
+static void
+ide_environment_editor_row_get_property (GObject    *object,
+                                         guint       prop_id,
+                                         GValue     *value,
+                                         GParamSpec *pspec)
+{
+  IdeEnvironmentEditorRow *self = IDE_ENVIRONMENT_EDITOR_ROW (object);
+
+  switch (prop_id)
+    {
+    case PROP_VARIABLE:
+      g_value_set_object (value, ide_environment_editor_row_get_variable (self));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_environment_editor_row_set_property (GObject      *object,
+                                         guint         prop_id,
+                                         const GValue *value,
+                                         GParamSpec   *pspec)
+{
+  IdeEnvironmentEditorRow *self = IDE_ENVIRONMENT_EDITOR_ROW (object);
+
+  switch (prop_id)
+    {
+    case PROP_VARIABLE:
+      ide_environment_editor_row_set_variable (self, g_value_get_object (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_environment_editor_row_class_init (IdeEnvironmentEditorRowClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->get_property = ide_environment_editor_row_get_property;
+  object_class->set_property = ide_environment_editor_row_set_property;
+
+  widget_class->destroy = ide_environment_editor_row_destroy;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/ide-environment-editor-row.ui");
+  gtk_widget_class_bind_template_child (widget_class, IdeEnvironmentEditorRow, delete_button);
+  gtk_widget_class_bind_template_child (widget_class, IdeEnvironmentEditorRow, key_entry);
+  gtk_widget_class_bind_template_child (widget_class, IdeEnvironmentEditorRow, value_entry);
+
+  properties [PROP_VARIABLE] =
+    g_param_spec_object ("variable",
+                         "Variable",
+                         "Variable",
+                         IDE_TYPE_ENVIRONMENT_VARIABLE,
+                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, LAST_PROP, properties);
+
+  signals [DELETE] =
+    g_signal_new ("delete",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL, NULL, G_TYPE_NONE, 0);
+}
+
+static void
+ide_environment_editor_row_init (IdeEnvironmentEditorRow *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  g_signal_connect (self->delete_button,
+                    "clicked",
+                    G_CALLBACK (delete_button_clicked),
+                    self);
+
+  g_signal_connect (self->key_entry,
+                    "activate",
+                    G_CALLBACK (key_entry_activate),
+                    self);
+
+  g_signal_connect (self->value_entry,
+                    "activate",
+                    G_CALLBACK (value_entry_activate),
+                    self);
+}
+
+/**
+ * ide_environment_editor_row_get_variable:
+ *
+ * Returns: (transfer none) (nullable): An #IdeEnvironmentVariable.
+ */
+IdeEnvironmentVariable *
+ide_environment_editor_row_get_variable (IdeEnvironmentEditorRow *self)
+{
+  g_return_val_if_fail (IDE_IS_ENVIRONMENT_EDITOR_ROW (self), NULL);
+
+  return self->variable;
+}
+
+void
+ide_environment_editor_row_set_variable (IdeEnvironmentEditorRow *self,
+                                         IdeEnvironmentVariable  *variable)
+{
+  g_return_if_fail (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+  g_return_if_fail (!variable || IDE_IS_ENVIRONMENT_VARIABLE (variable));
+
+  if (variable != self->variable)
+    {
+      if (self->variable != NULL)
+        {
+          ide_environment_editor_row_disconnect (self);
+          g_clear_object (&self->variable);
+        }
+
+      if (variable != NULL)
+        {
+          self->variable = g_object_ref (variable);
+          ide_environment_editor_row_connect (self);
+        }
+
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_VARIABLE]);
+    }
+}
+
+void
+ide_environment_editor_row_start_editing (IdeEnvironmentEditorRow *self)
+{
+  g_return_if_fail (IDE_IS_ENVIRONMENT_EDITOR_ROW (self));
+
+  gtk_widget_grab_focus (GTK_WIDGET (self->key_entry));
+}
diff --git a/libide/ide-environment-editor-row.h b/libide/ide-environment-editor-row.h
new file mode 100644
index 0000000..309b042
--- /dev/null
+++ b/libide/ide-environment-editor-row.h
@@ -0,0 +1,39 @@
+/* ide-environment-editor-row.h
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_ENVIRONMENT_EDITOR_ROW_H
+#define IDE_ENVIRONMENT_EDITOR_ROW_H
+
+#include <gtk/gtk.h>
+
+#include "ide-environment-variable.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_ENVIRONMENT_EDITOR_ROW (ide_environment_editor_row_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeEnvironmentEditorRow, ide_environment_editor_row, IDE, ENVIRONMENT_EDITOR_ROW, 
GtkListBoxRow)
+
+IdeEnvironmentVariable *ide_environment_editor_row_get_variable  (IdeEnvironmentEditorRow *self);
+void                    ide_environment_editor_row_set_variable  (IdeEnvironmentEditorRow *self,
+                                                                  IdeEnvironmentVariable  *variable);
+void                    ide_environment_editor_row_start_editing (IdeEnvironmentEditorRow *self);
+
+G_END_DECLS
+
+#endif /* IDE_ENVIRONMENT_EDITOR_ROW_H */
diff --git a/libide/ide-environment-editor.c b/libide/ide-environment-editor.c
new file mode 100644
index 0000000..0128a83
--- /dev/null
+++ b/libide/ide-environment-editor.c
@@ -0,0 +1,311 @@
+/* ide-environment-editor.c
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n.h>
+
+#include "ide-environment-editor.h"
+#include "ide-environment-editor-row.h"
+
+struct _IdeEnvironmentEditor
+{
+  GtkListBox      parent_instance;
+  IdeEnvironment *environment;
+  GtkWidget      *dummy_row;
+
+  IdeEnvironmentVariable *dummy;
+};
+
+G_DEFINE_TYPE (IdeEnvironmentEditor, ide_environment_editor, GTK_TYPE_LIST_BOX)
+
+enum {
+  PROP_0,
+  PROP_ENVIRONMENT,
+  LAST_PROP
+};
+
+static GParamSpec *properties [LAST_PROP];
+
+static void
+ide_environment_editor_delete_row (IdeEnvironmentEditor    *self,
+                                   IdeEnvironmentEditorRow *row)
+{
+  IdeEnvironmentVariable *variable;
+
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR (self));
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR_ROW (row));
+
+  variable = ide_environment_editor_row_get_variable (row);
+  ide_environment_remove (self->environment, variable);
+}
+
+static GtkWidget *
+ide_environment_editor_create_dummy_row (IdeEnvironmentEditor *self)
+{
+  GtkWidget *row;
+  GtkWidget *label;
+
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR (self));
+
+  label = g_object_new (GTK_TYPE_LABEL,
+                        "label", _("New variable…"),
+                        "visible", TRUE,
+                        "xalign", 0.0f,
+                        NULL);
+  gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
+
+  row = g_object_new (GTK_TYPE_LIST_BOX_ROW,
+                      "child", label,
+                      "visible", TRUE,
+                      NULL);
+
+  return row;
+}
+
+static GtkWidget *
+ide_environment_editor_create_row (gpointer item,
+                                   gpointer user_data)
+{
+  IdeEnvironmentVariable *variable = item;
+  IdeEnvironmentEditor *self = user_data;
+  IdeEnvironmentEditorRow *row;
+
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR (self));
+  g_assert (IDE_IS_ENVIRONMENT_VARIABLE (variable));
+
+  row = g_object_new (IDE_TYPE_ENVIRONMENT_EDITOR_ROW,
+                      "variable", variable,
+                      "visible", TRUE,
+                      NULL);
+
+  g_signal_connect_object (row,
+                           "delete",
+                           G_CALLBACK (ide_environment_editor_delete_row),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  return GTK_WIDGET (row);
+}
+
+static void
+ide_environment_editor_disconnect (IdeEnvironmentEditor *self)
+{
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR (self));
+  g_assert (IDE_IS_ENVIRONMENT (self->environment));
+
+  gtk_list_box_bind_model (GTK_LIST_BOX (self), NULL, NULL, NULL, NULL);
+
+  g_clear_object (&self->dummy);
+}
+
+static void
+ide_environment_editor_connect (IdeEnvironmentEditor *self)
+{
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR (self));
+  g_assert (IDE_IS_ENVIRONMENT (self->environment));
+
+  gtk_list_box_bind_model (GTK_LIST_BOX (self),
+                           G_LIST_MODEL (self->environment),
+                           ide_environment_editor_create_row, self, NULL);
+
+  self->dummy_row = ide_environment_editor_create_dummy_row (self);
+  gtk_container_add (GTK_CONTAINER (self), self->dummy_row);
+}
+
+static void
+find_row_cb (GtkWidget *widget,
+             gpointer   data)
+{
+  struct {
+    IdeEnvironmentVariable  *variable;
+    IdeEnvironmentEditorRow *row;
+  } *lookup = data;
+
+  g_assert (lookup != NULL);
+  g_assert (GTK_IS_LIST_BOX_ROW (widget));
+
+  if (IDE_IS_ENVIRONMENT_EDITOR_ROW (widget))
+    {
+      IdeEnvironmentVariable *variable;
+
+      variable = ide_environment_editor_row_get_variable (IDE_ENVIRONMENT_EDITOR_ROW (widget));
+
+      if (variable == lookup->variable)
+        lookup->row = IDE_ENVIRONMENT_EDITOR_ROW (widget);
+    }
+}
+
+static IdeEnvironmentEditorRow *
+find_row (IdeEnvironmentEditor   *self,
+          IdeEnvironmentVariable *variable)
+{
+  struct {
+    IdeEnvironmentVariable  *variable;
+    IdeEnvironmentEditorRow *row;
+  } lookup = { variable, NULL };
+
+  g_assert (IDE_IS_ENVIRONMENT_EDITOR (self));
+  g_assert (IDE_IS_ENVIRONMENT_VARIABLE (variable));
+
+  gtk_container_foreach (GTK_CONTAINER (self), find_row_cb, &lookup);
+
+  return lookup.row;
+}
+
+static void
+ide_environment_editor_row_activated (GtkListBox    *list_box,
+                                      GtkListBoxRow *row)
+{
+  IdeEnvironmentEditor *self = (IdeEnvironmentEditor *)list_box;
+
+  g_assert (GTK_IS_LIST_BOX (list_box));
+  g_assert (GTK_IS_LIST_BOX_ROW (row));
+
+  if (self->environment == NULL)
+    return;
+
+  if (self->dummy_row == GTK_WIDGET (row))
+    {
+      g_autoptr(IdeEnvironmentVariable) variable = NULL;
+
+      variable = ide_environment_variable_new (NULL, NULL);
+      ide_environment_append (self->environment, variable);
+      ide_environment_editor_row_start_editing (find_row (self, variable));
+    }
+}
+
+static void
+ide_environment_editor_destroy (GtkWidget *widget)
+{
+  IdeEnvironmentEditor *self = (IdeEnvironmentEditor *)widget;
+
+  GTK_WIDGET_CLASS (ide_environment_editor_parent_class)->destroy (widget);
+
+  g_clear_object (&self->environment);
+}
+
+static void
+ide_environment_editor_get_property (GObject    *object,
+                                     guint       prop_id,
+                                     GValue     *value,
+                                     GParamSpec *pspec)
+{
+  IdeEnvironmentEditor *self = IDE_ENVIRONMENT_EDITOR(object);
+
+  switch (prop_id)
+    {
+    case PROP_ENVIRONMENT:
+      g_value_set_object (value, ide_environment_editor_get_environment (self));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    }
+}
+
+static void
+ide_environment_editor_set_property (GObject      *object,
+                                     guint         prop_id,
+                                     const GValue *value,
+                                     GParamSpec   *pspec)
+{
+  IdeEnvironmentEditor *self = IDE_ENVIRONMENT_EDITOR(object);
+
+  switch (prop_id)
+    {
+    case PROP_ENVIRONMENT:
+      ide_environment_editor_set_environment (self, g_value_get_object (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    }
+}
+
+static void
+ide_environment_editor_class_init (IdeEnvironmentEditorClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GtkListBoxClass *list_box_class = GTK_LIST_BOX_CLASS (klass);
+
+  object_class->get_property = ide_environment_editor_get_property;
+  object_class->set_property = ide_environment_editor_set_property;
+
+  widget_class->destroy = ide_environment_editor_destroy;
+
+  list_box_class->row_activated = ide_environment_editor_row_activated;
+
+  properties [PROP_ENVIRONMENT] =
+    g_param_spec_object ("environment",
+                         "Environment",
+                         "Environment",
+                         IDE_TYPE_ENVIRONMENT,
+                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, LAST_PROP, properties);
+}
+
+static void
+ide_environment_editor_init (IdeEnvironmentEditor *self)
+{
+  gtk_list_box_set_selection_mode (GTK_LIST_BOX (self), GTK_SELECTION_NONE);
+}
+
+GtkWidget *
+ide_environment_editor_new (void)
+{
+  return g_object_new (IDE_TYPE_ENVIRONMENT_EDITOR, NULL);
+}
+
+void
+ide_environment_editor_set_environment (IdeEnvironmentEditor *self,
+                                        IdeEnvironment       *environment)
+{
+  g_return_if_fail (IDE_IS_ENVIRONMENT_EDITOR (self));
+  g_return_if_fail (IDE_IS_ENVIRONMENT (environment));
+
+  if (self->environment != environment)
+    {
+      if (self->environment != NULL)
+        {
+          ide_environment_editor_disconnect (self);
+          g_clear_object (&self->environment);
+        }
+
+      if (environment != NULL)
+        {
+          self->environment = g_object_ref (environment);
+          ide_environment_editor_connect (self);
+        }
+
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ENVIRONMENT]);
+    }
+}
+
+/**
+ * ide_environment_editor_get_environment:
+ *
+ * Returns: (nullable) (transfer none): An #IdeEnvironment or %NULL.
+ */
+IdeEnvironment *
+ide_environment_editor_get_environment (IdeEnvironmentEditor *self)
+{
+  g_return_val_if_fail (IDE_IS_ENVIRONMENT_EDITOR (self), NULL);
+
+  return self->environment;
+}
diff --git a/libide/ide-environment-editor.h b/libide/ide-environment-editor.h
new file mode 100644
index 0000000..5862bed
--- /dev/null
+++ b/libide/ide-environment-editor.h
@@ -0,0 +1,39 @@
+/* ide-environment-editor.h
+ *
+ * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_ENVIRONMENT_EDITOR_H
+#define IDE_ENVIRONMENT_EDITOR_H
+
+#include <gtk/gtk.h>
+
+#include "ide-environment.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_ENVIRONMENT_EDITOR (ide_environment_editor_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeEnvironmentEditor, ide_environment_editor, IDE, ENVIRONMENT_EDITOR, GtkListBox)
+
+GtkWidget      *ide_environment_editor_new             (void);
+IdeEnvironment *ide_environment_editor_get_environment (IdeEnvironmentEditor *self);
+void            ide_environment_editor_set_environment (IdeEnvironmentEditor *self,
+                                                        IdeEnvironment       *environment);
+
+G_END_DECLS
+
+#endif /* IDE_ENVIRONMENT_EDITOR_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]