Re: change the colour of the bar in a progress bar

2006-03-24 Thread Gyözö Both
sure:

GtkWidget *progress_bar;
GdkColor color;

/* set color to your desired color, see
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Colormaps-and-Colors.html#id2611333
*/

gtk_widget_modify_bg(progress_bar, GTK_STATE_PRELIGHT, color);

at least, this is the way it worked a year ago or so (gtk+2, to be
sure).

gyözö

 Hi is it possible to change the colour of the bar in a progress bar?
 
 Cheers.
 
 --
 -- Yiannis
 


-- 
Q:  What do monsters eat?
A:  Things.

Q:  What do monsters drink?
A:  Coke.  (Because Things go better with Coke.)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Simple GDK app segfaults for unknown reason

2006-01-20 Thread Gyözö Both
hi,

i'd say you forgot to end the call with a NULL. also, as far as i know
the standard way to use GError is to have a 'GError *error;' variable
and then pass the pointer to it. in your case:

GError *error = NULL;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(input.jpg, error);
gdk_pixbuf_save(pixbuf, output.bmp, bmp, error, NULL);

but of course it doesn't make sense to use GError if you don't look at
the error variable afterwards; e.g. to display the error message if
there was an error and free the error variable with g_error_free. i use
in my projects a function to check GErrors (called every time i used a
function that i passed a GError to):

/**
   Print the contents of a GError (if it was set).
   If abort_program is TRUE, we free the memory
   and exit the game.
   @param error The GError we check.
   @param abort_program Whether or not we continue or exit the program.
*/
void
misc_print_error(GError **error, gboolean abort_program)
{
if(*error == NULL)
return;

g_warning(error message: %s\n, (*error)-message);
g_error_free(*error);
*error = NULL;

if(abort_program)
main_exit_program(EXIT_PRINT_ERROR, NULL);
}

i hope i could help.

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


tooltips on gtktreeview column headers

2005-11-29 Thread Gyözö Both
hello list,

the subject line says it all. is it possible to attach tooltips to the
column headers? if the answer is yes, how?

i didn't find anything useful with google or in the archives.

gyözö

-- 
There is no statute of limitations on stupidity.
-- Randomly produced by a computer program called Markov3.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


msgfmt -c

2005-09-19 Thread Gyözö Both
ah, thank you. this helped.

gyözö

 You're right, autogen.sh calls glib-gettextize with the --force option
 that will overwrite your changes.
 It looks like this Makefile don't need to be overwritten in your case.
 Try if this patch fit your needs.
 
 Cheers,
 
 Andy


-- 
panic(smp_callin() a\n);
linux-2.6.6/arch/parisc/kernel/smp.c
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkCellRendererCombo

2005-09-17 Thread Gyözö Both
hello,

i can't quite figure out how to use a cell renderer combo. what i'd
like to have is a treeview column with cells that contain some text and
an icon next to the text.

so, what i try to do is pack a column into the treeview along with a
GtkCellRendererCombo and a cell data function. in the cell data
function i create a liststore with a G_TYPE_STRING and a
GDK_TYPE_PIXBUF, fill it with a few rows, and do a

g_object_set(renderer, model, GTK_TREE_MODEL(ls), NULL);
g_object_unref(ls);

ls being my GtkListStore.

but i don't see any sign of text or icons in my treeview :-(

what is it i'm missing?

gyözö


-- 
It is the creationists who blasphemously are claiming that God is
cheating us in a stupid way.
-- J. W. Nienhuys
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


msgfmt -c

2005-09-16 Thread Gyözö Both
hello list,

this is a bit off-topic but on the other hand it isn't because a lot of people 
use glade and the code-generation feature.

to add a new language (po file) to my project, i simply edit configure.in and 
add the language code to 'ALL_LINGUAS', and the po file gets compiled when i 
'make'. now, how can i tell 'make' to compile with 'msgfmt -c'  -- instead of 
simply 'msgfmt' -- so that the po file is checked for format errors? (and in 
a way that my setting doesn't get overwritten next time i do an 
'./autogen.sh'!)

thanks,

gyozo

-- 
I refuse to have a battle of wits with an unarmed person.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Colors in a tree view

2005-08-29 Thread Gyözö Both
 Hi!
 
 I want to change the color of the text in single entries of a tree
 view. Does anybody know how to do this?
 
 Thanks,
 
   /Arne

i'm not sure what you mean by 'entry', but i know of two ways to
colour individual cells in a treeview:

1. use the markup property to render text
(gtk_tree_view_column_add_attribute(col, renderer, markup, colnumber))
and print text with pango markup (span background='white'
foreground='red'your text/span) into the cells.

2. use a custom cell renderer that sets the foreground property of
the renderer in the cell data function: g_object_set(renderer,
foreground, red, NULL).

gyözö

-- 
Ed Sullivan will be around as long as someone else has talent.
-- Fred Allen
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: glade and combo boxes

2005-08-24 Thread Gyözö Both
 when i create a combo box in glade 2.6.8, the c code generated uses
 gtk_combo_box_new_text() instead of gtk_combo_box_new(), which is what
 i'd like to have. is there some way to make glade use the latter
 function?
 
 i didn't give any strings to put into the box in glade.
 p.s.: please no solutions of the type 'use libglade' ;-)

Unfortunately using libglade is not a solution, as it also instantiates
the ComboBox this way.  So I suggest just using the resulting object
and
clearing out the renderers before using it with
gtk-cell-layout-clear().

thank you, this helped. i did call the clear function, but only after i
set the model, i guess that was bad.

gyözö

-- 
Everything should be built top-down, except the first time.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


glade and combo boxes

2005-08-21 Thread Gyözö Both
hi all,

when i create a combo box in glade 2.6.8, the c code generated uses
gtk_combo_box_new_text() instead of gtk_combo_box_new(), which is what
i'd like to have. is there some way to make glade use the latter
function?

i didn't give any strings to put into the box in glade.

cheers,

gyözö

p.s.: please no solutions of the type 'use libglade' ;-)

-- 
The last person that quit or was fired will be held responsible for
everything that goes wrong -- until the next person quits or is fired.
___
gtk-app-devel-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


RE: variables in g_signal_connect

2005-07-14 Thread Gyözö Both
use GINT_TO_POINTER:

Horizontal_Zoom_In_clicked(GtkWidget *widget, gpointer gt)
g_signal_connect ((gpointer) Horizontal_Zoom_In, clicked,
   G_CALLBACK
(Horizontal_Zoom_In_clicked), GINT_TO_POINTER(graph_type));

and GPOINTER_TO_INT(gt) in the callback to get the int value from the
pointer.

see also

http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html

gyozo

-- 
When you're not looking at it, this fortune is written in FORTRAN.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtkfilechooser buttons

2005-06-18 Thread Gyözö Both
so the buttons can't be changed after the window was created? the
gtkdialog reference says buttons can be added, but apparently not
removed, so i can't just remove the open button and add a save button,
i suppose :-P

well, maybe i'm going to create the window myself then, as you
suggested. thanks for your help,

gyz

 Mmh, no (sorry, I didn't read accurately your first question); all 
 buttons in the GtkFileChooserDialog can be controlled as well from 
 within the gtk_file_chooser_dialog_new function. Please, take a look
 at following examples:

-- 
Laws of Serendipity:

(1) In order to discover anything, you must be looking for
something.
(2) If you wish to make an improved product, you must already
be engaged in making an inferior one.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


gtkfilechooser buttons

2005-06-17 Thread Gyözö Both
hi,

i've created a filechooserdialog with glade, the default mode is open.

now i want to save files, too, so i create the window and set the mode
to save. everything works fine, but the button that confirms things
still reads 'open' (with the default open pixmap, a folder image).
shouldn't that be a 'save' button, with the floppy image? am i doing
something wrong?

i also tried to set the default mode (in glade) to 'save', but the
button's still 'open', even in 'save' mode.

note that the behaviour is fine, saving and loading work as expected.
only the apperance is weird.

my gtk version is 2.4.8.

gyz

-- 
Others will look to you for stability, so hide when you bite your
nails.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtkfilechooser buttons

2005-06-17 Thread Gyözö Both
 You can consider using a dinamically generated filechooser, instead
 of a statically generated one (i.e. that created by Glade) by means
 of gtk_file_chooser_dialog_new; in this way, you can select a 
 GTK_FILE_CHOOSER_ACTION_OPEN behaviour or a
 GTK_FILE_CHOOSER_ACTION_SAVE one, depending on your current operation.

well, the behaviour of the widget is all right. but why doesn't the
button image change when i set to save mode? i mean, the folder
browser and the other parts of the window are ok.

shouldn't the appearance of the filechooser widget change when i set
the action with gtk_file_chooser_set_action ?

gyz

-- 
Today is a good day to bribe a high-ranking public official.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkFileSelection deprecated?

2005-06-14 Thread Gyözö Both
hi,

is that widget deprecated in favour of the filechooser and filechooser
dialog? should i use these instead of the fileselection?

gyözö


-- 
At a recent meeting in Snowmass, Colorado, a participant from Los
Angeles fainted from hyperoxygenation, and we had to hold his head
under the exhaust of a bus until he revived.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkFileSelection deprecated?

2005-06-13 Thread Gyözö Both
hi,

is that widget deprecated in favour of the filechooser and filechooser
dialog? should i use these instead of the fileselection?

gyözö
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: launching web-browser

2005-05-21 Thread Gyözö Both
thanks for your answers. if possible, i'd like to have a solution that
only uses gtk/glib, i wouldn't want to have a gnome-dependency in my
app. is there a way?

gyözö

-- 
A new koan:

If you have some ice cream, I will give it to you.

If you have no ice cream, I will take it away from you.

It is an ice cream koan.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: How can I access gtk_tree_view declared in interface.c from callback.c ?

2005-05-19 Thread Gyözö Both
you have to do a

GtkTreeView *treeview1 = GTK_TREE_VIEW(lookup_widget(treeview1, 
GTK_WIDGET(menuitem)));

before you can use the treeview. as far as i know (i might be wrong) in the 
newer glade versions one cannot use the 'user_data' stuff in the callback 
functions.

the widgets aren't declared in the callback file, you have to look them up 
using a widget from the same window and 'lookup_widget' before you can use 
them.

gyözö

 Hi,

 I have a file interface.c where glade set up a gtk treeview named
 treeview1. When in callbacks.c I try to use treeview1 I got this error:

 callbacks.c: In function `on_new1_activate':
 callbacks.c:56: warning: dereferencing `void *' pointer
 callbacks.c:56: error: request for member `treeview1' in something not a
 structure or union

 This is the code:
 void on_new1_activate (GtkMenuItem *menuitem, gpointer user_data)
 {
   //qui devo creare un nuovo archivio.
   gchar *path = Show_File_Dialog ( FALSE );
   if (path == NULL) return;
   g_print (Hai scelto: %s\n,path);
   switch (ChoosenArchiveType)
   {
   case 0:
   g_print (Hai scelto: bzip2\n);
   break;
   case 1:
   g_print (Hai scelto: rar\n);
   break;
   case 2:
   g_print (Hai scelto: tar\n);
   break;
   case 3:
   g_print (Hai scelto: zip\n);
   break;
   default:
   break;
   }
   g_free (path);
 56:   user_data-treeview1 = NULL;- here I got the error
 }

 Thanks for the attention,

-- 
Ginsberg's Theorem:
(1) You can't win.
(2) You can't break even.
(3) You can't even quit the game.

Freeman's Commentary on Ginsberg's theorem:
Every major philosophy that attempts to make life seem
meaningful is based on the negation of one part of Ginsberg's
Theorem.  To wit:

(1) Capitalism is based on the assumption that you can win.
(2) Socialism is based on the assumption that you can break
even.
(3) Mysticism is based on the assumption that you can quit the
game.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


re: Simple XML Subset Parser

2005-05-15 Thread Gyözö Both
hi,

here's a short example with manually defined tags:

http://cvs.sourceforge.net/viewcvs.py/bygfoot/bygfoot2-unstable/src/xml_country.c?view=markup

and a corresponding xml file that can be parsed:

http://cvs.sourceforge.net/viewcvs.py/bygfoot/bygfoot2-unstable/support_files/definitions/england/country_england.xml?view=markup

if the xml files don't have to be edited by hand, one can
use an enum both for the tags and for the states. example (a part of
the load/save system; nobody tampers with the xml files manually, only
functions read and write them)::

http://cvs.sourceforge.net/viewcvs.py/bygfoot/bygfoot2-unstable/src/xml_loadsave_table.c?view=markup

all examples are taken from my football manager project,
http://bygfoot.sf.net.

cheers,

gyözö

-- 
Disclaimer: These opinions are my own, though for a small fee they be
yours too.
-- Dave Haynie

Hello,

I am trying to figure out how to use Simple XML Subset Parser
(http://developer.gnome.org/doc/API/2.0/glib/glib-Simple-XML-Subset-Par
ser.html). Can somebody point me to a simple example code? I don't know
how to start.

Thanks.


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


clearing a treeview

2005-04-30 Thread Gyözö Both
hello,

is there an easy one-line way to clear a treeview (so that adding new
content doesn't lead to the old content and the new one appearing side
by side)? currently i'm calling gtk_tree_view_remove_column for each
column; as far as i can remember, setting the model to NULL didn't work
:-/

gyözö both

-- 
Some performers on television appear to be horrible people, but when
you finally get to know them in person, they turn out to be even
worse.
-- Avery
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk-app-devel-list Digest, Vol 12, Issue 35

2005-04-18 Thread Gyözö Both
a bit easier would be to add a 

while(gtk_events_pending())
gtk_main_iteration();

after each update of the progress bar. that should force a visible update of 
the bar:

system(wget file.a);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pb1), 0.3);
while(gtk_events_pending())
gtk_main_iteration();

gyözö both

 You may use the pthread.h C library and use multiples threads to do
 what you want... I don't know exactly how to do it, but it is a way
 out for your problem!

 --
 André Pedralho
 Bachelor in Computer Science
 Instituto Nokia de Tecnologia

 On 4/18/05, Aristidas Vilkaitis [EMAIL PROTECTED] wrote:
  Hello,
 
    Since i'm quite new to both C and Gtk, i met a problem which i am not
  able to solve. The     base  of the problem is that i have a task, which
  should fetch several files from the internet. When a button is pressed,
  a new window with a progress bar opens and indicates the progress of the
  task. Basicly, since i thought C is a linear language, i just added
  several system() calls and added gtk_progress_bar_set_fraction between
  them like so:
 
  ...
    system(wget file.a);
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pb1), 0.3);
    system(wget file.b);
    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pb1), 0.6);  ...
 
  and so on.
 
  The result was that the program first executed the system calls, and
  only afterwards did it paint something or tampered with the progress bar.
 
  Why? How to go around this? What to read?

-- 
I suggest you locate your hot tub outside your house, so it won't do
too much damage if it catches fire or explodes.  First you decide which
direction your hot tub should face for maximum solar energy.  After
much trial and error, I have found that the best direction for a hot
tub to face is up.
-- Dave Barry, The Taming of the Screw
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: g_ptr_array_sort crash

2005-02-13 Thread Gyözö Both
you were right, the compare function was to blame. the error happened
because two integers that were the same weren't the same after some
transformations to float, so the function didn't return 0, as it should
have. a nasty bug, that one.

gyözö 

 This might be happening because your compare function is inconsistent,
 e.g.  when
 
player_compare_func (foo, bar, x)  returns a value  0
 and
player_compare_func (bar, foo, x)  returns 0  (instead of a value 
0)
 
 or 
player_compare_func (bar, bar, x)  returns a value != 0  (instead
of 0)
 
 or something similar. 
 
 Cheers
  -Tim
 


-- 
Just because your doctor has a name for your condition doesn't mean he
knows what it is.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


libglade vs. glade

2005-01-29 Thread Gyözö Both
ah, yes, i found this out, too, after browsing a bit (next time i browse
first and ask then, promise :-)). what i still don't know,
however, is what the advantages of using libglade instead of letting
glade generate the source files are -- besides having less to compile
and a smaller executable. or is this the main advantage?

and there's the disadvantage of a slower program startup, right?

gyözö

 Once you built the Glade xml file you can use the Build code
 function and to end with the source code built by Glade - It's what
 you're doing - or use the xml file directly through a library - called
 libglade - to build the UI from this file at runtime.
 
  so i don't know of this
  glade_xml_new function.
 
 You pass the xml glade file to this function to build the UI at
 runtime. GladeXML *xml = glade_xml_new(filename.glade, NULL, NULL);

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


Re: gtk-can-change-accels

2005-01-29 Thread Gyözö Both
i'd say this is not different from my code. as far as i can see, casting
GtkSettings* to GObject isn't mandatory, otherwise the program would
complain (and i use g_object_set on other variables without casting,
and it works fine). and as i don't have a shortcut file (i can't have
one if changing the shortcuts doesn't work in the first place), i don't
load it. but this shouldn't prevent the whole system of changing the
shortcuts from working.

i used my code after creating the main window, which contains the menu.
so my code comes also after creating the menu.

gyözö

 I use the following code *after* I create the main menu:
 
 {
   GtkSettings* gtksettings = gtk_settings_get_default();
   g_object_set(G_OBJECT(gtksettings), gtk-can-change-accels,
   TRUE, NULL);  gtk_accel_map_load(shortcutfilename);
 }
 
 it works, but I don't use glade

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


Re: gtk-can-change-accels

2005-01-28 Thread Gyözö Both
hum... i'm not using non-GtkWindows. at least as far as i know. my app
is a rather simple and straightforward thingy with all interface files
created by glade 2 (i'm not even sure what the difference between
libglade and glade is; or, what libglade is). so i don't know of this
glade_xml_new function.

it's not an important aspect anyway; it's just that i've been using
sylpheed lately and i like the shortcut handling a lot.

thanks for your help,

gyözö

  i'm writing a gtk+2 application (the interface of which gets created
by 
  glade), and i'd like to make use of this magnificent feature that
allows 
  users to change the keyboard shortcuts by hovering on a menu entry
with the 
  mouse and pressing the buttons.
 
 It may not be related, but libglade is broken WRT accelerator
 support... http://bugzilla.gnome.org/show_bug.cgi?id=129846
 
 (AFAICT loses the AccelGroup during reparenting.  I've not had a
 chance to look into libglade itself yet.)  This is probably only an
 issue when using a non-GtkWindow root with glade_xml_new*.
 
 
 Regards,
 Roger
 
 - -- 
 Roger Leigh
 Printing on GNU/Linux? 
http://gimp-print.sourceforge.net/
 Debian GNU/Linuxhttp://www.debian.org/
 GPG Public Key: 0x25BFB848.  Please sign and encrypt
your mail.
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.2.5 (GNU/Linux)
 Comment: Processed by Mailcrypt 3.5.8
http://mailcrypt.sourceforge.net/
 
 iD8DBQFB+qdhVcFcaSW/uEgRAgOHAKDtsOpf7MgoLuuJwsEJ8Y+w/znktwCfeHVB
 nndfM8fz912m0kyk5XURyWM=
 =XqA7
 -END PGP SIGNATURE-
 


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