Re: [PATCH 4/5] don't use deprecated FILE_ATTRIBUTE_STANDARD_NAME



David King left as an exercise for the reader:

OK, I think i got it (haven't had time to test, and am *NOT* an expert with
vala). I'm using GLib collections now. I don't think this is the right way
to go -- you want to use the best collections possible -- but it ought work,
from what I can tell. Please apply after verifying they work -- I'll be able
to check it out later tonight.

https://github.com/dankamongmen/dankcheese/commit/e5f561b6da246d29ec41735e429c389733b45134
https://github.com/dankamongmen/dankcheese/commit/d409358f16f7460afd9a069987b29e899cb98bd6
https://github.com/dankamongmen/dankcheese/commit/6e1ad975cf7add59c980f1d52b9f1da7c17a84f4

also attached.

patch 1 pulls gee dep checks from autotools files
patch 2 reverts to glib collections
patch 3 adds myself to AUTHORS

-- 
nick black     http://www.sprezzatech.com -- unix and hpc consulting
to make an apple pie from scratch, you need first invent a universe.
From d409358f16f7460afd9a069987b29e899cb98bd6 Mon Sep 17 00:00:00 2001
From: nick black <nick black sprezzatech com>
Date: Mon, 7 Jan 2013 08:49:15 -0500
Subject: [PATCH 1/2] kill gee deps in autotools files

---
 Makefile.am  | 1 -
 configure.ac | 1 -
 2 files changed, 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e332074..6be69bc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,7 +59,6 @@ VALAFLAGS = \
 	--pkg posix \
 	--pkg gtk+-3.0 \
 	--pkg gmodule-2.0 \
-	--pkg gee-0.8 \
 	--pkg clutter-1.0 \
 	--pkg clutter-gtk-1.0 \
 	--pkg gstreamer-1.0 \
diff --git a/configure.ac b/configure.ac
index 9e254e5..8aa2494 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,6 @@ LIBRSVG_REQUIRED="librsvg-2.0 >= 2.32.0"
 CLUTTER_REQUIRED="clutter-1.0 >= 1.10.0"
 CLUTTERGTK_REQUIRED="clutter-gtk-1.0 >= 0.91.8"
 CLUTTERGST_REQUIRED="clutter-gst-2.0 >= 1.9.0"
-GEE_REQUIRED="gee-0.8 >= 0.9.0"
 LIBCANBERRA_REQUIRED="libcanberra-gtk3 >= 0.26"
 X11_REQUIRED="x11"
 GNOME_VIDEO_EFFECTS_REQUIRED="gnome-video-effects"
-- 
1.8.1

From e5f561b6da246d29ec41735e429c389733b45134 Mon Sep 17 00:00:00 2001
From: nick black <nick black sprezzatech com>
Date: Mon, 7 Jan 2013 08:49:41 -0500
Subject: [PATCH 2/2] remove gee as requested

---
 src/cheese-effects-manager.vala | 33 ++++++++++-----------------------
 src/cheese-window.vala          | 41 ++++++++++++++++++++---------------------
 2 files changed, 30 insertions(+), 44 deletions(-)

diff --git a/src/cheese-effects-manager.vala b/src/cheese-effects-manager.vala
index 06fc87b..8bef381 100644
--- a/src/cheese-effects-manager.vala
+++ b/src/cheese-effects-manager.vala
@@ -20,17 +20,16 @@
  */
 
 using GLib;
-using Gee;
 
 const string GROUP_NAME = "Effect";
 
 internal class Cheese.EffectsManager : GLib.Object
 {
-  public ArrayList<Effect> effects;
+  public GLib.Array<Effect> effects;
 
   public EffectsManager ()
   {
-    effects = new ArrayList<Effect>(Gee.Functions.get_equal_func_for(typeof(Effect)));
+    effects = new Array<Effect>();
   }
 
   /**
@@ -40,15 +39,15 @@ internal class Cheese.EffectsManager : GLib.Object
   {
     GLib.List<Cheese.Effect> effect_list = Cheese.Effect.load_effects ();
     for (int i = 0; i < effect_list.length (); i++)
-      effects.add (effect_list<Cheese.Effect>.nth (i).data);
+      effects.append_val (effect_list<Cheese.Effect>.nth (i).data);
 
-    effects.sort (Gee.Functions.get_compare_func_for(typeof(Cheese.Effect)));
+    effects.sort ((GLib.CompareFunc)sort_value);
 
     /* add identity effect as the first in the effect list */
-    if (effects.size > 0)
+    if (effects.length > 0)
     {
       Effect e = new Effect (_("No Effect"), "identity");
-      effects.insert (0, e);
+      effects.prepend_val (e);
     }
   }
 
@@ -60,27 +59,15 @@ internal class Cheese.EffectsManager : GLib.Object
    */
   public Effect ? get_effect (string name)
   {
-    foreach (Effect eff in effects)
-    {
-      if (eff.name == name)
-        return eff;
+    for(int i = 0 ; i < effects.length ; ++i){
+      if((string)effects.index(i) == name){
+        return effects.index(i);
+      }
     }
     return null;
   }
 
   /**
-   * Compare two effects by the pipeline description.
-   *
-   * @param a an effect to compare against
-   * @param b another effect to compare against
-   * @return true if the effects are the same, false otherwise
-   */
-  private static bool cmp_value (Effect a, Effect b)
-  {
-    return a.pipeline_desc == b.pipeline_desc;
-  }
-
-  /**
    * A sort function for effects
    *
    * @param a an effect to sort against
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 58317f8..08313fd 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -26,7 +26,6 @@ using Clutter;
 using Config;
 using Eog;
 using Gst;
-using Gee;
 using CanberraGtk;
 
 [DBus(name = "org.freedesktop.PackageKit.Modify")]
@@ -77,7 +76,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
 
   private Clutter.Box           current_effects_grid;
   private int                current_effects_page = 0;
-  private ArrayList<Clutter.Box> effects_grids;
+  private GLib.Array<Clutter.Box> effects_grids;
 
   private Gtk.ToggleAction wide_mode_action;
   private Gtk.Action       countdown_action;
@@ -1076,7 +1075,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
   [CCode (instance_pos = -1)]
   public void on_next_effects_page (Gtk.Action action)
   {
-    if (current_effects_page != (effects_manager.effects.size / EFFECTS_PER_PAGE))
+    if (current_effects_page != (effects_manager.effects.length / EFFECTS_PER_PAGE))
     {
       activate_effects_page (current_effects_page + 1);
     }
@@ -1096,15 +1095,15 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     {
       viewport_layout.remove ((Clutter.Actor) current_effects_grid);
     }
-    current_effects_grid = effects_grids[number];
+    current_effects_grid = effects_grids.index(number);
     current_effects_grid.set ("opacity", 0);
     viewport_layout.add ((Clutter.Actor) current_effects_grid);
     current_effects_grid.animate (Clutter.AnimationMode.LINEAR, 1000, "opacity", 255);
 
-    for (int i = 0; i < effects_manager.effects.size; i++)
+    for (int i = 0; i < effects_manager.effects.length; i++)
     {
       int           page_of_effect = i / EFFECTS_PER_PAGE;
-      Cheese.Effect effect         = effects_manager.effects[i];
+      Cheese.Effect effect         = effects_manager.effects.index(i);
       if (page_of_effect == number)
       {
         if (!effect.is_preview_connected ())
@@ -1130,7 +1129,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
   {
     effects_page_prev_action.sensitive = (is_effects_selector_active && current_effects_page != 0);
     effects_page_next_action.sensitive =
-      (is_effects_selector_active && current_effects_page != effects_manager.effects.size / EFFECTS_PER_PAGE);
+      (is_effects_selector_active && current_effects_page != effects_manager.effects.length / EFFECTS_PER_PAGE);
   }
 
   /**
@@ -1145,7 +1144,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     {
       video_preview.hide ();
 
-      if (effects_grids.size == 0)
+      if (effects_grids.length == 0)
       {
         error_layer.text = _("No effects found");
         error_layer.show ();
@@ -1158,7 +1157,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     }
     else
     {
-      if (effects_grids.size == 0)
+      if (effects_grids.length == 0)
       {
         error_layer.hide ();
       }
@@ -1184,26 +1183,26 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
       effects_manager.load_effects ();
 
       /* Must initialize effects_grids before returning, as it is dereferenced later, bug 654671. */
-      effects_grids = new ArrayList<Clutter.Box> ();
+      effects_grids = new GLib.Array<Clutter.Box> ();
 
-      if (effects_manager.effects.size == 0)
+      if (effects_manager.effects.length == 0)
       {
         warning ("gnome-video-effects is not installed.");
         return;
       }
 
-      for (int i = 0; i <= effects_manager.effects.size / EFFECTS_PER_PAGE; i++)
+      for (int i = 0; i <= effects_manager.effects.length / EFFECTS_PER_PAGE; i++)
       {
         Clutter.TableLayout table_layout = new TableLayout ();
         Clutter.Box grid = new Clutter.Box (table_layout);
-        effects_grids.add (grid);
+        effects_grids.append_val (grid);
         table_layout.set_column_spacing (10);
         table_layout.set_row_spacing (10);
       }
 
-      for (int i = 0; i < effects_manager.effects.size; i++)
+      for (int i = 0; i < effects_manager.effects.length; i++)
       {
-        Effect            effect  = effects_manager.effects[i];
+        Effect            effect  = effects_manager.effects.index(i);
         Clutter.Texture   texture = new Clutter.Texture ();
         Clutter.BinLayout layout  = new Clutter.BinLayout (Clutter.BinAlignment.CENTER,
                                                            Clutter.BinAlignment.CENTER);
@@ -1234,7 +1233,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
                   "x-align", Clutter.BinAlignment.CENTER,
                   "y-align", Clutter.BinAlignment.END, null);
 
-        Clutter.TableLayout table_layout = (Clutter.TableLayout) effects_grids[i / EFFECTS_PER_PAGE].layout_manager;
+        Clutter.TableLayout table_layout = (Clutter.TableLayout) effects_grids.index(i / EFFECTS_PER_PAGE).layout_manager;
         table_layout.pack ((Clutter.Actor) box,
                            (i % EFFECTS_PER_PAGE) % 3,
                            (i % EFFECTS_PER_PAGE) / 3);
@@ -1242,11 +1241,11 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
       }
 
       setup_effects_page_switch_sensitivity ();
-      current_effects_grid = effects_grids[0];
+      current_effects_grid = effects_grids.index(0);
     }
   }
 
-  private Gee.HashMap<string, bool> action_sensitivities;
+  private HashTable<string, bool> action_sensitivities;
   /**
    * Toggle the sensitvity of the camera actions.
    *
@@ -1257,7 +1256,8 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     is_camera_actions_sensitive = active;
     if (active)
     {
-      foreach (string key in action_sensitivities.keys)
+	/*List<string> keys = new List<string>(action_sensitivities.get_keys());*/
+      foreach (string key in action_sensitivities.get_keys())
       {
         Gtk.Action action = gtk_builder.get_object (key) as Gtk.Action;
         action.sensitive = action_sensitivities.get (key);
@@ -1265,8 +1265,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
     }
     else
     {
-      action_sensitivities = new HashMap<string, bool>
-        (Gee.Functions.get_hash_func_for(typeof(string)));
+      action_sensitivities = new GLib.HashTable<string, bool>(str_hash, str_equal);
       GLib.SList<weak GLib.Object> objects = gtk_builder.get_objects ();
       foreach (GLib.Object obj in objects)
       {
-- 
1.8.1

From 6e1ad975cf7add59c980f1d52b9f1da7c17a84f4 Mon Sep 17 00:00:00 2001
From: nick black <nick black sprezzatech com>
Date: Mon, 7 Jan 2013 08:53:36 -0500
Subject: [PATCH] add myself to AUTHORS

---
 AUTHORS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/AUTHORS b/AUTHORS
index 4228b7a..0fbc66f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -17,6 +17,7 @@ the following people contributed to cheese:
   - James Liggett <jrliggett cox net>
   - Luca Ferretti <elle uca libero it>
   - Mirco "MacSlow" Müller <macslow bangang de>
+  - Nick Black <dankamongmen gmail com>
   - Patryk Zawadzki <patrys pld-linux org>
   - Ryan Zeigler <zeiglerr gmail com>
   - Sebastian Keller <sebastian-keller gmx de>
-- 
1.8.1

Attachment: signature.asc
Description: Digital signature



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