[gimp/wip/animation: 232/373] plug-ins: minor code cleanup of animation-play.



commit f0017dd4af5957665ee97875f140b6291b5ceb84
Author: Jehan <jehan girinstud io>
Date:   Tue May 31 18:52:09 2016 +0200

    plug-ins: minor code cleanup of animation-play.

 plug-ins/animation-play/animation-play.c           |   30 ++++++++++---------
 plug-ins/animation-play/core/animation.c           |    2 +-
 plug-ins/animation-play/widgets/animation-dialog.c |   23 ++++----------
 3 files changed, 24 insertions(+), 31 deletions(-)
---
diff --git a/plug-ins/animation-play/animation-play.c b/plug-ins/animation-play/animation-play.c
index af76930..e889f6c 100644
--- a/plug-ins/animation-play/animation-play.c
+++ b/plug-ins/animation-play/animation-play.c
@@ -33,12 +33,12 @@
 
 #include "animation-utils.h"
 
-static void        query                     (void);
-static void        run                       (const gchar      *name,
-                                              gint              nparams,
-                                              const GimpParam  *param,
-                                              gint             *nreturn_vals,
-                                              GimpParam       **return_vals);
+static void query (void);
+static void run   (const gchar      *name,
+                   gint              nparams,
+                   const GimpParam  *param,
+                   gint             *nreturn_vals,
+                   GimpParam       **return_vals);
 
 const GimpPlugInInfo PLUG_IN_INFO =
 {
@@ -96,13 +96,10 @@ run (const gchar      *name,
   /* For preview, we want fast (0.0) over high quality (1.0). */
   g_object_set (config, "quality", 0.0, NULL);
 
-  status        = GIMP_PDB_SUCCESS;
-  *nreturn_vals = 1;
-  *return_vals  = values;
-
   run_mode = param[0].data.d_int32;
 
-  if (run_mode == GIMP_RUN_NONINTERACTIVE && n_params != 3)
+  if (run_mode == GIMP_RUN_NONINTERACTIVE ||
+      n_params != 3)
     {
       /* This plugin is meaningless right now other than interactive. */
       status = GIMP_PDB_CALLING_ERROR;
@@ -117,18 +114,23 @@ run (const gchar      *name,
       image_id = param[1].data.d_image;
       dialog   = animation_dialog_new (image_id);
 
-      gimp_help_connect (GTK_WIDGET (dialog), gimp_standard_help_func, PLUG_IN_PROC, NULL);
+      gimp_help_connect (GTK_WIDGET (dialog),
+                         gimp_standard_help_func,
+                         PLUG_IN_PROC, NULL);
       gtk_widget_show_now (GTK_WIDGET (dialog));
 
       gtk_main ();
+      gimp_displays_flush ();
 
-      if (run_mode != GIMP_RUN_NONINTERACTIVE)
-        gimp_displays_flush ();
+      status = GIMP_PDB_SUCCESS;
     }
 
   values[0].type = GIMP_PDB_STATUS;
   values[0].data.d_status = status;
 
+  *nreturn_vals = 1;
+  *return_vals  = values;
+
   gegl_exit ();
   gimp_quit ();
 }
diff --git a/plug-ins/animation-play/core/animation.c b/plug-ins/animation-play/core/animation.c
index aac999e..de3cc59 100644
--- a/plug-ins/animation-play/core/animation.c
+++ b/plug-ins/animation-play/core/animation.c
@@ -715,7 +715,7 @@ animation_set_property (GObject      *object,
   switch (property_id)
     {
     case PROP_IMAGE:
-      priv->image_id       = g_value_get_int (value);
+      priv->image_id = g_value_get_int (value);
       break;
 
     default:
diff --git a/plug-ins/animation-play/widgets/animation-dialog.c 
b/plug-ins/animation-play/widgets/animation-dialog.c
index e885444..60a80f0 100755
--- a/plug-ins/animation-play/widgets/animation-dialog.c
+++ b/plug-ins/animation-play/widgets/animation-dialog.c
@@ -20,10 +20,6 @@
 
 #include "config.h"
 
-#include <string.h>
-#include <errno.h>
-
-#include <glib/gstdio.h>
 #undef GDK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
 
@@ -48,7 +44,7 @@
  * These will be used only for image without stored animation. */
 typedef struct
 {
-  gdouble     framerate;
+  gdouble framerate;
 }
 CachedSettings;
 
@@ -316,7 +312,7 @@ animation_dialog_class_init (AnimationDialogClass *klass)
 
   g_object_class_install_property (object_class, PROP_IMAGE,
                                    g_param_spec_int ("image", NULL,
-                                                     "GIMP imag id",
+                                                     "GIMP image id",
                                                      G_MININT, G_MAXINT, 0,
                                                      GIMP_PARAM_READWRITE |
                                                      G_PARAM_CONSTRUCT_ONLY));
@@ -327,12 +323,6 @@ animation_dialog_class_init (AnimationDialogClass *klass)
 static void
 animation_dialog_init (AnimationDialog *dialog)
 {
-  AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
-
-  priv->drawing_area_width        = -1;
-  priv->drawing_area_height       = -1;
-  priv->shape_drawing_area_width  = -1;
-  priv->shape_drawing_area_height = -1;
 }
 
 /**** Public Functions ****/
@@ -1295,7 +1285,7 @@ animation_dialog_save_settings (AnimationDialog *dialog)
           gimp_image_undo_group_start (priv->image_id);
           undo_step_started = TRUE;
         }
-      parasite = gimp_parasite_new (PLUG_IN_PROC "/frame-rate",
+      parasite = gimp_parasite_new (PLUG_IN_PROC "/framerate",
                                     GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE,
                                     sizeof (cached_settings.framerate),
                                     &cached_settings.framerate);
@@ -1881,7 +1871,9 @@ popup_menu (GtkWidget       *widget,
             AnimationDialog *dialog)
 {
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
-  GtkWidget *menu = gtk_ui_manager_get_widget (priv->ui_manager, "/anim-play-popup");
+  GtkWidget              *menu;
+
+  menu = gtk_ui_manager_get_widget (priv->ui_manager, "/anim-play-popup");
 
   gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
   gtk_menu_popup (GTK_MENU (menu),
@@ -2652,7 +2644,7 @@ show_goto_progress (AnimationDialog *dialog,
                             animation_get_length (priv->animation));
   else
     text = g_strdup_printf (_("Go to frame %d [%d-%d]"),
-                            goto_frame, 
+                            goto_frame,
                             animation_get_start_position (priv->animation),
                             animation_get_start_position (priv->animation) + animation_get_length 
(priv->animation) - 1);
   gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), text);
@@ -2666,7 +2658,6 @@ show_playing_progress (AnimationDialog *dialog)
   gchar *text;
 
   /* update the dialog's progress bar */
-
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),
                                  ((gfloat) (animation_get_position (priv->animation) - 
animation_get_start_position (priv->animation)) /
                                   (gfloat) (animation_get_length (priv->animation) - 0.999)));


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