Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=ayatana.git;a=commitdiff;h=76fcca6b91aeb8113458e5f0c0a49be79750d58a

commit 76fcca6b91aeb8113458e5f0c0a49be79750d58a
Author: Devil505 <devil505li...@gmail.com>
Date:   Fri Aug 26 15:10:47 2011 +0200

libdee-0.5.18-2-i686
* added patch

diff --git a/source/ayatana-extra/libdee/FrugalBuild 
b/source/ayatana-extra/libdee/FrugalBuild
index 4fca9f5..217d9d4 100644
--- a/source/ayatana-extra/libdee/FrugalBuild
+++ b/source/ayatana-extra/libdee/FrugalBuild
@@ -4,16 +4,27 @@
pkgname=libdee
pkgbranch=trunk
pkgver=0.5.18
-pkgrel=1
+pkgrel=2
pkgdesc="Libdee is a library that uses DBus to provide objects allowing you to 
create Model-View-Controller type programs across DBus."
url="https://launchpad.net/dee";
depends=('dbus-glib')
-makedepends=('gobject-introspection' 'vala')
+makedepends=('gobject-introspection' 'vala' 'gtk-doc')
groups=('ayatana-extra')
archs=('i686' 'x86_64')
_F_archive_name="dee"
up2date="Flasttar $url"
-source=(http://launchpad.net/$_F_archive_name/$pkgbranch/$pkgver/+download/$_F_archive_name-$pkgver.tar.gz)
-sha1sums=('1a4199a54d0b258f9bb670f8082c0cdc8e7ac2b6')
+source=(http://launchpad.net/$_F_archive_name/$pkgbranch/$pkgver/+download/$_F_archive_name-$pkgver.tar.gz
 \
+        dee_filter_collator_desc.patch)
+sha1sums=('1a4199a54d0b258f9bb670f8082c0cdc8e7ac2b6' \
+          '2644e8a1c8ad1bed52e9effdc7b9b349af100b12')
+
+build() {
+  Fcd
+  Fpatchall
+  autoreconf -fi || fdie
+  Fmake
+  Fmakeinstall
+}
+

# optimization OK
diff --git a/source/ayatana-extra/libdee/dee_filter_collator_desc.patch 
b/source/ayatana-extra/libdee/dee_filter_collator_desc.patch
new file mode 100644
index 0000000..6d232cc
--- /dev/null
+++ b/source/ayatana-extra/libdee/dee_filter_collator_desc.patch
@@ -0,0 +1,877 @@
+Description: Upstream changes introduced in version 0.5.18-1ubuntu1
+ This patch has been created by dpkg-source during the package build.
+ Here's the last changelog entry, hopefully it gives details on why
+ those changes were made:
+ .
+ dee (0.5.18-1ubuntu1) oneiric; urgency=low
+ .
+   * Merged changes from trunk to get dee_filter_collator_desc and vapi
+     fixes
+   * debian/libdee-1.0-1.symbols
+     - Added new symbol
+   * debian/control
+     - Added Vcs
+     - Updated Maintainers
+     - Added build depends for dh-autoreconf
+   * debian/rules
+     - autoreconf
+ .
+ The person named in the Author field signed this changelog entry.
+Author: Ken VanDine <ken.vand...@canonical.com>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- dee-0.5.18.orig/gtk-doc.make
++++ dee-0.5.18/gtk-doc.make
+@@ -23,13 +23,15 @@ GPATH = $(srcdir)
+
+ TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+-EXTRA_DIST =                          \
++SETUP_FILES = \
+       $(content_files)                \
+-      $(HTML_IMAGES)                  \
+       $(DOC_MAIN_SGML_FILE)           \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_MODULE)-overrides.txt
+
++EXTRA_DIST =                          \
++      $(SETUP_FILES)
++
+ DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp 
sgml-build.stamp \
+       html-build.stamp pdf-build.stamp \
+       setup.stamp tmpl.stamp sgml.stamp html.stamp pdf.stamp
+@@ -71,17 +73,20 @@ $(REPORT_FILES): sgml-build.stamp
+
+ #### setup ####
+
+-setup-build.stamp::
++setup-build.stamp:
+       -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+-         cp -a $(abs_srcdir)/$(DOC_MAIN_SGML_FILE) $(abs_builddir)/; \
+-         cp -a $(abs_srcdir)/$(DOC_MODULE)* $(abs_builddir)/; \
+-         if test "x$(content_files)" != "x" ; then \
+-             for file in $(content_files) ; do \
+-                 test -f $(abs_srcdir)/$$file || \
+-                     cp -a $(abs_srcdir)/$$file $(abs_builddir)/; \
++         echo 'gtk-doc: Preparing build'; \
++         files=`echo $(SETUP_FILES) $(expand_content_files) 
$(DOC_MODULE).types`; \
++         if test "x$$files" != "x" ; then \
++             for file in $$files ; do \
++                 test -f $(abs_srcdir)/$$file && \
++                     cp -p $(abs_srcdir)/$$file $(abs_builddir)/; \
+              done \
+-         fi \
++         fi; \
++         test -f $(abs_srcdir)/tmpl && \
++             cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \
+       fi
++      @touch setup-build.stamp
+
+
+ setup.stamp: setup-build.stamp
+@@ -92,7 +97,7 @@ setup.stamp: setup-build.stamp
+
+ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
+       @echo 'gtk-doc: Scanning header files'
+-      @_source_dir='' ;
++      @_source_dir='' ; \
+       for i in $(DOC_SOURCE_DIR) ; do \
+           _source_dir="$${_source_dir} --source-dir=$$i" ; \
+       done ; \
+@@ -111,9 +116,14 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES)
+
+ #### templates ####
+
+-tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) 
$(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
++tmpl-build.stamp: setup.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) 
$(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
+       @echo 'gtk-doc: Rebuilding template files'
+       @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
++      @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
++        if test -w $(abs_srcdir) ; then \
++          cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \
++        fi \
++      fi
+       @touch tmpl-build.stamp
+
+ tmpl.stamp: tmpl-build.stamp
+@@ -149,7 +159,15 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_
+         mkhtml_options=--path="$(abs_srcdir)"; \
+       fi; \
+       cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) 
$(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+-      @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) 
$(abs_builddir)/html )
++      -@test "x$(HTML_IMAGES)" = "x" || \
++      for file in $(HTML_IMAGES) ; do \
++        if test -f $(abs_srcdir)/$$file ; then \
++          cp $(abs_srcdir)/$$file $(abs_builddir)/html; \
++        fi; \
++        if test -f $(abs_builddir)/$$file ; then \
++          cp $(abs_builddir)/$$file $(abs_builddir)/html; \
++        fi; \
++      done;
+       @echo 'gtk-doc: Fixing cross-references'
+       @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html 
--html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       @touch html-build.stamp
+@@ -179,10 +197,11 @@ clean-local:
+       rm -rf .libs
+
+ distclean-local:
+-      rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \
++      rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
+           $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+       if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+-          rm -f $(DOC_MAIN_SGML_FILE) $(DOC_MODULE)*; \
++          rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
++          rm -rf tmpl; \
+       fi
+
+ maintainer-clean-local: clean
+@@ -234,11 +253,11 @@ endif
+ dist-hook: dist-check-gtkdoc dist-hook-local
+       mkdir $(distdir)/tmpl
+       mkdir $(distdir)/html
+-      -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+-      cp $(srcdir)/html/* $(distdir)/html
+-      -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/
+-      -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
+-      -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
++      -cp $(build)/tmpl/*.sgml $(distdir)/tmpl
++      cp $(builddir)/html/* $(distdir)/html
++      -cp $(builddir)/$(DOC_MODULE).pdf $(distdir)/
++      -cp $(build)/$(DOC_MODULE).types $(distdir)/
++      -cp $(build)/$(DOC_MODULE)-sections.txt $(distdir)/
+       cd $(distdir) && rm -f $(DISTCLEANFILES)
+       $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html
+
+--- dee-0.5.18.orig/configure.ac
++++ dee-0.5.18/configure.ac
+@@ -4,7 +4,7 @@ AC_PREREQ(2.65)
+ # but also remember to bump the lib version as instructed below
+ m4_define([dee_major], [0])
+ m4_define([dee_minor], [5])
+-m4_define([dee_micro], [18])
++m4_define([dee_micro], [19])
+ m4_define([dee_api],
+           [dee_major.dee_minor])
+ m4_define([dee_version],
+--- dee-0.5.18.orig/vapi/dee-1.0.gi
++++ dee-0.5.18/vapi/dee-1.0.gi
+@@ -82,6 +82,12 @@
+                                       <parameter name="column" type="guint"/>
+                               </parameters>
+                       </method>
++                      <method name="new_collator_desc" 
symbol="dee_filter_new_collator_desc">
++                              <return-type type="DeeFilter*"/>
++                              <parameters>
++                                      <parameter name="column" type="guint"/>
++                              </parameters>
++                      </method>
+                       <method name="new_for_any_column" 
symbol="dee_filter_new_for_any_column">
+                               <return-type type="DeeFilter*"/>
+                               <parameters>
+--- /dev/null
++++ dee-0.5.18/vapi/dee-1.0-custom.vala
+@@ -0,0 +1,40 @@
++
++namespace Dee
++{
++  [CCode (cheader_filename = "dee.h")]
++  public interface Model : GLib.Object
++    {
++      public virtual signal void row_added (ModelIter iter);
++      public virtual signal void row_removed (ModelIter iter);
++      public virtual signal void row_changed (ModelIter iter);
++    }
++
++  [CCode (cheader_filename = "dee.h")]
++  public class FilterModel
++    {
++      [NoAccessorMethod]
++      public unowned Filter filter { get; construct; }
++    }
++  [Compact]
++  [CCode (free_function = "g_free", cheader_filename = "dee.h")]
++  public class Filter {
++  }
++
++
++  [CCode (cheader_filename = "dee.h")]
++  public interface ResultSet: GLib.Object
++    {
++      [CCode (cname = "_vala_dee_result_set_next_value")]
++      public unowned Dee.ModelIter? next_value ();
++      [CCode (cname = "_vala_dee_result_set_iterator")]
++      public ResultSet iterator ();
++    }
++
++  [CCode (cheader_filename = "dee.h")]
++  public class HashIndex : Dee.Index
++    {
++      [CCode (type = "DeeHashIndex*", has_construct_function = false)]
++      public HashIndex (Dee.Model model, Dee.Analyzer analyzer);
++    }
++
++}
+--- dee-0.5.18.orig/vapi/dee-1.0.vapi
++++ dee-0.5.18/vapi/dee-1.0.vapi
+@@ -31,7 +31,7 @@ namespace Dee {
+               public string primary_path { get; construct; }
+       }
+       [Compact]
+-      [CCode (cheader_filename = "dee.h")]
++      [CCode (free_function = "g_free", cheader_filename = "dee.h")]
+       public class Filter {
+               public weak GLib.DestroyNotify destroy;
+               public weak Dee.ModelMapFunc map_func;
+@@ -40,6 +40,8 @@ namespace Dee {
+               [CCode (has_construct_function = false)]
+               public Filter.collator (uint column);
+               [CCode (has_construct_function = false)]
++              public Filter.collator_desc (uint column);
++              [CCode (has_construct_function = false)]
+               public Filter.for_any_column (uint column, GLib.Variant value);
+               [CCode (has_construct_function = false)]
+               public Filter.for_key_column (uint column, string key);
+--- /dev/null
++++ dee-0.5.18/examples/synced-lists.c
+@@ -0,0 +1,269 @@
++/*
++ * Copyright (C) 2010 Canonical Ltd
++ *
++ * This program is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 3 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ *
++ * Authored by
++ *              Neil Jagdish Patel <neil.pa...@canonical.com>
++ *              Mikkel Kamstrup Erlandsen <mikkel.kamst...@canonical.com>
++ *
++ * Compile with:
++ *
++ * gcc synced-lists.c -o synced-lists `pkg-config --libs --cflags dee 
gtk+-2.0`
++ *
++ */
++#include <time.h>
++#include <glib.h>
++#include <glib-object.h>
++#include <gtk/gtk.h>
++#include <dee.h>
++#include <unistd.h>
++
++static DeeModel    *model;
++static GtkWidget    *window;
++static GtkWidget    *list;
++static GtkListStore *store;
++
++static void
++on_row_added (DeeModel *model, DeeModelIter *iter)
++{
++  gint         i = 0;
++  gchar       *str = NULL;
++  GtkTreeIter  titer;
++
++  dee_model_get (model, iter, 0, &i, 1, &str, -1);
++
++  gtk_list_store_append (store, &titer);
++  gtk_list_store_set (store, &titer,
++                      0, g_strdup_printf ("%d", i),
++                      1, str,
++                      2, iter,
++                      -1);
++
++  g_free (str);
++}
++
++static void
++on_row_removed (DeeModel *model, DeeModelIter *old_iter)
++{
++  GtkTreeIter iter = { 0};
++
++  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
++
++  do
++    {
++      gpointer data = NULL;
++
++      gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
++                          2, &data,
++                          -1);
++
++      if (data == old_iter)
++        {
++          gtk_list_store_remove (store, &iter);
++          break;
++        }
++    }
++  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
++}
++
++static void
++on_row_changed (DeeModel *model, DeeModelIter *row_iter)
++{
++  GtkTreeIter iter = { 0 };
++
++  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
++
++  do
++    {
++      gpointer data = NULL;
++
++      gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
++                          2, &data,
++                          -1);
++
++      if (data == row_iter)
++        {
++          gint i = 0;
++          gchar *str = NULL;
++
++          dee_model_get (model, row_iter, 0, &i, 1, &str, -1);
++
++          gtk_list_store_set (store, &iter,
++                              0, g_strdup_printf ("%d", i),
++                              1, str,
++                              -1);
++          break;
++        }
++    }
++  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
++}
++
++static void
++add_row (GtkWidget *button)
++{
++  dee_model_append (model,
++                     0, getpid (),
++                     1, "Wazza",
++                     -1);
++}
++
++static void
++remove_row (GtkWidget *button)
++{
++  GtkTreeSelection *sel;
++  GtkTreeIter       iter;
++
++  sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
++
++  if (gtk_tree_selection_get_selected (sel,
++                                       NULL,
++                                       &iter))
++    {
++      gpointer data = NULL;
++
++      gtk_tree_model_get (GTK_TREE_MODEL (store),
++                          &iter,
++                          2, &data,
++                          -1);
++
++      dee_model_remove (model, data);
++    }
++  else
++    g_debug ("No selection to delete");
++}
++
++static void
++clear_rows (GtkWidget *button)
++{
++  dee_model_clear (model);
++}
++
++static void
++on_cell_edited (GtkCellRendererText *renderer,
++                gchar               *path,
++                gchar               *new_text,
++                gpointer             old_data)
++{
++  GtkTreeIter iter;
++
++  if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (store),
++                                       &iter,
++                                       path))
++    {
++      gpointer data = NULL;
++
++      gtk_tree_model_get (GTK_TREE_MODEL (store),
++                          &iter,
++                          2, &data,
++                          -1);
++
++      dee_model_set (model,
++                      (DeeModelIter *)data,
++                      1, new_text,
++                      -1);
++    }
++}
++
++gint
++main (gint argc, gchar *argv[])
++{
++  GtkWidget *vbox, *hbox, *scroll, *button;
++
++  gtk_init (&argc, &argv);
++
++  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
++  gtk_window_resize (GTK_WINDOW (window), 300, 600);
++  gtk_container_set_border_width (GTK_CONTAINER (window), 12);
++
++  vbox = gtk_vbox_new (FALSE, 12);
++  gtk_container_add (GTK_CONTAINER (window), vbox);
++
++  button = gtk_label_new (g_strdup_printf ("My PID: <b>%d</b>", getpid()));
++  g_object_set (button, "use-markup", TRUE, NULL);
++  gtk_misc_set_alignment (GTK_MISC (button), 0.5, 0.5);
++  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
++
++  scroll = gtk_scrolled_window_new (NULL, NULL);
++  gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
++  gtk_widget_show (scroll);
++
++  list = gtk_tree_view_new ();
++  gtk_container_add (GTK_CONTAINER (scroll), list);
++  gtk_widget_show (list);
++
++    {
++      GtkCellRenderer   *cell;
++      GtkTreeViewColumn *col;
++
++      cell = gtk_cell_renderer_text_new ();
++      col = gtk_tree_view_column_new_with_attributes ("0",
++                                                      cell,
++                                                      "text", 0,
++                                                      NULL);
++      gtk_tree_view_append_column (GTK_TREE_VIEW (list), col);
++
++      cell = gtk_cell_renderer_text_new ();
++      g_object_set (cell, "editable", TRUE, NULL);
++      g_signal_connect (cell, "edited",
++                        G_CALLBACK (on_cell_edited), NULL);
++      col = gtk_tree_view_column_new_with_attributes ("1",
++                                                      cell,
++                                                      "text", 1,
++                                                      NULL);
++      gtk_tree_view_append_column (GTK_TREE_VIEW (list), col);
++    }
++
++  hbox = gtk_hbox_new (TRUE, 12);
++  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
++
++  button = gtk_button_new_from_stock (GTK_STOCK_ADD);
++  gtk_container_add (GTK_CONTAINER (hbox), button);
++  g_signal_connect (button, "clicked",
++                    G_CALLBACK (add_row), NULL);
++
++  button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
++  gtk_container_add (GTK_CONTAINER (hbox), button);
++  g_signal_connect (button, "clicked",
++                    G_CALLBACK (remove_row), NULL);
++
++  button = gtk_button_new_from_stock (GTK_STOCK_CLEAR);
++  gtk_container_add (GTK_CONTAINER (hbox), button);
++  g_signal_connect (button, "clicked",
++                    G_CALLBACK (clear_rows), NULL);
++
++  gtk_widget_show_all (window);
++
++  store = gtk_list_store_new (3,
++                              G_TYPE_STRING,
++                              G_TYPE_STRING,
++                              G_TYPE_POINTER);
++  gtk_tree_view_set_model (GTK_TREE_VIEW (list), GTK_TREE_MODEL (store));
++
++  model = dee_model_new ("com.canonical.Dbus.Model.Example",
++                          2,
++                          G_TYPE_INT,
++                          G_TYPE_STRING);
++  g_signal_connect (model, "row-added",
++                    G_CALLBACK (on_row_added), NULL);
++  g_signal_connect (model, "row-removed",
++                    G_CALLBACK (on_row_removed), NULL);
++  g_signal_connect (model, "row-changed",
++                    G_CALLBACK (on_row_changed), NULL);
++
++  dee_model_connect (DEE_SHARED_MODEL (model));
++
++  gtk_main ();
++
++  return 0;
++}
+--- dee-0.5.18.orig/tests/test-model-tags.c
++++ dee-0.5.18/tests/test-model-tags.c
+@@ -118,7 +118,9 @@ test_no_tags (Fixture *fix, gconstpointe
+   /* Check that getting an undefined tag fails gracefully */
+   if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | 
G_TEST_TRAP_SILENCE_STDERR))
+     {
++      tag = NULL;
+       tag = dee_model_get_tag (fix->m, iter, GUINT_TO_POINTER (123));
++      g_assert (tag == NULL);
+       exit (0); /* successful test run */
+     }
+   g_test_trap_assert_failed ();
+--- dee-0.5.18.orig/tests/test-filter-model.c
++++ dee-0.5.18/tests/test-filter-model.c
+@@ -39,7 +39,9 @@ static void test_discard_all
+                                                 gconstpointer  data);
+ static void test_discard_all_append_notify     (FilterFixture *fix,
+                                                 gconstpointer  data);
+-static void test_collator                      (FilterFixture *fix,
++static void test_collator_asc                  (FilterFixture *fix,
++                                                gconstpointer  data);
++static void test_collator_desc                  (FilterFixture *fix,
+                                                 gconstpointer  data);
+ static void test_key                           (FilterFixture *fix,
+                                                 gconstpointer  data);
+@@ -62,8 +64,10 @@ test_filter_model_create_suite (void)
+               setup, test_discard_all, teardown);
+   g_test_add (DOMAIN"/DiscardAllAppendNotify", FilterFixture, 0,
+               setup, test_discard_all_append_notify, teardown);
+-  g_test_add (DOMAIN"/Collator", FilterFixture, 0,
+-              setup, test_collator, teardown);
++  g_test_add (DOMAIN"/CollatorAscending", FilterFixture, 0,
++              setup, test_collator_asc, teardown);
++  g_test_add (DOMAIN"/CollatorDescending", FilterFixture, 0,
++              setup, test_collator_desc, teardown);
+   g_test_add (DOMAIN"/Key", FilterFixture, 0,
+               setup, test_key, teardown);
+   g_test_add (DOMAIN"/Any", FilterFixture, 0,
+@@ -301,9 +305,9 @@ test_discard_all_append_notify (FilterFi
+   g_object_unref (m);
+ }
+
+-/* Test dee_filter_new_collator() */
++/* Test dee_filter_new_collator() ascending */
+ static void
+-test_collator (FilterFixture *fix, gconstpointer data)
++test_collator_asc (FilterFixture *fix, gconstpointer data)
+ {
+   DeeModelIter *r0, *r1, *r2, *r3, *r4, *r5;
+   DeeFilter    *collator = dee_filter_new_collator (1);
+@@ -336,11 +340,56 @@ test_collator (FilterFixture *fix, gcons
+   /* Appending to the end of the sorted model is a special case in the code,
+    * so double check on that... */
+   dee_model_append (fix->model, 5, "Zzzz");
++  r0 = dee_model_get_iter_at_row (m, 0);
+   r5 = dee_model_get_iter_at_row (m, 5);
++  g_assert_cmpstr ("Four", ==, dee_model_get_string (m, r0, 1));
+   g_assert_cmpstr ("Zzzz", ==, dee_model_get_string (m, r5, 1));
+
+   g_object_unref (m);
+ }
++
++/* Test dee_filter_new_collator_desc() descending*/
++static void
++test_collator_desc (FilterFixture *fix, gconstpointer data)
++{
++  DeeModelIter *r0, *r1, *r2, *r3, *r4, *r5;
++  DeeFilter    *collator = dee_filter_new_collator_desc (1);
++  DeeModel     *m = dee_filter_model_new (collator, fix->model);
++
++  g_free (collator);
++
++  /* Test alphabetic sorting after initial construction */
++  r0 = dee_model_get_iter_at_row (m, 0);
++  r1 = dee_model_get_iter_at_row (m, 1);
++  r2 = dee_model_get_iter_at_row (m, 2);
++  g_assert_cmpstr ("Zero", ==, dee_model_get_string (m, r0, 1));
++  g_assert_cmpstr ("Two", ==, dee_model_get_string (m, r1, 1));
++  g_assert_cmpstr ("One", ==, dee_model_get_string (m, r2, 1));
++
++  /* Test alphabetic sorting after updates */
++  dee_model_append (fix->model, 3, "Three");
++  dee_model_append (fix->model, 4, "Four");
++  r0 = dee_model_get_iter_at_row (m, 0);
++  r1 = dee_model_get_iter_at_row (m, 1);
++  r2 = dee_model_get_iter_at_row (m, 2);
++  r3 = dee_model_get_iter_at_row (m, 3);
++  r4 = dee_model_get_iter_at_row (m, 4);
++  g_assert_cmpstr ("Zero", ==, dee_model_get_string (m, r0, 1));
++  g_assert_cmpstr ("Two", ==, dee_model_get_string (m, r1, 1));
++  g_assert_cmpstr ("Three", ==, dee_model_get_string (m, r2, 1));
++  g_assert_cmpstr ("One", ==, dee_model_get_string (m, r3, 1));
++  g_assert_cmpstr ("Four", ==, dee_model_get_string (m, r4, 1));
++
++  /* Appending to the end of the sorted model is a special case in the code,
++   * so double check on that... */
++  dee_model_append (fix->model, 5, "Zzzz");
++  r0 = dee_model_get_iter_at_row (m, 0);
++  r5 = dee_model_get_iter_at_row (m, 5);
++  g_assert_cmpstr ("Four", ==, dee_model_get_string (m, r5, 1));
++  g_assert_cmpstr ("Zzzz", ==, dee_model_get_string (m, r0, 1));
++
++  g_object_unref (m);
++}
+
+ static void
+ _test_orig_ordering (FilterFixture *fix,
+--- dee-0.5.18.orig/dee/dee-filters.h
++++ dee-0.5.18/dee/dee-filters.h
+@@ -32,6 +32,8 @@ G_BEGIN_DECLS
+
+ DeeFilter* dee_filter_new_collator       (guint column);
+
++DeeFilter* dee_filter_new_collator_desc       (guint column);
++
+ DeeFilter* dee_filter_new_for_key_column (guint column, const gchar *key);
+
+ DeeFilter* dee_filter_new_for_any_column (guint column, GVariant *value);
+--- dee-0.5.18.orig/dee/dee-filters.c
++++ dee-0.5.18/dee/dee-filters.c
+@@ -84,6 +84,11 @@ static void _dee_filter_collator_map_not
+                                              DeeFilterModel *filter_model,
+                                              gpointer user_data);
+
++static void _dee_filter_collator_desc_map_notify (DeeModel *orig_model,
++                                                  DeeModelIter *orig_iter,
++                                                  DeeFilterModel 
*filter_model,
++                                                  gpointer user_data);
++
+ static void
+ _dee_filter_collator_map_func (DeeModel *orig_model,
+                                DeeFilterModel *filter_model,
+@@ -109,6 +114,30 @@ _dee_filter_collator_map_func (DeeModel
+ }
+
+ static void
++_dee_filter_collator_desc_map_func (DeeModel *orig_model,
++                               DeeFilterModel *filter_model,
++                               gpointer user_data)
++{
++  DeeModelIter   *iter, *end;
++  CollatorFilter *filter;
++
++  g_return_if_fail (user_data != NULL);
++
++  filter = (CollatorFilter *) user_data;
++  filter->collation_key_tag =
++                 dee_model_register_tag (orig_model, (GDestroyNotify) g_free);
++
++  iter = dee_model_get_first_iter (orig_model);
++  end = dee_model_get_last_iter (orig_model);
++  while (iter != end)
++    {
++      _dee_filter_collator_desc_map_notify (orig_model, iter, filter_model, 
filter);
++      iter = dee_model_next (orig_model, iter);
++    }
++
++}
++
++static void
+ _dee_filter_collator_map_notify (DeeModel *orig_model,
+                                  DeeModelIter *orig_iter,
+                                  DeeFilterModel *filter_model,
+@@ -154,6 +183,51 @@ _dee_filter_collator_map_notify (DeeMode
+ }
+
+ static void
++_dee_filter_collator_desc_map_notify (DeeModel *orig_model,
++                                 DeeModelIter *orig_iter,
++                                 DeeFilterModel *filter_model,
++                                 gpointer user_data)
++{
++  DeeModelIter   *iter, *end;
++  CollatorFilter *filter;
++  const gchar    *column_value, *test_value;
++  gchar          *collation_key;
++
++  g_return_if_fail (user_data != NULL);
++  g_return_if_fail (orig_iter != NULL);
++
++  filter = (CollatorFilter *) user_data;
++
++  /* Build and set collation ley for the current row */
++  column_value = dee_model_get_string (orig_model, orig_iter, filter->column);
++  collation_key = g_utf8_collate_key (column_value, -1);
++  dee_model_set_tag (orig_model, orig_iter,
++                     filter->collation_key_tag, collation_key); // steal 
collation_key
++
++  iter = dee_model_get_first_iter (DEE_MODEL (filter_model));
++  end = dee_model_get_last_iter (DEE_MODEL (filter_model));
++  while (iter != end)
++    {
++      test_value = dee_model_get_tag (orig_model, iter, 
filter->collation_key_tag);
++      if (g_strcmp0 (test_value, column_value) > 0)
++        {
++          iter = dee_model_next (DEE_MODEL (filter_model), iter);
++        }
++      else
++        {
++          dee_filter_model_insert_iter_before (filter_model, orig_iter, iter);
++          iter = NULL;
++          break;
++        }
++    }
++
++  if (iter == end)
++    {
++      dee_filter_model_append_iter(filter_model, orig_iter);
++    }
++}
++
++static void
+ _dee_filter_key_map_func (DeeModel *orig_model,
+                           DeeFilterModel *filter_model,
+                           gpointer user_data)
+@@ -357,6 +431,37 @@ dee_filter_new_collator    (guint column
+ }
+
+ /**
++ * dee_filter_new_collator_desc:
++ * @column: The index of a column containing the strings to sort after
++ *
++ * Create a #DeeFilter that takes string values from a column in the model
++ * and builds a #DeeFilterModel with the rows sorted descending according to 
the
++ * collation rules of the current locale.
++ *
++ * Returns: (transfer full): A newly allocated #DeeFilter. Do not modify it.
++ *          Free with g_free().
++ */
++DeeFilter*
++dee_filter_new_collator_desc    (guint column)
++{
++  DeeFilter      *filter;
++  CollatorFilter *collator;
++
++  filter = g_new0 (DeeFilter, 1);
++  filter->map_func = _dee_filter_collator_desc_map_func;
++  filter->map_notify = _dee_filter_collator_desc_map_notify;
++
++  collator = g_new0 (CollatorFilter, 1);
++  collator->column = column;
++
++  filter->destroy = (GDestroyNotify) g_free;
++  filter->user_data =collator;
++
++  return filter;
++}
++
++
++/**
+  * dee_filter_new_for_key_column:
+  * @column: The index of a column containing the string key to match
+  *
+--- dee-0.5.18.orig/dee/dee-peer.c
++++ dee-0.5.18/dee/dee-peer.c
+@@ -1190,13 +1190,11 @@ on_dbus_peer_signal (GDBusConnection *co
+                     gpointer          user_data)
+ {
+   DeePeer          *self;
+-  DeePeerPrivate   *priv;
+   gchar            *peer_address = NULL;
+
+   g_return_if_fail (DEE_IS_PEER (user_data));
+
+   self = DEE_PEER (user_data);
+-  priv = self->priv;
+
+   if (g_strcmp0 ("Bye", signal_name) == 0)
+     {
+--- dee-0.5.18.orig/dee/dee-serializable-model.c
++++ dee-0.5.18/dee/dee-serializable-model.c
+@@ -866,7 +866,7 @@ dee_serializable_model_serialize (DeeSer
+   GVariantBuilder         aav, clone;
+   GVariant               *val, *tt, *schema;
+   DeeModelIter           *iter;
+-  guint                   i, j, n_rows, n_columns;
++  guint                   i, j, n_columns;
+   guint64                 last_seqnum;
+
+   g_return_val_if_fail (DEE_IS_SERIALIZABLE_MODEL (self), FALSE);
+@@ -874,7 +874,6 @@ dee_serializable_model_serialize (DeeSer
+   trace_object (self, "Building clone");
+
+   _self = DEE_MODEL (self);
+-  n_rows = dee_model_get_n_rows (_self);
+   n_columns = dee_model_get_n_columns (_self);
+
+   g_variant_builder_init (&aav, G_VARIANT_TYPE ("aav"));
+--- dee-0.5.18.orig/dee/dee-shared-model.c
++++ dee-0.5.18/dee/dee-shared-model.c
+@@ -1459,7 +1459,7 @@ dee_shared_model_serialize (DeeSerializa
+   GVariantBuilder         aav, au, ay, clone;
+   GVariant               *val, *tt, *schema;
+   DeeModelIter           *iter;
+-  guint                   i, j, n_rows, n_columns;
++  guint                   i, j, n_columns;
+   guint64                 last_seqnum;
+
+   g_return_val_if_fail (DEE_IS_SHARED_MODEL (self), FALSE);
+@@ -1468,7 +1468,6 @@ dee_shared_model_serialize (DeeSerializa
+                 dee_model_get_n_rows (DEE_MODEL (self)));
+
+   _self = DEE_MODEL (self);
+-  n_rows = dee_model_get_n_rows (DEE_MODEL (self));
+   n_columns = dee_model_get_n_columns (DEE_MODEL (self));
+
+   g_variant_builder_init (&aav, G_VARIANT_TYPE ("aav"));
+--- dee-0.5.18.orig/dee/dee-sequence-model.c
++++ dee-0.5.18/dee/dee-sequence-model.c
+@@ -367,13 +367,10 @@ dee_sequence_model_remove (DeeModel
+                            DeeModelIter *iter_)
+ {
+   DeeSequenceModel        *_self = (DeeSequenceModel *)self;
+-  DeeSequenceModelPrivate *priv;
+   GSequenceIter           *iter = (GSequenceIter *)iter_;
+
+   g_return_if_fail (DEE_IS_SEQUENCE_MODEL (_self));
+   g_return_if_fail (iter != NULL);
+-
+-  priv = _self->priv;
+
+   if (iter_ == dee_model_get_last_iter (self))
+     return;
+@@ -452,7 +449,6 @@ dee_sequence_model_set_value_silently (D
+                                        GVariant      *value)
+ {
+   DeeSequenceModel        *_self = (DeeSequenceModel *)self;
+-  DeeSequenceModelPrivate *priv;
+   GPtrArray               *row;
+
+   g_return_if_fail (DEE_IS_SEQUENCE_MODEL (_self));
+@@ -460,8 +456,6 @@ dee_sequence_model_set_value_silently (D
+   g_return_if_fail (column < dee_model_get_n_columns (self));
+   g_return_if_fail (g_variant_type_equal (g_variant_get_type (value), 
G_VARIANT_TYPE (dee_model_get_column_schema (self, column))));
+   g_return_if_fail (value != NULL);
+-
+-  priv = _self->priv;
+
+   row = g_sequence_get ((GSequenceIter *) iter);
+   if (g_ptr_array_index (row, column) != NULL)
+--- dee-0.5.18.orig/dee/dee-filter-model.c
++++ dee-0.5.18/dee/dee-filter-model.c
+@@ -192,7 +192,6 @@ dee_filter_model_constructed (GObject *o
+ {
+   DeeFilterModelPrivate *priv = DEE_FILTER_MODEL (object)->priv;
+   DeeFilter             *filter = priv->filter;
+-  guint                  n_columns;
+
+   if (filter == NULL)
+     {
+@@ -201,8 +200,7 @@ dee_filter_model_constructed (GObject *o
+       return;
+     }
+
+-  g_object_get (object, "back-end", &(priv->orig_model), NULL);
+-  n_columns = dee_model_get_n_columns (priv->orig_model);
++  g_object_get (object, "back-end", &(priv->orig_model), NULL);
+
+   /* Map the end iter of the orig_model to the end iter of our iter list */
+   g_hash_table_insert (priv->iter_map,
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to