[glide] Theme chooser is functional again



commit 6128982739f423eb85ec87e588313bd1860ef01d
Author: Robert Carr <racarr Valentine localdomain>
Date:   Sat Jun 5 18:27:04 2010 -0400

    Theme chooser is functional again

 libglide/glide-theme-chooser.c |   55 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 52 insertions(+), 3 deletions(-)
---
diff --git a/libglide/glide-theme-chooser.c b/libglide/glide-theme-chooser.c
index 6191780..f793f4f 100644
--- a/libglide/glide-theme-chooser.c
+++ b/libglide/glide-theme-chooser.c
@@ -51,6 +51,18 @@ enum {
 
 static guint theme_chooser_signals[LAST_SIGNAL] = { 0, };
 
+static GlideTheme *
+glide_theme_chooser_get_selection (GlideThemeChooser *chooser)
+{
+  GlideThemePreviewActor *prev;
+
+  if (!chooser->priv->selection)
+    return NULL;
+  
+  prev = GLIDE_THEME_PREVIEW_ACTOR (chooser->priv->selection);
+  return glide_theme_preview_actor_get_theme (prev);
+}
+
 static void
 glide_theme_chooser_finalize (GObject *object)
 {
@@ -145,6 +157,13 @@ glide_theme_chooser_populate_theme_box (GlideThemeChooser *chooser)
       glide_theme_preview_actor_set_theme (GLIDE_THEME_PREVIEW_ACTOR (preview),
 					   theme);
       
+      if (!chooser->priv->selection)
+	{
+	  chooser->priv->selection = preview;
+	  glide_theme_preview_actor_set_selected (GLIDE_THEME_PREVIEW_ACTOR (preview),
+						  TRUE);
+	}
+      
       clutter_box_pack (CLUTTER_BOX (chooser->priv->theme_box), preview, NULL);
     }
 }
@@ -247,17 +266,47 @@ glide_theme_chooser_make_top_hbox (GlideThemeChooser *chooser)
   return ret;  
 }
 
+static void
+glide_theme_chooser_new_clicked (GtkWidget *button,
+				 gpointer user_data)
+{
+  GlideThemeChooser *chooser = (GlideThemeChooser *)user_data;
+  GlideTheme *theme = glide_theme_chooser_get_selection (chooser);
+
+  chooser->priv->theme = theme;
+  g_object_notify (G_OBJECT (chooser), "theme");
+
+  g_signal_emit (chooser, theme_chooser_signals[RESPONSE], 0);
+}
+
+static void
+glide_theme_chooser_cancel_clicked (GtkWidget *button,
+				    gpointer user_data)
+{
+  GlideThemeChooser *chooser = (GlideThemeChooser *)user_data;
+
+  chooser->priv->theme = NULL;
+  g_object_notify (G_OBJECT (chooser), "theme");
+
+  g_signal_emit (chooser, theme_chooser_signals[RESPONSE], 0);
+}
+
 static GtkWidget *
 glide_theme_chooser_make_bottom_hbox (GlideThemeChooser *chooser)
 {
   GtkWidget *ret = gtk_hbox_new (FALSE, 0);
   GtkWidget *new, *cancel;
   
-  new = gtk_button_new_with_label ("New");
+  new = gtk_button_new_with_label ("New Presentation");
   cancel = gtk_button_new_with_label ("Cancel");
-  
-  gtk_box_pack_start (GTK_BOX (ret), cancel, FALSE, 0, 0);
+
+  g_signal_connect (new, "clicked",
+		    G_CALLBACK (glide_theme_chooser_new_clicked), chooser);
+  g_signal_connect (cancel, "clicked",
+		    G_CALLBACK (glide_theme_chooser_cancel_clicked), chooser);
+
   gtk_box_pack_start (GTK_BOX (ret), new, FALSE, 0, 0);
+  gtk_box_pack_start (GTK_BOX (ret), cancel, FALSE, 0, 0);
   
   return ret;
 }



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