From 80fc684dd854542752ad8f87a15879af9536dfc3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 1 Feb 2013 18:56:10 +0100 Subject: [PATCH] gtk-demo: Remove file lists from demo data We can get it from parsing resources now, so no need to manually add them. --- demos/gtk-demo/application.c | 2 +- demos/gtk-demo/builder.c | 2 +- demos/gtk-demo/css_accordion.c | 2 +- demos/gtk-demo/css_basics.c | 2 +- demos/gtk-demo/css_multiplebgs.c | 2 +- demos/gtk-demo/main.c | 21 ++++++++------------- demos/gtk-demo/theming_custom_css.c | 2 +- demos/gtk-demo/theming_style_classes.c | 2 +- 8 files changed, 15 insertions(+), 20 deletions(-) diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c index 412fc01164..31b1da09c6 100644 --- a/demos/gtk-demo/application.c +++ b/demos/gtk-demo/application.c @@ -1,4 +1,4 @@ -/* Application class :: menus.ui application.ui +/* Application class * * Demonstrates a simple application. * diff --git a/demos/gtk-demo/builder.c b/demos/gtk-demo/builder.c index 7aeff37c5d..e7c31ccab0 100644 --- a/demos/gtk-demo/builder.c +++ b/demos/gtk-demo/builder.c @@ -1,4 +1,4 @@ -/* Builder :: demo.ui +/* Builder * * Demonstrates an interface loaded from a XML description. */ diff --git a/demos/gtk-demo/css_accordion.c b/demos/gtk-demo/css_accordion.c index 73e4376668..df5e14b9a3 100644 --- a/demos/gtk-demo/css_accordion.c +++ b/demos/gtk-demo/css_accordion.c @@ -1,4 +1,4 @@ -/* CSS Theming/CSS Accordion :: css_accordion.css +/* CSS Theming/CSS Accordion * * A simple accordion demo written using CSS transitions and multiple backgrounds * diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c index ad030721af..04c4ee3b90 100644 --- a/demos/gtk-demo/css_basics.c +++ b/demos/gtk-demo/css_basics.c @@ -1,4 +1,4 @@ -/* CSS Theming/CSS Basics :: css_basics.css +/* CSS Theming/CSS Basics * * Gtk themes are written using CSS. Every widget is build of multiple items * that you can style very similarly to a regular website. diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c index 580decba4c..bb12a236c3 100644 --- a/demos/gtk-demo/css_multiplebgs.c +++ b/demos/gtk-demo/css_multiplebgs.c @@ -1,4 +1,4 @@ -/* CSS Theming/Multiple Backgrounds :: css_multiplebgs.css +/* CSS Theming/Multiple Backgrounds * * Gtk themes are written using CSS. Every widget is build of multiple items * that you can style very similarly to a regular website. diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index ff5489150d..fe0260b606 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -481,21 +481,19 @@ load_file (const gchar *demoname, GError *err = NULL; int state = 0; gboolean in_para = 0; - gchar **names, **lines; + gchar **lines; GBytes *bytes; gint i; - remove_data_tabs (); + if (!g_strcmp0 (current_file, filename)) + return; - names = g_strsplit (filename, " ", -1); + remove_data_tabs (); add_data_tab (demoname); - if (current_file && !strcmp (current_file, names[0])) - goto out; - g_free (current_file); - current_file = g_strdup (names[0]); + current_file = g_strdup (filename); gtk_text_buffer_get_bounds (info_buffer, &start, &end); gtk_text_buffer_delete (info_buffer, &start, &end); @@ -503,15 +501,15 @@ load_file (const gchar *demoname, gtk_text_buffer_get_bounds (source_buffer, &start, &end); gtk_text_buffer_delete (source_buffer, &start, &end); - resource_filename = g_strconcat ("/sources/", names[0], NULL); + resource_filename = g_strconcat ("/sources/", filename, NULL); bytes = g_resources_lookup_data (resource_filename, 0, &err); g_free (resource_filename); if (bytes == NULL) { - g_warning ("Cannot open source for %s: %s\n", names[0], err->message); + g_warning ("Cannot open source for %s: %s\n", filename, err->message); g_error_free (err); - goto out; + return; } lines = g_strsplit (g_bytes_get_data (bytes, NULL), "\n", -1); @@ -634,9 +632,6 @@ load_file (const gchar *demoname, fontify (); g_strfreev (lines); - -out: - g_strfreev (names); } void diff --git a/demos/gtk-demo/theming_custom_css.c b/demos/gtk-demo/theming_custom_css.c index fb557eb12b..8a8e25ed58 100644 --- a/demos/gtk-demo/theming_custom_css.c +++ b/demos/gtk-demo/theming_custom_css.c @@ -1,4 +1,4 @@ -/* CSS Theming/Custom CSS :: fancy.css +/* CSS Theming/Custom CSS * * GTK+ uses CSS for theming. If required, applications can * install their own custom CSS style provider to achieve diff --git a/demos/gtk-demo/theming_style_classes.c b/demos/gtk-demo/theming_style_classes.c index 0dc2dda00a..fa9cded39a 100644 --- a/demos/gtk-demo/theming_style_classes.c +++ b/demos/gtk-demo/theming_style_classes.c @@ -1,4 +1,4 @@ -/* CSS Theming/Style Classes :: theming.ui +/* CSS Theming/Style Classes * * GTK+ uses CSS for theming. Style classes can be associated * with widgets to inform the theme about intended rendering.