[Buoh-dev] Fechas de =?ISO-8859-1?Q?publicaci=F3n?=



El jue, 29-09-2005 a las 16:05 +0200, Esteban S?nchez escribi?:
> Ah? va el parche con los ?ltimos cambios. De momento dejo pendiente el
> tema de los ifs anidados hasta m?s recapacitaci?n.
> 
> ?Commit?
> 
> Saludos
> -- 
> Esteban S?nchez
>  esteban steve-0 com
>  http://steve-o.org
>  http://subanales.com/
>  ------------------------------------------------
>  PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xB6E0F8AF
>
> ===================================================================
> RCS file: /cvsroot/buoh/buoh/ChangeLog,v
> retrieving revision 1.73
> diff -u -p -u -r1.73 ChangeLog
> --- ChangeLog   26 Sep 2005 17:42:25 -0000      1.73
> +++ ChangeLog   29 Sep 2005 14:05:09 -0000
> @@ -1,5 +1,29 @@
> -2005-09-26  Esteban Sanchez  <esteban steve-o org>
> +2005-09-29  Esteban Sanchez  <esteban steve-o org>
> +
> +       * src/buoh-comic-manager-date.[ch]: Added
> get_publications_days method
> +       that returns a string with the days of week in which the comic
> is
> +       published. Changed restrictions to a positive logic.
> +
> +       * src/buoh-comic-properties-dialog.c: Added property of
> publication
> +       days when available.
> +
> +       * src/buoh-add-comic-dialog.c:  Modified a string.
> +
> +       * po/POTFILES: Added src/buoh-comic-properties-dialog.c and
> +       data/buoh.schemas.in.

no veo estos cambios en el parche, adem?s el fichero POTFILES es un
fichero generado, el que tienes que cambiar es POTFILES.in
 
> +       * data/comics.xml: Removed duplicated comics.
> +
> +       * src/comic-simple.[ch]: Removed from repository.
> +
> +       * src/buoh-comic-list.c, src/buoh-comic.c,
> +       src/buoh-properties-dialog.c, src/buoh-view-comic.c,
> +       src/buoh-view-message.c, src/buoh-view.c, src/buoh-window.c,
> +       src/buoh.c: Added "void" between "(" and ")" on functions
> declarations
> +
> +       * TODO: Updated.
> +
> +2005-09-26  Esteban Sanchez  <esteban steve-o org>
>         * src/buoh-window.c: Add the GConfClient as a private
> attribute of the
>         class. Set active to "view toolbar" menu based on the gconf
> key.
>  
> Index: src/buoh-comic-manager-date.c
> ===================================================================
> RCS file: /cvsroot/buoh/buoh/src/buoh-comic-manager-date.c,v
> retrieving revision 1.6
> diff -u -p -u -r1.6 buoh-comic-manager-date.c
> --- src/buoh-comic-manager-date.c       23 Sep 2005 13:48:46
> -0000      1.6
> +++ src/buoh-comic-manager-date.c       29 Sep 2005 14:05:12 -0000
> @@ -20,6 +20,7 @@
>  #include <gtk/gtk.h>
>  #include <time.h>
>  #include <glib.h>
> +#include <glib/gi18n.h>
>  
>  #include "buoh.h"
>  #include "buoh-comic-manager-date.h"
> @@ -33,24 +34,36 @@ static void buoh_comic_manager_date_init
>  static void buoh_comic_manager_date_class_init
> (BuohComicManagerDateClass *);
>  static void buoh_comic_manager_date_finalize     (GObject *);
>  
> -static gchar     *buoh_comic_manager_date_get_id_from_date
> (BuohComicManagerDate *comic_manager);
> -static gchar     *buoh_comic_manager_date_get_uri_from_date
> (BuohComicManagerDate *comic_manager);
> -static BuohComic *buoh_comic_manager_date_new_comic
> (BuohComicManagerDate *comic_manager);
> -
> -static BuohComic *buoh_comic_manager_date_get_next
> (BuohComicManager *manager);
> -static BuohComic *buoh_comic_manager_date_get_previous
> (BuohComicManager *manager);
> -static BuohComic *buoh_comic_manager_date_get_first
> (BuohComicManager *manager);
> -static BuohComic *buoh_comic_manager_date_get_last
> (BuohComicManager *manager);
> -static gboolean   buoh_comic_manager_date_is_the_first
> (BuohComicManager *manager);
> +static gchar       *buoh_comic_manager_date_get_id_from_date
> (BuohComicManagerDate *comic_manager);
> +static gchar       *buoh_comic_manager_date_get_uri_from_date
> (BuohComicManagerDate *comic_manager);
> +static BuohComic   *buoh_comic_manager_date_new_comic
> (BuohComicManagerDate *comic_manager);
> +
> +static BuohComic   *buoh_comic_manager_date_get_next
> (BuohComicManager *manager);
> +static BuohComic   *buoh_comic_manager_date_get_previous
> (BuohComicManager *manager);
> +static BuohComic   *buoh_comic_manager_date_get_first
> (BuohComicManager *manager);
> +static BuohComic   *buoh_comic_manager_date_get_last
> (BuohComicManager *manager);
> +static gboolean     buoh_comic_manager_date_is_the_first
> (BuohComicManager *manager);
> +static const gchar *buoh_comic_manager_date_get_dayweek
> (GDateWeekday d);
>  
>  static BuohComicManagerClass *parent_class = NULL;
>  
>  struct _BuohComicManagerDatePrivate {
>         GDate     *date;
>         GDate     *first;
> -       gboolean   restrictions[8]; /* Days of week */
> +       gboolean   publications[8]; /* Days of week */
>  };
>  
> +static const gchar *day_names [] = {
> +       NULL,
> +       N_("Monday"),
> +       N_("Tuesday"),
> +       N_("Wednesday"),
> +       N_("Thursday"),
> +       N_("Friday"),
> +       N_("Saturday"),
> +       N_("Sunday")
> + };
> +
>  GType
>  buoh_comic_manager_date_get_type (void)
>  {
> @@ -86,8 +99,8 @@ buoh_comic_manager_date_init (BuohComicM
>         
>         comic_manager->priv->date = NULL;
>  
> -       for (i = 0; i < 8; i++)
> -               comic_manager->priv->restrictions[i] = FALSE;
> +       for (i = G_DATE_BAD_WEEKDAY; i <= G_DATE_SUNDAY; i++)
> +               comic_manager->priv->publications[i] = TRUE;
>  }
>  
>  static void
> @@ -158,7 +171,7 @@ buoh_comic_manager_date_set_restriction 
>  {
>         g_return_if_fail (BUOH_IS_COMIC_MANAGER_DATE (comic_manager));
>  
> -       comic_manager->priv->restrictions[day] = TRUE;
> +       comic_manager->priv->publications[day] = FALSE;
>  }
>  
>  void
> @@ -249,7 +262,7 @@ buoh_comic_manager_date_get_next (BuohCo
>         
>         /* Check the restrictions */
>         weekday = g_date_get_weekday (cmd->priv->date);
> -       while (cmd->priv->restrictions[weekday] == TRUE) {
> +       while (!cmd->priv->publications[weekday]) {
>                 g_date_add_days (cmd->priv->date, 1);
>                 weekday = g_date_get_weekday (cmd->priv->date);
>         }
> @@ -297,7 +310,7 @@ buoh_comic_manager_date_get_previous (Bu
>         
>         /* Check the restrictions */
>         weekday = g_date_get_weekday (cmd->priv->date);
> -       while (cmd->priv->restrictions[weekday] == TRUE) {
> +       while (!cmd->priv->publications[weekday]) {
>                 g_date_subtract_days (cmd->priv->date, 1);
>                 weekday = g_date_get_weekday (cmd->priv->date);
>         }
> @@ -349,7 +362,7 @@ buoh_comic_manager_date_get_last (BuohCo
>  
>         /* Check the restrictions */
>         weekday = g_date_get_weekday (date);
> -       while (priv->restrictions[weekday] == TRUE) {
> +       while (!priv->publications[weekday]) {
>                 g_date_subtract_days (date, 1);
>                 weekday = g_date_get_weekday (date);
>         }
> @@ -449,4 +462,61 @@ buoh_comic_manager_date_get_first (BuohC
>                       comic_list, NULL);
>         
>         return comic;
> +}
> +
> +static const gchar *
> +buoh_comic_manager_date_get_dayweek (GDateWeekday d)
> +{
> +       if (d >= G_DATE_BAD_WEEKDAY && d <= G_DATE_SUNDAY) {
> +               

quita esta linea en blanco

> +               return g_strdup (day_names[d]);
> +       } else {
> +               return NULL;
> +       }
> +}
> +
> +gchar *
> +buoh_comic_manager_date_get_publication_days (BuohComicManagerDate
> *comic_manager)
> +{
> +       gint      i, last_printed = 0;
> +       gboolean  has_restrict = FALSE, prev = FALSE;
> +       GString  *aux;
> +       
> +       aux = g_string_new ("");
> +
> +       for (i = G_DATE_MONDAY; i <= G_DATE_SUNDAY; i++) {
> +               if (comic_manager->priv->publications[i]) {
> +                       if (!prev) {
> +                               if (aux->len) {
> +                                       /* Add a separator */
> +                                       g_string_append (aux, ", ");
> +                               }
> +                               g_string_append (aux,
> +
> buoh_comic_manager_date_get_dayweek (i));

viendo el codigo de GString parece que hace un memcpy, y puesto que
get_weekday devuelve un strdup, esto parece ser un leak. Prueba a
recoger la cadena en la variable y liberarla despu?s del append

> +                               last_printed = i;
> +                       }
> +                       
> +                       prev = TRUE;
> +               } else {
> +                       if (prev && (last_printed != i - 1)) {
> +                               if (aux->len) {
> +                                       /* It's a range of days */
> +                                       g_string_append (aux, _(" to
> "));
> +                               }
> +                               g_string_append (aux,
> +
> buoh_comic_manager_date_get_dayweek (i - 1));

idem

> +                       }
> +                       
> +                       has_restrict = TRUE;
> +                       prev = FALSE;
> +               }
> +       }
> +       
> +       if (!has_restrict) {
> +               g_string_set_size (aux, 0);
> +               g_string_append (aux, _("Every day"));
> +       }
> +       
> +       /* g_string_free () returns the "gchar *" data */
> +       return g_string_free (aux, FALSE);
>  }

Salu2
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Carlos Garcia Campos a.k.a. KaL
   elkalmail yahoo es
   carlosgc gnome org
   http://carlosgc.linups.org
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=             
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente
Url : http://forge.novell.com/pipermail/buoh-dev/attachments/20050929/dc90bf1b/attachment.pgp


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