Re: gtk-app-devel-list Digest, Vol 51, Issue 21



More good list karma - this is a great resource.

Does it work?


splons


On Jul 15, 2008, at 3:11 AM, gtk-app-devel-list-request gnome org wrote:

Send gtk-app-devel-list mailing list submissions to
        gtk-app-devel-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
or, via email, send a message with subject or body 'help' to
        gtk-app-devel-list-request gnome org

You can reach the person managing the list at
        gtk-app-devel-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtk-app-devel-list digest..."


Today's Topics:

  1. Re: font size gtk_*_new_with_label [SOLVED] (Luis Ariel Lecca)
  2. How do I get the enter key to press OK when in a GTk::Entry
     widget? (Garth's KidStuff)
  3. Re: How do I get the enter key to press OK when in a
     GTk::Entry widget? (Eduardo M KALINOWSKI)
  4. about textview (gtk_text_buffer_insert_with_tags cause
     segmentaion        fault) ( ??? )
  5. Re: about textview (gtk_text_buffer_insert_with_tags cause
     segmentaion fault) (plt)
  6. Problem writing pixels to GdkPixbuf data buffer (Luka Napotnik)
  7. Using g_signal_connect in class (Marco Rocco)


----------------------------------------------------------------------

Message: 1
Date: Mon, 14 Jul 2008 10:50:20 -0700 (PDT)
From: Luis Ariel Lecca <ariel_xxii yahoo com ar>
Subject: Re: font size gtk_*_new_with_label [SOLVED]
To: gtk-app-devel-list gnome org
Message-ID: <821067 11676 qm web53603 mail re2 yahoo com>
Content-Type: text/plain; charset=iso-8859-1

thanks to the 3 guys who gave me a hand with this...

Here one function in C to resolve this:

gint8 GuiUtils_Font_Change( GtkWidget *pCtrl, c8 *C8pname, PangoFontDescription *pfont )
{       
        gint8   S8retval = -1;
        
 if( C8pname && pfont )
        {       
                if( GTK_IS_WINDOW(pCtrl)/*||GTK_IS_LIST_ITEM(pCtrl)*/ )
                {       
                        pCtrl = lookup_widget( pCtrl/*GTK_WIDGET(pCtrl)*/, C8pname );
                }       
                
                if( pCtrl )
                {       
                        if( !GTK_IS_LABEL(pCtrl) )
                        {       
                                if( GTK_IS_BUTTON(pCtrl)||GTK_IS_ITEM(pCtrl) )
                                {       
                                        pCtrl = gtk_bin_get_child( GTK_BIN(pCtrl) );
                                }       
                                else if( GTK_IS_STATUSBAR(pCtrl) )
                                {       
                                        pCtrl = GTK_WIDGET((GTK_STATUSBAR(pCtrl)->label) );
                                }       
                                else if( GTK_IS_FRAME(pCtrl) )
                                {       
                                        pCtrl = GTK_WIDGET((GTK_FRAME(pCtrl)->label_widget) );
                                }       
                                else if( GTK_IS_ENTRY(pCtrl) )
                                {       
                                        pCtrl = lookup_widget( &((GTK_ENTRY(pCtrl)->widget)), C8pname );
                                }       
                        }       
                        
                        if( pCtrl )
                        {       
                                gtk_widget_modify_font( pCtrl, pfont );
                                S8retval = 0;
                        }       
                }       
        }       
        
        return S8retval;
}       



--- El dom 13-jul-08, Tomas Carnecky <tom dbservice com> escribi?:

De: Tomas Carnecky <tom dbservice com>
Asunto: Re: font size gtk_*_new_with_label
Para: ariel_xxii yahoo com ar
Cc: gtk-app-devel-list gnome org
Fecha: domingo, 13 de julio de 2008, 9:39 am
Luis Ariel Lecca wrote:
Hi All ! I will appreciate very much any help :)

I'm using

gtk_widget_modify_font()  and

style = gtk_rc_style_new();
pango_font_description_free( style->font_desc );
style->font_desc = pfont;
gtk_widget_modify_style( widget, style );

to change the font size of my labels, but I can't
do it on created
buttons with gtk_*_new_with_label() and neither in my
statusbar.

I couldn't find any example on the net. I
understand that I dont have the reference to the labels...
, but when gtk refresh the screen needs the reference to
the labels...

So how to get the reference pointer or directly how to
change the font size on these objects ?

I have custom labels with my widgets...
Now, I'd rather change as less as possible the
Glade code (Glade use _with_label in generation code).
I think that would be better using with_label than a
custom button (I'm not completetly sure about it on
gtk).

Could any body give me some help about this problem? I
need to solve it


Why don't you use pango markup?

button = gtk_button_new();
label = gtk_label_new();
gtk_label_set_markup(GTK_LABEL(label), "<span
size='large'>A</span>");
gtk_container_add(GTK_CONTAINER (button), label);

tom


____________________________________________________________________________________
?Busc? desde tu celular!

Yahoo! oneSEARCH ahora est? en Claro

http://ar.mobile.yahoo.com/onesearch


------------------------------

Message: 2
Date: Mon, 14 Jul 2008 14:23:13 -0700
From: "Garth's KidStuff" <garthskidstuff gmail com>
Subject: How do I get the enter key to press OK when in a GTk::Entry
        widget?
To: gtk-app-devel-list gnome org
Message-ID:
        <cc40fe460807141423p571a5a96v7d7d91e5a8027e3a mail gmail com>
Content-Type: text/plain; charset=ISO-8859-1

Hi All,

I've got a dialog with a Gtk:Entry widget and some other widgets. I've set the OK button the be the default and that works fine as long as the user isn't editing text in the Entry widget. How do I make the Entry widget
ignore the return key?

Thanks in advance.

-Garth


--
Garth Upshaw
Garth's KidStuff


------------------------------

Message: 3
Date: Mon, 14 Jul 2008 18:32:43 -0300
From: Eduardo M KALINOWSKI <eduardo kalinowski com br>
Subject: Re: How do I get the enter key to press OK when in a
        GTk::Entry      widget?
To: gtk-app-devel-list gnome org
Message-ID: <487BC5FB 9030108 kalinowski com br>
Content-Type: text/plain; charset=ISO-8859-1

Garth's KidStuff wrote:
Hi All,

I've got a dialog with a Gtk:Entry widget and some other widgets. I've set the OK button the be the default and that works fine as long as the user isn't editing text in the Entry widget. How do I make the Entry widget
ignore the return key?


You do not want the enter to be ignored on the Entry, but rather that
the enter in the Entry activates the default button.

That is accomplished with gtk_entry_set_activates_default():
http://library.gnome.org/devel/gtk/unstable/GtkEntry.html#gtk-entry-set-activates-default


--
Death rays don't kill people, people kill people!!

Eduardo M KALINOWSKI
eduardo kalinowski com br
http://move.to/hpkb



------------------------------

Message: 4
Date: Tue, 15 Jul 2008 02:09:34 +0800
From: " ??? "<zhubicen gmail com>
Subject: about textview (gtk_text_buffer_insert_with_tags cause
        segmentaion     fault)
To: "gtk-app-devel-list"<gtk-app-devel-list gnome org>
Message-ID: <DreamMail__020934_87582401000 smtp gmail com>
Content-Type: text/plain;       charset="GB2312"

Hi all ,
When I insert some text to textview in a thread in the following code(myThread::run) . it will segmentation fault .
Could someone help me to fix this issue.
Any comments and suggestion will be welcomed.

bzhu

#include <gtk/gtk.h>
#include <wchar.h>
#include <string.h>
#include <pthread.h>
GtkWidget* tv;
GtkTextTag* tag;
#include <assert.h>
class Thread
{
public:
   Thread();
   void start();
   virtual void run();
private:
   pthread_t   m_hThread;
};
Thread::Thread()
{
}
static void* _ou_thread_proc(void* param)
{
   pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
   pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
   Thread* tp = (Thread*)param;
   tp->run();
   pthread_exit(NULL);
   return NULL;
}
void Thread::start()
{
   int iret = pthread_create( &m_hThread, NULL, _ou_thread_proc,this);
   assert(iret == 0);
}
void Thread::run()
{
}
class myThread:public Thread
{
public :
   void run()
       {
           g_print("Thread is running\n");
           //Code belowe will cause the segmentation fault
           gdk_threads_enter();
GtkTextBuffer* tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));
           GtkTextIter end;
           gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(tb),&end);
           gchar text[] = "Thread is running\n";
gtk_text_buffer_insert_with_tags (GTK_TEXT_BUFFER(tb),&end,text,-1,tag);//segmentaion fault.
           gdk_threads_leave();

       }
};
void* thread_proc(void* param)
{
   gdk_threads_enter();
   GtkTextBuffer* tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));
   GtkTextIter end;
   gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(tb),&end);
   gchar text[] = "Thread is running\n";
gtk_text_buffer_insert_with_tags (GTK_TEXT_BUFFER(tb),&end,text,-1,tag);
   gdk_threads_leave();
}
myThread g_thread;
void go_click(GtkWidget* goButton,GtkWidget* noWidget)
{
   //g_print("You click");
   //pthread_t mythread;
   //pthread_create(&mythread,NULL,thread_proc,NULL);
   g_thread.start();
}
int main(int argc,char* argv[])
{
   GtkWidget* window;

   g_thread_init(NULL);
   gdk_threads_init();
   gdk_threads_enter();
   gtk_init(&argc,&argv);
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   GtkWidget* vbox = gtk_vbox_new(FALSE,2);
   gtk_container_add(GTK_CONTAINER(window),vbox);

   tv = gtk_text_view_new();
   gtk_box_pack_start(GTK_BOX(vbox),tv,TRUE,TRUE,0);
   gtk_widget_set_size_request(tv,160,160);
   GtkWidget* go = gtk_button_new_with_label("go");
   gtk_box_pack_start(GTK_BOX(vbox),go,TRUE,TRUE,0);
g_signal_connect (G_OBJECT (go),"clicked",G_CALLBACK (go_click),NULL);
   //write a text to the text view
   GtkTextBuffer* tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));
tag = gtk_text_buffer_create_tag (tb, "PASSTAG","scale",PANGO_SCALE_XX_LARGE,NULL);
   GtkTextIter end;
   gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(tb),&end);
   gchar text[] = "just a test\n";
gtk_text_buffer_insert_with_tags (GTK_TEXT_BUFFER(tb),&end,text,-1,tag);

   gtk_widget_show_all(window);
   gtk_main();
   gdk_threads_leave();
   return 1;
}


Makefile:


CC = g++
RM = rm
GTK_CFLAGS = `pkg-config --cflags gtk+-2.0 gthread-2.0 `
GTK_LIBS = `pkg-config --libs --cflags gtk+-2.0 gthread-2.0 `
CFLAGS = -g -Wall
LIBS = -lpthread
.SUFFIXES:.cpp
SRCS = textview.cpp
#thread.cpp
OBJS = $(SRCS:.cpp=.o)
.cpp.o:
$(CC) $(CFLAGS) $(GTK_CFLAGS) -c $<
tv: $(OBJS)
$(CC) $(GTK_LIBS) $(LIBS) -o $@ $(OBJS)
clean:
$(RM) *.o
$(RM) tv



------------------------------

Message: 5
Date: Tue, 15 Jul 2008 14:35:24 +0800
From: plt <blc03 mails tsinghua edu cn>
Subject: Re: about textview (gtk_text_buffer_insert_with_tags cause
        segmentaion fault)
To: zhubicen gmail com
Cc: gtk-app-devel-list gnome org
Message-ID: <1216103724 8525 2 camel plt-laptop>
Content-Type: text/plain; charset=UTF-8

On Tue, 2008-07-15 at 02:09 +0800, ??? wrote:
Hi all ,
When I insert some text to textview in a thread in the following code(myThread::run) . it will segmentation fault .
Could someone help me to fix this issue.
Any comments and suggestion will be welcomed.

bzhu

#include <gtk/gtk.h>
[...]

class myThread:public Thread
{
public :
   void run()
       {
           g_print("Thread is running\n");
           //Code belowe will cause the segmentation fault
           gdk_threads_enter();
GtkTextBuffer* tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));
           GtkTextIter end;
           gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(tb),&end);
           gchar text[] = "Thread is running\n";
gtk_text_buffer_insert_with_tags (GTK_TEXT_BUFFER(tb),&end,text,-1,tag);//segmentaion fault.

You should add `NULL' to the parameter list:

?gtk_text_buffer_insert_with_tags(GTK_TEXT_BUFFER(tb),
                &end,text,-1,tag, NULL);

           gdk_threads_leave();

       }
};
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




------------------------------

Message: 6
Date: Tue, 15 Jul 2008 09:22:08 +0200
From: Luka Napotnik <luka napotnik gmail com>
Subject: Problem writing pixels to GdkPixbuf data buffer
To: gtk-app-devel-list gnome org
Message-ID: <1216106528 7119 15 camel luka-laptop>
Content-Type: text/plain; charset="us-ascii"

Hello.

I encounter a strange problem when I'm writing image data to the
GdkPixbuf data buffer.

I create an empty pixbuf and get the data buffer. Then I use:

pixel = pixbuf_data + i * n_channels

, where pixel is a pointer to the pixel, pixbuf_data is the pixbuf data
buffer, i is a counter in a for loop with a condition:

for (i = 0; i < width*height; i++)

This for loop should iterate throught all pixel in the image. The
n_channels variable is 4 because I use a RGBA pixbuf.
When I have this pixel pointer, I use pixel[0], pixel[1], pixel[2] and
pixel[3] to modify the RGBA values.

I then handle the "expose-event", create a cairo surface using the
GdkPixbuf and display the surface onto the drawing area. The problem is
when I display the pixbuf the image is shifted to the right for exacly
two pixels. Meaning the first two pixels in the upper left are two
places to the right, making the last two pixels of the row appear in the
second row. I hope you understand.

Am I making something wrong when writing data to the pixbuf? Or is there
any other explanation. Please help.

Greets,
Luka

------------------------------

Message: 7
Date: Tue, 15 Jul 2008 12:09:23 +0200
From: Marco Rocco <mr85mr gmail com>
Subject: Using g_signal_connect in class
To: gtk-app-devel-list gnome org
Message-ID: <487C7753 7090604 gmail com>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hello, this is my first post on this mailing list, now i do my request: can i use g_signal_connect in a method of my class, using as c_handler
a private function of class? ...and if i can, how i can do ?


------------------------------

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

End of gtk-app-devel-list Digest, Vol 51, Issue 21
**************************************************




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