[glide] Start to make theme chooser work



commit b01010237e31f3945067d1b53017af5571f94121
Author: Robert Carr <racarr Valentine localdomain>
Date:   Wed May 26 22:28:35 2010 -0400

    Start to make theme chooser work

 libglide/glide-theme-chooser.c |   23 +++++++++++++++++++++++
 libglide/glide-window.c        |   27 ++++++++++++++++++++++-----
 2 files changed, 45 insertions(+), 5 deletions(-)
---
diff --git a/libglide/glide-theme-chooser.c b/libglide/glide-theme-chooser.c
index 048cc28..d401459 100644
--- a/libglide/glide-theme-chooser.c
+++ b/libglide/glide-theme-chooser.c
@@ -194,6 +194,24 @@ 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 *
@@ -205,6 +223,11 @@ glide_theme_chooser_make_bottom_hbox (GlideThemeChooser *chooser)
   new = gtk_button_new_with_label ("New");
   cancel = gtk_button_new_with_label ("Cancel");
   
+  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), cancel, FALSE, 0, 0);
   gtk_box_pack_start (GTK_BOX (ret), new, FALSE, 0, 0);
   
diff --git a/libglide/glide-window.c b/libglide/glide-window.c
index 017f0f2..d36ba8e 100644
--- a/libglide/glide-window.c
+++ b/libglide/glide-window.c
@@ -428,19 +428,36 @@ glide_window_open_document (GlideWindow *window,
 }
 
 static void
+glide_window_theme_chooser_response (GlideThemeChooser *chooser,
+				     gpointer user_data)
+{
+  GlideWindow *w = (GlideWindow *)user_data;
+  GlideTheme *t = glide_theme_chooser_get_theme (chooser);
+
+  glide_document_set_theme (w->priv->document, t);
+  
+  // a little hacky.
+  glide_slide_set_background (glide_document_get_nth_slide (w->priv->document, 0), glide_theme_get_default_background (glide_document_get_theme (w->priv->document)));
+  
+  gtk_window_set_title (GTK_WINDOW (w), "Glide - (New Document)");  
+  
+}
+
+static void
 glide_window_new_document_real (GlideWindow *w)
 {
+  GtkWidget *chooser = glide_theme_chooser_new ();
   GlideDocument *d = glide_document_new ("New Document...");
   GlideSlide *s;
-  GtkWidget *chooser = glide_theme_chooser_new ();
 
   gtk_widget_show_all (chooser);
+  g_signal_connect (chooser, "response", G_CALLBACK (glide_window_theme_chooser_response), w);
+  
+  glide_window_set_document (w, d);
+
+  s = glide_document_append_slide (w->priv->document);
 
   glide_window_set_document (w, d);
-  s = glide_document_append_slide (d);
-  glide_slide_set_background (s, glide_theme_get_default_background (glide_document_get_theme (w->priv->document)));
-  
-  gtk_window_set_title (GTK_WINDOW (w), "Glide - (New Document)");
 }
 
 static void



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