[glide] Start implementing some name stuff



commit 5beb6b66ad30dc7d5b2d12fae9e5673d0966634c
Author: Robert Carr <racarr Valentine localdomain>
Date:   Sat May 1 22:21:27 2010 -0400

    Start implementing some name stuff

 src/glide-inspector-actor-priv.h |    2 +
 src/glide-inspector-actor.c      |   61 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/src/glide-inspector-actor-priv.h b/src/glide-inspector-actor-priv.h
index 6fd7747..104fb99 100644
--- a/src/glide-inspector-actor-priv.h
+++ b/src/glide-inspector-actor-priv.h
@@ -27,6 +27,8 @@ G_BEGIN_DECLS
 struct _GlideInspectorActorPrivate
 {
   GlideActor *actor;
+  
+  GtkWidget *name_entry;
 };
 
 G_END_DECLS
diff --git a/src/glide-inspector-actor.c b/src/glide-inspector-actor.c
index 315ba57..baae1e4 100644
--- a/src/glide-inspector-actor.c
+++ b/src/glide-inspector-actor.c
@@ -19,6 +19,8 @@
 #include "glide-inspector-actor.h"
 #include "glide-inspector-actor-priv.h"
 
+#include "glide-slide.h"
+
 #include <string.h>
 
 #define GLIDE_INSPECTOR_ACTOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GLIDE_TYPE_INSPECTOR_ACTOR, GlideInspectorActorPrivate))
@@ -31,6 +33,22 @@ enum {
 };
 
 static void
+glide_inspector_actor_update_name (GlideInspectorActor *ins)
+{
+  gtk_entry_set_text (GTK_ENTRY (ins->priv->name_entry), clutter_actor_get_name (CLUTTER_ACTOR (ins->priv->actor)));
+}
+
+static void
+glide_inspector_actor_name_entry_changed (GtkEntry *entry,
+					  gpointer user_data)
+{
+  GlideInspectorActor *ins = (GlideInspectorActor *)user_data;
+  
+  clutter_actor_set_name (CLUTTER_ACTOR (ins->priv->actor),
+			  gtk_entry_get_text (entry));
+}
+
+static void
 glide_inspector_actor_finalize (GObject *object)
 {
   
@@ -74,12 +92,45 @@ glide_inspector_actor_set_property (GObject *object,
     }
 }
 
+static GtkWidget *
+glide_inspector_actor_make_name_box (GlideInspectorActor *ins)
+{
+  GtkWidget *ret = gtk_hbox_new (FALSE, 10);
+  GtkWidget *name_label = gtk_label_new (NULL);
+  GtkWidget *align = gtk_alignment_new (0, 0, 0.9, 1);
+  
+  ins->priv->name_entry = gtk_entry_new ();
+  gtk_label_set_markup (GTK_LABEL (name_label), "<b>Name:</b>");
+  gtk_container_add (GTK_CONTAINER (align), ins->priv->name_entry);
+  
+  gtk_box_pack_start (GTK_BOX (ret), name_label, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (ret), align, TRUE, TRUE, 0);
+  
+  g_signal_connect (ins->priv->name_entry, "changed",
+		    G_CALLBACK (glide_inspector_actor_name_entry_changed),
+		    ins);
+  
+  return ret;
+}
+
+static void
+glide_inspector_actor_setup_ui (GlideInspectorActor *ins)
+{
+  GtkWidget *vbox = gtk_vbox_new (FALSE, 2);
+  GtkWidget *name_box = glide_inspector_actor_make_name_box (ins);
+  
+  gtk_box_pack_start (GTK_BOX (vbox), name_box, FALSE, FALSE, 0);
+  
+  gtk_container_add (GTK_CONTAINER (ins), vbox);
+}
+
 static void
 glide_inspector_actor_init (GlideInspectorActor *inspector)
 {
   inspector->priv = GLIDE_INSPECTOR_ACTOR_GET_PRIVATE (inspector);
   
   gtk_widget_set_sensitive (GTK_WIDGET (inspector), FALSE);
+  glide_inspector_actor_setup_ui (inspector);
 
   gtk_alignment_set (GTK_ALIGNMENT (inspector), .5, 0, 0.8, 1.0);
 }
@@ -123,5 +174,15 @@ glide_inspector_actor_set_actor (GlideInspectorActor *inspector,
 {
   inspector->priv->actor = actor;
   
+  if (GLIDE_IS_SLIDE (actor))
+    {
+      gtk_widget_set_sensitive (GTK_WIDGET (inspector), FALSE);
+    }
+  else
+    {
+      gtk_widget_set_sensitive (GTK_WIDGET (inspector), TRUE);
+      glide_inspector_actor_update_name (inspector);
+    }
+  
   g_object_notify (G_OBJECT (inspector), "actor");
 }



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