]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/samples/layout/gnomelayout.cpp
ICU-6.2.10.tar.gz
[apple/icu.git] / icuSources / samples / layout / gnomelayout.cpp
index ab1dba3757f312b94d72359872cfec7501f2cbb3..75edb50d879c0f0084f86308601377fcba349de4 100644 (file)
@@ -225,57 +225,48 @@ gint eventExpose(GtkWidget *widget, GdkEvent *event, Context *context)
 
 GtkWidget *newSample(const gchar *fileName)
 {
-  gchar     *title   = NULL;
-  GtkWidget *app     = NULL;
-  GtkWidget *area    = NULL;
   Context   *context = new Context();
 
   context->width  = 600;
   context->height = 400;
   context->paragraph = Paragraph::paragraphFactory(fileName, font, guiSupport);
 
-  if (context->paragraph != NULL) {
-    GtkStyle *style;
-    gchar *title = prettyTitle(fileName);
+  gchar *title = prettyTitle(fileName);
+  GtkWidget *app = gnome_app_new("gnomeLayout", title);
 
-    app = gnome_app_new("gnomeLayout", title);
+  gtk_object_set_data(GTK_OBJECT(app), "context", context);
 
-    gtk_object_set_data(GTK_OBJECT(app), "context", context);
+  gtk_window_set_default_size(GTK_WINDOW(app), 600 - 24, 400);
 
-    gtk_window_set_default_size(GTK_WINDOW(app), 600 - 24, 400);
+  gnome_app_create_menus_with_data(GNOME_APP(app), mainMenu, app);
 
-    gnome_app_create_menus_with_data(GNOME_APP(app), mainMenu, app);
+  gtk_signal_connect(GTK_OBJECT(app), "delete_event",
+                    GTK_SIGNAL_FUNC(eventDelete), NULL);
 
-    gtk_signal_connect(GTK_OBJECT(app), "delete_event",
-                      GTK_SIGNAL_FUNC(eventDelete), NULL);
+  GtkWidget *area = gtk_drawing_area_new();
+  gtk_object_set_data(GTK_OBJECT(app), "area", area);
 
-    area = gtk_drawing_area_new();
-    gtk_object_set_data(GTK_OBJECT(app), "area", area);
+  GtkStyle *style = gtk_style_copy(gtk_widget_get_style(area));
 
-#if 1
-    style = gtk_style_copy(gtk_widget_get_style(area));
-
-    for (int i = 0; i < 5; i += 1) {
-      style->fg[i] = style->white;
-    }
+  for (int i = 0; i < 5; i += 1) {
+    style->fg[i] = style->white;
+  }
     
-    gtk_widget_set_style(area, style);
-#endif
+  gtk_widget_set_style(area, style);
 
-    gnome_app_set_contents(GNOME_APP(app), area);
+  gnome_app_set_contents(GNOME_APP(app), area);
 
-    gtk_signal_connect(GTK_OBJECT(area),
-                       "expose_event",
-                       GTK_SIGNAL_FUNC(eventExpose),
-                       context);
+  gtk_signal_connect(GTK_OBJECT(area),
+                    "expose_event",
+                    GTK_SIGNAL_FUNC(eventExpose),
+                    context);
 
-    gtk_signal_connect(GTK_OBJECT(area),
-                       "configure_event",
-                       GTK_SIGNAL_FUNC(eventConfigure),
-                       context);
+  gtk_signal_connect(GTK_OBJECT(area),
+                    "configure_event",
+                    GTK_SIGNAL_FUNC(eventConfigure),
+                    context);
 
-    appList = g_slist_prepend(appList, app);
-  }
+  appList = g_slist_prepend(appList, app);
 
   g_free(title);
 
@@ -321,10 +312,12 @@ int main (int argc, char *argv[])
 
     if (argc <= 1) {
       app = newSample("Sample.txt");
+
       gtk_widget_show_all(app);
     } else {
       for (int i = 1; i < argc; i += 1) {
        app = newSample(argv[i]);
+
        gtk_widget_show_all(app);
       }
     }