Re: ComboBox

2013-06-27 Thread Bernhard Schuster

https://developer.gnome.org/gtk2/2.24/GtkComboBox.html

I am not aware of the changes between 2.0 (which the tutorial targets) 
and 2.24, but you should try to replace it with the API above. Not sure 
though, I educated guess needs more information (i.e. your includes, 
sourcecode - preferably where the error occures +- n lines)


/Bernhard

On Thu, Jun 27, 2013 at 3:46 PM, Rui Pedro Caldeira 
 wrote:
Hello guys, I'm new to GTK+ and I've run into a problem when creating 
a

ComboBox.

I'm using GTK+ 2.24.18 and following the tutorial from this page:

https://developer.gnome.org/gtk-tutorial/2.24/x1063.html

But when I try to compile the code, it seems that none of the 
functions I

call exists in the gtk.h file

Output:

xxx.c: In function ‘XXX’:
xxx.c:63:2: warning: implicit declaration of function 
‘gtk_combo_new’

[-Wimplicit-function-declaration]
xxx.c:63:8: warning: assignment makes pointer from integer without a 
cast

[enabled by default]
xxx.c:65:2: warning: implicit declaration of function ‘GTK_COMBO’
[-Wimplicit-function-declaration]
xxx.c:65:101: error: invalid type argument of ‘->’ (have 
‘int’)

xxx.c:111:3: warning: statement with no effect [-Wunused-value]
xxx.c:116:3: warning: format not a string literal and no format 
arguments

[-Wformat-security]
xxx.c:123:2: warning: implicit declaration of function
‘gtk_combo_set_popdown_strings’ [-Wimplicit-function-declaration]
xxx.c:127:2: warning: implicit declaration of function
‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration]
xxx.c:54:6: warning: unused variable ‘status’ [-Wunused-variable]

If you could help me I would be thankful

Best regards,
Rui
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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

ComboBox

2013-06-27 Thread Rui Pedro Caldeira
Hello guys, I'm new to GTK+ and I've run into a problem when creating a
ComboBox.

I'm using GTK+ 2.24.18 and following the tutorial from this page:

https://developer.gnome.org/gtk-tutorial/2.24/x1063.html

But when I try to compile the code, it seems that none of the functions I
call exists in the gtk.h file

Output:

xxx.c: In function ‘XXX’:
xxx.c:63:2: warning: implicit declaration of function ‘gtk_combo_new’
[-Wimplicit-function-declaration]
xxx.c:63:8: warning: assignment makes pointer from integer without a cast
[enabled by default]
xxx.c:65:2: warning: implicit declaration of function ‘GTK_COMBO’
[-Wimplicit-function-declaration]
xxx.c:65:101: error: invalid type argument of ‘->’ (have ‘int’)
xxx.c:111:3: warning: statement with no effect [-Wunused-value]
xxx.c:116:3: warning: format not a string literal and no format arguments
[-Wformat-security]
xxx.c:123:2: warning: implicit declaration of function
‘gtk_combo_set_popdown_strings’ [-Wimplicit-function-declaration]
xxx.c:127:2: warning: implicit declaration of function
‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration]
xxx.c:54:6: warning: unused variable ‘status’ [-Wunused-variable]

If you could help me I would be thankful

Best regards,
Rui
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: ComboBox

2013-06-27 Thread Rui Pedro Caldeira
Thank You guys, I will try that out!

Best Regards,
Rui

On Thu, Jun 27, 2013 at 3:02 PM, Andreas Rönnquist
wrote:

> On Thu, 27 Jun 2013 14:46:41 +0100,
> Rui Pedro Caldeira wrote:
>
> >Hello guys, I'm new to GTK+ and I've run into a problem when creating a
> >ComboBox.
> >
> >I'm using GTK+ 2.24.18 and following the tutorial from this page:
> >
> >https://developer.gnome.org/gtk-tutorial/2.24/x1063.html
> >
> >But when I try to compile the code, it seems that none of the
> >functions I call exists in the gtk.h file
> >
>
> To me it looks like GtkCombo is deprecated in favor of GtkComboBox:
>
> According to
> https://developer.gnome.org/gtk2/2.24/GtkCombo.html
> :
> "As of GTK+ 2.4, GtkCombo has been deprecated in favor of
> GtkComboBoxEntry."
>
> which links
> https://developer.gnome.org/gtk2/2.24/GtkComboBoxEntry.html
>
> GtkCombBoxEntry does also seem to be deprecated though, and GtkComboBox
> seems to be what is supposed to be used. See
>
> https://developer.gnome.org/gtk2/2.24/GtkComboBox.html
> and
> https://developer.gnome.org/gtk3/3.8/GtkComboBox.html
>
> hope this helps -
> -- Andreas Rönnquist
> mailingli...@gusnan.se
> gus...@gusnan.se
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: ComboBox

2013-06-27 Thread Andreas Rönnquist
On Thu, 27 Jun 2013 14:46:41 +0100,
Rui Pedro Caldeira wrote:

>Hello guys, I'm new to GTK+ and I've run into a problem when creating a
>ComboBox.
>
>I'm using GTK+ 2.24.18 and following the tutorial from this page:
>
>https://developer.gnome.org/gtk-tutorial/2.24/x1063.html
>
>But when I try to compile the code, it seems that none of the
>functions I call exists in the gtk.h file
>

To me it looks like GtkCombo is deprecated in favor of GtkComboBox:

According to
https://developer.gnome.org/gtk2/2.24/GtkCombo.html
:
"As of GTK+ 2.4, GtkCombo has been deprecated in favor of
GtkComboBoxEntry."

which links
https://developer.gnome.org/gtk2/2.24/GtkComboBoxEntry.html

GtkCombBoxEntry does also seem to be deprecated though, and GtkComboBox
seems to be what is supposed to be used. See

https://developer.gnome.org/gtk2/2.24/GtkComboBox.html
and
https://developer.gnome.org/gtk3/3.8/GtkComboBox.html

hope this helps -
-- Andreas Rönnquist
mailingli...@gusnan.se
gus...@gusnan.se
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: ComboBox

2013-06-27 Thread Rudra Banerjee
gtk+2 itself is old, and if there is no other reason, you should (since
you are new) use gtk+3.
The documentation is at https://developer.gnome.org/gtk3/3.8/

On Thu, 2013-06-27 at 14:46 +0100, Rui Pedro Caldeira wrote:
> Hello guys, I'm new to GTK+ and I've run into a problem when creating a
> ComboBox.
> 
> I'm using GTK+ 2.24.18 and following the tutorial from this page:
> 
> https://developer.gnome.org/gtk-tutorial/2.24/x1063.html
> 
> But when I try to compile the code, it seems that none of the functions I
> call exists in the gtk.h file
> 
> Output:
> 
> xxx.c: In function ‘XXX’:
> xxx.c:63:2: warning: implicit declaration of function ‘gtk_combo_new’
> [-Wimplicit-function-declaration]
> xxx.c:63:8: warning: assignment makes pointer from integer without a cast
> [enabled by default]
> xxx.c:65:2: warning: implicit declaration of function ‘GTK_COMBO’
> [-Wimplicit-function-declaration]
> xxx.c:65:101: error: invalid type argument of ‘->’ (have ‘int’)
> xxx.c:111:3: warning: statement with no effect [-Wunused-value]
> xxx.c:116:3: warning: format not a string literal and no format arguments
> [-Wformat-security]
> xxx.c:123:2: warning: implicit declaration of function
> ‘gtk_combo_set_popdown_strings’ [-Wimplicit-function-declaration]
> xxx.c:127:2: warning: implicit declaration of function
> ‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration]
> xxx.c:54:6: warning: unused variable ‘status’ [-Wunused-variable]
> 
> If you could help me I would be thankful
> 
> Best regards,
> Rui
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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

Re: ComboBox

2013-06-27 Thread Bernhard Schuster
gtk-2.24 is still "current" in CentOS/RedHat Enterprise/Scientific 
Linux and static linking might be not allowed due to license 
restrictions.


On Thu, Jun 27, 2013 at 6:09 PM, Rudra Banerjee 
 wrote:
gtk+2 itself is old, and if there is no other reason, you should 
(since

you are new) use gtk+3.
The documentation is at https://developer.gnome.org/gtk3/3.8/

On Thu, 2013-06-27 at 14:46 +0100, Rui Pedro Caldeira wrote:
 Hello guys, I'm new to GTK+ and I've run into a problem when 
creating a

 ComboBox.
 
 I'm using GTK+ 2.24.18 and following the tutorial from this page:
 
 https://developer.gnome.org/gtk-tutorial/2.24/x1063.html
 
 But when I try to compile the code, it seems that none of the 
functions I

 call exists in the gtk.h file
 
 Output:
 
 xxx.c: In function ‘XXX’:
 xxx.c:63:2: warning: implicit declaration of function 
‘gtk_combo_new’

 [-Wimplicit-function-declaration]
 xxx.c:63:8: warning: assignment makes pointer from integer without 
a cast

 [enabled by default]
 xxx.c:65:2: warning: implicit declaration of function 
‘GTK_COMBO’

 [-Wimplicit-function-declaration]
 xxx.c:65:101: error: invalid type argument of ‘->’ (have 
‘int’)

 xxx.c:111:3: warning: statement with no effect [-Wunused-value]
 xxx.c:116:3: warning: format not a string literal and no format 
arguments

 [-Wformat-security]
 xxx.c:123:2: warning: implicit declaration of function
 ‘gtk_combo_set_popdown_strings’ 
[-Wimplicit-function-declaration]

 xxx.c:127:2: warning: implicit declaration of function
 ‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration]
 xxx.c:54:6: warning: unused variable ‘status’ 
[-Wunused-variable]
 
 If you could help me I would be thankful
 
 Best regards,

 Rui
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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

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

Re: ComboBox

2013-06-27 Thread Rudra Banerjee


On Thu, 2013-06-27 at 16:42 +0002, Bernhard Schuster wrote:
> gtk-2.24 is still "current" in CentOS/RedHat Enterprise/Scientific
> Linux 

This List is probably long, I can add at least one more..SLED. thats
what I meant (including others) as "if there is no other reason"  :-)
> and static linking might be not allowed due to license restrictions.
> 
> On Thu, Jun 27, 2013 at 6:09 PM, Rudra Banerjee
>  wrote:
> > gtk+2 itself is old, and if there is no other reason, you should
> > (since you are new) use gtk+3. The documentation is at
> > https://developer.gnome.org/gtk3/3.8/ On Thu, 2013-06-27 at 14:46
> > +0100, Rui Pedro Caldeira wrote: 
> > Hello guys, I'm new to GTK+ and I've run into a problem when
> > creating a ComboBox. I'm using GTK+ 2.24.18 and following
> > the tutorial from this page:
> > https://developer.gnome.org/gtk-tutorial/2.24/x1063.html But
> > when I try to compile the code, it seems that none of the
> > functions I call exists in the gtk.h file Output: xxx.c: In
> > function ‘XXX’: xxx.c:63:2: warning: implicit declaration of
> > function ‘gtk_combo_new’ [-Wimplicit-function-declaration]
> > xxx.c:63:8: warning: assignment makes pointer from integer
> > without a cast [enabled by default] xxx.c:65:2: warning:
> > implicit declaration of function
> > ‘GTK_COMBO’ [-Wimplicit-function-declaration] xxx.c:65:101:
> > error: invalid type argument of ‘->’ (have ‘int’)
> > xxx.c:111:3: warning: statement with no effect
> > [-Wunused-value] xxx.c:116:3: warning: format not a string
> > literal and no format arguments [-Wformat-security]
> > xxx.c:123:2: warning: implicit declaration of function
> > ‘gtk_combo_set_popdown_strings’ [-Wimplicit-function-declaration] 
> > xxx.c:127:2: warning: implicit declaration of function 
> > ‘gtk_combo_set_use_arrows’ [-Wimplicit-function-declaration] xxx.c:54:6: 
> > warning: unused variable ‘status’ [-Wunused-variable] If you could help me 
> > I would be thankful Best regards, Rui 
> > ___ gtk-app-devel-list mailing 
> > list gtk-app-devel-list@gnome.org 
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> > ___ gtk-app-devel-list
> > mailing list gtk-app-devel-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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

Re: Invisible GtkImage

2013-06-27 Thread Andrew Potter
On Wed, Jun 26, 2013 at 2:51 PM, Kip Warner  wrote:
> On Mon, 2013-06-24 at 13:56 -0700, Andrew Potter wrote:
> So two questions now I have for you, if you don't mind. The first is a
> problem with clipping, the same one I experienced a few days ago. Note
> the assistant button widgets at the bottom of the assistant.
>
> Implementation:
> 

Please show the code that deals with the TextView and ScrolledWindow.
The clipping is almost certainly due to setting the minimum size on
either the TextView, or the GtkBox the two are contained in. I have
example GtkAssistant code at the bottom of this email that does not
exhibit this issue until extraordinarily small window sizes.

> The second is just a request for clarification on the min() calculation
> in your do_draw() override. I'd just like to better understand what that
> calculation is attempting to do.

When scaling an image, both its height and width are changing. In
order to fit the allocated rectangle without clipping, one must figure
out which dimension is smallest (normalized to the aspect ratio). For
example, if a 200x100 image is allocated 200x50, the allocation is
height-limited and the image must be scaled to 100x50. OTOH if
allocated 100x100, the image is width-limited and must be scaled to
100x50.

> ... Hopefully now if anyone else in the future wants to do
> something similar with an image in Gtk+, they'll manage to find this
> thread. Actually, it might even be worth adding on the FAQ.

I'm getting motivated to work on a patch to GtkImage to add scaling support...

-

Below is an example program with ScalableImage in a GtkAssistant.

Example 1, start up:
http://i.imgur.com/ZdqwUZG.jpg

Example 2, Resized to less height. Notice the TextView/ScrolledWindow
had plenty of space to "give up" because it has no minimum height
http://i.imgur.com/wTN5rY9.jpg

Example 3, Clipping occurs at this very small size due to minimum size
on the ScalableImage as well as the ScrolledWindow/TextView
http://i.imgur.com/EAzFYOG.jpg

Example 4, ScalableImage is modified to return a 0 minimum size in
get_preferred_height_for_width(). This means that at very small
heights the image will not have enough space to fill the allocated
width, allowing the other widgets get some space in this corner case.
http://i.imgur.com/ZrOPt75.jpg

It is your choice whether or not to allow your header image to become
smaller when the window is pressured for height.

#!/usr/bin/python
# coding=UTF-8
from gi.repository import Gtk, Gdk, GdkPixbuf

class ScalableImage(Gtk.DrawingArea):
def __init__(self, filename):
super(ScalableImage, self).__init__()
self.pb = GdkPixbuf.Pixbuf.new_from_file(filename)

def do_get_preferred_width(self):
pw = self.pb.get_width()
return (0, pw)

def do_get_preferred_height(self):
ph = self.pb.get_height()
return (0, ph)

def do_get_preferred_height_for_width(self, width):
ph = width / self.get_aspect_ratio()
return (0, ph)

def do_get_request_mode(self):
return Gtk.SizeRequestMode.HEIGHT_FOR_WIDTH

def get_aspect_ratio(self):
return self.pb.get_width() / self.pb.get_height()

def do_draw(self, cr):
alloc = self.get_allocation()
pw, ph = self.pb.get_width(), self.pb.get_height()
aw, ah = float(alloc.width), float(alloc.height)
r = min(aw/pw, ah/ph)
cr.scale(r, r)
Gdk.cairo_set_source_pixbuf(cr, self.pb, 0.0, 0.0)
cr.paint()
return False

bin = Gtk.Box(False)
bin.set_orientation(Gtk.Orientation.VERTICAL)

img = ScalableImage("gnome-logo.png")
bin.add(img)

tv = Gtk.TextView()
buf = tv.get_buffer()
buf.set_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.\
Quas enim kakaw Graeci appellant, vitia malo quam malitias nominare.\
Quod autem satis est, eo quicquid accessit, nimium est; Solum\
praeterea formosum, solum liberum, solum civem, stultost; Erat enim\
Polemonis. Conferam tecum, quam cuique verso rem subicias; Duo Reges:\
constructio interrete. Aufert enim sensus actionemque tollit\
omnem.\n\nQuae cum magnifice primo dici viderentur, considerata minus\
probabantur. In quibus doctissimi illi veteres inesse quiddam caeleste\
et divinum putaverunt. Dolere malum est: in crucem qui agitur, beatus\
esse non potest. Tu vero, inquam, ducas licet, si sequetur; Eademne,\
quae restincta siti? Sint modo partes vitae beatae. Sextilio Rufo, cum\
is rem ad amicos ita deferret, se esse heredem Q. Negat enim summo\
bono afferre incrementum diem. Sin te auctoritas commovebat, nobisne\
omnibus et Platoni ipsi nescio quem illum anteponebas?\n\nIstam\
voluptatem, inquit, Epicurus ignorat? Inde sermone vario sex illa a\
Dipylo stadia confecimus. Quam ob rem tandem, inquit, non satisfacit?\
Duae sunt enim res quoque, ne tu verba solum putes.\n\nComprehensum,\
quod cognitum non habet? Nunc ita separantur, ut disiuncta sint, quo\
nihil potest esse 

[GTK+2] gtk_widget_modify_bg() doesn't work on Windows

2013-06-27 Thread Alessandro Francesconi
Hello,

I have a piece of code that shows a matrix of 5x5 GtkButtons. 

Each one must be black or white.


I managed to do this with gtk_widget_modify_bg(), for example:


// prepare colors

GdkColor color_black, color_white;
gdk_color_parse ("black", &color_black);

gdk_color_parse ("white", &color_white);


// assign colors to some buttons...

gtk_widget_modify_bg(GTK_WIDGET(button1), GTK_STATE_NORMAL, &color_black);

gtk_widget_modify_bg(GTK_WIDGET(button2), GTK_STATE_NORMAL, &color_white);



This works under Linux, here is a pic: http://oi44.tinypic.com/5exx79.jpg

But on Windows (8 - 64bit with GTK+ 2.16) the result is this: 
http://oi40.tinypic.com/k00woj.jpg



Can you help me?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list