]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Move throbber to libplybootsplash
authorRay Strode <rstrode@redhat.com>
Thu, 12 Jun 2008 21:29:16 +0000 (17:29 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 12 Jun 2008 21:32:02 +0000 (17:32 -0400)
src/libplybootsplash/Makefile.am
src/libplybootsplash/ply-throbber.c [moved from src/splash-plugins/spinfinity/throbber.c with 88% similarity]
src/libplybootsplash/ply-throbber.h [moved from src/splash-plugins/spinfinity/throbber.h with 62% similarity]
src/splash-plugins/spinfinity/Makefile.am
src/splash-plugins/spinfinity/plugin.c

index 7e59c9b962e8ced85a57cc8461dc3b23d0780ec8..b2f4a3d2e7f39de8577e7c7063f2c47ef2776c6a 100644 (file)
@@ -5,9 +5,10 @@ INCLUDES = -I$(top_srcdir)                                                    \
 lib_LTLIBRARIES = libplybootsplash.la
 
 libplybootsplashdir = $(includedir)/plymouth-1/plybootsplash
-libplybootsplash_HEADERS = ply-answer.h ply-window.h ply-boot-splash-plugin.h
+libplybootsplash_HEADERS = ply-answer.h ply-throbber.h ply-window.h ply-boot-splash-plugin.h
 
-libplybootsplash_la_CFLAGS = $(PLYMOUTH_CFLAGS)
+libplybootsplash_la_CFLAGS = $(PLYMOUTH_CFLAGS)                               \
+                             -DPLYMOUTH_BACKGROUND_COLOR=$(background_color)
 libplybootsplash_la_LIBADD = $(PLYMOUTH_LIBS) ../libply/libply.la
 libplybootsplash_la_LDFLAGS = -export-symbols-regex '^[^_].*' \
                    -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
@@ -15,6 +16,7 @@ libplybootsplash_la_LDFLAGS = -export-symbols-regex '^[^_].*' \
 libplybootsplash_la_SOURCES = \
                    $(libplybootsplash_HEADERS)                              \
                    ply-answer.c                                             \
+                   ply-throbber.c                                           \
                    ply-window.c
 
 MAINTAINERCLEANFILES = Makefile.in
similarity index 88%
rename from src/splash-plugins/spinfinity/throbber.c
rename to src/libplybootsplash/ply-throbber.c
index 998f229e70d6a6ab38b63e1d978e2048f609c518..2b3ebbad7e7489a2a641b5fc80e090b721481025 100644 (file)
@@ -40,7 +40,7 @@
 #include <unistd.h>
 #include <wchar.h>
 
-#include "throbber.h"
+#include "ply-throbber.h"
 #include "ply-event-loop.h"
 #include "ply-array.h"
 #include "ply-logger.h"
@@ -55,7 +55,7 @@
 #define FRAMES_PER_SECOND 30
 #endif
 
-struct _throbber
+struct _ply_throbber
 {
   ply_array_t *frames;
   ply_event_loop_t *loop;
@@ -71,16 +71,16 @@ struct _throbber
   double start_time, now;
 };
 
-throbber_t *
-throbber_new (const char *image_dir,
+ply_throbber_t *
+ply_throbber_new (const char *image_dir,
               const char *frames_prefix)
 {
-  throbber_t *throbber;
+  ply_throbber_t *throbber;
 
   assert (image_dir != NULL);
   assert (frames_prefix != NULL);
 
-  throbber = calloc (1, sizeof (throbber_t));
+  throbber = calloc (1, sizeof (ply_throbber_t));
 
   throbber->frames = ply_array_new ();
   throbber->frames_prefix = strdup (frames_prefix);
@@ -96,7 +96,7 @@ throbber_new (const char *image_dir,
 }
 
 static void
-throbber_remove_frames (throbber_t *throbber)
+ply_throbber_remove_frames (ply_throbber_t *throbber)
 {
   int i;
   ply_image_t **frames;
@@ -108,12 +108,12 @@ throbber_remove_frames (throbber_t *throbber)
 }
 
 void
-throbber_free (throbber_t *throbber)
+ply_throbber_free (ply_throbber_t *throbber)
 {
   if (throbber == NULL)
     return;
 
-  throbber_remove_frames (throbber);
+  ply_throbber_remove_frames (throbber);
   ply_array_free (throbber->frames);
 
   free (throbber->frames_prefix);
@@ -122,7 +122,7 @@ throbber_free (throbber_t *throbber)
 }
 
 static void
-animate_at_time (throbber_t *throbber,
+animate_at_time (ply_throbber_t *throbber,
                  double      time)
 {
   int number_of_frames;
@@ -159,7 +159,7 @@ animate_at_time (throbber_t *throbber,
 }
 
 static void
-on_timeout (throbber_t *throbber)
+on_timeout (ply_throbber_t *throbber)
 {
   double sleep_time;
   throbber->now = ply_get_timestamp ();
@@ -184,7 +184,7 @@ on_timeout (throbber_t *throbber)
 }
 
 static bool
-throbber_add_frame (throbber_t *throbber,
+ply_throbber_add_frame (ply_throbber_t *throbber,
                     const char *filename)
 {
   ply_image_t *image;
@@ -206,7 +206,7 @@ throbber_add_frame (throbber_t *throbber,
 }
 
 static bool
-throbber_add_frames (throbber_t *throbber)
+ply_throbber_add_frames (ply_throbber_t *throbber)
 {
   struct dirent **entries;
   int number_of_entries;
@@ -234,7 +234,7 @@ throbber_add_frames (throbber_t *throbber)
           filename = NULL;
           asprintf (&filename, "%s/%s", throbber->image_dir, entries[i]->d_name);
 
-          if (!throbber_add_frame (throbber, filename))
+          if (!ply_throbber_add_frame (throbber, filename))
             goto out;
 
           free (filename);
@@ -248,7 +248,7 @@ throbber_add_frames (throbber_t *throbber)
 out:
   if (!load_finished)
     {
-      throbber_remove_frames (throbber);
+      ply_throbber_remove_frames (throbber);
 
       while (entries[i] != NULL)
         {
@@ -262,19 +262,19 @@ out:
 }
 
 bool
-throbber_load (throbber_t *throbber)
+ply_throbber_load (ply_throbber_t *throbber)
 {
   if (ply_array_get_size (throbber->frames) != 0)
-    throbber_remove_frames (throbber->frames);
+    ply_throbber_remove_frames (throbber->frames);
 
-  if (!throbber_add_frames (throbber))
+  if (!ply_throbber_add_frames (throbber))
     return false;
 
   return true;
 }
 
 bool
-throbber_start (throbber_t         *throbber,
+ply_throbber_start (ply_throbber_t         *throbber,
                 ply_event_loop_t   *loop,
                 ply_window_t       *window,
                 long                x,
@@ -301,7 +301,7 @@ throbber_start (throbber_t         *throbber,
 }
 
 void
-throbber_stop (throbber_t *throbber)
+ply_throbber_stop (ply_throbber_t *throbber)
 {
   if (throbber->frame_area.width > 0)
     ply_frame_buffer_fill_with_hex_color (throbber->frame_buffer, &throbber->frame_area,
@@ -319,13 +319,13 @@ throbber_stop (throbber_t *throbber)
 }
 
 long
-throbber_get_width (throbber_t *throbber)
+ply_throbber_get_width (ply_throbber_t *throbber)
 {
   return throbber->width;
 }
 
 long
-throbber_get_height (throbber_t *throbber)
+ply_throbber_get_height (ply_throbber_t *throbber)
 {
   return throbber->height;
 }
similarity index 62%
rename from src/splash-plugins/spinfinity/throbber.h
rename to src/libplybootsplash/ply-throbber.h
index c1e7b1a565d76ba08ed1f1f5e834db80b4fa7876..21ff17eebc4d43f07c9ea431c0f34b462c4ac0a4 100644 (file)
 #include "ply-frame-buffer.h"
 #include "ply-window.h"
 
-typedef struct _throbber throbber_t;
+typedef struct _ply_throbber ply_throbber_t;
 
 #ifndef PLY_HIDE_FUNCTION_DECLARATIONS
-throbber_t *throbber_new (const char *image_dir,
-                          const char *frames_prefix);
-void throbber_free (throbber_t *throbber);
+ply_throbber_t *ply_throbber_new (const char *image_dir,
+                                  const char *frames_prefix);
+void ply_throbber_free (ply_throbber_t *throbber);
 
-bool throbber_load (throbber_t *throbber);
-bool throbber_start (throbber_t         *throbber,
-                     ply_event_loop_t   *loop,
-                     ply_window_t       *window,
-                     long                x,
-                     long                y);
-void throbber_stop (throbber_t *throbber);
+bool ply_throbber_load (ply_throbber_t *throbber);
+bool ply_throbber_start (ply_throbber_t         *throbber,
+                         ply_event_loop_t   *loop,
+                         ply_window_t       *window,
+                         long                x,
+                         long                y);
+void ply_throbber_stop (ply_throbber_t *throbber);
 
-long throbber_get_width (throbber_t *throbber);
-long throbber_get_height (throbber_t *throbber);
+long ply_throbber_get_width (ply_throbber_t *throbber);
+long ply_throbber_get_height (ply_throbber_t *throbber);
 #endif
 
 #endif /* THROBBER_H */
index 8a2280406a7d77b87459ee214f3ff0b30107fec1..485b19f2b85337170ae512bf69b81c52f5fe8da7 100644 (file)
@@ -17,9 +17,7 @@ spinfinity_la_LDFLAGS = -module -avoid-version -export-dynamic
 spinfinity_la_LIBADD = $(PLYMOUTH_LIBS)                                      \
                        ../../libply/libply.la                                \
                        ../../libplybootsplash/libplybootsplash.la
-spinfinity_la_SOURCES = $(srcdir)/plugin.c                                   \
-                        $(srcdir)/throbber.h                                 \
-                        $(srcdir)/throbber.c
+spinfinity_la_SOURCES = $(srcdir)/plugin.c
 
 throbber_frames =                                                            \
                     throbber-00.png                                          \
index 07f9ffd2bfed7a6788da9a72e075522be88211e8..8b95c0e150eeb336aaaf51b027725ed73cb71d79 100644 (file)
@@ -50,7 +50,7 @@
 #include "ply-utils.h"
 #include "ply-window.h"
 
-#include "throbber.h"
+#include "ply-throbber.h"
 
 #include <linux/kd.h>
 
@@ -77,7 +77,7 @@ struct _ply_boot_splash_plugin
   ply_window_t *window;
 
   entry_t *entry;
-  throbber_t *throbber;
+  ply_throbber_t *throbber;
 
   ply_answer_t *pending_password_answer;
 };
@@ -99,7 +99,7 @@ create_plugin (void)
   plugin->entry_image = ply_image_new (PLYMOUTH_IMAGE_DIR "spinfinity/entry.png");
   plugin->box_image = ply_image_new (PLYMOUTH_IMAGE_DIR "spinfinity/box.png");
 
-  plugin->throbber = throbber_new (PLYMOUTH_IMAGE_DIR "spinfinity",
+  plugin->throbber = ply_throbber_new (PLYMOUTH_IMAGE_DIR "spinfinity",
                                    "throbber-");
 
   return plugin;
@@ -140,7 +140,7 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
   ply_image_free (plugin->entry_image);
   ply_image_free (plugin->box_image);
   ply_image_free (plugin->lock_image);
-  throbber_free (plugin->throbber);
+  ply_throbber_free (plugin->throbber);
   free (plugin);
 }
 
@@ -189,9 +189,9 @@ start_animation (ply_boot_splash_plugin_t *plugin)
 
   ply_frame_buffer_get_size (plugin->frame_buffer, &area);
 
-  width = throbber_get_width (plugin->throbber);
-  height = throbber_get_height (plugin->throbber);
-  throbber_start (plugin->throbber,
+  width = ply_throbber_get_width (plugin->throbber);
+  height = ply_throbber_get_height (plugin->throbber);
+  ply_throbber_start (plugin->throbber,
                   plugin->loop,
                   plugin->window,
                   area.width / 2.0 - width / 2.0,
@@ -206,7 +206,7 @@ stop_animation (ply_boot_splash_plugin_t *plugin)
   assert (plugin != NULL);
   assert (plugin->loop != NULL);
 
-  throbber_stop (plugin->throbber);
+  ply_throbber_stop (plugin->throbber);
 
   for (i = 0; i < 10; i++)
     {
@@ -325,7 +325,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
     return false;
 
   ply_trace ("loading throbber");
-  if (!throbber_load (plugin->throbber))
+  if (!ply_throbber_load (plugin->throbber))
     return false;
 
   plugin->window = window;