Re: turn on italics in TextView




 
On that last post, I think that I have some bad pointer arithmetic. Moving a pointer past the end and freeing 
a moved pointer. Not so good.

Eric

...
    GSList *tlist=NULL;
    GSList *p=NULL;
    GSList *next=NULL;
    tlist=gtk_text_iter_get_tags(&start);
    p=tlist;
    if(tlist!=NULL)
      {
        do
          {
            next=p->next;
            gchar *string=NULL;
            g_object_get(G_OBJECT(p->data), "name", &string, NULL);
            g_print("%s\n", string);
            g_free(string);
            if(next!=NULL)p=g_slist_next(p);
          }while(next!=NULL);
       }
    else g_print("No Tag\n");

    if(tlist!=NULL) g_slist_free(tlist);
...

 

 

-----Original Message-----
From: Eric Cashon via gtk-app-devel-list <gtk-app-devel-list gnome org>
To: dougm <dougm bravoecho net>
Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
Sent: Tue, Jun 20, 2017 4:48 pm
Subject: Re: turn on italics in TextView


 
Another option is to look at the properties of the tags to get the information that you need. This might work 
better than saving globals and matching pointers.

Eric

...
    GSList *tlist=NULL;
    GSList *next=NULL;
    tlist=gtk_text_iter_get_tags(&start);
    if(tlist!=NULL)
    {
        do
          {
            next=tlist->next;
            gchar *string=NULL;
            g_object_get(G_OBJECT(tlist->data), "name", &string, NULL);
            g_print("%s\n", string);
            g_free(string);
      tlist=g_slist_next(tlist);
          }while(next!=NULL);
       }
    else g_print("No Tags\n");

    if(tlist!=NULL) g_slist_free(tlist);
...

 



_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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